[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()
->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 (conformance->isComplete())
return conformance;
@@ -4594,13 +4584,16 @@ void ModuleFile::finishNormalConformance(NormalProtocolConformance *conformance,
typeCount,
rawIDs);
// Skip requirement signature conformances.
auto proto = conformance->getProtocol();
// Read requirement signature conformances.
const ProtocolDecl *proto = conformance->getProtocol();
SmallVector<ProtocolConformanceRef, 4> reqConformances;
for (const auto &req : proto->getRequirementSignature()) {
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();