diff options
| author | Daniel Dunbar <daniel@zuster.org> | 2011-04-19 21:12:05 +0000 |
|---|---|---|
| committer | Daniel Dunbar <daniel@zuster.org> | 2011-04-19 21:12:05 +0000 |
| commit | 163a0966a92bb989b1d91c59be5943a4f2988cf7 (patch) | |
| tree | d399adcdc5ca6b6a14df0e1418d6797c47377762 | |
| parent | 3c0fbce10b20609422c2ee50081cc1dcf39a9c69 (diff) | |
| download | bcm5719-llvm-163a0966a92bb989b1d91c59be5943a4f2988cf7.tar.gz bcm5719-llvm-163a0966a92bb989b1d91c59be5943a4f2988cf7.zip | |
ADT/Triple: Add isOSDarwin() and isOSWindows() helper functions.
llvm-svn: 129815
| -rw-r--r-- | llvm/include/llvm/ADT/Triple.h | 13 | ||||
| -rw-r--r-- | llvm/lib/Support/Triple.cpp | 3 |
2 files changed, 14 insertions, 2 deletions
diff --git a/llvm/include/llvm/ADT/Triple.h b/llvm/include/llvm/ADT/Triple.h index 480c9316bd0..f8e0ec88786 100644 --- a/llvm/include/llvm/ADT/Triple.h +++ b/llvm/include/llvm/ADT/Triple.h @@ -249,6 +249,8 @@ public: return getOSMajorVersion(); } + /// isOSVersionLT - Helper function for doing comparisons against version + /// numbers included in the target triple. bool isOSVersionLT(unsigned Major, unsigned Minor = 0, unsigned Micro = 0) const { unsigned LHS[3]; @@ -270,6 +272,17 @@ public: return getOS() == Triple::Darwin || getOS() == Triple::OSX; } + /// isOSDarwin - Is this a "Darwin" OS (OS X or iOS). + bool isOSDarwin() const { + return isOSX() ||getOS() == Triple::IOS; + } + + /// isOSWindows - Is this a "Windows" OS. + bool isOSWindows() const { + return getOS() == Triple::Win32 || getOS() == Triple::Cygwin || + getOS() == Triple::MinGW32; + } + /// isOSXVersionLT - Comparison function for checking OS X version /// compatibility, which handles supporting skewed version numbering schemes /// used by the "darwin" triples. diff --git a/llvm/lib/Support/Triple.cpp b/llvm/lib/Support/Triple.cpp index 51f6c0787f2..8281b483c95 100644 --- a/llvm/lib/Support/Triple.cpp +++ b/llvm/lib/Support/Triple.cpp @@ -213,8 +213,7 @@ Triple::ArchType Triple::getArchTypeForDarwinArchName(StringRef Str) { // Returns architecture name that is understood by the target assembler. const char *Triple::getArchNameForAssembler() { - if (getOS() != Triple::Darwin && getOS() != Triple::OSX && - getOS() != Triple::IOS && getVendor() != Triple::Apple) + if (!isOSDarwin() && getVendor() != Triple::Apple) return NULL; StringRef Str = getArchName(); |

