Author: Jonas Devlieghere Date: 2020-01-14T22:28:49-08:00 New Revision: a6faf851f49c7d50e92b16ff9d2e7c02790dd0f8
URL: https://github.com/llvm/llvm-project/commit/a6faf851f49c7d50e92b16ff9d2e7c02790dd0f8 DIFF: https://github.com/llvm/llvm-project/commit/a6faf851f49c7d50e92b16ff9d2e7c02790dd0f8.diff LOG: [lldb/CommandInterpreter] Remove flag that's always true (NFC) The 'asynchronously' argument to both GetLLDBCommandsFromIOHandler and GetPythonCommandsFromIOHandler is true for all call sites. This commit simplifies the API by dropping it and giving the baton a default argument. Added: Modified: lldb/include/lldb/Interpreter/CommandInterpreter.h lldb/source/Commands/CommandObjectBreakpointCommand.cpp lldb/source/Commands/CommandObjectCommands.cpp lldb/source/Commands/CommandObjectTarget.cpp lldb/source/Commands/CommandObjectType.cpp lldb/source/Commands/CommandObjectWatchpointCommand.cpp lldb/source/Interpreter/CommandInterpreter.cpp lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp Removed: ################################################################################ diff --git a/lldb/include/lldb/Interpreter/CommandInterpreter.h b/lldb/include/lldb/Interpreter/CommandInterpreter.h index 13bde7284ee5..d08951e608cb 100644 --- a/lldb/include/lldb/Interpreter/CommandInterpreter.h +++ b/lldb/include/lldb/Interpreter/CommandInterpreter.h @@ -428,13 +428,14 @@ class CommandInterpreter : public Broadcaster, void RunCommandInterpreter(bool auto_handle_events, bool spawn_thread, CommandInterpreterRunOptions &options); + void GetLLDBCommandsFromIOHandler(const char *prompt, IOHandlerDelegate &delegate, - bool asynchronously, void *baton); + void *baton = nullptr); void GetPythonCommandsFromIOHandler(const char *prompt, IOHandlerDelegate &delegate, - bool asynchronously, void *baton); + void *baton = nullptr); const char *GetCommandPrefix(); diff --git a/lldb/source/Commands/CommandObjectBreakpointCommand.cpp b/lldb/source/Commands/CommandObjectBreakpointCommand.cpp index 551d0ac0081a..bbd2ca570126 100644 --- a/lldb/source/Commands/CommandObjectBreakpointCommand.cpp +++ b/lldb/source/Commands/CommandObjectBreakpointCommand.cpp @@ -256,7 +256,6 @@ are no syntax errors may indicate that a function was declared but never called. m_interpreter.GetLLDBCommandsFromIOHandler( "> ", // Prompt *this, // IOHandlerDelegate - true, // Run IOHandler in async mode &bp_options_vec); // Baton for the "io_handler" that will be passed back // into our IOHandlerDelegate functions } diff --git a/lldb/source/Commands/CommandObjectCommands.cpp b/lldb/source/Commands/CommandObjectCommands.cpp index 1796b6bbcf29..388db6fad631 100644 --- a/lldb/source/Commands/CommandObjectCommands.cpp +++ b/lldb/source/Commands/CommandObjectCommands.cpp @@ -1650,11 +1650,8 @@ class CommandObjectCommandsScriptAdd : public CommandObjectParsed, if (m_options.m_class_name.empty()) { if (m_options.m_funct_name.empty()) { m_interpreter.GetPythonCommandsFromIOHandler( - " ", // Prompt - *this, // IOHandlerDelegate - true, // Run IOHandler in async mode - nullptr); // Baton for the "io_handler" that will be passed back - // into our IOHandlerDelegate functions + " ", // Prompt + *this); // IOHandlerDelegate } else { CommandObjectSP new_cmd(new CommandObjectPythonFunction( m_interpreter, m_cmd_name, m_options.m_funct_name, diff --git a/lldb/source/Commands/CommandObjectTarget.cpp b/lldb/source/Commands/CommandObjectTarget.cpp index 8a5f75ab4d4c..8738e850c9f7 100644 --- a/lldb/source/Commands/CommandObjectTarget.cpp +++ b/lldb/source/Commands/CommandObjectTarget.cpp @@ -4686,12 +4686,8 @@ class CommandObjectTargetStopHookAdd : public CommandObjectParsed, new_hook_sp->GetID()); } else { m_stop_hook_sp = new_hook_sp; - m_interpreter.GetLLDBCommandsFromIOHandler( - "> ", // Prompt - *this, // IOHandlerDelegate - true, // Run IOHandler in async mode - nullptr); // Baton for the "io_handler" that will be passed back - // into our IOHandlerDelegate functions + m_interpreter.GetLLDBCommandsFromIOHandler("> ", // Prompt + *this); // IOHandlerDelegate } result.SetStatus(eReturnStatusSuccessFinishNoResult); diff --git a/lldb/source/Commands/CommandObjectType.cpp b/lldb/source/Commands/CommandObjectType.cpp index d24f9110fe22..87c107cfb943 100644 --- a/lldb/source/Commands/CommandObjectType.cpp +++ b/lldb/source/Commands/CommandObjectType.cpp @@ -1332,7 +1332,6 @@ bool CommandObjectTypeSummaryAdd::Execute_ScriptSummary( m_interpreter.GetPythonCommandsFromIOHandler( " ", // Prompt *this, // IOHandlerDelegate - true, // Run IOHandler in async mode options); // Baton for the "io_handler" that will be passed back into // our IOHandlerDelegate functions result.SetStatus(eReturnStatusSuccessFinishNoResult); @@ -2232,7 +2231,6 @@ bool CommandObjectTypeSynthAdd::Execute_HandwritePython( m_interpreter.GetPythonCommandsFromIOHandler( " ", // Prompt *this, // IOHandlerDelegate - true, // Run IOHandler in async mode options); // Baton for the "io_handler" that will be passed back into our // IOHandlerDelegate functions result.SetStatus(eReturnStatusSuccessFinishNoResult); diff --git a/lldb/source/Commands/CommandObjectWatchpointCommand.cpp b/lldb/source/Commands/CommandObjectWatchpointCommand.cpp index 4cc74e77ed4d..1b83e885d27e 100644 --- a/lldb/source/Commands/CommandObjectWatchpointCommand.cpp +++ b/lldb/source/Commands/CommandObjectWatchpointCommand.cpp @@ -243,7 +243,6 @@ are no syntax errors may indicate that a function was declared but never called. m_interpreter.GetLLDBCommandsFromIOHandler( "> ", // Prompt *this, // IOHandlerDelegate - true, // Run IOHandler in async mode wp_options); // Baton for the "io_handler" that will be passed back into // our IOHandlerDelegate functions } diff --git a/lldb/source/Interpreter/CommandInterpreter.cpp b/lldb/source/Interpreter/CommandInterpreter.cpp index 7c2739f9dd40..1ee80503f569 100644 --- a/lldb/source/Interpreter/CommandInterpreter.cpp +++ b/lldb/source/Interpreter/CommandInterpreter.cpp @@ -2839,8 +2839,7 @@ bool CommandInterpreter::IOHandlerInterrupt(IOHandler &io_handler) { } void CommandInterpreter::GetLLDBCommandsFromIOHandler( - const char *prompt, IOHandlerDelegate &delegate, bool asynchronously, - void *baton) { + const char *prompt, IOHandlerDelegate &delegate, void *baton) { Debugger &debugger = GetDebugger(); IOHandlerSP io_handler_sp( new IOHandlerEditline(debugger, IOHandler::Type::CommandList, @@ -2855,16 +2854,12 @@ void CommandInterpreter::GetLLDBCommandsFromIOHandler( if (io_handler_sp) { io_handler_sp->SetUserData(baton); - if (asynchronously) - debugger.PushIOHandler(io_handler_sp); - else - debugger.RunIOHandler(io_handler_sp); + debugger.PushIOHandler(io_handler_sp); } } void CommandInterpreter::GetPythonCommandsFromIOHandler( - const char *prompt, IOHandlerDelegate &delegate, bool asynchronously, - void *baton) { + const char *prompt, IOHandlerDelegate &delegate, void *baton) { Debugger &debugger = GetDebugger(); IOHandlerSP io_handler_sp( new IOHandlerEditline(debugger, IOHandler::Type::PythonCode, @@ -2879,10 +2874,7 @@ void CommandInterpreter::GetPythonCommandsFromIOHandler( if (io_handler_sp) { io_handler_sp->SetUserData(baton); - if (asynchronously) - debugger.PushIOHandler(io_handler_sp); - else - debugger.RunIOHandler(io_handler_sp); + debugger.PushIOHandler(io_handler_sp); } } diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp index 1bb3cde7ab24..06e0d5bfa63f 100644 --- a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp +++ b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp @@ -1248,14 +1248,14 @@ void ScriptInterpreterPythonImpl::CollectDataForBreakpointCommandCallback( CommandReturnObject &result) { m_active_io_handler = eIOHandlerBreakpoint; m_debugger.GetCommandInterpreter().GetPythonCommandsFromIOHandler( - " ", *this, true, &bp_options_vec); + " ", *this, &bp_options_vec); } void ScriptInterpreterPythonImpl::CollectDataForWatchpointCommandCallback( WatchpointOptions *wp_options, CommandReturnObject &result) { m_active_io_handler = eIOHandlerWatchpoint; m_debugger.GetCommandInterpreter().GetPythonCommandsFromIOHandler( - " ", *this, true, wp_options); + " ", *this, wp_options); } Status ScriptInterpreterPythonImpl::SetBreakpointCommandCallbackFunction( _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits