summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2010-04-23 19:12:32 +0000
committerDaniel Dunbar <daniel@zuster.org>2010-04-23 19:12:32 +0000
commite3883874c557b51d32b4b9902a10a00109506d77 (patch)
tree96643b422b2b007845933d9ed1f9539c8f27bcc8 /clang/lib
parent5a6b3e0865fc4c9329ef5a66d36d02b874ea3bdc (diff)
downloadbcm5719-llvm-e3883874c557b51d32b4b9902a10a00109506d77.tar.gz
bcm5719-llvm-e3883874c557b51d32b4b9902a10a00109506d77.zip
NeXT/EH: When generating the rethrow code for a finally block, make sure to
chain outwards when inside a nested exception scope. - A real test for this is going into LLVM test-suite. llvm-svn: 102204
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/CodeGen/CGObjCMac.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/clang/lib/CodeGen/CGObjCMac.cpp b/clang/lib/CodeGen/CGObjCMac.cpp
index e8c08056304..421136ba47e 100644
--- a/clang/lib/CodeGen/CGObjCMac.cpp
+++ b/clang/lib/CodeGen/CGObjCMac.cpp
@@ -5772,9 +5772,19 @@ CGObjCNonFragileABIMac::EmitTryOrSynchronizedStmt(CodeGen::CodeGenFunction &CGF,
// Branch around the rethrow code.
CGF.EmitBranch(FinallyEnd);
+ // Generate the rethrow code, taking care to use an invoke if we are in a
+ // nested exception scope.
CGF.EmitBlock(FinallyRethrow);
- CGF.Builder.CreateCall(ObjCTypes.getUnwindResumeOrRethrowFn(),
- CGF.Builder.CreateLoad(RethrowPtr));
+ if (PrevLandingPad) {
+ llvm::BasicBlock *Cont = CGF.createBasicBlock("invoke.cont");
+ CGF.Builder.CreateInvoke(ObjCTypes.getUnwindResumeOrRethrowFn(),
+ Cont, PrevLandingPad,
+ CGF.Builder.CreateLoad(RethrowPtr));
+ CGF.EmitBlock(Cont);
+ } else {
+ CGF.Builder.CreateCall(ObjCTypes.getUnwindResumeOrRethrowFn(),
+ CGF.Builder.CreateLoad(RethrowPtr));
+ }
CGF.Builder.CreateUnreachable();
CGF.EmitBlock(FinallyEnd);
OpenPOWER on IntegriCloud