@@ -2690,21 +2690,21 @@ void irgen::emitPolymorphicParametersFromArray(IRGenFunction &IGF,
26902690
26912691Size NecessaryBindings::getBufferSize (IRGenModule &IGM) const {
26922692 // We need one pointer for each archetype or witness table.
2693- return IGM.getPointerSize () * Requirements. size ();
2693+ return IGM.getPointerSize () * size ();
26942694}
26952695
26962696void NecessaryBindings::restore (IRGenFunction &IGF, Address buffer,
26972697 MetadataState metadataState) const {
2698- bindFromGenericRequirementsBuffer (IGF, Requirements. getArrayRef (), buffer,
2698+ bindFromGenericRequirementsBuffer (IGF, getRequirements (), buffer,
26992699 metadataState,
2700- [&](CanType type) { return type;});
2700+ [&](CanType type) { return type; });
27012701}
27022702
27032703template <typename Transform>
27042704static void save (const NecessaryBindings &bindings, IRGenFunction &IGF,
27052705 Address buffer, Transform transform) {
27062706 emitInitOfGenericRequirementsBuffer (
2707- IGF, bindings.getRequirements (). getArrayRef () , buffer,
2707+ IGF, bindings.getRequirements (), buffer,
27082708 [&](GenericRequirement requirement) -> llvm::Value * {
27092709 CanType type = requirement.TypeParameter ;
27102710 if (auto protocol = requirement.Protocol ) {
@@ -2772,14 +2772,13 @@ void NecessaryBindings::addTypeMetadata(CanType type) {
27722772 // Generic types are trickier, because they can require conformances.
27732773
27742774 // Otherwise, just record the need for this metadata.
2775- Requirements. insert ({type, nullptr });
2775+ addRequirement ({type, nullptr });
27762776}
27772777
27782778// / Add all the abstract conditional conformances in the specialized
27792779// / conformance to the \p requirements.
2780- static void addAbstractConditionalRequirements (
2781- SpecializedProtocolConformance *specializedConformance,
2782- llvm::SetVector<GenericRequirement> &requirements) {
2780+ void NecessaryBindings::addAbstractConditionalRequirements (
2781+ SpecializedProtocolConformance *specializedConformance) {
27832782 auto subMap = specializedConformance->getSubstitutionMap ();
27842783 auto condRequirements = specializedConformance->getConditionalRequirements ();
27852784 for (auto req : condRequirements) {
@@ -2791,7 +2790,7 @@ static void addAbstractConditionalRequirements(
27912790 auto archetype = dyn_cast<ArchetypeType>(ty);
27922791 if (!archetype)
27932792 continue ;
2794- requirements. insert ({ty, proto});
2793+ addRequirement ({ty, proto});
27952794 }
27962795 // Recursively add conditional requirements.
27972796 for (auto &conf : subMap.getConformances ()) {
@@ -2801,7 +2800,7 @@ static void addAbstractConditionalRequirements(
28012800 dyn_cast<SpecializedProtocolConformance>(conf.getConcrete ());
28022801 if (!specializedConf)
28032802 continue ;
2804- addAbstractConditionalRequirements (specializedConf, requirements );
2803+ addAbstractConditionalRequirements (specializedConf);
28052804 }
28062805}
28072806
@@ -2813,8 +2812,8 @@ void NecessaryBindings::addProtocolConformance(CanType type,
28132812 dyn_cast<SpecializedProtocolConformance>(concreteConformance);
28142813 // The partial apply forwarder does not have the context to reconstruct
28152814 // abstract conditional conformance requirements.
2816- if (forPartialApply && specializedConf) {
2817- addAbstractConditionalRequirements (specializedConf, Requirements );
2815+ if (forPartialApply () && specializedConf) {
2816+ addAbstractConditionalRequirements (specializedConf);
28182817 } else if (forAsyncFunction ()) {
28192818 ProtocolDecl *protocol = conf.getRequirement ();
28202819 GenericRequirement requirement;
@@ -2823,15 +2822,15 @@ void NecessaryBindings::addProtocolConformance(CanType type,
28232822 std::pair<GenericRequirement, ProtocolConformanceRef> pair{requirement,
28242823 conf};
28252824 Conformances.insert (pair);
2826- Requirements. insert ({type, concreteConformance->getProtocol ()});
2825+ addRequirement ({type, concreteConformance->getProtocol ()});
28272826 }
28282827 return ;
28292828 }
28302829 assert (isa<ArchetypeType>(type) || forAsyncFunction ());
28312830
28322831 // TODO: pass something about the root conformance necessary to
28332832 // reconstruct this.
2834- Requirements. insert ({type, conf.getAbstract ()});
2833+ addRequirement ({type, conf.getAbstract ()});
28352834}
28362835
28372836llvm::Value *irgen::emitWitnessTableRef (IRGenFunction &IGF,
@@ -3035,7 +3034,8 @@ NecessaryBindings NecessaryBindings::computeBindings(
30353034 bool forPartialApplyForwarder, bool considerParameterSources) {
30363035
30373036 NecessaryBindings bindings;
3038- bindings.forPartialApply = forPartialApplyForwarder;
3037+ bindings.kind =
3038+ forPartialApplyForwarder ? Kind::PartialApply : Kind::AsyncFunction;
30393039
30403040 // Bail out early if we don't have polymorphic parameters.
30413041 if (!hasPolymorphicParameters (origType))
0 commit comments