Author: fjahanian
Date: Mon Sep 26 19:23:52 2011
New Revision: 140586
URL: http://llvm.org/viewvc/llvm-project?rev=140586&view=rev
Log:
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
Modified:
cfe/trunk/lib/Sema/SemaObjCProperty.cpp
cfe/trunk/test/SemaObjC/unimplemented-protocol-prop.m
Modified: cfe/trunk/lib/Sema/SemaObjCProperty.cpp
URL:
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaObjCProperty.cpp?rev=140586&r1=140585&r2=140586&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaObjCProperty.cpp (original)
+++ cfe/trunk/lib/Sema/SemaObjCProperty.cpp Mon Sep 26 19:23:52 2011
@@ -1153,7 +1153,8 @@
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;
Modified: cfe/trunk/test/SemaObjC/unimplemented-protocol-prop.m
URL:
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/unimplemented-protocol-prop.m?rev=140586&r1=140585&r2=140586&view=diff
==============================================================================
--- cfe/trunk/test/SemaObjC/unimplemented-protocol-prop.m (original)
+++ cfe/trunk/test/SemaObjC/unimplemented-protocol-prop.m Mon Sep 26 19:23:52
2011
@@ -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
+
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits