[cfe-commits] r92228 - in /cfe/trunk/lib/CodeGen: CGDebugInfo.cpp CodeGenModule.cpp

Chris Lattner sabre at nondot.org
Mon Dec 28 13:44:42 PST 2009


Author: lattner
Date: Mon Dec 28 15:44:41 2009
New Revision: 92228

URL: http://llvm.org/viewvc/llvm-project?rev=92228&view=rev
Log:
this form of SetDebugLocation is about to go away, add some #includes that
are about to not come in implicitly.

Modified:
    cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
    cfe/trunk/lib/CodeGen/CodeGenModule.cpp

Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=92228&r1=92227&r2=92228&view=diff

==============================================================================
--- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Mon Dec 28 15:44:41 2009
@@ -26,6 +26,7 @@
 #include "llvm/DerivedTypes.h"
 #include "llvm/Instructions.h"
 #include "llvm/Intrinsics.h"
+#include "llvm/LLVMContext.h"
 #include "llvm/Module.h"
 #include "llvm/ADT/StringExtras.h"
 #include "llvm/ADT/SmallVector.h"
@@ -1216,9 +1217,12 @@
 
   llvm::DIScope DS(RegionStack.back());
   llvm::DILocation DO(NULL);
-  llvm::DILocation DL = 
-    DebugFactory.CreateLocation(Line, Column, DS, DO);
-  Builder.SetDebugLocation(Call, DL.getNode());
+  llvm::DILocation DL = DebugFactory.CreateLocation(Line, Column, DS, DO);
+  
+  // TODO: Remove #include of LLVMContext from this.
+  llvm::LLVMContext &Context = Call->getContext();
+  unsigned DbgMDKind = Context.getMetadata().getMDKindID("dbg");
+  Context.getMetadata().addMD(DbgMDKind, DL.getNode(), Call);
 }
 
 /// EmitDeclare - Emit local variable declaration debug info.
@@ -1419,7 +1423,12 @@
   llvm::DILocation DO(NULL);
   llvm::DILocation DL = 
     DebugFactory.CreateLocation(Line, PLoc.getColumn(), DS, DO);
-  Builder.SetDebugLocation(Call, DL.getNode());
+  
+  // TODO: Remove #include of LLVMContext from this.
+  llvm::LLVMContext &Context = Call->getContext();
+  unsigned DbgMDKind = Context.getMetadata().getMDKindID("dbg");
+  Context.getMetadata().addMD(DbgMDKind, DL.getNode(), Call);
+  
 }
 
 void CGDebugInfo::EmitDeclareOfAutoVariable(const VarDecl *Decl,

Modified: cfe/trunk/lib/CodeGen/CodeGenModule.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenModule.cpp?rev=92228&r1=92227&r2=92228&view=diff

==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenModule.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenModule.cpp Mon Dec 28 15:44:41 2009
@@ -30,6 +30,7 @@
 #include "llvm/CallingConv.h"
 #include "llvm/Module.h"
 #include "llvm/Intrinsics.h"
+#include "llvm/LLVMContext.h"
 #include "llvm/Target/TargetData.h"
 #include "llvm/Support/ErrorHandling.h"
 using namespace clang;
@@ -1089,9 +1090,7 @@
       CI->replaceAllUsesWith(NewCall);
 
     // Copy any custom metadata attached with CI.
-    llvm::MetadataContext &TheMetadata = CI->getContext().getMetadata();
-    TheMetadata.copyMD(CI, NewCall);
-
+    CI->getContext().getMetadata().copyMD(CI, NewCall);
     CI->eraseFromParent();
   }
 }





More information about the cfe-commits mailing list