================
@@ -704,6 +706,21 @@ void toolchains::MinGW::AddClangSystemIncludeArgs(const 
ArgList &DriverArgs,
   if (DriverArgs.hasArg(options::OPT_nostdlibinc))
     return;
 
+  if (std::optional<std::string> Path = getStdlibIncludePath())
+    addSystemInclude(DriverArgs, CC1Args, *Path);
+
+  // Add multilib variant include paths in priority order.
+  for (const Multilib &M : getOrderedMultilibs()) {
+    if (M.isDefault())
+      continue;
+    if (std::optional<std::string> StdlibIncDir = getStdlibIncludePath()) {
+      SmallString<128> Dir(*StdlibIncDir);
+      llvm::sys::path::append(Dir, M.includeSuffix());
+      if (getDriver().getVFS().exists(Dir))
+        addSystemInclude(DriverArgs, CC1Args, Dir);
+    }
+  }
----------------
petrhosek wrote:

Ditto here.
```suggestion
  // Add multilib variant include paths in priority order.
  for (const Multilib &M : getOrderedMultilibs()) {
    if (M.isDefault())
      continue;
    if (std::optional<std::string> StdlibIncDir = getStdlibIncludePath()) {
      SmallString<128> Dir(*StdlibIncDir);
      llvm::sys::path::append(Dir, M.includeSuffix());
      if (getDriver().getVFS().exists(Dir))
        addSystemInclude(DriverArgs, CC1Args, Dir);
    }
  }
  
  if (std::optional<std::string> Path = getStdlibIncludePath())
    addSystemInclude(DriverArgs, CC1Args, *Path);
```

https://github.com/llvm/llvm-project/pull/188584
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to