@@ -229,6 +229,13 @@ std::string FrontendSourceFileDepGraphFactory::getFingerprint(SourceFile *SF) {
229229 return getInterfaceHash (SF);
230230}
231231
232+ std::string
233+ FrontendSourceFileDepGraphFactory::getInterfaceHash (SourceFile *SF) {
234+ llvm::SmallString<32 > interfaceHash;
235+ SF->getInterfaceHash (interfaceHash);
236+ return interfaceHash.str ().str ();
237+ }
238+
232239// ==============================================================================
233240// MARK: FrontendSourceFileDepGraphFactory - adding collections of defined Decls
234241// ==============================================================================
@@ -407,7 +414,8 @@ template <NodeKind kind, typename ContentsT>
407414void FrontendSourceFileDepGraphFactory::addAllDefinedDeclsOfAGivenType (
408415 std::vector<ContentsT> &contentsVec) {
409416 for (const auto &declOrPair : contentsVec) {
410- Optional<std::string> fp = getFingerprintIfAny (declOrPair);
417+ Optional<std::string> fp =
418+ AbstractSourceFileDepGraphFactory::getFingerprintIfAny (declOrPair);
411419 addADefinedDecl (
412420 DependencyKey::createForProvidedEntityInterface<kind>(declOrPair),
413421 fp ? StringRef (fp.getValue ()) : Optional<StringRef>());
@@ -519,33 +527,6 @@ void FrontendSourceFileDepGraphFactory::addAllUsedDecls() {
519527 .enumerateAllUses ();
520528}
521529
522- // ==============================================================================
523- // MARK: FrontendSourceFileDepGraphFactory - adding individual defined Decls
524- // ==============================================================================
525-
526- std::string
527- FrontendSourceFileDepGraphFactory::getInterfaceHash (SourceFile *SF) {
528- llvm::SmallString<32 > interfaceHash;
529- SF->getInterfaceHash (interfaceHash);
530- return interfaceHash.str ().str ();
531- }
532-
533- // / At present, only \c NominalTypeDecls have (body) fingerprints
534- Optional<std::string> FrontendSourceFileDepGraphFactory::getFingerprintIfAny (
535- std::pair<const NominalTypeDecl *, const ValueDecl *>) {
536- return None;
537- }
538- Optional<std::string>
539- FrontendSourceFileDepGraphFactory::getFingerprintIfAny (const Decl *d) {
540- if (const auto *idc = dyn_cast<IterableDeclContext>(d)) {
541- auto result = idc->getBodyFingerprint ();
542- assert ((!result || !result->empty ()) &&
543- " Fingerprint should never be empty" );
544- return result;
545- }
546- return None;
547- }
548-
549530// ==============================================================================
550531// MARK: ModuleDepGraphFactory
551532// ==============================================================================
@@ -591,29 +572,10 @@ template <NodeKind kind, typename ContentsT>
591572void ModuleDepGraphFactory::addAllDefinedDeclsOfAGivenType (
592573 std::vector<ContentsT> &contentsVec) {
593574 for (const auto &declOrPair : contentsVec) {
594- Optional<std::string> fp = getFingerprintIfAny (declOrPair);
575+ Optional<std::string> fp =
576+ AbstractSourceFileDepGraphFactory::getFingerprintIfAny (declOrPair);
595577 addADefinedDecl (
596578 DependencyKey::createForProvidedEntityInterface<kind>(declOrPair),
597579 fp ? StringRef (fp.getValue ()) : Optional<StringRef>());
598580 }
599581}
600-
601- // ==============================================================================
602- // MARK: ModuleDepGraphFactory - adding individual defined Decls
603- // ==============================================================================
604-
605- // / At present, only \c NominalTypeDecls have (body) fingerprints
606- Optional<std::string> ModuleDepGraphFactory::getFingerprintIfAny (
607- std::pair<const NominalTypeDecl *, const ValueDecl *>) {
608- return None;
609- }
610- Optional<std::string>
611- ModuleDepGraphFactory::getFingerprintIfAny (const Decl *d) {
612- if (const auto *idc = dyn_cast<IterableDeclContext>(d)) {
613- auto result = idc->getBodyFingerprint ();
614- assert ((!result || !result->empty ()) &&
615- " Fingerprint should never be empty" );
616- return result;
617- }
618- return None;
619- }
0 commit comments