Skip to content

Commit cdd54f1

Browse files
committed
Unconditionally Record Type Body Fingerprints
We used to disable these for extensions, which meant changes to extensions would pessimistically cause every decl in the file to be considered dirty.
1 parent d65ab09 commit cdd54f1

File tree

3 files changed

+4
-15
lines changed

3 files changed

+4
-15
lines changed

include/swift/AST/DeclContext.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -873,8 +873,6 @@ class IterableDeclContext {
873873
/// available.
874874
Optional<std::string> getBodyFingerprint() const;
875875

876-
bool areTokensHashedForThisBodyInsteadOfInterfaceHash() const;
877-
878876
private:
879877
/// Add a member to the list for iteration purposes, but do not notify the
880878
/// subclass that we have done so.

lib/AST/DeclContext.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1022,11 +1022,6 @@ Optional<std::string> IterableDeclContext::getBodyFingerprint() const {
10221022
.fingerprint;
10231023
}
10241024

1025-
bool IterableDeclContext::areTokensHashedForThisBodyInsteadOfInterfaceHash()
1026-
const {
1027-
return true;
1028-
}
1029-
10301025
/// Return the DeclContext to compare when checking private access in
10311026
/// Swift 4 mode. The context returned is the type declaration if the context
10321027
/// and the type declaration are in the same file, otherwise it is the types

lib/Parse/ParseDecl.cpp

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4765,12 +4765,9 @@ Parser::parseDeclList(SourceLoc LBLoc, SourceLoc &RBLoc, Diag<> ErrorDiag,
47654765

47664766
// If we're hashing the type body separately, record the curly braces but
47674767
// nothing inside for the interface hash.
4768-
Optional<llvm::SaveAndRestore<Optional<llvm::MD5>>> MemberHashingScope;
4769-
if (IDC->areTokensHashedForThisBodyInsteadOfInterfaceHash()) {
4770-
recordTokenHash("{");
4771-
recordTokenHash("}");
4772-
MemberHashingScope.emplace(CurrentTokenHash, llvm::MD5());
4773-
}
4768+
llvm::SaveAndRestore<Optional<llvm::MD5>> MemberHashingScope{CurrentTokenHash, llvm::MD5()};
4769+
recordTokenHash("{");
4770+
recordTokenHash("}");
47744771

47754772
std::vector<Decl *> decls;
47764773
ParserStatus Status;
@@ -4802,8 +4799,7 @@ Parser::parseDeclList(SourceLoc LBLoc, SourceLoc &RBLoc, Diag<> ErrorDiag,
48024799
hadError = true;
48034800

48044801
llvm::MD5::MD5Result result;
4805-
auto declListHash = MemberHashingScope ? *CurrentTokenHash : llvm::MD5();
4806-
declListHash.final(result);
4802+
CurrentTokenHash->final(result);
48074803
llvm::SmallString<32> tokenHashString;
48084804
llvm::MD5::stringifyResult(result, tokenHashString);
48094805
return std::make_pair(decls, tokenHashString.str().str());

0 commit comments

Comments
 (0)