[cfe-commits] r140586 - in /cfe/trunk: lib/Sema/SemaObjCProperty.cpp test/SemaObjC/unimplemented-protocol-prop.m
Fariborz Jahanian
fjahanian at apple.com
Mon Sep 26 17:23:52 PDT 2011
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
+
+ at protocol PROTOCOL1
+ at property int MyProp;
+ at end
+
+ at interface superclass
+ at property int MyProp;
+ at end
+
+ at interface childclass : superclass <PROTOCOL1>
+ at end
+
+ at implementation childclass
+ at end
+
More information about the cfe-commits
mailing list