diff options
author | David Spickett <david.spickett@linaro.org> | 2021-06-17 12:32:23 +0100 |
---|---|---|
committer | David Spickett <david.spickett@linaro.org> | 2021-06-17 14:39:35 +0100 |
commit | eaf60a4411f79a1addfa6c5d8ddf4b47e082881e (patch) | |
tree | 8ea76ea64b562f4386e0ce802a430a1292f5da89 /lldb/source/Commands/CommandObjectCommands.cpp | |
parent | 3f596842e3d25009c4d62c75e5b24b515bde8e93 (diff) | |
download | llvm-eaf60a4411f79a1addfa6c5d8ddf4b47e082881e.zip llvm-eaf60a4411f79a1addfa6c5d8ddf4b47e082881e.tar.gz llvm-eaf60a4411f79a1addfa6c5d8ddf4b47e082881e.tar.bz2 |
[lldb] Remove redundant calls to set eReturnStatusFailed
This is part 2, covering the commands source.
Some uses remain where it's tricky to see what the
logic is or they are not used with AppendError.
Reviewed By: teemperor
Differential Revision: https://reviews.llvm.org/D104448
Diffstat (limited to 'lldb/source/Commands/CommandObjectCommands.cpp')
-rw-r--r-- | lldb/source/Commands/CommandObjectCommands.cpp | 37 |
1 files changed, 0 insertions, 37 deletions
diff --git a/lldb/source/Commands/CommandObjectCommands.cpp b/lldb/source/Commands/CommandObjectCommands.cpp index 94e670a..c6b0f7f 100644 --- a/lldb/source/Commands/CommandObjectCommands.cpp +++ b/lldb/source/Commands/CommandObjectCommands.cpp @@ -128,7 +128,6 @@ protected: result.AppendErrorWithFormat( "'%s' takes exactly one executable filename argument.\n", GetCommandName().str().c_str()); - result.SetStatus(eReturnStatusFailed); return false; } @@ -380,7 +379,6 @@ protected: if (args.GetArgumentCount() < 2) { result.AppendError("'command alias' requires at least two arguments"); - result.SetStatus(eReturnStatusFailed); return false; } @@ -393,7 +391,6 @@ protected: result.AppendWarning("if trying to pass options to 'command alias' add " "a -- at the end of the options"); } - result.SetStatus(eReturnStatusFailed); return false; } @@ -407,7 +404,6 @@ protected: raw_command_string = raw_command_string.substr(pos); } else { result.AppendError("Error parsing command string. No alias created."); - result.SetStatus(eReturnStatusFailed); return false; } @@ -416,7 +412,6 @@ protected: result.AppendErrorWithFormat( "'%s' is a permanent debugger command and cannot be redefined.\n", args[0].c_str()); - result.SetStatus(eReturnStatusFailed); return false; } @@ -432,7 +427,6 @@ protected: "'%s' does not begin with a valid command." " No alias created.", original_raw_command_string.str().c_str()); - result.SetStatus(eReturnStatusFailed); return false; } else if (!cmd_obj->WantsRawCommandString()) { // Note that args was initialized with the original command, and has not @@ -472,12 +466,10 @@ protected: result.SetStatus(eReturnStatusSuccessFinishNoResult); } else { result.AppendError("Unable to create requested alias.\n"); - result.SetStatus(eReturnStatusFailed); } } else { result.AppendError("Unable to create requested alias.\n"); - result.SetStatus(eReturnStatusFailed); } return result.Succeeded(); @@ -488,7 +480,6 @@ protected: if (argc < 2) { result.AppendError("'command alias' requires at least two arguments"); - result.SetStatus(eReturnStatusFailed); return false; } @@ -506,7 +497,6 @@ protected: result.AppendErrorWithFormat( "'%s' is a permanent debugger command and cannot be redefined.\n", alias_command.c_str()); - result.SetStatus(eReturnStatusFailed); return false; } @@ -517,7 +507,6 @@ protected: if (!command_obj_sp) { result.AppendErrorWithFormat("'%s' is not an existing command.\n", actual_command.c_str()); - result.SetStatus(eReturnStatusFailed); return false; } CommandObject *cmd_obj = command_obj_sp.get(); @@ -534,7 +523,6 @@ protected: "'%s' is not a valid sub-command of '%s'. " "Unable to create alias.\n", args[0].c_str(), actual_command.c_str()); - result.SetStatus(eReturnStatusFailed); return false; } @@ -573,7 +561,6 @@ protected: result.SetStatus(eReturnStatusSuccessFinishNoResult); } else { result.AppendError("Unable to create requested alias.\n"); - result.SetStatus(eReturnStatusFailed); return false; } @@ -626,7 +613,6 @@ protected: if (args.empty()) { result.AppendError("must call 'unalias' with a valid alias"); - result.SetStatus(eReturnStatusFailed); return false; } @@ -637,7 +623,6 @@ protected: "'%s' is not a known command.\nTry 'help' to see a " "current list of commands.\n", args[0].c_str()); - result.SetStatus(eReturnStatusFailed); return false; } @@ -652,7 +637,6 @@ protected: "'%s' is a permanent debugger command and cannot be removed.\n", args[0].c_str()); } - result.SetStatus(eReturnStatusFailed); return false; } @@ -664,7 +648,6 @@ protected: else result.AppendErrorWithFormat("'%s' is not an existing alias.\n", args[0].c_str()); - result.SetStatus(eReturnStatusFailed); return false; } @@ -720,7 +703,6 @@ protected: result.AppendErrorWithFormat("must call '%s' with one or more valid user " "defined regular expression command names", GetCommandName().str().c_str()); - result.SetStatus(eReturnStatusFailed); return false; } @@ -733,7 +715,6 @@ protected: &error_msg_stream, command_name, llvm::StringRef(), llvm::StringRef(), generate_upropos, generate_type_lookup); result.AppendError(error_msg_stream.GetString()); - result.SetStatus(eReturnStatusFailed); return false; } @@ -741,7 +722,6 @@ protected: result.AppendErrorWithFormat( "'%s' is a permanent debugger command and cannot be removed.\n", args[0].c_str()); - result.SetStatus(eReturnStatusFailed); return false; } @@ -846,7 +826,6 @@ protected: if (argc == 0) { result.AppendError("usage: 'command regex <command-name> " "[s/<regex1>/<subst1>/ s/<regex2>/<subst2>/ ...]'\n"); - result.SetStatus(eReturnStatusFailed); return false; } @@ -887,7 +866,6 @@ protected: } if (error.Fail()) { result.AppendError(error.AsCString()); - result.SetStatus(eReturnStatusFailed); } return result.Succeeded(); @@ -1103,7 +1081,6 @@ protected: m_function_name.c_str(), raw_command_line, m_synchro, result, error, m_exe_ctx)) { result.AppendError(error.AsCString()); - result.SetStatus(eReturnStatusFailed); } else { // Don't change the status if the command already set it... if (result.GetStatus() == eReturnStatusInvalid) { @@ -1189,7 +1166,6 @@ protected: !scripter->RunScriptBasedCommand(m_cmd_obj_sp, raw_command_line, m_synchro, result, error, m_exe_ctx)) { result.AppendError(error.AsCString()); - result.SetStatus(eReturnStatusFailed); } else { // Don't change the status if the command already set it... if (result.GetStatus() == eReturnStatusInvalid) { @@ -1286,7 +1262,6 @@ protected: bool DoExecute(Args &command, CommandReturnObject &result) override { if (command.empty()) { result.AppendError("command script import needs one or more arguments"); - result.SetStatus(eReturnStatusFailed); return false; } @@ -1296,7 +1271,6 @@ protected: if (!source_dir) { result.AppendError("command script import -c can only be specified " "from a command file"); - result.SetStatus(eReturnStatusFailed); return false; } } @@ -1320,7 +1294,6 @@ protected: } else { result.AppendErrorWithFormat("module importing failed: %s", error.AsCString()); - result.SetStatus(eReturnStatusFailed); } } @@ -1505,13 +1478,11 @@ protected: if (GetDebugger().GetScriptLanguage() != lldb::eScriptLanguagePython) { result.AppendError("only scripting language supported for scripted " "commands is currently Python"); - result.SetStatus(eReturnStatusFailed); return false; } if (command.GetArgumentCount() != 1) { result.AppendError("'command script add' requires one argument"); - result.SetStatus(eReturnStatusFailed); return false; } @@ -1533,14 +1504,12 @@ protected: result.SetStatus(eReturnStatusSuccessFinishNoResult); } else { result.AppendError("cannot add command"); - result.SetStatus(eReturnStatusFailed); } } } else { ScriptInterpreter *interpreter = GetDebugger().GetScriptInterpreter(); if (!interpreter) { result.AppendError("cannot find ScriptInterpreter"); - result.SetStatus(eReturnStatusFailed); return false; } @@ -1548,7 +1517,6 @@ protected: m_options.m_class_name.c_str()); if (!cmd_obj_sp) { result.AppendError("cannot create helper object"); - result.SetStatus(eReturnStatusFailed); return false; } @@ -1558,7 +1526,6 @@ protected: result.SetStatus(eReturnStatusSuccessFinishNoResult); } else { result.AppendError("cannot add command"); - result.SetStatus(eReturnStatusFailed); } } @@ -1584,7 +1551,6 @@ public: bool DoExecute(Args &command, CommandReturnObject &result) override { if (command.GetArgumentCount() != 0) { result.AppendError("'command script list' doesn't take any arguments"); - result.SetStatus(eReturnStatusFailed); return false; } @@ -1610,7 +1576,6 @@ protected: bool DoExecute(Args &command, CommandReturnObject &result) override { if (command.GetArgumentCount() != 0) { result.AppendError("'command script clear' doesn't take any arguments"); - result.SetStatus(eReturnStatusFailed); return false; } @@ -1661,7 +1626,6 @@ protected: if (command.GetArgumentCount() != 1) { result.AppendError("'command script delete' requires one argument"); - result.SetStatus(eReturnStatusFailed); return false; } @@ -1670,7 +1634,6 @@ protected: if (cmd_name.empty() || !m_interpreter.HasUserCommands() || !m_interpreter.UserCommandExists(cmd_name)) { result.AppendErrorWithFormat("command %s not found", command[0].c_str()); - result.SetStatus(eReturnStatusFailed); return false; } |