@@ -946,11 +946,11 @@ namespace {
946
946
}
947
947
}
948
948
949
- void addAssociatedType (AssociatedType requirement ) {
949
+ void addAssociatedType (AssociatedTypeDecl *assocType ) {
950
950
// In Embedded Swift witness tables don't have associated-types entries.
951
- if (requirement. getAssociation () ->getASTContext ().LangOpts .hasFeature (Feature::Embedded))
951
+ if (assocType ->getASTContext ().LangOpts .hasFeature (Feature::Embedded))
952
952
return ;
953
- Entries.push_back (WitnessTableEntry::forAssociatedType (requirement ));
953
+ Entries.push_back (WitnessTableEntry::forAssociatedType (assocType ));
954
954
}
955
955
956
956
void addAssociatedConformance (const AssociatedConformance &req) {
@@ -1330,8 +1330,8 @@ mapConformanceIntoContext(const RootProtocolConformance *conf) {
1330
1330
1331
1331
WitnessIndex ProtocolInfo::getAssociatedTypeIndex (
1332
1332
IRGenModule &IGM,
1333
- AssociatedType assocType) const {
1334
- assert (!IGM.isResilient (assocType. getSourceProtocol (),
1333
+ AssociatedTypeDecl * assocType) const {
1334
+ assert (!IGM.isResilient (assocType-> getProtocol (),
1335
1335
ResilienceExpansion::Maximal) &&
1336
1336
" Cannot ask for the associated type index of non-resilient protocol" );
1337
1337
for (auto &witness : getWitnessEntries ()) {
@@ -1707,7 +1707,7 @@ class AccessorConformanceInfo : public ConformanceInfo {
1707
1707
llvm_unreachable (" cannot emit a witness table with placeholders in it" );
1708
1708
}
1709
1709
1710
- void addAssociatedType (AssociatedType requirement ) {
1710
+ void addAssociatedType (AssociatedTypeDecl *assocType ) {
1711
1711
auto &entry = SILEntries.front ();
1712
1712
SILEntries = SILEntries.slice (1 );
1713
1713
@@ -1718,34 +1718,32 @@ class AccessorConformanceInfo : public ConformanceInfo {
1718
1718
#ifndef NDEBUG
1719
1719
assert (entry.getKind () == SILWitnessTable::AssociatedType
1720
1720
&& " sil witness table does not match protocol" );
1721
- assert (entry.getAssociatedTypeWitness ().Requirement
1722
- == requirement.getAssociation ()
1721
+ assert (entry.getAssociatedTypeWitness ().Requirement == assocType
1723
1722
&& " sil witness table does not match protocol" );
1724
- auto piIndex = PI.getAssociatedTypeIndex (IGM, requirement );
1723
+ auto piIndex = PI.getAssociatedTypeIndex (IGM, assocType );
1725
1724
assert ((size_t )piIndex.getValue () ==
1726
1725
Table.size () - WitnessTableFirstRequirementOffset &&
1727
1726
" offset doesn't match ProtocolInfo layout" );
1728
1727
#else
1729
1728
(void )entry;
1730
1729
#endif
1731
1730
1732
- auto associate =
1733
- Conformance.getTypeWitness (requirement.getAssociation ());
1734
- llvm::Constant *witness =
1731
+ auto typeWitness = Conformance.getTypeWitness (assocType);
1732
+ llvm::Constant *typeWitnessAddr =
1735
1733
IGM.getAssociatedTypeWitness (
1736
- associate ,
1734
+ typeWitness ,
1737
1735
Conformance.getDeclContext ()->getGenericSignatureOfContext (),
1738
1736
/* inProtocolContext=*/ false );
1739
- witness = llvm::ConstantExpr::getBitCast (witness , IGM.Int8PtrTy );
1737
+ typeWitnessAddr = llvm::ConstantExpr::getBitCast (typeWitnessAddr , IGM.Int8PtrTy );
1740
1738
1741
1739
if (isRelative) {
1742
- Table.addRelativeAddress (witness );
1740
+ Table.addRelativeAddress (typeWitnessAddr );
1743
1741
return ;
1744
1742
}
1745
1743
1746
1744
auto &schema = IGM.getOptions ().PointerAuth
1747
1745
.ProtocolAssociatedTypeAccessFunctions ;
1748
- Table.addSignedPointer (witness , schema, requirement );
1746
+ Table.addSignedPointer (typeWitnessAddr , schema, assocType );
1749
1747
}
1750
1748
1751
1749
void addAssociatedConformance (AssociatedConformance requirement) {
@@ -3513,7 +3511,7 @@ MetadataResponse MetadataPath::followComponent(IRGenFunction &IGF,
3513
3511
SubstitutionMap::getProtocolSubstitutions (sourceConformance))
3514
3512
->getCanonicalType ();
3515
3513
if (auto archetypeType = dyn_cast<ArchetypeType>(baseSubstType)) {
3516
- AssociatedType baseAssocType ( depMemType->getAssocType () );
3514
+ auto * baseAssocType = depMemType->getAssocType ();
3517
3515
3518
3516
MetadataResponse response =
3519
3517
emitAssociatedTypeMetadataRef (IGF, archetypeType, baseAssocType,
@@ -4538,18 +4536,18 @@ MetadataResponse
4538
4536
irgen::emitAssociatedTypeMetadataRef (IRGenFunction &IGF,
4539
4537
llvm::Value *parentMetadata,
4540
4538
llvm::Value *wtable,
4541
- AssociatedType associatedType ,
4539
+ AssociatedTypeDecl *assocType ,
4542
4540
DynamicMetadataRequest request) {
4543
4541
auto &IGM = IGF.IGM ;
4544
4542
4545
4543
// Extract the requirements base descriptor.
4546
4544
auto reqBaseDescriptor =
4547
4545
IGM.getAddrOfProtocolRequirementsBaseDescriptor (
4548
- associatedType. getSourceProtocol ());
4546
+ assocType-> getProtocol ());
4549
4547
4550
4548
// Extract the associated type descriptor.
4551
4549
auto assocTypeDescriptor =
4552
- IGM.getAddrOfAssociatedTypeDescriptor (associatedType. getAssociation () );
4550
+ IGM.getAddrOfAssociatedTypeDescriptor (assocType );
4553
4551
// Call swift_getAssociatedTypeWitness().
4554
4552
auto call =
4555
4553
IGF.IGM .IRGen .Opts .UseRelativeProtocolWitnessTables ?
0 commit comments