[cfe-commits] r65241 - in /cfe/trunk: include/clang/Basic/DiagnosticSemaKinds.def lib/Sema/SemaType.cpp test/SemaObjC/protocol-archane.m
Steve Naroff
snaroff at apple.com
Sat Feb 21 11:50:44 PST 2009
Author: snaroff
Date: Sat Feb 21 13:50:43 2009
New Revision: 65241
URL: http://llvm.org/viewvc/llvm-project?rev=65241&view=rev
Log:
Warn about bogus protocol qualifiers.
Modified:
cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.def
cfe/trunk/lib/Sema/SemaType.cpp
cfe/trunk/test/SemaObjC/protocol-archane.m
Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.def
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.def?rev=65241&r1=65240&r2=65241&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.def (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.def Sat Feb 21 13:50:43 2009
@@ -1402,4 +1402,6 @@
"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")
Modified: cfe/trunk/lib/Sema/SemaType.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaType.cpp?rev=65241&r1=65240&r2=65241&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaType.cpp (original)
+++ cfe/trunk/lib/Sema/SemaType.cpp Sat Feb 21 13:50:43 2009
@@ -151,6 +151,9 @@
// 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;
Modified: cfe/trunk/test/SemaObjC/protocol-archane.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/protocol-archane.m?rev=65241&r1=65240&r2=65241&view=diff
==============================================================================
--- cfe/trunk/test/SemaObjC/protocol-archane.m (original)
+++ cfe/trunk/test/SemaObjC/protocol-archane.m Sat Feb 21 13:50:43 2009
@@ -21,4 +21,9 @@
// FIXME: provide a better diagnostic (no typedef).
- (void)m2:(id <MyProtocol> short)arg1; // expected-error {{'short type-name' is invalid}}
- at end
\ No newline at end of file
+ at end
+
+typedef int NotAnObjCObjectType;
+
+// GCC doesn't diagnose this.
+NotAnObjCObjectType <SomeProtocol> *obj; // expected-warning {{ignoring protocol qualifiers on non-ObjC type}}
More information about the cfe-commits
mailing list