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

@@ -18,7 +18,8 @@ using namespace swift;
SILFunction::SILFunction(SILModule &Module, SILLinkage Linkage,
StringRef Name, SILType LoweredType,
Optional<SILLocation> Loc,
IsTransparent_t isTrans)
IsTransparent_t isTrans,
SILFunction *InsertBefore)
: ModuleAndLinkage(&Module, Linkage),
Name(Name),
LoweredType(LoweredType),
@@ -26,7 +27,10 @@ SILFunction::SILFunction(SILModule &Module, SILLinkage Linkage,
DeclCtx(nullptr),
DebugScope(nullptr),
Transparent(isTrans) {
Module.functions.push_back(this);
if (InsertBefore)
Module.functions.insert(SILModule::iterator(InsertBefore), this);
else
Module.functions.push_back(this);
}
SILFunction::~SILFunction() {