Skip to content

[Clang] [Driver] Canoncalise -internal-isystem include paths #148745

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions clang/include/clang/Driver/ToolChain.h
Original file line number Diff line number Diff line change
Expand Up @@ -228,9 +228,13 @@ class ToolChain {
static void addSystemFrameworkInclude(const llvm::opt::ArgList &DriverArgs,
llvm::opt::ArgStringList &CC1Args,
const Twine &Path);

public:
static void addSystemInclude(const llvm::opt::ArgList &DriverArgs,
llvm::opt::ArgStringList &CC1Args,
const Twine &Path);

protected:
static void addExternCSystemInclude(const llvm::opt::ArgList &DriverArgs,
llvm::opt::ArgStringList &CC1Args,
const Twine &Path);
Expand Down
39 changes: 28 additions & 11 deletions clang/lib/Driver/ToolChain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1370,19 +1370,40 @@ ToolChain::CXXStdlibType ToolChain::GetCXXStdlibType(const ArgList &Args) const{
return *cxxStdlibType;
}

static void ResolveAndAddSystemIncludePath(const ArgList &DriverArgs,
ArgStringList &CC1Args,
const Twine &Path) {
bool Canonicalize =
DriverArgs.hasFlag(options::OPT_canonical_prefixes,
options::OPT_no_canonical_prefixes, true);

if (!Canonicalize) {
CC1Args.push_back(DriverArgs.MakeArgString(Path));
return;
}

// We canonicalise system include paths that were added automatically
// since those can end up quite long otherwise.
SmallString<256> Canonical, PathStorage;
StringRef SimplifiedPath = Path.toStringRef(PathStorage);
if (!sys::fs::real_path(SimplifiedPath, Canonical))
SimplifiedPath = Canonical;
CC1Args.push_back(DriverArgs.MakeArgString(SimplifiedPath));
}

/// Utility function to add a system framework directory to CC1 arguments.
void ToolChain::addSystemFrameworkInclude(const llvm::opt::ArgList &DriverArgs,
llvm::opt::ArgStringList &CC1Args,
const Twine &Path) {
CC1Args.push_back("-internal-iframework");
CC1Args.push_back(DriverArgs.MakeArgString(Path));
ResolveAndAddSystemIncludePath(DriverArgs, CC1Args, Path);
}

/// Utility function to add a system include directory to CC1 arguments.
void ToolChain::addSystemInclude(const ArgList &DriverArgs,
ArgStringList &CC1Args, const Twine &Path) {
CC1Args.push_back("-internal-isystem");
CC1Args.push_back(DriverArgs.MakeArgString(Path));
ResolveAndAddSystemIncludePath(DriverArgs, CC1Args, Path);
}

/// Utility function to add a system include directory with extern "C"
Expand All @@ -1397,7 +1418,7 @@ void ToolChain::addExternCSystemInclude(const ArgList &DriverArgs,
ArgStringList &CC1Args,
const Twine &Path) {
CC1Args.push_back("-internal-externc-isystem");
CC1Args.push_back(DriverArgs.MakeArgString(Path));
ResolveAndAddSystemIncludePath(DriverArgs, CC1Args, Path);
}

void ToolChain::addExternCSystemIncludeIfExists(const ArgList &DriverArgs,
Expand All @@ -1411,20 +1432,16 @@ void ToolChain::addExternCSystemIncludeIfExists(const ArgList &DriverArgs,
void ToolChain::addSystemFrameworkIncludes(const ArgList &DriverArgs,
ArgStringList &CC1Args,
ArrayRef<StringRef> Paths) {
for (const auto &Path : Paths) {
CC1Args.push_back("-internal-iframework");
CC1Args.push_back(DriverArgs.MakeArgString(Path));
}
for (const auto &Path : Paths)
addSystemFrameworkInclude(DriverArgs, CC1Args, Path);
}

/// Utility function to add a list of system include directories to CC1.
void ToolChain::addSystemIncludes(const ArgList &DriverArgs,
ArgStringList &CC1Args,
ArrayRef<StringRef> Paths) {
for (const auto &Path : Paths) {
CC1Args.push_back("-internal-isystem");
CC1Args.push_back(DriverArgs.MakeArgString(Path));
}
for (const auto &Path : Paths)
addSystemInclude(DriverArgs, CC1Args, Path);
}

std::string ToolChain::concat(StringRef Path, const Twine &A, const Twine &B,
Expand Down
12 changes: 5 additions & 7 deletions clang/lib/Driver/ToolChains/Clang.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -946,8 +946,7 @@ void Clang::AddPreprocessingOptions(Compilation &C, const JobAction &JA,
SmallString<128> P(D.ResourceDir);
llvm::sys::path::append(P, "include");
llvm::sys::path::append(P, "openmp_wrappers");
CmdArgs.push_back("-internal-isystem");
CmdArgs.push_back(Args.MakeArgString(P));
getToolChain().addSystemInclude(Args, CmdArgs, P);
}

CmdArgs.push_back("-include");
Expand All @@ -959,7 +958,8 @@ void Clang::AddPreprocessingOptions(Compilation &C, const JobAction &JA,
// standard library headers and other headers.
SmallString<128> P(D.ResourceDir);
llvm::sys::path::append(P, "include", "llvm_offload_wrappers");
CmdArgs.append({"-internal-isystem", Args.MakeArgString(P), "-include"});
getToolChain().addSystemInclude(Args, CmdArgs, P);
CmdArgs.push_back("-include");
if (JA.isDeviceOffloading(Action::OFK_OpenMP))
CmdArgs.push_back("__llvm_offload_device.h");
else
Expand Down Expand Up @@ -1132,16 +1132,14 @@ void Clang::AddPreprocessingOptions(Compilation &C, const JobAction &JA,
SmallString<128> P(llvm::sys::path::parent_path(D.Dir));
llvm::sys::path::append(P, "include");
llvm::sys::path::append(P, getToolChain().getTripleString());
CmdArgs.push_back("-internal-isystem");
CmdArgs.push_back(Args.MakeArgString(P));
getToolChain().addSystemInclude(Args, CmdArgs, P);
} else if (C.getActiveOffloadKinds() == Action::OFK_OpenMP) {
// TODO: CUDA / HIP include their own headers for some common functions
// implemented here. We'll need to clean those up so they do not conflict.
SmallString<128> P(D.ResourceDir);
llvm::sys::path::append(P, "include");
llvm::sys::path::append(P, "llvm_libc_wrappers");
CmdArgs.push_back("-internal-isystem");
CmdArgs.push_back(Args.MakeArgString(P));
getToolChain().addSystemInclude(Args, CmdArgs, P);
}
}

Expand Down
7 changes: 7 additions & 0 deletions clang/test/Driver/aarch64-toolchain.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

// Test interaction with -fuse-ld=lld
// RUN: %clang -### %s -fuse-ld=lld -B%S/Inputs/lld \
// RUN: -no-canonical-prefixes \
// RUN: --target=aarch64-none-elf --rtlib=libgcc --unwindlib=platform \
// RUN: --gcc-toolchain=%S/Inputs/basic_aarch64_gcc_tree \
// RUN: --sysroot=%S/Inputs/basic_aarch64_gcc_tree/aarch64-none-elf 2>&1 \
Expand All @@ -20,6 +21,7 @@
// LLD-AARCH64-BAREMETAL: "{{.*}}/Inputs/basic_aarch64_gcc_tree/lib/gcc/aarch64-none-elf/8.2.1/crtend.o"

// RUN: %clang -### %s -fuse-ld= \
// RUN: -no-canonical-prefixes \
// RUN: --target=aarch64-none-elf --rtlib=libgcc --unwindlib=platform \
// RUN: --gcc-toolchain=%S/Inputs/basic_aarch64_gcc_tree \
// RUN: --sysroot=%S/Inputs/basic_aarch64_gcc_tree/aarch64-none-elf 2>&1 \
Expand All @@ -39,6 +41,7 @@
// C-AARCH64-BAREMETAL: "{{.*}}/Inputs/basic_aarch64_gcc_tree/lib/gcc/aarch64-none-elf/8.2.1/crtend.o"

// RUN: %clang -### %s -fuse-ld= \
// RUN: -no-canonical-prefixes \
// RUN: --target=aarch64-none-elf --rtlib=libgcc --unwindlib=platform \
// RUN: --gcc-toolchain=%S/Inputs/basic_aarch64_gcc_tree \
// RUN: --sysroot= 2>&1 \
Expand All @@ -56,6 +59,7 @@
// C-AARCH64-BAREMETAL-NOSYSROOT: "{{.*}}/Inputs/basic_aarch64_gcc_tree/lib/gcc/aarch64-none-elf/8.2.1/crtend.o"

// RUN: %clangxx -### %s -fuse-ld= \
// RUN: -no-canonical-prefixes \
// RUN: --target=aarch64-none-elf -stdlib=libstdc++ --rtlib=libgcc --unwindlib=platform \
// RUN: --gcc-toolchain=%S/Inputs/basic_aarch64_gcc_tree \
// RUN: --sysroot=%S/Inputs/basic_aarch64_gcc_tree/aarch64-none-elf 2>&1 \
Expand All @@ -76,6 +80,7 @@
// CXX-AARCH64-BAREMETAL: "{{.*}}/Inputs/basic_aarch64_gcc_tree/lib/gcc/aarch64-none-elf/8.2.1/crtend.o"

// RUN: %clangxx -### %s -fuse-ld= \
// RUN: -no-canonical-prefixes \
// RUN: --target=aarch64-none-elf -stdlib=libstdc++ --rtlib=libgcc --unwindlib=platform \
// RUN: --gcc-toolchain=%S/Inputs/basic_aarch64_gcc_tree \
// RUN: --sysroot= 2>&1 \
Expand All @@ -95,6 +100,7 @@
// CXX-AARCH64-BAREMETAL-NOSYSROOT: "{{.*}}/Inputs/basic_aarch64_gcc_tree/lib/gcc/aarch64-none-elf/8.2.1/crtend.o"

// RUN: %clangxx -### %s -fuse-ld= \
// RUN: -no-canonical-prefixes \
// RUN: --target=aarch64-none-elf -stdlib=libc++ --rtlib=libgcc --unwindlib=platform \
// RUN: --gcc-toolchain=%S/Inputs/basic_aarch64_gcc_tree \
// RUN: --sysroot=%S/Inputs/basic_aarch64_gcc_tree/aarch64-none-elf 2>&1 \
Expand All @@ -114,6 +120,7 @@
// CXX-AARCH64-BAREMETAL-LIBCXX: "{{.*}}/Inputs/basic_aarch64_gcc_tree/lib/gcc/aarch64-none-elf/8.2.1/crtend.o"

// RUN: %clangxx -### %s -fuse-ld= \
// RUN: -no-canonical-prefixes \
// RUN: --target=aarch64-none-elf -stdlib=libc++ --rtlib=libgcc --unwindlib=platform \
// RUN: --gcc-toolchain=%S/Inputs/basic_aarch64_gcc_tree \
// RUN: --sysroot= 2>&1 \
Expand Down
4 changes: 4 additions & 0 deletions clang/test/Driver/android-installed-libcxx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,25 @@
// RUN: mkdir -p %t2/include/aarch64-none-linux-android23/c++/v1

// RUN: %clang -target aarch64-none-linux-android -ccc-install-dir %/t2/bin \
// RUN: -no-canonical-prefixes \
// RUN: --sysroot=%t2/sysroot -stdlib=libc++ -fsyntax-only \
// RUN: %s -### 2>&1 | FileCheck --check-prefix=ANDROID-DIR -DDIR=%/t2/bin %s

// RUN: %clang -target aarch64-none-linux-android21 -ccc-install-dir %/t2/bin \
// RUN: -no-canonical-prefixes \
// RUN: --sysroot=%t2/sysroot -stdlib=libc++ -fsyntax-only \
// RUN: %s -### 2>&1 | FileCheck --check-prefix=ANDROID-DIR -DDIR=%/t2/bin %s

// ANDROID-DIR: "-internal-isystem" "[[DIR]][[SEP:/|\\\\]]..[[SEP]]include[[SEP]]aarch64-none-linux-android[[SEP]]c++[[SEP]]v1"
// ANDROID-DIR-SAME: "-internal-isystem" "[[DIR]][[SEP]]..[[SEP]]include[[SEP]]c++[[SEP]]v1"

// RUN: %clang -target aarch64-none-linux-android23 -ccc-install-dir %/t2/bin \
// RUN: -no-canonical-prefixes \
// RUN: --sysroot=%t2/sysroot -stdlib=libc++ -fsyntax-only \
// RUN: %s -### 2>&1 | FileCheck --check-prefix=ANDROID23-DIR -DDIR=%/t2/bin %s

// RUN: %clang -target aarch64-none-linux-android28 -ccc-install-dir %/t2/bin \
// RUN: -no-canonical-prefixes \
// RUN: --sysroot=%t2/sysroot -stdlib=libc++ -fsyntax-only \
// RUN: %s -### 2>&1 | FileCheck --check-prefix=ANDROID23-DIR -DDIR=%/t2/bin %s

Expand Down
7 changes: 7 additions & 0 deletions clang/test/Driver/arm-toolchain.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// UNSUPPORTED: system-windows

// RUN: %clang -### %s -fuse-ld=lld -B%S/Inputs/lld \
// RUN: -no-canonical-prefixes \
// RUN: --target=armv6m-none-eabi --rtlib=libgcc --unwindlib=platform \
// RUN: --gcc-toolchain=%S/Inputs/basic_arm_gcc_tree \
// RUN: --sysroot=%S/Inputs/basic_arm_gcc_tree/armv6m-none-eabi 2>&1 \
Expand All @@ -19,6 +20,7 @@
// LLD-ARM-BAREMETAL: "{{.*}}/Inputs/basic_arm_gcc_tree/lib/gcc/armv6m-none-eabi/8.2.1/crtend.o"

// RUN: %clang -### %s -fuse-ld= \
// RUN: -no-canonical-prefixes \
// RUN: --target=armv6m-none-eabi --rtlib=libgcc --unwindlib=platform \
// RUN: --gcc-toolchain=%S/Inputs/basic_arm_gcc_tree \
// RUN: --sysroot=%S/Inputs/basic_arm_gcc_tree/armv6m-none-eabi 2>&1 \
Expand All @@ -38,6 +40,7 @@
// C-ARM-BAREMETAL: "{{.*}}/Inputs/basic_arm_gcc_tree/lib/gcc/armv6m-none-eabi/8.2.1/crtend.o"

// RUN: %clang -### %s -fuse-ld= \
// RUN: -no-canonical-prefixes \
// RUN: --target=armv6m-none-eabi --rtlib=libgcc --unwindlib=platform \
// RUN: --gcc-toolchain=%S/Inputs/basic_arm_gcc_tree \
// RUN: --sysroot= 2>&1 \
Expand All @@ -55,6 +58,7 @@
// C-ARM-BAREMETAL-NOSYSROOT: "{{.*}}/Inputs/basic_arm_gcc_tree/lib/gcc/armv6m-none-eabi/8.2.1/crtend.o"

// RUN: %clangxx -### %s -fuse-ld= \
// RUN: -no-canonical-prefixes \
// RUN: --target=armv6m-none-eabi -stdlib=libstdc++ --rtlib=libgcc --unwindlib=platform \
// RUN: --gcc-toolchain=%S/Inputs/basic_arm_gcc_tree \
// RUN: --sysroot=%S/Inputs/basic_arm_gcc_tree/armv6m-none-eabi 2>&1 \
Expand All @@ -77,6 +81,7 @@


// RUN: %clangxx -### %s -fuse-ld= \
// RUN: -no-canonical-prefixes \
// RUN: --target=armv6m-none-eabi -stdlib=libstdc++ --rtlib=libgcc --unwindlib=platform \
// RUN: --gcc-toolchain=%S/Inputs/basic_arm_gcc_tree \
// RUN: --sysroot= 2>&1 \
Expand All @@ -96,6 +101,7 @@
// CXX-ARM-BAREMETAL-NOSYSROOT: "{{.*}}/Inputs/basic_arm_gcc_tree/lib/gcc/armv6m-none-eabi/8.2.1/crtend.o"

// RUN: %clangxx -### %s -fuse-ld= \
// RUN: -no-canonical-prefixes \
// RUN: --target=armv6m-none-eabi -stdlib=libc++ --rtlib=libgcc --unwindlib=platform \
// RUN: --gcc-toolchain=%S/Inputs/basic_arm_gcc_tree \
// RUN: --sysroot=%S/Inputs/basic_arm_gcc_tree/armv6m-none-eabi 2>&1 \
Expand All @@ -115,6 +121,7 @@
// CXX-ARM-BAREMETAL-LIBCXX: "{{.*}}/Inputs/basic_arm_gcc_tree/lib/gcc/armv6m-none-eabi/8.2.1/crtend.o"

// RUN: %clangxx -### %s -fuse-ld= \
// RUN: -no-canonical-prefixes \
// RUN: --target=armv6m-none-eabi -stdlib=libc++ --rtlib=libgcc --unwindlib=platform \
// RUN: --gcc-toolchain=%S/Inputs/basic_arm_gcc_tree \
// RUN: --sysroot= 2>&1 \
Expand Down
10 changes: 5 additions & 5 deletions clang/test/Driver/avr-toolchain.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// UNSUPPORTED: system-windows
// A basic clang -cc1 command-line.

// RUN: %clang -### %s --target=avr --sysroot=%S/Inputs/basic_avr_tree -resource-dir=%S/Inputs/resource_dir 2>&1 | FileCheck --check-prefix=CHECK1 %s
// RUN: %clang -### %s -no-canonical-prefixes --target=avr --sysroot=%S/Inputs/basic_avr_tree -resource-dir=%S/Inputs/resource_dir 2>&1 | FileCheck --check-prefix=CHECK1 %s
// CHECK1: "-cc1" "-triple" "avr"
// CHECK1-SAME: "-resource-dir" "[[RESOURCE:[^"]+]]"
// CHECK1-SAME: "-isysroot" "[[SYSROOT:[^"]+/basic_avr_tree]]"
Expand All @@ -12,13 +12,13 @@
// CHECK1-SAME: "-o" "a.out"
// CHECK1-SAME: {{^}} "--gc-sections"

// RUN: %clang -### %s --target=avr --sysroot=%S/Inputs/basic_avr_tree_2/opt/local -S 2>&1 | FileCheck --check-prefix=CHECK2 %s
// RUN: %clang -### %s -no-canonical-prefixes --target=avr --sysroot=%S/Inputs/basic_avr_tree_2/opt/local -S 2>&1 | FileCheck --check-prefix=CHECK2 %s
// CHECK2: "-cc1" "-triple" "avr"
// CHECK2-SAME: "-isysroot" "[[SYSROOT:[^"]+/basic_avr_tree_2/opt/local]]"
// CHECK2-SAME: "-internal-isystem"
// CHECK2-SAME: {{^}} "[[SYSROOT]]/lib/gcc/avr/10.3.0/../../../../avr/include"

// RUN: %clang -### %s --target=avr --sysroot=%S/Inputs/basic_avr_tree_2 -S 2>&1 | FileCheck --check-prefix=CHECK3 %s
// RUN: %clang -### %s -no-canonical-prefixes --target=avr --sysroot=%S/Inputs/basic_avr_tree_2 -S 2>&1 | FileCheck --check-prefix=CHECK3 %s
// CHECK3: "-cc1" "-triple" "avr"
// CHECK3-SAME: "-isysroot" "[[SYSROOT:[^"]+/basic_avr_tree_2]]"
// CHECK3-SAME: "-internal-isystem"
Expand All @@ -32,8 +32,8 @@
// CHECK4-NOT: "-fno-use-init-array"
// CHECK4-NOT: "-fno-use-cxa-atexit"

// RUN: %clang -### %s --target=avr --sysroot=%S/Inputs/basic_avr_tree 2>&1 -nostdinc | FileCheck --check-prefix=NOSTDINC %s
// RUN: %clang -### %s --target=avr --sysroot=%S/Inputs/basic_avr_tree 2>&1 -nostdlibinc | FileCheck --check-prefix=NOSTDINC %s
// RUN: %clang -### %s -no-canonical-prefixes --target=avr --sysroot=%S/Inputs/basic_avr_tree 2>&1 -nostdinc | FileCheck --check-prefix=NOSTDINC %s
// RUN: %clang -### %s -no-canonical-prefixes --target=avr --sysroot=%S/Inputs/basic_avr_tree 2>&1 -nostdlibinc | FileCheck --check-prefix=NOSTDINC %s
// NOSTDINC-NOT: "-internal-isystem" {{".*avr/include"}}

// RUN: %clang -### --target=avr --sysroot=%S/Inputs/basic_avr_tree -mmcu=atmega328 %s 2>&1 | FileCheck --check-prefix=NOWARN %s
Expand Down
2 changes: 2 additions & 0 deletions clang/test/Driver/baremetal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
// CHECK-STATIC-LIB: {{.*}}llvm-ar{{.*}}" "rcsD"

// RUN: %clang %s -### --target=armv6m-none-eabi -o %t.out 2>&1 \
// RUN: -no-canonical-prefixes \
// RUN: -T semihosted.lds \
// RUN: -L some/directory/user/asked/for \
// RUN: --sysroot=%S/Inputs/baremetal_arm \
Expand Down Expand Up @@ -33,6 +34,7 @@
// CHECK-V6M-LIBINC-NOT: "-internal-isystem"

// RUN: %clang %s -### --target=armv6m-none-eabi -o %t.out 2>&1 \
// RUN: -no-canonical-prefixes \
// RUN: -ccc-install-dir %S/Inputs/basic_baremetal_tree/bin \
// RUN: | FileCheck --check-prefix=CHECK-V6M-TREE %s
// CHECK-V6M-TREE: InstalledDir: [[INSTALLED_DIR:.+]]
Expand Down
3 changes: 3 additions & 0 deletions clang/test/Driver/cygwin.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// RUN: %clang -### %s --target=i686-pc-windows-cygnus --sysroot=%S/Inputs/basic_cygwin_tree \
// RUN: -no-canonical-prefixes \
// RUN: -resource-dir=%S/Inputs/resource_dir \
// RUN: --stdlib=platform 2>&1 | FileCheck --check-prefix=CHECK %s
// CHECK: "-cc1"
Expand Down Expand Up @@ -31,13 +32,15 @@
// CHECK-SHARED-SAME: "-shared"

// RUN: %clang -### -o %t %s 2>&1 -no-integrated-as -fuse-ld=ld \
// RUN: -no-canonical-prefixes \
// RUN: --gcc-toolchain=%S/Inputs/basic_cross_cygwin_tree/usr \
// RUN: --target=i686-pc-cygwin \
// RUN: | FileCheck --check-prefix=CHECK-CROSS %s
// CHECK-CROSS: "-cc1" "-triple" "i686-pc-windows-cygnus"
// CHECK-CROSS: "{{.*}}/Inputs/basic_cross_cygwin_tree/usr/lib/gcc/i686-pc-msys/10/../../../../i686-pc-msys/bin{{(/|\\\\)}}as" "--32"

// RUN: %clang -### %s --target=x86_64-pc-windows-cygnus --sysroot=%S/Inputs/basic_cygwin_tree \
// RUN: -no-canonical-prefixes \
// RUN: -resource-dir=%S/Inputs/resource_dir \
// RUN: --stdlib=platform 2>&1 | FileCheck --check-prefix=CHECK-64 %s
// CHECK-64: "-cc1"
Expand Down
4 changes: 2 additions & 2 deletions clang/test/Driver/darwin-header-search-libcxx-2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
// RUN: | FileCheck -DTOOLCHAIN=%t/install \
// RUN: -DSYSROOT=%S/Inputs/basic_darwin_sdk_usr_cxx_v1 \
// RUN: --check-prefix=CHECK-TOOLCHAIN-INCLUDE-CXX-V1 %s
// CHECK-TOOLCHAIN-INCLUDE-CXX-V1: "-internal-isystem" "[[TOOLCHAIN]]/bin/../include/c++/v1"
// CHECK-TOOLCHAIN-INCLUDE-CXX-V1: "-internal-isystem" "[[TOOLCHAIN]]/include/c++/v1"
// CHECK-TOOLCHAIN-INCLUDE-CXX-V1-NOT: "-internal-isystem" "[[SYSROOT]]/usr/include/c++/v1"

// Headers in (2) and nowhere else -> (2) is used
Expand All @@ -61,4 +61,4 @@
// RUN: | FileCheck -DTOOLCHAIN=%t/install \
// RUN: -DSYSROOT=%S/Inputs/basic_darwin_sdk_no_libcxx \
// RUN: --check-prefix=CHECK-TOOLCHAIN-NO-SYSROOT %s
// CHECK-TOOLCHAIN-NO-SYSROOT: "-internal-isystem" "[[TOOLCHAIN]]/bin/../include/c++/v1"
// CHECK-TOOLCHAIN-NO-SYSROOT: "-internal-isystem" "[[TOOLCHAIN]]/include/c++/v1"
Loading
Loading