From: Anders Carlsson Date: Tue, 9 Sep 2008 16:16:55 +0000 (+0000) Subject: Simple @throw support. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2b1e311009cf682b7b5adb8ba97a0816f727bfb7;p=clang Simple @throw support. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55991 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/CGObjCMac.cpp b/lib/CodeGen/CGObjCMac.cpp index ea34d11318..e060c671f0 100644 --- a/lib/CodeGen/CGObjCMac.cpp +++ b/lib/CodeGen/CGObjCMac.cpp @@ -1429,7 +1429,18 @@ void CGObjCMac::EmitTryStmt(CodeGen::CodeGenFunction &CGF, 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 *** */