From e2a885537f11f8d9ced1c80c2c90069ab5adeb1d Mon Sep 17 00:00:00 2001 From: Kazu Hirata Date: Thu, 22 May 2025 12:44:20 -0700 Subject: Revert "[clang] Remove intrusive reference count from `DiagnosticOptions` (#139584)" This reverts commit 9e306ad4600c4d3392c194a8be88919ee758425c. Multiple builtbot failures have been reported: https://github.com/llvm/llvm-project/pull/139584 --- clang/lib/Frontend/CreateInvocationFromCommandLine.cpp | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) (limited to 'clang/lib/Frontend/CreateInvocationFromCommandLine.cpp') diff --git a/clang/lib/Frontend/CreateInvocationFromCommandLine.cpp b/clang/lib/Frontend/CreateInvocationFromCommandLine.cpp index 99212b8..d0b855f 100644 --- a/clang/lib/Frontend/CreateInvocationFromCommandLine.cpp +++ b/clang/lib/Frontend/CreateInvocationFromCommandLine.cpp @@ -31,15 +31,11 @@ std::unique_ptr clang::createInvocation(ArrayRef ArgList, CreateInvocationOptions Opts) { assert(!ArgList.empty()); - std::optional LocalDiagOpts; - IntrusiveRefCntPtr Diags; - if (Opts.Diags) { - Diags = std::move(Opts.Diags); - } else { - LocalDiagOpts.emplace(); - Diags = CompilerInstance::createDiagnostics( - Opts.VFS ? *Opts.VFS : *llvm::vfs::getRealFileSystem(), *LocalDiagOpts); - } + auto Diags = Opts.Diags + ? std::move(Opts.Diags) + : CompilerInstance::createDiagnostics( + Opts.VFS ? *Opts.VFS : *llvm::vfs::getRealFileSystem(), + new DiagnosticOptions); SmallVector Args(ArgList); -- cgit v1.1