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

Chris Lattner sabre at nondot.org
Wed Mar 31 23:31:43 PDT 2010


Author: lattner
Date: Thu Apr  1 01:31:43 2010
New Revision: 100093

URL: http://llvm.org/viewvc/llvm-project?rev=100093&view=rev
Log:
adjust to IRBuilder change and use faster DebugLoc apis.


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=100093&r1=100092&r2=100093&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Thu Apr  1 01:31:43 2010
@@ -1389,13 +1389,10 @@
   llvm::DIFile Unit = getOrCreateFile(CurLoc);
   PresumedLoc PLoc = SM.getPresumedLoc(CurLoc);
 
-  llvm::DIDescriptor DR(RegionStack.back());
-  llvm::DIScope DS = llvm::DIScope(DR.getNode());
-  llvm::DILocation DO(NULL);
-  llvm::DILocation DL = 
-    DebugFactory.CreateLocation(PLoc.getLine(), PLoc.getColumn(),
-                                DS, DO);
-  Builder.SetCurrentDebugLocation(DL.getNode());
+  llvm::MDNode *Scope = RegionStack.back();
+  Builder.SetCurrentDebugLocation(llvm::NewDebugLoc::get(PLoc.getLine(),
+                                                         PLoc.getColumn(),
+                                                         Scope));
 }
 
 /// EmitRegionStart- Constructs the debug code for entering a declarative
@@ -1598,11 +1595,8 @@
   llvm::Instruction *Call =
     DebugFactory.InsertDeclare(Storage, D, Builder.GetInsertBlock());
 
-  llvm::DIScope DS(RegionStack.back());
-  llvm::DILocation DO(NULL);
-  llvm::DILocation DL = DebugFactory.CreateLocation(Line, Column, DS, DO);
-  
-  Call->setDbgMetadata(DL.getNode());
+  llvm::MDNode *Scope = RegionStack.back();
+  Call->setDebugLoc(llvm::NewDebugLoc::get(Line, Column, Scope));
 }
 
 /// EmitDeclare - Emit local variable declaration debug info.
@@ -1664,13 +1658,9 @@
   // Insert an llvm.dbg.declare into the current block.
   llvm::Instruction *Call = 
     DebugFactory.InsertDeclare(Storage, D, Builder.GetInsertBlock());
-
-  llvm::DIScope DS(RegionStack.back());
-  llvm::DILocation DO(NULL);
-  llvm::DILocation DL = 
-    DebugFactory.CreateLocation(Line, PLoc.getColumn(), DS, DO);
   
-  Call->setDbgMetadata(DL.getNode());
+  llvm::MDNode *Scope = RegionStack.back();
+  Call->setDebugLoc(llvm::NewDebugLoc::get(Line, PLoc.getColumn(), Scope));
 }
 
 void CGDebugInfo::EmitDeclareOfAutoVariable(const VarDecl *VD,

Modified: cfe/trunk/lib/CodeGen/CodeGenModule.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenModule.cpp?rev=100093&r1=100092&r2=100093&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenModule.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenModule.cpp Thu Apr  1 01:31:43 2010
@@ -1245,9 +1245,9 @@
     if (!CI->use_empty())
       CI->replaceAllUsesWith(NewCall);
 
-    // Copy any custom metadata attached with CI.
-    if (llvm::MDNode *DbgNode = CI->getDbgMetadata())
-      NewCall->setDbgMetadata(DbgNode);
+    // Copy debug location attached to CI.
+    if (!CI->getDebugLoc().isUnknown())
+      NewCall->setDebugLoc(CI->getDebugLoc());
     CI->eraseFromParent();
   }
 }





More information about the cfe-commits mailing list