From: Enrico Granata Date: Tue, 8 Mar 2016 03:48:41 +0000 (+0000) Subject: Attempt to fix the Ubuntu buildbot by making FindLongestCommandWord a free template... X-Git-Tag: llvmorg-3.9.0-rc1~12284 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4a795920e3e3fbef8c55956210b698f49d90f091;p=platform%2Fupstream%2Fllvm.git Attempt to fix the Ubuntu buildbot by making FindLongestCommandWord a free template function in lldb_private llvm-svn: 262905 --- diff --git a/lldb/include/lldb/Interpreter/CommandInterpreter.h b/lldb/include/lldb/Interpreter/CommandInterpreter.h index 4d950e4..5aaeccb 100644 --- a/lldb/include/lldb/Interpreter/CommandInterpreter.h +++ b/lldb/include/lldb/Interpreter/CommandInterpreter.h @@ -533,10 +533,6 @@ public: bool GetSynchronous (); - template - size_t - FindLongestCommandWord (std::map &dict); - void FindCommandsForApropos (const char *word, StringList &commands_found, diff --git a/lldb/include/lldb/Interpreter/CommandObject.h b/lldb/include/lldb/Interpreter/CommandObject.h index 4d20563..b78b22c 100644 --- a/lldb/include/lldb/Interpreter/CommandObject.h +++ b/lldb/include/lldb/Interpreter/CommandObject.h @@ -70,7 +70,23 @@ AddNamesMatchingPartialString (std::map &in_map, const ch } return number_added; } + +template +size_t +FindLongestCommandWord (std::map &dict) +{ + auto end = dict.end(); + size_t max_len = 0; + for (auto pos = dict.begin(); pos != end; ++pos) + { + size_t len = pos->first.size(); + if (max_len < len) + max_len = len; + } + return max_len; +} + class CommandObject { public: diff --git a/lldb/source/Commands/CommandObjectMultiword.cpp b/lldb/source/Commands/CommandObjectMultiword.cpp index 18e162d..887ce24 100644 --- a/lldb/source/Commands/CommandObjectMultiword.cpp +++ b/lldb/source/Commands/CommandObjectMultiword.cpp @@ -181,7 +181,7 @@ CommandObjectMultiword::GenerateHelpText (Stream &output_stream) output_stream.PutCString ("The following subcommands are supported:\n\n"); CommandMap::iterator pos; - uint32_t max_len = m_interpreter.FindLongestCommandWord (m_subcommand_dict); + uint32_t max_len = FindLongestCommandWord (m_subcommand_dict); if (max_len) max_len += 4; // Indent the output by 4 spaces. diff --git a/lldb/source/Interpreter/CommandInterpreter.cpp b/lldb/source/Interpreter/CommandInterpreter.cpp index bf8ac43..bfbfabb 100644 --- a/lldb/source/Interpreter/CommandInterpreter.cpp +++ b/lldb/source/Interpreter/CommandInterpreter.cpp @@ -1200,22 +1200,6 @@ CommandInterpreter::GetAliasHelp (const char *alias_name, const char *command_na help_string.Printf ("'"); } -template -size_t -CommandInterpreter::FindLongestCommandWord (std::map &dict) -{ - auto end = dict.end(); - size_t max_len = 0; - - for (auto pos = dict.begin(); pos != end; ++pos) - { - size_t len = pos->first.size(); - if (max_len < len) - max_len = len; - } - return max_len; -} - void CommandInterpreter::GetHelp (CommandReturnObject &result, uint32_t cmd_types)