aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
diff options
context:
space:
mode:
authorJonas Devlieghere <jonas@devlieghere.com>2023-05-01 20:34:51 -0700
committerJonas Devlieghere <jonas@devlieghere.com>2023-05-01 21:08:23 -0700
commitfdbe7c7faa547b16bf6da0fedbb7234b6ee3adef (patch)
treede943ecab10dba4e794771be711ba6d2633f2fd6 /lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
parent65365cff3b4ca62d20a6e4588375a48b4f386b69 (diff)
downloadllvm-fdbe7c7faa547b16bf6da0fedbb7234b6ee3adef.zip
llvm-fdbe7c7faa547b16bf6da0fedbb7234b6ee3adef.tar.gz
llvm-fdbe7c7faa547b16bf6da0fedbb7234b6ee3adef.tar.bz2
[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.
Diffstat (limited to 'lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp')
-rw-r--r--lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp b/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
index 9b29d1b..faebe5d 100644
--- a/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
+++ b/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
@@ -887,7 +887,7 @@ public:
"the --command option must be set to a valid command byte");
} else {
const uint64_t command_byte =
- m_command_byte.GetOptionValue().GetUInt64Value(0);
+ m_command_byte.GetOptionValue().GetUInt64Value().value_or(0);
if (command_byte > 0 && command_byte <= UINT8_MAX) {
ProcessKDP *process =
(ProcessKDP *)m_interpreter.GetExecutionContext().GetProcessPtr();