Capture Promotion: have new closures inserted before their original versions

Swift SVN r10554
This commit is contained in:
Stephen Lin
2013-11-19 03:29:00 +00:00
parent cacdcabad1
commit 4ebdf9c80f
4 changed files with 35 additions and 33 deletions

View File

@@ -305,13 +305,10 @@ ClosureCloner::initCloned(SILFunction *Orig, IndicesSet &PromotableIndices) {
OrigLoweredTy.getAs<AnyFunctionType>().getResult(),
M.getASTContext()));
// FIXME: This should insert the cloned function right before the existing
// SILFunction for the closure, so that these naturally clump together and
// so that testcases are easier to write. This can be done by creating the
// function then using the splice method on the module's ilist of functions.
// This inserts the new cloned function before the original function.
return new (M) SILFunction(M, SILLinkage::Internal, ClonedName,
M.Types.getLoweredType(ClonedTy),
Orig->getLocation());
Orig->getLocation(), IsNotTransparent, Orig);
}
/// \brief Populate the body of the cloned closure, modifying instructions as