[Triple] Define OS Check for Haiku

This adds the OS check for the Haiku operating system, as it was
missing in the Triple class. Tests for x86_64-unknown-haiku and
i586-pc-haiku were also added.

These patches only affect Haiku and are completely harmless for
other platforms.

Patch by Calvin Hill <calvin@hakobaito.co.uk>

llvm-svn: 311153
This commit is contained in:
Renato Golin 2017-08-18 10:35:42 +00:00
parent 827c8acc21
commit 6fd16d37ae
2 changed files with 17 additions and 0 deletions

View File

@ -504,6 +504,11 @@ public:
return getOS() == Triple::Contiki;
}
/// Tests whether the OS is Haiku.
bool isOSHaiku() const {
return getOS() == Triple::Haiku;
}
/// Checks if the environment could be MSVC.
bool isWindowsMSVCEnvironment() const {
return getOS() == Triple::Win32 &&

View File

@ -296,6 +296,18 @@ TEST(TripleTest, ParsedIDs) {
EXPECT_EQ(Triple::Linux, T.getOS());
EXPECT_EQ(Triple::GNUEABI, T.getEnvironment());
T = Triple("i586-pc-haiku");
EXPECT_EQ(Triple::x86, T.getArch());
EXPECT_EQ(Triple::PC, T.getVendor());
EXPECT_EQ(Triple::Haiku, T.getOS());
EXPECT_EQ(Triple::UnknownEnvironment, T.getEnvironment());
T = Triple("x86_64-unknown-haiku");
EXPECT_EQ(Triple::x86_64, T.getArch());
EXPECT_EQ(Triple::UnknownVendor, T.getVendor());
EXPECT_EQ(Triple::Haiku, T.getOS());
EXPECT_EQ(Triple::UnknownEnvironment, T.getEnvironment());
T = Triple("huh");
EXPECT_EQ(Triple::UnknownArch, T.getArch());
}