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

Ted Kremenek kremenek at apple.com
Fri Oct 16 17:34:24 PDT 2009


Author: kremenek
Date: Fri Oct 16 19:34:24 2009
New Revision: 84296

URL: http://llvm.org/viewvc/llvm-project?rev=84296&view=rev
Log:
Add 'UseBumpPtrAllocator' flag to ASTUnit::LoadFromPCHFile() to cause the created ASTContext to use
its own BumpPtrAllocator to allocate ASTs.

Change clang_createTranslationUnit (CIndex) to pass 'UseBumpPtrAllocator = true' to
ASTUnit::LoadFromPCHFile().

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

Modified: cfe/trunk/include/clang/Frontend/ASTUnit.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/ASTUnit.h?rev=84296&r1=84295&r2=84296&view=diff

==============================================================================
--- cfe/trunk/include/clang/Frontend/ASTUnit.h (original)
+++ cfe/trunk/include/clang/Frontend/ASTUnit.h Fri Oct 16 19:34:24 2009
@@ -88,7 +88,8 @@
                                   Diagnostic &Diags,
                                   FileManager &FileMgr,
                                   std::string *ErrMsg = 0,
-                                  bool OnlyLocalDecls = false);
+                                  bool OnlyLocalDecls = false,
+                                  bool UseBumpAllocator = false);
 };
 
 } // namespace clang

Modified: cfe/trunk/lib/Frontend/ASTUnit.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/ASTUnit.cpp?rev=84296&r1=84295&r2=84296&view=diff

==============================================================================
--- cfe/trunk/lib/Frontend/ASTUnit.cpp (original)
+++ cfe/trunk/lib/Frontend/ASTUnit.cpp Fri Oct 16 19:34:24 2009
@@ -95,7 +95,8 @@
                                   Diagnostic &Diags,
                                   FileManager &FileMgr,
                                   std::string *ErrMsg,
-                                  bool OnlyLocalDecls) {
+                                  bool OnlyLocalDecls,
+                                  bool UseBumpAllocator) {
   llvm::OwningPtr<ASTUnit> AST(new ASTUnit(Diags));
   AST->OnlyLocalDecls = OnlyLocalDecls;
   AST->HeaderInfo.reset(new HeaderSearch(FileMgr));
@@ -146,7 +147,7 @@
                                 PP.getIdentifierTable(),
                                 PP.getSelectorTable(),
                                 PP.getBuiltinInfo(),
-                                /* FreeMemory = */ true,
+                                /* FreeMemory = */ !UseBumpAllocator,
                                 /* size_reserve = */0));
   ASTContext &Context = *AST->Ctx.get();
 

Modified: cfe/trunk/tools/CIndex/CIndex.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/CIndex/CIndex.cpp?rev=84296&r1=84295&r2=84296&view=diff

==============================================================================
--- cfe/trunk/tools/CIndex/CIndex.cpp (original)
+++ cfe/trunk/tools/CIndex/CIndex.cpp Fri Oct 16 19:34:24 2009
@@ -323,7 +323,8 @@
   
   return ASTUnit::LoadFromPCHFile(astName, CXXIdx->getDiagnostics(),
                                   CXXIdx->getFileManager(), &ErrMsg,
-                                  CXXIdx->getOnlyLocalDecls());
+                                  CXXIdx->getOnlyLocalDecls(),
+                                  /* UseBumpAllocator = */ true);
 }
 
 CXTranslationUnit clang_createTranslationUnitFromSourceFile(





More information about the cfe-commits mailing list