@@ -444,8 +444,8 @@ void RuleBuilder::addReferencedProtocol(const ProtocolDecl *proto) {
444
444
}
445
445
446
446
// / Compute the transitive closure of the set of all protocols referenced from
447
- // / the right hand sides of conformance requirements, and convert their
448
- // / requirements to rewrite rules .
447
+ // / the right hand sides of conformance requirements, and import the rewrite
448
+ // / rules from the requirement machine for each protocol component .
449
449
void RuleBuilder::collectRulesFromReferencedProtocols () {
450
450
// Compute the transitive closure.
451
451
unsigned i = 0 ;
@@ -462,12 +462,9 @@ void RuleBuilder::collectRulesFromReferencedProtocols() {
462
462
// if this is a rewrite system for a connected component of the protocol
463
463
// dependency graph, add rewrite rules for each referenced protocol not part
464
464
// of this connected component.
465
-
466
- // First, collect all unique requirement machines, one for each connected
467
- // component of each referenced protocol.
468
465
llvm::DenseSet<RequirementMachine *> machines;
469
466
470
- // Now visit each subordinate requirement machine pull in its rules.
467
+ // Now visit each protocol component requirement machine and pull in its rules.
471
468
for (auto *proto : ProtocolsToImport) {
472
469
// This will trigger requirement signature computation for this protocol,
473
470
// if necessary, which will cause us to re-enter into a new RuleBuilder
@@ -478,13 +475,13 @@ void RuleBuilder::collectRulesFromReferencedProtocols() {
478
475
479
476
auto *machine = Context.getRequirementMachine (proto);
480
477
if (!machines.insert (machine).second ) {
481
- // We've already seen this connected component.
478
+ // We've already seen this protocol component.
482
479
continue ;
483
480
}
484
481
485
482
// We grab the machine's local rules, not *all* of its rules, to avoid
486
483
// duplicates in case multiple machines share a dependency on a downstream
487
- // protocol connected component.
484
+ // protocol component.
488
485
auto localRules = machine->getLocalRules ();
489
486
ImportedRules.insert (ImportedRules.end (),
490
487
localRules.begin (),
0 commit comments