Author: kadircet Date: Mon Nov 19 10:06:36 2018 New Revision: 347237 URL: http://llvm.org/viewvc/llvm-project?rev=347237&view=rev Log: Address comments.
Modified: clang-tools-extra/trunk/clangd/index/Serialization.cpp clang-tools-extra/trunk/clangd/index/Serialization.h Modified: clang-tools-extra/trunk/clangd/index/Serialization.cpp URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/index/Serialization.cpp?rev=347237&r1=347236&r2=347237&view=diff ============================================================================== --- clang-tools-extra/trunk/clangd/index/Serialization.cpp (original) +++ clang-tools-extra/trunk/clangd/index/Serialization.cpp Mon Nov 19 10:06:36 2018 @@ -331,6 +331,7 @@ std::pair<SymbolID, std::vector<Ref>> re // A file is a RIFF chunk with type 'CdIx'. // It contains the sections: // - meta: version number +// - srcs: checksum of the source file // - stri: string table // - symb: symbols // - refs: references to symbols @@ -363,8 +364,8 @@ Expected<IndexFileIn> readRIFF(StringRef return Strings.takeError(); IndexFileIn Result; - if (Chunks.count("hash")) { - Reader Hash(Chunks.lookup("hash")); + if (Chunks.count("srcs")) { + Reader Hash(Chunks.lookup("srcs")); Result.Digest.emplace(); llvm::StringRef Digest = Hash.consume(Result.Digest->size()); std::copy(Digest.bytes_begin(), Digest.bytes_end(), Result.Digest->begin()); @@ -409,7 +410,7 @@ void writeRIFF(const IndexFileOut &Data, if (Data.Digest) { llvm::StringRef Hash(reinterpret_cast<const char *>(Data.Digest->data()), Data.Digest->size()); - RIFF.Chunks.push_back({riff::fourCC("hash"), Hash}); + RIFF.Chunks.push_back({riff::fourCC("srcs"), Hash}); } StringTableOut Strings; Modified: clang-tools-extra/trunk/clangd/index/Serialization.h URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/index/Serialization.h?rev=347237&r1=347236&r2=347237&view=diff ============================================================================== --- clang-tools-extra/trunk/clangd/index/Serialization.h (original) +++ clang-tools-extra/trunk/clangd/index/Serialization.h Mon Nov 19 10:06:36 2018 @@ -37,10 +37,11 @@ enum class IndexFileFormat { // Holds the contents of an index file that was read. struct IndexFileIn { + using FileDigest = std::array<uint8_t, 20>; llvm::Optional<SymbolSlab> Symbols; llvm::Optional<RefSlab> Refs; // Digest of the source file that generated the contents. - llvm::Optional<std::array<uint8_t, 20>> Digest; + llvm::Optional<FileDigest> Digest; }; // Parse an index file. The input must be a RIFF or YAML file. llvm::Expected<IndexFileIn> readIndexFile(llvm::StringRef); @@ -50,7 +51,7 @@ struct IndexFileOut { const SymbolSlab *Symbols = nullptr; const RefSlab *Refs = nullptr; // Digest of the source file that generated the contents. - const std::array<uint8_t, 20> *Digest = nullptr; + const IndexFileIn::FileDigest *Digest = nullptr; // TODO: Support serializing Dex posting lists. IndexFileFormat Format = IndexFileFormat::RIFF; _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits