[cfe-commits] r143465 - in /cfe/trunk: include/clang/Frontend/ASTUnit.h lib/Frontend/ASTUnit.cpp

Argyrios Kyrtzidis akyrtzi at gmail.com
Tue Nov 1 10:14:16 PDT 2011


Author: akirtzidis
Date: Tue Nov  1 12:14:15 2011
New Revision: 143465

URL: http://llvm.org/viewvc/llvm-project?rev=143465&view=rev
Log:
Put a reference of the ASTReader in the ASTUnit.

This is intended for direct access of the ASTReader for uses that make
little sense to try to shoehorn in the ExternalASTSource interface.

Modified:
    cfe/trunk/include/clang/Frontend/ASTUnit.h
    cfe/trunk/lib/Frontend/ASTUnit.cpp

Modified: cfe/trunk/include/clang/Frontend/ASTUnit.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/ASTUnit.h?rev=143465&r1=143464&r2=143465&view=diff
==============================================================================
--- cfe/trunk/include/clang/Frontend/ASTUnit.h (original)
+++ cfe/trunk/include/clang/Frontend/ASTUnit.h Tue Nov  1 12:14:15 2011
@@ -76,6 +76,7 @@
   llvm::IntrusiveRefCntPtr<TargetInfo>        Target;
   llvm::IntrusiveRefCntPtr<Preprocessor>      PP;
   llvm::IntrusiveRefCntPtr<ASTContext>        Ctx;
+  ASTReader *Reader;
 
   FileSystemOptions FileSystemOpts;
 

Modified: cfe/trunk/lib/Frontend/ASTUnit.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/ASTUnit.cpp?rev=143465&r1=143464&r2=143465&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/ASTUnit.cpp (original)
+++ cfe/trunk/lib/Frontend/ASTUnit.cpp Tue Nov  1 12:14:15 2011
@@ -211,7 +211,7 @@
 static llvm::sys::cas_flag ActiveASTUnitObjects;
 
 ASTUnit::ASTUnit(bool _MainFileIsAST)
-  : OnlyLocalDecls(false), CaptureDiagnostics(false),
+  : Reader(0), OnlyLocalDecls(false), CaptureDiagnostics(false),
     MainFileIsAST(_MainFileIsAST), 
     TUKind(TU_Complete), WantTiming(getenv("LIBCLANG_TIMING")),
     OwnsRemappedFileBuffers(true),
@@ -783,6 +783,7 @@
   AST->TheSema.reset(new Sema(PP, Context, *AST->Consumer));
   AST->TheSema->Initialize();
   ReaderPtr->InitializeSema(*AST->TheSema);
+  AST->Reader = ReaderPtr;
 
   return AST.take();
 }
@@ -1042,6 +1043,7 @@
   TheSema.reset();
   Ctx = 0;
   PP = 0;
+  Reader = 0;
   
   // Clear out old caches and data.
   TopLevelDecls.clear();
@@ -1117,6 +1119,7 @@
   Clang->setSourceManager(0);
   Clang->setFileManager(0);
   Target = &Clang->getTarget();
+  Reader = Clang->getModuleManager();
   
   Act->EndSourceFile();
 
@@ -1709,6 +1712,7 @@
   AST->TheSema.reset();
   AST->Ctx = 0;
   AST->PP = 0;
+  AST->Reader = 0;
   
   // Create a file manager object to provide access to and cache the filesystem.
   Clang->setFileManager(&AST->getFileManager());
@@ -1743,6 +1747,7 @@
   Clang->setSourceManager(0);
   Clang->setFileManager(0);
   AST->Target = &Clang->getTarget();
+  AST->Reader = Clang->getModuleManager();
   
   Act->EndSourceFile();
 





More information about the cfe-commits mailing list