[cfe-commits] r55991 - /cfe/trunk/lib/CodeGen/CGObjCMac.cpp
Anders Carlsson
andersca at mac.com
Tue Sep 9 09:16:56 PDT 2008
Author: andersca
Date: Tue Sep 9 11:16:55 2008
New Revision: 55991
URL: http://llvm.org/viewvc/llvm-project?rev=55991&view=rev
Log:
Simple @throw support.
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=55991&r1=55990&r2=55991&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGObjCMac.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGObjCMac.cpp Tue Sep 9 11:16:55 2008
@@ -1429,7 +1429,18 @@
void CGObjCMac::EmitThrowStmt(CodeGen::CodeGenFunction &CGF,
const ObjCAtThrowStmt &S)
{
- CGF.ErrorUnsupported(&S, "@throw statement");
+ llvm::Value *ExceptionAsObject;
+
+ if (const Expr *ThrowExpr = S.getThrowExpr()) {
+ llvm::Value *Exception = CGF.EmitScalarExpr(ThrowExpr);
+ ExceptionAsObject =
+ CGF.Builder.CreateBitCast(Exception, ObjCTypes.ObjectPtrTy, "tmp");
+ } else {
+ assert(0 && "FIXME: rethrows not supported!");
+ }
+
+ CGF.Builder.CreateCall(ObjCTypes.ExceptionThrowFn, ExceptionAsObject);
+
}
/* *** Private Interface *** */
More information about the cfe-commits
mailing list