|
1 | | -// RUN: %clang_cc1 -fblocks -ffeature-availability=feature1:ON -ffeature-availability=feature2:OFF -fsyntax-only -verify %s |
2 | | -// RUN: %clang_cc1 -fblocks -fsyntax-only -verify -DUSE_DOMAIN %s |
| 1 | +// RUN: %clang_cc1 -fblocks -ffeature-availability=feature1:ON -ffeature-availability=feature2:OFF -fsyntax-only -verify=expected,enabled %s |
| 2 | +// RUN: %clang_cc1 -fblocks -fsyntax-only -verify=expected,enabled -DUSE_DOMAIN %s |
| 3 | +// RUN: %clang_cc1 -fblocks -fsyntax-only -verify=expected -DUSE_DOMAIN -DALWAYS_ENABLED %s |
3 | 4 |
|
4 | 5 | #include <availability_domain.h> |
5 | 6 |
|
6 | 7 | #define AVAIL 0 |
7 | 8 | #define UNAVAIL 1 |
8 | 9 |
|
9 | 10 | #ifdef USE_DOMAIN |
| 11 | +#ifdef ALWAYS_ENABLED |
| 12 | +CLANG_ALWAYS_ENABLED_AVAILABILITY_DOMAIN(feature1); |
| 13 | +#else |
10 | 14 | CLANG_ENABLED_AVAILABILITY_DOMAIN(feature1); |
| 15 | +#endif |
11 | 16 | CLANG_DISABLED_AVAILABILITY_DOMAIN(feature2); |
12 | 17 | #endif |
13 | 18 |
|
|
19 | 24 |
|
20 | 25 | @interface C0 { |
21 | 26 | struct S0 ivar0; // expected-error {{cannot use 'S0' because feature 'feature1' is available in this context}} |
22 | | - struct S1 ivar1; // expected-error {{cannot use 'S1' because feature 'feature1' is unavailable in this context}} |
| 27 | + struct S1 ivar1; // enabled-error {{cannot use 'S1' because feature 'feature1' is unavailable in this context}} |
23 | 28 | struct S1 ivar2 __attribute__((availability(domain:feature1, AVAIL))); |
24 | | - struct S1 ivar3 __attribute__((availability(domain:feature1, UNAVAIL))); // expected-error {{cannot use 'S1' because feature 'feature1' is unavailable in this context}} |
| 29 | + struct S1 ivar3 __attribute__((availability(domain:feature1, UNAVAIL))); // enabled-error {{cannot use 'S1' because feature 'feature1' is unavailable in this context}} |
25 | 30 | } |
26 | 31 | @property struct S0 prop0; // expected-error {{cannot use 'S0' because feature 'feature1' is available in this context}} |
27 | | -@property struct S1 prop1; // expected-error {{cannot use 'S1' because feature 'feature1' is unavailable in this context}} |
| 32 | +@property struct S1 prop1; // enabled-error {{cannot use 'S1' because feature 'feature1' is unavailable in this context}} |
28 | 33 | @property struct S1 prop2 __attribute__((availability(domain:feature1, AVAIL))); |
29 | | -@property struct S1 prop3 __attribute__((availability(domain:feature1, UNAVAIL))); // expected-error {{cannot use 'S1' because feature 'feature1' is unavailable in this context}} |
| 34 | +@property struct S1 prop3 __attribute__((availability(domain:feature1, UNAVAIL))); // enabled-error {{cannot use 'S1' because feature 'feature1' is unavailable in this context}} |
30 | 35 | -(struct S0)m0; // expected-error {{cannot use 'S0' because feature 'feature1' is available in this context}} |
31 | | --(struct S1)m1; // expected-error {{cannot use 'S1' because feature 'feature1' is unavailable in this context}} |
| 36 | +-(struct S1)m1; // enabled-error {{cannot use 'S1' because feature 'feature1' is unavailable in this context}} |
32 | 37 | -(struct S1)m2 __attribute__((availability(domain:feature1, AVAIL))); |
33 | | --(struct S1)m3 __attribute__((availability(domain:feature1, UNAVAIL))); // expected-error {{cannot use 'S1' because feature 'feature1' is unavailable in this context}} |
| 38 | +-(struct S1)m3 __attribute__((availability(domain:feature1, UNAVAIL))); // enabled-error {{cannot use 'S1' because feature 'feature1' is unavailable in this context}} |
34 | 39 | @end |
35 | 40 |
|
36 | 41 | @class Base0; |
@@ -59,7 +64,7 @@ @interface NSObject |
59 | 64 | @interface Base7<T> : NSObject |
60 | 65 | @end |
61 | 66 |
|
62 | | -@interface Derived3 : Base7<Base0 *> // expected-error {{cannot use 'Base0' because feature 'feature1' is unavailable in this context}} |
| 67 | +@interface Derived3 : Base7<Base0 *> // enabled-error {{cannot use 'Base0' because feature 'feature1' is unavailable in this context}} |
63 | 68 | @end |
64 | 69 |
|
65 | 70 | __attribute__((availability(domain:feature1, AVAIL))) // expected-note {{is incompatible with __attribute__((availability(domain:feature1, 0)))}} expected-note 2 {{feature attribute __attribute__((availability(domain:feature1, 0)))}} |
@@ -116,7 +121,7 @@ @interface Derived1(C1) // expected-error {{cannot merge incompatible feature at |
116 | 121 | @end |
117 | 122 |
|
118 | 123 | @protocol P0 |
119 | | -@property struct S1 *p0; // expected-error {{cannot use 'S1' because feature 'feature1' is unavailable in this context}} |
| 124 | +@property struct S1 *p0; // enabled-error {{cannot use 'S1' because feature 'feature1' is unavailable in this context}} |
120 | 125 | @end |
121 | 126 |
|
122 | 127 | __attribute__((availability(domain:feature1, AVAIL))) |
@@ -198,8 +203,8 @@ @implementation Derived9 : Base9 |
198 | 203 | -(void)m4 { |
199 | 204 | // Check that this method doesn't inherit the domain availablity attribute |
200 | 205 | // from the base class method. |
201 | | - func1(); // expected-error {{cannot use 'func1' because feature 'feature1' is unavailable in this context}} |
| 206 | + func1(); // enabled-error {{cannot use 'func1' because feature 'feature1' is unavailable in this context}} |
202 | 207 |
|
203 | | - [super m4]; // expected-error {{cannot use 'm4' because feature 'feature1' is unavailable in this context}} |
| 208 | + [super m4]; // enabled-error {{cannot use 'm4' because feature 'feature1' is unavailable in this context}} |
204 | 209 | } |
205 | 210 | @end |
0 commit comments