summaryrefslogtreecommitdiffstats
path: root/clang
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2009-09-03 05:59:35 +0000
committerDaniel Dunbar <daniel@zuster.org>2009-09-03 05:59:35 +0000
commit2d9c740cc53d4885a8fbc536416f81f7e531e838 (patch)
tree988f644328fa9057df7c571c4e6b179965c9834b /clang
parent1945453843b3bec348176da6eda042f73fe35bbd (diff)
downloadbcm5719-llvm-2d9c740cc53d4885a8fbc536416f81f7e531e838.tar.gz
bcm5719-llvm-2d9c740cc53d4885a8fbc536416f81f7e531e838.zip
Revert "Remove redundant local variable (use newly created instance data).", the
previous commit this depends on is breaking x86_64-apple-darwin10 and Linux tests. llvm-svn: 80895
Diffstat (limited to 'clang')
-rw-r--r--clang/lib/Frontend/ASTUnit.cpp18
1 files changed, 10 insertions, 8 deletions
diff --git a/clang/lib/Frontend/ASTUnit.cpp b/clang/lib/Frontend/ASTUnit.cpp
index 3fce817c0d2..38452ed9d44 100644
--- a/clang/lib/Frontend/ASTUnit.cpp
+++ b/clang/lib/Frontend/ASTUnit.cpp
@@ -104,13 +104,15 @@ ASTUnit *ASTUnit::LoadFromPCHFile(const std::string &Filename,
std::string Predefines;
unsigned Counter;
+ llvm::OwningPtr<PCHReader> Reader;
llvm::OwningPtr<ExternalASTSource> Source;
- AST->Reader.reset(new PCHReader(SourceMgr, FileMgr, Diags));
- AST->Reader->setListener(new PCHInfoCollector(LangInfo, HeaderInfo,
- TargetTriple, Predefines,
- Counter));
- switch (AST->Reader->ReadPCH(Filename)) {
+ 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)) {
case PCHReader::Success:
break;
@@ -131,7 +133,7 @@ ASTUnit *ASTUnit::LoadFromPCHFile(const std::string &Filename,
PP.setPredefines(Predefines);
PP.setCounterValue(Counter);
- AST->Reader->setPreprocessor(PP);
+ Reader->setPreprocessor(PP);
// Create and initialize the ASTContext.
@@ -145,12 +147,12 @@ ASTUnit *ASTUnit::LoadFromPCHFile(const std::string &Filename,
/* size_reserve = */0));
ASTContext &Context = *AST->Ctx.get();
- AST->Reader->InitializeContext(Context);
+ 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(AST->Reader.get());
+ Source.reset(Reader.take());
Context.setExternalSource(Source);
return AST.take();
OpenPOWER on IntegriCloud