Stop leaking memory from Module and FileUnit.

Also, disallow creating Modules and FileUnits on the stack. They must always
live as long as the ASTContext.

<rdar://problem/15596964>

Swift SVN r13671
This commit is contained in:
Jordan Rose
2014-02-08 02:12:57 +00:00
parent 1e3fd1a5b1
commit cbcf17f9bd
11 changed files with 37 additions and 14 deletions

View File

@@ -218,7 +218,7 @@ Module *SerializedModuleLoader::loadModule(SourceLoc importLoc,
assert(inputFile);
auto M = new (Ctx) Module(moduleID.first, Ctx);
auto M = Module::create(moduleID.first, Ctx);
Ctx.LoadedModules[moduleID.first.str()] = M;
(void)loadAST(*M, moduleID.second, std::move(inputFile));