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/CommandObjectExpression.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/CommandObjectExpression.cpp')
-rw-r--r-- | lldb/source/Commands/CommandObjectExpression.cpp | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/lldb/source/Commands/CommandObjectExpression.cpp b/lldb/source/Commands/CommandObjectExpression.cpp index 2834be6..3a2dc11 100644 --- a/lldb/source/Commands/CommandObjectExpression.cpp +++ b/lldb/source/Commands/CommandObjectExpression.cpp @@ -594,7 +594,7 @@ GetExprOptions(ExecutionContext &ctx, return expr_options; } -bool CommandObjectExpression::DoExecute(llvm::StringRef command, +void CommandObjectExpression::DoExecute(llvm::StringRef command, CommandReturnObject &result) { m_fixed_expression.clear(); auto exe_ctx = GetCommandInterpreter().GetExecutionContext(); @@ -602,7 +602,7 @@ bool CommandObjectExpression::DoExecute(llvm::StringRef command, if (command.empty()) { GetMultilineExpression(); - return result.Succeeded(); + return; } OptionsWithRaw args(command); @@ -610,7 +610,7 @@ bool CommandObjectExpression::DoExecute(llvm::StringRef command, if (args.HasArgs()) { if (!ParseOptionsAndNotify(args.GetArgs(), result, m_option_group, exe_ctx)) - return false; + return; if (m_repl_option.GetOptionValue().GetCurrentValue()) { Target &target = GetSelectedOrDummyTarget(); @@ -642,7 +642,7 @@ bool CommandObjectExpression::DoExecute(llvm::StringRef command, nullptr, true); if (!repl_error.Success()) { result.SetError(repl_error); - return result.Succeeded(); + return; } } @@ -662,14 +662,14 @@ bool CommandObjectExpression::DoExecute(llvm::StringRef command, "Couldn't create a REPL for %s", Language::GetNameForLanguageType(m_command_options.language)); result.SetError(repl_error); - return result.Succeeded(); + return; } } } // No expression following options else if (expr.empty()) { GetMultilineExpression(); - return result.Succeeded(); + return; } } @@ -691,8 +691,7 @@ bool CommandObjectExpression::DoExecute(llvm::StringRef command, fixed_command.append(m_fixed_expression); history.AppendString(fixed_command); } - return true; + return; } result.SetStatus(eReturnStatusFailed); - return false; } |