std::string Predefines;
unsigned Counter;
- llvm::OwningPtr<PCHReader> Reader;
llvm::OwningPtr<ExternalASTSource> Source;
- Reader.reset(new PCHReader(SourceMgr, FileMgr, Diags));
- AST->Reader.reset(Reader.get());
- Reader->setListener(new PCHInfoCollector(LangInfo, HeaderInfo, TargetTriple,
- Predefines, Counter));
-
- switch (Reader->ReadPCH(Filename)) {
+ AST->Reader.reset(new PCHReader(SourceMgr, FileMgr, Diags));
+ AST->Reader->setListener(new PCHInfoCollector(LangInfo, HeaderInfo,
+ TargetTriple, Predefines,
+ Counter));
+ switch (AST->Reader->ReadPCH(Filename)) {
case PCHReader::Success:
break;
PP.setPredefines(Predefines);
PP.setCounterValue(Counter);
- Reader->setPreprocessor(PP);
+ AST->Reader->setPreprocessor(PP);
// Create and initialize the ASTContext.
/* size_reserve = */0));
ASTContext &Context = *AST->Ctx.get();
- Reader->InitializeContext(Context);
+ AST->Reader->InitializeContext(Context);
// Attach the PCH reader to the AST context as an external AST
// source, so that declarations will be deserialized from the
// PCH file as needed.
- Source.reset(Reader.take());
+ Source.reset(AST->Reader.get());
Context.setExternalSource(Source);
return AST.take();