This patch propagates the debug location info when c++ function calls are lowered. It allows to generate proper debug location info for e.g. the c backend (so you can map instructions back to the original c++ code).

Since it's fairly trivial I have not added a test case. If you require one anyways please let me know.

Alex
Index: lib/Transforms/Utils/LowerInvoke.cpp
===================================================================
--- lib/Transforms/Utils/LowerInvoke.cpp	(revision 116700)
+++ lib/Transforms/Utils/LowerInvoke.cpp	(working copy)
@@ -187,6 +187,11 @@
       NewCall->takeName(II);
       NewCall->setCallingConv(II->getCallingConv());
       NewCall->setAttributes(II->getAttributes());
+
+      Instruction* pOI=static_cast<Instruction*>(II);
+      Instruction* pNI=static_cast<Instruction*>(NewCall);
+      pNI->setDebugLoc(pOI->getDebugLoc());
+
       II->replaceAllUsesWith(NewCall);
 
       // Insert an unconditional branch to the normal destination.
@@ -267,6 +272,11 @@
   NewCall->takeName(II);
   NewCall->setCallingConv(II->getCallingConv());
   NewCall->setAttributes(II->getAttributes());
+
+  Instruction* pOI=static_cast<Instruction*>(II);
+  Instruction* pNI=static_cast<Instruction*>(NewCall);
+  pNI->setDebugLoc(pOI->getDebugLoc());
+
   II->replaceAllUsesWith(NewCall);
 
   // Replace the invoke with an uncond branch.
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to