From 2b29b432d206ee706538b8dad54806d7649fb378 Mon Sep 17 00:00:00 2001 From: Jonas Devlieghere Date: Fri, 26 Apr 2019 22:43:16 +0000 Subject: [ScriptInterpreter] Move ownership into debugger (NFC) This is part two of the change started in r359330. This patch moves the ownership of the script interpreter from the command interpreter into the debugger. I would've preferred to remove the lazy initialization, however the fact that the scripting language is set after the debugger is created makes that tricky. So for now this does exactly the same thing as when it was under the command interpreter. The result is that this patch is fully NFC. Differential revision: https://reviews.llvm.org/D61211 llvm-svn: 359354 --- lldb/source/Commands/CommandObjectCommands.cpp | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) (limited to 'lldb/source/Commands/CommandObjectCommands.cpp') diff --git a/lldb/source/Commands/CommandObjectCommands.cpp b/lldb/source/Commands/CommandObjectCommands.cpp index dabc5c80..45427753 100644 --- a/lldb/source/Commands/CommandObjectCommands.cpp +++ b/lldb/source/Commands/CommandObjectCommands.cpp @@ -1246,7 +1246,7 @@ public: if (m_fetched_help_long) return CommandObjectRaw::GetHelpLong(); - ScriptInterpreter *scripter = m_interpreter.GetScriptInterpreter(); + ScriptInterpreter *scripter = GetDebugger().GetScriptInterpreter(); if (!scripter) return CommandObjectRaw::GetHelpLong(); @@ -1261,7 +1261,7 @@ public: protected: bool DoExecute(llvm::StringRef raw_command_line, CommandReturnObject &result) override { - ScriptInterpreter *scripter = m_interpreter.GetScriptInterpreter(); + ScriptInterpreter *scripter = GetDebugger().GetScriptInterpreter(); Status error; @@ -1304,7 +1304,7 @@ public: StreamString stream; stream.Printf("For more information run 'help %s'", name.c_str()); SetHelp(stream.GetString()); - if (ScriptInterpreter *scripter = m_interpreter.GetScriptInterpreter()) + if (ScriptInterpreter *scripter = GetDebugger().GetScriptInterpreter()) GetFlags().Set(scripter->GetFlagsForCommandObject(cmd_obj_sp)); } @@ -1319,7 +1319,7 @@ public: llvm::StringRef GetHelp() override { if (m_fetched_help_short) return CommandObjectRaw::GetHelp(); - ScriptInterpreter *scripter = m_interpreter.GetScriptInterpreter(); + ScriptInterpreter *scripter = GetDebugger().GetScriptInterpreter(); if (!scripter) return CommandObjectRaw::GetHelp(); std::string docstring; @@ -1335,7 +1335,7 @@ public: if (m_fetched_help_long) return CommandObjectRaw::GetHelpLong(); - ScriptInterpreter *scripter = m_interpreter.GetScriptInterpreter(); + ScriptInterpreter *scripter = GetDebugger().GetScriptInterpreter(); if (!scripter) return CommandObjectRaw::GetHelpLong(); @@ -1350,7 +1350,7 @@ public: protected: bool DoExecute(llvm::StringRef raw_command_line, CommandReturnObject &result) override { - ScriptInterpreter *scripter = m_interpreter.GetScriptInterpreter(); + ScriptInterpreter *scripter = GetDebugger().GetScriptInterpreter(); Status error; @@ -1489,7 +1489,7 @@ protected: // won't stomp on each other (wrt to execution contents, options, and // more) m_exe_ctx.Clear(); - if (m_interpreter.GetScriptInterpreter()->LoadScriptingModule( + if (GetDebugger().GetScriptInterpreter()->LoadScriptingModule( entry.c_str(), m_options.m_allow_reload, init_session, error)) { result.SetStatus(eReturnStatusSuccessFinishNoResult); } else { @@ -1630,7 +1630,7 @@ protected: std::string &data) override { StreamFileSP error_sp = io_handler.GetErrorStreamFile(); - ScriptInterpreter *interpreter = m_interpreter.GetScriptInterpreter(); + ScriptInterpreter *interpreter = GetDebugger().GetScriptInterpreter(); if (interpreter) { StringList lines; @@ -1715,8 +1715,7 @@ protected: } } } else { - ScriptInterpreter *interpreter = - GetCommandInterpreter().GetScriptInterpreter(); + ScriptInterpreter *interpreter = GetDebugger().GetScriptInterpreter(); if (!interpreter) { result.AppendError("cannot find ScriptInterpreter"); result.SetStatus(eReturnStatusFailed); -- cgit v1.1