[Lldb-commits] [lldb] [lldb] Use std::optional::value_or (NFC) (PR #151629)

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


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-lldb

Author: Kazu Hirata (kazutakahirata)

<details>
<summary>Changes</summary>



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


1 Files Affected:

- (modified) lldb/source/Interpreter/OptionArgParser.cpp (+1-1) 


``````````diff
diff --git a/lldb/source/Interpreter/OptionArgParser.cpp b/lldb/source/Interpreter/OptionArgParser.cpp
index 616f6e3dc8820..170f65ad80a74 100644
--- a/lldb/source/Interpreter/OptionArgParser.cpp
+++ b/lldb/source/Interpreter/OptionArgParser.cpp
@@ -161,7 +161,7 @@ lldb::addr_t OptionArgParser::ToRawAddress(const ExecutionContext *exe_ctx,
                                            lldb::addr_t fail_value,
                                            Status *error_ptr) {
   std::optional<lldb::addr_t> maybe_addr = DoToAddress(exe_ctx, s, error_ptr);
-  return maybe_addr ? *maybe_addr : fail_value;
+  return maybe_addr.value_or(fail_value);
 }
 
 lldb::addr_t OptionArgParser::ToAddress(const ExecutionContext *exe_ctx,

``````````

</details>


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


More information about the lldb-commits mailing list