Do not execute nested finally block twice

GitHub: Fixes #1054.
This commit is contained in:
David Nadlinger 2015-08-31 17:30:44 +03:00
parent a5075f10b7
commit 2b77da4e2e
2 changed files with 7 additions and 3 deletions

View file

@ -138,7 +138,7 @@ void ScopeStack::runCleanups(
}
// Insert the unconditional branch to the first cleanup block.
irs->ir->CreateBr(cleanupScopes.back().beginBlock);
irs->ir->CreateBr(cleanupScopes[sourceScope - 1].beginBlock);
// Update all the control flow in the cleanups to make sure we end up where
// we want.
@ -353,6 +353,7 @@ llvm::BasicBlock* ScopeStack::emitLandingPad() {
it != end; ++it
) {
// Insert any cleanups in between the last catch we ran and this one.
assert(lastCleanup >= it->cleanupScope);
if (lastCleanup > it->cleanupScope) {
landingPad->setCleanup(true);
llvm::BasicBlock* afterCleanupBB = llvm::BasicBlock::Create(