1 // Backslash escaping makes matching against the installation directory fail on
2 // Windows. Temporarily disable the test there until we add an option to print
3 // the installation directory unescaped.
4 // UNSUPPORTED: system-windows
5 
6 // By default, we should search for libc++ next to the driver.
7 // RUN: mkdir -p %t/bin
8 // RUN: mkdir -p %t/include/c++/v1
9 // RUN: %clang -target aarch64-linux-gnu -ccc-install-dir %t/bin \
10 // RUN:   -stdlib=libc++ -fsyntax-only %s -### 2>&1 | \
11 // RUN:   FileCheck -check-prefix=LIBCXX %s
12 // RUN: %clang -target x86_64-apple-darwin -ccc-install-dir %t/bin \
13 // RUN:   -stdlib=libc++ -fsyntax-only %s -### 2>&1 | \
14 // RUN:   FileCheck -check-prefix=LIBCXX %s
15 // LIBCXX: InstalledDir: [[INSTALLDIR:.+$]]
16 // LIBCXX: "-internal-isystem" "[[INSTALLDIR]]/../include/c++/v1"
17 
18 // Passing -stdlib++-isystem should suppress the default search.
19 // RUN: %clang -target aarch64-linux-gnu -ccc-install-dir %t/bin \
20 // RUN:   -stdlib++-isystem /tmp/foo -stdlib++-isystem /tmp/bar -stdlib=libc++ \
21 // RUN:   -fsyntax-only %s -### 2>&1 | FileCheck -check-prefix=NODEFAULT %s
22 // RUN: %clang -target x86_64-apple-darwin -ccc-install-dir %t/bin \
23 // RUN:   -stdlib++-isystem /tmp/foo -stdlib++-isystem /tmp/bar -stdlib=libc++ \
24 // RUN:   -fsyntax-only %s -### 2>&1 | FileCheck -check-prefix=NODEFAULT %s
25 // NODEFAULT: InstalledDir: [[INSTALLDIR:.+$]]
26 // NODEFAULT-NOT: "-internal-isystem" "[[INSTALLDIR]]/../include/c++/v1"
27 
28 // And we should add it as an -internal-isystem.
29 // RUN: %clang -target aarch64-linux-gnu -ccc-install-dir %t/bin \
30 // RUN:   -stdlib++-isystem /tmp/foo -stdlib++-isystem /tmp/bar -stdlib=libc++ \
31 // RUN:   -fsyntax-only %s -### 2>&1 | FileCheck -check-prefix=INCPATH %s
32 // RUN: %clang -target x86_64-apple-darwin -ccc-install-dir %t/bin \
33 // RUN:   -stdlib++-isystem /tmp/foo -stdlib++-isystem /tmp/bar -stdlib=libc++ \
34 // RUN:   -fsyntax-only %s -### 2>&1 | FileCheck -check-prefix=INCPATH %s
35 // INCPATH: "-internal-isystem" "/tmp/foo" "-internal-isystem" "/tmp/bar"
36 
37 // We shouldn't pass the -stdlib++-isystem to cc1.
38 // RUN: %clang -target aarch64-linux-gnu -ccc-install-dir %t/bin \
39 // RUN:   -stdlib++-isystem /tmp -stdlib=libc++ -fsyntax-only %s -### 2>&1 | \
40 // RUN:   FileCheck -check-prefix=NOCC1 %s
41 // RUN: %clang -target x86_64-apple-darwin -ccc-install-dir %t/bin \
42 // RUN:   -stdlib++-isystem /tmp -stdlib=libc++ -fsyntax-only %s -### 2>&1 | \
43 // RUN:   FileCheck -check-prefix=NOCC1 %s
44 // NOCC1-NOT: "-stdlib++-isystem" "/tmp"
45 
46 // It should respect -nostdinc++.
47 // RUN: %clang -target aarch64-linux-gnu -ccc-install-dir %t/bin \
48 // RUN:   -stdlib++-isystem /tmp/foo -stdlib++-isystem /tmp/bar -nostdinc++ \
49 // RUN:   -fsyntax-only %s -### 2>&1 | FileCheck -check-prefix=NOSTDINCXX %s
50 // RUN: %clang -target x86_64-apple-darwin -ccc-install-dir %t/bin \
51 // RUN:   -stdlib++-isystem /tmp/foo -stdlib++-isystem /tmp/bar -nostdinc++ \
52 // RUN:   -fsyntax-only %s -### 2>&1 | FileCheck -check-prefix=NOSTDINCXX %s
53 // NOSTDINCXX-NOT: "-internal-isystem" "/tmp/foo" "-internal-isystem" "/tmp/bar"
54