diff options
author | Jan Svoboda <jan_svoboda@apple.com> | 2025-04-25 07:38:51 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-04-25 07:38:51 -0700 |
commit | 77148fce6f35743c368e6c01ad24ebcec9fdea13 (patch) | |
tree | 061e06c2a4ef86e29d88c96e5628e01142eae6cc /clang/lib/Frontend | |
parent | 09b012fa2d4f547e5359b8e1ace634b74bb9eebd (diff) | |
download | llvm-77148fce6f35743c368e6c01ad24ebcec9fdea13.zip llvm-77148fce6f35743c368e6c01ad24ebcec9fdea13.tar.gz llvm-77148fce6f35743c368e6c01ad24ebcec9fdea13.tar.bz2 |
[clang] Do not share ownership of `HeaderSearchOptions` (#132984)
This PR makes it so that `CompilerInvocation` is the sole owner of the
`HeaderSearchOptions` instance.
Diffstat (limited to 'clang/lib/Frontend')
-rw-r--r-- | clang/lib/Frontend/ASTMerge.cpp | 2 | ||||
-rw-r--r-- | clang/lib/Frontend/ASTUnit.cpp | 5 | ||||
-rw-r--r-- | clang/lib/Frontend/FrontendAction.cpp | 6 |
3 files changed, 5 insertions, 8 deletions
diff --git a/clang/lib/Frontend/ASTMerge.cpp b/clang/lib/Frontend/ASTMerge.cpp index 1e3a5c0..b6b0644 100644 --- a/clang/lib/Frontend/ASTMerge.cpp +++ b/clang/lib/Frontend/ASTMerge.cpp @@ -48,7 +48,7 @@ void ASTMergeAction::ExecuteAction() { /*ShouldOwnClient=*/true)); std::unique_ptr<ASTUnit> Unit = ASTUnit::LoadFromASTFile( ASTFiles[I], CI.getPCHContainerReader(), ASTUnit::LoadEverything, Diags, - CI.getFileSystemOpts(), CI.getHeaderSearchOptsPtr()); + CI.getFileSystemOpts(), CI.getHeaderSearchOpts()); if (!Unit) continue; diff --git a/clang/lib/Frontend/ASTUnit.cpp b/clang/lib/Frontend/ASTUnit.cpp index 04ddc93..23a1324 100644 --- a/clang/lib/Frontend/ASTUnit.cpp +++ b/clang/lib/Frontend/ASTUnit.cpp @@ -804,8 +804,7 @@ void ASTUnit::ConfigureDiags(IntrusiveRefCntPtr<DiagnosticsEngine> Diags, std::unique_ptr<ASTUnit> ASTUnit::LoadFromASTFile( StringRef Filename, const PCHContainerReader &PCHContainerRdr, WhatToLoad ToLoad, IntrusiveRefCntPtr<DiagnosticsEngine> Diags, - const FileSystemOptions &FileSystemOpts, - std::shared_ptr<HeaderSearchOptions> HSOpts, + const FileSystemOptions &FileSystemOpts, const HeaderSearchOptions &HSOpts, std::shared_ptr<LangOptions> LangOpts, bool OnlyLocalDecls, CaptureDiagsKind CaptureDiagnostics, bool AllowASTWithCompilerErrors, bool UserFilesAreVolatile, IntrusiveRefCntPtr<llvm::vfs::FileSystem> VFS) { @@ -830,7 +829,7 @@ std::unique_ptr<ASTUnit> ASTUnit::LoadFromASTFile( AST->getFileManager(), UserFilesAreVolatile); AST->ModCache = createCrossProcessModuleCache(); - AST->HSOpts = HSOpts ? HSOpts : std::make_shared<HeaderSearchOptions>(); + AST->HSOpts = std::make_unique<HeaderSearchOptions>(HSOpts); AST->HSOpts->ModuleFormat = std::string(PCHContainerRdr.getFormats().front()); AST->HeaderInfo.reset(new HeaderSearch(AST->getHeaderSearchOpts(), AST->getSourceManager(), diff --git a/clang/lib/Frontend/FrontendAction.cpp b/clang/lib/Frontend/FrontendAction.cpp index 1c4dec0..783d1a64 100644 --- a/clang/lib/Frontend/FrontendAction.cpp +++ b/clang/lib/Frontend/FrontendAction.cpp @@ -780,8 +780,7 @@ bool FrontendAction::BeginSourceFile(CompilerInstance &CI, std::unique_ptr<ASTUnit> AST = ASTUnit::LoadFromASTFile( InputFile, CI.getPCHContainerReader(), ASTUnit::LoadPreprocessorOnly, - ASTDiags, CI.getFileSystemOpts(), - /*HeaderSearchOptions=*/nullptr); + ASTDiags, CI.getFileSystemOpts(), CI.getHeaderSearchOpts()); if (!AST) return false; @@ -848,8 +847,7 @@ bool FrontendAction::BeginSourceFile(CompilerInstance &CI, std::unique_ptr<ASTUnit> AST = ASTUnit::LoadFromASTFile( InputFile, CI.getPCHContainerReader(), ASTUnit::LoadEverything, Diags, - CI.getFileSystemOpts(), CI.getHeaderSearchOptsPtr(), - CI.getLangOptsPtr()); + CI.getFileSystemOpts(), CI.getHeaderSearchOpts(), CI.getLangOptsPtr()); if (!AST) return false; |