summaryrefslogtreecommitdiff
path: root/lib/Support/Triple.cpp
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2009-08-18 19:26:55 +0000
committerDaniel Dunbar <daniel@zuster.org>2009-08-18 19:26:55 +0000
commit651aa689cc37d5932fac0e096aa8b536f282aa21 (patch)
treeecd1967cfa05a67497cf0275abcb468ab04108c0 /lib/Support/Triple.cpp
parentfe37ab335be5632eab561d49984c95cb06b946d4 (diff)
downloadllvm-651aa689cc37d5932fac0e096aa8b536f282aa21.tar.gz
llvm-651aa689cc37d5932fac0e096aa8b536f282aa21.tar.bz2
llvm-651aa689cc37d5932fac0e096aa8b536f282aa21.tar.xz
Improve Triple to recognize the OS in i386-mingw32.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79359 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Support/Triple.cpp')
-rw-r--r--lib/Support/Triple.cpp21
1 files changed, 19 insertions, 2 deletions
diff --git a/lib/Support/Triple.cpp b/lib/Support/Triple.cpp
index c2982ce661..df28b98b68 100644
--- a/lib/Support/Triple.cpp
+++ b/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"))