diff options
author | Chad Rosier <mcrosier@apple.com> | 2012-05-09 17:23:48 +0000 |
---|---|---|
committer | Chad Rosier <mcrosier@apple.com> | 2012-05-09 17:23:48 +0000 |
commit | ecee47eab409f6a6fada7ace3d9bee0a0146ac3f (patch) | |
tree | eecaf69bbb23589be8f5ee4e55f783196439191c /lib/Support | |
parent | 5c87b4958d1a5dabf2400be5b3a86aed4f82db91 (diff) | |
download | external_llvm-ecee47eab409f6a6fada7ace3d9bee0a0146ac3f.zip external_llvm-ecee47eab409f6a6fada7ace3d9bee0a0146ac3f.tar.gz external_llvm-ecee47eab409f6a6fada7ace3d9bee0a0146ac3f.tar.bz2 |
Add Triple::getiOSVersion.
This new function provides a way to get the iOS version number from ios triples.
Part of rdar://11409204
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@156483 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Support')
-rw-r--r-- | lib/Support/Triple.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/lib/Support/Triple.cpp b/lib/Support/Triple.cpp index 4ee4716..2a22f75 100644 --- a/lib/Support/Triple.cpp +++ b/lib/Support/Triple.cpp @@ -596,6 +596,27 @@ bool Triple::getMacOSXVersion(unsigned &Major, unsigned &Minor, return true; } +void Triple::getiOSVersion(unsigned &Major, unsigned &Minor, + unsigned &Micro) const { + switch (getOS()) { + default: llvm_unreachable("unexpected OS for Darwin triple"); + case Darwin: + case MacOSX: + // Ignore the version from the triple. This is only handled because the + // the clang driver combines OS X and IOS support into a common Darwin + // toolchain that wants to know the iOS version number even when targeting + // OS X. + Major = 0; + Minor = 0; + Micro = 0; + return true; + case IOS: + getOSVersion(Major, Minor, Micro); + // Default to 0.0. + break; + } +} + void Triple::setTriple(const Twine &Str) { *this = Triple(Str); } |