[cfe-commits] r67911 - in /cfe/trunk: include/clang/Sema/ParseAST.h lib/Sema/ParseAST.cpp tools/clang-cc/clang.cpp

Chris Lattner sabre at nondot.org
Fri Mar 27 21:13:34 PDT 2009


Author: lattner
Date: Fri Mar 27 23:13:34 2009
New Revision: 67911

URL: http://llvm.org/viewvc/llvm-project?rev=67911&view=rev
Log:
remove TranslationUnit from ParseAST.

Modified:
    cfe/trunk/include/clang/Sema/ParseAST.h
    cfe/trunk/lib/Sema/ParseAST.cpp
    cfe/trunk/tools/clang-cc/clang.cpp

Modified: cfe/trunk/include/clang/Sema/ParseAST.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/ParseAST.h?rev=67911&r1=67910&r2=67911&view=diff

==============================================================================
--- cfe/trunk/include/clang/Sema/ParseAST.h (original)
+++ cfe/trunk/include/clang/Sema/ParseAST.h Fri Mar 27 23:13:34 2009
@@ -17,13 +17,14 @@
 namespace clang {
   class Preprocessor;
   class ASTConsumer;
-  class TranslationUnit;
+  class ASTContext;
 
   /// ParseAST - Parse the entire file specified, notifying the ASTConsumer as
-  /// the file is parsed.  This inserts the parsed decls into TU.
+  /// the file is parsed.    This inserts the parsed decls into the translation unit
+  /// held by Ctx.
   ///
   void ParseAST(Preprocessor &pp, ASTConsumer *C, 
-                TranslationUnit &TU, bool PrintStats = false);
+                ASTContext &Ctx, bool PrintStats = false);
 
 }  // end namespace clang
 

Modified: cfe/trunk/lib/Sema/ParseAST.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/ParseAST.cpp?rev=67911&r1=67910&r2=67911&view=diff

==============================================================================
--- cfe/trunk/lib/Sema/ParseAST.cpp (original)
+++ cfe/trunk/lib/Sema/ParseAST.cpp Fri Mar 27 23:13:34 2009
@@ -25,24 +25,25 @@
 //===----------------------------------------------------------------------===//
 
 /// ParseAST - Parse the entire file specified, notifying the ASTConsumer as
-/// the file is parsed.  This inserts the parsed decls into TU.
+/// the file is parsed.  This inserts the parsed decls into the translation unit
+/// held by Ctx.
 ///
 void clang::ParseAST(Preprocessor &PP, ASTConsumer *Consumer,
-                     TranslationUnit &TU, bool PrintStats) {
+                     ASTContext &Ctx, bool PrintStats) {
   // Collect global stats on Decls/Stmts (until we have a module streamer).
   if (PrintStats) {
     Decl::CollectingStats(true);
     Stmt::CollectingStats(true);
   }
 
-  Sema S(PP, TU.getContext(), *Consumer);
+  Sema S(PP, Ctx, *Consumer);
   Parser P(PP, S);
   PP.EnterMainSourceFile();
     
   // Initialize the parser.
   P.Initialize();
   
-  Consumer->Initialize(TU.getContext());
+  Consumer->Initialize(Ctx);
   
   Parser::DeclTy *ADecl;
   
@@ -56,12 +57,12 @@
     }
   };
   
-  Consumer->HandleTranslationUnit(TU.getContext());
+  Consumer->HandleTranslationUnit(Ctx);
 
   if (PrintStats) {
     fprintf(stderr, "\nSTATISTICS:\n");
     P.getActions().PrintStats();
-    TU.getContext().PrintStats();
+    Ctx.PrintStats();
     Decl::PrintStats();
     Stmt::PrintStats();
     Consumer->PrintStats();

Modified: cfe/trunk/tools/clang-cc/clang.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/clang-cc/clang.cpp?rev=67911&r1=67910&r2=67911&view=diff

==============================================================================
--- cfe/trunk/tools/clang-cc/clang.cpp (original)
+++ cfe/trunk/tools/clang-cc/clang.cpp Fri Mar 27 23:13:34 2009
@@ -1476,7 +1476,6 @@
 
   if (Consumer) {
     llvm::OwningPtr<ASTContext> ContextOwner;
-    llvm::OwningPtr<TranslationUnit> TranslationUnitOwner;
 
     ContextOwner.reset(new ASTContext(PP.getLangOptions(),
                                       PP.getSourceManager(),
@@ -1484,17 +1483,14 @@
                                       PP.getIdentifierTable(),
                                       PP.getSelectorTable(),
                                       /* FreeMemory = */ !DisableFree));
-    TranslationUnitOwner.reset(new TranslationUnit(*ContextOwner.get()));
     
     
-    ParseAST(PP, Consumer.get(), *TranslationUnitOwner.get(), Stats);
+    ParseAST(PP, Consumer.get(), *ContextOwner.get(), Stats);
     
     // If in -disable-free mode, don't deallocate these when they go out of
     // scope.
-    if (DisableFree) {
+    if (DisableFree)
       ContextOwner.take();
-      TranslationUnitOwner.take();
-    }
   }
 
   if (VerifyDiagnostics)





More information about the cfe-commits mailing list