llvm-project/clang/lib
Stepan Dyatkovskiy 5fecf54460 Compatability fix for SwitchInst refactoring.
The purpose of refactoring is to hide operand roles from SwitchInst user (programmer). If you want to play with operands directly, probably you will need lower level methods than SwitchInst ones (TerminatorInst or may be User). After this patch we can reorganize SwitchInst operands and successors as we want.

What was done:

1. Changed semantics of index inside the getCaseValue method:
getCaseValue(0) means "get first case", not a condition. Use getCondition() if you want to resolve the condition. I propose don't mix SwitchInst case indexing with low level indexing (TI successors indexing, User's operands indexing), since it may be dangerous.
2. By the same reason findCaseValue(ConstantInt*) returns actual number of case value. 0 means first case, not default. If there is no case with given value, ErrorIndex will returned.
3. Added getCaseSuccessor method. I propose to avoid usage of TerminatorInst::getSuccessor if you want to resolve case successor BB. Use getCaseSuccessor instead, since internal SwitchInst organization of operands/successors is hidden and may be changed in any moment.
4. Added resolveSuccessorIndex and resolveCaseIndex. The main purpose of these methods is to see how case successors are really mapped in TerminatorInst.
4.1 "resolveSuccessorIndex" was created if you need to level down from SwitchInst to TerminatorInst. It returns TerminatorInst's successor index for given case successor.
4.2 "resolveCaseIndex" converts low level successors index to case index that curresponds to the given successor.

Note: There are also related compatability fix patches for dragonegg, klee, llvm-gcc-4.0, llvm-gcc-4.2, safecode, clang.
llvm-svn: 149482
2012-02-01 07:50:21 +00:00
..
ARCMigrate arc migrator: twik previous patch to exclude user provided 2012-01-31 22:09:44 +00:00
AST Remove redundant checks in CXXRecordDecl::isCLike(), as suggested by Sebastian. 2012-02-01 06:36:44 +00:00
Analysis Format string warnings: don't a.k.a. wchar_t with wchar_t. 2012-01-31 14:59:59 +00:00
Basic Use the new Triple::getMacOSXVersion function in another place. 2012-01-31 23:52:58 +00:00
CodeGen Compatability fix for SwitchInst refactoring. 2012-02-01 07:50:21 +00:00
Driver Use new Triple::getMacOSXVersion function. 2012-01-31 22:43:59 +00:00
Frontend Split compiler builtin module into "stdlib" builtins and "intrinsic" 2012-01-31 21:57:50 +00:00
FrontendTool Introduce 3 new fixit options: 2012-01-26 02:40:48 +00:00
Headers Split compiler builtin module into "stdlib" builtins and "intrinsic" 2012-01-31 21:57:50 +00:00
Index More dead code removal (using -Wunreachable-code) 2012-01-20 21:50:17 +00:00
Lex fix a crash on: 2012-01-31 18:53:44 +00:00
Parse Implement code completion support for module import declarations, e.g., 2012-01-29 18:15:03 +00:00
Rewrite In FixItRecompile::BeginInvocation() reset the diagnostics before executing 2012-01-27 06:15:37 +00:00
Sema When providing code completions for a switch over a scoped enumeration 2012-02-01 05:02:47 +00:00
Serialization Thread a TargetInfo through to the module map; we'll need it for 2012-01-30 06:01:29 +00:00
StaticAnalyzer Fix an assertion failure in isMacOSXVersionLT for IOS targets. 2012-01-31 23:52:54 +00:00
CMakeLists.txt The ARC Migration Tool. All the credit goes to Argyrios and Fariborz 2011-06-15 23:25:17 +00:00
Makefile The ARC Migration Tool. All the credit goes to Argyrios and Fariborz 2011-06-15 23:25:17 +00:00