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
Diagnostic &Diags,
FileManager &FileMgr,
std::string *ErrMsg = 0,
- bool OnlyLocalDecls = false);
+ bool OnlyLocalDecls = false,
+ bool UseBumpAllocator = false);
};
} // namespace clang
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));
PP.getIdentifierTable(),
PP.getSelectorTable(),
PP.getBuiltinInfo(),
- /* FreeMemory = */ true,
+ /* FreeMemory = */ !UseBumpAllocator,
/* size_reserve = */0));
ASTContext &Context = *AST->Ctx.get();
return ASTUnit::LoadFromPCHFile(astName, CXXIdx->getDiagnostics(),
CXXIdx->getFileManager(), &ErrMsg,
- CXXIdx->getOnlyLocalDecls());
+ CXXIdx->getOnlyLocalDecls(),
+ /* UseBumpAllocator = */ true);
}
CXTranslationUnit clang_createTranslationUnitFromSourceFile(