summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGStmt.cpp
diff options
context:
space:
mode:
authorAnders Carlsson <andersca@mac.com>2009-02-10 22:50:24 +0000
committerAnders Carlsson <andersca@mac.com>2009-02-10 22:50:24 +0000
commit7ccf3e4e286b5926398b6a30a2e04dea9cf6823c (patch)
tree7a6f07b8596e93aa56c99b2bb7a348435afb2942 /clang/lib/CodeGen/CGStmt.cpp
parentd7264430e6a7cd8cb0e2d73337a9d4c46dbfffc4 (diff)
downloadbcm5719-llvm-7ccf3e4e286b5926398b6a30a2e04dea9cf6823c.tar.gz
bcm5719-llvm-7ccf3e4e286b5926398b6a30a2e04dea9cf6823c.zip
Handle the case where EmitBlock might be called multiple times for the same block. Fixes PR3536.
llvm-svn: 64252
Diffstat (limited to 'clang/lib/CodeGen/CGStmt.cpp')
-rw-r--r--clang/lib/CodeGen/CGStmt.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/clang/lib/CodeGen/CGStmt.cpp b/clang/lib/CodeGen/CGStmt.cpp
index 85ea8c5e31c..d23547fb36a 100644
--- a/clang/lib/CodeGen/CGStmt.cpp
+++ b/clang/lib/CodeGen/CGStmt.cpp
@@ -182,8 +182,14 @@ void CodeGenFunction::EmitBlock(llvm::BasicBlock *BB, bool IsFinished) {
// If necessary, associate the block with the cleanup stack size.
if (!CleanupEntries.empty()) {
- BlockScopes[BB] = CleanupEntries.size() - 1;
- CleanupEntries.back().Blocks.push_back(BB);
+ // Check if the basic block has already been inserted.
+ BlockScopeMap::iterator I = BlockScopes.find(BB);
+ if (I != BlockScopes.end()) {
+ assert(I->second == CleanupEntries.size() - 1);
+ } else {
+ BlockScopes[BB] = CleanupEntries.size() - 1;
+ CleanupEntries.back().Blocks.push_back(BB);
+ }
}
CurFn->getBasicBlockList().push_back(BB);
OpenPOWER on IntegriCloud