aboutsummaryrefslogtreecommitdiff
path: root/clang/test/Sema/attr-availability-ios-fallback-aligned-versions.c
blob: 8947bc7dda4698dae104b802cde3f4c2bda179d1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// This validates that all expected OSVersions that allow fallbacks 
// from iOS behave as expected against a common version bump.

// RUN: %clang_cc1 "-triple" "arm64-apple-ios26" -fsyntax-only -verify %s
// RUN: %clang_cc1 "-triple" "arm64-apple-watchos26" -fsyntax-only -verify %s
// RUN: %clang_cc1 "-triple" "arm64-apple-tvos26" -fsyntax-only -verify %s

// VisionOS requires SDKSettings support to enable remappings.
// RUN: %clang_cc1 "-triple" "arm64-apple-visionos26" -isysroot %S/Inputs/XROS.sdk -fsyntax-only -verify %s

// expected-no-diagnostics

__attribute__((availability(ios,strict,introduced=19)))
int iOSExistingAPI(void);

__attribute__((availability(ios,strict,introduced=26)))
int iOSExistingAPI2(void);

void testAvailabilityCheck(void) {
  
  if (__builtin_available(iOS 19, *)) {
    iOSExistingAPI();
    iOSExistingAPI2();
  }
  
  if (__builtin_available(iOS 26, *)) {
    iOSExistingAPI();
    iOSExistingAPI2();
  }

  iOSExistingAPI2();
}