mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Replace llvm::MD5 with StableHasher
This commit is contained in:
@@ -1092,22 +1092,21 @@ Fingerprint SourceFile::getInterfaceHash() const {
|
||||
assert(hasInterfaceHash() && "Interface hash not enabled");
|
||||
auto &eval = getASTContext().evaluator;
|
||||
auto *mutableThis = const_cast<SourceFile *>(this);
|
||||
auto md5 = *evaluateOrDefault(eval, ParseSourceFileRequest{mutableThis}, {})
|
||||
.InterfaceHash;
|
||||
llvm::MD5::MD5Result result;
|
||||
md5.final(result);
|
||||
return Fingerprint{std::move(result)};
|
||||
Optional<StableHasher> interfaceHasher =
|
||||
evaluateOrDefault(eval, ParseSourceFileRequest{mutableThis}, {})
|
||||
.InterfaceHasher;
|
||||
return Fingerprint{StableHasher{interfaceHasher.getValue()}.finalize()};
|
||||
}
|
||||
|
||||
Fingerprint SourceFile::getInterfaceHashIncludingTypeMembers() const {
|
||||
/// FIXME: Gross. Hashing multiple "hash" values.
|
||||
llvm::MD5 hash;
|
||||
hash.update(getInterfaceHash().getRawValue());
|
||||
auto hash = StableHasher::defaultHasher();
|
||||
hash.combine(getInterfaceHash());
|
||||
|
||||
std::function<void(IterableDeclContext *)> hashTypeBodyFingerprints =
|
||||
[&](IterableDeclContext *IDC) {
|
||||
if (auto fp = IDC->getBodyFingerprint())
|
||||
hash.update(fp->getRawValue());
|
||||
hash.combine(*fp);
|
||||
for (auto *member : IDC->getParsedMembers())
|
||||
if (auto *childIDC = dyn_cast<IterableDeclContext>(member))
|
||||
hashTypeBodyFingerprints(childIDC);
|
||||
@@ -1118,9 +1117,7 @@ Fingerprint SourceFile::getInterfaceHashIncludingTypeMembers() const {
|
||||
hashTypeBodyFingerprints(IDC);
|
||||
}
|
||||
|
||||
llvm::MD5::MD5Result result;
|
||||
hash.final(result);
|
||||
return Fingerprint{std::move(result)};
|
||||
return Fingerprint{std::move(hash)};
|
||||
}
|
||||
|
||||
syntax::SourceFileSyntax SourceFile::getSyntaxRoot() const {
|
||||
|
||||
Reference in New Issue
Block a user