Add a Musl environment to the triple.

It will be used in clang.

Patch by Lei Zhang.

llvm-svn: 272660
This commit is contained in:
Rafael Espindola 2016-06-14 12:45:33 +00:00
parent be7aa544f0
commit 9768b0ae73
3 changed files with 9 additions and 0 deletions

View File

@ -179,6 +179,7 @@ public:
EABI,
EABIHF,
Android,
Musl,
MSVC,
Itanium,

View File

@ -205,6 +205,7 @@ const char *Triple::getEnvironmentTypeName(EnvironmentType Kind) {
case EABI: return "eabi";
case EABIHF: return "eabihf";
case Android: return "android";
case Musl: return "musl";
case MSVC: return "msvc";
case Itanium: return "itanium";
case Cygnus: return "cygnus";
@ -464,6 +465,7 @@ static Triple::EnvironmentType parseEnvironment(StringRef EnvironmentName) {
.StartsWith("code16", Triple::CODE16)
.StartsWith("gnu", Triple::GNU)
.StartsWith("android", Triple::Android)
.StartsWith("musl", Triple::Musl)
.StartsWith("msvc", Triple::MSVC)
.StartsWith("itanium", Triple::Itanium)
.StartsWith("cygnus", Triple::Cygnus)

View File

@ -93,6 +93,12 @@ TEST(TripleTest, ParsedIDs) {
EXPECT_EQ(Triple::Linux, T.getOS());
EXPECT_EQ(Triple::GNU, T.getEnvironment());
T = Triple("x86_64-pc-linux-musl");
EXPECT_EQ(Triple::x86_64, T.getArch());
EXPECT_EQ(Triple::PC, T.getVendor());
EXPECT_EQ(Triple::Linux, T.getOS());
EXPECT_EQ(Triple::Musl, T.getEnvironment());
T = Triple("powerpc-bgp-linux");
EXPECT_EQ(Triple::ppc, T.getArch());
EXPECT_EQ(Triple::BGP, T.getVendor());