diff options
author | Raphael Isemann <teemperor@gmail.com> | 2018-07-12 22:28:52 +0000 |
---|---|---|
committer | Raphael Isemann <teemperor@gmail.com> | 2018-07-12 22:28:52 +0000 |
commit | 4d51a90297d34389b53c00c5cd6fa6f73998c298 (patch) | |
tree | fb8d42ce62a2a5e7bff1c397626c774ce51e3fee /lldb/source/Interpreter/CommandObjectScript.cpp | |
parent | 3a1347721454c50c0f06cdf99388b8d38a49c408 (diff) | |
download | bcm5719-llvm-4d51a90297d34389b53c00c5cd6fa6f73998c298.tar.gz bcm5719-llvm-4d51a90297d34389b53c00c5cd6fa6f73998c298.zip |
Get rid of the C-string parameter in DoExecute
Summary:
This patch gets rid of the C-string parameter in the RawCommandObject::DoExecute function,
making the code simpler and less memory unsafe.
There seems to be a assumption in some command objects that this parameter could be a nullptr,
but from what I can see the rest of the API doesn't actually allow this (and other command
objects and related code pieces dereference this parameter without any checks).
Especially CommandObjectRegexCommand has error handling code for a nullptr that is now gone.
Reviewers: davide, jingham, teemperor
Reviewed By: teemperor
Subscribers: jingham, lldb-commits
Differential Revision: https://reviews.llvm.org/D49207
llvm-svn: 336955
Diffstat (limited to 'lldb/source/Interpreter/CommandObjectScript.cpp')
-rw-r--r-- | lldb/source/Interpreter/CommandObjectScript.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lldb/source/Interpreter/CommandObjectScript.cpp b/lldb/source/Interpreter/CommandObjectScript.cpp index dfb1ba5037f..fa1516df60c 100644 --- a/lldb/source/Interpreter/CommandObjectScript.cpp +++ b/lldb/source/Interpreter/CommandObjectScript.cpp @@ -40,7 +40,7 @@ CommandObjectScript::CommandObjectScript(CommandInterpreter &interpreter, CommandObjectScript::~CommandObjectScript() {} -bool CommandObjectScript::DoExecute(const char *command, +bool CommandObjectScript::DoExecute(llvm::StringRef command, CommandReturnObject &result) { #ifdef LLDB_DISABLE_PYTHON // if we ever support languages other than Python this simple #ifdef won't @@ -69,7 +69,7 @@ bool CommandObjectScript::DoExecute(const char *command, // for formatting.. make sure we keep up to // date with it - if (command == nullptr || command[0] == '\0') { + if (command.empty()) { script_interpreter->ExecuteInterpreterLoop(); result.SetStatus(eReturnStatusSuccessFinishNoResult); return result.Succeeded(); |