diff options
author | Todd Fiala <todd.fiala@gmail.com> | 2016-08-11 23:51:28 +0000 |
---|---|---|
committer | Todd Fiala <todd.fiala@gmail.com> | 2016-08-11 23:51:28 +0000 |
commit | e1cfbc79420fee0b71bad62f8d413b68a0eca91e (patch) | |
tree | ab91f6f91be4051731e37ed69ca9ff8c7bdad1ff /lldb/source/Commands/CommandObjectSettings.cpp | |
parent | 1602421c852d9d7fddbe8c5f014d7861a7848865 (diff) | |
download | llvm-e1cfbc79420fee0b71bad62f8d413b68a0eca91e.zip llvm-e1cfbc79420fee0b71bad62f8d413b68a0eca91e.tar.gz llvm-e1cfbc79420fee0b71bad62f8d413b68a0eca91e.tar.bz2 |
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
Diffstat (limited to 'lldb/source/Commands/CommandObjectSettings.cpp')
-rw-r--r-- | lldb/source/Commands/CommandObjectSettings.cpp | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/lldb/source/Commands/CommandObjectSettings.cpp b/lldb/source/Commands/CommandObjectSettings.cpp index b76af20..3fcca55 100644 --- a/lldb/source/Commands/CommandObjectSettings.cpp +++ b/lldb/source/Commands/CommandObjectSettings.cpp @@ -32,7 +32,7 @@ class CommandObjectSettingsSet : public CommandObjectRaw public: CommandObjectSettingsSet(CommandInterpreter &interpreter) : CommandObjectRaw(interpreter, "settings set", "Set the value of the specified debugger setting.", nullptr), - m_options(interpreter) + m_options() { CommandArgumentEntry arg1; CommandArgumentEntry arg2; @@ -95,16 +95,17 @@ insert-before or insert-after." class CommandOptions : public Options { public: - CommandOptions (CommandInterpreter &interpreter) : - Options (interpreter), - m_global (false) + CommandOptions() : + Options(), + m_global(false) { } ~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; @@ -123,7 +124,7 @@ insert-before or insert-after." } void - OptionParsingStarting () override + OptionParsingStarting(ExecutionContext *execution_context) override { m_global = false; } @@ -168,7 +169,7 @@ insert-before or insert-after." if (cursor_index == setting_var_idx) { // Attempting to complete setting variable name - CommandCompletions::InvokeCommonCompletionCallbacks(m_interpreter, + CommandCompletions::InvokeCommonCompletionCallbacks(GetCommandInterpreter(), CommandCompletions::eSettingsNameCompletion, completion_str.c_str(), match_start_point, @@ -328,7 +329,7 @@ public: { std::string completion_str (input.GetArgumentAtIndex (cursor_index), cursor_char_position); - CommandCompletions::InvokeCommonCompletionCallbacks(m_interpreter, + CommandCompletions::InvokeCommonCompletionCallbacks(GetCommandInterpreter(), CommandCompletions::eSettingsNameCompletion, completion_str.c_str(), match_start_point, @@ -418,7 +419,7 @@ public: { std::string completion_str (input.GetArgumentAtIndex (cursor_index), cursor_char_position); - CommandCompletions::InvokeCommonCompletionCallbacks(m_interpreter, + CommandCompletions::InvokeCommonCompletionCallbacks(GetCommandInterpreter(), CommandCompletions::eSettingsNameCompletion, completion_str.c_str(), match_start_point, @@ -524,7 +525,7 @@ public: // Attempting to complete variable name if (cursor_index < 2) - CommandCompletions::InvokeCommonCompletionCallbacks(m_interpreter, + CommandCompletions::InvokeCommonCompletionCallbacks(GetCommandInterpreter(), CommandCompletions::eSettingsNameCompletion, completion_str.c_str(), match_start_point, @@ -532,7 +533,6 @@ public: nullptr, word_complete, matches); - return matches.GetSize(); } @@ -655,7 +655,7 @@ public: // Attempting to complete variable name if (cursor_index < 2) - CommandCompletions::InvokeCommonCompletionCallbacks(m_interpreter, + CommandCompletions::InvokeCommonCompletionCallbacks(GetCommandInterpreter(), CommandCompletions::eSettingsNameCompletion, completion_str.c_str(), match_start_point, @@ -774,7 +774,7 @@ public: // Attempting to complete variable name if (cursor_index < 2) - CommandCompletions::InvokeCommonCompletionCallbacks(m_interpreter, + CommandCompletions::InvokeCommonCompletionCallbacks(GetCommandInterpreter(), CommandCompletions::eSettingsNameCompletion, completion_str.c_str(), match_start_point, @@ -896,7 +896,7 @@ public: // Attempting to complete variable name if (cursor_index < 2) - CommandCompletions::InvokeCommonCompletionCallbacks(m_interpreter, + CommandCompletions::InvokeCommonCompletionCallbacks(GetCommandInterpreter(), CommandCompletions::eSettingsNameCompletion, completion_str.c_str(), match_start_point, @@ -1007,7 +1007,7 @@ public: // Attempting to complete variable name if (cursor_index < 2) - CommandCompletions::InvokeCommonCompletionCallbacks(m_interpreter, + CommandCompletions::InvokeCommonCompletionCallbacks(GetCommandInterpreter(), CommandCompletions::eSettingsNameCompletion, completion_str.c_str(), match_start_point, @@ -1106,7 +1106,7 @@ public: // Attempting to complete variable name if (cursor_index < 2) - CommandCompletions::InvokeCommonCompletionCallbacks(m_interpreter, + CommandCompletions::InvokeCommonCompletionCallbacks(GetCommandInterpreter(), CommandCompletions::eSettingsNameCompletion, completion_str.c_str(), match_start_point, |