// 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
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());
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;
// 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);
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;