[lldb][NFC] Remove StringList::AutoComplete
We don't need this very specific function in StringList that we only call once in LLDB. llvm-svn: 369242
This commit is contained in:
parent
cedd0d9a6e
commit
b8639f5c0f
|
@ -107,14 +107,6 @@ public:
|
|||
// Copy assignment for a vector of strings
|
||||
StringList &operator=(const std::vector<std::string> &rhs);
|
||||
|
||||
// This string list contains a list of valid auto completion strings, and the
|
||||
// "s" is passed in. "matches" is filled in with zero or more string values
|
||||
// that start with "s", and the first string to exactly match one of the
|
||||
// string values in this collection, will have "exact_matches_idx" filled in
|
||||
// to match the index, or "exact_matches_idx" will have SIZE_MAX
|
||||
size_t AutoComplete(llvm::StringRef s, StringList &matches,
|
||||
size_t &exact_matches_idx) const;
|
||||
|
||||
// Dump the StringList to the given lldb_private::Log, `log`, one item per
|
||||
// line. If given, `name` will be used to identify the start and end of the
|
||||
// list in the output.
|
||||
|
|
|
@ -309,12 +309,18 @@ int CommandCompletions::SettingsNames(CommandInterpreter &interpreter,
|
|||
}
|
||||
}
|
||||
|
||||
size_t exact_matches_idx = SIZE_MAX;
|
||||
StringList matches;
|
||||
g_property_names.AutoComplete(request.GetCursorArgumentPrefix(), matches,
|
||||
exact_matches_idx);
|
||||
request.SetWordComplete(exact_matches_idx != SIZE_MAX);
|
||||
request.AddCompletions(matches);
|
||||
bool exact_match = false;
|
||||
|
||||
for (const std::string &s : g_property_names) {
|
||||
if (llvm::StringRef(s).startswith(request.GetCursorArgumentPrefix())) {
|
||||
if (request.GetCursorArgumentPrefix() == s)
|
||||
exact_match = true;
|
||||
request.AddCompletion(s);
|
||||
}
|
||||
}
|
||||
|
||||
request.SetWordComplete(exact_match);
|
||||
|
||||
return request.GetNumberOfMatches();
|
||||
}
|
||||
|
||||
|
|
|
@ -223,29 +223,6 @@ StringList &StringList::operator=(const std::vector<std::string> &rhs) {
|
|||
return *this;
|
||||
}
|
||||
|
||||
size_t StringList::AutoComplete(llvm::StringRef s, StringList &matches,
|
||||
size_t &exact_idx) const {
|
||||
matches.Clear();
|
||||
exact_idx = SIZE_MAX;
|
||||
if (s.empty()) {
|
||||
// No string, so it matches everything
|
||||
matches = *this;
|
||||
return matches.GetSize();
|
||||
}
|
||||
|
||||
const size_t s_len = s.size();
|
||||
const size_t num_strings = m_strings.size();
|
||||
|
||||
for (size_t i = 0; i < num_strings; ++i) {
|
||||
if (m_strings[i].find(s) == 0) {
|
||||
if (exact_idx == SIZE_MAX && m_strings[i].size() == s_len)
|
||||
exact_idx = matches.GetSize();
|
||||
matches.AppendString(m_strings[i]);
|
||||
}
|
||||
}
|
||||
return matches.GetSize();
|
||||
}
|
||||
|
||||
void StringList::LogDump(Log *log, const char *name) {
|
||||
if (!log)
|
||||
return;
|
||||
|
|
Loading…
Reference in New Issue