1 // RUN: %clang -target x86_64-apple-macosx10.13 -isysroot %S/Inputs/MacOSX10.14.sdk -c -### %s 2>&1 \
3 // RUN: env SDKROOT=%S/Inputs/MacOSX10.14.sdk %clang -target x86_64-apple-macosx10.13 -c -### %s 2>&1 \
6 // RUN: rm -rf %t/SDKs/MacOSX10.10.sdk
7 // RUN: mkdir -p %t/SDKs/MacOSX10.10.sdk
8 // RUN: %clang -m64 -isysroot %t/SDKs/MacOSX10.10.sdk -c -### %s 2>&1 \
9 // RUN: | FileCheck --check-prefix=INFER_SDK_VERSION %s
10 // RUN: sed -e 's/10\.14/10\.8/g' %S/Inputs/MacOSX10.14.sdk/SDKSettings.json > %t/SDKs/MacOSX10.10.sdk/SDKSettings.json
11 // RUN: %clang -m64 -isysroot %t/SDKs/MacOSX10.10.sdk -c -### %s 2>&1 \
12 // RUN: | FileCheck --check-prefix=INFER_DEPLOYMENT_TARGET_VERSION %s
13 // REQUIRES: system-darwin && native
15 // RUN: rm -rf %t/SDKs/MacOSX10.14.sdk
16 // RUN: mkdir -p %t/SDKs/MacOSX10.14.sdk
17 // RUN: %clang -target x86_64-apple-macosx10.13 -isysroot %t/SDKs/MacOSX10.14.sdk -c -### %s 2>&1 \
18 // RUN: | FileCheck --check-prefix=NO_VERSION %s
20 // RUN: rm -rf %t/SDKs/MacOSX10.14.sdk
21 // RUN: mkdir -p %t/SDKs/MacOSX10.14.sdk
22 // RUN: echo '{broken json' > %t/SDKs/MacOSX10.14.sdk/SDKSettings.json
23 // RUN: %clang -target x86_64-apple-macosx10.13 -isysroot %t/SDKs/MacOSX10.14.sdk -c -### %s 2>&1 \
24 // RUN: | FileCheck --check-prefixes=NO_VERSION,ERROR %s
26 // RUN: rm -rf %t/SDKs/MacOSX10.14.sdk
27 // RUN: mkdir -p %t/SDKs/MacOSX10.14.sdk
28 // RUN: echo '{"Version":1}' > %t/SDKs/MacOSX10.14.sdk/SDKSettings.json
29 // RUN: %clang -target x86_64-apple-macosx10.13 -isysroot %t/SDKs/MacOSX10.14.sdk -c -### %s 2>&1 \
30 // RUN: | FileCheck --check-prefixes=NO_VERSION,ERROR %s
32 // CHECK: -target-sdk-version=10.14
33 // INFER_SDK_VERSION: "-triple" "{{arm64|x86_64}}-apple-macosx10.10.0"
34 // INFER_SDK_VERSION-SAME: -target-sdk-version=10.10
35 // INFER_DEPLOYMENT_TARGET_VERSION: "-triple" "{{arm64|x86_64}}-apple-macosx10.8.0"
36 // NO_VERSION-NOT: target-sdk-version
37 // ERROR: warning: SDK settings were ignored as 'SDKSettings.json' could not be parsed