Skip to content

Commit 62555ec

Browse files
committed
Drop Cascading Users from FrontendSourceFileDepGraphFactory's Modeling
The final set of edges that were being registered cascading were external edges. Just mark these all private - they're duplicated into the swiftdeps for each file that imports a given (usually clang) module anyways.
1 parent 4d875ee commit 62555ec

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

lib/AST/FrontendSourceFileDepGraphFactory.cpp

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -579,7 +579,6 @@ class UsedDeclEnumerator {
579579
void enumerateAllUses() {
580580
auto &Ctx = SF->getASTContext();
581581
Ctx.evaluator.enumerateReferencesInFile(SF, [&](const auto &ref) {
582-
const auto cascades = false;
583582
std::string name = ref.name.userFacingName().str();
584583
const auto *nominal = ref.subject;
585584
using Kind = evaluator::DependencyCollector::Reference::Kind;
@@ -589,19 +588,19 @@ class UsedDeclEnumerator {
589588
case Kind::Tombstone:
590589
llvm_unreachable("Cannot enumerate dead reference!");
591590
case Kind::TopLevel:
592-
return enumerateUse<NodeKind::topLevel>("", name, cascades);
591+
return enumerateUse<NodeKind::topLevel>("", name);
593592
case Kind::Dynamic:
594-
return enumerateUse<NodeKind::dynamicLookup>("", name, cascades);
593+
return enumerateUse<NodeKind::dynamicLookup>("", name);
595594
case Kind::PotentialMember: {
596595
std::string context = DependencyKey::computeContextForProvidedEntity<
597596
NodeKind::potentialMember>(nominal);
598-
return enumerateUse<NodeKind::potentialMember>(context, "", cascades);
597+
return enumerateUse<NodeKind::potentialMember>(context, "");
599598
}
600599
case Kind::UsedMember: {
601600
std::string context =
602601
DependencyKey::computeContextForProvidedEntity<NodeKind::member>(
603602
nominal);
604-
return enumerateUse<NodeKind::member>(context, name, cascades);
603+
return enumerateUse<NodeKind::member>(context, name);
605604
}
606605
}
607606
});
@@ -611,11 +610,11 @@ class UsedDeclEnumerator {
611610

612611
private:
613612
template <NodeKind kind>
614-
void enumerateUse(StringRef context, StringRef name, bool isCascadingUse) {
613+
void enumerateUse(StringRef context, StringRef name) {
615614
// Assume that what is depended-upon is the interface
616615
createDefUse(
617616
DependencyKey(kind, DeclAspect::interface, context.str(), name.str()),
618-
isCascadingUse ? sourceFileInterface : sourceFileImplementation);
617+
sourceFileImplementation);
619618
}
620619

621620
void enumerateNominalUses() {
@@ -634,14 +633,13 @@ class UsedDeclEnumerator {
634633
std::string context =
635634
DependencyKey::computeContextForProvidedEntity<NodeKind::nominal>(
636635
subject);
637-
enumerateUse<NodeKind::nominal>(context, "", /*isCascadingUse*/ false);
636+
enumerateUse<NodeKind::nominal>(context, "");
638637
});
639638
}
640639

641640
void enumerateExternalUses() {
642-
// external dependencies always cascade
643641
for (StringRef s : depTracker.getDependencies())
644-
enumerateUse<NodeKind::externalDepend>("", s, true);
642+
enumerateUse<NodeKind::externalDepend>("", s);
645643
}
646644
};
647645
} // end namespace

0 commit comments

Comments
 (0)