Skip to content

Commit

Permalink
Make Triple::getOSVersion make sense for Android.
Browse files Browse the repository at this point in the history
Reviewers: srhines

Reviewed By: srhines

Subscribers: llvm-commits

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

llvm-svn: 231090
  • Loading branch information
DanAlbert committed Mar 3, 2015
1 parent 23f94df commit 675cffc
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions llvm/lib/Support/Triple.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down

0 comments on commit 675cffc

Please sign in to comment.