diff options
Diffstat (limited to 'lib/Core/ExternalDispatcher.cpp')
-rw-r--r-- | lib/Core/ExternalDispatcher.cpp | 18 |
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. |