about summary refs log tree commit diff homepage
path: root/lib
diff options
context:
space:
mode:
authorJiri Slaby <jirislaby@gmail.com>2018-07-20 10:06:29 +0200
committerMartinNowack <martin.nowack@gmail.com>2018-10-26 13:31:07 +0100
commit0c0e1045b4f784e0f72fd1286a97c7701152d412 (patch)
tree33f8c95bd64bf8d085f1ca6bde4beee5cebab4f4 /lib
parent0a7963e0dd119285b9730473ba417d181583ad0a (diff)
downloadklee-0c0e1045b4f784e0f72fd1286a97c7701152d412.tar.gz
llvm5: CallSite.paramHasAttr is indexed from 0
Since LLVM 5 commit 1f8f0490690b, CallSite.paramHasAttr is indexed from
0, so make sure we use correct indexing in klee. And use
CallSite.hasRetAttr for return attributes.

Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/Core/Executor.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/Core/Executor.cpp b/lib/Core/Executor.cpp
index 24211453..2e5b864c 100644
--- a/lib/Core/Executor.cpp
+++ b/lib/Core/Executor.cpp
@@ -1531,7 +1531,11 @@ void Executor::executeInstruction(ExecutionState &state, KInstruction *ki) {
                            CallSite(cast<CallInst>(caller)));
 
             // XXX need to check other param attrs ?
-      bool isSExt = cs.paramHasAttr(0, llvm::Attribute::SExt);
+#if LLVM_VERSION_CODE >= LLVM_VERSION(5, 0)
+            bool isSExt = cs.hasRetAttr(llvm::Attribute::SExt);
+#else
+            bool isSExt = cs.paramHasAttr(0, llvm::Attribute::SExt);
+#endif
             if (isSExt) {
               result = SExtExpr::create(result, to);
             } else {
@@ -1829,7 +1833,11 @@ void Executor::executeInstruction(ExecutionState &state, KInstruction *ki) {
 
             if (from != to) {
               // XXX need to check other param attrs ?
+#if LLVM_VERSION_CODE >= LLVM_VERSION(5, 0)
+              bool isSExt = cs.paramHasAttr(i, llvm::Attribute::SExt);
+#else
               bool isSExt = cs.paramHasAttr(i+1, llvm::Attribute::SExt);
+#endif
               if (isSExt) {
                 arguments[i] = SExtExpr::create(arguments[i], to);
               } else {