236
|
1 // RUN: %clang_cc1 -fsyntax-only -triple arm64-apple-macos -DMAC -verify %s
|
|
2 // RUN: %clang_cc1 -fsyntax-only -triple arm64-apple-ios13.1 -DIOS -verify %s
|
|
3 // RUN: %clang_cc1 -fsyntax-only -triple arm64-apple-ios13.1-macabi -DCATALYST -verify %s
|
|
4 // RUN: %clang_cc1 -fsyntax-only -triple arm64-apple-macos12 -darwin-target-variant-triple arm64-apple-ios-macabi -DZIPPERED -verify %s
|
|
5 // expected-no-diagnostics
|
|
6
|
|
7 #if !__has_builtin(__is_target_variant_os) || !__has_builtin(__is_target_variant_environment)
|
|
8 #error "has builtin doesn't work"
|
|
9 #endif
|
|
10
|
|
11 #ifdef ZIPPERED
|
|
12
|
|
13 // Target variant is a darwin.
|
|
14 #if !__is_target_variant_os(darwin)
|
|
15 #error "mismatching variant os"
|
|
16 #endif
|
|
17
|
|
18 // Target variant is not macOS...
|
|
19 #if __is_target_variant_os(macos)
|
|
20 #error "mismatching variant os"
|
|
21 #endif
|
|
22
|
|
23 // ...but iOS.
|
|
24 #if !__is_target_variant_os(ios)
|
|
25 #error "mismatching variant os"
|
|
26 #endif
|
|
27
|
|
28 // Zippered builds also set the target variant environment to macabi.
|
|
29 // At the moment, only zippered builds set __is_target_variant_os(ios),
|
|
30 // so checking __is_target_variant_environment() is currently redundant
|
|
31 // with checking the former.
|
|
32 #if !__is_target_variant_environment(macabi)
|
|
33 #error "mismatching variant environment"
|
|
34 #endif
|
|
35
|
|
36 #else
|
|
37
|
|
38 // In non-zippered builds, even for catalyst, no target variant is set.
|
|
39 // So these are all false.
|
|
40
|
|
41 #if __is_target_variant_os(darwin)
|
|
42 #error "mismatching variant os"
|
|
43 #endif
|
|
44
|
|
45 #if __is_target_variant_os(macos)
|
|
46 #error "mismatching variant os"
|
|
47 #endif
|
|
48
|
|
49 #if __is_target_variant_os(ios)
|
|
50 #error "mismatching variant os"
|
|
51 #endif
|
|
52
|
|
53 #if __is_target_variant_environment(macabi)
|
|
54 #error "mismatching variant environment"
|
|
55 #endif
|
|
56
|
|
57 #endif
|
|
58
|
|
59 // The target environment in zippered builds is _not_ macabi.
|
|
60 // The target environment is macabi only in catalyst builds.
|
|
61 #ifdef CATALYST
|
|
62 #if !__is_target_environment(macabi)
|
|
63 #error "mismatching environment"
|
|
64 #endif
|
|
65 #if !__is_target_os(ios)
|
|
66 #error "mismatching os"
|
|
67 #endif
|
|
68 #else
|
|
69 #if __is_target_environment(macabi)
|
|
70 #error "mismatching environment"
|
|
71 #endif
|
|
72 #endif
|