@@ -32,7 +32,6 @@ namespace Mangle {
32
32
// / The mangler for AST declarations.
33
33
class ASTMangler : public Mangler {
34
34
protected:
35
- CanGenericSignature CurGenericSignature;
36
35
ModuleDecl *Mod = nullptr ;
37
36
38
37
// / Optimize out protocol names if a type only conforms to one protocol.
@@ -94,12 +93,12 @@ class ASTMangler : public Mangler {
94
93
ASTMangler (bool DWARFMangling = false )
95
94
: DWARFMangling(DWARFMangling) {}
96
95
97
- void addTypeSubstitution (Type type) {
98
- type = dropProtocolsFromAssociatedTypes (type);
96
+ void addTypeSubstitution (Type type, GenericSignature sig ) {
97
+ type = dropProtocolsFromAssociatedTypes (type, sig );
99
98
addSubstitution (type.getPointer ());
100
99
}
101
- bool tryMangleTypeSubstitution (Type type) {
102
- type = dropProtocolsFromAssociatedTypes (type);
100
+ bool tryMangleTypeSubstitution (Type type, GenericSignature sig ) {
101
+ type = dropProtocolsFromAssociatedTypes (type, sig );
103
102
return tryMangleSubstitution (type.getPointer ());
104
103
}
105
104
@@ -255,7 +254,7 @@ class ASTMangler : public Mangler {
255
254
std::string mangleObjCRuntimeName (const NominalTypeDecl *Nominal);
256
255
257
256
std::string mangleTypeWithoutPrefix (Type type) {
258
- appendType (type);
257
+ appendType (type, nullptr );
259
258
return finalize ();
260
259
}
261
260
@@ -293,18 +292,18 @@ class ASTMangler : public Mangler {
293
292
294
293
void appendSymbolKind (SymbolKind SKind);
295
294
296
- void appendType (Type type, const ValueDecl *forDecl = nullptr );
295
+ void appendType (Type type, GenericSignature sig,
296
+ const ValueDecl *forDecl = nullptr );
297
297
298
298
void appendDeclName (const ValueDecl *decl);
299
299
300
300
GenericTypeParamType *appendAssocType (DependentMemberType *DepTy,
301
+ GenericSignature sig,
301
302
bool &isAssocTypeAtDepth);
302
303
303
304
void appendOpWithGenericParamIndex (StringRef,
304
305
const GenericTypeParamType *paramTy);
305
306
306
- void bindGenericParameters (GenericSignature sig);
307
-
308
307
// / Mangles a sugared type iff we are mangling for the debugger.
309
308
template <class T > void appendSugaredType (Type type,
310
309
const ValueDecl *forDecl) {
@@ -314,25 +313,29 @@ class ASTMangler : public Mangler {
314
313
appendType (BlandTy, forDecl);
315
314
}
316
315
317
- void appendBoundGenericArgs (Type type, bool &isFirstArgList);
316
+ void appendBoundGenericArgs (Type type, GenericSignature sig,
317
+ bool &isFirstArgList);
318
318
319
319
// / Append the bound generics arguments for the given declaration context
320
320
// / based on a complete substitution map.
321
321
// /
322
322
// / \returns the number of generic parameters that were emitted
323
323
// / thus far.
324
324
unsigned appendBoundGenericArgs (DeclContext *dc,
325
+ GenericSignature sig,
325
326
SubstitutionMap subs,
326
327
bool &isFirstArgList);
327
328
328
329
// / Append the bound generic arguments as a flat list, disregarding depth.
329
- void appendFlatGenericArgs (SubstitutionMap subs);
330
+ void appendFlatGenericArgs (SubstitutionMap subs,
331
+ GenericSignature sig);
330
332
331
333
// / Append any retroactive conformances.
332
- void appendRetroactiveConformances (Type type);
334
+ void appendRetroactiveConformances (Type type, GenericSignature sig );
333
335
void appendRetroactiveConformances (SubstitutionMap subMap,
336
+ GenericSignature sig,
334
337
ModuleDecl *fromModule);
335
- void appendImplFunctionType (SILFunctionType *fn);
338
+ void appendImplFunctionType (SILFunctionType *fn, GenericSignature sig );
336
339
337
340
void appendContextOf (const ValueDecl *decl);
338
341
@@ -350,27 +353,33 @@ class ASTMangler : public Mangler {
350
353
FunctionMangling,
351
354
};
352
355
353
- void appendFunction (AnyFunctionType *fn,
356
+ void appendFunction (AnyFunctionType *fn, GenericSignature sig,
354
357
FunctionManglingKind functionMangling = NoFunctionMangling,
355
358
const ValueDecl *forDecl = nullptr );
356
- void appendFunctionType (AnyFunctionType *fn, bool isAutoClosure = false ,
359
+ void appendFunctionType (AnyFunctionType *fn, GenericSignature sig,
360
+ bool isAutoClosure = false ,
357
361
const ValueDecl *forDecl = nullptr );
358
362
void appendClangType (AnyFunctionType *fn);
359
363
template <typename FnType>
360
364
void appendClangType (FnType *fn, llvm::raw_svector_ostream &os);
361
365
362
366
void appendFunctionSignature (AnyFunctionType *fn,
367
+ GenericSignature sig,
363
368
const ValueDecl *forDecl,
364
369
FunctionManglingKind functionMangling);
365
370
366
371
void appendFunctionInputType (ArrayRef<AnyFunctionType::Param> params,
372
+ GenericSignature sig,
367
373
const ValueDecl *forDecl = nullptr );
368
374
void appendFunctionResultType (Type resultType,
375
+ GenericSignature sig,
369
376
const ValueDecl *forDecl = nullptr );
370
377
371
- void appendTypeList (Type listTy, const ValueDecl *forDecl = nullptr );
378
+ void appendTypeList (Type listTy, GenericSignature sig,
379
+ const ValueDecl *forDecl = nullptr );
372
380
void appendTypeListElement (Identifier name, Type elementType,
373
381
ParameterTypeFlags flags,
382
+ GenericSignature sig,
374
383
const ValueDecl *forDecl = nullptr );
375
384
376
385
// / Append a generic signature to the mangling.
@@ -385,16 +394,21 @@ class ASTMangler : public Mangler {
385
394
bool appendGenericSignature (GenericSignature sig,
386
395
GenericSignature contextSig = nullptr );
387
396
388
- void appendRequirement (const Requirement &reqt);
397
+ void appendRequirement (const Requirement &reqt,
398
+ GenericSignature sig);
389
399
390
- void appendGenericSignatureParts (ArrayRef<CanTypeWrapper<GenericTypeParamType>> params,
400
+ void appendGenericSignatureParts (GenericSignature sig,
401
+ ArrayRef<CanTypeWrapper<GenericTypeParamType>> params,
391
402
unsigned initialParamDepth,
392
403
ArrayRef<Requirement> requirements);
393
404
394
- DependentMemberType *dropProtocolFromAssociatedType (DependentMemberType *dmt);
395
- Type dropProtocolsFromAssociatedTypes (Type type);
405
+ DependentMemberType *dropProtocolFromAssociatedType (DependentMemberType *dmt,
406
+ GenericSignature sig);
407
+ Type dropProtocolsFromAssociatedTypes (Type type,
408
+ GenericSignature sig);
396
409
397
- void appendAssociatedTypeName (DependentMemberType *dmt);
410
+ void appendAssociatedTypeName (DependentMemberType *dmt,
411
+ GenericSignature sig);
398
412
399
413
void appendClosureEntity (const SerializedAbstractClosureExpr *closure);
400
414
@@ -437,12 +451,14 @@ class ASTMangler : public Mangler {
437
451
438
452
void appendProtocolConformance (const ProtocolConformance *conformance);
439
453
void appendProtocolConformanceRef (const RootProtocolConformance *conformance);
440
- void appendAnyProtocolConformance (CanGenericSignature genericSig,
454
+ void appendAnyProtocolConformance (GenericSignature genericSig,
441
455
CanType conformingType,
442
456
ProtocolConformanceRef conformance);
443
457
void appendConcreteProtocolConformance (
444
- const ProtocolConformance *conformance);
445
- void appendDependentProtocolConformance (const ConformanceAccessPath &path);
458
+ const ProtocolConformance *conformance,
459
+ GenericSignature sig);
460
+ void appendDependentProtocolConformance (const ConformanceAccessPath &path,
461
+ GenericSignature sig);
446
462
void appendOpParamForLayoutConstraint (LayoutConstraint Layout);
447
463
448
464
void appendSymbolicReference (SymbolicReferent referent);
0 commit comments