SILSerializer: handle body of closure.

Body of closure needs to be serialized if its caller is serialized.
To fix this, we serialize private functions that are referenced by a serialized
function.

rdar://15884245


Swift SVN r13162
This commit is contained in:
Manman Ren
2014-01-30 19:39:12 +00:00
parent c38c95c0a1
commit f8b686a2cc
3 changed files with 38 additions and 7 deletions

View File

@@ -1333,8 +1333,12 @@ void SILSerializer::writeAllSILFunctions(const SILModule *SILMod) {
// Helper function for whether to emit a function body.
auto shouldEmitFunctionBody = [&](const SILFunction &F) {
// Emit function body if a private function is referenced in this module.
// This is needed for body of closure.
return (!F.empty() &&
(EnableSerializeAll || F.isTransparent()));
(EnableSerializeAll || F.isTransparent() ||
(F.getLinkage() == SILLinkage::Private &&
FuncsToDeclare.count(&F))));
};
// Go through all the SILFunctions in SILMod and write out any