diff options
author | Pete Lawrence <plawrence@apple.com> | 2023-10-25 12:55:27 -1000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-25 15:55:27 -0700 |
commit | 463a02bc2260d01ac9e8457792bb455e48097ce5 (patch) | |
tree | 4f34bc7474b64a8360f000913bd60cd404708b3d /lldb/source/Interpreter/CommandObject.cpp | |
parent | c9ca2fe739b6924575c222d0a6e02e528d606f88 (diff) | |
download | llvm-463a02bc2260d01ac9e8457792bb455e48097ce5.zip llvm-463a02bc2260d01ac9e8457792bb455e48097ce5.tar.gz llvm-463a02bc2260d01ac9e8457792bb455e48097ce5.tar.bz2 |
[lldb] Part 1 of 2 - Refactor `CommandObject::Execute(...)` return `void` (not `bool`) (#69989)
[lldb] Part 1 of 2 - Refactor `CommandObject::Execute(...)` 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 2 refactors the `CommandObject::DoExecute(...)` method.
- See
[https://github.com/llvm/llvm-project/pull/69991](https://github.com/llvm/llvm-project/pull/69991)
rdar://117378957
Diffstat (limited to 'lldb/source/Interpreter/CommandObject.cpp')
-rw-r--r-- | lldb/source/Interpreter/CommandObject.cpp | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/lldb/source/Interpreter/CommandObject.cpp b/lldb/source/Interpreter/CommandObject.cpp index 313d24f..1ff9774 100644 --- a/lldb/source/Interpreter/CommandObject.cpp +++ b/lldb/source/Interpreter/CommandObject.cpp @@ -715,7 +715,7 @@ Thread *CommandObject::GetDefaultThread() { return nullptr; } -bool CommandObjectParsed::Execute(const char *args_string, +void CommandObjectParsed::Execute(const char *args_string, CommandReturnObject &result) { bool handled = false; Args cmd_args(args_string); @@ -746,18 +746,17 @@ bool CommandObjectParsed::Execute(const char *args_string, result.AppendErrorWithFormatv("'{0}' doesn't take any arguments.", GetCommandName()); Cleanup(); - return false; + return; } - handled = DoExecute(cmd_args, result); + DoExecute(cmd_args, result); } } Cleanup(); } - return handled; } -bool CommandObjectRaw::Execute(const char *args_string, +void CommandObjectRaw::Execute(const char *args_string, CommandReturnObject &result) { bool handled = false; if (HasOverrideCallback()) { @@ -770,9 +769,8 @@ bool CommandObjectRaw::Execute(const char *args_string, } if (!handled) { if (CheckRequirements(result)) - handled = DoExecute(args_string, result); + DoExecute(args_string, result); Cleanup(); } - return handled; } |