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());