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/Interpreter/CommandObject.cpp | |
parent | 5e63e78ca9407d0592b5a5c7dbf1017a45d91bf5 (diff) | |
download | llvm-308f73c5a3c53f2b9fe8df4c1e73f6786ad7735e.zip llvm-308f73c5a3c53f2b9fe8df4c1e73f6786ad7735e.tar.gz llvm-308f73c5a3c53f2b9fe8df4c1e73f6786ad7735e.tar.bz2 |
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/Interpreter/CommandObject.cpp')
-rw-r--r-- | lldb/source/Interpreter/CommandObject.cpp | 39 |
1 files changed, 0 insertions, 39 deletions
diff --git a/lldb/source/Interpreter/CommandObject.cpp b/lldb/source/Interpreter/CommandObject.cpp index e04659c..bd41ca9 100644 --- a/lldb/source/Interpreter/CommandObject.cpp +++ b/lldb/source/Interpreter/CommandObject.cpp @@ -346,45 +346,6 @@ CommandObject::Cleanup () m_api_locker.Unlock(); } - -class CommandDictCommandPartialMatch -{ - public: - CommandDictCommandPartialMatch (const char *match_str) - { - m_match_str = match_str; - } - bool operator() (const std::pair<std::string, lldb::CommandObjectSP> map_element) const - { - // A NULL or empty string matches everything. - if (m_match_str == nullptr || *m_match_str == '\0') - return true; - - return map_element.first.find (m_match_str, 0) == 0; - } - - private: - const char *m_match_str; -}; - -int -CommandObject::AddNamesMatchingPartialString (CommandObject::CommandMap &in_map, const char *cmd_str, - StringList &matches) -{ - int number_added = 0; - CommandDictCommandPartialMatch matcher(cmd_str); - - CommandObject::CommandMap::iterator matching_cmds = std::find_if (in_map.begin(), in_map.end(), matcher); - - while (matching_cmds != in_map.end()) - { - ++number_added; - matches.AppendString((*matching_cmds).first.c_str()); - matching_cmds = std::find_if (++matching_cmds, in_map.end(), matcher);; - } - return number_added; -} - int CommandObject::HandleCompletion ( |