@@ -444,8 +444,8 @@ void RuleBuilder::addReferencedProtocol(const ProtocolDecl *proto) {
444444}
445445
446446// / 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 .
449449void RuleBuilder::collectRulesFromReferencedProtocols () {
450450 // Compute the transitive closure.
451451 unsigned i = 0 ;
@@ -462,12 +462,9 @@ void RuleBuilder::collectRulesFromReferencedProtocols() {
462462 // if this is a rewrite system for a connected component of the protocol
463463 // dependency graph, add rewrite rules for each referenced protocol not part
464464 // of this connected component.
465-
466- // First, collect all unique requirement machines, one for each connected
467- // component of each referenced protocol.
468465 llvm::DenseSet<RequirementMachine *> machines;
469466
470- // Now visit each subordinate requirement machine pull in its rules.
467+ // Now visit each protocol component requirement machine and pull in its rules.
471468 for (auto *proto : ProtocolsToImport) {
472469 // This will trigger requirement signature computation for this protocol,
473470 // if necessary, which will cause us to re-enter into a new RuleBuilder
@@ -478,13 +475,13 @@ void RuleBuilder::collectRulesFromReferencedProtocols() {
478475
479476 auto *machine = Context.getRequirementMachine (proto);
480477 if (!machines.insert (machine).second ) {
481- // We've already seen this connected component.
478+ // We've already seen this protocol component.
482479 continue ;
483480 }
484481
485482 // We grab the machine's local rules, not *all* of its rules, to avoid
486483 // duplicates in case multiple machines share a dependency on a downstream
487- // protocol connected component.
484+ // protocol component.
488485 auto localRules = machine->getLocalRules ();
489486 ImportedRules.insert (ImportedRules.end (),
490487 localRules.begin (),
0 commit comments