summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen
diff options
context:
space:
mode:
authorDevang Patel <dpatel@apple.com>2011-06-03 19:21:47 +0000
committerDevang Patel <dpatel@apple.com>2011-06-03 19:21:47 +0000
commit887e215e6428dae395f34ce6db81e0d6bfd738a4 (patch)
treee07fa8ad9f1d97d7d3c926c0b71be5beec79ba24 /clang/lib/CodeGen
parentb96ea46c7c499de91a5dfae3c1de3b7acbf8b964 (diff)
downloadbcm5719-llvm-887e215e6428dae395f34ce6db81e0d6bfd738a4.tar.gz
bcm5719-llvm-887e215e6428dae395f34ce6db81e0d6bfd738a4.zip
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.
llvm-svn: 132576
Diffstat (limited to 'clang/lib/CodeGen')
-rw-r--r--clang/lib/CodeGen/CGDecl.cpp19
-rw-r--r--clang/lib/CodeGen/CGStmt.cpp7
2 files changed, 10 insertions, 16 deletions
diff --git a/clang/lib/CodeGen/CGDecl.cpp b/clang/lib/CodeGen/CGDecl.cpp
index 9991b302b21..048289e5067 100644
--- a/clang/lib/CodeGen/CGDecl.cpp
+++ b/clang/lib/CodeGen/CGDecl.cpp
@@ -629,15 +629,16 @@ CodeGenFunction::EmitAutoVarAlloca(const VarDecl &D) {
emission.Address = DeclPtr;
// Emit debug info for local var declaration.
- if (CGDebugInfo *DI = getDebugInfo()) {
- assert(HaveInsertPoint() && "Unexpected unreachable point!");
-
- DI->setLocation(D.getLocation());
- if (Target.useGlobalsForAutomaticVariables()) {
- DI->EmitGlobalVariable(static_cast<llvm::GlobalVariable *>(DeclPtr), &D);
- } else
- DI->EmitDeclareOfAutoVariable(&D, DeclPtr, Builder);
- }
+ 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
+ DI->EmitDeclareOfAutoVariable(&D, DeclPtr, Builder);
+ }
return emission;
}
diff --git a/clang/lib/CodeGen/CGStmt.cpp b/clang/lib/CodeGen/CGStmt.cpp
index 995511c615a..5f660f88587 100644
--- a/clang/lib/CodeGen/CGStmt.cpp
+++ b/clang/lib/CodeGen/CGStmt.cpp
@@ -771,13 +771,6 @@ 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()) {
- EnsureInsertPoint();
- EmitStopPoint(&S);
- }
-
for (DeclStmt::const_decl_iterator I = S.decl_begin(), E = S.decl_end();
I != E; ++I)
EmitDecl(**I);
OpenPOWER on IntegriCloud