Use a CompletionRequest in the expression command completion [NFC]
The patch was originally written before we had a CompletionRequest,
so it still used a StringList to pass back the completions to
the request.
llvm-svn: 341124
diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
index 80d04c1..bf41126 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
@@ -563,7 +563,7 @@
std::string m_expr;
unsigned m_position = 0;
- StringList &m_matches;
+ CompletionRequest &m_request;
/// Returns true if the given character can be used in an identifier.
/// This also returns true for numbers because for completion we usually
@@ -638,10 +638,10 @@
/// @param[out] position
/// The character position of the user cursor in the `expr` parameter.
///
- CodeComplete(StringList &matches, std::string expr, unsigned position)
+ CodeComplete(CompletionRequest &request, std::string expr, unsigned position)
: CodeCompleteConsumer(CodeCompleteOptions(), false),
m_info(std::make_shared<GlobalCodeCompletionAllocator>()), m_expr(expr),
- m_position(position), m_matches(matches) {}
+ m_position(position), m_request(request) {}
/// Deregisters and destroys this code-completion consumer.
virtual ~CodeComplete() {}
@@ -735,7 +735,7 @@
// with the kind of result the lldb API expects.
std::string CompletionSuggestion =
mergeCompletion(m_expr, m_position, ToInsert);
- m_matches.AppendString(CompletionSuggestion);
+ m_request.AddCompletion(CompletionSuggestion);
}
}
}
@@ -763,7 +763,7 @@
};
} // namespace
-bool ClangExpressionParser::Complete(StringList &matches, unsigned line,
+bool ClangExpressionParser::Complete(CompletionRequest &request, unsigned line,
unsigned pos, unsigned typed_pos) {
DiagnosticManager mgr;
// We need the raw user expression here because that's what the CodeComplete
@@ -773,7 +773,7 @@
// the LLVMUserExpression which exposes the right API. This should never fail
// as we always have a ClangUserExpression whenever we call this.
LLVMUserExpression &llvm_expr = *static_cast<LLVMUserExpression *>(&m_expr);
- CodeComplete CC(matches, llvm_expr.GetUserText(), typed_pos);
+ CodeComplete CC(request, llvm_expr.GetUserText(), typed_pos);
// We don't need a code generator for parsing.
m_code_generator.reset();
// Start parsing the expression with our custom code completion consumer.