forked from OSchip/llvm-project
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(). llvm-svn: 84296
This commit is contained in:
parent
0d3d9ee03e
commit
8bcb1c6883
|
@ -88,7 +88,8 @@ public:
|
|||
Diagnostic &Diags,
|
||||
FileManager &FileMgr,
|
||||
std::string *ErrMsg = 0,
|
||||
bool OnlyLocalDecls = false);
|
||||
bool OnlyLocalDecls = false,
|
||||
bool UseBumpAllocator = false);
|
||||
};
|
||||
|
||||
} // namespace clang
|
||||
|
|
|
@ -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();
|
||||
|
||||
|
|
|
@ -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(
|
||||
|
|
Loading…
Reference in New Issue