@@ -13,6 +13,7 @@ CLANG_ENABLED_AVAILABILITY_DOMAIN(feature1);
1313CLANG_DISABLED_AVAILABILITY_DOMAIN (feature2 );
1414CLANG_ENABLED_AVAILABILITY_DOMAIN (feature3 );
1515CLANG_DYNAMIC_AVAILABILITY_DOMAIN (feature4 , pred1 );
16+ CLANG_ALWAYS_ENABLED_AVAILABILITY_DOMAIN (feature5 );
1617#endif
1718
1819__attribute__((availability (domain :feature1 , AVAIL ))) void func12 (void );
@@ -31,6 +32,8 @@ __attribute__((availability(domain:feature4, AVAIL))) void func10(void);
3132__attribute__((availability (domain :feature4 , UNAVAIL ))) void func11 (void );
3233__attribute__((availability (domain :feature4 , AVAIL ))) int g4 ;
3334__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 );
3437#endif
3538
3639void test_unreachable_code (void ) {
@@ -237,3 +240,19 @@ void test7(void) {
237240 e = EB ; // expected-error {{use of 'EB' requires feature 'feature1' to be available}}
238241 }
239242}
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