]> granicus.if.org Git - llvm/commitdiff
[Triple] Add a "macos" OS type that acts as a synonym for "macosx"
authorAlex Lorenz <arphaman@gmail.com>
Wed, 3 May 2017 10:42:35 +0000 (10:42 +0000)
committerAlex Lorenz <arphaman@gmail.com>
Wed, 3 May 2017 10:42:35 +0000 (10:42 +0000)
The "macosx" OS type is still the canonical type. In the future "macos" will
become the canonical OS type (but we will still support "macosx").

rdar://27043820

Differential Revision: https://reviews.llvm.org/D32748

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@302011 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Support/Triple.cpp
test/CodeGen/X86/version_directive.ll

index f3a654d7d2bdb696d9b333f762a830a7495b3f71..eb8108908ac5fee86d240cd5c36a2b6d69adc336 100644 (file)
@@ -459,7 +459,7 @@ static Triple::OSType parseOS(StringRef OSName) {
     .StartsWith("kfreebsd", Triple::KFreeBSD)
     .StartsWith("linux", Triple::Linux)
     .StartsWith("lv2", Triple::Lv2)
-    .StartsWith("macosx", Triple::MacOSX)
+    .StartsWith("macos", Triple::MacOSX)
     .StartsWith("netbsd", Triple::NetBSD)
     .StartsWith("openbsd", Triple::OpenBSD)
     .StartsWith("solaris", Triple::Solaris)
@@ -984,6 +984,8 @@ void Triple::getOSVersion(unsigned &Major, unsigned &Minor,
   StringRef OSTypeName = getOSTypeName(getOS());
   if (OSName.startswith(OSTypeName))
     OSName = OSName.substr(OSTypeName.size());
+  else if (getOS() == MacOSX)
+    OSName.consume_front("macos");
 
   parseVersionFromName(OSName, Major, Minor, Micro);
 }
index 8e4e6dc70e61bb251d826f6057f66eb3dcc9d644..ac5eda71dbc68cb93849cccee40418615efa880d 100644 (file)
@@ -1,4 +1,5 @@
 ; RUN: llc -mtriple x86_64-apple-darwin15.0.0 -o - /dev/null | FileCheck %s
 ; RUN: llc -mtriple x86_64-apple-macosx10.11.0 -o - /dev/null | FileCheck %s
+; RUN: llc -mtriple x86_64-apple-macos10.11.0 -o - /dev/null | FileCheck %s
 
 ; CHECK: .macosx_version_min 10, 11