diff options
author | Raphael Isemann <teemperor@gmail.com> | 2018-07-13 18:28:14 +0000 |
---|---|---|
committer | Raphael Isemann <teemperor@gmail.com> | 2018-07-13 18:28:14 +0000 |
commit | a2e76c0bfc5bec8d50e8d13f71b72a66eaa0a386 (patch) | |
tree | 55563c896d181a4de6dc254f335c10a379e0eac0 /lldb/source/Interpreter/CommandObject.cpp | |
parent | d6c062bce1e499f52500cc759a7c0846dd178cda (diff) | |
download | llvm-a2e76c0bfc5bec8d50e8d13f71b72a66eaa0a386.zip llvm-a2e76c0bfc5bec8d50e8d13f71b72a66eaa0a386.tar.gz llvm-a2e76c0bfc5bec8d50e8d13f71b72a66eaa0a386.tar.bz2 |
Replaced more boilerplate code with CompletionRequest (NFC)
Summary:
As suggested in D48796, this patch replaces even more internal calls that were using the old
completion API style with a single CompletionRequest. In some cases we also pass an option
vector/index, but as we don't always have this information, it currently is not part of the
CompletionRequest class.
The constructor of the CompletionRequest is now also more sensible. You only pass the
user input, cursor position and your list of matches to the request and the rest will be
inferred (using the same code we used before to calculate this). You also have to pass these
match window parameters to it, even though they are unused right now.
The patch shouldn't change any behavior.
Reviewers: jingham
Reviewed By: jingham
Subscribers: lldb-commits
Differential Revision: https://reviews.llvm.org/D48976
llvm-svn: 337031
Diffstat (limited to 'lldb/source/Interpreter/CommandObject.cpp')
-rw-r--r-- | lldb/source/Interpreter/CommandObject.cpp | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/lldb/source/Interpreter/CommandObject.cpp b/lldb/source/Interpreter/CommandObject.cpp index 004cdf0..07be913 100644 --- a/lldb/source/Interpreter/CommandObject.cpp +++ b/lldb/source/Interpreter/CommandObject.cpp @@ -279,14 +279,8 @@ int CommandObject::HandleCompletion(CompletionRequest &request) { opt_element_vector = cur_options->ParseForCompletion( request.GetParsedLine(), request.GetCursorIndex()); - bool handled_by_options; - bool word_complete = request.GetWordComplete(); - handled_by_options = cur_options->HandleOptionCompletion( - request.GetParsedLine(), opt_element_vector, request.GetCursorIndex(), - request.GetCursorCharPosition(), request.GetMatchStartPoint(), - request.GetMaxReturnElements(), GetCommandInterpreter(), - word_complete, request.GetMatches()); - request.SetWordComplete(word_complete); + bool handled_by_options = cur_options->HandleOptionCompletion( + request, opt_element_vector, GetCommandInterpreter()); if (handled_by_options) return request.GetMatches().GetSize(); } @@ -1015,7 +1009,8 @@ static llvm::StringRef arch_helper() { static StreamString g_archs_help; if (g_archs_help.Empty()) { StringList archs; - ArchSpec::AutoComplete(llvm::StringRef(), archs); + + ArchSpec::ListSupportedArchNames(archs); g_archs_help.Printf("These are the supported architecture names:\n"); archs.Join("\n", g_archs_help); } |