[llvm] [BOLT] Use std::optional::value_or (NFC) (PR #151628)

via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 31 19:49:07 PDT 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-bolt

Author: Kazu Hirata (kazutakahirata)

<details>
<summary>Changes</summary>



---
Full diff: https://github.com/llvm/llvm-project/pull/151628.diff


1 Files Affected:

- (modified) bolt/lib/Core/Exceptions.cpp (+1-1) 


``````````diff
diff --git a/bolt/lib/Core/Exceptions.cpp b/bolt/lib/Core/Exceptions.cpp
index 0b2e63b8ca6a7..874419f592cc9 100644
--- a/bolt/lib/Core/Exceptions.cpp
+++ b/bolt/lib/Core/Exceptions.cpp
@@ -500,7 +500,7 @@ bool CFIReaderWriter::fillCFIInfoFor(BinaryFunction &Function) const {
 
   const FDE &CurFDE = *I->second;
   std::optional<uint64_t> LSDA = CurFDE.getLSDAAddress();
-  Function.setLSDAAddress(LSDA ? *LSDA : 0);
+  Function.setLSDAAddress(LSDA.value_or(0));
 
   uint64_t Offset = Function.getFirstInstructionOffset();
   uint64_t CodeAlignment = CurFDE.getLinkedCIE()->getCodeAlignmentFactor();

``````````

</details>


https://github.com/llvm/llvm-project/pull/151628


More information about the llvm-commits mailing list