xref: /minix3/external/bsd/llvm/dist/clang/test/SemaObjC/property-noninherited-availability-attr.m (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1f4a2713aSLionel Sambuc// RUN: %clang_cc1 -triple x86_64-apple-macosx10.8.0 -fsyntax-only -verify %s
2f4a2713aSLionel Sambuc
3*0a6a1f1dSLionel Sambuc// This test case shows that 'availability' and 'deprecated' do not inherit
4f4a2713aSLionel Sambuc// when a property is redeclared in a subclass.  This is intentional.
5f4a2713aSLionel Sambuc
6f4a2713aSLionel Sambuc@interface NSObject @end
7f4a2713aSLionel Sambuc@protocol myProtocol
8*0a6a1f1dSLionel Sambuc@property int myProtocolProperty __attribute__((availability(macosx,introduced=10.7,deprecated=10.8))); // expected-note {{'myProtocolProperty' has been explicitly marked deprecated here}} \
9f4a2713aSLionel Sambuc                                                                                                        // expected-note {{property 'myProtocolProperty' is declared deprecated here}}
10f4a2713aSLionel Sambuc@end
11f4a2713aSLionel Sambuc
12f4a2713aSLionel Sambuc@interface Foo : NSObject
13*0a6a1f1dSLionel Sambuc@property int myProperty __attribute__((availability(macosx,introduced=10.7,deprecated=10.8)));  // expected-note 2 {{'myProperty' has been explicitly marked deprecated here}} \
14f4a2713aSLionel Sambuc								// expected-note {{property 'myProperty' is declared deprecated here}}
15f4a2713aSLionel Sambuc@end
16f4a2713aSLionel Sambuc
17f4a2713aSLionel Sambuc@interface Bar : Foo <myProtocol>
18f4a2713aSLionel Sambuc@property int myProperty;
19f4a2713aSLionel Sambuc@property int myProtocolProperty;
20f4a2713aSLionel Sambuc@end
21f4a2713aSLionel Sambuc
22f4a2713aSLionel Sambucvoid test(Foo *y, Bar *x, id<myProtocol> z) {
23f4a2713aSLionel Sambuc  y.myProperty = 0; // expected-warning {{'myProperty' is deprecated: first deprecated in OS X 10.8}}
24*0a6a1f1dSLionel Sambuc  (void)[y myProperty];   // expected-warning {{'myProperty' is deprecated: first deprecated in OS X 10.8}}
25f4a2713aSLionel Sambuc
26f4a2713aSLionel Sambuc  x.myProperty = 1; // no-warning
27*0a6a1f1dSLionel Sambuc  (void)[x myProperty]; // no-warning
28f4a2713aSLionel Sambuc
29f4a2713aSLionel Sambuc  x.myProtocolProperty = 0; // no-warning
30f4a2713aSLionel Sambuc
31*0a6a1f1dSLionel Sambuc  (void)[x myProtocolProperty]; // no-warning
32*0a6a1f1dSLionel Sambuc  (void)[z myProtocolProperty]; // expected-warning {{'myProtocolProperty' is deprecated: first deprecated in OS X 10.8}}
33f4a2713aSLionel Sambuc}
34