|
68 | 68 | using namespace swift; |
69 | 69 | using namespace swift::Mangle; |
70 | 70 |
|
71 | | -template<typename DeclType> |
72 | | -static DeclType *getABIDecl(DeclType *D) { |
73 | | - if (!D) |
74 | | - return nullptr; |
75 | | - |
76 | | - auto abiRole = ABIRoleInfo(D); |
77 | | - if (!abiRole.providesABI()) |
78 | | - return abiRole.getCounterpart(); |
79 | | - return nullptr; |
80 | | -} |
81 | | - |
82 | | -static std::optional<ASTMangler::SymbolicReferent> |
83 | | -getABIDecl(ASTMangler::SymbolicReferent ref) { |
| 71 | +std::optional<ASTMangler::SymbolicReferent> |
| 72 | +ASTMangler::getABIDecl(SymbolicReferent ref) const { |
84 | 73 | switch (ref.getKind()) { |
85 | | - case ASTMangler::SymbolicReferent::NominalType: |
| 74 | + case SymbolicReferent::NominalType: |
86 | 75 | if (auto abiTypeDecl = getABIDecl(ref.getNominalType())) { |
87 | | - return ASTMangler::SymbolicReferent(abiTypeDecl); |
| 76 | + return SymbolicReferent(abiTypeDecl); |
88 | 77 | } |
89 | 78 | break; |
90 | 79 |
|
91 | | - case ASTMangler::SymbolicReferent::OpaqueType: |
| 80 | + case SymbolicReferent::OpaqueType: |
92 | 81 | if (auto abiTypeDecl = getABIDecl(ref.getOpaqueType())) { |
93 | | - return ASTMangler::SymbolicReferent(abiTypeDecl); |
| 82 | + return SymbolicReferent(abiTypeDecl); |
94 | 83 | } |
95 | 84 | break; |
96 | 85 |
|
97 | | - case ASTMangler::SymbolicReferent::ExtendedExistentialTypeShape: |
| 86 | + case SymbolicReferent::ExtendedExistentialTypeShape: |
98 | 87 | // Do nothing; mangling will use the underlying ABI decls in the end. |
99 | 88 | break; |
100 | 89 | } |
@@ -5329,18 +5318,18 @@ std::string ASTMangler::mangleAttachedMacroExpansion( |
5329 | 5318 | return finalize(); |
5330 | 5319 | } |
5331 | 5320 |
|
5332 | | -static void gatherExistentialRequirements(SmallVectorImpl<Requirement> &reqs, |
5333 | | - ParameterizedProtocolType *PPT) { |
| 5321 | +void ASTMangler::gatherExistentialRequirements( |
| 5322 | + SmallVectorImpl<Requirement> &reqs, ParameterizedProtocolType *PPT) const { |
5334 | 5323 | auto protoTy = PPT->getBaseType(); |
5335 | 5324 | ASSERT(!getABIDecl(protoTy->getDecl()) && "need to figure out behavior"); |
5336 | 5325 | PPT->getRequirements(protoTy->getDecl()->getSelfInterfaceType(), reqs); |
5337 | 5326 | } |
5338 | 5327 |
|
5339 | 5328 | /// Extracts a list of inverse requirements from a PCT serving as the constraint |
5340 | 5329 | /// type of an existential. |
5341 | | -static void extractExistentialInverseRequirements( |
5342 | | - SmallVectorImpl<InverseRequirement> &inverses, |
5343 | | - ProtocolCompositionType *PCT) { |
| 5330 | +void ASTMangler::extractExistentialInverseRequirements( |
| 5331 | + SmallVectorImpl<InverseRequirement> &inverses, |
| 5332 | + ProtocolCompositionType *PCT) const { |
5344 | 5333 | if (!PCT->hasInverse()) |
5345 | 5334 | return; |
5346 | 5335 |
|
|
0 commit comments