diff options
author | Ted Kremenek <kremenek@apple.com> | 2009-10-17 00:34:24 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2009-10-17 00:34:24 +0000 |
commit | 5cf48766d626ff6b223acc9d4b7e415ca8480836 (patch) | |
tree | c8dae4f26d5497c34a098a83f3c3867a4ef12725 | |
parent | 61d60ee6aa0a5ded0ddcf48679673b37506a1895 (diff) |
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().
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84296 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | include/clang/Frontend/ASTUnit.h | 3 | ||||
-rw-r--r-- | lib/Frontend/ASTUnit.cpp | 5 | ||||
-rw-r--r-- | tools/CIndex/CIndex.cpp | 3 |
3 files changed, 7 insertions, 4 deletions
diff --git a/include/clang/Frontend/ASTUnit.h b/include/clang/Frontend/ASTUnit.h index 0ce473f2af..dd3db39343 100644 --- a/include/clang/Frontend/ASTUnit.h +++ b/include/clang/Frontend/ASTUnit.h @@ -88,7 +88,8 @@ public: Diagnostic &Diags, FileManager &FileMgr, std::string *ErrMsg = 0, - bool OnlyLocalDecls = false); + bool OnlyLocalDecls = false, + bool UseBumpAllocator = false); }; } // namespace clang diff --git a/lib/Frontend/ASTUnit.cpp b/lib/Frontend/ASTUnit.cpp index 15002385a8..7ee6648699 100644 --- a/lib/Frontend/ASTUnit.cpp +++ b/lib/Frontend/ASTUnit.cpp @@ -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(); diff --git a/tools/CIndex/CIndex.cpp b/tools/CIndex/CIndex.cpp index d0638d0772..d355025da9 100644 --- a/tools/CIndex/CIndex.cpp +++ b/tools/CIndex/CIndex.cpp @@ -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( |