[all-commits] [llvm/llvm-project] e397a0: [clangd] Add instrumentation mode in clangd for me...

UTKARSH SAXENA via All-commits all-commits at lists.llvm.org
Thu Mar 5 03:39:30 PST 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: e397a0a5c3c0fa1912fbac23b550fa7d239196ba
      https://github.com/llvm/llvm-project/commit/e397a0a5c3c0fa1912fbac23b550fa7d239196ba
  Author: Utkarsh Saxena <usx at google.com>
  Date:   2020-03-05 (Thu, 05 Mar 2020)

  Changed paths:
    M clang-tools-extra/clangd/CodeComplete.cpp
    M clang-tools-extra/clangd/CodeComplete.h
    M clang-tools-extra/clangd/unittests/CodeCompleteTests.cpp

  Log Message:
  -----------
  [clangd] Add instrumentation mode in clangd for metrics collection.

Summary:
This patch adds an instrumentation mode for clangd (enabled by
corresponding option in cc_opts).
If this mode is enabled then user can specify callbacks to run on the
final code completion result.

Moreover the CodeCompletion::Score will contain the detailed Quality and
Relevance signals used to compute the score when this mode is enabled.
These are required because we do not any place in which the final
candidates (scored and sorted) are available along with the above
signals. The signals are temporary structures in `addCandidate`.

The callback is needed as it gives access to many data structures that
are internal to CodeCompleteFlow and are available once Sema has run. Eg:
ScopeDistnace and FileDistance.

If this mode is disabled (as in default) then Score would just contain 2
shared pointers (null). Thus cost(memory/time) increase for the default
mode would be fairly cheap and insignificant.

Reviewers: sammccall

Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D75603




More information about the All-commits mailing list