Simple @throw support.

llvm-svn: 55991
This commit is contained in:
Anders Carlsson 2008-09-09 16:16:55 +00:00
parent 44cfcb6fb1
commit e005aa13f1
1 changed files with 12 additions and 1 deletions

View File

@ -1429,7 +1429,18 @@ void CGObjCMac::EmitTryStmt(CodeGen::CodeGenFunction &CGF,
void CGObjCMac::EmitThrowStmt(CodeGen::CodeGenFunction &CGF, void CGObjCMac::EmitThrowStmt(CodeGen::CodeGenFunction &CGF,
const ObjCAtThrowStmt &S) 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 *** */ /* *** Private Interface *** */