[PATCH] D114885: Use VersionTuple for parsing versions in Triple, fixing issues that caused the original change to be reverted. This makes it possible to distinguish between "16" and "16.0" after parsing, which previously was not possible.

James Farrell via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Dec 1 09:02:36 PST 2021


jamesfarrell added inline comments.


================
Comment at: llvm/lib/MC/MCStreamer.cpp:1343
                             LinkedTargetVersion.getMajor(),
-                            *LinkedTargetVersion.getMinor(),
-                            *LinkedTargetVersion.getSubminor(), SDKVersion);
+                            LinkedTargetVersion.getMinor().getValueOr(0),
+                            LinkedTargetVersion.getSubminor().getValueOr(0),
----------------
This was broken in the original change, because we were blindly dereferencing an Optional without checking whether it had a value.


================
Comment at: llvm/unittests/Support/Host.cpp:411
 
 #if defined(__APPLE__)
 TEST_F(HostTest, getMacOSHostVersion) {
----------------
This was broken in the original change. Because it's wrapped in "#if defined(__APPLE__)", I'm not sure how to test it prior to commit.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D114885/new/

https://reviews.llvm.org/D114885



More information about the cfe-commits mailing list