aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/Core/ExternalDispatcher.cpp
diff options
context:
space:
mode:
authorLukas Zaoral <lzaoral@redhat.com>2020-09-12 11:02:29 +0200
committerCristian Cadar <c.cadar@imperial.ac.uk>2020-09-26 21:31:49 +0100
commit3983b23eac93b0e6f28ffba4b626401c5280c10f (patch)
tree5589ff2a11f892cb4911c235e7856ef965cc4059 /lib/Core/ExternalDispatcher.cpp
parente9aaebb43b5789692377e7b367813e8b3b728484 (diff)
downloadklee-3983b23eac93b0e6f28ffba4b626401c5280c10f.tar.gz
Replace llvm::CallSite with llvm::CallBase on LLVM 8+
This is in preparation for LLVM 11 as the llvm:CallSite class has been removed.
Diffstat (limited to 'lib/Core/ExternalDispatcher.cpp')
-rw-r--r--lib/Core/ExternalDispatcher.cpp18
1 files changed, 10 insertions, 8 deletions
diff --git a/lib/Core/ExternalDispatcher.cpp b/lib/Core/ExternalDispatcher.cpp
index 2b537b7d..7ba8df53 100644
--- a/lib/Core/ExternalDispatcher.cpp
+++ b/lib/Core/ExternalDispatcher.cpp
@@ -10,7 +10,9 @@
#include "ExternalDispatcher.h"
#include "klee/Config/Version.h"
+#if LLVM_VERSION_CODE < LLVM_VERSION(8, 0)
#include "llvm/IR/CallSite.h"
+#endif
#include "llvm/IR/Constants.h"
#include "llvm/IR/DerivedTypes.h"
#include "llvm/IR/IRBuilder.h"
@@ -256,12 +258,13 @@ Function *ExternalDispatcherImpl::createDispatcher(Function *target,
if (!resolveSymbol(target->getName()))
return 0;
- CallSite cs;
- if (inst->getOpcode() == Instruction::Call) {
- cs = CallSite(cast<CallInst>(inst));
- } else {
- cs = CallSite(cast<InvokeInst>(inst));
- }
+#if LLVM_VERSION_CODE >= LLVM_VERSION(8, 0)
+ const CallBase &cs = cast<CallBase>(*inst);
+#else
+ const CallSite cs(inst->getOpcode() == Instruction::Call
+ ? CallSite(cast<CallInst>(inst))
+ : CallSite(cast<InvokeInst>(inst)));
+#endif
Value **args = new Value *[cs.arg_size()];
@@ -292,8 +295,7 @@ Function *ExternalDispatcherImpl::createDispatcher(Function *target,
// Each argument will be passed by writing it into gTheArgsP[i].
unsigned i = 0, idx = 2;
- for (CallSite::arg_iterator ai = cs.arg_begin(), ae = cs.arg_end(); ai != ae;
- ++ai, ++i) {
+ for (auto ai = cs.arg_begin(), ae = cs.arg_end(); ai != ae; ++ai, ++i) {
// Determine the type the argument will be passed as. This accommodates for
// the corresponding code in Executor.cpp for handling calls to bitcasted
// functions.