klee/0021-llvm50-SwitchInst-case-functions-now-return-pointers.patch

36 lines
1.4 KiB
Diff

From: Jiri Slaby <jirislaby@gmail.com>
Date: Mon, 15 Jan 2018 10:38:35 +0100
Subject: llvm50: SwitchInst case functions now return pointers
Patch-mainline: no
Starting llvm 5, SwitchInst->findCaseValue() now has to be dereferenced
using ->. So do so, otherwise we see:
../lib/Core/Executor.cpp:1598:38: error: no member named 'getCaseSuccessor' in 'llvm::SwitchInst::CaseIteratorImpl<llvm::SwitchInst::CaseHandle>'; did you mean to use '->' instead of '.'?
BasicBlock *caseSuccessor = i.getCaseSuccessor();
^
Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
---
lib/Core/Executor.cpp | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/lib/Core/Executor.cpp b/lib/Core/Executor.cpp
index f994a82e2df7..bca2eb6e06a7 100644
--- a/lib/Core/Executor.cpp
+++ b/lib/Core/Executor.cpp
@@ -1641,7 +1641,11 @@ void Executor::executeInstruction(ExecutionState &state, KInstruction *ki) {
// switch to an internal rep.
llvm::IntegerType *Ty = cast<IntegerType>(si->getCondition()->getType());
ConstantInt *ci = ConstantInt::get(Ty, CE->getZExtValue());
+#if LLVM_VERSION_CODE >= LLVM_VERSION(5, 0)
+ unsigned index = si->findCaseValue(ci)->getSuccessorIndex();
+#else
unsigned index = si->findCaseValue(ci).getSuccessorIndex();
+#endif
transferToBasicBlock(si->getSuccessor(index), si->getParent(), state);
} else {
// Handle possible different branch targets
--
2.17.1