summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/clangd/CodeComplete.cpp
diff options
context:
space:
mode:
authorEric Liu <ioeric@google.com>2018-07-23 10:56:37 +0000
committerEric Liu <ioeric@google.com>2018-07-23 10:56:37 +0000
commit5d2a807f2575f4ca7a7d8e359d408226605fd6a5 (patch)
tree96e8171b5462bd1381f0d217a75e59113117e606 /clang-tools-extra/clangd/CodeComplete.cpp
parentbf6009c234d3605420add4b1a4f30f13a9377231 (diff)
downloadbcm5719-llvm-5d2a807f2575f4ca7a7d8e359d408226605fd6a5.tar.gz
bcm5719-llvm-5d2a807f2575f4ca7a7d8e359d408226605fd6a5.zip
[clangd] Penalize non-instance members when accessed via class instances.
Summary: The following are metrics for explicit member access completions. There is no noticeable impact on other completion types. Before: EXPLICIT_MEMBER_ACCESS Total measurements: 24382 All measurements: MRR: 62.27 Top10: 80.21% Top-100: 94.48% Full identifiers: MRR: 98.81 Top10: 99.89% Top-100: 99.95% 0-5 filter len: MRR: 13.25 46.31 62.47 67.77 70.40 81.91 Top-10: 29% 74% 84% 91% 91% 97% Top-100: 67% 99% 99% 99% 99% 100% After: EXPLICIT_MEMBER_ACCESS Total measurements: 24382 All measurements: MRR: 63.18 Top10: 80.58% Top-100: 95.07% Full identifiers: MRR: 98.79 Top10: 99.89% Top-100: 99.95% 0-5 filter len: MRR: 13.84 48.39 63.55 68.83 71.28 82.64 Top-10: 30% 75% 84% 91% 91% 97% Top-100: 70% 99% 99% 99% 99% 100% * Top-N: wanted result is found in the first N completion results. * MRR: Mean reciprocal rank. Remark: the change seems to have minor positive impact. Although the improvement is relatively small, down-ranking non-instance members in instance member access should reduce noise in the completion results. Reviewers: sammccall Reviewed By: sammccall Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, cfe-commits Differential Revision: https://reviews.llvm.org/D49543 llvm-svn: 337681
Diffstat (limited to 'clang-tools-extra/clangd/CodeComplete.cpp')
-rw-r--r--clang-tools-extra/clangd/CodeComplete.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/clang-tools-extra/clangd/CodeComplete.cpp b/clang-tools-extra/clangd/CodeComplete.cpp
index c0725fa633a..44c44b62db3 100644
--- a/clang-tools-extra/clangd/CodeComplete.cpp
+++ b/clang-tools-extra/clangd/CodeComplete.cpp
@@ -1062,6 +1062,7 @@ private:
Output.Completions.back().Score = C.second;
}
Output.HasMore = Incomplete;
+ Output.Context = Recorder->CCContext.getKind();
return Output;
}
@@ -1156,6 +1157,7 @@ private:
CompletionCandidate::Bundle Bundle) {
SymbolQualitySignals Quality;
SymbolRelevanceSignals Relevance;
+ Relevance.Context = Recorder->CCContext.getKind();
Relevance.Query = SymbolRelevanceSignals::CodeComplete;
Relevance.FileProximityMatch = FileProximity.getPointer();
auto &First = Bundle.front();
@@ -1290,6 +1292,7 @@ raw_ostream &operator<<(raw_ostream &OS, const CodeCompletion &C) {
raw_ostream &operator<<(raw_ostream &OS, const CodeCompleteResult &R) {
OS << "CodeCompleteResult: " << R.Completions.size() << (R.HasMore ? "+" : "")
+ << " (" << getCompletionKindString(R.Context) << ")"
<< " items:\n";
for (const auto &C : R.Completions)
OS << C << "\n";
OpenPOWER on IntegriCloud