diff options
author | Evandro Menezes <e.menezes@samsung.com> | 2019-02-04 23:34:38 +0000 |
---|---|---|
committer | Evandro Menezes <e.menezes@samsung.com> | 2019-02-04 23:34:38 +0000 |
commit | d016763774199214287ea4b778ab9d077e087dfc (patch) | |
tree | d11ea0b6e185daa8bb7f68b6c2ff2c9a2e864e4c | |
parent | f7393d2a3e5ce8766b9eab43d0b68de43f953a5b (diff) | |
download | bcm5719-llvm-d016763774199214287ea4b778ab9d077e087dfc.tar.gz bcm5719-llvm-d016763774199214287ea4b778ab9d077e087dfc.zip |
[ADT] Refactor the Windows query functions (NFC)
Increase reuse in the query functions for Windows.
llvm-svn: 353117
-rw-r--r-- | llvm/include/llvm/ADT/Triple.h | 29 |
1 files changed, 14 insertions, 15 deletions
diff --git a/llvm/include/llvm/ADT/Triple.h b/llvm/include/llvm/ADT/Triple.h index 55389eda732..70d8879bf05 100644 --- a/llvm/include/llvm/ADT/Triple.h +++ b/llvm/include/llvm/ADT/Triple.h @@ -523,32 +523,36 @@ public: return getOS() == Triple::Haiku; } - /// Checks if the environment could be MSVC. - bool isWindowsMSVCEnvironment() const { - return getOS() == Triple::Win32 && - (getEnvironment() == Triple::UnknownEnvironment || - getEnvironment() == Triple::MSVC); + /// Tests whether the OS is Windows. + bool isOSWindows() const { + return getOS() == Triple::Win32; } /// Checks if the environment is MSVC. bool isKnownWindowsMSVCEnvironment() const { - return getOS() == Triple::Win32 && getEnvironment() == Triple::MSVC; + return isOSWindows() && getEnvironment() == Triple::MSVC; + } + + /// Checks if the environment could be MSVC. + bool isWindowsMSVCEnvironment() const { + return isKnownWindowsMSVCEnvironment() || + (isOSWindows() && getEnvironment() == Triple::UnknownEnvironment); } bool isWindowsCoreCLREnvironment() const { - return getOS() == Triple::Win32 && getEnvironment() == Triple::CoreCLR; + return isOSWindows() && getEnvironment() == Triple::CoreCLR; } bool isWindowsItaniumEnvironment() const { - return getOS() == Triple::Win32 && getEnvironment() == Triple::Itanium; + return isOSWindows() && getEnvironment() == Triple::Itanium; } bool isWindowsCygwinEnvironment() const { - return getOS() == Triple::Win32 && getEnvironment() == Triple::Cygnus; + return isOSWindows() && getEnvironment() == Triple::Cygnus; } bool isWindowsGNUEnvironment() const { - return getOS() == Triple::Win32 && getEnvironment() == Triple::GNU; + return isOSWindows() && getEnvironment() == Triple::GNU; } /// Tests for either Cygwin or MinGW OS @@ -562,11 +566,6 @@ public: isWindowsItaniumEnvironment(); } - /// Tests whether the OS is Windows. - bool isOSWindows() const { - return getOS() == Triple::Win32; - } - /// Tests whether the OS is NaCl (Native Client) bool isOSNaCl() const { return getOS() == Triple::NaCl; |