[llvm] r238798 - [Support] Simplify Triple::getOSVersion

David Majnemer david.majnemer at gmail.com
Mon Jun 1 16:45:25 PDT 2015


Author: majnemer
Date: Mon Jun  1 18:45:25 2015
New Revision: 238798

URL: http://llvm.org/viewvc/llvm-project?rev=238798&view=rev
Log:
[Support] Simplify Triple::getOSVersion

Those who are interested in the Android version can use
getEnvironmentVersion instead of getOSVersion.

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=238798&r1=238797&r2=238798&view=diff
==============================================================================
--- llvm/trunk/lib/Support/Triple.cpp (original)
+++ llvm/trunk/lib/Support/Triple.cpp Mon Jun  1 18:45:25 2015
@@ -815,21 +815,13 @@ void Triple::getEnvironmentVersion(unsig
   StringRef EnvironmentTypeName = getEnvironmentTypeName(getEnvironment());
   if (EnvironmentName.startswith(EnvironmentTypeName))
     EnvironmentName = EnvironmentName.substr(EnvironmentTypeName.size());
+
   parseVersionFromName(EnvironmentName, Major, Minor, Micro);
 }
 
 void Triple::getOSVersion(unsigned &Major, unsigned &Minor,
                           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