summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/Frontend/ASTUnit.cpp12
-rw-r--r--clang/lib/Frontend/CompilerInstance.cpp5
-rw-r--r--clang/lib/Lex/Preprocessor.cpp2
3 files changed, 10 insertions, 9 deletions
diff --git a/clang/lib/Frontend/ASTUnit.cpp b/clang/lib/Frontend/ASTUnit.cpp
index 5a88bc4083a..760918c9088 100644
--- a/clang/lib/Frontend/ASTUnit.cpp
+++ b/clang/lib/Frontend/ASTUnit.cpp
@@ -683,7 +683,7 @@ std::unique_ptr<ASTUnit> ASTUnit::LoadFromASTFile(
AST->ASTFileLangOpts,
/*Target=*/nullptr));
- PreprocessorOptions *PPOpts = new PreprocessorOptions();
+ auto PPOpts = std::make_shared<PreprocessorOptions>();
for (const auto &RemappedFile : RemappedFiles)
PPOpts->addRemappedFile(RemappedFile.first, RemappedFile.second);
@@ -693,11 +693,11 @@ std::unique_ptr<ASTUnit> ASTUnit::LoadFromASTFile(
HeaderSearch &HeaderInfo = *AST->HeaderInfo;
unsigned Counter;
- AST->PP =
- new Preprocessor(PPOpts, AST->getDiagnostics(), AST->ASTFileLangOpts,
- AST->getSourceManager(), HeaderInfo, *AST,
- /*IILookup=*/nullptr,
- /*OwnsHeaderSearch=*/false);
+ AST->PP = new Preprocessor(std::move(PPOpts), AST->getDiagnostics(),
+ AST->ASTFileLangOpts, AST->getSourceManager(),
+ HeaderInfo, *AST,
+ /*IILookup=*/nullptr,
+ /*OwnsHeaderSearch=*/false);
Preprocessor &PP = *AST->PP;
AST->Ctx = new ASTContext(AST->ASTFileLangOpts, AST->getSourceManager(),
diff --git a/clang/lib/Frontend/CompilerInstance.cpp b/clang/lib/Frontend/CompilerInstance.cpp
index 9c4c2a67b9c..10b8c7f4ff0 100644
--- a/clang/lib/Frontend/CompilerInstance.cpp
+++ b/clang/lib/Frontend/CompilerInstance.cpp
@@ -370,8 +370,9 @@ void CompilerInstance::createPreprocessor(TranslationUnitKind TUKind) {
getDiagnostics(),
getLangOpts(),
&getTarget());
- PP = new Preprocessor(&getPreprocessorOpts(), getDiagnostics(), getLangOpts(),
- getSourceManager(), *HeaderInfo, *this, PTHMgr,
+ PP = new Preprocessor(Invocation->getPreprocessorOptsPtr(), getDiagnostics(),
+ getLangOpts(), getSourceManager(), *HeaderInfo, *this,
+ PTHMgr,
/*OwnsHeaderSearch=*/true, TUKind);
PP->Initialize(getTarget(), getAuxTarget());
diff --git a/clang/lib/Lex/Preprocessor.cpp b/clang/lib/Lex/Preprocessor.cpp
index 0f7473b8c1f..91319bedd6f 100644
--- a/clang/lib/Lex/Preprocessor.cpp
+++ b/clang/lib/Lex/Preprocessor.cpp
@@ -68,7 +68,7 @@ LLVM_INSTANTIATE_REGISTRY(PragmaHandlerRegistry)
//===----------------------------------------------------------------------===//
ExternalPreprocessorSource::~ExternalPreprocessorSource() { }
-Preprocessor::Preprocessor(IntrusiveRefCntPtr<PreprocessorOptions> PPOpts,
+Preprocessor::Preprocessor(std::shared_ptr<PreprocessorOptions> PPOpts,
DiagnosticsEngine &diags, LangOptions &opts,
SourceManager &SM, HeaderSearch &Headers,
ModuleLoader &TheModuleLoader,
OpenPOWER on IntegriCloud