Skip to content

Commit 29904e7

Browse files
committed
[Gardening] Redocument The Interface Hash
1 parent 108bd50 commit 29904e7

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

include/swift/AST/SourceFile.h

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -520,12 +520,24 @@ class SourceFile final : public FileUnit {
520520
/// Set the root refinement context for the file.
521521
void setTypeRefinementContext(TypeRefinementContext *TRC);
522522

523-
/// Whether this file has an interface hash available.
523+
/// Whether this file can compute an interface hash.
524524
bool hasInterfaceHash() const {
525525
return ParsingOpts.contains(ParsingFlags::EnableInterfaceHash);
526526
}
527527

528-
/// Output this file's interface hash into the provided string buffer.
528+
/// Retrieve a fingerprint value that summarizes the declarations in this
529+
/// source file.
530+
///
531+
/// Note that the interface hash merely summarizes the top-level declarations
532+
/// in this file. Type body fingerprints are currently implemented such that
533+
/// they divert tokens away from the hasher used for fingerprints. That is,
534+
/// changes to the bodies of types and extensions will not result in a change
535+
/// to the interface hash.
536+
///
537+
/// In order for the interface hash to be enabled, this source file must be a
538+
/// primary and the compiler must be set in incremental mode. If this is not
539+
/// the case, this function will try to signal with an assert. It is useful
540+
/// to guard requests for the interface hash with \c hasInterfaceHash().
529541
Fingerprint getInterfaceHash() const;
530542

531543
void dumpInterfaceHash(llvm::raw_ostream &out) {

0 commit comments

Comments
 (0)