|
29 | 29 | #include "swift/AST/IfConfigClause.h" |
30 | 30 | #include "swift/AST/LayoutConstraint.h" |
31 | 31 | #include "swift/AST/ReferenceCounting.h" |
| 32 | +#include "swift/AST/RequirementSignature.h" |
32 | 33 | #include "swift/AST/StorageImpl.h" |
33 | 34 | #include "swift/AST/TypeAlignments.h" |
34 | 35 | #include "swift/AST/TypeWalker.h" |
@@ -525,7 +526,7 @@ class alignas(1 << DeclAlignInBits) Decl : public ASTAllocated<Decl> { |
525 | 526 | IsComputingSemanticMembers : 1 |
526 | 527 | ); |
527 | 528 |
|
528 | | - SWIFT_INLINE_BITFIELD_FULL(ProtocolDecl, NominalTypeDecl, 1+1+1+1+1+1+1+1+1+1+1+8+16, |
| 529 | + SWIFT_INLINE_BITFIELD_FULL(ProtocolDecl, NominalTypeDecl, 1+1+1+1+1+1+1+1+1+1+1+8, |
529 | 530 | /// Whether the \c RequiresClass bit is valid. |
530 | 531 | RequiresClassValid : 1, |
531 | 532 |
|
@@ -564,10 +565,7 @@ class alignas(1 << DeclAlignInBits) Decl : public ASTAllocated<Decl> { |
564 | 565 |
|
565 | 566 | /// If this is a compiler-known protocol, this will be a KnownProtocolKind |
566 | 567 | /// value, plus one. Otherwise, it will be 0. |
567 | | - KnownProtocol : 8, // '8' for speed. This only needs 6. |
568 | | - |
569 | | - /// The number of requirements in the requirement signature. |
570 | | - NumRequirementsInSignature : 16 |
| 568 | + KnownProtocol : 8 // '8' for speed. This only needs 6. |
571 | 569 | ); |
572 | 570 |
|
573 | 571 | SWIFT_INLINE_BITFIELD(ClassDecl, NominalTypeDecl, 1+1+2+1+1+1+1+1+1, |
@@ -4313,7 +4311,7 @@ class ProtocolDecl final : public NominalTypeDecl { |
4313 | 4311 |
|
4314 | 4312 | /// The generic signature representing exactly the new requirements introduced |
4315 | 4313 | /// by this protocol. |
4316 | | - const Requirement *RequirementSignature = nullptr; |
| 4314 | + Optional<RequirementSignature> RequirementSig; |
4317 | 4315 |
|
4318 | 4316 | /// Returns the cached result of \c requiresClass or \c None if it hasn't yet |
4319 | 4317 | /// been computed. |
@@ -4574,34 +4572,26 @@ class ProtocolDecl final : public NominalTypeDecl { |
4574 | 4572 | /// requirements. Computed from the structural requirements, above. |
4575 | 4573 | ArrayRef<ProtocolDecl *> getProtocolDependencies() const; |
4576 | 4574 |
|
4577 | | - /// Retrieve the requirements that describe this protocol. |
4578 | | - /// |
4579 | | - /// These are the requirements including any inherited protocols |
4580 | | - /// and conformances for associated types that are introduced in this |
4581 | | - /// protocol. Requirements implied via any other protocol (e.g., inherited |
4582 | | - /// protocols of the inherited protocols) are not mentioned. The conformance |
4583 | | - /// requirements listed here become entries in the witness table. |
4584 | | - ArrayRef<Requirement> getRequirementSignature() const; |
| 4575 | + /// Retrieve the requirements that describe this protocol from the point of |
| 4576 | + /// view of the generic system; see RequirementSignature.h for details. |
| 4577 | + RequirementSignature getRequirementSignature() const; |
4585 | 4578 |
|
4586 | 4579 | /// Is the requirement signature currently being computed? |
4587 | 4580 | bool isComputingRequirementSignature() const; |
4588 | 4581 |
|
4589 | 4582 | /// Has the requirement signature been computed yet? |
4590 | 4583 | bool isRequirementSignatureComputed() const { |
4591 | | - return RequirementSignature != nullptr; |
| 4584 | + return RequirementSig.hasValue(); |
4592 | 4585 | } |
4593 | 4586 |
|
4594 | | - void setRequirementSignature(ArrayRef<Requirement> requirements); |
| 4587 | + void setRequirementSignature(RequirementSignature requirementSig); |
4595 | 4588 |
|
4596 | 4589 | void setLazyRequirementSignature(LazyMemberLoader *lazyLoader, |
4597 | 4590 | uint64_t requirementSignatureData); |
4598 | 4591 |
|
4599 | 4592 | void setLazyAssociatedTypeMembers(LazyMemberLoader *lazyLoader, |
4600 | 4593 | uint64_t associatedTypesData); |
4601 | 4594 |
|
4602 | | -private: |
4603 | | - ArrayRef<Requirement> getCachedRequirementSignature() const; |
4604 | | - |
4605 | 4595 | public: |
4606 | 4596 | // Implement isa/cast/dyncast/etc. |
4607 | 4597 | static bool classof(const Decl *D) { |
|
0 commit comments