mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
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:
@@ -33,8 +33,8 @@ bool ide::isSourceInputComplete(std::unique_ptr<llvm::MemoryBuffer> MemBuf) {
|
||||
ASTContext Ctx(LangOpts, SearchPathOpts, SM, Diags);
|
||||
auto ModName = Ctx.getIdentifier("input");
|
||||
|
||||
Module Mod(ModName, Ctx);
|
||||
SourceFile SF(Mod, SourceFileKind::Main, BufferID);
|
||||
Module &Mod = *Module::create(ModName, Ctx);
|
||||
SourceFile &SF = *new (Ctx) SourceFile(Mod, SourceFileKind::Main, BufferID);
|
||||
|
||||
PersistentParserState PersistentState;
|
||||
Parser P(BufferID, SF, /*SIL=*/nullptr, &PersistentState);
|
||||
|
||||
Reference in New Issue
Block a user