@@ -49,7 +49,7 @@ class SILCloner : protected SILInstructionVisitor<ImplClass> {
49
49
50
50
SILBuilder Builder;
51
51
DominanceInfo *DomTree = nullptr ;
52
- TypeSubstitutionMap OpenedExistentialSubs ;
52
+ TypeSubstitutionMap LocalArchetypeSubs ;
53
53
54
54
// The old-to-new value map.
55
55
llvm::DenseMap<SILValue, SILValue> ValueMap;
@@ -164,10 +164,10 @@ class SILCloner : protected SILInstructionVisitor<ImplClass> {
164
164
asImpl ().mapValue (origValue, mappedValue);
165
165
}
166
166
167
- // / Register a re-mapping for opened existentials.
168
- void registerOpenedExistentialRemapping (ArchetypeType *From,
169
- ArchetypeType *To) {
170
- auto result = OpenedExistentialSubs .insert (
167
+ // / Register a re-mapping for local archetypes such as opened existentials.
168
+ void registerLocalArchetypeRemapping (ArchetypeType *From,
169
+ ArchetypeType *To) {
170
+ auto result = LocalArchetypeSubs .insert (
171
171
std::make_pair (CanArchetypeType (From), CanType (To)));
172
172
assert (result.second );
173
173
(void )result;
@@ -189,15 +189,15 @@ class SILCloner : protected SILInstructionVisitor<ImplClass> {
189
189
}
190
190
191
191
SubstitutionMap getOpSubstitutionMap (SubstitutionMap Subs) {
192
- // If we have open existentials to substitute, check whether that's
192
+ // If we have local archetypes to substitute, check whether that's
193
193
// relevant to this particular substitution.
194
- if (!OpenedExistentialSubs .empty ()) {
194
+ if (!LocalArchetypeSubs .empty ()) {
195
195
for (auto ty : Subs.getReplacementTypes ()) {
196
- // If we found a type containing an opened existential , substitute
196
+ // If we found a type containing a local archetype , substitute
197
197
// open existentials throughout the substitution map.
198
- if (ty->hasOpenedExistential ()) {
198
+ if (ty->hasLocalArchetype ()) {
199
199
Subs = Subs.subst (QueryTypeSubstitutionMapOrIdentity{
200
- OpenedExistentialSubs },
200
+ LocalArchetypeSubs },
201
201
MakeAbstractConformanceForGenericType ());
202
202
break ;
203
203
}
@@ -209,19 +209,19 @@ class SILCloner : protected SILInstructionVisitor<ImplClass> {
209
209
210
210
SILType getTypeInClonedContext (SILType Ty) {
211
211
auto objectTy = Ty.getASTType ();
212
- // Do not substitute opened existential types , if we do not have any.
213
- if (!objectTy->hasOpenedExistential ())
212
+ // Do not substitute local archetypes , if we do not have any.
213
+ if (!objectTy->hasLocalArchetype ())
214
214
return Ty;
215
- // Do not substitute opened existential types , if it is not required.
215
+ // Do not substitute local archetypes , if it is not required.
216
216
// This is often the case when cloning basic blocks inside the same
217
217
// function.
218
- if (OpenedExistentialSubs .empty ())
218
+ if (LocalArchetypeSubs .empty ())
219
219
return Ty;
220
220
221
- // Substitute opened existential types , if we have any.
221
+ // Substitute local archetypes , if we have any.
222
222
return Ty.subst (
223
223
Builder.getModule (),
224
- QueryTypeSubstitutionMapOrIdentity{OpenedExistentialSubs },
224
+ QueryTypeSubstitutionMapOrIdentity{LocalArchetypeSubs },
225
225
MakeAbstractConformanceForGenericType ());
226
226
}
227
227
SILType getOpType (SILType Ty) {
@@ -230,17 +230,17 @@ class SILCloner : protected SILInstructionVisitor<ImplClass> {
230
230
}
231
231
232
232
CanType getASTTypeInClonedContext (Type ty) {
233
- // Do not substitute opened existential types , if we do not have any.
234
- if (!ty->hasOpenedExistential ())
233
+ // Do not substitute local archetypes , if we do not have any.
234
+ if (!ty->hasLocalArchetype ())
235
235
return ty->getCanonicalType ();
236
- // Do not substitute opened existential types , if it is not required.
236
+ // Do not substitute local archetypes , if it is not required.
237
237
// This is often the case when cloning basic blocks inside the same
238
238
// function.
239
- if (OpenedExistentialSubs .empty ())
239
+ if (LocalArchetypeSubs .empty ())
240
240
return ty->getCanonicalType ();
241
241
242
242
return ty.subst (
243
- QueryTypeSubstitutionMapOrIdentity{OpenedExistentialSubs },
243
+ QueryTypeSubstitutionMapOrIdentity{LocalArchetypeSubs },
244
244
MakeAbstractConformanceForGenericType ()
245
245
)->getCanonicalType ();
246
246
}
@@ -258,7 +258,7 @@ class SILCloner : protected SILInstructionVisitor<ImplClass> {
258
258
->getCanonicalType ();
259
259
auto substExistentialTy = getOpASTType (origExistentialTy);
260
260
auto replacementTy = OpenedArchetypeType::get (substExistentialTy, sig);
261
- registerOpenedExistentialRemapping (archetypeTy, replacementTy);
261
+ registerLocalArchetypeRemapping (archetypeTy, replacementTy);
262
262
}
263
263
264
264
// SILCloner will take care of debug scope on the instruction
@@ -273,12 +273,12 @@ class SILCloner : protected SILInstructionVisitor<ImplClass> {
273
273
274
274
ProtocolConformanceRef getOpConformance (Type ty,
275
275
ProtocolConformanceRef conformance) {
276
- // If we have open existentials to substitute, do so now.
277
- if (ty->hasOpenedExistential () && !OpenedExistentialSubs .empty ()) {
276
+ // If we have local archetypes to substitute, do so now.
277
+ if (ty->hasLocalArchetype () && !LocalArchetypeSubs .empty ()) {
278
278
conformance =
279
279
conformance.subst (ty,
280
280
QueryTypeSubstitutionMapOrIdentity{
281
- OpenedExistentialSubs },
281
+ LocalArchetypeSubs },
282
282
MakeAbstractConformanceForGenericType ());
283
283
}
284
284
0 commit comments