summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGBlocks.cpp
diff options
context:
space:
mode:
authorMike Stump <mrs@apple.com>2009-10-01 00:27:30 +0000
committerMike Stump <mrs@apple.com>2009-10-01 00:27:30 +0000
commit7d69911a1f0c21653bea7859cd853ab4dad18538 (patch)
tree986ae95a2ca67d1f659780e8c4de0aa927573a6d /clang/lib/CodeGen/CGBlocks.cpp
parent4fa53427585ceea6e5e947bc19e7cfbce17bb4fa (diff)
downloadbcm5719-llvm-7d69911a1f0c21653bea7859cd853ab4dad18538.tar.gz
bcm5719-llvm-7d69911a1f0c21653bea7859cd853ab4dad18538.zip
A couple of refinements for laying out debug information for
BlockDeclRefDecls. llvm-svn: 83185
Diffstat (limited to 'clang/lib/CodeGen/CGBlocks.cpp')
-rw-r--r--clang/lib/CodeGen/CGBlocks.cpp27
1 files changed, 15 insertions, 12 deletions
diff --git a/clang/lib/CodeGen/CGBlocks.cpp b/clang/lib/CodeGen/CGBlocks.cpp
index e9648251d2b..ba14fea36e0 100644
--- a/clang/lib/CodeGen/CGBlocks.cpp
+++ b/clang/lib/CodeGen/CGBlocks.cpp
@@ -665,21 +665,20 @@ CodeGenFunction::GenerateBlockFunction(const BlockExpr *BExpr,
// Save a spot to insert the debug information for all the BlockDeclRefDecls.
llvm::BasicBlock *entry = Builder.GetInsertBlock();
- llvm::BasicBlock::iterator entry_ptr = Builder.GetInsertPoint();
CurFuncDecl = OuterFuncDecl;
CurCodeDecl = BD;
+ // FIXME: Can we straighten this out not using multiple basic blocks?
+ // Set body aside for now.
+ llvm::BasicBlock *body = createBasicBlock("body");
+ Builder.SetInsertPoint(body);
EmitStmt(BExpr->getBody());
-
+ // Remember where we were...
+ llvm::BasicBlock *resume = Builder.GetInsertBlock();
+ // Go back to the entry.
+ Builder.SetInsertPoint(entry);
if (CGDebugInfo *DI = getDebugInfo()) {
- llvm::BasicBlock *end = Builder.GetInsertBlock();
- llvm::BasicBlock::iterator end_ptr = Builder.GetInsertPoint();
-
// Emit debug information for all the BlockDeclRefDecls.
- // First, go back to the entry...
- Builder.SetInsertPoint(entry, entry_ptr);
-
- // And then insert the debug information..
for (unsigned i=0; i < BlockDeclRefDecls.size(); ++i) {
const Expr *E = BlockDeclRefDecls[i];
const BlockDeclRefExpr *BDRE = dyn_cast<BlockDeclRefExpr>(E);
@@ -691,10 +690,14 @@ CodeGenFunction::GenerateBlockFunction(const BlockExpr *BExpr,
Builder, this);
}
}
-
- // Then go back to the end, and we're done.
- Builder.SetInsertPoint(end, end_ptr);
}
+ // And now go back to the body
+ EmitBlock(body);
+ // And resume where we left off.
+ if (resume == 0)
+ Builder.ClearInsertionPoint();
+ else
+ Builder.SetInsertPoint(resume);
FinishFunction(cast<CompoundStmt>(BExpr->getBody())->getRBracLoc());
OpenPOWER on IntegriCloud