aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/Interpreter/CommandInterpreter.cpp
diff options
context:
space:
mode:
authorEnrico Granata <egranata@apple.com>2016-03-14 22:17:04 +0000
committerEnrico Granata <egranata@apple.com>2016-03-14 22:17:04 +0000
commitbef55ac8f54fc62369af35483ab69f8d0676050d (patch)
treed24412b18a03908157a952f88e036903cb5db705 /lldb/source/Interpreter/CommandInterpreter.cpp
parent2414c5d46be6de849cdba1b048f3e7096cb578f1 (diff)
downloadllvm-bef55ac8f54fc62369af35483ab69f8d0676050d.zip
llvm-bef55ac8f54fc62369af35483ab69f8d0676050d.tar.gz
llvm-bef55ac8f54fc62369af35483ab69f8d0676050d.tar.bz2
Lots of progress on the CommandAlias refactoring
This cleans things up such CommandAlias essentially can work as its own object; the aliases still live in a separate map, but are now just full-fledged CommandObjectSPs This patch also cleans up help generation for aliases, allows aliases to vend their own help, and adds a tweak such that "dash-dash aliases", such as po, don't show the list of options for their underlying command, since those can't be provided anyway I plan to fix up a few more things here, and then add a test case and proclaim victory llvm-svn: 263499
Diffstat (limited to 'lldb/source/Interpreter/CommandInterpreter.cpp')
-rw-r--r--lldb/source/Interpreter/CommandInterpreter.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/lldb/source/Interpreter/CommandInterpreter.cpp b/lldb/source/Interpreter/CommandInterpreter.cpp
index ffe5a57..5127d19 100644
--- a/lldb/source/Interpreter/CommandInterpreter.cpp
+++ b/lldb/source/Interpreter/CommandInterpreter.cpp
@@ -772,7 +772,7 @@ CommandInterpreter::GetCommandSP (const char *cmd_cstr, bool include_aliases, bo
{
CommandAliasMap::iterator alias_pos = m_alias_dict.find(cmd);
if (alias_pos != m_alias_dict.end())
- command_sp = ((CommandAlias*)alias_pos->second.get())->GetUnderlyingCommand();
+ command_sp = alias_pos->second;
}
if (HasUserCommands())
@@ -823,7 +823,7 @@ CommandInterpreter::GetCommandSP (const char *cmd_cstr, bool include_aliases, bo
cmd.assign(matches->GetStringAtIndex (num_cmd_matches));
CommandAliasMap::iterator alias_pos = m_alias_dict.find(cmd);
if (alias_pos != m_alias_dict.end())
- alias_match_sp = ((CommandAlias*)alias_pos->second.get())->GetUnderlyingCommand();
+ alias_match_sp = alias_pos->second;
}
if (HasUserCommands())
@@ -1351,15 +1351,16 @@ CommandInterpreter::BuildAliasResult (const char *alias_name,
alias_cmd_obj = GetCommandObject (alias_name);
StreamString result_str;
- if (alias_cmd_obj)
+ if (alias_cmd_obj && alias_cmd_obj->IsAlias())
{
+ OptionArgVectorSP option_arg_vector_sp = ((CommandAlias*)alias_cmd_obj)->GetOptionArguments();
+ alias_cmd_obj = ((CommandAlias*)alias_cmd_obj)->GetUnderlyingCommand().get();
std::string alias_name_str = alias_name;
if ((cmd_args.GetArgumentCount() == 0)
|| (alias_name_str.compare (cmd_args.GetArgumentAtIndex(0)) != 0))
cmd_args.Unshift (alias_name);
result_str.Printf ("%s", alias_cmd_obj->GetCommandName ());
- OptionArgVectorSP option_arg_vector_sp = GetAlias(alias_name)->GetOptionArguments();
if (option_arg_vector_sp.get())
{