[cfe-commits] r110583 - in /cfe/trunk: lib/AST/ASTContext.cpp test/SemaObjC/comptypes-5.m
Fariborz Jahanian
fjahanian at apple.com
Mon Aug 9 11:21:43 PDT 2010
Author: fjahanian
Date: Mon Aug 9 13:21:43 2010
New Revision: 110583
URL: http://llvm.org/viewvc/llvm-project?rev=110583&view=rev
Log:
Warn if class object does not implement qualified
id's protocols. Fixes radar 8154220.
Modified:
cfe/trunk/lib/AST/ASTContext.cpp
cfe/trunk/test/SemaObjC/comptypes-5.m
Modified: cfe/trunk/lib/AST/ASTContext.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTContext.cpp?rev=110583&r1=110582&r2=110583&view=diff
==============================================================================
--- cfe/trunk/lib/AST/ASTContext.cpp (original)
+++ cfe/trunk/lib/AST/ASTContext.cpp Mon Aug 9 13:21:43 2010
@@ -4323,10 +4323,10 @@
if (ObjCInterfaceDecl *lhsID = lhsOPT->getInterfaceDecl()) {
for (ObjCObjectPointerType::qual_iterator I = rhsQID->qual_begin(),
E = rhsQID->qual_end(); I != E; ++I) {
- // when comparing an id<P> on lhs with a static type on rhs,
- // see if static class implements all of id's protocols, directly or
- // through its super class and categories.
- if (lhsID->ClassImplementsProtocol(*I, true)) {
+ // when comparing an id<P> on rhs with a static type on lhs,
+ // static class must implement all of id's protocols directly or
+ // indirectly through its super class.
+ if (lhsID->ClassImplementsProtocol(*I, false)) {
match = true;
break;
}
Modified: cfe/trunk/test/SemaObjC/comptypes-5.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/comptypes-5.m?rev=110583&r1=110582&r2=110583&view=diff
==============================================================================
--- cfe/trunk/test/SemaObjC/comptypes-5.m (original)
+++ cfe/trunk/test/SemaObjC/comptypes-5.m Mon Aug 9 13:21:43 2010
@@ -26,8 +26,8 @@
MyOtherClass<MyProtocol> *obj_c_super_p_q = nil;
MyClass<MyProtocol> *obj_c_cat_p_q = nil;
- obj_c_cat_p = obj_id_p;
- obj_c_super_p = obj_id_p;
+ obj_c_cat_p = obj_id_p; // expected-warning {{assigning to 'MyClass *' from incompatible type 'id<MyProtocol>'}}
+ obj_c_super_p = obj_id_p; // expected-warning {{assigning to 'MyOtherClass *' from incompatible type 'id<MyProtocol>'}}
obj_id_p = obj_c_cat_p; /* Ok */
obj_id_p = obj_c_super_p; /* Ok */
More information about the cfe-commits
mailing list