about summary refs log tree commit diff homepage
diff options
context:
space:
mode:
authorJiri Slaby <jirislaby@gmail.com>2018-01-15 10:24:48 +0100
committerMartinNowack <martin.nowack@gmail.com>2018-02-01 10:04:11 +0100
commit46b144492c54a14004b0a982948610ff47f72743 (patch)
treec7b9207151562e4ef24755f8276cd8459fd7f5a8
parentc4a8b2901160568fba95b33d73a7792e0ba32c50 (diff)
downloadklee-46b144492c54a14004b0a982948610ff47f72743.tar.gz
llvm50: use auto variable instead of SwitchInst::CaseIt
llvm50 changed the semantics of SwitchInst::CaseIt and started using
"auto" variable type. So use it here too for all versions greater than
3.4 -- 3.4 does not support this semantics yet.

Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
-rw-r--r--lib/Core/Executor.cpp4
-rw-r--r--lib/Module/LowerSwitch.cpp6
2 files changed, 9 insertions, 1 deletions
diff --git a/lib/Core/Executor.cpp b/lib/Core/Executor.cpp
index be92b16a..fe53fc9b 100644
--- a/lib/Core/Executor.cpp
+++ b/lib/Core/Executor.cpp
@@ -1553,8 +1553,12 @@ void Executor::executeInstruction(ExecutionState &state, KInstruction *ki) {
       std::map<ref<Expr>, BasicBlock *> expressionOrder;
 
       // Iterate through all non-default cases and order them by expressions
+#if LLVM_VERSION_CODE > LLVM_VERSION(3, 4)
+      for (auto i : si->cases()) {
+#else
       for (SwitchInst::CaseIt i = si->case_begin(), e = si->case_end(); i != e;
            ++i) {
+#endif
         ref<Expr> value = evalConstant(i.getCaseValue());
 
         BasicBlock *caseSuccessor = i.getCaseSuccessor();
diff --git a/lib/Module/LowerSwitch.cpp b/lib/Module/LowerSwitch.cpp
index 1a194245..0f4e8b1e 100644
--- a/lib/Module/LowerSwitch.cpp
+++ b/lib/Module/LowerSwitch.cpp
@@ -114,8 +114,12 @@ void LowerSwitchPass::processSwitchInst(SwitchInst *SI) {
   }
   
   CaseVector cases;
-  
+
+#if LLVM_VERSION_CODE > LLVM_VERSION(3, 4)
+  for (auto i : SI->cases())
+#else
   for (SwitchInst::CaseIt i = SI->case_begin(), e = SI->case_end(); i != e; ++i)
+#endif
     cases.push_back(SwitchCase(i.getCaseValue(),
                                i.getCaseSuccessor()));