aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/llvm/ADT/Triple.h13
-rw-r--r--lib/Support/Triple.cpp3
2 files changed, 14 insertions, 2 deletions
diff --git a/include/llvm/ADT/Triple.h b/include/llvm/ADT/Triple.h
index 480c9316bd..f8e0ec8878 100644
--- a/include/llvm/ADT/Triple.h
+++ b/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/lib/Support/Triple.cpp b/lib/Support/Triple.cpp
index 51f6c0787f..8281b483c9 100644
--- a/lib/Support/Triple.cpp
+++ b/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();