1 // UNSUPPORTED: system-windows
2 
3 // General tests that the header search paths for libstdc++ detected by the
4 // driver and passed to CC1 are correct on Darwin platforms.
5 
6 // Check x86 and x86_64
7 //
8 // RUN: %clang -no-canonical-prefixes %s -### -fsyntax-only 2>&1 \
9 // RUN:     -target i686-apple-darwin \
10 // RUN:     -stdlib=libstdc++ \
11 // RUN:     -isysroot %S/Inputs/basic_darwin_sdk_libstdcxx_x86 \
12 // RUN:   | FileCheck -DSYSROOT=%S/Inputs/basic_darwin_sdk_libstdcxx_x86 --check-prefix=CHECK-LIBSTDCXX-X86 %s
13 // CHECK-LIBSTDCXX-X86: "{{[^"]*}}clang{{[^"]*}}" "-cc1"
14 // CHECK-LIBSTDCXX-X86: "-internal-isystem" "[[SYSROOT]]/usr/include/c++/4.2.1"
15 // CHECK-LIBSTDCXX-X86: "-internal-isystem" "[[SYSROOT]]/usr/include/c++/4.2.1/i686-apple-darwin10"
16 // CHECK-LIBSTDCXX-X86: "-internal-isystem" "[[SYSROOT]]/usr/include/c++/4.2.1/backward"
17 // CHECK-LIBSTDCXX-X86: "-internal-isystem" "[[SYSROOT]]/usr/include/c++/4.0.0"
18 // CHECK-LIBSTDCXX-X86: "-internal-isystem" "[[SYSROOT]]/usr/include/c++/4.0.0/i686-apple-darwin8"
19 // CHECK-LIBSTDCXX-X86: "-internal-isystem" "[[SYSROOT]]/usr/include/c++/4.0.0/backward"
20 //
21 // RUN: %clang -no-canonical-prefixes %s -### -fsyntax-only 2>&1 \
22 // RUN:     -target x86_64-apple-darwin \
23 // RUN:     -stdlib=libstdc++ \
24 // RUN:     -isysroot %S/Inputs/basic_darwin_sdk_libstdcxx_x86 \
25 // RUN:   | FileCheck -DSYSROOT=%S/Inputs/basic_darwin_sdk_libstdcxx_x86 --check-prefix=CHECK-LIBSTDCXX-X86_64 %s
26 // CHECK-LIBSTDCXX-X86_64: "{{[^"]*}}clang{{[^"]*}}" "-cc1"
27 // CHECK-LIBSTDCXX-X86_64: "-internal-isystem" "[[SYSROOT]]/usr/include/c++/4.2.1"
28 // CHECK-LIBSTDCXX-X86_64: "-internal-isystem" "[[SYSROOT]]/usr/include/c++/4.2.1/i686-apple-darwin10/x86_64"
29 // CHECK-LIBSTDCXX-X86_64: "-internal-isystem" "[[SYSROOT]]/usr/include/c++/4.2.1/backward"
30 // CHECK-LIBSTDCXX-X86_64: "-internal-isystem" "[[SYSROOT]]/usr/include/c++/4.0.0"
31 // CHECK-LIBSTDCXX-X86_64: "-internal-isystem" "[[SYSROOT]]/usr/include/c++/4.0.0/i686-apple-darwin8"
32 // CHECK-LIBSTDCXX-X86_64: "-internal-isystem" "[[SYSROOT]]/usr/include/c++/4.0.0/backward"
33 
34 // Check arm and thumb
35 //
36 // RUN: %clang -no-canonical-prefixes %s -### -fsyntax-only 2>&1 \
37 // RUN:     -target arm-apple-darwin \
38 // RUN:     -stdlib=libstdc++ \
39 // RUN:     -isysroot %S/Inputs/basic_darwin_sdk_libstdcxx_arm \
40 // RUN:   | FileCheck -DSYSROOT=%S/Inputs/basic_darwin_sdk_libstdcxx_arm --check-prefix=CHECK-LIBSTDCXX-ARM %s
41 // CHECK-LIBSTDCXX-ARM: "{{[^"]*}}clang{{[^"]*}}" "-cc1"
42 // CHECK-LIBSTDCXX-ARM: "-internal-isystem" "[[SYSROOT]]/usr/include/c++/4.2.1"
43 // CHECK-LIBSTDCXX-ARM: "-internal-isystem" "[[SYSROOT]]/usr/include/c++/4.2.1/arm-apple-darwin10/v7"
44 // CHECK-LIBSTDCXX-ARM: "-internal-isystem" "[[SYSROOT]]/usr/include/c++/4.2.1/backward"
45 // CHECK-LIBSTDCXX-ARM: "-internal-isystem" "[[SYSROOT]]/usr/include/c++/4.2.1"
46 // CHECK-LIBSTDCXX-ARM: "-internal-isystem" "[[SYSROOT]]/usr/include/c++/4.2.1/arm-apple-darwin10/v6"
47 // CHECK-LIBSTDCXX-ARM: "-internal-isystem" "[[SYSROOT]]/usr/include/c++/4.2.1/backward"
48 //
49 // RUN: %clang -no-canonical-prefixes %s -### -fsyntax-only 2>&1 \
50 // RUN:     -target arm-apple-darwin \
51 // RUN:     -stdlib=libstdc++ \
52 // RUN:     -isysroot %S/Inputs/basic_darwin_sdk_libstdcxx_arm \
53 // RUN:   | FileCheck -DSYSROOT=%S/Inputs/basic_darwin_sdk_libstdcxx_arm --check-prefix=CHECK-LIBSTDCXX-THUMB %s
54 // CHECK-LIBSTDCXX-THUMB: "{{[^"]*}}clang{{[^"]*}}" "-cc1"
55 // CHECK-LIBSTDCXX-THUMB: "-internal-isystem" "[[SYSROOT]]/usr/include/c++/4.2.1"
56 // CHECK-LIBSTDCXX-THUMB: "-internal-isystem" "[[SYSROOT]]/usr/include/c++/4.2.1/arm-apple-darwin10/v7"
57 // CHECK-LIBSTDCXX-THUMB: "-internal-isystem" "[[SYSROOT]]/usr/include/c++/4.2.1/backward"
58 // CHECK-LIBSTDCXX-THUMB: "-internal-isystem" "[[SYSROOT]]/usr/include/c++/4.2.1"
59 // CHECK-LIBSTDCXX-THUMB: "-internal-isystem" "[[SYSROOT]]/usr/include/c++/4.2.1/arm-apple-darwin10/v6"
60 // CHECK-LIBSTDCXX-THUMB: "-internal-isystem" "[[SYSROOT]]/usr/include/c++/4.2.1/backward"
61 
62 // Check aarch64
63 //
64 // RUN: %clang -no-canonical-prefixes %s -### -fsyntax-only 2>&1 \
65 // RUN:     -target arm64-apple-darwin \
66 // RUN:     -stdlib=libstdc++ \
67 // RUN:     -isysroot %S/Inputs/basic_darwin_sdk_libstdcxx_aarch64 \
68 // RUN:   | FileCheck -DSYSROOT=%S/Inputs/basic_darwin_sdk_libstdcxx_aarch64 --check-prefix=CHECK-LIBSTDCXX-AARCH64 %s
69 // CHECK-LIBSTDCXX-AARCH64: "{{[^"]*}}clang{{[^"]*}}" "-cc1"
70 // CHECK-LIBSTDCXX-AARCH64: "-internal-isystem" "[[SYSROOT]]/usr/include/c++/4.2.1"
71 // CHECK-LIBSTDCXX-AARCH64: "-internal-isystem" "[[SYSROOT]]/usr/include/c++/4.2.1/arm64-apple-darwin10"
72 // CHECK-LIBSTDCXX-AARCH64: "-internal-isystem" "[[SYSROOT]]/usr/include/c++/4.2.1/backward"
73 
74 // Make sure we issue a warning when we can't find the path
75 //
76 // RUN: %clang -no-canonical-prefixes %s -fsyntax-only 2>&1 \
77 // RUN:     -target x86_64-apple-darwin \
78 // RUN:     -stdlib=libstdc++ \
79 // RUN:     -isysroot %S/Inputs/basic_darwin_sdk_no_libstdcxx \
80 // RUN:   | FileCheck --check-prefix=CHECK-LIBSTDCXX-MISSING %s
81 // CHECK-LIBSTDCXX-MISSING: clang: warning: include path for libstdc++ headers not found; pass '-stdlib=libc++' on the command line to use the libc++ standard library instead
82 //
83 // RUN: %clang %s -target x86_64-apple-darwin -fsyntax-only 2>&1 \
84 // RUN:           -isysroot %S/Inputs/basic_darwin_sdk_no_libstdcxx \
85 // RUN:           -stdlib=libc++ \
86 // RUN:    | FileCheck -allow-empty --check-prefix=CHECK-LIBSTDCXX-MISSING-1 %s
87 // CHECK-LIBSTDCXX-MISSING-1-NOT: warning
88 //
89 // RUN: %clang %s -target x86_64-apple-darwin16 -fsyntax-only 2>&1 \
90 // RUN:           -isysroot %S/Inputs/basic_darwin_sdk_no_libstdcxx -stdlib=platform \
91 // RUN:    | FileCheck -allow-empty --check-prefix=CHECK-LIBSTDCXX-MISSING-2 %s
92 // CHECK-LIBSTDCXX-MISSING-2-NOT: warning
93