brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.0 KiB · 8d374f8 Raw
73 lines · c
1// RUN: %clang_cc1 -fsyntax-only -triple arm64-apple-macos -DMAC -verify %s2// RUN: %clang_cc1 -fsyntax-only -triple arm64-apple-ios13.1 -DIOS -verify %s3// RUN: %clang_cc1 -fsyntax-only -triple arm64-apple-ios13.1-macabi -DCATALYST -verify %s4// RUN: %clang_cc1 -fsyntax-only -triple arm64-apple-macos12 -darwin-target-variant-triple arm64-apple-ios-macabi -DZIPPERED -verify %s5// expected-no-diagnostics6 7#if !__has_builtin(__is_target_variant_os) || !__has_builtin(__is_target_variant_environment)8  #error "has builtin doesn't work"9#endif10 11#ifdef ZIPPERED12 13  // Target variant is a darwin.14  #if !__is_target_variant_os(darwin)15    #error "mismatching variant os"16  #endif17 18  // Target variant is not macOS...19  #if __is_target_variant_os(macos)20    #error "mismatching variant os"21  #endif22 23  // ...but iOS.24  #if !__is_target_variant_os(ios)25    #error "mismatching variant os"26  #endif27 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 redundant31  // with checking the former.32  #if !__is_target_variant_environment(macabi)33    #error "mismatching variant environment"34  #endif35 36#else37 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  #endif44 45  #if __is_target_variant_os(macos)46    #error "mismatching variant os"47  #endif48 49  #if __is_target_variant_os(ios)50    #error "mismatching variant os"51  #endif52 53  #if __is_target_variant_environment(macabi)54    #error "mismatching variant environment"55  #endif56 57#endif58 59// The target environment in zippered builds is _not_ macabi.60// The target environment is macabi only in catalyst builds.61#ifdef CATALYST62  #if !__is_target_environment(macabi)63    #error "mismatching environment"64  #endif65  #if !__is_target_os(ios)66    #error "mismatching os"67  #endif68#else69  #if __is_target_environment(macabi)70    #error "mismatching environment"71  #endif72#endif73