]> granicus.if.org Git - clang/commitdiff
Stop leaking the main Sema object. (Leak found using valgrind.)
authorEli Friedman <eli.friedman@gmail.com>
Tue, 27 May 2008 04:23:47 +0000 (04:23 +0000)
committerEli Friedman <eli.friedman@gmail.com>
Tue, 27 May 2008 04:23:47 +0000 (04:23 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51580 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/ParseAST.cpp

index fcdc27b10aeb0396471b5df9e65a92bae96ffbbe..cff3ef7612e82d27c30c329e3917ba0cf6d541bf 100644 (file)
@@ -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.