annotate clang/test/SemaObjC/property-noninherited-availability-attr.m @ 207:2e18cbf3894f

LLVM12
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Tue, 08 Jun 2021 06:07:14 +0900
parents 1d019706d866
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
150
anatofuz
parents:
diff changeset
1 // RUN: %clang_cc1 -triple x86_64-apple-macosx10.8.0 -fsyntax-only -verify %s
anatofuz
parents:
diff changeset
2
anatofuz
parents:
diff changeset
3 // This test case shows that 'availability' and 'deprecated' do not inherit
anatofuz
parents:
diff changeset
4 // when a property is redeclared in a subclass. This is intentional.
anatofuz
parents:
diff changeset
5
anatofuz
parents:
diff changeset
6 @interface NSObject @end
anatofuz
parents:
diff changeset
7 @protocol myProtocol
anatofuz
parents:
diff changeset
8 @property int myProtocolProperty __attribute__((availability(macosx,introduced=10.7,deprecated=10.8))); // expected-note {{'myProtocolProperty' has been explicitly marked deprecated here}} \
anatofuz
parents:
diff changeset
9 // expected-note {{property 'myProtocolProperty' is declared deprecated here}}
anatofuz
parents:
diff changeset
10 @end
anatofuz
parents:
diff changeset
11
anatofuz
parents:
diff changeset
12 @interface Foo : NSObject
anatofuz
parents:
diff changeset
13 @property int myProperty __attribute__((availability(macosx,introduced=10.7,deprecated=10.8))); // expected-note 2 {{'myProperty' has been explicitly marked deprecated here}} \
anatofuz
parents:
diff changeset
14 // expected-note {{property 'myProperty' is declared deprecated here}}
anatofuz
parents:
diff changeset
15 @end
anatofuz
parents:
diff changeset
16
anatofuz
parents:
diff changeset
17 @interface Bar : Foo <myProtocol>
anatofuz
parents:
diff changeset
18 @property int myProperty;
anatofuz
parents:
diff changeset
19 @property int myProtocolProperty;
anatofuz
parents:
diff changeset
20 @end
anatofuz
parents:
diff changeset
21
anatofuz
parents:
diff changeset
22 void test(Foo *y, Bar *x, id<myProtocol> z) {
anatofuz
parents:
diff changeset
23 y.myProperty = 0; // expected-warning {{'myProperty' is deprecated: first deprecated in macOS 10.8}}
anatofuz
parents:
diff changeset
24 (void)[y myProperty]; // expected-warning {{'myProperty' is deprecated: first deprecated in macOS 10.8}}
anatofuz
parents:
diff changeset
25
anatofuz
parents:
diff changeset
26 x.myProperty = 1; // no-warning
anatofuz
parents:
diff changeset
27 (void)[x myProperty]; // no-warning
anatofuz
parents:
diff changeset
28
anatofuz
parents:
diff changeset
29 x.myProtocolProperty = 0; // no-warning
anatofuz
parents:
diff changeset
30
anatofuz
parents:
diff changeset
31 (void)[x myProtocolProperty]; // no-warning
anatofuz
parents:
diff changeset
32 (void)[z myProtocolProperty]; // expected-warning {{'myProtocolProperty' is deprecated: first deprecated in macOS 10.8}}
anatofuz
parents:
diff changeset
33 }