diff options
Diffstat (limited to 'lldb/source')
5 files changed, 12 insertions, 13 deletions
diff --git a/lldb/source/Commands/CommandObjectExpression.cpp b/lldb/source/Commands/CommandObjectExpression.cpp index fdeaac24d0a..b880cbfd49e 100644 --- a/lldb/source/Commands/CommandObjectExpression.cpp +++ b/lldb/source/Commands/CommandObjectExpression.cpp @@ -369,9 +369,7 @@ int CommandObjectExpression::HandleCompletion(CompletionRequest &request) {    if (error.Fail())      return 0; -  StringList matches; -  expr->Complete(exe_ctx, matches, cursor_pos); -  request.AddCompletions(matches); +  expr->Complete(exe_ctx, request, cursor_pos);    return request.GetNumberOfMatches();  } diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp index 80d04c1e973..bf41126dbf6 100644 --- a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp +++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp @@ -563,7 +563,7 @@ class CodeComplete : public CodeCompleteConsumer {    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 @@ public:    /// @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 @@ public:          // 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 @@ public:  };  } // 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 @@ bool ClangExpressionParser::Complete(StringList &matches, unsigned line,    // 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. diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.h b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.h index 7fdc9c121ef..03ff55f614d 100644 --- a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.h +++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.h @@ -62,7 +62,7 @@ public:    //------------------------------------------------------------------    ~ClangExpressionParser() override; -  bool Complete(StringList &matches, unsigned line, unsigned pos, +  bool Complete(CompletionRequest &request, unsigned line, unsigned pos,                  unsigned typed_pos) override;    //------------------------------------------------------------------ diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp index c43e9d7511f..048cef0b660 100644 --- a/lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp +++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp @@ -643,7 +643,8 @@ static void AbsPosToLineColumnPos(unsigned abs_pos, llvm::StringRef code,  }  bool ClangUserExpression::Complete(ExecutionContext &exe_ctx, -                                   StringList &matches, unsigned complete_pos) { +                                   CompletionRequest &request, +                                   unsigned complete_pos) {    Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS));    // We don't want any visible feedback when completing an expression. Mostly @@ -709,7 +710,7 @@ bool ClangUserExpression::Complete(ExecutionContext &exe_ctx,    // The actual column where we have to complete is the start column of the    // user expression + the offset inside the user code that we were given.    const unsigned completion_column = user_expr_column + complete_pos; -  parser.Complete(matches, user_expr_line, completion_column, complete_pos); +  parser.Complete(request, user_expr_line, completion_column, complete_pos);    return true;  } diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.h b/lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.h index c26975e60e5..8831d94ea9d 100644 --- a/lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.h +++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.h @@ -143,7 +143,7 @@ public:               lldb_private::ExecutionPolicy execution_policy,               bool keep_result_in_memory, bool generate_debug_info) override; -  bool Complete(ExecutionContext &exe_ctx, StringList &matches, +  bool Complete(ExecutionContext &exe_ctx, CompletionRequest &request,                  unsigned complete_pos) override;    ExpressionTypeSystemHelper *GetTypeSystemHelper() override {  | 

