Make sure to invoke (not call) to objc_exception_throw if necessary.

llvm-svn: 65808
This commit is contained in:
Daniel Dunbar 2009-03-02 05:20:36 +00:00
parent a646834214
commit 7a38ce4f88
1 changed files with 11 additions and 2 deletions

View File

@ -4844,8 +4844,17 @@ void CGObjCNonFragileABIMac::EmitThrowStmt(CodeGen::CodeGenFunction &CGF,
llvm::Value *Exception = CGF.EmitScalarExpr(ThrowExpr);
ExceptionAsObject =
CGF.Builder.CreateBitCast(Exception, ObjCTypes.ObjectPtrTy, "tmp");
CGF.Builder.CreateCall(ObjCTypes.ExceptionThrowFn, ExceptionAsObject);
llvm::BasicBlock *InvokeDest = CGF.getInvokeDest();
if (InvokeDest) {
llvm::BasicBlock *Cont = CGF.createBasicBlock("invoke.cont");
CGF.Builder.CreateInvoke(ObjCTypes.ExceptionThrowFn,
Cont, InvokeDest,
&ExceptionAsObject, &ExceptionAsObject + 1);
CGF.EmitBlock(Cont);
} else
CGF.Builder.CreateCall(ObjCTypes.ExceptionThrowFn, ExceptionAsObject);
CGF.Builder.CreateUnreachable();
} else {
CGF.ErrorUnsupported(&S, "rethrow statement");