[clang] [MinGW] Consider the per-target libc++ include directory too

The existing logic for per-target libc++ include directories only
seem to exist for the Gnu and Fuchsia drivers, added in
ea12d779bc / D89013.

This is less generic than the corresponding case in the Gnu driver,
but matches the existing level of genericity in the MinGW driver
(and others too).

Differential Revision: https://reviews.llvm.org/D107893
This commit is contained in:
Martin Storsjö 2021-08-11 13:53:43 +03:00
parent 592adb0b24
commit 5ed9e5c2c0
3 changed files with 8 additions and 1 deletions

View File

@ -588,12 +588,18 @@ void toolchains::MinGW::AddClangCXXStdlibIncludeArgs(
StringRef Slash = llvm::sys::path::get_separator();
switch (GetCXXStdlibType(DriverArgs)) {
case ToolChain::CST_Libcxx:
case ToolChain::CST_Libcxx: {
std::string TargetDir = (Base + "include" + Slash + getTripleString() +
Slash + "c++" + Slash + "v1")
.str();
if (getDriver().getVFS().exists(TargetDir))
addSystemInclude(DriverArgs, CC1Args, TargetDir);
addSystemInclude(DriverArgs, CC1Args, Base + Arch + Slash + "include" +
Slash + "c++" + Slash + "v1");
addSystemInclude(DriverArgs, CC1Args,
Base + "include" + Slash + "c++" + Slash + "v1");
break;
}
case ToolChain::CST_Libstdcxx:
llvm::SmallVector<llvm::SmallString<1024>, 4> CppIncludeBases;

View File

@ -4,6 +4,7 @@
// RUN: %clang -target i686-windows-gnu -rtlib=platform -stdlib=libc++ -c -### --sysroot=%S/Inputs/mingw_clang_tree/mingw32 %s 2>&1 | FileCheck -check-prefix=CHECK_MINGW_CLANG_TREE_LIBCXX %s
// CHECK_MINGW_CLANG_TREE_LIBCXX: "[[BASE:[^"]+]]/Inputs/mingw_clang_tree/mingw32{{/|\\\\}}include{{/|\\\\}}i686-unknown-windows-gnu{{/|\\\\}}c++{{/|\\\\}}v1"
// CHECK_MINGW_CLANG_TREE_LIBCXX: "[[BASE:[^"]+]]/Inputs/mingw_clang_tree/mingw32{{/|\\\\}}i686-w64-mingw32{{/|\\\\}}include{{/|\\\\}}c++{{/|\\\\}}v1"