objc - don't complain about unimplemented property when conforming

protocol declares the property, as well as one of its superclasses.
Property will be implemented in the super class. // rdar://10120691

llvm-svn: 140586
This commit is contained in:
Fariborz Jahanian 2011-09-27 00:23:52 +00:00
parent f6fbfd3f83
commit 698bd3113e
2 changed files with 20 additions and 1 deletions

View File

@ -1153,7 +1153,8 @@ void Sema::CollectImmediateProperties(ObjCContainerDecl *CDecl,
ObjCPropertyDecl *PropertyFromSuper = SuperPropMap[Prop->getIdentifier()];
// Exclude property for protocols which conform to class's super-class,
// as super-class has to implement the property.
if (!PropertyFromSuper || PropertyFromSuper != Prop) {
if (!PropertyFromSuper ||
PropertyFromSuper->getIdentifier() != Prop->getIdentifier()) {
ObjCPropertyDecl *&PropEntry = PropMap[Prop->getIdentifier()];
if (!PropEntry)
PropEntry = Prop;

View File

@ -19,3 +19,21 @@
// expected-warning {{property 'MyProperty0' requires method 'setMyProperty0:' to be defined}}\
// expected-warning {{property 'MyProperty' requires method 'MyProperty' to be defined}} \
// expected-warning {{property 'MyProperty' requires method 'setMyProperty:' to be defined}}
// rdar://10120691
// property is implemented in super class. No warning
@protocol PROTOCOL1
@property int MyProp;
@end
@interface superclass
@property int MyProp;
@end
@interface childclass : superclass <PROTOCOL1>
@end
@implementation childclass
@end