summaryrefslogtreecommitdiff
path: root/clang-tools-extra/unittests/clangd/IndexTests.cpp
diff options
context:
space:
mode:
authorSam McCall <sam.mccall@gmail.com>2018-03-12 14:49:09 +0000
committerSam McCall <sam.mccall@gmail.com>2018-03-12 14:49:09 +0000
commit4e9b812af402da7b0177b03b02fe95a2341f2e0b (patch)
treef2663dacd528fbc123bb040df8509eae12133d30 /clang-tools-extra/unittests/clangd/IndexTests.cpp
parent8ccff2fdfbfaba29b980777bbaafa748acb1ed94 (diff)
[clangd] Collect the number of files referencing a symbol in the static index.
Summary: This is an important ranking signal. It's off for the dynamic index for now. Correspondingly, tell the index infrastructure only to report declarations for the dynamic index. Reviewers: ioeric, hokein Subscribers: klimek, ilya-biryukov, jkorous-apple, cfe-commits Differential Revision: https://reviews.llvm.org/D44315
Diffstat (limited to 'clang-tools-extra/unittests/clangd/IndexTests.cpp')
-rw-r--r--clang-tools-extra/unittests/clangd/IndexTests.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/clang-tools-extra/unittests/clangd/IndexTests.cpp b/clang-tools-extra/unittests/clangd/IndexTests.cpp
index 20eb4527d9f..5e5ddbfb86e 100644
--- a/clang-tools-extra/unittests/clangd/IndexTests.cpp
+++ b/clang-tools-extra/unittests/clangd/IndexTests.cpp
@@ -225,6 +225,8 @@ TEST(MergeTest, Merge) {
L.Name = R.Name = "Foo"; // same in both
L.CanonicalDeclaration.FileURI = "file:///left.h"; // differs
R.CanonicalDeclaration.FileURI = "file:///right.h";
+ L.References = 1;
+ R.References = 2;
L.CompletionPlainInsertText = "f00"; // present in left only
R.CompletionSnippetInsertText = "f0{$1:0}"; // present in right only
Symbol::Details DetL, DetR;
@@ -238,6 +240,7 @@ TEST(MergeTest, Merge) {
Symbol M = mergeSymbol(L, R, &Scratch);
EXPECT_EQ(M.Name, "Foo");
EXPECT_EQ(M.CanonicalDeclaration.FileURI, "file:///left.h");
+ EXPECT_EQ(M.References, 3u);
EXPECT_EQ(M.CompletionPlainInsertText, "f00");
EXPECT_EQ(M.CompletionSnippetInsertText, "f0{$1:0}");
ASSERT_TRUE(M.Detail);