aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/CGException.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/CodeGen/CGException.cpp')
-rw-r--r--lib/CodeGen/CGException.cpp51
1 files changed, 6 insertions, 45 deletions
diff --git a/lib/CodeGen/CGException.cpp b/lib/CodeGen/CGException.cpp
index cc0a03f8b5..71a078f929 100644
--- a/lib/CodeGen/CGException.cpp
+++ b/lib/CodeGen/CGException.cpp
@@ -58,11 +58,6 @@ EHScopeStack::stable_iterator
EHScopeStack::getEnclosingEHCleanup(iterator it) const {
assert(it != end());
do {
- if (isa<EHCleanupScope>(*it)) {
- if (cast<EHCleanupScope>(*it).isEHCleanup())
- return stabilize(it);
- return cast<EHCleanupScope>(*it).getEnclosingEHCleanup();
- }
if (isa<EHLazyCleanupScope>(*it)) {
if (cast<EHLazyCleanupScope>(*it).isEHCleanup())
return stabilize(it);
@@ -94,36 +89,14 @@ void *EHScopeStack::pushLazyCleanup(CleanupKind Kind, size_t Size) {
return Scope->getCleanupBuffer();
}
-void EHScopeStack::pushCleanup(llvm::BasicBlock *NormalEntry,
- llvm::BasicBlock *NormalExit,
- llvm::BasicBlock *EHEntry,
- llvm::BasicBlock *EHExit) {
- char *Buffer = allocate(EHCleanupScope::getSize());
- new (Buffer) EHCleanupScope(BranchFixups.size(),
- InnermostNormalCleanup,
- InnermostEHCleanup,
- NormalEntry, NormalExit, EHEntry, EHExit);
- if (NormalEntry)
- InnermostNormalCleanup = stable_begin();
- if (EHEntry)
- InnermostEHCleanup = stable_begin();
-}
-
void EHScopeStack::popCleanup() {
assert(!empty() && "popping exception stack when not empty");
- if (isa<EHLazyCleanupScope>(*begin())) {
- EHLazyCleanupScope &Cleanup = cast<EHLazyCleanupScope>(*begin());
- InnermostNormalCleanup = Cleanup.getEnclosingNormalCleanup();
- InnermostEHCleanup = Cleanup.getEnclosingEHCleanup();
- StartOfData += Cleanup.getAllocatedSize();
- } else {
- assert(isa<EHCleanupScope>(*begin()));
- EHCleanupScope &Cleanup = cast<EHCleanupScope>(*begin());
- InnermostNormalCleanup = Cleanup.getEnclosingNormalCleanup();
- InnermostEHCleanup = Cleanup.getEnclosingEHCleanup();
- StartOfData += EHCleanupScope::getSize();
- }
+ assert(isa<EHLazyCleanupScope>(*begin()));
+ EHLazyCleanupScope &Cleanup = cast<EHLazyCleanupScope>(*begin());
+ InnermostNormalCleanup = Cleanup.getEnclosingNormalCleanup();
+ InnermostEHCleanup = Cleanup.getEnclosingEHCleanup();
+ StartOfData += Cleanup.getAllocatedSize();
// Check whether we can shrink the branch-fixups stack.
if (!BranchFixups.empty()) {
@@ -177,11 +150,7 @@ void EHScopeStack::popNullFixups() {
assert(hasNormalCleanups());
EHScopeStack::iterator it = find(InnermostNormalCleanup);
- unsigned MinSize;
- if (isa<EHCleanupScope>(*it))
- MinSize = cast<EHCleanupScope>(*it).getFixupDepth();
- else
- MinSize = cast<EHLazyCleanupScope>(*it).getFixupDepth();
+ unsigned MinSize = cast<EHLazyCleanupScope>(*it).getFixupDepth();
assert(BranchFixups.size() >= MinSize && "fixup stack out of order");
while (BranchFixups.size() > MinSize &&
@@ -666,8 +635,6 @@ void CodeGenFunction::EnterCXXTryStmt(const CXXTryStmt &S, bool IsFnTryBlock) {
/// normal-only cleanup scopes.
static bool isNonEHScope(const EHScope &S) {
switch (S.getKind()) {
- case EHScope::Cleanup:
- return !cast<EHCleanupScope>(S).isEHCleanup();
case EHScope::LazyCleanup:
return !cast<EHLazyCleanupScope>(S).isEHCleanup();
case EHScope::Filter:
@@ -804,12 +771,6 @@ llvm::BasicBlock *CodeGenFunction::EmitLandingPad() {
// We otherwise don't care about cleanups.
continue;
- case EHScope::Cleanup:
- if (!HasEHCleanup)
- HasEHCleanup = cast<EHCleanupScope>(*I).isEHCleanup();
- // We otherwise don't care about cleanups.
- continue;
-
case EHScope::Filter: {
assert(I.next() == EHStack.end() && "EH filter is not end of EH stack");
assert(!CatchAll.Block && "EH filter reached after catch-all");