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