Remove redundant local variable (use newly created instance data).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80861 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Steve Naroff 2009-09-03 00:43:52 +00:00
Родитель 16b10378a9
Коммит bbff6990ac
1 изменённых файлов: 8 добавлений и 10 удалений

Просмотреть файл

@ -104,15 +104,13 @@ ASTUnit *ASTUnit::LoadFromPCHFile(const std::string &Filename,
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;
@ -133,7 +131,7 @@ ASTUnit *ASTUnit::LoadFromPCHFile(const std::string &Filename,
PP.setPredefines(Predefines);
PP.setCounterValue(Counter);
Reader->setPreprocessor(PP);
AST->Reader->setPreprocessor(PP);
// Create and initialize the ASTContext.
@ -147,12 +145,12 @@ ASTUnit *ASTUnit::LoadFromPCHFile(const std::string &Filename,
/* 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();