Skip to content

[lldb] Part 2 of 2 - Refactor CommandObject::DoExecute(...) return void (not bool) #69991

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lldb/include/lldb/Interpreter/CommandObject.h
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ class CommandObjectParsed : public CommandObject {
void Execute(const char *args_string, CommandReturnObject &result) override;

protected:
virtual bool DoExecute(Args &command, CommandReturnObject &result) = 0;
virtual void DoExecute(Args &command, CommandReturnObject &result) = 0;

bool WantsRawCommandString() override { return false; }
};
Expand All @@ -418,7 +418,7 @@ class CommandObjectRaw : public CommandObject {
void Execute(const char *args_string, CommandReturnObject &result) override;

protected:
virtual bool DoExecute(llvm::StringRef command,
virtual void DoExecute(llvm::StringRef command,
CommandReturnObject &result) = 0;

bool WantsRawCommandString() override { return true; }
Expand Down
6 changes: 2 additions & 4 deletions lldb/source/API/SBCommandInterpreter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,11 @@ class CommandPluginInterfaceImplementation : public CommandObjectParsed {
}

protected:
bool DoExecute(Args &command, CommandReturnObject &result) override {
void DoExecute(Args &command, CommandReturnObject &result) override {
SBCommandReturnObject sb_return(result);
SBCommandInterpreter sb_interpreter(&m_interpreter);
SBDebugger debugger_sb(m_interpreter.GetDebugger().shared_from_this());
bool ret = m_backend->DoExecute(debugger_sb, command.GetArgumentVector(),
sb_return);
return ret;
m_backend->DoExecute(debugger_sb, command.GetArgumentVector(), sb_return);
}
std::shared_ptr<lldb::SBCommandPluginInterface> m_backend;
std::optional<std::string> m_auto_repeat_command;
Expand Down
4 changes: 1 addition & 3 deletions lldb/source/Commands/CommandObjectApropos.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ CommandObjectApropos::CommandObjectApropos(CommandInterpreter &interpreter)

CommandObjectApropos::~CommandObjectApropos() = default;

bool CommandObjectApropos::DoExecute(Args &args, CommandReturnObject &result) {
void CommandObjectApropos::DoExecute(Args &args, CommandReturnObject &result) {
const size_t argc = args.GetArgumentCount();

if (argc == 1) {
Expand Down Expand Up @@ -90,6 +90,4 @@ bool CommandObjectApropos::DoExecute(Args &args, CommandReturnObject &result) {
} else {
result.AppendError("'apropos' must be called with exactly one argument.\n");
}

return result.Succeeded();
}
2 changes: 1 addition & 1 deletion lldb/source/Commands/CommandObjectApropos.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class CommandObjectApropos : public CommandObjectParsed {
~CommandObjectApropos() override;

protected:
bool DoExecute(Args &command, CommandReturnObject &result) override;
void DoExecute(Args &command, CommandReturnObject &result) override;
};

} // namespace lldb_private
Expand Down
Loading