aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/Commands/CommandObjectSource.cpp
diff options
context:
space:
mode:
authorTodd Fiala <todd.fiala@gmail.com>2016-08-11 23:51:28 +0000
committerTodd Fiala <todd.fiala@gmail.com>2016-08-11 23:51:28 +0000
commite1cfbc79420fee0b71bad62f8d413b68a0eca91e (patch)
treeab91f6f91be4051731e37ed69ca9ff8c7bdad1ff /lldb/source/Commands/CommandObjectSource.cpp
parent1602421c852d9d7fddbe8c5f014d7861a7848865 (diff)
downloadllvm-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/CommandObjectSource.cpp')
-rw-r--r--lldb/source/Commands/CommandObjectSource.cpp32
1 files changed, 19 insertions, 13 deletions
diff --git a/lldb/source/Commands/CommandObjectSource.cpp b/lldb/source/Commands/CommandObjectSource.cpp
index cef9d09..e87169d 100644
--- a/lldb/source/Commands/CommandObjectSource.cpp
+++ b/lldb/source/Commands/CommandObjectSource.cpp
@@ -45,12 +45,13 @@ class CommandObjectSourceInfo : public CommandObjectParsed
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 = g_option_table[option_idx].short_option;
@@ -84,8 +85,10 @@ class CommandObjectSourceInfo : public CommandObjectParsed
case 'a':
{
- ExecutionContext exe_ctx(m_interpreter.GetExecutionContext());
- address = Args::StringToAddress(&exe_ctx, option_arg, LLDB_INVALID_ADDRESS, &error);
+ address = Args::StringToAddress(execution_context,
+ option_arg,
+ LLDB_INVALID_ADDRESS,
+ &error);
}
break;
case 's':
@@ -100,7 +103,7 @@ class CommandObjectSourceInfo : public CommandObjectParsed
}
void
- OptionParsingStarting () override
+ OptionParsingStarting(ExecutionContext *execution_context) override
{
file_spec.Clear();
file_name.clear();
@@ -137,7 +140,7 @@ public:
"process. Defaults to instruction pointer in current stack "
"frame.",
nullptr, eCommandRequiresTarget),
- m_options(interpreter)
+ m_options()
{
}
@@ -728,15 +731,16 @@ class CommandObjectSourceList : public CommandObjectParsed
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 = g_option_table[option_idx].short_option;
@@ -764,8 +768,10 @@ class CommandObjectSourceList : public CommandObjectParsed
case 'a':
{
- ExecutionContext exe_ctx (m_interpreter.GetExecutionContext());
- address = Args::StringToAddress(&exe_ctx, option_arg, LLDB_INVALID_ADDRESS, &error);
+ address = Args::StringToAddress(execution_context,
+ option_arg,
+ LLDB_INVALID_ADDRESS,
+ &error);
}
break;
case 's':
@@ -787,7 +793,7 @@ class CommandObjectSourceList : public CommandObjectParsed
}
void
- OptionParsingStarting () override
+ OptionParsingStarting(ExecutionContext *execution_context) override
{
file_spec.Clear();
file_name.clear();
@@ -825,7 +831,7 @@ public:
: CommandObjectParsed(interpreter, "source list",
"Display source code for the current target process as specified by options.", nullptr,
eCommandRequiresTarget),
- m_options(interpreter)
+ m_options()
{
}