about summary refs log tree commit diff homepage
path: root/lib/Module
diff options
context:
space:
mode:
authorLukas Zaoral <lzaoral@redhat.com>2020-09-10 17:14:42 +0200
committerCristian Cadar <c.cadar@imperial.ac.uk>2020-12-04 20:35:47 +0000
commit30336015ff88298f38841efa1e0dd120e71f2f67 (patch)
tree8224e8274443bdb68a2669a4d8f594007870bc7d /lib/Module
parentb398c94c821edd3e8699026dc00501062eafd5b2 (diff)
downloadklee-30336015ff88298f38841efa1e0dd120e71f2f67.tar.gz
llvm11: Use getCalledOperand instead of getCalledValue
CallBase::getCalledValue has been deprecated by getCalledOperand since LLVM 8
and has been removed in LLVM 11

See: https://reviews.llvm.org/D78882
Diffstat (limited to 'lib/Module')
-rw-r--r--lib/Module/KModule.cpp5
-rw-r--r--lib/Module/ModuleUtil.cpp4
-rw-r--r--lib/Module/RaiseAsm.cpp4
3 files changed, 11 insertions, 2 deletions
diff --git a/lib/Module/KModule.cpp b/lib/Module/KModule.cpp
index b16be68a..50bb28bb 100644
--- a/lib/Module/KModule.cpp
+++ b/lib/Module/KModule.cpp
@@ -475,13 +475,14 @@ KFunction::KFunction(llvm::Function *_function,
       if (isa<CallInst>(it) || isa<InvokeInst>(it)) {
 #if LLVM_VERSION_CODE >= LLVM_VERSION(8, 0)
         const CallBase &cs = cast<CallBase>(*inst);
+        Value *val = cs.getCalledOperand();
 #else
         const CallSite cs(inst);
+        Value *val = cs.getCalledValue();
 #endif
         unsigned numArgs = cs.arg_size();
         ki->operands = new int[numArgs+1];
-        ki->operands[0] = getOperandNum(cs.getCalledValue(), registerMap, km,
-                                        ki);
+        ki->operands[0] = getOperandNum(val, registerMap, km, ki);
         for (unsigned j=0; j<numArgs; j++) {
           Value *v = cs.getArgOperand(j);
           ki->operands[j+1] = getOperandNum(v, registerMap, km, ki);
diff --git a/lib/Module/ModuleUtil.cpp b/lib/Module/ModuleUtil.cpp
index 7cd66415..2c855261 100644
--- a/lib/Module/ModuleUtil.cpp
+++ b/lib/Module/ModuleUtil.cpp
@@ -285,7 +285,11 @@ Function *klee::getDirectCallTarget(
     const CallSite &cs,
 #endif
     bool moduleIsFullyLinked) {
+#if LLVM_VERSION_CODE >= LLVM_VERSION(8, 0)
+  Value *v = cs.getCalledOperand();
+#else
   Value *v = cs.getCalledValue();
+#endif
   bool viaConstantExpr = false;
   // Walk through aliases and bitcasts to try to find
   // the function being called.
diff --git a/lib/Module/RaiseAsm.cpp b/lib/Module/RaiseAsm.cpp
index 3de28f4d..ff4c2467 100644
--- a/lib/Module/RaiseAsm.cpp
+++ b/lib/Module/RaiseAsm.cpp
@@ -48,7 +48,11 @@ bool RaiseAsmPass::runOnInstruction(Module &M, Instruction *I) {
   if (!ci)
     return false;
 
+#if LLVM_VERSION_CODE >= LLVM_VERSION(8, 0)
+  InlineAsm *ia = dyn_cast<InlineAsm>(ci->getCalledOperand());
+#else
   InlineAsm *ia = dyn_cast<InlineAsm>(ci->getCalledValue());
+#endif
   if (!ia)
     return false;