|
| 1 | +diff --git a/llvm/include/llvm/ADT/Triple.h b/llvm/include/llvm/ADT/Triple.h |
| 2 | +index edeb31efab8..fd9e38db0ac 100644 |
| 3 | +--- a/llvm/include/llvm/ADT/Triple.h |
| 4 | ++++ b/llvm/include/llvm/ADT/Triple.h |
| 5 | +@@ -149,7 +149,8 @@ public: |
| 6 | + Mesa, |
| 7 | + SUSE, |
| 8 | + OpenEmbedded, |
| 9 | +- LastVendorType = OpenEmbedded |
| 10 | ++ MeeGo, |
| 11 | ++ LastVendorType = MeeGo |
| 12 | + }; |
| 13 | + enum OSType { |
| 14 | + UnknownOS, |
| 15 | +diff --git a/llvm/lib/Support/Triple.cpp b/llvm/lib/Support/Triple.cpp |
| 16 | +index d419463e6a5..916ebc28856 100644 |
| 17 | +--- a/llvm/lib/Support/Triple.cpp |
| 18 | ++++ b/llvm/lib/Support/Triple.cpp |
| 19 | +@@ -166,6 +166,7 @@ StringRef Triple::getVendorTypeName(VendorType Kind) { |
| 20 | + case AMD: return "amd"; |
| 21 | + case Mesa: return "mesa"; |
| 22 | + case SUSE: return "suse"; |
| 23 | ++ case MeeGo: return "meego"; |
| 24 | + case OpenEmbedded: return "oe"; |
| 25 | + } |
| 26 | + |
| 27 | +@@ -476,6 +477,7 @@ static Triple::VendorType parseVendor(StringRef VendorName) { |
| 28 | + .Case("mesa", Triple::Mesa) |
| 29 | + .Case("suse", Triple::SUSE) |
| 30 | + .Case("oe", Triple::OpenEmbedded) |
| 31 | ++ .Case("meego", Triple::MeeGo) |
| 32 | + .Default(Triple::UnknownVendor); |
| 33 | + } |
| 34 | + |
| 35 | +@@ -738,6 +740,9 @@ Triple::Triple(const Twine &Str) |
| 36 | + OS = parseOS(Components[2]); |
| 37 | + if (Components.size() > 3) { |
| 38 | + Environment = parseEnvironment(Components[3]); |
| 39 | ++ // MeeGo uses "gnueabi" to mean "gnueabihf" |
| 40 | ++ if (Vendor == Triple::MeeGo && Environment == Triple::GNUEABI) |
| 41 | ++ Environment = Triple::GNUEABIHF; |
| 42 | + ObjectFormat = parseFormat(Components[3]); |
| 43 | + } |
| 44 | + } |
| 45 | +@@ -789,6 +794,10 @@ Triple::Triple(const Twine &ArchStr, const Twine &VendorStr, const Twine &OSStr, |
| 46 | + ObjectFormat(parseFormat(EnvironmentStr.str())) { |
| 47 | + if (ObjectFormat == Triple::UnknownObjectFormat) |
| 48 | + ObjectFormat = getDefaultFormat(*this); |
| 49 | ++ |
| 50 | ++ // MeeGo uses "gnueabi" to mean "gnueabihf" |
| 51 | ++ if (Vendor == Triple::MeeGo && Environment == Triple::GNUEABI) |
| 52 | ++ Environment = Triple::GNUEABIHF; |
| 53 | + } |
| 54 | + |
| 55 | + std::string Triple::normalize(StringRef Str) { |
| 56 | +@@ -1051,6 +1065,9 @@ void Triple::getEnvironmentVersion(unsigned &Major, unsigned &Minor, |
| 57 | + unsigned &Micro) const { |
| 58 | + StringRef EnvironmentName = getEnvironmentName(); |
| 59 | + StringRef EnvironmentTypeName = getEnvironmentTypeName(getEnvironment()); |
| 60 | ++ // MeeGo uses "gnueabi" to mean "gnueabihf" |
| 61 | ++ if (Vendor == Triple::MeeGo && getEnvironment() == Triple::GNUEABIHF) |
| 62 | ++ EnvironmentTypeName = "gnueabi"; |
| 63 | + if (EnvironmentName.startswith(EnvironmentTypeName)) |
| 64 | + EnvironmentName = EnvironmentName.substr(EnvironmentTypeName.size()); |
| 65 | + |
| 66 | +diff --git a/llvm/unittests/ADT/TripleTest.cpp b/llvm/unittests/ADT/TripleTest.cpp |
| 67 | +index 37ebe5dbcb2..2a69a2af8f5 100644 |
| 68 | +--- a/llvm/unittests/ADT/TripleTest.cpp |
| 69 | ++++ b/llvm/unittests/ADT/TripleTest.cpp |
| 70 | +@@ -336,6 +336,12 @@ TEST(TripleTest, ParsedIDs) { |
| 71 | + EXPECT_EQ(Triple::Linux, T.getOS()); |
| 72 | + EXPECT_EQ(Triple::GNUEABI, T.getEnvironment()); |
| 73 | + |
| 74 | ++ T = Triple("armv7hl-meego-linux-gnueabi"); |
| 75 | ++ EXPECT_EQ(Triple::arm, T.getArch()); |
| 76 | ++ EXPECT_EQ(Triple::MeeGo, T.getVendor()); |
| 77 | ++ EXPECT_EQ(Triple::Linux, T.getOS()); |
| 78 | ++ EXPECT_EQ(Triple::GNUEABIHF, T.getEnvironment()); |
| 79 | ++ |
| 80 | + T = Triple("i586-pc-haiku"); |
| 81 | + EXPECT_EQ(Triple::x86, T.getArch()); |
| 82 | + EXPECT_EQ(Triple::PC, T.getVendor()); |
0 commit comments