diff options
author | Martin Storsjö <martin@martin.st> | 2021-08-11 13:53:43 +0300 |
---|---|---|
committer | Martin Storsjö <martin@martin.st> | 2021-08-12 13:27:09 +0300 |
commit | 5ed9e5c2c0ee9a77ed4a2a5bd817b03acf78fbac (patch) | |
tree | 4ca4d4e1c5399c51205562041416b59987b58953 | |
parent | 592adb0b24aca2ccc88d9f5f1c427361897d1172 (diff) | |
download | llvm-5ed9e5c2c0ee9a77ed4a2a5bd817b03acf78fbac.zip llvm-5ed9e5c2c0ee9a77ed4a2a5bd817b03acf78fbac.tar.gz llvm-5ed9e5c2c0ee9a77ed4a2a5bd817b03acf78fbac.tar.bz2 |
[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
ea12d779bc238c387511fe7462020f4ecf4a8246 / 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
-rw-r--r-- | clang/lib/Driver/ToolChains/MinGW.cpp | 8 | ||||
-rw-r--r-- | clang/test/Driver/Inputs/mingw_clang_tree/mingw32/include/i686-unknown-windows-gnu/c++/v1/.keep | 0 | ||||
-rw-r--r-- | clang/test/Driver/mingw.cpp | 1 |
3 files changed, 8 insertions, 1 deletions
diff --git a/clang/lib/Driver/ToolChains/MinGW.cpp b/clang/lib/Driver/ToolChains/MinGW.cpp index 7ba729f..1aaa941 100644 --- a/clang/lib/Driver/ToolChains/MinGW.cpp +++ b/clang/lib/Driver/ToolChains/MinGW.cpp @@ -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; diff --git a/clang/test/Driver/Inputs/mingw_clang_tree/mingw32/include/i686-unknown-windows-gnu/c++/v1/.keep b/clang/test/Driver/Inputs/mingw_clang_tree/mingw32/include/i686-unknown-windows-gnu/c++/v1/.keep new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/clang/test/Driver/Inputs/mingw_clang_tree/mingw32/include/i686-unknown-windows-gnu/c++/v1/.keep diff --git a/clang/test/Driver/mingw.cpp b/clang/test/Driver/mingw.cpp index 83b61ba..4d573f0 100644 --- a/clang/test/Driver/mingw.cpp +++ b/clang/test/Driver/mingw.cpp @@ -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" |