[cfe-commits] r64308 - in /cfe/trunk: include/clang/Basic/DiagnosticSemaKinds.def lib/Sema/SemaStmt.cpp test/Parser/objc-try-catch-1.m test/SemaObjC/try-catch.m
Chris Lattner
clattner at apple.com
Wed Feb 11 10:15:13 PST 2009
On Feb 11, 2009, at 9:45 AM, Steve Naroff wrote:
> Log:
> Fix <rdar://problem/6206858> [sema] type check @throw statements.
>
Thanks!
> +Sema::ActOnObjCAtThrowStmt(SourceLocation AtLoc, ExprArg expr) {
> + Expr *ThrowExpr = static_cast<Expr*>(expr.release());
> + if (!ThrowExpr) {
> + // FIXME: verify the 'rethrow' is within a @catch block
> + } else {
> + QualType ThrowType = ThrowExpr->getType();
> + // Make sure the expression type is an ObjC pointer or "void *".
> + if (!Context.isObjCObjectPointerType(ThrowType)) {
> + const PointerType *PT = ThrowType->getAsPointerType();
> + if (!PT || !PT->getPointeeType()->isVoidType())
> + // This should be an error, however GCC only yields a
> warning.
> + Diag(AtLoc, diag::warn_objc_throw_expects_object)
> + << ThrowExpr->getType() << ThrowExpr-
> >getSourceRange();
Shouldn't this reject aggregates with an error?
-Chris
More information about the cfe-commits
mailing list