+
+ /// isMacOSXVersionLT - Comparison function for checking OS X version
+ /// compatibility, which handles supporting skewed version numbering schemes
+ /// used by the "darwin" triples.
+ unsigned isMacOSXVersionLT(unsigned Major, unsigned Minor = 0,
+ unsigned Micro = 0) const {
+ assert(isMacOSX() && "Not an OS X triple!");
+
+ // If this is OS X, expect a sane version number.
+ if (getOS() == Triple::MacOSX)
+ return isOSVersionLT(Major, Minor, Micro);
+
+ // Otherwise, compare to the "Darwin" number.
+ assert(Major == 10 && "Unexpected major version");
+ return isOSVersionLT(Minor + 4, Micro, 0);
+ }
+
+ /// isMacOSX - Is this a Mac OS X triple. For legacy reasons, we support both
+ /// "darwin" and "osx" as OS X triples.
+ bool isMacOSX() const {
+ return getOS() == Triple::Darwin || getOS() == Triple::MacOSX;
+ }
+
+ /// Is this an iOS triple.
+ bool isiOS() const {
+ return getOS() == Triple::IOS;
+ }
+
+ /// isOSDarwin - Is this a "Darwin" OS (OS X or iOS).
+ bool isOSDarwin() const {
+ return isMacOSX() || isiOS();
+ }
+
+ bool isOSNetBSD() const {
+ return getOS() == Triple::NetBSD;
+ }
+
+ bool isOSOpenBSD() const {
+ return getOS() == Triple::OpenBSD;
+ }
+
+ bool isOSFreeBSD() const {
+ return getOS() == Triple::FreeBSD;
+ }
+
+ bool isOSDragonFly() const { return getOS() == Triple::DragonFly; }
+
+ bool isOSSolaris() const {
+ return getOS() == Triple::Solaris;
+ }
+
+ bool isOSBitrig() const {
+ return getOS() == Triple::Bitrig;
+ }
+
+ bool isWindowsMSVCEnvironment() const {
+ return getOS() == Triple::Win32 &&
+ (getEnvironment() == Triple::UnknownEnvironment ||
+ getEnvironment() == Triple::MSVC);
+ }
+
+ bool isKnownWindowsMSVCEnvironment() const {
+ return getOS() == Triple::Win32 && getEnvironment() == Triple::MSVC;
+ }
+
+ bool isWindowsItaniumEnvironment() const {
+ return getOS() == Triple::Win32 && getEnvironment() == Triple::Itanium;
+ }
+
+ bool isWindowsCygwinEnvironment() const {
+ return getOS() == Triple::Win32 && getEnvironment() == Triple::Cygnus;
+ }
+
+ bool isWindowsGNUEnvironment() const {
+ return getOS() == Triple::Win32 && getEnvironment() == Triple::GNU;
+ }
+
+ /// \brief Tests for either Cygwin or MinGW OS
+ bool isOSCygMing() const {
+ return isWindowsCygwinEnvironment() || isWindowsGNUEnvironment();
+ }
+
+ /// \brief Is this a "Windows" OS targeting a "MSVCRT.dll" environment.
+ bool isOSMSVCRT() const {
+ return isWindowsMSVCEnvironment() || isWindowsGNUEnvironment() ||
+ isWindowsItaniumEnvironment();
+ }
+
+ /// \brief Tests whether the OS is Windows.
+ bool isOSWindows() const {
+ return getOS() == Triple::Win32;
+ }
+
+ /// \brief Tests whether the OS is NaCl (Native Client)
+ bool isOSNaCl() const {
+ return getOS() == Triple::NaCl;
+ }
+
+ /// \brief Tests whether the OS is Linux.
+ bool isOSLinux() const {
+ return getOS() == Triple::Linux;
+ }
+
+ /// \brief Tests whether the OS uses the ELF binary format.
+ bool isOSBinFormatELF() const {
+ return getObjectFormat() == Triple::ELF;
+ }
+
+ /// \brief Tests whether the OS uses the COFF binary format.
+ bool isOSBinFormatCOFF() const {
+ return getObjectFormat() == Triple::COFF;
+ }
+
+ /// \brief Tests whether the environment is MachO.
+ bool isOSBinFormatMachO() const {
+ return getObjectFormat() == Triple::MachO;
+ }
+
+ /// \brief Tests whether the target is the PS4 CPU
+ bool isPS4CPU() const {
+ return getArch() == Triple::x86_64 &&
+ getVendor() == Triple::SCEI &&
+ getOS() == Triple::PS4;
+ }
+
+ /// \brief Tests whether the target is the PS4 platform
+ bool isPS4() const {
+ return getVendor() == Triple::SCEI &&
+ getOS() == Triple::PS4;
+ }
+