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

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


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

None

>From ce46f3df1109b25c660bc70de9f2f52f93e13ba0 Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Thu, 31 Jul 2025 13:36:45 -0700
Subject: [PATCH] [lldb] Use std::optional::value_or (NFC)

---
 lldb/source/Interpreter/OptionArgParser.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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,



More information about the lldb-commits mailing list