summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Support
diff options
context:
space:
mode:
authorChad Rosier <mcrosier@apple.com>2012-05-09 17:23:48 +0000
committerChad Rosier <mcrosier@apple.com>2012-05-09 17:23:48 +0000
commitd84eaac673f0b7f45995233d58f58cb73d368ce0 (patch)
tree82d0fc8910b8e997fd836543a59ce054fd5d7e96 /llvm/lib/Support
parentd60f4c8fefbad141a736d89254785aae3f8a1349 (diff)
downloadbcm5719-llvm-d84eaac673f0b7f45995233d58f58cb73d368ce0.tar.gz
bcm5719-llvm-d84eaac673f0b7f45995233d58f58cb73d368ce0.zip
Add Triple::getiOSVersion.
This new function provides a way to get the iOS version number from ios triples. Part of rdar://11409204 llvm-svn: 156483
Diffstat (limited to 'llvm/lib/Support')
-rw-r--r--llvm/lib/Support/Triple.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/llvm/lib/Support/Triple.cpp b/llvm/lib/Support/Triple.cpp
index 4ee4716b37f..2a22f754806 100644
--- a/llvm/lib/Support/Triple.cpp
+++ b/llvm/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);
}
OpenPOWER on IntegriCloud