Go to file
Stepan Dyatkovskiy 85fcc2daf5 Taken into account Duncan's comments for r149481 dated by 2nd Feb 2012:
http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20120130/136146.html

Implemented CaseIterator and it solves almost all described issues: we don't need to mix operand/case/successor indexing anymore. Base iterator class is implemented as a template since it may be initialized either from "const SwitchInst*" or from "SwitchInst*".

ConstCaseIt is just a read-only iterator.
CaseIt is read-write iterator; it allows to change case successor and case value.

Usage of iterator allows totally remove resolveXXXX methods. All indexing convertions done automatically inside the iterator's getters.

Main way of iterator usage looks like this:
SwitchInst *SI = ... // intialize it somehow

for (SwitchInst::CaseIt i = SI->caseBegin(), e = SI->caseEnd(); i != e; ++i) {
  BasicBlock *BB = i.getCaseSuccessor();
  ConstantInt *V = i.getCaseValue();
  // Do something.
}

If you want to convert case number to TerminatorInst successor index, just use getSuccessorIndex iterator's method.
If you want initialize iterator from TerminatorInst successor index, use CaseIt::fromSuccessorIndex(...) method.

There are also related changes in llvm-clients: klee and clang.

llvm-svn: 152298
2012-03-08 07:06:48 +00:00
clang Taken into account Duncan's comments for r149481 dated by 2nd Feb 2012: 2012-03-08 07:06:48 +00:00
compiler-rt [ASan] Fix lint warning 2012-03-07 11:33:15 +00:00
debuginfo-tests Revert previous patch as the corresponding clang patch was reverted. 2012-01-26 07:01:33 +00:00
libclc Switch to BSD/MIT dual license. 2012-02-22 04:47:39 +00:00
libcxx Change some smart_ptr == 0 to smart_ptr == nullptr. Fixes http://llvm.org/bugs/show_bug.cgi?id=12185. 2012-03-07 20:37:43 +00:00
libcxxabi First attempt at arm support. 2012-02-29 22:14:19 +00:00
lld Sources now require C++11 to build. 2012-03-08 00:18:30 +00:00
lldb Bumping Xcode project version for lldb-124 and debugserver-175. 2012-03-08 04:15:20 +00:00
llvm Taken into account Duncan's comments for r149481 dated by 2nd Feb 2012: 2012-03-08 07:06:20 +00:00
polly Dependences: Simplify isParallelDimension 2012-03-07 17:42:49 +00:00