@@ -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#pragma clang attribute push (__attribute__((availability(domain:feature1, AVAIL))), apply_to=any(function))
@@ -34,6 +35,8 @@ __attribute__((availability(domain:feature4, AVAIL))) void func10(void);
3435__attribute__((availability (domain :feature4 , UNAVAIL ))) void func11 (void );
3536__attribute__((availability (domain :feature4 , AVAIL ))) int g4 ;
3637__attribute__((availability (domain :feature4 , UNAVAIL ))) int g5 ;
38+ __attribute__((availability (domain :feature5 , AVAIL ))) void func21 (void );
39+ __attribute__((availability (domain :feature5 , UNAVAIL ))) void func22 (void );
3740#endif
3841
3942void test_unreachable_code (void ) {
@@ -240,3 +243,19 @@ void test7(void) {
240243 e = EB ; // expected-error {{use of 'EB' requires feature 'feature1' to be available}}
241244 }
242245}
246+
247+ #ifdef USE_DOMAIN
248+ void test8 (void ) {
249+ // FIXME: Use of 'func21()' should not be diagnosed because feature5 is always available.
250+ func21 (); // expected-error {{use of 'func21' requires feature 'feature5' to be available}}
251+ func22 (); // expected-error {{use of 'func22' requires feature 'feature5' to be unavailable}}
252+
253+ if (__builtin_available (domain :feature5 )) {
254+ func21 ();
255+ func22 (); // expected-error {{use of 'func22' requires feature 'feature5' to be unavailable}}
256+ } else {
257+ func21 (); // expected-error {{use of 'func21' requires feature 'feature5' to be available}}
258+ func22 ();
259+ }
260+ }
261+ #endif
0 commit comments