[PATCH] D54378: Add Hurd triplet

Samuel Thibault via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Nov 10 05:31:26 PST 2018


sthibaul created this revision.
sthibaul added reviewers: joerg, echristo, rengolin.
Herald added subscribers: llvm-commits, kristina, dexonsmith.

Repository:
  rL LLVM

https://reviews.llvm.org/D54378

Files:
  include/llvm/ADT/Triple.h
  lib/Support/Triple.cpp


Index: lib/Support/Triple.cpp
===================================================================
--- lib/Support/Triple.cpp
+++ lib/Support/Triple.cpp
@@ -210,6 +210,7 @@
   case Contiki: return "contiki";
   case AMDPAL: return "amdpal";
   case HermitCore: return "hermit";
+  case Hurd: return "gnu";
   }
 
   llvm_unreachable("Invalid OSType");
@@ -508,6 +509,7 @@
     .StartsWith("contiki", Triple::Contiki)
     .StartsWith("amdpal", Triple::AMDPAL)
     .StartsWith("hermit", Triple::HermitCore)
+    .StartsWith("gnu", Triple::Hurd)
     .Default(Triple::UnknownOS);
 }
 
Index: include/llvm/ADT/Triple.h
===================================================================
--- include/llvm/ADT/Triple.h
+++ include/llvm/ADT/Triple.h
@@ -186,7 +186,8 @@
     Contiki,
     AMDPAL,     // AMD PAL Runtime
     HermitCore, // HermitCore Unikernel/Multikernel
-    LastOSType = HermitCore
+    Hurd,       // GNU/Hurd
+    LastOSType = Hurd
   };
   enum EnvironmentType {
     UnknownEnvironment,
@@ -582,9 +583,15 @@
     return getOS() == Triple::KFreeBSD;
   }
 
+  /// Tests whether the OS is Hurd.
+  bool isOSHurd() const {
+    return getOS() == Triple::Hurd;
+  }
+
   /// Tests whether the OS uses glibc.
   bool isOSGlibc() const {
-    return (getOS() == Triple::Linux || getOS() == Triple::KFreeBSD) &&
+    return (getOS() == Triple::Linux || getOS() == Triple::KFreeBSD ||
+            getOS() == Triple::Hurd) &&
            !isAndroid();
   }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D54378.173510.patch
Type: text/x-patch
Size: 1469 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181110/6dde1d68/attachment.bin>


More information about the llvm-commits mailing list