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

Martin Storsjö via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 12 03:28:25 PDT 2021


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG5ed9e5c2c0ee: [clang] [MinGW] Consider the per-target libc++ include directory too (authored by mstorsjo).

Changed prior to commit:
  https://reviews.llvm.org/D107893?vs=365720&id=365953#toc

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D107893/new/

https://reviews.llvm.org/D107893

Files:
  clang/lib/Driver/ToolChains/MinGW.cpp
  clang/test/Driver/Inputs/mingw_clang_tree/mingw32/include/i686-unknown-windows-gnu/c++/v1/.keep
  clang/test/Driver/mingw.cpp


Index: clang/test/Driver/mingw.cpp
===================================================================
--- clang/test/Driver/mingw.cpp
+++ 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"
 
 
Index: clang/lib/Driver/ToolChains/MinGW.cpp
===================================================================
--- clang/lib/Driver/ToolChains/MinGW.cpp
+++ clang/lib/Driver/ToolChains/MinGW.cpp
@@ -588,12 +588,18 @@
   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;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D107893.365953.patch
Type: text/x-patch
Size: 1753 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210812/5463beb6/attachment.bin>


More information about the cfe-commits mailing list