]> granicus.if.org Git - clang/commitdiff
Add 'UseBumpPtrAllocator' flag to ASTUnit::LoadFromPCHFile() to cause the created...
authorTed Kremenek <kremenek@apple.com>
Sat, 17 Oct 2009 00:34:24 +0000 (00:34 +0000)
committerTed Kremenek <kremenek@apple.com>
Sat, 17 Oct 2009 00:34:24 +0000 (00:34 +0000)
its own BumpPtrAllocator to allocate ASTs.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84296 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Frontend/ASTUnit.h
lib/Frontend/ASTUnit.cpp
tools/CIndex/CIndex.cpp

index 0ce473f2af5345cdf821c2d12714fcc7093fed04..dd3db393436fd5f652bf4f129aff6eea7bdfd4d2 100644 (file)
@@ -88,7 +88,8 @@ public:
                                   Diagnostic &Diags,
                                   FileManager &FileMgr,
                                   std::string *ErrMsg = 0,
-                                  bool OnlyLocalDecls = false);
+                                  bool OnlyLocalDecls = false,
+                                  bool UseBumpAllocator = false);
 };
 
 } // namespace clang
index 15002385a8c2e4fb0f0e5daf497ea271e55decc0..7ee66486998881d36af9cf10d8c8efdf41a02971 100644 (file)
@@ -95,7 +95,8 @@ ASTUnit *ASTUnit::LoadFromPCHFile(const std::string &Filename,
                                   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 @@ ASTUnit *ASTUnit::LoadFromPCHFile(const std::string &Filename,
                                 PP.getIdentifierTable(),
                                 PP.getSelectorTable(),
                                 PP.getBuiltinInfo(),
-                                /* FreeMemory = */ true,
+                                /* FreeMemory = */ !UseBumpAllocator,
                                 /* size_reserve = */0));
   ASTContext &Context = *AST->Ctx.get();
 
index d0638d07728b0bee1c9ee6597b74e74ca0f3e2d7..d355025da918fb6087e78497da2135079e7bce52 100644 (file)
@@ -323,7 +323,8 @@ CXTranslationUnit clang_createTranslationUnit(
   
   return ASTUnit::LoadFromPCHFile(astName, CXXIdx->getDiagnostics(),
                                   CXXIdx->getFileManager(), &ErrMsg,
-                                  CXXIdx->getOnlyLocalDecls());
+                                  CXXIdx->getOnlyLocalDecls(),
+                                  /* UseBumpAllocator = */ true);
 }
 
 CXTranslationUnit clang_createTranslationUnitFromSourceFile(