Use digest size instead of hardcoding it.
authorKadir Cetinkaya <kadircet@google.com>
Mon, 19 Nov 2018 18:06:33 +0000 (18:06 +0000)
committerKadir Cetinkaya <kadircet@google.com>
Mon, 19 Nov 2018 18:06:33 +0000 (18:06 +0000)
llvm-svn: 347236

clang-tools-extra/clangd/index/Serialization.cpp

index c1b42ea..958501d 100644 (file)
@@ -365,8 +365,8 @@ Expected<IndexFileIn> readRIFF(StringRef Data) {
   IndexFileIn Result;
   if (Chunks.count("hash")) {
     Reader Hash(Chunks.lookup("hash"));
-    llvm::StringRef Digest = Hash.consume(20);
     Result.Digest.emplace();
+    llvm::StringRef Digest = Hash.consume(Result.Digest->size());
     std::copy(Digest.bytes_begin(), Digest.bytes_end(), Result.Digest->begin());
   }