Skip to content

Commit 897effe

Browse files
committed
[Serialization] Make requirement signature conformance loading lazy.
The previous commit needed this for the importer, so we might as well take advantage of it in deserialization as well. No expected change in behavior.
1 parent a8bc132 commit 897effe

File tree

1 file changed

+6
-13
lines changed

1 file changed

+6
-13
lines changed

lib/Serialization/Deserialization.cpp

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -654,16 +654,6 @@ NormalProtocolConformance *ModuleFile::readNormalConformance(
654654
dc->getAsNominalTypeOrNominalTypeExtensionContext()
655655
->registerProtocolConformance(conformance);
656656

657-
// Read requirement signature conformances.
658-
SmallVector<ProtocolConformanceRef, 4> reqConformances;
659-
for (const auto &req : proto->getRequirementSignature()) {
660-
if (req.getKind() == RequirementKind::Conformance) {
661-
auto reqConformance = readConformance(DeclTypeCursor);
662-
reqConformances.push_back(reqConformance);
663-
}
664-
}
665-
conformance->setSignatureConformances(reqConformances);
666-
667657
// If the conformance is complete, we're done.
668658
if (conformance->isComplete())
669659
return conformance;
@@ -4594,13 +4584,16 @@ void ModuleFile::finishNormalConformance(NormalProtocolConformance *conformance,
45944584
typeCount,
45954585
rawIDs);
45964586

4597-
// Skip requirement signature conformances.
4598-
auto proto = conformance->getProtocol();
4587+
// Read requirement signature conformances.
4588+
const ProtocolDecl *proto = conformance->getProtocol();
4589+
SmallVector<ProtocolConformanceRef, 4> reqConformances;
45994590
for (const auto &req : proto->getRequirementSignature()) {
46004591
if (req.getKind() == RequirementKind::Conformance) {
4601-
(void)readConformance(DeclTypeCursor);
4592+
auto reqConformance = readConformance(DeclTypeCursor);
4593+
reqConformances.push_back(reqConformance);
46024594
}
46034595
}
4596+
conformance->setSignatureConformances(reqConformances);
46044597

46054598
ArrayRef<uint64_t>::iterator rawIDIter = rawIDs.begin();
46064599

0 commit comments

Comments
 (0)