From: Eli Friedman Date: Tue, 27 May 2008 04:23:47 +0000 (+0000) Subject: Stop leaking the main Sema object. (Leak found using valgrind.) X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=80f3346981172428a568ccd67e37755fd2d7efbe;p=clang Stop leaking the main Sema object. (Leak found using valgrind.) git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51580 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Sema/ParseAST.cpp b/lib/Sema/ParseAST.cpp index fcdc27b10a..cff3ef7612 100644 --- a/lib/Sema/ParseAST.cpp +++ b/lib/Sema/ParseAST.cpp @@ -38,8 +38,9 @@ void clang::ParseAST(Preprocessor &PP, ASTConsumer *Consumer, bool PrintStats) { PP.getIdentifierTable(), PP.getSelectorTable()); TranslationUnit TU(Context, PP.getLangOptions()); - - Parser P(PP, *new Sema(PP, Context, *Consumer)); + + Sema S(PP, Context, *Consumer); + Parser P(PP, S); PP.EnterMainSourceFile(); // Initialize the parser.