@@ -2688,21 +2688,21 @@ void irgen::emitPolymorphicParametersFromArray(IRGenFunction &IGF,
2688
2688
2689
2689
Size NecessaryBindings::getBufferSize (IRGenModule &IGM) const {
2690
2690
// We need one pointer for each archetype or witness table.
2691
- return IGM.getPointerSize () * Requirements. size ();
2691
+ return IGM.getPointerSize () * size ();
2692
2692
}
2693
2693
2694
2694
void NecessaryBindings::restore (IRGenFunction &IGF, Address buffer,
2695
2695
MetadataState metadataState) const {
2696
- bindFromGenericRequirementsBuffer (IGF, Requirements. getArrayRef (), buffer,
2696
+ bindFromGenericRequirementsBuffer (IGF, getRequirements (), buffer,
2697
2697
metadataState,
2698
- [&](CanType type) { return type;});
2698
+ [&](CanType type) { return type; });
2699
2699
}
2700
2700
2701
2701
template <typename Transform>
2702
2702
static void save (const NecessaryBindings &bindings, IRGenFunction &IGF,
2703
2703
Address buffer, Transform transform) {
2704
2704
emitInitOfGenericRequirementsBuffer (
2705
- IGF, bindings.getRequirements (). getArrayRef () , buffer,
2705
+ IGF, bindings.getRequirements (), buffer,
2706
2706
[&](GenericRequirement requirement) -> llvm::Value * {
2707
2707
CanType type = requirement.TypeParameter ;
2708
2708
if (auto protocol = requirement.Protocol ) {
@@ -2770,14 +2770,13 @@ void NecessaryBindings::addTypeMetadata(CanType type) {
2770
2770
// Generic types are trickier, because they can require conformances.
2771
2771
2772
2772
// Otherwise, just record the need for this metadata.
2773
- Requirements. insert ({type, nullptr });
2773
+ addRequirement ({type, nullptr });
2774
2774
}
2775
2775
2776
2776
// / Add all the abstract conditional conformances in the specialized
2777
2777
// / conformance to the \p requirements.
2778
- static void addAbstractConditionalRequirements (
2779
- SpecializedProtocolConformance *specializedConformance,
2780
- llvm::SetVector<GenericRequirement> &requirements) {
2778
+ void NecessaryBindings::addAbstractConditionalRequirements (
2779
+ SpecializedProtocolConformance *specializedConformance) {
2781
2780
auto subMap = specializedConformance->getSubstitutionMap ();
2782
2781
auto condRequirements = specializedConformance->getConditionalRequirements ();
2783
2782
for (auto req : condRequirements) {
@@ -2789,7 +2788,7 @@ static void addAbstractConditionalRequirements(
2789
2788
auto archetype = dyn_cast<ArchetypeType>(ty);
2790
2789
if (!archetype)
2791
2790
continue ;
2792
- requirements. insert ({ty, proto});
2791
+ addRequirement ({ty, proto});
2793
2792
}
2794
2793
// Recursively add conditional requirements.
2795
2794
for (auto &conf : subMap.getConformances ()) {
@@ -2799,7 +2798,7 @@ static void addAbstractConditionalRequirements(
2799
2798
dyn_cast<SpecializedProtocolConformance>(conf.getConcrete ());
2800
2799
if (!specializedConf)
2801
2800
continue ;
2802
- addAbstractConditionalRequirements (specializedConf, requirements );
2801
+ addAbstractConditionalRequirements (specializedConf);
2803
2802
}
2804
2803
}
2805
2804
@@ -2811,8 +2810,8 @@ void NecessaryBindings::addProtocolConformance(CanType type,
2811
2810
dyn_cast<SpecializedProtocolConformance>(concreteConformance);
2812
2811
// The partial apply forwarder does not have the context to reconstruct
2813
2812
// abstract conditional conformance requirements.
2814
- if (forPartialApply && specializedConf) {
2815
- addAbstractConditionalRequirements (specializedConf, Requirements );
2813
+ if (forPartialApply () && specializedConf) {
2814
+ addAbstractConditionalRequirements (specializedConf);
2816
2815
} else if (forAsyncFunction ()) {
2817
2816
ProtocolDecl *protocol = conf.getRequirement ();
2818
2817
GenericRequirement requirement;
@@ -2821,15 +2820,15 @@ void NecessaryBindings::addProtocolConformance(CanType type,
2821
2820
std::pair<GenericRequirement, ProtocolConformanceRef> pair{requirement,
2822
2821
conf};
2823
2822
Conformances.insert (pair);
2824
- Requirements. insert ({type, concreteConformance->getProtocol ()});
2823
+ addRequirement ({type, concreteConformance->getProtocol ()});
2825
2824
}
2826
2825
return ;
2827
2826
}
2828
2827
assert (isa<ArchetypeType>(type) || forAsyncFunction ());
2829
2828
2830
2829
// TODO: pass something about the root conformance necessary to
2831
2830
// reconstruct this.
2832
- Requirements. insert ({type, conf.getAbstract ()});
2831
+ addRequirement ({type, conf.getAbstract ()});
2833
2832
}
2834
2833
2835
2834
llvm::Value *irgen::emitWitnessTableRef (IRGenFunction &IGF,
@@ -3033,7 +3032,8 @@ NecessaryBindings NecessaryBindings::computeBindings(
3033
3032
bool forPartialApplyForwarder, bool considerParameterSources) {
3034
3033
3035
3034
NecessaryBindings bindings;
3036
- bindings.forPartialApply = forPartialApplyForwarder;
3035
+ bindings.kind =
3036
+ forPartialApplyForwarder ? Kind::PartialApply : Kind::AsyncFunction;
3037
3037
3038
3038
// Bail out early if we don't have polymorphic parameters.
3039
3039
if (!hasPolymorphicParameters (origType))
0 commit comments