[cfe-commits] r65808 - /cfe/trunk/lib/CodeGen/CGObjCMac.cpp

Daniel Dunbar daniel at zuster.org
Sun Mar 1 21:20:37 PST 2009


Author: ddunbar
Date: Sun Mar  1 23:20:36 2009
New Revision: 65808

URL: http://llvm.org/viewvc/llvm-project?rev=65808&view=rev
Log:
Make sure to invoke (not call) to objc_exception_throw if necessary.

Modified:
    cfe/trunk/lib/CodeGen/CGObjCMac.cpp

Modified: cfe/trunk/lib/CodeGen/CGObjCMac.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGObjCMac.cpp?rev=65808&r1=65807&r2=65808&view=diff

==============================================================================
--- cfe/trunk/lib/CodeGen/CGObjCMac.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGObjCMac.cpp Sun Mar  1 23:20:36 2009
@@ -4844,8 +4844,17 @@
     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");





More information about the cfe-commits mailing list