Revert "[NFC; Incremental] Rename BasicSourceFileInfo.InterfaceHash"

This commit is contained in:
David Ungar
2021-02-25 09:06:53 -08:00
committed by GitHub
parent 88c73c63d8
commit 6e034cac4e
6 changed files with 9 additions and 11 deletions

View File

@@ -98,9 +98,7 @@ struct BasicDeclLocs {
struct BasicSourceFileInfo {
StringRef FilePath;
/// Used for completion; factors in hashes from type-bodies in order to be sensitive to changes in
/// the intefaces of top-level type members.
Fingerprint InterfaceHashIncludingTypeMembers = Fingerprint::ZERO();
Fingerprint InterfaceHash = Fingerprint::ZERO();
llvm::sys::TimePoint<> LastModified = {};
uint64_t FileSize = 0;

View File

@@ -1553,7 +1553,7 @@ Fingerprint ModuleDecl::getFingerprint() const {
StableHasher hasher = StableHasher::defaultHasher();
SmallVector<Fingerprint, 16> FPs;
collectBasicSourceFileInfo([&](const BasicSourceFileInfo &bsfi) {
FPs.emplace_back(bsfi.InterfaceHashIncludingTypeMembers);
FPs.emplace_back(bsfi.InterfaceHash);
});
// Sort the fingerprints lexicographically so we have a stable hash despite

View File

@@ -262,10 +262,10 @@ bool BasicSourceFileInfo::populate(const SourceFile *SF) {
FileSize = stat->getSize();
if (SF->hasInterfaceHash()) {
InterfaceHashIncludingTypeMembers = SF->getInterfaceHashIncludingTypeMembers();
InterfaceHash = SF->getInterfaceHashIncludingTypeMembers();
} else {
// FIXME: Parse the file with EnableInterfaceHash option.
InterfaceHashIncludingTypeMembers = Fingerprint::ZERO();
InterfaceHash = Fingerprint::ZERO();
}
return false;

View File

@@ -978,7 +978,7 @@ void ModuleFile::collectBasicSourceFileInfo(
while (Cursor < End) {
// FilePath (byte offset in 'SourceLocsTextData').
auto fileID = endian::readNext<uint32_t, little, unaligned>(Cursor);
// InterfaceHashIncludingTypeMembers (fixed length string).
// InterfaceHash (fixed length string).
auto fpStr = StringRef{reinterpret_cast<const char *>(Cursor),
Fingerprint::DIGEST_LENGTH};
Cursor += Fingerprint::DIGEST_LENGTH;
@@ -995,7 +995,7 @@ void ModuleFile::collectBasicSourceFileInfo(
BasicSourceFileInfo info;
info.FilePath = filePath;
if (auto fingerprint = Fingerprint::fromString(fpStr))
info.InterfaceHashIncludingTypeMembers = fingerprint.getValue();
info.InterfaceHash = fingerprint.getValue();
else {
llvm::errs() << "Unconvertable fingerprint '" << fpStr << "'\n";
abort();

View File

@@ -803,7 +803,7 @@ static void emitFileListRecord(llvm::BitstreamWriter &Out,
return;
auto fileID = FWriter.getTextOffset(absolutePath);
auto fingerprintStr = info.InterfaceHashIncludingTypeMembers.getRawValue();
auto fingerprintStr = info.InterfaceHash.getRawValue();
auto timestamp = std::chrono::duration_cast<std::chrono::nanoseconds>(
info.LastModified.time_since_epoch())
.count();
@@ -812,7 +812,7 @@ static void emitFileListRecord(llvm::BitstreamWriter &Out,
endian::Writer writer(out, little);
// FilePath.
writer.write<uint32_t>(fileID);
// InterfaceHashIncludingTypeMembers (fixed length string).
// InterfaceHash (fixed length string).
assert(fingerprintStr.size() == Fingerprint::DIGEST_LENGTH);
out << fingerprintStr;
// LastModified (nanoseconds since epoch).

View File

@@ -2518,7 +2518,7 @@ static void printModuleMetadata(ModuleDecl *MD) {
});
MD->collectBasicSourceFileInfo([&](const BasicSourceFileInfo &info) {
OS << "filepath=" << info.FilePath << "; ";
OS << "hash=" << info.InterfaceHashIncludingTypeMembers.getRawValue() << "; ";
OS << "hash=" << info.InterfaceHash.getRawValue() << "; ";
OS << "mtime=" << info.LastModified << "; ";
OS << "size=" << info.FileSize;
OS << "\n";