[PATCH] D107970: [LLVM][Support] Add macOS 12 to Triple.cpp

Alf via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 12 08:56:50 PDT 2021


gAlfonso-bit created this revision.
gAlfonso-bit added reviewers: MaskRay, LLVM.
Herald added subscribers: dexonsmith, hiraditya.
gAlfonso-bit requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Since macOS 12 Monterey is around the corner, it might be good to prepare.

Also, since we are here, remove llvm-unreachable that is already taken care of by the default statements as well as comment typos.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D107970

Files:
  llvm/lib/Support/Triple.cpp


Index: llvm/lib/Support/Triple.cpp
===================================================================
--- llvm/lib/Support/Triple.cpp
+++ llvm/lib/Support/Triple.cpp
@@ -1140,9 +1140,9 @@
   case TvOS:
   case WatchOS:
     // Ignore the version from the triple.  This is only handled because the
-    // the clang driver combines OS X and IOS support into a common Darwin
+    // the clang driver combines OS X and iOS support into a common Darwin
     // toolchain that wants to know the OS X version number even when targeting
-    // IOS.
+    // iOS.
     Major = 10;
     Minor = 4;
     Micro = 0;
@@ -1158,7 +1158,7 @@
   case Darwin:
   case MacOSX:
     // Ignore the version from the triple.  This is only handled because the
-    // the clang driver combines OS X and IOS support into a common Darwin
+    // the clang driver combines OS X and iOS support into a common Darwin
     // toolchain that wants to know the iOS version number even when targeting
     // OS X.
     Major = 5;
@@ -1634,7 +1634,7 @@
              getObjectFormat() == Other.getObjectFormat();
   }
 
-  // If vendor is apple, ignore the version number.
+  // If vendor is Apple, ignore the version number.
   if (getVendor() == Triple::Apple)
     return getArch() == Other.getArch() && getSubArch() == Other.getSubArch() &&
            getVendor() == Other.getVendor() && getOS() == Other.getOS();
@@ -1643,7 +1643,7 @@
 }
 
 std::string Triple::merge(const Triple &Other) const {
-  // If vendor is apple, pick the triple with the larger version number.
+  // If vendor is Apple, pick the triple with the larger version number.
   if (getVendor() == Triple::Apple)
     if (Other.isOSVersionLT(*this))
       return str();
@@ -1680,7 +1680,7 @@
     // ARM64 simulators are supported for iOS 14+.
     if (isMacCatalystEnvironment() || isSimulatorEnvironment())
       return VersionTuple(14, 0, 0);
-    // ARM64e slice is supported starting from iOS 14.
+    // ARM64e slice is supported starting from iOS 14+.
     if (isArm64e())
       return VersionTuple(14, 0, 0);
     break;
@@ -1763,8 +1763,6 @@
       return "arm7tdmi";
     }
   }
-
-  llvm_unreachable("invalid arch name");
 }
 
 VersionTuple Triple::getCanonicalVersionForOS(OSType OSKind,
@@ -1774,6 +1772,11 @@
     // macOS 10.16 is canonicalized to macOS 11.
     if (Version == VersionTuple(10, 16))
       return VersionTuple(11, 0);
+    // macOS 10.17 is canonicalized to macOS 12.
+    // TODO: Find a better way to do this going forward rather than hardcoding a
+    // new if statement every year
+    if (Version == VersionTuple(10, 17))
+      return VersionTuple(12, 0);
     LLVM_FALLTHROUGH;
   default:
     return Version;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D107970.366010.patch
Type: text/x-patch
Size: 2697 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210812/3115d459/attachment.bin>


More information about the llvm-commits mailing list