Skip to content

Commit f677d19

Browse files
authored
Merge pull request #34700 from CodaFi/time-extended!
Unconditionally Record Type Body Fingerprints
2 parents ce218b3 + cdd54f1 commit f677d19

File tree

4 files changed

+5
-21
lines changed

4 files changed

+5
-21
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 & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1022,16 +1022,6 @@ Optional<std::string> IterableDeclContext::getBodyFingerprint() const {
10221022
.fingerprint;
10231023
}
10241024

1025-
bool IterableDeclContext::areTokensHashedForThisBodyInsteadOfInterfaceHash()
1026-
const {
1027-
// Do not keep separate hashes for extension bodies because the dependencies
1028-
// can miss the addition of a member in an extension because there is nothing
1029-
// corresponding to the fingerprinted nominal dependency node.
1030-
if (isa<ExtensionDecl>(this))
1031-
return false;
1032-
return true;
1033-
}
1034-
10351025
/// Return the DeclContext to compare when checking private access in
10361026
/// Swift 4 mode. The context returned is the type declaration if the context
10371027
/// 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());

test/Incremental/Fingerprints/Inputs/extension-adds-member/definesAB-after.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ struct A {
33
struct B {
44
}
55
extension A {
6-
var x: Int {17}
6+
init(_ x: String = "") {}
77
}
88
extension B {
99
}

0 commit comments

Comments
 (0)