[llvm] r231090 - Make Triple::getOSVersion make sense for Android.

Dan Albert danalbert at google.com
Tue Mar 3 10:23:51 PST 2015


Author: danalbert
Date: Tue Mar  3 12:23:51 2015
New Revision: 231090

URL: http://llvm.org/viewvc/llvm-project?rev=231090&view=rev
Log:
Make Triple::getOSVersion make sense for Android.

Reviewers: srhines

Reviewed By: srhines

Subscribers: llvm-commits

Differential Revision: http://reviews.llvm.org/D7928

Modified:
    llvm/trunk/lib/Support/Triple.cpp

Modified: llvm/trunk/lib/Support/Triple.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Triple.cpp?rev=231090&r1=231089&r2=231090&view=diff
==============================================================================
--- llvm/trunk/lib/Support/Triple.cpp (original)
+++ llvm/trunk/lib/Support/Triple.cpp Tue Mar  3 12:23:51 2015
@@ -714,6 +714,14 @@ void Triple::getOSVersion(unsigned &Majo
                           unsigned &Micro) const {
   StringRef OSName = getOSName();
 
+  // For Android, we care about the Android version rather than the Linux
+  // version.
+  if (getEnvironment() == Android) {
+    OSName = getEnvironmentName().substr(strlen("android"));
+    if (OSName.startswith("eabi"))
+      OSName = OSName.substr(strlen("eabi"));
+  }
+
   // Assume that the OS portion of the triple starts with the canonical name.
   StringRef OSTypeName = getOSTypeName(getOS());
   if (OSName.startswith(OSTypeName))





More information about the llvm-commits mailing list