Define "contiki" OS specifier.

Patch by Michael LeMay

Differential revision: http://reviews.llvm.org/D24897

llvm-svn: 284240
This commit is contained in:
David L Kreitzer 2016-10-14 14:41:46 +00:00
parent 00fc7a6159
commit 3155abfb57
3 changed files with 14 additions and 1 deletions

View File

@ -170,7 +170,8 @@ public:
TvOS, // Apple tvOS
WatchOS, // Apple watchOS
Mesa3D,
LastOSType = Mesa3D
Contiki,
LastOSType = Contiki
};
enum EnvironmentType {
UnknownEnvironment,
@ -489,6 +490,10 @@ public:
Env == Triple::GNUX32;
}
bool isOSContiki() const {
return getOS() == Triple::Contiki;
}
/// Checks if the environment could be MSVC.
bool isWindowsMSVCEnvironment() const {
return getOS() == Triple::Win32 &&

View File

@ -193,6 +193,7 @@ StringRef Triple::getOSTypeName(OSType Kind) {
case TvOS: return "tvos";
case WatchOS: return "watchos";
case Mesa3D: return "mesa3d";
case Contiki: return "contiki";
}
llvm_unreachable("Invalid OSType");
@ -465,6 +466,7 @@ static Triple::OSType parseOS(StringRef OSName) {
.StartsWith("tvos", Triple::TvOS)
.StartsWith("watchos", Triple::WatchOS)
.StartsWith("mesa3d", Triple::Mesa3D)
.StartsWith("contiki", Triple::Contiki)
.Default(Triple::UnknownOS);
}

View File

@ -87,6 +87,12 @@ TEST(TripleTest, ParsedIDs) {
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());