]> granicus.if.org Git - clang/commitdiff
adjust to IRBuilder change and use faster DebugLoc apis.
authorChris Lattner <sabre@nondot.org>
Thu, 1 Apr 2010 06:31:43 +0000 (06:31 +0000)
committerChris Lattner <sabre@nondot.org>
Thu, 1 Apr 2010 06:31:43 +0000 (06:31 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100093 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CGDebugInfo.cpp
lib/CodeGen/CodeGenModule.cpp

index fc7c0c52ebb8abe9f440630b8137c1a01f8b5395..58acd3c2e1720d9fce3d0d5c5dbeeddda89fcd2b 100644 (file)
@@ -1389,13 +1389,10 @@ void CGDebugInfo::EmitStopPoint(llvm::Function *Fn, CGBuilderTy &Builder) {
   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 @@ void CGDebugInfo::EmitDeclare(const VarDecl *VD, unsigned Tag,
   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 @@ void CGDebugInfo::EmitDeclare(const BlockDeclRefExpr *BDRE, unsigned Tag,
   // 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,
index 65aceb741ac5e93f71a0a98d143996d13bcfccd9..3c872c8560d237ac25de8ef9bc6c9036842214bd 100644 (file)
@@ -1245,9 +1245,9 @@ static void ReplaceUsesOfNonProtoTypeWithRealFunction(llvm::GlobalValue *Old,
     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();
   }
 }