diff options
author | Jan Svoboda <jan_svoboda@apple.com> | 2025-05-22 12:51:28 -0700 |
---|---|---|
committer | Jan Svoboda <jan_svoboda@apple.com> | 2025-05-22 12:52:03 -0700 |
commit | 13e1a2cb2246dc5e9a4afcdacabed4d43154ec3f (patch) | |
tree | 44ef419d0d5533ac9464061a6801ed0db1c93a49 /clang/lib/Frontend/CreateInvocationFromCommandLine.cpp | |
parent | 45f6036533bd30966f5e815568b792a7e293a0e8 (diff) | |
download | llvm-13e1a2cb2246dc5e9a4afcdacabed4d43154ec3f.zip llvm-13e1a2cb2246dc5e9a4afcdacabed4d43154ec3f.tar.gz llvm-13e1a2cb2246dc5e9a4afcdacabed4d43154ec3f.tar.bz2 |
Reapply "[clang] Remove intrusive reference count from `DiagnosticOptions` (#139584)"
This reverts commit e2a885537f11f8d9ced1c80c2c90069ab5adeb1d. Build failures were fixed right away and reverting the original commit without the fixes breaks the build again.
Diffstat (limited to 'clang/lib/Frontend/CreateInvocationFromCommandLine.cpp')
-rw-r--r-- | clang/lib/Frontend/CreateInvocationFromCommandLine.cpp | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/clang/lib/Frontend/CreateInvocationFromCommandLine.cpp b/clang/lib/Frontend/CreateInvocationFromCommandLine.cpp index d0b855f..99212b8 100644 --- a/clang/lib/Frontend/CreateInvocationFromCommandLine.cpp +++ b/clang/lib/Frontend/CreateInvocationFromCommandLine.cpp @@ -31,11 +31,15 @@ std::unique_ptr<CompilerInvocation> clang::createInvocation(ArrayRef<const char *> ArgList, CreateInvocationOptions Opts) { assert(!ArgList.empty()); - auto Diags = Opts.Diags - ? std::move(Opts.Diags) - : CompilerInstance::createDiagnostics( - Opts.VFS ? *Opts.VFS : *llvm::vfs::getRealFileSystem(), - new DiagnosticOptions); + std::optional<DiagnosticOptions> LocalDiagOpts; + IntrusiveRefCntPtr<DiagnosticsEngine> Diags; + if (Opts.Diags) { + Diags = std::move(Opts.Diags); + } else { + LocalDiagOpts.emplace(); + Diags = CompilerInstance::createDiagnostics( + Opts.VFS ? *Opts.VFS : *llvm::vfs::getRealFileSystem(), *LocalDiagOpts); + } SmallVector<const char *, 16> Args(ArgList); |