From 4c93fe068533cf9568fc1c62fb0b24fd463dfdcf Mon Sep 17 00:00:00 2001 From: Rafael Espindola Date: Tue, 14 Jun 2016 12:45:33 +0000 Subject: [PATCH] Add a Musl environment to the triple. It will be used in clang. Patch by Lei Zhang. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272660 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/ADT/Triple.h | 1 + lib/Support/Triple.cpp | 2 ++ unittests/ADT/TripleTest.cpp | 6 ++++++ 3 files changed, 9 insertions(+) diff --git a/include/llvm/ADT/Triple.h b/include/llvm/ADT/Triple.h index 5e35e8e0d8a..beb19ffee4a 100644 --- a/include/llvm/ADT/Triple.h +++ b/include/llvm/ADT/Triple.h @@ -179,6 +179,7 @@ public: EABI, EABIHF, Android, + Musl, MSVC, Itanium, diff --git a/lib/Support/Triple.cpp b/lib/Support/Triple.cpp index 1967fac2600..c792fcbc34d 100644 --- a/lib/Support/Triple.cpp +++ b/lib/Support/Triple.cpp @@ -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) diff --git a/unittests/ADT/TripleTest.cpp b/unittests/ADT/TripleTest.cpp index e3835422433..c8602228faf 100644 --- a/unittests/ADT/TripleTest.cpp +++ b/unittests/ADT/TripleTest.cpp @@ -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()); -- 2.11.0