[llvm-commits] [llvm-gcc-4.2] r86860 - /llvm-gcc-4.2/trunk/gcc/llvm-debug.cpp

Devang Patel dpatel at apple.com
Wed Nov 11 11:07:28 PST 2009


Author: dpatel
Date: Wed Nov 11 13:07:28 2009
New Revision: 86860

URL: http://llvm.org/viewvc/llvm-project?rev=86860&view=rev
Log:
Create new location to attach with llvm.dbg.declare. This location is only used to find the context of the variable by the code generator.

Modified:
    llvm-gcc-4.2/trunk/gcc/llvm-debug.cpp

Modified: llvm-gcc-4.2/trunk/gcc/llvm-debug.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-debug.cpp?rev=86860&r1=86859&r2=86860&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/llvm-debug.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-debug.cpp Wed Nov 11 13:07:28 2009
@@ -333,7 +333,15 @@
   // Insert an llvm.dbg.declare into the current block.
   Instruction *Call = DebugFactory.InsertDeclare(AI, D, 
                                                  Builder.GetInsertBlock());
-  Builder.SetDebugLocation(Call);
+
+#ifdef ATTACH_DEBUG_INFO_TO_AN_INSN
+    llvm::DIDescriptor DR = RegionStack.back();
+    llvm::DIScope DS = llvm::DIScope(DR.getNode());
+    llvm::DILocation DO(NULL);
+    llvm::DILocation DL = 
+      DebugFactory.CreateLocation(CurLineNo, 0 /* column */, DS, DO);
+    Builder.SetDebugLocation(Call, DL.getNode());
+#endif
 }
 
 





More information about the llvm-commits mailing list