[PATCH] D24897: Define "contiki" OS specifier.

Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 14 07:51:07 PDT 2016


This revision was automatically updated to reflect the committed changes.
Closed by commit rL284240: Define "contiki" OS specifier. (authored by dlkreitz).

Changed prior to commit:
  https://reviews.llvm.org/D24897?vs=74154&id=74690#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D24897

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


Index: llvm/trunk/include/llvm/ADT/Triple.h
===================================================================
--- llvm/trunk/include/llvm/ADT/Triple.h
+++ llvm/trunk/include/llvm/ADT/Triple.h
@@ -170,7 +170,8 @@
     TvOS,       // Apple tvOS
     WatchOS,    // Apple watchOS
     Mesa3D,
-    LastOSType = Mesa3D
+    Contiki,
+    LastOSType = Contiki
   };
   enum EnvironmentType {
     UnknownEnvironment,
@@ -489,6 +490,10 @@
            Env == Triple::GNUX32;
   }
 
+  bool isOSContiki() const {
+    return getOS() == Triple::Contiki;
+  }
+
   /// Checks if the environment could be MSVC.
   bool isWindowsMSVCEnvironment() const {
     return getOS() == Triple::Win32 &&
Index: llvm/trunk/lib/Support/Triple.cpp
===================================================================
--- llvm/trunk/lib/Support/Triple.cpp
+++ llvm/trunk/lib/Support/Triple.cpp
@@ -193,6 +193,7 @@
   case TvOS: return "tvos";
   case WatchOS: return "watchos";
   case Mesa3D: return "mesa3d";
+  case Contiki: return "contiki";
   }
 
   llvm_unreachable("Invalid OSType");
@@ -465,6 +466,7 @@
     .StartsWith("tvos", Triple::TvOS)
     .StartsWith("watchos", Triple::WatchOS)
     .StartsWith("mesa3d", Triple::Mesa3D)
+    .StartsWith("contiki", Triple::Contiki)
     .Default(Triple::UnknownOS);
 }
 
Index: llvm/trunk/unittests/ADT/TripleTest.cpp
===================================================================
--- llvm/trunk/unittests/ADT/TripleTest.cpp
+++ llvm/trunk/unittests/ADT/TripleTest.cpp
@@ -87,6 +87,12 @@
   EXPECT_EQ(Triple::ELFIAMCU, T.getOS());
   EXPECT_EQ(Triple::UnknownEnvironment, T.getEnvironment());
 
+  T = Triple("i386-pc-contiki-unknown");
+  EXPECT_EQ(Triple::x86, T.getArch());
+  EXPECT_EQ(Triple::PC, T.getVendor());
+  EXPECT_EQ(Triple::Contiki, T.getOS());
+  EXPECT_EQ(Triple::UnknownEnvironment, T.getEnvironment());
+
   T = Triple("x86_64-pc-linux-gnu");
   EXPECT_EQ(Triple::x86_64, T.getArch());
   EXPECT_EQ(Triple::PC, T.getVendor());


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D24897.74690.patch
Type: text/x-patch
Size: 1979 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161014/e2bc4f5f/attachment.bin>


More information about the llvm-commits mailing list