Author: fjahanian
Date: Mon Mar 25 18:59:42 2013
New Revision: 177948
URL: http://llvm.org/viewvc/llvm-project?rev=177948&view=rev
Log:
Objective-C: Property declaration overiding one in
its super class or protocols inherit their
availability/deprecated attribute. // rdar://13467644
Added:
cfe/trunk/test/SemaObjC/property-inherited-availability-attr.m
Modified:
cfe/trunk/lib/Sema/SemaObjCProperty.cpp
Modified: cfe/trunk/lib/Sema/SemaObjCProperty.cpp
URL:
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaObjCProperty.cpp?rev=177948&r1=177947&r2=177948&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaObjCProperty.cpp (original)
+++ cfe/trunk/lib/Sema/SemaObjCProperty.cpp Mon Mar 25 18:59:42 2013
@@ -127,6 +127,7 @@ CheckPropertyAgainstProtocol(Sema &S, Ob
for (unsigned I = 0, N = R.size(); I != N; ++I) {
if (ObjCPropertyDecl *ProtoProp = dyn_cast<ObjCPropertyDecl>(R[I])) {
S.DiagnosePropertyMismatch(Prop, ProtoProp, Proto->getIdentifier());
+ S.mergeDeclAttributes(Prop, ProtoProp, Sema::AMK_Override);
return;
}
}
@@ -209,6 +210,7 @@ Decl *Sema::ActOnProperty(Scope *S, Sour
for (unsigned I = 0, N = R.size(); I != N; ++I) {
if (ObjCPropertyDecl *SuperProp = dyn_cast<ObjCPropertyDecl>(R[I])) {
DiagnosePropertyMismatch(Res, SuperProp, Super->getIdentifier());
+ mergeDeclAttributes(Res, SuperProp, AMK_Override);
FoundInSuper = true;
break;
}
Added: cfe/trunk/test/SemaObjC/property-inherited-availability-attr.m
URL:
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/property-inherited-availability-attr.m?rev=177948&view=auto
==============================================================================
--- cfe/trunk/test/SemaObjC/property-inherited-availability-attr.m (added)
+++ cfe/trunk/test/SemaObjC/property-inherited-availability-attr.m Mon Mar 25
18:59:42 2013
@@ -0,0 +1,34 @@
+// RUN: %clang_cc1 -triple x86_64-apple-macosx10.8.0 -fsyntax-only -verify %s
+// rdar://13467644
+
+@interface NSObject @end
+@protocol myProtocol
+@property int myProtocolProperty
__attribute__((availability(macosx,introduced=10.7,deprecated=10.8)));
+@end
+
+@interface Foo : NSObject
+@property int myProperty
__attribute__((availability(macosx,introduced=10.7,deprecated=10.8))); //
expected-note {{'myProperty' declared here}} \
+ //
expected-note {{method 'myProperty' declared here}} \
+ //
expected-note {{property 'myProperty' is declared deprecated here}}
+@end
+
+@interface Bar : Foo <myProtocol>
+@property int myProperty; // expected-note {{'myProperty' declared here}} \
+ // expected-note {{method 'myProperty' declared
here}} \
+ // expected-note {{property 'myProperty' is declared
deprecated here}}
+@property int myProtocolProperty; // expected-note {{'myProtocolProperty'
declared here}} \
+ // expected-note {{method
'myProtocolProperty' declared here}} \
+ // expected-note {{property
'myProtocolProperty' is declared deprecated here}}
+@end
+
+void test(Foo *y, Bar *x) {
+ y.myProperty = 0; // expected-warning {{'myProperty' is deprecated: first
deprecated in OS X 10.8}}
+ [y myProperty]; // expected-warning {{'myProperty' is deprecated: first
deprecated in OS X 10.8}}
+
+ x.myProperty = 1; // expected-warning {{'myProperty' is deprecated: first
deprecated in OS X 10.8}}
+ [x myProperty]; // expected-warning {{'myProperty' is deprecated: first
deprecated in OS X 10.8}}
+
+ x.myProtocolProperty = 0; // expected-warning {{'myProtocolProperty' is
deprecated: first deprecated in OS X 10.8}}
+
+ [x myProtocolProperty]; // expected-warning {{'myProtocolProperty' is
deprecated: first deprecated in OS X 10.8}}
+}
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits