]> granicus.if.org Git - clang/commitdiff
Make sure to invoke (not call) to objc_exception_throw if necessary.
authorDaniel Dunbar <daniel@zuster.org>
Mon, 2 Mar 2009 05:20:36 +0000 (05:20 +0000)
committerDaniel Dunbar <daniel@zuster.org>
Mon, 2 Mar 2009 05:20:36 +0000 (05:20 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65808 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CGObjCMac.cpp

index b45f1e4ddeea4906467e81b130c2556f2a8bce3c..eee9d438c6a42d74e13e68bb9c58027867dd6bda 100644 (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");