@@ -244,7 +244,7 @@ class SILType {
244
244
// / tc.getTypeLowering(type).isAddressOnly().
245
245
static bool isAddressOnly (CanType type, Lowering::TypeConverter &tc,
246
246
CanGenericSignature sig,
247
- ResilienceExpansion expansion);
247
+ TypeExpansionContext expansion);
248
248
249
249
// / Return true if this type must be returned indirectly.
250
250
// /
@@ -253,7 +253,7 @@ class SILType {
253
253
static bool isFormallyReturnedIndirectly (CanType type,
254
254
Lowering::TypeConverter &tc,
255
255
CanGenericSignature sig) {
256
- return isAddressOnly (type, tc, sig, ResilienceExpansion::Minimal );
256
+ return isAddressOnly (type, tc, sig, TypeExpansionContext::minimal () );
257
257
}
258
258
259
259
// / Return true if this type must be passed indirectly.
@@ -263,7 +263,7 @@ class SILType {
263
263
static bool isFormallyPassedIndirectly (CanType type,
264
264
Lowering::TypeConverter &tc,
265
265
CanGenericSignature sig) {
266
- return isAddressOnly (type, tc, sig, ResilienceExpansion::Minimal );
266
+ return isAddressOnly (type, tc, sig, TypeExpansionContext::minimal () );
267
267
}
268
268
269
269
// / True if the type, or the referenced type of an address type, is loadable.
@@ -411,16 +411,20 @@ class SILType {
411
411
// / the given field. Applies substitutions as necessary. The
412
412
// / result will be an address type if the base type is an address
413
413
// / type or a class.
414
- SILType getFieldType (VarDecl *field, Lowering::TypeConverter &TC) const ;
414
+ SILType getFieldType (VarDecl *field, Lowering::TypeConverter &TC,
415
+ TypeExpansionContext context) const ;
415
416
416
- SILType getFieldType (VarDecl *field, SILModule &M) const ;
417
+ SILType getFieldType (VarDecl *field, SILModule &M,
418
+ TypeExpansionContext context) const ;
417
419
418
420
// / Given that this is an enum type, return the lowered type of the
419
421
// / data for the given element. Applies substitutions as necessary.
420
422
// / The result will have the same value category as the base type.
421
- SILType getEnumElementType (EnumElementDecl *elt, Lowering::TypeConverter &TC) const ;
423
+ SILType getEnumElementType (EnumElementDecl *elt, Lowering::TypeConverter &TC,
424
+ TypeExpansionContext context) const ;
422
425
423
- SILType getEnumElementType (EnumElementDecl *elt, SILModule &M) const ;
426
+ SILType getEnumElementType (EnumElementDecl *elt, SILModule &M,
427
+ TypeExpansionContext context) const ;
424
428
425
429
// / Given that this is a tuple type, return the lowered type of the
426
430
// / given tuple element. The result will have the same value
@@ -458,11 +462,11 @@ class SILType {
458
462
// / generic args with the appropriate item from the substitution.
459
463
// /
460
464
// / Only call this with function types!
461
- SILType substGenericArgs (Lowering::TypeConverter &TC,
462
- SubstitutionMap SubMap ) const ;
465
+ SILType substGenericArgs (Lowering::TypeConverter &TC, SubstitutionMap SubMap,
466
+ TypeExpansionContext context ) const ;
463
467
464
- SILType substGenericArgs (SILModule &M,
465
- SubstitutionMap SubMap ) const ;
468
+ SILType substGenericArgs (SILModule &M, SubstitutionMap SubMap,
469
+ TypeExpansionContext context ) const ;
466
470
467
471
// / If the original type is generic, pass the signature as genericSig.
468
472
// /
@@ -487,8 +491,9 @@ class SILType {
487
491
bool isHeapObjectReferenceType () const ;
488
492
489
493
// / Returns true if this SILType is an aggregate that contains \p Ty
490
- bool aggregateContainsRecord (SILType Ty, SILModule &SILMod) const ;
491
-
494
+ bool aggregateContainsRecord (SILType Ty, SILModule &SILMod,
495
+ TypeExpansionContext context) const ;
496
+
492
497
// / Returns true if this SILType is an aggregate with unreferenceable storage,
493
498
// / meaning it cannot be fully destructured in SIL.
494
499
bool aggregateHasUnreferenceableStorage () const ;
@@ -515,7 +520,8 @@ class SILType {
515
520
516
521
// / Returns true if this SILType could be potentially a lowering of the given
517
522
// / formal type. Meant for verification purposes/assertions.
518
- bool isLoweringOf (SILModule &M, CanType formalType);
523
+ bool isLoweringOf (TypeExpansionContext context, SILModule &M,
524
+ CanType formalType);
519
525
520
526
// / Returns the hash code for the SILType.
521
527
llvm::hash_code getHashCode () const {
@@ -589,8 +595,9 @@ NON_SIL_TYPE(LValue)
589
595
#undef NON_SIL_TYPE
590
596
591
597
CanSILFunctionType getNativeSILFunctionType (
592
- Lowering::TypeConverter &TC, Lowering::AbstractionPattern origType,
593
- CanAnyFunctionType substType, Optional<SILDeclRef> origConstant = None,
598
+ Lowering::TypeConverter &TC, TypeExpansionContext context,
599
+ Lowering::AbstractionPattern origType, CanAnyFunctionType substType,
600
+ Optional<SILDeclRef> origConstant = None,
594
601
Optional<SILDeclRef> constant = None,
595
602
Optional<SubstitutionMap> reqtSubs = None,
596
603
ProtocolConformanceRef witnessMethodConformance = ProtocolConformanceRef());
@@ -616,15 +623,15 @@ inline SILType SILField::getObjectType() const {
616
623
return SILType::getPrimitiveObjectType (getLoweredType ());
617
624
}
618
625
619
- CanType getSILBoxFieldLoweredType (SILBoxType *type ,
620
- Lowering::TypeConverter &TC,
626
+ CanType getSILBoxFieldLoweredType (TypeExpansionContext context ,
627
+ SILBoxType *type, Lowering::TypeConverter &TC,
621
628
unsigned index);
622
629
623
- inline SILType getSILBoxFieldType (SILBoxType *type ,
624
- Lowering::TypeConverter &TC,
630
+ inline SILType getSILBoxFieldType (TypeExpansionContext context ,
631
+ SILBoxType *type, Lowering::TypeConverter &TC,
625
632
unsigned index) {
626
633
return SILType::getPrimitiveAddressType (
627
- getSILBoxFieldLoweredType (type, TC, index));
634
+ getSILBoxFieldLoweredType (context, type, TC, index));
628
635
}
629
636
630
637
} // end swift namespace
0 commit comments