[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
Loading
Please register or sign in to comment