diff options
author | Douglas Gregor <dgregor@apple.com> | 2011-09-02 00:26:20 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2011-09-02 00:26:20 +0000 |
commit | f8a1e51c48761ee1d7803c3fa35ac94f42ebb55e (patch) | |
tree | 068fd71196ea90971e827ca4e56a28a172d6daf4 /lib/Frontend/ASTUnit.cpp | |
parent | bcfd1f55bfbb3e5944cd5e03d07b343e280838c4 (diff) |
Always construct an ASTReader with a non-NULL ASTContext and
Preprocessor, eliminating the constructor that was used by ASTUnit
(which didn't provide an ASTContext or Prepreprocessor). Ensuring that
both objects are non-NULL will simplify module loading (but none of
that is done yet).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@138986 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Frontend/ASTUnit.cpp')
-rw-r--r-- | lib/Frontend/ASTUnit.cpp | 7 |
1 files changed, 1 insertions, 6 deletions
diff --git a/lib/Frontend/ASTUnit.cpp b/lib/Frontend/ASTUnit.cpp index 34a6dabf64..b8551e9a42 100644 --- a/lib/Frontend/ASTUnit.cpp +++ b/lib/Frontend/ASTUnit.cpp @@ -624,8 +624,7 @@ ASTUnit *ASTUnit::LoadFromASTFile(const std::string &Filename, /*DelayInitialization=*/true); ASTContext &Context = *AST->Ctx; - Reader.reset(new ASTReader(AST->getSourceManager(), AST->getFileManager(), - AST->getDiagnostics())); + Reader.reset(new ASTReader(PP, Context)); // Recover resources if we crash before exiting this method. llvm::CrashRecoveryContextCleanupRegistrar<ASTReader> @@ -649,11 +648,7 @@ ASTUnit *ASTUnit::LoadFromASTFile(const std::string &Filename, PP.setPredefines(Reader->getSuggestedPredefines()); PP.setCounterValue(Counter); - Reader->setPreprocessor(PP); - // Create and initialize the ASTContext. - Reader->InitializeContext(Context); - // Attach the AST reader to the AST context as an external AST // source, so that declarations will be deserialized from the // AST file as needed. |