[PATCH] D101324: Hurd: Clean up Debian multiarch /usr/include/<triplet>

Samuel Thibault via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 26 14:18:28 PDT 2021


sthibaul created this revision.
sthibaul requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

This is a follow-up of 35dd6470de84 <https://reviews.llvm.org/rG35dd6470de847636c212d7e0cd4d7ac2995679cc> for the Hurd case, to avoid the
duplication of the i386-gnu path, already provided by
Hurd::getMultiarchTriple.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D101324

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


Index: clang/lib/Driver/ToolChains/Hurd.cpp
===================================================================
--- clang/lib/Driver/ToolChains/Hurd.cpp
+++ clang/lib/Driver/ToolChains/Hurd.cpp
@@ -170,11 +170,13 @@
 
   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


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D101324.340642.patch
Type: text/x-patch
Size: 1050 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210426/8a132470/attachment.bin>


More information about the cfe-commits mailing list