Remove the MinGW32 and Cygwin types from the OSType enumeration. These values
are represented via environments of Windows. It is a source of confusion and
needlessly clutters the code. The cost of doing this is that we must sink the
check for them into the normalization code path along with the spelling.
Addresses PR20592.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@215303
91177308-0d34-0410-b5e6-
96231b3b80d8
Darwin,
DragonFly,
FreeBSD,
Darwin,
DragonFly,
FreeBSD,
Linux,
Lv2, // PS3
MacOSX,
Linux,
Lv2, // PS3
MacOSX,
- MinGW32, // i*86-pc-mingw32, *-w64-mingw32
NetBSD,
OpenBSD,
Solaris,
NetBSD,
OpenBSD,
Solaris,
}
bool isWindowsCygwinEnvironment() const {
}
bool isWindowsCygwinEnvironment() const {
- return getOS() == Triple::Cygwin ||
- (getOS() == Triple::Win32 && getEnvironment() == Triple::Cygnus);
+ return getOS() == Triple::Win32 && getEnvironment() == Triple::Cygnus;
}
bool isWindowsGNUEnvironment() const {
}
bool isWindowsGNUEnvironment() const {
- return getOS() == Triple::MinGW32 ||
- (getOS() == Triple::Win32 && getEnvironment() == Triple::GNU);
+ return getOS() == Triple::Win32 && getEnvironment() == Triple::GNU;
}
/// \brief Tests for either Cygwin or MinGW OS
}
/// \brief Tests for either Cygwin or MinGW OS
case UnknownOS: return "unknown";
case AuroraUX: return "auroraux";
case UnknownOS: return "unknown";
case AuroraUX: return "auroraux";
- case Cygwin: return "cygwin";
case Darwin: return "darwin";
case DragonFly: return "dragonfly";
case FreeBSD: return "freebsd";
case Darwin: return "darwin";
case DragonFly: return "dragonfly";
case FreeBSD: return "freebsd";
case Linux: return "linux";
case Lv2: return "lv2";
case MacOSX: return "macosx";
case Linux: return "linux";
case Lv2: return "lv2";
case MacOSX: return "macosx";
- case MinGW32: return "mingw32";
case NetBSD: return "netbsd";
case OpenBSD: return "openbsd";
case Solaris: return "solaris";
case NetBSD: return "netbsd";
case OpenBSD: return "openbsd";
case Solaris: return "solaris";
static Triple::OSType parseOS(StringRef OSName) {
return StringSwitch<Triple::OSType>(OSName)
.StartsWith("auroraux", Triple::AuroraUX)
static Triple::OSType parseOS(StringRef OSName) {
return StringSwitch<Triple::OSType>(OSName)
.StartsWith("auroraux", Triple::AuroraUX)
- .StartsWith("cygwin", Triple::Cygwin)
.StartsWith("darwin", Triple::Darwin)
.StartsWith("dragonfly", Triple::DragonFly)
.StartsWith("freebsd", Triple::FreeBSD)
.StartsWith("darwin", Triple::Darwin)
.StartsWith("dragonfly", Triple::DragonFly)
.StartsWith("freebsd", Triple::FreeBSD)
.StartsWith("linux", Triple::Linux)
.StartsWith("lv2", Triple::Lv2)
.StartsWith("macosx", Triple::MacOSX)
.StartsWith("linux", Triple::Linux)
.StartsWith("lv2", Triple::Lv2)
.StartsWith("macosx", Triple::MacOSX)
- .StartsWith("mingw32", Triple::MinGW32)
.StartsWith("netbsd", Triple::NetBSD)
.StartsWith("openbsd", Triple::OpenBSD)
.StartsWith("solaris", Triple::Solaris)
.StartsWith("netbsd", Triple::NetBSD)
.StartsWith("openbsd", Triple::OpenBSD)
.StartsWith("solaris", Triple::Solaris)
}
std::string Triple::normalize(StringRef Str) {
}
std::string Triple::normalize(StringRef Str) {
+ bool IsMinGW32 = false;
+ bool IsCygwin = false;
+
// Parse into components.
SmallVector<StringRef, 4> Components;
Str.split(Components, "-");
// Parse into components.
SmallVector<StringRef, 4> Components;
Str.split(Components, "-");
if (Components.size() > 1)
Vendor = parseVendor(Components[1]);
OSType OS = UnknownOS;
if (Components.size() > 1)
Vendor = parseVendor(Components[1]);
OSType OS = UnknownOS;
- if (Components.size() > 2)
+ if (Components.size() > 2) {
OS = parseOS(Components[2]);
OS = parseOS(Components[2]);
+ IsCygwin = Components[2].startswith("cygwin");
+ IsMinGW32 = Components[2].startswith("mingw");
+ }
EnvironmentType Environment = UnknownEnvironment;
if (Components.size() > 3)
Environment = parseEnvironment(Components[3]);
EnvironmentType Environment = UnknownEnvironment;
if (Components.size() > 3)
Environment = parseEnvironment(Components[3]);
break;
case 2:
OS = parseOS(Comp);
break;
case 2:
OS = parseOS(Comp);
- Valid = OS != UnknownOS;
+ IsCygwin = Comp.startswith("cygwin");
+ IsMinGW32 = Comp.startswith("mingw");
+ Valid = OS != UnknownOS || IsCygwin || IsMinGW32;
break;
case 3:
Environment = parseEnvironment(Comp);
break;
case 3:
Environment = parseEnvironment(Comp);
else
Components[3] = getObjectFormatTypeName(ObjectFormat);
}
else
Components[3] = getObjectFormatTypeName(ObjectFormat);
}
- } else if (OS == Triple::MinGW32) {
+ } else if (IsMinGW32) {
Components.resize(4);
Components[2] = "windows";
Components[3] = "gnu";
Components.resize(4);
Components[2] = "windows";
Components[3] = "gnu";
- } else if (OS == Triple::Cygwin) {
Components.resize(4);
Components[2] = "windows";
Components[3] = "cygnus";
}
Components.resize(4);
Components[2] = "windows";
Components[3] = "cygnus";
}
- if (OS == Triple::MinGW32 || OS == Triple::Cygwin ||
+ if (IsMinGW32 || IsCygwin ||
(OS == Triple::Win32 && Environment != UnknownEnvironment)) {
if (ObjectFormat != UnknownObjectFormat && ObjectFormat != Triple::COFF) {
Components.resize(5);
(OS == Triple::Win32 && Environment != UnknownEnvironment)) {
if (ObjectFormat != UnknownObjectFormat && ObjectFormat != Triple::COFF) {
Components.resize(5);
++Vendor) {
C[1] = Triple::getVendorTypeName(Triple::VendorType(Vendor));
for (int OS = 1+Triple::UnknownOS; OS <= Triple::Minix; ++OS) {
++Vendor) {
C[1] = Triple::getVendorTypeName(Triple::VendorType(Vendor));
for (int OS = 1+Triple::UnknownOS; OS <= Triple::Minix; ++OS) {
- if (OS == Triple::Cygwin || OS == Triple::MinGW32 || OS == Triple::Win32)
+ if (OS == Triple::Win32)
continue;
C[2] = Triple::getOSTypeName(Triple::OSType(OS));
continue;
C[2] = Triple::getOSTypeName(Triple::OSType(OS));
// The operating systems below are known to be sufficiently incompatible
// that they will fail the MCJIT C API tests.
// The operating systems below are known to be sufficiently incompatible
// that they will fail the MCJIT C API tests.
- UnsupportedOSs.push_back(Triple::Cygwin);
-
UnsupportedEnvironments.push_back(Triple::Cygnus);
}
UnsupportedEnvironments.push_back(Triple::Cygnus);
}
// The operating systems below are known to be incompatible with MCJIT as
// they are copied from the test/ExecutionEngine/MCJIT/lit.local.cfg and
// should be kept in sync.
// The operating systems below are known to be incompatible with MCJIT as
// they are copied from the test/ExecutionEngine/MCJIT/lit.local.cfg and
// should be kept in sync.
- UnsupportedOSs.push_back(Triple::Cygwin);
UnsupportedOSs.push_back(Triple::Darwin);
UnsupportedEnvironments.push_back(Triple::Cygnus);
UnsupportedOSs.push_back(Triple::Darwin);
UnsupportedEnvironments.push_back(Triple::Cygnus);