[PATCH] D54693: [clangd] Store source file hash in IndexFile{In,Out}

Sam McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 19 09:28:18 PST 2018


sammccall accepted this revision.
sammccall added inline comments.
This revision is now accepted and ready to land.


================
Comment at: clangd/index/Serialization.cpp:368
+    Reader Hash(Chunks.lookup("hash"));
+    llvm::StringRef Digest = Hash.consume(20);
+    Result.Digest.emplace();
----------------
jkorous wrote:
> Nit: Maybe we could use `Result.Digest.size()` and avoid having `20` hardcoded here?
It's still in a couple of places in Serialization.h. Could we add an alias there e.g. `using FileDigest = std::array<uint8_t, 20>`?


================
Comment at: clangd/index/Serialization.cpp:330
 
 // FILE ENCODING
 // A file is a RIFF chunk with type 'CdIx'.
----------------
update


================
Comment at: clangd/index/Serialization.cpp:366
   IndexFileIn Result;
+  if (Chunks.count("hash")) {
+    Reader Hash(Chunks.lookup("hash"));
----------------
I'd call this chunk "srcs" or so - I suspect we may want to include path info and/or dependencies in the future.


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D54693





More information about the cfe-commits mailing list