aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/Commands/CommandObjectRegexCommand.cpp
diff options
context:
space:
mode:
authorPete Lawrence <plawrence@apple.com>2023-10-30 10:21:00 -1000
committerGitHub <noreply@github.com>2023-10-30 13:21:00 -0700
commit92d8a28cc665d73d9d679b8c014dd04f95d1df18 (patch)
tree19b3a218ad57e05a911da01c0f4f80ca3c0a4bd4 /lldb/source/Commands/CommandObjectRegexCommand.cpp
parent2446439f51cf0d2dfb11c823436a930de7a4b8a2 (diff)
downloadllvm-92d8a28cc665d73d9d679b8c014dd04f95d1df18.zip
llvm-92d8a28cc665d73d9d679b8c014dd04f95d1df18.tar.gz
llvm-92d8a28cc665d73d9d679b8c014dd04f95d1df18.tar.bz2
[lldb] Part 2 of 2 - Refactor `CommandObject::DoExecute(...)` return `void` (not `bool`) (#69991)
[lldb] Part 2 of 2 - Refactor `CommandObject::DoExecute(...)` to return `void` instead of ~~`bool`~~ Justifications: - The code doesn't ultimately apply the `true`/`false` return values. - The methods already pass around a `CommandReturnObject`, typically with a `result` parameter. - Each command return object already contains: - A more precise status - The error code(s) that apply to that status Part 1 refactors the `CommandObject::Execute(...)` method. - See [https://github.com/llvm/llvm-project/pull/69989](https://github.com/llvm/llvm-project/pull/69989) rdar://117378957
Diffstat (limited to 'lldb/source/Commands/CommandObjectRegexCommand.cpp')
-rw-r--r--lldb/source/Commands/CommandObjectRegexCommand.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/lldb/source/Commands/CommandObjectRegexCommand.cpp b/lldb/source/Commands/CommandObjectRegexCommand.cpp
index 6ff1d28..f638d70 100644
--- a/lldb/source/Commands/CommandObjectRegexCommand.cpp
+++ b/lldb/source/Commands/CommandObjectRegexCommand.cpp
@@ -54,7 +54,7 @@ llvm::Expected<std::string> CommandObjectRegexCommand::SubstituteVariables(
return output.str();
}
-bool CommandObjectRegexCommand::DoExecute(llvm::StringRef command,
+void CommandObjectRegexCommand::DoExecute(llvm::StringRef command,
CommandReturnObject &result) {
EntryCollection::const_iterator pos, end = m_entries.end();
for (pos = m_entries.begin(); pos != end; ++pos) {
@@ -64,7 +64,7 @@ bool CommandObjectRegexCommand::DoExecute(llvm::StringRef command,
SubstituteVariables(pos->command, matches);
if (!new_command) {
result.SetError(new_command.takeError());
- return false;
+ return;
}
// Interpret the new command and return this as the result!
@@ -73,8 +73,9 @@ bool CommandObjectRegexCommand::DoExecute(llvm::StringRef command,
// We don't have to pass an override_context here, as the command that
// called us should have set up the context appropriately.
bool force_repeat_command = true;
- return m_interpreter.HandleCommand(new_command->c_str(), eLazyBoolNo,
- result, force_repeat_command);
+ m_interpreter.HandleCommand(new_command->c_str(), eLazyBoolNo, result,
+ force_repeat_command);
+ return;
}
}
result.SetStatus(eReturnStatusFailed);
@@ -85,7 +86,6 @@ bool CommandObjectRegexCommand::DoExecute(llvm::StringRef command,
<< "' failed to match any "
"regular expression in the '"
<< m_cmd_name << "' regex ";
- return false;
}
bool CommandObjectRegexCommand::AddRegexCommand(llvm::StringRef re_cstr,