[PATCH] D93475: Updating macOS Version logic for macOS 11+ and Darwin 20+

Andrew Litteken via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 17 10:52:26 PST 2020


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

Minor releases of macOS 11+ increment the minor field rather than the micro field at the same rate as the Darwin minor field.  Currently the `getMacOSHostVersion` test fails for macOS 11.1.

This adjusts the logic for the found macOS minor version from the Darwin version to be one less than the Darwin minor version unless the Darwin minor version, is zero, in which case the macOS minor version is also zero.  This is a guess based on the past few releases: https://en.wikipedia.org/wiki/Darwin_(operating_system).


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D93475

Files:
  llvm/lib/Support/Triple.cpp


Index: llvm/lib/Support/Triple.cpp
===================================================================
--- llvm/lib/Support/Triple.cpp
+++ llvm/lib/Support/Triple.cpp
@@ -1106,7 +1106,8 @@
       Major = 10;
     } else {
       Micro = 0;
-      Minor = 0;
+      // macOS 11+ minor version trails darwin20+ version by 1, unless 0.
+      Minor = Minor == 0 ? 0 : Minor - 1;
       // darwin20+ corresponds to macOS 11+.
       Major = 11 + Major - 20;
     }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D93475.312558.patch
Type: text/x-patch
Size: 461 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201217/b90514fb/attachment.bin>


More information about the llvm-commits mailing list