From e1cfbc79420fee0b71bad62f8d413b68a0eca91e Mon Sep 17 00:00:00 2001 From: Todd Fiala Date: Thu, 11 Aug 2016 23:51:28 +0000 Subject: Decoupled Options from CommandInterpreter. Options used to store a reference to the CommandInterpreter instance in the base Options class. This made it impossible to parse options independent of a CommandInterpreter. This change removes the reference from the base class. Instead, it modifies the options-parsing-related methods to take an ExecutionContext pointer, which the options may inspect if they need to do so. Closes https://reviews.llvm.org/D23416 Reviewers: clayborg, jingham llvm-svn: 278440 --- .../RenderScriptRuntime/RenderScriptRuntime.cpp | 27 ++++++++++++---------- 1 file changed, 15 insertions(+), 12 deletions(-) (limited to 'lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp') diff --git a/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp b/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp index ad1fe3d91c4..52991691261 100644 --- a/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp +++ b/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp @@ -3659,7 +3659,7 @@ public: "Sets a breakpoint on a renderscript kernel.", "renderscript kernel breakpoint set [-c x,y,z]", eCommandRequiresProcess | eCommandProcessMustBeLaunched | eCommandProcessMustBePaused), - m_options(interpreter) + m_options() { } @@ -3674,12 +3674,13 @@ public: class CommandOptions : public Options { public: - CommandOptions(CommandInterpreter &interpreter) : Options(interpreter) {} + CommandOptions() : Options() {} ~CommandOptions() override = default; Error - SetOptionValue(uint32_t option_idx, const char *option_arg) override + SetOptionValue(uint32_t option_idx, const char *option_arg, + ExecutionContext *execution_context) override { Error error; const int short_option = m_getopt_table[option_idx].val; @@ -3726,7 +3727,7 @@ public: } void - OptionParsingStarting() override + OptionParsingStarting(ExecutionContext *execution_context) override { // -1 means the -c option hasn't been set m_coord[0] = -1; @@ -3950,7 +3951,7 @@ public: : CommandObjectParsed(interpreter, "renderscript allocation dump", "Displays the contents of a particular allocation", "renderscript allocation dump ", eCommandRequiresProcess | eCommandProcessMustBeLaunched), - m_options(interpreter) + m_options() { } @@ -3965,12 +3966,13 @@ public: class CommandOptions : public Options { public: - CommandOptions(CommandInterpreter &interpreter) : Options(interpreter) {} + CommandOptions() : Options() {} ~CommandOptions() override = default; Error - SetOptionValue(uint32_t option_idx, const char *option_arg) override + SetOptionValue(uint32_t option_idx, const char *option_arg, + ExecutionContext *execution_context) override { Error error; const int short_option = m_getopt_table[option_idx].val; @@ -3993,7 +3995,7 @@ public: } void - OptionParsingStarting() override + OptionParsingStarting(ExecutionContext *execution_context) override { m_outfile.Clear(); } @@ -4084,7 +4086,7 @@ public: : CommandObjectParsed(interpreter, "renderscript allocation list", "List renderscript allocations and their information.", "renderscript allocation list", eCommandRequiresProcess | eCommandProcessMustBeLaunched), - m_options(interpreter) + m_options() { } @@ -4099,12 +4101,13 @@ public: class CommandOptions : public Options { public: - CommandOptions(CommandInterpreter &interpreter) : Options(interpreter), m_id(0) {} + CommandOptions() : Options(), m_id(0) {} ~CommandOptions() override = default; Error - SetOptionValue(uint32_t option_idx, const char *option_arg) override + SetOptionValue(uint32_t option_idx, const char *option_arg, + ExecutionContext *execution_context) override { Error error; const int short_option = m_getopt_table[option_idx].val; @@ -4125,7 +4128,7 @@ public: } void - OptionParsingStarting() override + OptionParsingStarting(ExecutionContext *execution_context) override { m_id = 0; } -- cgit v1.2.3