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.
5 // By default, we should search for libc++ next to the driver.
6 // RUN: mkdir -p %t/bin
7 // RUN: mkdir -p %t/include/c++/v1
8 // RUN: %clang -target aarch64-linux-gnu -ccc-install-dir %/t/bin \
9 // RUN: -stdlib=libc++ -fsyntax-only %s -### 2>&1 | \
10 // RUN: FileCheck -check-prefix=LIBCXX %s
11 // RUN: %clang -target x86_64-apple-darwin -ccc-install-dir %/t/bin \
12 // RUN: -stdlib=libc++ -fsyntax-only %s -### 2>&1 | \
13 // RUN: FileCheck -check-prefix=LIBCXX %s
14 // LIBCXX: InstalledDir: [[INSTALLDIR:.+$]]
15 // LIBCXX: "-internal-isystem" "[[INSTALLDIR]]{{/|\\\\}}..{{/|\\\\}}include{{/|\\\\}}c++{{/|\\\\}}v1"
17 // Passing -stdlib++-isystem should suppress the default search.
18 // RUN: %clang -target aarch64-linux-gnu -ccc-install-dir %/t/bin \
19 // RUN: -stdlib++-isystem /tmp/foo -stdlib++-isystem /tmp/bar -stdlib=libc++ \
20 // RUN: -fsyntax-only %s -### 2>&1 | FileCheck -check-prefix=NODEFAULT %s
21 // RUN: %clang -target x86_64-apple-darwin -ccc-install-dir %/t/bin \
22 // RUN: -stdlib++-isystem /tmp/foo -stdlib++-isystem /tmp/bar -stdlib=libc++ \
23 // RUN: -fsyntax-only %s -### 2>&1 | FileCheck -check-prefix=NODEFAULT %s
24 // NODEFAULT: InstalledDir: [[INSTALLDIR:.+$]]
25 // NODEFAULT-NOT: "-internal-isystem" "[[INSTALLDIR]]{{/|\\\\}}..{{/|\\\\}}include{{/|\\\\}}c++{{/|\\\\}}v1"
27 // And we should add it as an -internal-isystem.
28 // RUN: %clang -target aarch64-linux-gnu -ccc-install-dir %t/bin \
29 // RUN: -stdlib++-isystem /tmp/foo -stdlib++-isystem /tmp/bar -stdlib=libc++ \
30 // RUN: -fsyntax-only %s -### 2>&1 | FileCheck -check-prefix=INCPATH %s
31 // RUN: %clang -target x86_64-apple-darwin -ccc-install-dir %t/bin \
32 // RUN: -stdlib++-isystem /tmp/foo -stdlib++-isystem /tmp/bar -stdlib=libc++ \
33 // RUN: -fsyntax-only %s -### 2>&1 | FileCheck -check-prefix=INCPATH %s
34 // INCPATH: "-internal-isystem" "/tmp/foo" "-internal-isystem" "/tmp/bar"
36 // We shouldn't pass the -stdlib++-isystem to cc1.
37 // RUN: %clang -target aarch64-linux-gnu -ccc-install-dir %t/bin \
38 // RUN: -stdlib++-isystem /tmp -stdlib=libc++ -fsyntax-only %s -### 2>&1 | \
39 // RUN: FileCheck -check-prefix=NOCC1 %s
40 // RUN: %clang -target x86_64-apple-darwin -ccc-install-dir %t/bin \
41 // RUN: -stdlib++-isystem /tmp -stdlib=libc++ -fsyntax-only %s -### 2>&1 | \
42 // RUN: FileCheck -check-prefix=NOCC1 %s
43 // NOCC1-NOT: "-stdlib++-isystem" "/tmp"
45 // It should respect -nostdinc++.
46 // RUN: %clang -target aarch64-linux-gnu -ccc-install-dir %t/bin \
47 // RUN: -stdlib++-isystem /tmp/foo -stdlib++-isystem /tmp/bar -nostdinc++ \
48 // RUN: -fsyntax-only %s -### 2>&1 | FileCheck -check-prefix=NOSTDINCXX %s
49 // RUN: %clang -target x86_64-apple-darwin -ccc-install-dir %t/bin \
50 // RUN: -stdlib++-isystem /tmp/foo -stdlib++-isystem /tmp/bar -nostdinc++ \
51 // RUN: -fsyntax-only %s -### 2>&1 | FileCheck -check-prefix=NOSTDINCXX %s
52 // NOSTDINCXX-NOT: "-internal-isystem" "/tmp/foo" "-internal-isystem" "/tmp/bar"
54 // It should take effect even if -nostdinc or -nostdlibinc are specified; only
55 // -nostdinc++ should suppress it.
56 // RUN: %clang -target aarch64-linux-gnu -ccc-install-dir %t/bin \
57 // RUN: -stdlib++-isystem /tmp/foo -stdlib++-isystem /tmp/bar -nostdinc \
58 // RUN: -fsyntax-only %s -### 2>&1 | FileCheck -check-prefix=NOSTDINC %s
59 // RUN: %clang -target x86_64-apple-darwin -ccc-install-dir %t/bin \
60 // RUN: -stdlib++-isystem /tmp/foo -stdlib++-isystem /tmp/bar -nostdlibinc \
61 // RUN: -fsyntax-only %s -### 2>&1 | FileCheck -check-prefix=NOSTDINC %s
62 // NOSTDINC: "-internal-isystem" "/tmp/foo" "-internal-isystem" "/tmp/bar"