Serialization: Don't throw away the conformances of ApplyInst substitutions.

We kinda need those. Limit the hack to pad it out with nulls to only apply in the case when the conformance list is empty but the original archetype requires conformances, which only occurs for archetypes or existentials.

At long last, we can build at -O0 again, again! Reapplying now that Jordan fixed some fallout this had on his objc printer tests. Thanks Jordan!

Swift SVN r13840
This commit is contained in:
Joe Groff
2014-02-12 21:10:54 +00:00
parent 525c9323cc
commit dd4db41048

View File

@@ -833,13 +833,19 @@ void Serializer::writeSubstitutions(ArrayRef<Substitution> substitutions,
addTypeRef(sub.Archetype),
addTypeRef(sub.Replacement),
sub.Archetype->getConformsTo().size());
ArrayRef<ProtocolConformance*> conformances = sub.Conformance;
// For archetypes the conformance information is context dependent,
// the conformance array is either empty or full of nulls and can be
// ignored. We use an array of null pointers for conformances to satisfy
// the requirement in writeConformances: the first and second arguments
// have the same size.
SmallVector<ProtocolConformance *, 4> conformances(
sub.Archetype->getConformsTo().size(), nullptr);
SmallVector<ProtocolConformance *, 4> conformancesBuf;
if (sub.Conformance.empty() && !sub.Archetype->getConformsTo().empty()) {
conformancesBuf.resize(sub.Archetype->getConformsTo().size(),
nullptr);
conformances = conformancesBuf;
}
writeConformances(sub.Archetype->getConformsTo(), conformances, nullptr,
abbrCodes);
}