@@ -13,6 +13,7 @@ CLANG_ENABLED_AVAILABILITY_DOMAIN(feature1);
13
13
CLANG_DISABLED_AVAILABILITY_DOMAIN (feature2 );
14
14
CLANG_ENABLED_AVAILABILITY_DOMAIN (feature3 );
15
15
CLANG_DYNAMIC_AVAILABILITY_DOMAIN (feature4 , pred1 );
16
+ CLANG_ALWAYS_ENABLED_AVAILABILITY_DOMAIN (feature5 );
16
17
#endif
17
18
18
19
__attribute__((availability (domain :feature1 , AVAIL ))) void func12 (void );
@@ -31,6 +32,8 @@ __attribute__((availability(domain:feature4, AVAIL))) void func10(void);
31
32
__attribute__((availability (domain :feature4 , UNAVAIL ))) void func11 (void );
32
33
__attribute__((availability (domain :feature4 , AVAIL ))) int g4 ;
33
34
__attribute__((availability (domain :feature4 , UNAVAIL ))) int g5 ;
35
+ __attribute__((availability (domain :feature5 , AVAIL ))) void func21 (void );
36
+ __attribute__((availability (domain :feature5 , UNAVAIL ))) void func22 (void );
34
37
#endif
35
38
36
39
void test_unreachable_code (void ) {
@@ -237,3 +240,19 @@ void test7(void) {
237
240
e = EB ; // expected-error {{use of 'EB' requires feature 'feature1' to be available}}
238
241
}
239
242
}
243
+
244
+ #ifdef USE_DOMAIN
245
+ void test8 (void ) {
246
+ // FIXME: Use of 'func21()' should not be diagnosed because feature5 is always available.
247
+ func21 (); // expected-error {{use of 'func21' requires feature 'feature5' to be available}}
248
+ func22 (); // expected-error {{use of 'func22' requires feature 'feature5' to be unavailable}}
249
+
250
+ if (__builtin_available (domain :feature5 )) {
251
+ func21 ();
252
+ func22 (); // expected-error {{use of 'func22' requires feature 'feature5' to be unavailable}}
253
+ } else {
254
+ func21 (); // expected-error {{use of 'func21' requires feature 'feature5' to be available}}
255
+ func22 ();
256
+ }
257
+ }
258
+ #endif
0 commit comments