diff options
author | John McCall <rjmccall@apple.com> | 2010-07-13 22:24:23 +0000 |
---|---|---|
committer | John McCall <rjmccall@apple.com> | 2010-07-13 22:24:23 +0000 |
commit | 5c0e69ef0e4089affef7c225147bbbd9d20a61ed (patch) | |
tree | b9bf5503e5a7f2eaac8e9b56263d6e865322775f /clang/lib/CodeGen | |
parent | 5c08ab956ba3b615d47c1e5ecda9d1b4242126a4 (diff) | |
download | bcm5719-llvm-5c0e69ef0e4089affef7c225147bbbd9d20a61ed.tar.gz bcm5719-llvm-5c0e69ef0e4089affef7c225147bbbd9d20a61ed.zip |
Switch the __cxa_rethrow cleanup to be lazy.
llvm-svn: 108288
Diffstat (limited to 'clang/lib/CodeGen')
-rw-r--r-- | clang/lib/CodeGen/CGException.cpp | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/clang/lib/CodeGen/CGException.cpp b/clang/lib/CodeGen/CGException.cpp index 5e91adc669e..bfe00ea158a 100644 --- a/clang/lib/CodeGen/CGException.cpp +++ b/clang/lib/CodeGen/CGException.cpp @@ -1202,6 +1202,14 @@ static void BeginCatch(CodeGenFunction &CGF, CGF.EmitLocalBlockVarDecl(*CatchParam, &InitCatchParam); } +namespace { + struct CallRethrow : EHScopeStack::LazyCleanup { + void Emit(CodeGenFunction &CGF, bool IsForEH) { + CGF.EmitCallOrInvoke(getReThrowFn(CGF), 0, 0); + } + }; +} + void CodeGenFunction::ExitCXXTryStmt(const CXXTryStmt &S, bool IsFnTryBlock) { unsigned NumHandlers = S.getNumHandlers(); EHCatchScope &CatchScope = cast<EHCatchScope>(*EHStack.begin()); @@ -1242,12 +1250,10 @@ void CodeGenFunction::ExitCXXTryStmt(const CXXTryStmt &S, bool IsFnTryBlock) { BeginCatch(*this, C); // If there's an implicit rethrow, push a normal "cleanup" to call - // _cxa_rethrow. This needs to happen before _cxa_end_catch is - // called. - if (ImplicitRethrow) { - CleanupBlock Rethrow(*this, NormalCleanup); - EmitCallOrInvoke(getReThrowFn(*this), 0, 0); - } + // _cxa_rethrow. This needs to happen before __cxa_end_catch is + // called, and so it is pushed after BeginCatch. + if (ImplicitRethrow) + EHStack.pushLazyCleanup<CallRethrow>(NormalCleanup); // Perform the body of the catch. EmitStmt(C->getHandlerBlock()); |