From fdbe7c7faa547b16bf6da0fedbb7234b6ee3adef Mon Sep 17 00:00:00 2001 From: Jonas Devlieghere Date: Mon, 1 May 2023 20:34:51 -0700 Subject: [lldb] Refactor OptionValue to return a std::optional (NFC) Refactor OptionValue to return a std::optional instead of taking a fail value. This allows the caller to handle situations where there's no value, instead of being unable to distinguish between the absence of a value and the value happening the match the fail value. When a fail value is required, std::optional::value_or() provides the same functionality. --- lldb/source/Commands/CommandObjectRegister.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lldb/source/Commands/CommandObjectRegister.cpp') diff --git a/lldb/source/Commands/CommandObjectRegister.cpp b/lldb/source/Commands/CommandObjectRegister.cpp index a6ea642..80813cd 100644 --- a/lldb/source/Commands/CommandObjectRegister.cpp +++ b/lldb/source/Commands/CommandObjectRegister.cpp @@ -171,8 +171,8 @@ protected: const size_t set_array_size = m_command_options.set_indexes.GetSize(); if (set_array_size > 0) { for (size_t i = 0; i < set_array_size; ++i) { - set_idx = m_command_options.set_indexes[i]->GetUInt64Value(UINT32_MAX, - nullptr); + set_idx = m_command_options.set_indexes[i]->GetUInt64Value().value_or( + UINT32_MAX); if (set_idx < reg_ctx->GetRegisterSetCount()) { if (!DumpRegisterSet(m_exe_ctx, strm, reg_ctx, set_idx)) { if (errno) -- cgit v1.1