@@ -444,13 +444,18 @@ class NormalProtocolConformance : public RootProtocolConformance,
444
444
445
445
// / The conformance was labeled with @unchecked.
446
446
UncheckedFlag = 0x02 ,
447
+
448
+ // / We have allocated the AssociatedConformances array (but not necessarily
449
+ // / populated any of its elements).
450
+ HasComputedAssociatedConformancesFlag = 0x04 ,
447
451
};
448
452
449
453
// / The declaration context containing the ExtensionDecl or
450
454
// / NominalTypeDecl that declared the conformance.
451
455
// /
452
- // / Also stores the "invalid" and "unchecked" bits.
453
- llvm::PointerIntPair<DeclContext *, 2 , unsigned > ContextAndBits;
456
+ // / Also stores the "invalid", "unchecked" and "has computed associated
457
+ // / conformances" bits.
458
+ llvm::PointerIntPair<DeclContext *, 3 , unsigned > ContextAndBits;
454
459
455
460
// / The reason that this conformance exists.
456
461
// /
@@ -554,6 +559,17 @@ class NormalProtocolConformance : public RootProtocolConformance,
554
559
ContextAndBits.setInt (ContextAndBits.getInt () | UncheckedFlag);
555
560
}
556
561
562
+ // / Determine whether we've lazily computed the associated conformance array
563
+ // / already.
564
+ bool hasComputedAssociatedConformances () const {
565
+ return ContextAndBits.getInt () & HasComputedAssociatedConformancesFlag;
566
+ }
567
+
568
+ // / Mark this conformance as having computed the assocaited conformance array.
569
+ void setHasComputedAssociatedConformances () {
570
+ ContextAndBits.setInt (ContextAndBits.getInt () | HasComputedAssociatedConformancesFlag);
571
+ }
572
+
557
573
// / Get the kind of source from which this conformance comes.
558
574
ConformanceEntryKind getSourceKind () const {
559
575
return SourceKindAndImplyingConformance.getInt ();
0 commit comments