[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
Wed Aug 11 04:51:47 PDT 2021


mstorsjo created this revision.
mstorsjo added reviewers: phosek, MaskRay.
mstorsjo requested review of this revision.
Herald added a project: clang.

The existing logic for per-target libc++ include directories only
seem to exist for the Gnu and Fuchsia drivers, added in
ea12d779bc238c387511fe7462020f4ecf4a8246 <https://reviews.llvm.org/rGea12d779bc238c387511fe7462020f4ecf4a8246> / D89013 <https://reviews.llvm.org/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).


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D107893

Files:
  clang/lib/Driver/ToolChains/MinGW.cpp


Index: clang/lib/Driver/ToolChains/MinGW.cpp
===================================================================
--- clang/lib/Driver/ToolChains/MinGW.cpp
+++ clang/lib/Driver/ToolChains/MinGW.cpp
@@ -588,12 +588,16 @@
   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.365720.patch
Type: text/x-patch
Size: 994 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210811/df9acba9/attachment.bin>


More information about the cfe-commits mailing list