[llvm-commits] [llvm] r156483 - in /llvm/trunk: include/llvm/ADT/Triple.h lib/Support/Triple.cpp
Chandler Carruth
chandlerc at google.com
Wed May 9 10:51:29 PDT 2012
On Wed, May 9, 2012 at 10:23 AM, Chad Rosier <mcrosier at apple.com> wrote:
> Author: mcrosier
> Date: Wed May 9 12:23:48 2012
> New Revision: 156483
>
> URL: http://llvm.org/viewvc/llvm-project?rev=156483&view=rev
> Log:
> Add Triple::getiOSVersion.
>
> This new function provides a way to get the iOS version number from ios
> triples.
> Part of rdar://11409204
>
Add a new unittest for this?
>
> 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=156483&r1=156482&r2=156483&view=diff
>
> ==============================================================================
> --- llvm/trunk/include/llvm/ADT/Triple.h (original)
> +++ llvm/trunk/include/llvm/ADT/Triple.h Wed May 9 12:23:48 2012
> @@ -196,6 +196,11 @@
> bool getMacOSXVersion(unsigned &Major, unsigned &Minor,
> unsigned &Micro) const;
>
> + /// getiOSVersion - Parse the version number as with getOSVersion.
> This should
> + /// only be called with IOS triples.
> + void getiOSVersion(unsigned &Major, unsigned &Minor,
> + unsigned &Micro) const;
> +
> /// @}
> /// @name Direct Component Access
> /// @{
>
> Modified: llvm/trunk/lib/Support/Triple.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Triple.cpp?rev=156483&r1=156482&r2=156483&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/Support/Triple.cpp (original)
> +++ llvm/trunk/lib/Support/Triple.cpp Wed May 9 12:23:48 2012
> @@ -596,6 +596,27 @@
> 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);
> }
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20120509/245d27d4/attachment.html>
More information about the llvm-commits
mailing list