]> granicus.if.org Git - clang/commitdiff
objc - don't complain about unimplemented property when conforming
authorFariborz Jahanian <fjahanian@apple.com>
Tue, 27 Sep 2011 00:23:52 +0000 (00:23 +0000)
committerFariborz Jahanian <fjahanian@apple.com>
Tue, 27 Sep 2011 00:23:52 +0000 (00:23 +0000)
protocol declares the property, as well as one of its superclasses.
Property will be implemented in the super class. // rdar://10120691

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140586 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaObjCProperty.cpp
test/SemaObjC/unimplemented-protocol-prop.m

index db23c84f2e20c8e9683e798e6fcb4cb7732bdfb3..56aa4480fbe669f325b136bde0e6bf025eb6e4f7 100644 (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;
index 0805202c5e09203a1b9f5bf946c3f0c47b5c1e4b..fa3ed8ef121c7f6bfb4cb20d7e4fefa05f34e5b6 100644 (file)
                        // 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
+