about summary refs log tree commit diff homepage
diff options
context:
space:
mode:
authorMartin Nowack <martin@se.inf.tu-dresden.de>2013-11-13 23:57:41 +0100
committerDan Liew <daniel.liew@imperial.ac.uk>2013-12-19 15:45:03 +0000
commitf8a0a98bfdeb3c9bb903a549042c2da322c753b5 (patch)
tree846626833bac6c801ac4617818a415883d572e11
parent17ec611bb5ada13350a72f2e1de439499128c62f (diff)
downloadklee-f8a0a98bfdeb3c9bb903a549042c2da322c753b5.tar.gz
Replicate debug information from checked instructions to checker call.
-rw-r--r--lib/Module/Checks.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/lib/Module/Checks.cpp b/lib/Module/Checks.cpp
index 79fd4afc..bf37eea2 100644
--- a/lib/Module/Checks.cpp
+++ b/lib/Module/Checks.cpp
@@ -82,8 +82,13 @@ bool DivCheckPass::runOnModule(Module &M) {
                                                    NULL);
               divZeroCheckFunction = cast<Function>(fc);
             }
-
+#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 0)
+            CallInst * ci =
+#endif
 	    CallInst::Create(divZeroCheckFunction, denominator, "", &*i);
+#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 0)
+            ci->setDebugLoc(binOp->getDebugLoc());
+#endif
             moduleChanged = true;
           }
         }
@@ -139,7 +144,9 @@ bool OvershiftCheckPass::runOnModule(Module &M) {
 
             // Inject CallInstr to check if overshifting possible
 #if LLVM_VERSION_CODE >= LLVM_VERSION(3, 0)
-            CallInst::Create(overshiftCheckFunction, args, "", &*i);
+            CallInst * ci = CallInst::Create(overshiftCheckFunction, args, "", &*i);
+            // set debug information from binary operand to preserve it
+            ci->setDebugLoc(binOp->getDebugLoc());
 #else
             CallInst::Create(overshiftCheckFunction, args.begin(), args.end(), "", &*i);
 #endif