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
7 #if !__has_builtin(__is_target_variant_os) || !__has_builtin(__is_target_variant_environment)
8 #error "has builtin doesn't work"
13 // Target variant is a darwin.
14 #if !__is_target_variant_os(darwin)
15 #error "mismatching variant os"
18 // Target variant is not macOS...
19 #if __is_target_variant_os(macos)
20 #error "mismatching variant os"
24 #if !__is_target_variant_os(ios)
25 #error "mismatching variant os"
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"
38 // In non-zippered builds, even for catalyst, no target variant is set.
39 // So these are all false.
41 #if __is_target_variant_os(darwin)
42 #error "mismatching variant os"
45 #if __is_target_variant_os(macos)
46 #error "mismatching variant os"
49 #if __is_target_variant_os(ios)
50 #error "mismatching variant os"
53 #if __is_target_variant_environment(macabi)
54 #error "mismatching variant environment"
59 // The target environment in zippered builds is _not_ macabi.
60 // The target environment is macabi only in catalyst builds.
62 #if !__is_target_environment(macabi)
63 #error "mismatching environment"
65 #if !__is_target_os(ios)
66 #error "mismatching os"
69 #if __is_target_environment(macabi)
70 #error "mismatching environment"