brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.2 KiB · 703ef42 Raw
117 lines · c
1/// This test verifies several different patterns of iOS, and app extension, availability declarations & usages.2// RUN: %clang_cc1 "-triple" "arm64-apple-ios26" -DNEW -fsyntax-only -verify %s3// RUN: %clang_cc1 "-triple" "arm64-apple-ios18" -fsyntax-only -verify -fapplication-extension -DAPP_EXT %s4// RUN: %clang_cc1 "-triple" "arm64-apple-ios18" -fsyntax-only -verify %s5 6__attribute__((availability(ios,strict,introduced=19)))7void fNew1();8#ifndef NEW9// expected-note@-2 {{here}}10#endif11 12__attribute__((availability(ios,strict,introduced=19)))13void fNew();14 15__attribute__((availability(ios,strict,introduced=26)))16void fNew() { }17#ifndef NEW18// expected-note@-2 {{here}}19#endif20 21__attribute__((availability(ios,strict,deprecated=19)))22void fDep();23 24__attribute__((availability(ios,strict,deprecated=26)))25void fDep() { }26#ifdef NEW27// expected-note@-2 {{here}}28#endif29 30__attribute__((availability(ios,strict,obsoleted=19)))31void fObs();32 33__attribute__((availability(ios,strict,obsoleted=26)))34void fObs() { }35#ifdef NEW36// expected-note@-2 {{here}}37#endif38 39__attribute__((availability(ios_app_extension,strict,introduced=19)))40void fAppExt();41 42__attribute__((availability(ios_app_extension,strict,introduced=26)))43void fAppExt() { }44#ifdef APP_EXT45// expected-note@-2 {{here}}46#endif47 48void testVersionRemapping() {49  fNew1();50#ifndef NEW51  // expected-error@-2 {{'fNew1' is unavailable: introduced in iOS 26.0}}52#endif53  fNew();54#ifndef NEW55  // expected-error@-2 {{'fNew' is unavailable: introduced in iOS 26}}56#endif57  fDep();58#ifdef NEW59  // expected-warning@-2 {{'fDep' is deprecated: first deprecated in iOS 26}}60#endif61  fObs();62#ifdef NEW63  // expected-error@-2 {{'fObs' is unavailable: obsoleted in iOS 26}}64#endif65 66  fAppExt();67#ifdef APP_EXT68  // expected-error@-2 {{'fAppExt' is unavailable: introduced in iOS (App Extension) 26}}69#endif70}71 72__attribute__((availability(ios,strict,introduced=18.5))) // expected-note {{here}}73void fMatchErr();74 75__attribute__((availability(ios,strict,introduced=26))) // expected-warning {{availability does not match previous declaration}}76void fMatchErr() { }77 78__attribute__((availability(ios_app_extension,strict,introduced=19))) // expected-note {{here}}79void fAppExtErr();80 81__attribute__((availability(ios_app_extension,strict,introduced=26.1))) // expected-warning {{availability does not match previous declaration}}82void fAppExtErr() { }83 84__attribute__((availability(ios,introduced=26)))85void fNew2();86#ifndef NEW87  // expected-note@-2 {{'fNew2' has been marked as being introduced in iOS 26 here, but the deployment target is iOS 18}}88#endif89__attribute__((availability(ios,introduced=19)))90void fNew3();91 92__attribute__((availability(ios,introduced=27)))93void evenNewer();94#ifdef NEW95  // expected-note@-2 {{'evenNewer' has been marked as being introduced in iOS 27 here, but the deployment target is iOS 26}}96#endif97 98void testAvailabilityCheck() {99  if (__builtin_available(iOS 19, *)) {100    fNew2();101    fNew3();102  }103  if (__builtin_available(iOS 26, *)) {104    fNew2();105    fNew3();106  }107  fNew2();108#ifndef NEW109  // expected-warning@-2 {{'fNew2' is only available on iOS 26 or newer}} expected-note@-2 {{enclose}}110#endif111#ifdef NEW112  evenNewer(); // expected-warning {{'evenNewer' is only available on iOS 27 or newer}} expected-note {{enclose}}113#endif114}115 116 117