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
This commit is contained in:
parent
5a6b3e0865
commit
e3883874c5
|
@ -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);
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -o %t %s
|
||||
//
|
||||
// <rdar://problem/7471679> [irgen] [eh] Exception code built with clang (x86_64) crashes
|
||||
|
||||
// Just check that we don't emit any dead blocks.
|
||||
//
|
||||
// RUN: grep 'No predecessors' %t | count 0
|
||||
|
||||
@interface NSArray @end
|
||||
void f0() {
|
||||
@try {
|
||||
@try {
|
||||
@throw @"a";
|
||||
} @catch(NSArray *e) {
|
||||
}
|
||||
} @catch (id e) {
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue