llvm/lib
Stepan Dyatkovskiy c10fa6c801 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.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152297 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-08 07:06:20 +00:00
..
Analysis Taken into account Duncan's comments for r149481 dated by 2nd Feb 2012: 2012-03-08 07:06:20 +00:00
Archive Avoid using an invalidated iterator. 2012-01-23 05:07:16 +00:00
AsmParser Convert assert(0) to llvm_unreachable 2012-02-07 05:05:23 +00:00
Bitcode Taken into account Duncan's comments for r149481 dated by 2nd Feb 2012: 2012-03-08 07:06:20 +00:00
CodeGen Taken into account Duncan's comments for r149481 dated by 2nd Feb 2012: 2012-03-08 07:06:20 +00:00
DebugInfo More dead code removal (using -Wunreachable-code) 2012-01-20 21:51:11 +00:00
ExecutionEngine Taken into account Duncan's comments for r149481 dated by 2nd Feb 2012: 2012-03-08 07:06:20 +00:00
Linker Include cctype for isdigit. Patch by Stephen Hines. 2012-03-03 09:36:58 +00:00
MC Make MCRegisterInfo available to the the MCInstPrinter. 2012-03-05 19:33:20 +00:00
Object [Object] 2012-03-01 22:19:54 +00:00
Support Revert r152288, "[ADT] Change the trivial FoldingSetNodeID::Add* methods to be 2012-03-08 04:17:15 +00:00
TableGen Fix infinite loop in nested multiclasses. 2012-03-07 16:39:35 +00:00
Target Taken into account Duncan's comments for r149481 dated by 2nd Feb 2012: 2012-03-08 07:06:20 +00:00
Transforms Taken into account Duncan's comments for r149481 dated by 2nd Feb 2012: 2012-03-08 07:06:20 +00:00
VMCore Taken into account Duncan's comments for r149481 dated by 2nd Feb 2012: 2012-03-08 07:06:20 +00:00
CMakeLists.txt
LLVMBuild.txt
Makefile