|
172 | 172 | // RUN: --check-prefix=CHECK-LIBCXX-STDLIB-UNSPECIFIED %s
|
173 | 173 | // CHECK-LIBCXX-STDLIB-UNSPECIFIED: "-cc1"
|
174 | 174 | // CHECK-LIBCXX-STDLIB-UNSPECIFIED: "-internal-isystem" "[[SYSROOT]]/usr/include/c++/v1"
|
| 175 | + |
| 176 | +// ---------------------------------------------------------------------------- |
| 177 | +// On Darwin, libc++ can be installed in one of the following places: |
| 178 | +// 1. Alongside the compiler in <install>/include/c++/v1 |
| 179 | +// 2. Alongside the compiler in <clang-executable-folder>/../include/c++/v1 |
| 180 | +// 3. In a SDK (or a custom sysroot) in <sysroot>/usr/include/c++/v1 |
| 181 | + |
| 182 | +// The build folders do not have an `include/c++/v1`; create a new |
| 183 | +// local folder hierarchy that meets this requirement. |
| 184 | +// Note: this might not work with weird RPATH configurations. |
| 185 | +// RUN: rm -rf %t/install |
| 186 | +// RUN: mkdir -pv %t/install/bin |
| 187 | +// RUN: cp %clang %t/install/bin/clang |
| 188 | +// RUN: mkdir -pv %t/install/include/c++/v1 |
| 189 | + |
| 190 | +// Headers in (1) and in (2) -> (1) is preferred over (2) |
| 191 | +// RUN: rm -rf %t/symlinked1 |
| 192 | +// RUN: mkdir -pv %t/symlinked1/bin |
| 193 | +// RUN: ln -svf %t/install/bin/clang %t/symlinked1/bin/clang |
| 194 | +// RUN: mkdir -pv %t/symlinked1/include/c++/v1 |
| 195 | + |
| 196 | +// RUN: %t/symlinked1/bin/clang -### %s -fsyntax-only 2>&1 \ |
| 197 | +// RUN: --target=x86_64-apple-darwin \ |
| 198 | +// RUN: -stdlib=libc++ \ |
| 199 | +// RUN: -isysroot %S/Inputs/basic_darwin_sdk_usr_cxx_v1 \ |
| 200 | +// RUN: | FileCheck -DSYMLINKED=%t/symlinked1 \ |
| 201 | +// RUN: -DTOOLCHAIN=%t/install \ |
| 202 | +// RUN: -DSYSROOT=%S/Inputs/basic_darwin_sdk_usr_cxx_v1 \ |
| 203 | +// RUN: --check-prefix=CHECK-SYMLINKED-INCLUDE-CXX-V1 %s |
| 204 | +// CHECK-SYMLINKED-INCLUDE-CXX-V1: "-internal-isystem" "[[SYMLINKED]]/bin/../include/c++/v1" |
| 205 | +// CHECK-SYMLINKED-INCLUDE-CXX-V1-NOT: "-internal-isystem" "[[TOOLCHAIN]]/bin/../include/c++/v1" |
| 206 | +// CHECK-SYMLINKED-INCLUDE-CXX-V1-NOT: "-internal-isystem" "[[SYSROOT]]/usr/include/c++/v1" |
| 207 | + |
| 208 | +// Headers in (2) and in (3) -> (2) is preferred over (3) |
| 209 | +// RUN: rm -rf %t/symlinked2 |
| 210 | +// RUN: mkdir -pv %t/symlinked2/bin |
| 211 | +// RUN: ln -svf %t/install/bin/clang %t/symlinked2/bin/clang |
| 212 | + |
| 213 | +// RUN: %t/symlinked2/bin/clang -### %s -fsyntax-only 2>&1 \ |
| 214 | +// RUN: --target=x86_64-apple-darwin \ |
| 215 | +// RUN: -stdlib=libc++ \ |
| 216 | +// RUN: -isysroot %S/Inputs/basic_darwin_sdk_usr_cxx_v1 \ |
| 217 | +// RUN: | FileCheck -DTOOLCHAIN=%t/install \ |
| 218 | +// RUN: -DSYSROOT=%S/Inputs/basic_darwin_sdk_usr_cxx_v1 \ |
| 219 | +// RUN: --check-prefix=CHECK-TOOLCHAIN-INCLUDE-CXX-V1 %s |
| 220 | +// CHECK-TOOLCHAIN-INCLUDE-CXX-V1: "-internal-isystem" "[[TOOLCHAIN]]/bin/../include/c++/v1" |
| 221 | +// CHECK-TOOLCHAIN-INCLUDE-CXX-V1-NOT: "-internal-isystem" "[[SYSROOT]]/usr/include/c++/v1" |
| 222 | + |
| 223 | +// Headers in (2) and nowhere else -> (2) is used |
| 224 | +// RUN: %t/symlinked2/bin/clang -### %s -fsyntax-only 2>&1 \ |
| 225 | +// RUN: --target=x86_64-apple-darwin \ |
| 226 | +// RUN: -stdlib=libc++ \ |
| 227 | +// RUN: -isysroot %S/Inputs/basic_darwin_sdk_usr_cxx_v1 \ |
| 228 | +// RUN: | FileCheck -DTOOLCHAIN=%t/install \ |
| 229 | +// RUN: -DSYSROOT=%S/Inputs/basic_darwin_sdk_no_libcxx \ |
| 230 | +// RUN: --check-prefix=CHECK-TOOLCHAIN-NO-SYSROOT %s |
| 231 | +// CHECK-TOOLCHAIN-NO-SYSROOT: "-internal-isystem" "[[TOOLCHAIN]]/bin/../include/c++/v1" |
0 commit comments