[lldb][NFC] Refactor remaining completion logic to use CompletionRequests

This patch moves the remaining completion functions from the
old completion API (that used several variables) to just
passing a single CompletionRequest.

This is for the most part a simple change as we just replace
the old arguments with a single CompletionRequest argument.

There are a few places where I had to create new CompletionRequests
in the called functions as CompletionRequests itself are immutable
and don't expose their internal match list anymore. This means that
if a function wanted to change the CompletionRequest or directly
access the result list, we need to work around this by creating
a new CompletionRequest and a temporary match/description list.

Preparation work for rdar://53769355

llvm-svn: 369000
This commit is contained in:
Raphael Isemann
2019-08-15 13:14:10 +00:00
parent dc23c832f4
commit 2fc20f652c
10 changed files with 89 additions and 92 deletions

View File

@@ -371,8 +371,11 @@ int SBCommandInterpreter::HandleCompletionWithDescriptions(
if (IsValid()) {
lldb_private::StringList lldb_matches, lldb_descriptions;
num_completions = m_opaque_ptr->HandleCompletion(
current_line, cursor, last_char, lldb_matches, lldb_descriptions);
CompletionResult result;
CompletionRequest request(current_line, cursor - current_line, result);
num_completions = m_opaque_ptr->HandleCompletion(request);
result.GetMatches(lldb_matches);
result.GetDescriptions(lldb_descriptions);
SBStringList temp_matches_list(&lldb_matches);
matches.AppendList(temp_matches_list);