diff options
Diffstat (limited to 'lib/Frontend')
-rw-r--r-- | lib/Frontend/ASTUnit.cpp | 7 | ||||
-rw-r--r-- | lib/Frontend/CompilerInstance.cpp | 4 |
2 files changed, 3 insertions, 8 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. diff --git a/lib/Frontend/CompilerInstance.cpp b/lib/Frontend/CompilerInstance.cpp index 2252cd6f95..bd019e0cf2 100644 --- a/lib/Frontend/CompilerInstance.cpp +++ b/lib/Frontend/CompilerInstance.cpp @@ -273,7 +273,7 @@ CompilerInstance::createPCHExternalASTSource(StringRef Path, void *DeserializationListener, bool Preamble) { llvm::OwningPtr<ASTReader> Reader; - Reader.reset(new ASTReader(PP, &Context, + Reader.reset(new ASTReader(PP, Context, Sysroot.empty() ? "" : Sysroot.c_str(), DisablePCHValidation, DisableStatCache)); @@ -655,7 +655,7 @@ ModuleKey CompilerInstance::loadModule(SourceLocation ImportLoc, if (!ModuleManager) { std::string Sysroot = getHeaderSearchOpts().Sysroot; const PreprocessorOptions &PPOpts = getPreprocessorOpts(); - ModuleManager = new ASTReader(getPreprocessor(), &*Context, + ModuleManager = new ASTReader(getPreprocessor(), *Context, Sysroot.empty() ? "" : Sysroot.c_str(), PPOpts.DisablePCHValidation, PPOpts.DisableStatCache); |