summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/unittests/clangd/BackgroundIndexTests.cpp
diff options
context:
space:
mode:
authorKadir Cetinkaya <kadircet@google.com>2018-11-19 18:06:29 +0000
committerKadir Cetinkaya <kadircet@google.com>2018-11-19 18:06:29 +0000
commitca9e5dc71481b7e514d322804d86a8328f857d3a (patch)
tree57fcaf4c23cb71289222e5cdab46a88bdb5e3daa /clang-tools-extra/unittests/clangd/BackgroundIndexTests.cpp
parentd83a5526d5f8a9df5c4fac5e2aaeae242fbe7dc3 (diff)
downloadbcm5719-llvm-ca9e5dc71481b7e514d322804d86a8328f857d3a.tar.gz
bcm5719-llvm-ca9e5dc71481b7e514d322804d86a8328f857d3a.zip
[clangd] Store source file hash in IndexFile{In,Out}
Summary: Puts the digest of the source file that generated the index into serialized index and stores them back on load, if exists. Reviewers: sammccall Subscribers: ilya-biryukov, ioeric, MaskRay, jkorous, arphaman, cfe-commits Differential Revision: https://reviews.llvm.org/D54693 llvm-svn: 347235
Diffstat (limited to 'clang-tools-extra/unittests/clangd/BackgroundIndexTests.cpp')
-rw-r--r--clang-tools-extra/unittests/clangd/BackgroundIndexTests.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/clang-tools-extra/unittests/clangd/BackgroundIndexTests.cpp b/clang-tools-extra/unittests/clangd/BackgroundIndexTests.cpp
index 6746e800ea1..39f4040f09d 100644
--- a/clang-tools-extra/unittests/clangd/BackgroundIndexTests.cpp
+++ b/clang-tools-extra/unittests/clangd/BackgroundIndexTests.cpp
@@ -121,8 +121,10 @@ TEST(BackgroundIndexTest, ShardStorageWriteTest) {
void f_b();
class A_CC {};
)cpp";
- FS.Files[testPath("root/A.cc")] =
- "#include \"A.h\"\nvoid g() { (void)common; }";
+ std::string A_CC = "#include \"A.h\"\nvoid g() { (void)common; }";
+ FS.Files[testPath("root/A.cc")] = A_CC;
+ auto Digest = llvm::SHA1::hash(
+ {reinterpret_cast<const uint8_t *>(A_CC.data()), A_CC.size()});
llvm::StringMap<std::string> Storage;
size_t CacheHits = 0;
@@ -156,6 +158,7 @@ TEST(BackgroundIndexTest, ShardStorageWriteTest) {
EXPECT_NE(ShardSource, nullptr);
EXPECT_THAT(*ShardSource->Symbols, UnorderedElementsAre());
EXPECT_THAT(*ShardSource->Refs, RefsAre({FileURI("unittest:///root/A.cc")}));
+ EXPECT_EQ(*ShardSource->Digest, Digest);
}
} // namespace clangd
OpenPOWER on IntegriCloud