[llvm-commits] [llvm] r129815 - in /llvm/trunk: include/llvm/ADT/Triple.h lib/Support/Triple.cpp
Daniel Dunbar
daniel at zuster.org
Tue Apr 19 14:12:05 PDT 2011
Author: ddunbar
Date: Tue Apr 19 16:12:05 2011
New Revision: 129815
URL: http://llvm.org/viewvc/llvm-project?rev=129815&view=rev
Log:
ADT/Triple: Add isOSDarwin() and isOSWindows() helper functions.
Modified:
llvm/trunk/include/llvm/ADT/Triple.h
llvm/trunk/lib/Support/Triple.cpp
Modified: llvm/trunk/include/llvm/ADT/Triple.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/Triple.h?rev=129815&r1=129814&r2=129815&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ADT/Triple.h (original)
+++ llvm/trunk/include/llvm/ADT/Triple.h Tue Apr 19 16:12:05 2011
@@ -249,6 +249,8 @@
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 @@
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.
Modified: llvm/trunk/lib/Support/Triple.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Triple.cpp?rev=129815&r1=129814&r2=129815&view=diff
==============================================================================
--- llvm/trunk/lib/Support/Triple.cpp (original)
+++ llvm/trunk/lib/Support/Triple.cpp Tue Apr 19 16:12:05 2011
@@ -213,8 +213,7 @@
// 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();
More information about the llvm-commits
mailing list