28
28
// arbitrary type, not just a type parameter, and recursively transfozms the
29
29
// type parameters it contains, if any.
30
30
//
31
- // Also, getConformanceAccessPath () is another one-off operation.
31
+ // Also, getConformancePath () is another one-off operation.
32
32
//
33
33
// ===----------------------------------------------------------------------===//
34
34
@@ -469,7 +469,7 @@ bool RequirementMachine::isValidTypeParameter(Type type) const {
469
469
return (prefix == term);
470
470
}
471
471
472
- // / Retrieve the conformance access path used to extract the conformance of
472
+ // / Retrieve the conformance path used to extract the conformance of
473
473
// / interface \c type to the given \c protocol.
474
474
// /
475
475
// / \param type The interface type whose conformance access path is to be
@@ -480,10 +480,10 @@ bool RequirementMachine::isValidTypeParameter(Type type) const {
480
480
// / this generic signature and ends at the conformance that makes \c type
481
481
// / conform to \c protocol.
482
482
// /
483
- // / \seealso ConformanceAccessPath
484
- ConformanceAccessPath
485
- RequirementMachine::getConformanceAccessPath (Type type,
486
- ProtocolDecl *protocol) {
483
+ // / \seealso ConformancePath
484
+ ConformancePath
485
+ RequirementMachine::getConformancePath (Type type,
486
+ ProtocolDecl *protocol) {
487
487
assert (type->isTypeParameter ());
488
488
489
489
auto mutTerm = Context.getMutableTermForType (type->getCanonicalType (),
@@ -505,9 +505,9 @@ RequirementMachine::getConformanceAccessPath(Type type,
505
505
auto term = Term::get (mutTerm, Context);
506
506
507
507
// Check if we've already cached the result before doing anything else.
508
- auto found = ConformanceAccessPaths .find (
508
+ auto found = ConformancePaths .find (
509
509
std::make_pair (term, protocol));
510
- if (found != ConformanceAccessPaths .end ()) {
510
+ if (found != ConformancePaths .end ()) {
511
511
return found->second ;
512
512
}
513
513
@@ -516,25 +516,25 @@ RequirementMachine::getConformanceAccessPath(Type type,
516
516
FrontendStatsTracer tracer (Stats, " get-conformance-access-path" );
517
517
518
518
auto recordPath = [&](Term term, ProtocolDecl *proto,
519
- ConformanceAccessPath path) {
519
+ ConformancePath path) {
520
520
// Add the path to the buffer.
521
- CurrentConformanceAccessPaths .emplace_back (term, path);
521
+ CurrentConformancePaths .emplace_back (term, path);
522
522
523
523
// Add the path to the map.
524
524
auto key = std::make_pair (term, proto);
525
- auto inserted = ConformanceAccessPaths .insert (
525
+ auto inserted = ConformancePaths .insert (
526
526
std::make_pair (key, path));
527
527
assert (inserted.second );
528
528
(void ) inserted;
529
529
530
530
if (Stats)
531
- ++Stats->getFrontendCounters ().NumConformanceAccessPathsRecorded ;
531
+ ++Stats->getFrontendCounters ().NumConformancePathsRecorded ;
532
532
};
533
533
534
534
// If this is the first time we're asked to look up a conformance access path,
535
535
// visit all of the root conformance requirements in our generic signature and
536
536
// add them to the buffer.
537
- if (ConformanceAccessPaths .empty ()) {
537
+ if (ConformancePaths .empty ()) {
538
538
for (const auto &req : Sig.getRequirements ()) {
539
539
// We only care about conformance requirements.
540
540
if (req.getKind () != RequirementKind::Conformance)
@@ -543,9 +543,9 @@ RequirementMachine::getConformanceAccessPath(Type type,
543
543
auto rootType = CanType (req.getFirstType ());
544
544
auto *rootProto = req.getProtocolDecl ();
545
545
546
- ConformanceAccessPath ::Entry root (rootType, rootProto);
547
- ArrayRef<ConformanceAccessPath ::Entry> path (root);
548
- ConformanceAccessPath result (ctx.AllocateCopy (path));
546
+ ConformancePath ::Entry root (rootType, rootProto);
547
+ ArrayRef<ConformancePath ::Entry> path (root);
548
+ ConformancePath result (ctx.AllocateCopy (path));
549
549
550
550
auto mutTerm = Context.getMutableTermForType (rootType, nullptr );
551
551
System.simplify (mutTerm);
@@ -555,17 +555,17 @@ RequirementMachine::getConformanceAccessPath(Type type,
555
555
}
556
556
}
557
557
558
- // We enumerate conformance access paths in shortlex order until we find the
558
+ // We enumerate conformance paths in shortlex order until we find the
559
559
// path whose corresponding type reduces to the one we are looking for.
560
560
while (true ) {
561
- auto found = ConformanceAccessPaths .find (
561
+ auto found = ConformancePaths .find (
562
562
std::make_pair (term, protocol));
563
- if (found != ConformanceAccessPaths .end ()) {
563
+ if (found != ConformancePaths .end ()) {
564
564
return found->second ;
565
565
}
566
566
567
- if (CurrentConformanceAccessPaths .empty ()) {
568
- llvm::errs () << " Failed to find conformance access path for " ;
567
+ if (CurrentConformancePaths .empty ()) {
568
+ llvm::errs () << " Failed to find conformance path for " ;
569
569
llvm::errs () << type << " (" << term << " )" << " : " ;
570
570
llvm::errs () << protocol->getName () << " :\n " ;
571
571
type.dump (llvm::errs ());
@@ -574,18 +574,18 @@ RequirementMachine::getConformanceAccessPath(Type type,
574
574
abort ();
575
575
}
576
576
577
- // The buffer consists of all conformance access paths of length N.
577
+ // The buffer consists of all conformance paths of length N.
578
578
// Swap it out with an empty buffer, and fill it with all paths of
579
579
// length N+1.
580
- std::vector<std::pair<Term, ConformanceAccessPath >> oldPaths;
581
- std::swap (CurrentConformanceAccessPaths , oldPaths);
580
+ std::vector<std::pair<Term, ConformancePath >> oldPaths;
581
+ std::swap (CurrentConformancePaths , oldPaths);
582
582
583
583
for (const auto &pair : oldPaths) {
584
584
const auto &lastElt = pair.second .back ();
585
585
auto *lastProto = lastElt.second ;
586
586
587
587
// A copy of the current path, populated as needed.
588
- SmallVector<ConformanceAccessPath ::Entry, 4 > entries;
588
+ SmallVector<ConformancePath ::Entry, 4 > entries;
589
589
590
590
auto reqs = lastProto->getRequirementSignature ().getRequirements ();
591
591
for (const auto &req : reqs) {
@@ -607,7 +607,7 @@ RequirementMachine::getConformanceAccessPath(Type type,
607
607
// don't add it to the buffer. Note that because we iterate over
608
608
// conformance access paths in shortlex order, the existing
609
609
// conformance access path is shorter than the one we found just now.
610
- if (ConformanceAccessPaths .count (
610
+ if (ConformancePaths .count (
611
611
std::make_pair (nextTerm, nextProto)))
612
612
continue ;
613
613
@@ -620,7 +620,7 @@ RequirementMachine::getConformanceAccessPath(Type type,
620
620
621
621
// Add the next entry.
622
622
entries.emplace_back (nextSubjectType, nextProto);
623
- ConformanceAccessPath result = ctx.AllocateCopy (entries);
623
+ ConformancePath result = ctx.AllocateCopy (entries);
624
624
entries.pop_back ();
625
625
626
626
recordPath (nextTerm, nextProto, result);
0 commit comments