[PATCH] D145206: [NFC] Properly handle optional minor value for ArchInfo::Version

Zixu Wang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 2 16:45:29 PST 2023


zixuw created this revision.
Herald added a subscriber: ributzka.
Herald added a project: All.
zixuw requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Use `value_or` instead of `value` for checking minor versions in
`ArchInfo::implies`.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D145206

Files:
  llvm/include/llvm/TargetParser/AArch64TargetParser.h


Index: llvm/include/llvm/TargetParser/AArch64TargetParser.h
===================================================================
--- llvm/include/llvm/TargetParser/AArch64TargetParser.h
+++ llvm/include/llvm/TargetParser/AArch64TargetParser.h
@@ -288,8 +288,8 @@
       return this->Version > Other.Version;
     }
     if (this->Version.getMajor() == 9 && Other.Version.getMajor() == 8) {
-      return this->Version.getMinor().value() + 5 >=
-             Other.Version.getMinor().value();
+      return this->Version.getMinor().value_or(0) + 5 >=
+             Other.Version.getMinor().value_or(0);
     }
     return false;
   }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D145206.502025.patch
Type: text/x-patch
Size: 632 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230303/1d153f9e/attachment.bin>


More information about the llvm-commits mailing list