diff options
author | Daniel Dunbar <daniel@zuster.org> | 2009-08-18 19:26:55 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2009-08-18 19:26:55 +0000 |
commit | 959323a2600c6edc764d5e88dac20afc89221c13 (patch) | |
tree | 2d938913738fbeaf9e04d57d1504a47457d151ee /llvm/lib | |
parent | 60eb473ac91e4dae897707db37371f0ea93c969b (diff) | |
download | bcm5719-llvm-959323a2600c6edc764d5e88dac20afc89221c13.tar.gz bcm5719-llvm-959323a2600c6edc764d5e88dac20afc89221c13.zip |
Improve Triple to recognize the OS in i386-mingw32.
llvm-svn: 79359
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/Support/Triple.cpp | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/llvm/lib/Support/Triple.cpp b/llvm/lib/Support/Triple.cpp index c2982ce6615..df28b98b689 100644 --- a/llvm/lib/Support/Triple.cpp +++ b/llvm/lib/Support/Triple.cpp @@ -117,6 +117,9 @@ void Triple::Parse() const { assert(!isInitialized() && "Invalid parse call."); StringRef ArchName = getArchName(); + StringRef VendorName = getVendorName(); + StringRef OSName = getOSName(); + if (ArchName.size() == 4 && ArchName[0] == 'i' && ArchName[2] == '8' && ArchName[3] == '6' && ArchName[1] - '3' < 6) // i[3-9]86 @@ -156,7 +159,22 @@ void Triple::Parse() const { else Arch = UnknownArch; - StringRef VendorName = getVendorName(); + + // Handle some exceptional cases where the OS / environment components are + // stuck into the vendor field. + if (StringRef(getTriple()).count('-') == 1) { + StringRef VendorName = getVendorName(); + + if (VendorName.startswith("mingw32")) { // 'i386-mingw32', etc. + Vendor = PC; + OS = MinGW32; + return; + } + + // arm-elf is another example, but we don't currently parse anything about + // the environment. + } + if (VendorName == "apple") Vendor = Apple; else if (VendorName == "pc") @@ -164,7 +182,6 @@ void Triple::Parse() const { else Vendor = UnknownVendor; - StringRef OSName = getOSName(); if (OSName.startswith("auroraux")) OS = AuroraUX; else if (OSName.startswith("cygwin")) |