Skip to content

Commit c86ce64

Browse files
committed
IRGen: Small cleanup
1 parent a62ab69 commit c86ce64

File tree

1 file changed

+4
-14
lines changed

1 file changed

+4
-14
lines changed

lib/IRGen/GenProto.cpp

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -157,8 +157,6 @@ class PolymorphicConvention {
157157
}
158158

159159
private:
160-
void initGenerics();
161-
162160
template <typename ...Args>
163161
void considerNewTypeSource(IsExact_t isExact, MetadataSource::Kind kind,
164162
CanType type, Args... args);
@@ -213,9 +211,8 @@ class PolymorphicConvention {
213211
PolymorphicConvention::PolymorphicConvention(IRGenModule &IGM,
214212
CanSILFunctionType fnType,
215213
bool considerParameterSources = true)
216-
: IGM(IGM), M(*IGM.getSwiftModule()), FnType(fnType){
217-
initGenerics();
218-
214+
: IGM(IGM), M(*IGM.getSwiftModule()), FnType(fnType),
215+
Generics(fnType->getInvocationGenericSignature()) {
219216
auto rep = fnType->getRepresentation();
220217

221218
if (fnType->isPseudogeneric()) {
@@ -263,11 +260,8 @@ PolymorphicConvention::PolymorphicConvention(IRGenModule &IGM,
263260

264261
void PolymorphicConvention::addPseudogenericFulfillments() {
265262
enumerateRequirements([&](GenericRequirement reqt) {
266-
auto archetype = Generics.getGenericEnvironment()
267-
->mapTypeIntoContext(reqt.getTypeParameter())
268-
->getAs<ArchetypeType>();
269-
assert(archetype && "did not get an archetype by mapping param?");
270-
auto erasedTypeParam = archetype->getExistentialType()->getCanonicalType();
263+
auto erasedTypeParam = Generics->getExistentialType(reqt.getTypeParameter())
264+
->getCanonicalType();
271265
Sources.emplace_back(MetadataSource::Kind::ErasedTypeMetadata,
272266
reqt.getTypeParameter(), erasedTypeParam);
273267

@@ -333,10 +327,6 @@ enumerateUnfulfilledRequirements(const RequirementCallback &callback) {
333327
});
334328
}
335329

336-
void PolymorphicConvention::initGenerics() {
337-
Generics = FnType->getInvocationGenericSignature();
338-
}
339-
340330
template <typename ...Args>
341331
void PolymorphicConvention::considerNewTypeSource(IsExact_t isExact,
342332
MetadataSource::Kind kind,

0 commit comments

Comments
 (0)