Attempt to fix the Ubuntu buildbot by making FindLongestCommandWord a free template function in lldb_private

llvm-svn: 262905
This commit is contained in:
Enrico Granata 2016-03-08 03:48:41 +00:00
parent 5df5402f94
commit 4a795920e3
4 changed files with 17 additions and 21 deletions

View File

@ -533,10 +533,6 @@ public:
bool
GetSynchronous ();
template <typename ValueType>
size_t
FindLongestCommandWord (std::map<std::string,ValueType> &dict);
void
FindCommandsForApropos (const char *word,
StringList &commands_found,

View File

@ -70,7 +70,23 @@ AddNamesMatchingPartialString (std::map<std::string,ValueType> &in_map, const ch
}
return number_added;
}
template <typename ValueType>
size_t
FindLongestCommandWord (std::map<std::string,ValueType> &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:

View File

@ -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.

View File

@ -1200,22 +1200,6 @@ CommandInterpreter::GetAliasHelp (const char *alias_name, const char *command_na
help_string.Printf ("'");
}
template <typename ValueType>
size_t
CommandInterpreter::FindLongestCommandWord (std::map<std::string,ValueType> &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)