[cfe-commits] r64375 - in /cfe/trunk: include/clang/Basic/DiagnosticSemaKinds.def lib/Sema/SemaStmt.cpp test/Parser/objc-try-catch-1.m test/SemaObjC/try-catch.m
Steve Naroff
snaroff at apple.com
Thu Feb 12 07:55:00 PST 2009
Author: snaroff
Date: Thu Feb 12 09:54:59 2009
New Revision: 64375
URL: http://llvm.org/viewvc/llvm-project?rev=64375&view=rev
Log:
Turn warning into error. Minor incompatibility with GCC (for scalar types, GCC only produces a warning).
Modified:
cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.def
cfe/trunk/lib/Sema/SemaStmt.cpp
cfe/trunk/test/Parser/objc-try-catch-1.m
cfe/trunk/test/SemaObjC/try-catch.m
Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.def
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.def?rev=64375&r1=64374&r2=64375&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.def (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.def Thu Feb 12 09:54:59 2009
@@ -873,7 +873,7 @@
"method %objcinstance0 not found in protocol (return type defaults to 'id')")
DIAG(error_bad_receiver_type, ERROR,
"bad receiver type %0")
-DIAG(warn_objc_throw_expects_object, WARNING,
+DIAG(error_objc_throw_expects_object, ERROR,
"invalid %0 argument (expected an ObjC object type)")
DIAG(error_rethrow_used_outside_catch, ERROR,
"@throw (rethrow) used outside of a @catch block")
Modified: cfe/trunk/lib/Sema/SemaStmt.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaStmt.cpp?rev=64375&r1=64374&r2=64375&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaStmt.cpp (original)
+++ cfe/trunk/lib/Sema/SemaStmt.cpp Thu Feb 12 09:54:59 2009
@@ -981,8 +981,7 @@
}
Action::OwningStmtResult
-Sema::ActOnObjCAtThrowStmt(SourceLocation AtLoc, ExprArg expr,
- Scope *CurScope) {
+Sema::ActOnObjCAtThrowStmt(SourceLocation AtLoc, ExprArg expr,Scope *CurScope) {
Expr *ThrowExpr = static_cast<Expr*>(expr.release());
if (!ThrowExpr) {
// @throw without an expression designates a rethrow (which much occur
@@ -998,8 +997,7 @@
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)
+ Diag(AtLoc, diag::error_objc_throw_expects_object)
<< ThrowExpr->getType() << ThrowExpr->getSourceRange();
}
}
Modified: cfe/trunk/test/Parser/objc-try-catch-1.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Parser/objc-try-catch-1.m?rev=64375&r1=64374&r2=64375&view=diff
==============================================================================
--- cfe/trunk/test/Parser/objc-try-catch-1.m (original)
+++ cfe/trunk/test/Parser/objc-try-catch-1.m Thu Feb 12 09:54:59 2009
@@ -27,7 +27,7 @@
return proc();
}
@catch (Frob* ex) {
- @throw 1,2; // expected-warning {{invalid 'int' argument (expected an ObjC object type)}}
+ @throw 1,2; // expected-error {{invalid 'int' argument (expected an ObjC object type)}}
}
@catch(...) {
@throw (4,3,proc());
Modified: cfe/trunk/test/SemaObjC/try-catch.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/try-catch.m?rev=64375&r1=64374&r2=64375&view=diff
==============================================================================
--- cfe/trunk/test/SemaObjC/try-catch.m (original)
+++ cfe/trunk/test/SemaObjC/try-catch.m Thu Feb 12 09:54:59 2009
@@ -38,6 +38,10 @@
@end
int foo() {
- @throw 42; // expected-warning {{invalid 'int' argument (expected an ObjC object type)}}
+ struct s { int a, b; } agg, *pagg;
+
+ @throw 42; // expected-error {{invalid 'int' argument (expected an ObjC object type)}}
+ @throw agg; // expected-error {{invalid 'struct s' argument (expected an ObjC object type)}}
+ @throw pagg; // expected-error {{invalid 'struct s *' argument (expected an ObjC object type)}}
@throw; // expected-error {{@throw (rethrow) used outside of a @catch block}}
}
More information about the cfe-commits
mailing list