diff options
author | Enrico Granata <egranata@apple.com> | 2016-03-08 02:49:15 +0000 |
---|---|---|
committer | Enrico Granata <egranata@apple.com> | 2016-03-08 02:49:15 +0000 |
commit | 308f73c5a3c53f2b9fe8df4c1e73f6786ad7735e (patch) | |
tree | a4559c80a5eb3653af14ba3d65ef96393543a658 /lldb/source/Commands/CommandObjectCommands.cpp | |
parent | 5e63e78ca9407d0592b5a5c7dbf1017a45d91bf5 (diff) | |
download | bcm5719-llvm-308f73c5a3c53f2b9fe8df4c1e73f6786ad7735e.tar.gz bcm5719-llvm-308f73c5a3c53f2b9fe8df4c1e73f6786ad7735e.zip |
Change the way command aliases are stored. Go from a model where a map holds the alias -> underlying command binding and another map holds the alias -> options, to a model where one single map holds the alias -> (all useful data) combination
Right now, obviously, this is just the pair of (CommandObjectSP,OptionArgVectorSP), so NFC
This is step one of a larger - and tricky - refactoring which will turn command aliases into interesting objects instead of passive storage that the command interpreter does smart things to
This refactoring, in turn, will allow us to do interesting things with aliases, such as intelligent and customizable help
llvm-svn: 262900
Diffstat (limited to 'lldb/source/Commands/CommandObjectCommands.cpp')
-rw-r--r-- | lldb/source/Commands/CommandObjectCommands.cpp | 22 |
1 files changed, 3 insertions, 19 deletions
diff --git a/lldb/source/Commands/CommandObjectCommands.cpp b/lldb/source/Commands/CommandObjectCommands.cpp index e2e2bb81ea0..d5816db0dbf 100644 --- a/lldb/source/Commands/CommandObjectCommands.cpp +++ b/lldb/source/Commands/CommandObjectCommands.cpp @@ -635,21 +635,13 @@ protected: if (m_interpreter.AliasExists (alias_command.c_str()) || m_interpreter.UserCommandExists (alias_command.c_str())) { - OptionArgVectorSP temp_option_arg_sp (m_interpreter.GetAliasOptions (alias_command.c_str())); - if (temp_option_arg_sp) - { - if (option_arg_vector->empty()) - m_interpreter.RemoveAliasOptions (alias_command.c_str()); - } result.AppendWarningWithFormat ("Overwriting existing definition for '%s'.\n", alias_command.c_str()); } if (cmd_obj_sp) { - m_interpreter.AddAlias (alias_command.c_str(), cmd_obj_sp); - if (!option_arg_vector->empty()) - m_interpreter.AddOrReplaceAliasOptions (alias_command.c_str(), option_arg_vector_sp); + m_interpreter.AddAlias (alias_command.c_str(), cmd_obj_sp, option_arg_vector_sp); result.SetStatus (eReturnStatusSuccessFinishNoResult); } else @@ -747,22 +739,14 @@ protected: if (m_interpreter.AliasExists (alias_command.c_str()) || m_interpreter.UserCommandExists (alias_command.c_str())) { - OptionArgVectorSP tmp_option_arg_sp (m_interpreter.GetAliasOptions (alias_command.c_str())); - if (tmp_option_arg_sp) - { - if (option_arg_vector->empty()) - m_interpreter.RemoveAliasOptions (alias_command.c_str()); - } result.AppendWarningWithFormat ("Overwriting existing definition for '%s'.\n", alias_command.c_str()); } if (use_subcommand) - m_interpreter.AddAlias (alias_command.c_str(), subcommand_obj_sp); + m_interpreter.AddAlias (alias_command.c_str(), subcommand_obj_sp, option_arg_vector_sp); else - m_interpreter.AddAlias (alias_command.c_str(), command_obj_sp); - if (!option_arg_vector->empty()) - m_interpreter.AddOrReplaceAliasOptions (alias_command.c_str(), option_arg_vector_sp); + m_interpreter.AddAlias (alias_command.c_str(), command_obj_sp, option_arg_vector_sp); result.SetStatus (eReturnStatusSuccessFinishNoResult); } else |