[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.
This commit is contained in:
Jordan Rose
2017-06-29 15:56:09 -07:00
parent a8bc132565
commit 897effec58

View File

@@ -654,16 +654,6 @@ NormalProtocolConformance *ModuleFile::readNormalConformance(
dc->getAsNominalTypeOrNominalTypeExtensionContext() dc->getAsNominalTypeOrNominalTypeExtensionContext()
->registerProtocolConformance(conformance); ->registerProtocolConformance(conformance);
// Read requirement signature conformances.
SmallVector<ProtocolConformanceRef, 4> reqConformances;
for (const auto &req : proto->getRequirementSignature()) {
if (req.getKind() == RequirementKind::Conformance) {
auto reqConformance = readConformance(DeclTypeCursor);
reqConformances.push_back(reqConformance);
}
}
conformance->setSignatureConformances(reqConformances);
// If the conformance is complete, we're done. // If the conformance is complete, we're done.
if (conformance->isComplete()) if (conformance->isComplete())
return conformance; return conformance;
@@ -4594,13 +4584,16 @@ void ModuleFile::finishNormalConformance(NormalProtocolConformance *conformance,
typeCount, typeCount,
rawIDs); rawIDs);
// Skip requirement signature conformances. // Read requirement signature conformances.
auto proto = conformance->getProtocol(); const ProtocolDecl *proto = conformance->getProtocol();
SmallVector<ProtocolConformanceRef, 4> reqConformances;
for (const auto &req : proto->getRequirementSignature()) { for (const auto &req : proto->getRequirementSignature()) {
if (req.getKind() == RequirementKind::Conformance) { if (req.getKind() == RequirementKind::Conformance) {
(void)readConformance(DeclTypeCursor); auto reqConformance = readConformance(DeclTypeCursor);
reqConformances.push_back(reqConformance);
} }
} }
conformance->setSignatureConformances(reqConformances);
ArrayRef<uint64_t>::iterator rawIDIter = rawIDs.begin(); ArrayRef<uint64_t>::iterator rawIDIter = rawIDs.begin();