mirror of
https://github.com/ldc-developers/ldc.git
synced 2025-05-01 07:30:43 +03:00
parent
a5075f10b7
commit
2b77da4e2e
2 changed files with 7 additions and 3 deletions
|
@ -138,7 +138,7 @@ void ScopeStack::runCleanups(
|
||||||
}
|
}
|
||||||
|
|
||||||
// Insert the unconditional branch to the first cleanup block.
|
// 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
|
// Update all the control flow in the cleanups to make sure we end up where
|
||||||
// we want.
|
// we want.
|
||||||
|
@ -353,6 +353,7 @@ llvm::BasicBlock* ScopeStack::emitLandingPad() {
|
||||||
it != end; ++it
|
it != end; ++it
|
||||||
) {
|
) {
|
||||||
// Insert any cleanups in between the last catch we ran and this one.
|
// Insert any cleanups in between the last catch we ran and this one.
|
||||||
|
assert(lastCleanup >= it->cleanupScope);
|
||||||
if (lastCleanup > it->cleanupScope) {
|
if (lastCleanup > it->cleanupScope) {
|
||||||
landingPad->setCleanup(true);
|
landingPad->setCleanup(true);
|
||||||
llvm::BasicBlock* afterCleanupBB = llvm::BasicBlock::Create(
|
llvm::BasicBlock* afterCleanupBB = llvm::BasicBlock::Create(
|
||||||
|
|
|
@ -322,7 +322,8 @@ private:
|
||||||
///
|
///
|
||||||
std::vector<JumpTarget> continueTargets;
|
std::vector<JumpTarget> continueTargets;
|
||||||
|
|
||||||
///
|
/// cleanupScopes[i] contains the information to go from
|
||||||
|
/// currentCleanupScope() == i + 1 to currentCleanupScope() == i.
|
||||||
std::vector<CleanupScope> cleanupScopes;
|
std::vector<CleanupScope> cleanupScopes;
|
||||||
|
|
||||||
///
|
///
|
||||||
|
@ -361,7 +362,9 @@ llvm::CallSite ScopeStack::callOrInvoke(llvm::Value* callee, const T &args,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (currentLandingPads().empty()) {
|
if (currentLandingPads().empty()) {
|
||||||
// Have not encountered.
|
// Have not encountered any catches (for which we would push a scope) or
|
||||||
|
// calls to throwing functions (where we would have already executed
|
||||||
|
// this if) in this cleanup scope yet.
|
||||||
currentLandingPads().push_back(0);
|
currentLandingPads().push_back(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue