File tree Expand file tree Collapse file tree 6 files changed +11
-9
lines changed Expand file tree Collapse file tree 6 files changed +11
-9
lines changed Original file line number Diff line number Diff line change @@ -98,7 +98,9 @@ struct BasicDeclLocs {
98
98
99
99
struct BasicSourceFileInfo {
100
100
StringRef FilePath;
101
- Fingerprint InterfaceHash = Fingerprint::ZERO();
101
+ // / Used for completion; factors in hashes from type-bodies in order to be sensitive to changes in
102
+ // / the intefaces of top-level type members.
103
+ Fingerprint InterfaceHashIncludingTypeMembers = Fingerprint::ZERO();
102
104
llvm::sys::TimePoint<> LastModified = {};
103
105
uint64_t FileSize = 0 ;
104
106
Original file line number Diff line number Diff line change @@ -1553,7 +1553,7 @@ Fingerprint ModuleDecl::getFingerprint() const {
1553
1553
StableHasher hasher = StableHasher::defaultHasher ();
1554
1554
SmallVector<Fingerprint, 16 > FPs;
1555
1555
collectBasicSourceFileInfo ([&](const BasicSourceFileInfo &bsfi) {
1556
- FPs.emplace_back (bsfi.InterfaceHash );
1556
+ FPs.emplace_back (bsfi.InterfaceHashIncludingTypeMembers );
1557
1557
});
1558
1558
1559
1559
// Sort the fingerprints lexicographically so we have a stable hash despite
Original file line number Diff line number Diff line change @@ -262,10 +262,10 @@ bool BasicSourceFileInfo::populate(const SourceFile *SF) {
262
262
FileSize = stat->getSize ();
263
263
264
264
if (SF->hasInterfaceHash ()) {
265
- InterfaceHash = SF->getInterfaceHashIncludingTypeMembers ();
265
+ InterfaceHashIncludingTypeMembers = SF->getInterfaceHashIncludingTypeMembers ();
266
266
} else {
267
267
// FIXME: Parse the file with EnableInterfaceHash option.
268
- InterfaceHash = Fingerprint::ZERO ();
268
+ InterfaceHashIncludingTypeMembers = Fingerprint::ZERO ();
269
269
}
270
270
271
271
return false ;
Original file line number Diff line number Diff line change @@ -974,7 +974,7 @@ void ModuleFile::collectBasicSourceFileInfo(
974
974
while (Cursor < End) {
975
975
// FilePath (byte offset in 'SourceLocsTextData').
976
976
auto fileID = endian::readNext<uint32_t , little, unaligned>(Cursor);
977
- // InterfaceHash (fixed length string).
977
+ // InterfaceHashIncludingTypeMembers (fixed length string).
978
978
auto fpStr = StringRef{reinterpret_cast <const char *>(Cursor),
979
979
Fingerprint::DIGEST_LENGTH};
980
980
Cursor += Fingerprint::DIGEST_LENGTH;
@@ -991,7 +991,7 @@ void ModuleFile::collectBasicSourceFileInfo(
991
991
BasicSourceFileInfo info;
992
992
info.FilePath = filePath;
993
993
if (auto fingerprint = Fingerprint::fromString (fpStr))
994
- info.InterfaceHash = fingerprint.getValue ();
994
+ info.InterfaceHashIncludingTypeMembers = fingerprint.getValue ();
995
995
else {
996
996
llvm::errs () << " Unconvertable fingerprint '" << fpStr << " '\n " ;
997
997
abort ();
Original file line number Diff line number Diff line change @@ -803,7 +803,7 @@ static void emitFileListRecord(llvm::BitstreamWriter &Out,
803
803
return ;
804
804
805
805
auto fileID = FWriter.getTextOffset (absolutePath);
806
- auto fingerprintStr = info.InterfaceHash .getRawValue ();
806
+ auto fingerprintStr = info.InterfaceHashIncludingTypeMembers .getRawValue ();
807
807
auto timestamp = std::chrono::duration_cast<std::chrono::nanoseconds>(
808
808
info.LastModified .time_since_epoch ())
809
809
.count ();
@@ -812,7 +812,7 @@ static void emitFileListRecord(llvm::BitstreamWriter &Out,
812
812
endian::Writer writer (out, little);
813
813
// FilePath.
814
814
writer.write <uint32_t >(fileID);
815
- // InterfaceHash (fixed length string).
815
+ // InterfaceHashIncludingTypeMembers (fixed length string).
816
816
assert (fingerprintStr.size () == Fingerprint::DIGEST_LENGTH);
817
817
out << fingerprintStr;
818
818
// LastModified (nanoseconds since epoch).
Original file line number Diff line number Diff line change @@ -2518,7 +2518,7 @@ static void printModuleMetadata(ModuleDecl *MD) {
2518
2518
});
2519
2519
MD->collectBasicSourceFileInfo ([&](const BasicSourceFileInfo &info) {
2520
2520
OS << " filepath=" << info.FilePath << " ; " ;
2521
- OS << " hash=" << info.InterfaceHash .getRawValue () << " ; " ;
2521
+ OS << " hash=" << info.InterfaceHashIncludingTypeMembers .getRawValue () << " ; " ;
2522
2522
OS << " mtime=" << info.LastModified << " ; " ;
2523
2523
OS << " size=" << info.FileSize ;
2524
2524
OS << " \n " ;
You can’t perform that action at this time.
0 commit comments