@@ -3456,12 +3456,15 @@ void irgen::bindGenericRequirement(IRGenFunction &IGF,
3456
3456
namespace {
3457
3457
// / A class for expanding a polymorphic signature.
3458
3458
class ExpandPolymorphicSignature : public PolymorphicConvention {
3459
+ unsigned numTypeMetadataPtrs = 0 ;
3460
+
3459
3461
public:
3460
3462
ExpandPolymorphicSignature (IRGenModule &IGM, CanSILFunctionType fn)
3461
3463
: PolymorphicConvention(IGM, fn) {}
3462
3464
3463
- void expand (SmallVectorImpl<llvm::Type *> &out,
3464
- SmallVectorImpl<PolymorphicSignatureExpandedTypeSource> *reqs) {
3465
+ unsigned
3466
+ expand (SmallVectorImpl<llvm::Type *> &out,
3467
+ SmallVectorImpl<PolymorphicSignatureExpandedTypeSource> *reqs) {
3465
3468
auto outStartSize = out.size ();
3466
3469
(void )outStartSize;
3467
3470
for (auto &source : getSources ())
@@ -3472,9 +3475,13 @@ namespace {
3472
3475
reqs->push_back (reqt);
3473
3476
out.push_back (reqt.Protocol ? IGM.WitnessTablePtrTy
3474
3477
: IGM.TypeMetadataPtrTy );
3478
+
3479
+ if (!reqt.Protocol )
3480
+ ++numTypeMetadataPtrs;
3475
3481
});
3476
3482
assert ((!reqs || reqs->size () == (out.size () - outStartSize)) &&
3477
3483
" missing type source for type" );
3484
+ return numTypeMetadataPtrs;
3478
3485
}
3479
3486
3480
3487
private:
@@ -3488,6 +3495,7 @@ namespace {
3488
3495
case MetadataSource::Kind::GenericLValueMetadata:
3489
3496
if (reqs)
3490
3497
reqs->push_back (source);
3498
+ ++numTypeMetadataPtrs;
3491
3499
return out.push_back (IGM.TypeMetadataPtrTy );
3492
3500
case MetadataSource::Kind::SelfMetadata:
3493
3501
case MetadataSource::Kind::SelfWitnessTable:
@@ -3501,11 +3509,11 @@ namespace {
3501
3509
} // end anonymous namespace
3502
3510
3503
3511
// / Given a generic signature, add the argument types required in order to call it.
3504
- void irgen::expandPolymorphicSignature (
3512
+ unsigned irgen::expandPolymorphicSignature (
3505
3513
IRGenModule &IGM, CanSILFunctionType polyFn,
3506
3514
SmallVectorImpl<llvm::Type *> &out,
3507
3515
SmallVectorImpl<PolymorphicSignatureExpandedTypeSource> *outReqs) {
3508
- ExpandPolymorphicSignature (IGM, polyFn).expand (out, outReqs);
3516
+ return ExpandPolymorphicSignature (IGM, polyFn).expand (out, outReqs);
3509
3517
}
3510
3518
3511
3519
void irgen::expandTrailingWitnessSignature (IRGenModule &IGM,
0 commit comments