Warn about bogus protocol qualifiers.

llvm-svn: 65241
This commit is contained in:
Steve Naroff 2009-02-21 19:50:43 +00:00
parent 0c9404e0a7
commit cd8d572283
3 changed files with 11 additions and 1 deletions

View File

@ -1402,4 +1402,6 @@ DIAG(warn_objc_array_of_interfaces, WARNING,
"array of interface %0 should probably be an array of pointers")
DIAG(ext_c99_array_usage, EXTENSION,
"use of C99-specific array features, accepted as an extension")
DIAG(warn_ignoring_objc_qualifiers, WARNING,
"ignoring protocol qualifiers on non-ObjC type")

View File

@ -151,6 +151,9 @@ QualType Sema::ConvertDeclSpecToType(const DeclSpec &DS) {
// id<protocol-list>
Result = Context.getObjCQualifiedIdType((ObjCProtocolDecl**)PQ,
DS.getNumProtocolQualifiers());
else
Diag(DS.getSourceRange().getBegin(),
diag::warn_ignoring_objc_qualifiers) << DS.getSourceRange();
}
// TypeQuals handled by caller.
break;

View File

@ -21,4 +21,9 @@ void foo(id x) {
// FIXME: provide a better diagnostic (no typedef).
- (void)m2:(id <MyProtocol> short)arg1; // expected-error {{'short type-name' is invalid}}
@end
@end
typedef int NotAnObjCObjectType;
// GCC doesn't diagnose this.
NotAnObjCObjectType <SomeProtocol> *obj; // expected-warning {{ignoring protocol qualifiers on non-ObjC type}}