diff options
author | Pete Lawrence <plawrence@apple.com> | 2023-10-30 10:21:00 -1000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-30 13:21:00 -0700 |
commit | 92d8a28cc665d73d9d679b8c014dd04f95d1df18 (patch) | |
tree | 19b3a218ad57e05a911da01c0f4f80ca3c0a4bd4 /lldb/source/Commands/CommandObjectRegister.cpp | |
parent | 2446439f51cf0d2dfb11c823436a930de7a4b8a2 (diff) | |
download | llvm-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/CommandObjectRegister.cpp')
-rw-r--r-- | lldb/source/Commands/CommandObjectRegister.cpp | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/lldb/source/Commands/CommandObjectRegister.cpp b/lldb/source/Commands/CommandObjectRegister.cpp index 6e6071f..a4d53e5 100644 --- a/lldb/source/Commands/CommandObjectRegister.cpp +++ b/lldb/source/Commands/CommandObjectRegister.cpp @@ -161,7 +161,7 @@ public: } protected: - bool DoExecute(Args &command, CommandReturnObject &result) override { + void DoExecute(Args &command, CommandReturnObject &result) override { Stream &strm = result.GetOutputStream(); RegisterContext *reg_ctx = m_exe_ctx.GetRegisterContext(); @@ -234,7 +234,6 @@ protected: } } } - return result.Succeeded(); } class CommandOptions : public OptionGroup { @@ -348,7 +347,7 @@ public: } protected: - bool DoExecute(Args &command, CommandReturnObject &result) override { + void DoExecute(Args &command, CommandReturnObject &result) override { DataExtractor reg_data; RegisterContext *reg_ctx = m_exe_ctx.GetRegisterContext(); @@ -378,7 +377,7 @@ protected: // has been written. m_exe_ctx.GetThreadRef().Flush(); result.SetStatus(eReturnStatusSuccessFinishNoResult); - return true; + return; } } if (error.AsCString()) { @@ -396,7 +395,6 @@ protected: reg_name.str().c_str()); } } - return result.Succeeded(); } }; @@ -447,10 +445,10 @@ different for the same register when connected to different debug servers.)"); } protected: - bool DoExecute(Args &command, CommandReturnObject &result) override { + void DoExecute(Args &command, CommandReturnObject &result) override { if (command.GetArgumentCount() != 1) { result.AppendError("register info takes exactly 1 argument: <reg-name>"); - return result.Succeeded(); + return; } llvm::StringRef reg_name = command[0].ref(); @@ -464,8 +462,6 @@ protected: } else result.AppendErrorWithFormat("No register found with name '%s'.\n", reg_name.str().c_str()); - - return result.Succeeded(); } }; |