]> granicus.if.org Git - clang/commitdiff
Do not eagerly set stop point for arguments. This misleads the debugger in identifyin...
authorDevang Patel <dpatel@apple.com>
Wed, 11 Nov 2009 19:10:19 +0000 (19:10 +0000)
committerDevang Patel <dpatel@apple.com>
Wed, 11 Nov 2009 19:10:19 +0000 (19:10 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86862 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CGDebugInfo.cpp

index ce43d4f38a6625c7e95e9ec03dd7a8dd549e4134..97754728ca29fc42ea9c7ad88d3f1f4bada0e99b 100644 (file)
@@ -941,7 +941,6 @@ void CGDebugInfo::EmitFunctionStart(const char *Name, QualType FnType,
 
   // Push function on region stack.
   RegionStack.push_back(SP);
-  EmitStopPoint(Fn, Builder);
 }
 
 
@@ -1166,9 +1165,16 @@ void CGDebugInfo::EmitDeclare(const VarDecl *Decl, unsigned Tag,
     DebugFactory.CreateVariable(Tag, RegionStack.back(),Decl->getNameAsString(),
                                 Unit, Line, Ty);
   // Insert an llvm.dbg.declare into the current block.
-  llvm::Instruction *Call = 
+  llvm::Instruction *Call =
     DebugFactory.InsertDeclare(Storage, 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(Line, PLoc.getColumn(), DS, DO);
+    Builder.SetDebugLocation(Call, DL.getNode());
+#endif
 }
 
 /// EmitDeclare - Emit local variable declaration debug info.
@@ -1363,7 +1369,16 @@ void CGDebugInfo::EmitDeclare(const BlockDeclRefExpr *BDRE, unsigned Tag,
                                        Decl->getNameAsString(), Unit, Line, Ty,
                                        addr);
   // Insert an llvm.dbg.declare into the current block.
-  DebugFactory.InsertDeclare(Storage, D, Builder.GetInsertPoint());
+  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
 }
 
 void CGDebugInfo::EmitDeclareOfAutoVariable(const VarDecl *Decl,