diff options
| author | Kadir Cetinkaya <kadircet@google.com> | 2018-11-19 18:06:29 +0000 |
|---|---|---|
| committer | Kadir Cetinkaya <kadircet@google.com> | 2018-11-19 18:06:29 +0000 |
| commit | ca9e5dc71481b7e514d322804d86a8328f857d3a (patch) | |
| tree | 57fcaf4c23cb71289222e5cdab46a88bdb5e3daa /clang-tools-extra/unittests/clangd/BackgroundIndexTests.cpp | |
| parent | d83a5526d5f8a9df5c4fac5e2aaeae242fbe7dc3 (diff) | |
| download | bcm5719-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.cpp | 7 |
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 |

