From: Dan Albert Date: Tue, 3 Mar 2015 18:23:51 +0000 (+0000) Subject: Make Triple::getOSVersion make sense for Android. X-Git-Tag: llvmorg-3.7.0-rc1~10339 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=675cffcb91353b00bcc23f15e879925f6a0e1db3;p=platform%2Fupstream%2Fllvm.git Make Triple::getOSVersion make sense for Android. Reviewers: srhines Reviewed By: srhines Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D7928 llvm-svn: 231090 --- diff --git a/llvm/lib/Support/Triple.cpp b/llvm/lib/Support/Triple.cpp index e74b23c..33472e5 100644 --- a/llvm/lib/Support/Triple.cpp +++ b/llvm/lib/Support/Triple.cpp @@ -714,6 +714,14 @@ 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))