]> granicus.if.org Git - clang/commitdiff
Rework r132576.
authorDevang Patel <dpatel@apple.com>
Sat, 4 Jun 2011 00:38:02 +0000 (00:38 +0000)
committerDevang Patel <dpatel@apple.com>
Sat, 4 Jun 2011 00:38:02 +0000 (00:38 +0000)
Emit debug info only if there is an insertion point. The debug info should not force an insertion point. Codegen may later on decide to not emit code for some reason, see extensive comment in CodeGenFunction::EmitStmt(), and debug info should not get in the way.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132610 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CGDecl.cpp
lib/CodeGen/CGStmt.cpp

index 048289e5067b19a020a47f312971ec650e0c154c..8a1a8536dab1056f8b8cf4fa2c985eb1adb05d06 100644 (file)
@@ -632,8 +632,6 @@ CodeGenFunction::EmitAutoVarAlloca(const VarDecl &D) {
   if (HaveInsertPoint())
     if (CGDebugInfo *DI = getDebugInfo()) {
       DI->setLocation(D.getLocation());
-      DI->UpdateLineDirectiveRegion(Builder);
-      DI->EmitStopPoint(Builder);
       if (Target.useGlobalsForAutomaticVariables()) {
         DI->EmitGlobalVariable(static_cast<llvm::GlobalVariable *>(DeclPtr), &D);
       } else
index 5f660f8858791faf6fe43d284a8c40f19f600cb4..782ff061606bd810ad5b17740a7eb1b1e11db690 100644 (file)
@@ -771,6 +771,11 @@ void CodeGenFunction::EmitReturnStmt(const ReturnStmt &S) {
 }
 
 void CodeGenFunction::EmitDeclStmt(const DeclStmt &S) {
+  // As long as debug info is modeled with instructions, we have to ensure we
+  // have a place to insert here and write the stop point here.
+  if (getDebugInfo() && HaveInsertPoint())
+    EmitStopPoint(&S);
+
   for (DeclStmt::const_decl_iterator I = S.decl_begin(), E = S.decl_end();
        I != E; ++I)
     EmitDecl(**I);