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/CommandObjectExpression.cpp | |
parent | 1602421c852d9d7fddbe8c5f014d7861a7848865 (diff) | |
download | bcm5719-llvm-e1cfbc79420fee0b71bad62f8d413b68a0eca91e.tar.gz bcm5719-llvm-e1cfbc79420fee0b71bad62f8d413b68a0eca91e.zip |
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/CommandObjectExpression.cpp')
-rw-r--r-- | lldb/source/Commands/CommandObjectExpression.cpp | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/lldb/source/Commands/CommandObjectExpression.cpp b/lldb/source/Commands/CommandObjectExpression.cpp index f2bd3ed367c..78483ed3f59 100644 --- a/lldb/source/Commands/CommandObjectExpression.cpp +++ b/lldb/source/Commands/CommandObjectExpression.cpp @@ -74,9 +74,9 @@ CommandObjectExpression::CommandOptions::GetNumDefinitions () } Error -CommandObjectExpression::CommandOptions::SetOptionValue (CommandInterpreter &interpreter, - uint32_t option_idx, - const char *option_arg) +CommandObjectExpression::CommandOptions::SetOptionValue (uint32_t option_idx, + const char *option_arg, + ExecutionContext *execution_context) { Error error; @@ -188,13 +188,15 @@ CommandObjectExpression::CommandOptions::SetOptionValue (CommandInterpreter &int } void -CommandObjectExpression::CommandOptions::OptionParsingStarting (CommandInterpreter &interpreter) +CommandObjectExpression::CommandOptions::OptionParsingStarting( + ExecutionContext *execution_context) { - Process *process = interpreter.GetExecutionContext().GetProcessPtr(); - if (process != nullptr) + auto process_sp = + execution_context ? execution_context->GetProcessSP() : ProcessSP(); + if (process_sp) { - ignore_breakpoints = process->GetIgnoreBreakpointsInExpressions(); - unwind_on_error = process->GetUnwindOnErrorInExpressions(); + ignore_breakpoints = process_sp->GetIgnoreBreakpointsInExpressions(); + unwind_on_error = process_sp->GetUnwindOnErrorInExpressions(); } else { @@ -225,7 +227,7 @@ CommandObjectExpression::CommandObjectExpression(CommandInterpreter &interpreter "Evaluate an expression on the current thread. Displays any returned value with LLDB's default formatting.", nullptr, eCommandProcessMustBePaused | eCommandTryTargetAPILock), IOHandlerDelegate(IOHandlerDelegate::Completion::Expression), - m_option_group(interpreter), + m_option_group(), m_format_options(eFormatDefault), m_repl_option(LLDB_OPT_SET_1, false, "repl", 'r', "Drop into REPL", false, true), m_command_options(), @@ -517,7 +519,8 @@ CommandObjectExpression::DoExecute(const char *command, CommandReturnObject &result) { m_fixed_expression.clear(); - m_option_group.NotifyOptionParsingStarting(); + auto exe_ctx = GetCommandInterpreter().GetExecutionContext(); + m_option_group.NotifyOptionParsingStarting(&exe_ctx); const char * expr = nullptr; @@ -555,7 +558,7 @@ CommandObjectExpression::DoExecute(const char *command, if (!ParseOptions (args, result)) return false; - Error error (m_option_group.NotifyOptionParsingFinished()); + Error error (m_option_group.NotifyOptionParsingFinished(&exe_ctx)); if (error.Fail()) { result.AppendError (error.AsCString()); |