summaryrefslogtreecommitdiffstats
path: root/clang
diff options
context:
space:
mode:
authorAnders Carlsson <andersca@mac.com>2008-09-09 16:16:55 +0000
committerAnders Carlsson <andersca@mac.com>2008-09-09 16:16:55 +0000
commite005aa13f1c572b4c2b22e56d2c34e279b344ccf (patch)
treeff92c10edc2fcb3cd050a6f6dcddcae93c3c6e3a /clang
parent44cfcb6fb1f7de1aa5a94b3ac6f57cb93bb3bf04 (diff)
downloadbcm5719-llvm-e005aa13f1c572b4c2b22e56d2c34e279b344ccf.tar.gz
bcm5719-llvm-e005aa13f1c572b4c2b22e56d2c34e279b344ccf.zip
Simple @throw support.
llvm-svn: 55991
Diffstat (limited to 'clang')
-rw-r--r--clang/lib/CodeGen/CGObjCMac.cpp13
1 files changed, 12 insertions, 1 deletions
diff --git a/clang/lib/CodeGen/CGObjCMac.cpp b/clang/lib/CodeGen/CGObjCMac.cpp
index ea34d11318c..e060c671f03 100644
--- a/clang/lib/CodeGen/CGObjCMac.cpp
+++ b/clang/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 *** */
OpenPOWER on IntegriCloud