]> granicus.if.org Git - clang/commitdiff
"Attach debug info with llvm instructions" mode was enabled a month ago. Now make...
authorDevang Patel <dpatel@apple.com>
Thu, 12 Nov 2009 18:21:39 +0000 (18:21 +0000)
committerDevang Patel <dpatel@apple.com>
Thu, 12 Nov 2009 18:21:39 +0000 (18:21 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@87007 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CGDebugInfo.cpp
lib/CodeGen/CGStmt.cpp
lib/CodeGen/CodeGenModule.h

index a1fdb9e1755ba0a175f844ac0c52c6714ed8e110..3a9dea06f1a7f51c81febc561fc6e704e4a51aff 100644 (file)
@@ -934,10 +934,6 @@ void CGDebugInfo::EmitFunctionStart(const char *Name, QualType FnType,
                                   getOrCreateType(FnType, Unit),
                                   Fn->hasInternalLinkage(), true/*definition*/);
 
-#ifndef ATTACH_DEBUG_INFO_TO_AN_INSN
-  DebugFactory.InsertSubprogramStart(SP, Builder.GetInsertBlock());
-#endif
-
   // Push function on region stack.
   RegionStack.push_back(SP);
 }
@@ -961,7 +957,6 @@ void CGDebugInfo::EmitStopPoint(llvm::Function *Fn, CGBuilderTy &Builder) {
   llvm::DICompileUnit Unit = getOrCreateCompileUnit(CurLoc);
   PresumedLoc PLoc = SM.getPresumedLoc(CurLoc);
 
-#ifdef ATTACH_DEBUG_INFO_TO_AN_INSN
   llvm::DIDescriptor DR = RegionStack.back();
   llvm::DIScope DS = llvm::DIScope(DR.getNode());
   llvm::DILocation DO(NULL);
@@ -969,10 +964,6 @@ void CGDebugInfo::EmitStopPoint(llvm::Function *Fn, CGBuilderTy &Builder) {
     DebugFactory.CreateLocation(PLoc.getLine(), PLoc.getColumn(),
                                 DS, DO);
   Builder.SetCurrentDebugLocation(DL.getNode());
-#else
-  DebugFactory.InsertStopPoint(Unit, PLoc.getLine(), PLoc.getColumn(),
-                               Builder.GetInsertBlock());
-#endif
 }
 
 /// EmitRegionStart- Constructs the debug code for entering a declarative
@@ -983,9 +974,6 @@ void CGDebugInfo::EmitRegionStart(llvm::Function *Fn, CGBuilderTy &Builder) {
     D = RegionStack.back();
   D = DebugFactory.CreateLexicalBlock(D);
   RegionStack.push_back(D);
-#ifndef ATTACH_DEBUG_INFO_TO_AN_INSN
-  DebugFactory.InsertRegionStart(D, Builder.GetInsertBlock());
-#endif
 }
 
 /// EmitRegionEnd - Constructs the debug code for exiting a declarative
@@ -996,9 +984,6 @@ void CGDebugInfo::EmitRegionEnd(llvm::Function *Fn, CGBuilderTy &Builder) {
   // Provide an region stop point.
   EmitStopPoint(Fn, Builder);
 
-#ifndef ATTACH_DEBUG_INFO_TO_AN_INSN
-  DebugFactory.InsertRegionEnd(RegionStack.back(), Builder.GetInsertBlock());
-#endif
   RegionStack.pop_back();
 }
 
@@ -1165,14 +1150,13 @@ void CGDebugInfo::EmitDeclare(const VarDecl *Decl, unsigned Tag,
   // Insert an llvm.dbg.declare into the current block.
   llvm::Instruction *Call =
     DebugFactory.InsertDeclare(Storage, D, Builder.GetInsertBlock());
-#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(Line, PLoc.getColumn(), DS, DO);
-    Builder.SetDebugLocation(Call, DL.getNode());
-#endif
+
+  llvm::DIDescriptor DR = RegionStack.back();
+  llvm::DIScope DS = llvm::DIScope(DR.getNode());
+  llvm::DILocation DO(NULL);
+  llvm::DILocation DL = 
+    DebugFactory.CreateLocation(Line, PLoc.getColumn(), DS, DO);
+  Builder.SetDebugLocation(Call, DL.getNode());
 }
 
 /// EmitDeclare - Emit local variable declaration debug info.
@@ -1368,14 +1352,13 @@ 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.GetInsertPoint());
-#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(Line, PLoc.getColumn(), DS, DO);
-    Builder.SetDebugLocation(Call, DL.getNode());
-#endif
+
+  llvm::DIDescriptor DR = RegionStack.back();
+  llvm::DIScope DS = llvm::DIScope(DR.getNode());
+  llvm::DILocation DO(NULL);
+  llvm::DILocation DL = 
+    DebugFactory.CreateLocation(Line, PLoc.getColumn(), DS, DO);
+  Builder.SetDebugLocation(Call, DL.getNode());
 }
 
 void CGDebugInfo::EmitDeclareOfAutoVariable(const VarDecl *Decl,
index 4f3fc74fcdde4b5ebc82282baf0f29dcb0b0c0b3..b47930e31371f753ffbf5822c80a444f10d0eaad 100644 (file)
@@ -148,13 +148,8 @@ RValue CodeGenFunction::EmitCompoundStmt(const CompoundStmt &S, bool GetLast,
 
   CGDebugInfo *DI = getDebugInfo();
   if (DI) {
-#ifdef ATTACH_DEBUG_INFO_TO_AN_INSN
     DI->setLocation(S.getLBracLoc());
     DI->EmitRegionStart(CurFn, Builder);
-#else
-    EnsureInsertPoint();
-    DI->setLocation(S.getLBracLoc());
-#endif    
   }
 
   // Keep track of the current cleanup stack depth.
@@ -167,13 +162,8 @@ RValue CodeGenFunction::EmitCompoundStmt(const CompoundStmt &S, bool GetLast,
     EmitStmt(*I);
 
   if (DI) {
-#ifdef ATTACH_DEBUG_INFO_TO_AN_INSN
     DI->setLocation(S.getLBracLoc());
     DI->EmitRegionEnd(CurFn, Builder);
-#else
-    EnsureInsertPoint();
-    DI->setLocation(S.getLBracLoc());
-#endif    
   }
 
   RValue RV;
@@ -484,13 +474,11 @@ void CodeGenFunction::EmitForStmt(const ForStmt &S) {
   BreakContinueStack.push_back(BreakContinue(AfterFor, ContinueBlock));
 
   // If the condition is true, execute the body of the for stmt.
-#ifdef ATTACH_DEBUG_INFO_TO_AN_INSN
   CGDebugInfo *DI = getDebugInfo();
   if (DI) {
     DI->setLocation(S.getSourceRange().getBegin());
     DI->EmitRegionStart(CurFn, Builder);
   }
-#endif
   EmitStmt(S.getBody());
 
   BreakContinueStack.pop_back();
@@ -503,12 +491,10 @@ void CodeGenFunction::EmitForStmt(const ForStmt &S) {
 
   // Finally, branch back up to the condition for the next iteration.
   EmitBranch(CondBlock);
-#ifdef ATTACH_DEBUG_INFO_TO_AN_INSN
   if (DI) {
     DI->setLocation(S.getSourceRange().getEnd());
     DI->EmitRegionEnd(CurFn, Builder);
   }
-#endif
 
   // Emit the fall-through block.
   EmitBlock(AfterFor, true);
index cf7a9d68f31ec9b71c7e666250ff5382207f45fb..749c8f5403fdf28ca46231bfa9e33ff2720813cc 100644 (file)
@@ -31,8 +31,6 @@
 #include "llvm/Support/ValueHandle.h"
 #include <list>
 
-#define ATTACH_DEBUG_INFO_TO_AN_INSN 1 
-
 namespace llvm {
   class Module;
   class Constant;