[clang] e37c8fd - Hurd: Clean up Debian multiarch /usr/include/<triplet>

Fangrui Song via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 27 13:36:21 PDT 2021


Author: Samuel Thibault
Date: 2021-04-27T13:36:12-07:00
New Revision: e37c8fd364a96d9d9f56a1e06e178e9e376beda3

URL: https://github.com/llvm/llvm-project/commit/e37c8fd364a96d9d9f56a1e06e178e9e376beda3
DIFF: https://github.com/llvm/llvm-project/commit/e37c8fd364a96d9d9f56a1e06e178e9e376beda3.diff

LOG: Hurd: Clean up Debian multiarch /usr/include/<triplet>

This is a follow-up of 35dd6470de84 for the Hurd case, to avoid the
duplication of the i386-gnu path, already provided by
Hurd::getMultiarchTriple.

Reviewed By: MaskRay

Differential Revision: https://reviews.llvm.org/D101324

Added: 
    

Modified: 
    clang/lib/Driver/ToolChains/Hurd.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/Driver/ToolChains/Hurd.cpp b/clang/lib/Driver/ToolChains/Hurd.cpp
index bfb96775f898..48b9ccadf36f 100644
--- a/clang/lib/Driver/ToolChains/Hurd.cpp
+++ b/clang/lib/Driver/ToolChains/Hurd.cpp
@@ -170,11 +170,13 @@ void Hurd::AddClangSystemIncludeArgs(const ArgList &DriverArgs,
 
   AddMultilibIncludeArgs(DriverArgs, CC1Args);
 
-  if (getTriple().getArch() == llvm::Triple::x86) {
-    std::string Path = SysRoot + "/usr/include/i386-gnu";
-    if (D.getVFS().exists(Path))
-      addExternCSystemInclude(DriverArgs, CC1Args, Path);
-  }
+  // On systems using multiarch, add /usr/include/$triple before
+  // /usr/include.
+  std::string MultiarchIncludeDir = getMultiarchTriple(D, getTriple(), SysRoot);
+  if (!MultiarchIncludeDir.empty() &&
+      D.getVFS().exists(SysRoot + "/usr/include/" + MultiarchIncludeDir))
+    addExternCSystemInclude(DriverArgs, CC1Args,
+                            SysRoot + "/usr/include/" + MultiarchIncludeDir);
 
   // Add an include of '/include' directly. This isn't provided by default by
   // system GCCs, but is often used with cross-compiling GCCs, and harmless to


        


More information about the cfe-commits mailing list