Store the conforming type within an abstract ProtocolConformanceRef

An "abstract" ProtocolConformanceRef is a conformance of a type
parameter or archetype to a given protocol. Previously, we would only
store the protocol requirement itself---but not track the actual
conforming type, requiring clients of ProtocolConformanceRef to keep
track of this information separately.

Record the conforming type as part of an abstract ProtocolConformanceRef,
so that clients will be able to recover it later. This is handled by a uniqued
AbstractConformance structure, so that ProtocolConformanceRef itself stays one
pointer.

There remain a small number of places where we create an abstract
ProtocolConformanceRef with a null type. We'll want to chip away at
those and establish some stronger invariants on the abstract conformance
in the future.
This commit is contained in:
Doug Gregor
2025-03-21 16:48:05 -07:00
parent f8ab391737
commit 2a7de1b559
24 changed files with 326 additions and 71 deletions

View File

@@ -1000,6 +1000,10 @@ bool ModuleFileSharedCore::readIndexBlock(llvm::BitstreamCursor &cursor) {
assert(blobData.empty());
allocateBuffer(Conformances, scratch);
break;
case index_block::ABSTRACT_CONFORMANCE_OFFSETS:
assert(blobData.empty());
allocateBuffer(AbstractConformances, scratch);
break;
case index_block::PACK_CONFORMANCE_OFFSETS:
assert(blobData.empty());
allocateBuffer(PackConformances, scratch);