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!

Swift SVN r13815
This commit is contained in:
Joe Groff
2014-02-12 05:59:26 +00:00
parent be8ed18722
commit c0b39cb57a

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);
}