mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-02-13 08:54:59 +00:00
ADT: remove MinGW32 and Cygwin OSType enum
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. llvm-svn: 215303
This commit is contained in:
parent
b734c2ca97
commit
92b98299b9
@ -111,7 +111,6 @@ public:
|
|||||||
UnknownOS,
|
UnknownOS,
|
||||||
|
|
||||||
AuroraUX,
|
AuroraUX,
|
||||||
Cygwin,
|
|
||||||
Darwin,
|
Darwin,
|
||||||
DragonFly,
|
DragonFly,
|
||||||
FreeBSD,
|
FreeBSD,
|
||||||
@ -120,7 +119,6 @@ public:
|
|||||||
Linux,
|
Linux,
|
||||||
Lv2, // PS3
|
Lv2, // PS3
|
||||||
MacOSX,
|
MacOSX,
|
||||||
MinGW32, // i*86-pc-mingw32, *-w64-mingw32
|
|
||||||
NetBSD,
|
NetBSD,
|
||||||
OpenBSD,
|
OpenBSD,
|
||||||
Solaris,
|
Solaris,
|
||||||
@ -378,13 +376,11 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool isWindowsCygwinEnvironment() const {
|
bool isWindowsCygwinEnvironment() const {
|
||||||
return getOS() == Triple::Cygwin ||
|
return getOS() == Triple::Win32 && getEnvironment() == Triple::Cygnus;
|
||||||
(getOS() == Triple::Win32 && getEnvironment() == Triple::Cygnus);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isWindowsGNUEnvironment() const {
|
bool isWindowsGNUEnvironment() const {
|
||||||
return getOS() == Triple::MinGW32 ||
|
return getOS() == Triple::Win32 && getEnvironment() == Triple::GNU;
|
||||||
(getOS() == Triple::Win32 && getEnvironment() == Triple::GNU);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// \brief Tests for either Cygwin or MinGW OS
|
/// \brief Tests for either Cygwin or MinGW OS
|
||||||
|
@ -126,7 +126,6 @@ const char *Triple::getOSTypeName(OSType Kind) {
|
|||||||
case UnknownOS: return "unknown";
|
case UnknownOS: return "unknown";
|
||||||
|
|
||||||
case AuroraUX: return "auroraux";
|
case AuroraUX: return "auroraux";
|
||||||
case Cygwin: return "cygwin";
|
|
||||||
case Darwin: return "darwin";
|
case Darwin: return "darwin";
|
||||||
case DragonFly: return "dragonfly";
|
case DragonFly: return "dragonfly";
|
||||||
case FreeBSD: return "freebsd";
|
case FreeBSD: return "freebsd";
|
||||||
@ -135,7 +134,6 @@ const char *Triple::getOSTypeName(OSType Kind) {
|
|||||||
case Linux: return "linux";
|
case Linux: return "linux";
|
||||||
case Lv2: return "lv2";
|
case Lv2: return "lv2";
|
||||||
case MacOSX: return "macosx";
|
case MacOSX: return "macosx";
|
||||||
case MinGW32: return "mingw32";
|
|
||||||
case NetBSD: return "netbsd";
|
case NetBSD: return "netbsd";
|
||||||
case OpenBSD: return "openbsd";
|
case OpenBSD: return "openbsd";
|
||||||
case Solaris: return "solaris";
|
case Solaris: return "solaris";
|
||||||
@ -273,7 +271,6 @@ static Triple::VendorType parseVendor(StringRef VendorName) {
|
|||||||
static Triple::OSType parseOS(StringRef OSName) {
|
static Triple::OSType parseOS(StringRef OSName) {
|
||||||
return StringSwitch<Triple::OSType>(OSName)
|
return StringSwitch<Triple::OSType>(OSName)
|
||||||
.StartsWith("auroraux", Triple::AuroraUX)
|
.StartsWith("auroraux", Triple::AuroraUX)
|
||||||
.StartsWith("cygwin", Triple::Cygwin)
|
|
||||||
.StartsWith("darwin", Triple::Darwin)
|
.StartsWith("darwin", Triple::Darwin)
|
||||||
.StartsWith("dragonfly", Triple::DragonFly)
|
.StartsWith("dragonfly", Triple::DragonFly)
|
||||||
.StartsWith("freebsd", Triple::FreeBSD)
|
.StartsWith("freebsd", Triple::FreeBSD)
|
||||||
@ -282,7 +279,6 @@ static Triple::OSType parseOS(StringRef OSName) {
|
|||||||
.StartsWith("linux", Triple::Linux)
|
.StartsWith("linux", Triple::Linux)
|
||||||
.StartsWith("lv2", Triple::Lv2)
|
.StartsWith("lv2", Triple::Lv2)
|
||||||
.StartsWith("macosx", Triple::MacOSX)
|
.StartsWith("macosx", Triple::MacOSX)
|
||||||
.StartsWith("mingw32", Triple::MinGW32)
|
|
||||||
.StartsWith("netbsd", Triple::NetBSD)
|
.StartsWith("netbsd", Triple::NetBSD)
|
||||||
.StartsWith("openbsd", Triple::OpenBSD)
|
.StartsWith("openbsd", Triple::OpenBSD)
|
||||||
.StartsWith("solaris", Triple::Solaris)
|
.StartsWith("solaris", Triple::Solaris)
|
||||||
@ -416,6 +412,9 @@ Triple::Triple(const Twine &ArchStr, const Twine &VendorStr, const Twine &OSStr,
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::string Triple::normalize(StringRef Str) {
|
std::string Triple::normalize(StringRef Str) {
|
||||||
|
bool IsMinGW32 = false;
|
||||||
|
bool IsCygwin = false;
|
||||||
|
|
||||||
// Parse into components.
|
// Parse into components.
|
||||||
SmallVector<StringRef, 4> Components;
|
SmallVector<StringRef, 4> Components;
|
||||||
Str.split(Components, "-");
|
Str.split(Components, "-");
|
||||||
@ -432,8 +431,11 @@ std::string Triple::normalize(StringRef Str) {
|
|||||||
if (Components.size() > 1)
|
if (Components.size() > 1)
|
||||||
Vendor = parseVendor(Components[1]);
|
Vendor = parseVendor(Components[1]);
|
||||||
OSType OS = UnknownOS;
|
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;
|
EnvironmentType Environment = UnknownEnvironment;
|
||||||
if (Components.size() > 3)
|
if (Components.size() > 3)
|
||||||
Environment = parseEnvironment(Components[3]);
|
Environment = parseEnvironment(Components[3]);
|
||||||
@ -476,7 +478,9 @@ std::string Triple::normalize(StringRef Str) {
|
|||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
OS = parseOS(Comp);
|
OS = parseOS(Comp);
|
||||||
Valid = OS != UnknownOS;
|
IsCygwin = Comp.startswith("cygwin");
|
||||||
|
IsMinGW32 = Comp.startswith("mingw");
|
||||||
|
Valid = OS != UnknownOS || IsCygwin || IsMinGW32;
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
Environment = parseEnvironment(Comp);
|
Environment = parseEnvironment(Comp);
|
||||||
@ -556,16 +560,16 @@ std::string Triple::normalize(StringRef Str) {
|
|||||||
else
|
else
|
||||||
Components[3] = getObjectFormatTypeName(ObjectFormat);
|
Components[3] = getObjectFormatTypeName(ObjectFormat);
|
||||||
}
|
}
|
||||||
} else if (OS == Triple::MinGW32) {
|
} else if (IsMinGW32) {
|
||||||
Components.resize(4);
|
Components.resize(4);
|
||||||
Components[2] = "windows";
|
Components[2] = "windows";
|
||||||
Components[3] = "gnu";
|
Components[3] = "gnu";
|
||||||
} else if (OS == Triple::Cygwin) {
|
} else if (IsCygwin) {
|
||||||
Components.resize(4);
|
Components.resize(4);
|
||||||
Components[2] = "windows";
|
Components[2] = "windows";
|
||||||
Components[3] = "cygnus";
|
Components[3] = "cygnus";
|
||||||
}
|
}
|
||||||
if (OS == Triple::MinGW32 || OS == Triple::Cygwin ||
|
if (IsMinGW32 || IsCygwin ||
|
||||||
(OS == Triple::Win32 && Environment != UnknownEnvironment)) {
|
(OS == Triple::Win32 && Environment != UnknownEnvironment)) {
|
||||||
if (ObjectFormat != UnknownObjectFormat && ObjectFormat != Triple::COFF) {
|
if (ObjectFormat != UnknownObjectFormat && ObjectFormat != Triple::COFF) {
|
||||||
Components.resize(5);
|
Components.resize(5);
|
||||||
|
@ -190,7 +190,7 @@ TEST(TripleTest, Normalization) {
|
|||||||
++Vendor) {
|
++Vendor) {
|
||||||
C[1] = Triple::getVendorTypeName(Triple::VendorType(Vendor));
|
C[1] = Triple::getVendorTypeName(Triple::VendorType(Vendor));
|
||||||
for (int OS = 1+Triple::UnknownOS; OS <= Triple::Minix; ++OS) {
|
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;
|
continue;
|
||||||
|
|
||||||
C[2] = Triple::getOSTypeName(Triple::OSType(OS));
|
C[2] = Triple::getOSTypeName(Triple::OSType(OS));
|
||||||
|
@ -139,8 +139,6 @@ protected:
|
|||||||
|
|
||||||
// The operating systems below are known to be sufficiently incompatible
|
// The operating systems below are known to be sufficiently incompatible
|
||||||
// that they will fail the MCJIT C API tests.
|
// that they will fail the MCJIT C API tests.
|
||||||
UnsupportedOSs.push_back(Triple::Cygwin);
|
|
||||||
|
|
||||||
UnsupportedEnvironments.push_back(Triple::Cygnus);
|
UnsupportedEnvironments.push_back(Triple::Cygnus);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -302,7 +302,6 @@ protected:
|
|||||||
// The operating systems below are known to be incompatible with MCJIT as
|
// The operating systems below are known to be incompatible with MCJIT as
|
||||||
// they are copied from the test/ExecutionEngine/MCJIT/lit.local.cfg and
|
// they are copied from the test/ExecutionEngine/MCJIT/lit.local.cfg and
|
||||||
// should be kept in sync.
|
// should be kept in sync.
|
||||||
UnsupportedOSs.push_back(Triple::Cygwin);
|
|
||||||
UnsupportedOSs.push_back(Triple::Darwin);
|
UnsupportedOSs.push_back(Triple::Darwin);
|
||||||
|
|
||||||
UnsupportedEnvironments.push_back(Triple::Cygnus);
|
UnsupportedEnvironments.push_back(Triple::Cygnus);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user