Skip to content

Commit 9768b0a

Browse files
committed
Add a Musl environment to the triple.
It will be used in clang. Patch by Lei Zhang. llvm-svn: 272660
1 parent be7aa54 commit 9768b0a

File tree

3 files changed

+9
-0
lines changed

3 files changed

+9
-0
lines changed

llvm/include/llvm/ADT/Triple.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,7 @@ class Triple {
179179
EABI,
180180
EABIHF,
181181
Android,
182+
Musl,
182183

183184
MSVC,
184185
Itanium,

llvm/lib/Support/Triple.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,7 @@ const char *Triple::getEnvironmentTypeName(EnvironmentType Kind) {
205205
case EABI: return "eabi";
206206
case EABIHF: return "eabihf";
207207
case Android: return "android";
208+
case Musl: return "musl";
208209
case MSVC: return "msvc";
209210
case Itanium: return "itanium";
210211
case Cygnus: return "cygnus";
@@ -464,6 +465,7 @@ static Triple::EnvironmentType parseEnvironment(StringRef EnvironmentName) {
464465
.StartsWith("code16", Triple::CODE16)
465466
.StartsWith("gnu", Triple::GNU)
466467
.StartsWith("android", Triple::Android)
468+
.StartsWith("musl", Triple::Musl)
467469
.StartsWith("msvc", Triple::MSVC)
468470
.StartsWith("itanium", Triple::Itanium)
469471
.StartsWith("cygnus", Triple::Cygnus)

llvm/unittests/ADT/TripleTest.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,12 @@ TEST(TripleTest, ParsedIDs) {
9393
EXPECT_EQ(Triple::Linux, T.getOS());
9494
EXPECT_EQ(Triple::GNU, T.getEnvironment());
9595

96+
T = Triple("x86_64-pc-linux-musl");
97+
EXPECT_EQ(Triple::x86_64, T.getArch());
98+
EXPECT_EQ(Triple::PC, T.getVendor());
99+
EXPECT_EQ(Triple::Linux, T.getOS());
100+
EXPECT_EQ(Triple::Musl, T.getEnvironment());
101+
96102
T = Triple("powerpc-bgp-linux");
97103
EXPECT_EQ(Triple::ppc, T.getArch());
98104
EXPECT_EQ(Triple::BGP, T.getVendor());

0 commit comments

Comments
 (0)