<div class="gmail_quote">On Wed, May 9, 2012 at 10:23 AM, Chad Rosier <span dir="ltr"><<a href="mailto:mcrosier@apple.com" target="_blank">mcrosier@apple.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Author: mcrosier<br>
Date: Wed May  9 12:23:48 2012<br>
New Revision: 156483<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=156483&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=156483&view=rev</a><br>
Log:<br>
Add Triple::getiOSVersion.<br>
<br>
This new function provides a way to get the iOS version number from ios triples.<br>
Part of rdar://11409204<br></blockquote><div><br></div><div>Add a new unittest for this?</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Modified:<br>
    llvm/trunk/include/llvm/ADT/Triple.h<br>
    llvm/trunk/lib/Support/Triple.cpp<br>
<br>
Modified: llvm/trunk/include/llvm/ADT/Triple.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/Triple.h?rev=156483&r1=156482&r2=156483&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/Triple.h?rev=156483&r1=156482&r2=156483&view=diff</a><br>

==============================================================================<br>
--- llvm/trunk/include/llvm/ADT/Triple.h (original)<br>
+++ llvm/trunk/include/llvm/ADT/Triple.h Wed May  9 12:23:48 2012<br>
@@ -196,6 +196,11 @@<br>
   bool getMacOSXVersion(unsigned &Major, unsigned &Minor,<br>
                         unsigned &Micro) const;<br>
<br>
+  /// getiOSVersion - Parse the version number as with getOSVersion.  This should<br>
+  /// only be called with IOS triples.<br>
+  void getiOSVersion(unsigned &Major, unsigned &Minor,<br>
+                     unsigned &Micro) const;<br>
+<br>
   /// @}<br>
   /// @name Direct Component Access<br>
   /// @{<br>
<br>
Modified: llvm/trunk/lib/Support/Triple.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Triple.cpp?rev=156483&r1=156482&r2=156483&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Triple.cpp?rev=156483&r1=156482&r2=156483&view=diff</a><br>

==============================================================================<br>
--- llvm/trunk/lib/Support/Triple.cpp (original)<br>
+++ llvm/trunk/lib/Support/Triple.cpp Wed May  9 12:23:48 2012<br>
@@ -596,6 +596,27 @@<br>
   return true;<br>
 }<br>
<br>
+void Triple::getiOSVersion(unsigned &Major, unsigned &Minor,<br>
+                           unsigned &Micro) const {<br>
+  switch (getOS()) {<br>
+  default: llvm_unreachable("unexpected OS for Darwin triple");<br>
+  case Darwin:<br>
+  case MacOSX:<br>
+    // Ignore the version from the triple.  This is only handled because the<br>
+    // the clang driver combines OS X and IOS support into a common Darwin<br>
+    // toolchain that wants to know the iOS version number even when targeting<br>
+    // OS X.<br>
+    Major = 0;<br>
+    Minor = 0;<br>
+    Micro = 0;<br>
+    return true;<br>
+  case IOS:<br>
+    getOSVersion(Major, Minor, Micro);<br>
+    // Default to 0.0.<br>
+    break;<br>
+  }<br>
+}<br>
+<br>
 void Triple::setTriple(const Twine &Str) {<br>
   *this = Triple(Str);<br>
 }<br>
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
</blockquote></div><br>