Skip to content

[clang] Remove intrusive reference count from DiagnosticOptions #139584

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
May 22, 2025

Conversation

jansvoboda11
Copy link
Contributor

The DiagnosticOptions class is currently intrusively reference-counted, which makes reasoning about its lifetime very difficult in some cases. For example, CompilerInvocation owns the DiagnosticOptions instance (wrapped in llvm::IntrusiveRefCntPtr) and only exposes an accessor returning DiagnosticOptions &. One would think this gives CompilerInvocation exclusive ownership of the object, but that's not the case:

void shareOwnership(CompilerInvocation &CI) {
  llvm::IntrusiveRefCntPtr<DiagnosticOptions> CoOwner = &CI.getDiagnosticOptions();
 // ...
}

This is a perfectly valid pattern that is being actually used in the codebase.

I would like to ensure the ownership of DiagnosticOptions by CompilerInvocation is guaranteed to be exclusive. This can be leveraged for a copy-on-write optimization later on. This PR changes usages of DiagnosticOptions across clang, clang-tools-extra and lldb to not be intrusively reference-counted.

@jansvoboda11 jansvoboda11 requested a review from cyndyishida as a code owner May 12, 2025 17:07
@llvmbot llvmbot added clang Clang issues not falling into any other category clang-tools-extra lldb clangd clang-tidy clang:driver 'clang' and 'clang++' user-facing binaries. Not 'clang-cl' clang-format clang:frontend Language frontend issues, e.g. anything involving "Sema" clang:modules C++20 modules and Clang Header Modules clang:as-a-library libclang and C++ API HLSL HLSL Language Support clang:dataflow Clang Dataflow Analysis framework - https://clang.llvm.org/docs/DataFlowAnalysisIntro.html labels May 12, 2025
@llvmbot
Copy link
Member

llvmbot commented May 12, 2025

@llvm/pr-subscribers-lldb
@llvm/pr-subscribers-clangd
@llvm/pr-subscribers-clang-tools-extra
@llvm/pr-subscribers-clang-format

@llvm/pr-subscribers-clang

Author: Jan Svoboda (jansvoboda11)

Changes

The DiagnosticOptions class is currently intrusively reference-counted, which makes reasoning about its lifetime very difficult in some cases. For example, CompilerInvocation owns the DiagnosticOptions instance (wrapped in llvm::IntrusiveRefCntPtr) and only exposes an accessor returning DiagnosticOptions &amp;. One would think this gives CompilerInvocation exclusive ownership of the object, but that's not the case:

void shareOwnership(CompilerInvocation &amp;CI) {
  llvm::IntrusiveRefCntPtr&lt;DiagnosticOptions&gt; CoOwner = &amp;CI.getDiagnosticOptions();
 // ...
}

This is a perfectly valid pattern that is being actually used in the codebase.

I would like to ensure the ownership of DiagnosticOptions by CompilerInvocation is guaranteed to be exclusive. This can be leveraged for a copy-on-write optimization later on. This PR changes usages of DiagnosticOptions across clang, clang-tools-extra and lldb to not be intrusively reference-counted.


Patch is 189.21 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/139584.diff

134 Files Affected:

  • (modified) clang-tools-extra/clang-apply-replacements/tool/ClangApplyReplacementsMain.cpp (+2-2)
  • (modified) clang-tools-extra/clang-change-namespace/tool/ClangChangeNamespace.cpp (+3-3)
  • (modified) clang-tools-extra/clang-include-fixer/tool/ClangIncludeFixer.cpp (+3-3)
  • (modified) clang-tools-extra/clang-move/tool/ClangMove.cpp (+3-3)
  • (modified) clang-tools-extra/clang-query/Query.cpp (+1-1)
  • (modified) clang-tools-extra/clang-reorder-fields/tool/ClangReorderFields.cpp (+3-3)
  • (modified) clang-tools-extra/clang-tidy/ClangTidy.cpp (+12-12)
  • (modified) clang-tools-extra/clang-tidy/ClangTidyDiagnosticConsumer.cpp (+2-2)
  • (modified) clang-tools-extra/clang-tidy/ClangTidyDiagnosticConsumer.h (+4-1)
  • (modified) clang-tools-extra/clang-tidy/ExpandModularHeadersPPCallbacks.cpp (+1-1)
  • (modified) clang-tools-extra/clang-tidy/ExpandModularHeadersPPCallbacks.h (+1)
  • (modified) clang-tools-extra/clangd/Compiler.cpp (+3-2)
  • (modified) clang-tools-extra/clangd/ModulesBuilder.cpp (+2-2)
  • (modified) clang-tools-extra/clangd/ParsedAST.cpp (+2-1)
  • (modified) clang-tools-extra/clangd/Preamble.cpp (+1-1)
  • (modified) clang-tools-extra/clangd/SystemIncludeExtractor.cpp (+2-1)
  • (modified) clang-tools-extra/clangd/unittests/ConfigCompileTests.cpp (+2-1)
  • (modified) clang-tools-extra/clangd/unittests/tweaks/TweakTests.cpp (+2-1)
  • (modified) clang-tools-extra/include-cleaner/unittests/RecordTest.cpp (+2-2)
  • (modified) clang-tools-extra/include-cleaner/unittests/WalkASTTest.cpp (+3-3)
  • (modified) clang-tools-extra/modularize/ModularizeUtilities.cpp (+2-4)
  • (modified) clang-tools-extra/modularize/ModularizeUtilities.h (+1-1)
  • (modified) clang-tools-extra/unittests/clang-apply-replacements/ApplyReplacementsTest.cpp (+2-2)
  • (modified) clang-tools-extra/unittests/clang-tidy/ClangTidyOptionsTest.cpp (+9-9)
  • (modified) clang-tools-extra/unittests/clang-tidy/ClangTidyTest.h (+3-3)
  • (modified) clang/include/clang/Basic/Diagnostic.h (+3-3)
  • (modified) clang/include/clang/Basic/DiagnosticOptions.h (+1-3)
  • (modified) clang/include/clang/Basic/SourceManager.h (+1)
  • (modified) clang/include/clang/Frontend/ASTUnit.h (+2)
  • (modified) clang/include/clang/Frontend/CompilerInstance.h (+1-1)
  • (modified) clang/include/clang/Frontend/CompilerInvocation.h (+1-1)
  • (modified) clang/include/clang/Frontend/DiagnosticRenderer.h (+3-4)
  • (modified) clang/include/clang/Frontend/LogDiagnosticPrinter.h (+2-2)
  • (modified) clang/include/clang/Frontend/SARIFDiagnostic.h (+1-1)
  • (modified) clang/include/clang/Frontend/SARIFDiagnosticPrinter.h (+2-2)
  • (modified) clang/include/clang/Frontend/SerializedDiagnosticPrinter.h (+1-1)
  • (modified) clang/include/clang/Frontend/TextDiagnostic.h (+1-1)
  • (modified) clang/include/clang/Frontend/TextDiagnosticPrinter.h (+2-2)
  • (modified) clang/include/clang/Serialization/ASTReader.h (+4-5)
  • (modified) clang/lib/Basic/Diagnostic.cpp (+5-5)
  • (modified) clang/lib/Basic/SourceManager.cpp (+2-2)
  • (modified) clang/lib/CrossTU/CrossTranslationUnit.cpp (+9-9)
  • (modified) clang/lib/Frontend/ASTMerge.cpp (+4-5)
  • (modified) clang/lib/Frontend/ASTUnit.cpp (+2)
  • (modified) clang/lib/Frontend/ChainedIncludesSource.cpp (+2-2)
  • (modified) clang/lib/Frontend/CompilerInstance.cpp (+13-14)
  • (modified) clang/lib/Frontend/CompilerInvocation.cpp (+7-20)
  • (modified) clang/lib/Frontend/CreateInvocationFromCommandLine.cpp (+9-5)
  • (modified) clang/lib/Frontend/DiagnosticRenderer.cpp (+8-9)
  • (modified) clang/lib/Frontend/FrontendAction.cpp (+2-3)
  • (modified) clang/lib/Frontend/FrontendActions.cpp (+8-8)
  • (modified) clang/lib/Frontend/LogDiagnosticPrinter.cpp (+2-2)
  • (modified) clang/lib/Frontend/SARIFDiagnostic.cpp (+2-2)
  • (modified) clang/lib/Frontend/SARIFDiagnosticPrinter.cpp (+3-4)
  • (modified) clang/lib/Frontend/SerializedDiagnosticPrinter.cpp (+15-14)
  • (modified) clang/lib/Frontend/TextDiagnostic.cpp (+39-40)
  • (modified) clang/lib/Frontend/TextDiagnosticPrinter.cpp (+6-9)
  • (modified) clang/lib/Interpreter/Interpreter.cpp (+4-4)
  • (modified) clang/lib/Rewrite/HTMLRewrite.cpp (+2-2)
  • (modified) clang/lib/Serialization/ASTReader.cpp (+12-13)
  • (modified) clang/lib/Testing/TestAST.cpp (+1-1)
  • (modified) clang/lib/Tooling/CompilationDatabase.cpp (+4-4)
  • (modified) clang/lib/Tooling/Core/Replacement.cpp (+2-2)
  • (modified) clang/lib/Tooling/DependencyScanning/DependencyScanningWorker.cpp (+3-3)
  • (modified) clang/lib/Tooling/Refactoring.cpp (+4-4)
  • (modified) clang/lib/Tooling/Tooling.cpp (+4-4)
  • (modified) clang/tools/c-index-test/core_main.cpp (+4-2)
  • (modified) clang/tools/clang-extdef-mapping/ClangExtDefMapGen.cpp (+7-5)
  • (modified) clang/tools/clang-format/ClangFormat.cpp (+4-4)
  • (modified) clang/tools/clang-import-test/clang-import-test.cpp (+2-2)
  • (modified) clang/tools/clang-installapi/ClangInstallAPI.cpp (+4-4)
  • (modified) clang/tools/clang-scan-deps/ClangScanDeps.cpp (+5-4)
  • (modified) clang/tools/diagtool/ShowEnabledWarnings.cpp (+3-3)
  • (modified) clang/tools/diagtool/TreeView.cpp (+2-2)
  • (modified) clang/tools/driver/cc1_main.cpp (+2-2)
  • (modified) clang/tools/driver/cc1as_main.cpp (+4-4)
  • (modified) clang/tools/driver/cc1gen_reproducer_main.cpp (+3-3)
  • (modified) clang/tools/driver/driver.cpp (+5-6)
  • (modified) clang/tools/libclang/CIndex.cpp (+5-4)
  • (modified) clang/tools/libclang/CIndexCodeCompletion.cpp (+5-5)
  • (modified) clang/tools/libclang/CIndexDiagnostic.cpp (+8-9)
  • (modified) clang/tools/libclang/Indexing.cpp (+2-1)
  • (modified) clang/unittests/AST/ASTVectorTest.cpp (+2-1)
  • (modified) clang/unittests/AST/CommentLexer.cpp (+4-6)
  • (modified) clang/unittests/AST/CommentParser.cpp (+4-6)
  • (modified) clang/unittests/AST/CommentTextTest.cpp (+2-1)
  • (modified) clang/unittests/AST/ExternalASTSourceTest.cpp (+2-2)
  • (modified) clang/unittests/Analysis/FlowSensitive/UncheckedOptionalAccessModelTest.cpp (+2-3)
  • (modified) clang/unittests/Analysis/MacroExpansionContextTest.cpp (+3-3)
  • (modified) clang/unittests/Analysis/UnsafeBufferUsageTest.cpp (+2-1)
  • (modified) clang/unittests/Basic/DiagnosticTest.cpp (+14-9)
  • (modified) clang/unittests/Basic/SarifTest.cpp (+3-3)
  • (modified) clang/unittests/Basic/SourceManagerTest.cpp (+4-5)
  • (modified) clang/unittests/Driver/DXCModeTest.cpp (+6-6)
  • (modified) clang/unittests/Driver/SanitizerArgsTest.cpp (+3-4)
  • (modified) clang/unittests/Driver/SimpleDiagnosticConsumer.h (+2-3)
  • (modified) clang/unittests/Driver/ToolChainTest.cpp (+36-35)
  • (modified) clang/unittests/Frontend/ASTUnitTest.cpp (+14-13)
  • (modified) clang/unittests/Frontend/CompilerInstanceTest.cpp (+6-5)
  • (modified) clang/unittests/Frontend/CompilerInvocationTest.cpp (+2-1)
  • (modified) clang/unittests/Frontend/OutputStreamTest.cpp (+6-6)
  • (modified) clang/unittests/Frontend/PCHPreambleTest.cpp (+3-1)
  • (modified) clang/unittests/Frontend/ReparseWorkingDirTest.cpp (+2-1)
  • (modified) clang/unittests/Frontend/SearchPathTest.cpp (+2-2)
  • (modified) clang/unittests/Frontend/TextDiagnosticTest.cpp (+4-4)
  • (modified) clang/unittests/Frontend/UtilsTest.cpp (+5-4)
  • (modified) clang/unittests/Interpreter/InterpreterTest.cpp (+9-6)
  • (modified) clang/unittests/Lex/HeaderSearchTest.cpp (+2-1)
  • (modified) clang/unittests/Lex/LexerTest.cpp (+4-6)
  • (modified) clang/unittests/Lex/ModuleDeclStateTest.cpp (+2-1)
  • (modified) clang/unittests/Lex/PPCallbacksTest.cpp (+4-4)
  • (modified) clang/unittests/Lex/PPConditionalDirectiveRecordTest.cpp (+4-6)
  • (modified) clang/unittests/Lex/PPDependencyDirectivesTest.cpp (+2-1)
  • (modified) clang/unittests/Lex/PPMemoryAllocationsTest.cpp (+2-1)
  • (modified) clang/unittests/Parse/ParseHLSLRootSignatureTest.cpp (+2-2)
  • (modified) clang/unittests/Sema/SemaNoloadLookupTest.cpp (+2-2)
  • (modified) clang/unittests/Serialization/ForceCheckFileInputTest.cpp (+4-4)
  • (modified) clang/unittests/Serialization/LoadSpecLazilyTest.cpp (+2-1)
  • (modified) clang/unittests/Serialization/ModuleCacheTest.cpp (+4-2)
  • (modified) clang/unittests/Serialization/NoCommentsTest.cpp (+2-1)
  • (modified) clang/unittests/Serialization/PreambleInNamedModulesTest.cpp (+2-1)
  • (modified) clang/unittests/Serialization/VarDeclConstantInitTest.cpp (+2-1)
  • (modified) clang/unittests/Support/TimeProfilerTest.cpp (+2-2)
  • (modified) clang/unittests/Tooling/RewriterTestContext.h (+4-5)
  • (modified) clang/unittests/Tooling/Syntax/TokensTest.cpp (+2-1)
  • (modified) clang/unittests/Tooling/Syntax/TreeTestBase.cpp (+1-1)
  • (modified) clang/unittests/Tooling/Syntax/TreeTestBase.h (+2-2)
  • (modified) clang/unittests/Tooling/ToolingTest.cpp (+4-4)
  • (modified) lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp (+5-5)
  • (modified) lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionSourceCode.cpp (+1-2)
  • (modified) lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp (+13-8)
  • (modified) lldb/source/Plugins/Language/ClangCommon/ClangHighlighter.cpp (+1-2)
  • (modified) lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp (+2-1)
  • (modified) lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h (+1)
diff --git a/clang-tools-extra/clang-apply-replacements/tool/ClangApplyReplacementsMain.cpp b/clang-tools-extra/clang-apply-replacements/tool/ClangApplyReplacementsMain.cpp
index 68b5743c6540f..062e236d3e51f 100644
--- a/clang-tools-extra/clang-apply-replacements/tool/ClangApplyReplacementsMain.cpp
+++ b/clang-tools-extra/clang-apply-replacements/tool/ClangApplyReplacementsMain.cpp
@@ -96,9 +96,9 @@ int main(int argc, char **argv) {
   cl::SetVersionPrinter(printVersion);
   cl::ParseCommandLineOptions(argc, argv);
 
-  IntrusiveRefCntPtr<DiagnosticOptions> DiagOpts(new DiagnosticOptions());
+  DiagnosticOptions DiagOpts;
   DiagnosticsEngine Diagnostics(
-      IntrusiveRefCntPtr<DiagnosticIDs>(new DiagnosticIDs()), DiagOpts.get());
+      IntrusiveRefCntPtr<DiagnosticIDs>(new DiagnosticIDs()), DiagOpts);
 
   // Determine a formatting style from options.
   auto FormatStyleOrError = format::getStyle(FormatStyleOpt, FormatStyleConfig,
diff --git a/clang-tools-extra/clang-change-namespace/tool/ClangChangeNamespace.cpp b/clang-tools-extra/clang-change-namespace/tool/ClangChangeNamespace.cpp
index 22d26db0c11bc..2a8fe2d06d185 100644
--- a/clang-tools-extra/clang-change-namespace/tool/ClangChangeNamespace.cpp
+++ b/clang-tools-extra/clang-change-namespace/tool/ClangChangeNamespace.cpp
@@ -126,10 +126,10 @@ int main(int argc, const char **argv) {
   if (int Result = Tool.run(Factory.get()))
     return Result;
   LangOptions DefaultLangOptions;
-  IntrusiveRefCntPtr<DiagnosticOptions> DiagOpts = new DiagnosticOptions();
-  clang::TextDiagnosticPrinter DiagnosticPrinter(errs(), &*DiagOpts);
+  DiagnosticOptions DiagOpts;
+  clang::TextDiagnosticPrinter DiagnosticPrinter(errs(), DiagOpts);
   DiagnosticsEngine Diagnostics(
-      IntrusiveRefCntPtr<DiagnosticIDs>(new DiagnosticIDs()), &*DiagOpts,
+      IntrusiveRefCntPtr<DiagnosticIDs>(new DiagnosticIDs()), DiagOpts,
       &DiagnosticPrinter, false);
   auto &FileMgr = Tool.getFiles();
   SourceManager Sources(Diagnostics, FileMgr);
diff --git a/clang-tools-extra/clang-include-fixer/tool/ClangIncludeFixer.cpp b/clang-tools-extra/clang-include-fixer/tool/ClangIncludeFixer.cpp
index 6e51f25a66407..746ba7bcea015 100644
--- a/clang-tools-extra/clang-include-fixer/tool/ClangIncludeFixer.cpp
+++ b/clang-tools-extra/clang-include-fixer/tool/ClangIncludeFixer.cpp
@@ -455,9 +455,9 @@ int includeFixerMain(int argc, const char **argv) {
   }
 
   // Set up a new source manager for applying the resulting replacements.
-  IntrusiveRefCntPtr<DiagnosticOptions> DiagOpts(new DiagnosticOptions);
-  DiagnosticsEngine Diagnostics(new DiagnosticIDs, &*DiagOpts);
-  TextDiagnosticPrinter DiagnosticPrinter(outs(), &*DiagOpts);
+  DiagnosticOptions DiagOpts;
+  DiagnosticsEngine Diagnostics(new DiagnosticIDs, DiagOpts);
+  TextDiagnosticPrinter DiagnosticPrinter(outs(), DiagOpts);
   SourceManager SM(Diagnostics, tool.getFiles());
   Diagnostics.setClient(&DiagnosticPrinter, false);
 
diff --git a/clang-tools-extra/clang-move/tool/ClangMove.cpp b/clang-tools-extra/clang-move/tool/ClangMove.cpp
index 655ea81ee37d4..750eb952714f7 100644
--- a/clang-tools-extra/clang-move/tool/ClangMove.cpp
+++ b/clang-tools-extra/clang-move/tool/ClangMove.cpp
@@ -176,10 +176,10 @@ int main(int argc, const char **argv) {
     }
   }
 
-  IntrusiveRefCntPtr<DiagnosticOptions> DiagOpts(new DiagnosticOptions());
-  clang::TextDiagnosticPrinter DiagnosticPrinter(errs(), &*DiagOpts);
+  DiagnosticOptions DiagOpts;
+  clang::TextDiagnosticPrinter DiagnosticPrinter(errs(), DiagOpts);
   DiagnosticsEngine Diagnostics(
-      IntrusiveRefCntPtr<DiagnosticIDs>(new DiagnosticIDs()), &*DiagOpts,
+      IntrusiveRefCntPtr<DiagnosticIDs>(new DiagnosticIDs()), DiagOpts,
       &DiagnosticPrinter, false);
   auto &FileMgr = Tool.getFiles();
   SourceManager SM(Diagnostics, FileMgr);
diff --git a/clang-tools-extra/clang-query/Query.cpp b/clang-tools-extra/clang-query/Query.cpp
index 382aa5d6fe25e..574b64ee0f759 100644
--- a/clang-tools-extra/clang-query/Query.cpp
+++ b/clang-tools-extra/clang-query/Query.cpp
@@ -172,7 +172,7 @@ bool MatchQuery::run(llvm::raw_ostream &OS, QuerySession &QS) const {
           clang::SourceRange R = BI->second.getSourceRange();
           if (R.isValid()) {
             TextDiagnostic TD(OS, AST->getASTContext().getLangOpts(),
-                              &AST->getDiagnostics().getDiagnosticOptions());
+                              AST->getDiagnostics().getDiagnosticOptions());
             TD.emitDiagnostic(
                 FullSourceLoc(R.getBegin(), AST->getSourceManager()),
                 DiagnosticsEngine::Note, "\"" + BI->first + "\" binds here",
diff --git a/clang-tools-extra/clang-reorder-fields/tool/ClangReorderFields.cpp b/clang-tools-extra/clang-reorder-fields/tool/ClangReorderFields.cpp
index 5b77ee7b5738c..03502525417b2 100644
--- a/clang-tools-extra/clang-reorder-fields/tool/ClangReorderFields.cpp
+++ b/clang-tools-extra/clang-reorder-fields/tool/ClangReorderFields.cpp
@@ -72,10 +72,10 @@ int main(int argc, const char **argv) {
 
   int ExitCode = Tool.run(Factory.get());
   LangOptions DefaultLangOptions;
-  IntrusiveRefCntPtr<DiagnosticOptions> DiagOpts(new DiagnosticOptions());
-  TextDiagnosticPrinter DiagnosticPrinter(errs(), &*DiagOpts);
+  DiagnosticOptions DiagOpts;
+  TextDiagnosticPrinter DiagnosticPrinter(errs(), DiagOpts);
   DiagnosticsEngine Diagnostics(
-      IntrusiveRefCntPtr<DiagnosticIDs>(new DiagnosticIDs()), &*DiagOpts,
+      IntrusiveRefCntPtr<DiagnosticIDs>(new DiagnosticIDs()), DiagOpts,
       &DiagnosticPrinter, false);
 
   auto &FileMgr = Tool.getFiles();
diff --git a/clang-tools-extra/clang-tidy/ClangTidy.cpp b/clang-tools-extra/clang-tidy/ClangTidy.cpp
index 733a53a0f5dcc..26f9afbc0880e 100644
--- a/clang-tools-extra/clang-tidy/ClangTidy.cpp
+++ b/clang-tools-extra/clang-tidy/ClangTidy.cpp
@@ -97,15 +97,14 @@ class ErrorReporter {
   ErrorReporter(ClangTidyContext &Context, FixBehaviour ApplyFixes,
                 llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem> BaseFS)
       : Files(FileSystemOptions(), std::move(BaseFS)),
-        DiagOpts(new DiagnosticOptions()),
-        DiagPrinter(new TextDiagnosticPrinter(llvm::outs(), &*DiagOpts)),
-        Diags(IntrusiveRefCntPtr<DiagnosticIDs>(new DiagnosticIDs), &*DiagOpts,
+        DiagPrinter(new TextDiagnosticPrinter(llvm::outs(), DiagOpts)),
+        Diags(IntrusiveRefCntPtr<DiagnosticIDs>(new DiagnosticIDs), DiagOpts,
               DiagPrinter),
         SourceMgr(Diags, Files), Context(Context), ApplyFixes(ApplyFixes) {
-    DiagOpts->ShowColors = Context.getOptions().UseColor.value_or(
+    DiagOpts.ShowColors = Context.getOptions().UseColor.value_or(
         llvm::sys::Process::StandardOutHasColors());
     DiagPrinter->BeginSourceFile(LangOpts);
-    if (DiagOpts->ShowColors && !llvm::sys::Process::StandardOutIsDisplayed()) {
+    if (DiagOpts.ShowColors && !llvm::sys::Process::StandardOutIsDisplayed()) {
       llvm::sys::Process::UseANSIEscapeCodes(true);
     }
   }
@@ -308,7 +307,7 @@ class ErrorReporter {
 
   FileManager Files;
   LangOptions LangOpts; // FIXME: use langopts from each original file
-  IntrusiveRefCntPtr<DiagnosticOptions> DiagOpts;
+  DiagnosticOptions DiagOpts;
   DiagnosticConsumer *DiagPrinter;
   DiagnosticsEngine Diags;
   SourceManager SourceMgr;
@@ -516,10 +515,10 @@ getCheckOptions(const ClangTidyOptions &Options,
                                                 Options),
       AllowEnablingAnalyzerAlphaCheckers);
   ClangTidyDiagnosticConsumer DiagConsumer(Context);
-  DiagnosticsEngine DE(llvm::makeIntrusiveRefCnt<DiagnosticIDs>(),
-                       llvm::makeIntrusiveRefCnt<DiagnosticOptions>(),
+  auto DiagOpts = std::make_unique<DiagnosticOptions>();
+  DiagnosticsEngine DE(llvm::makeIntrusiveRefCnt<DiagnosticIDs>(), *DiagOpts,
                        &DiagConsumer, /*ShouldOwnClient=*/false);
-  Context.setDiagnosticsEngine(&DE);
+  Context.setDiagnosticsEngine(std::move(DiagOpts), &DE);
   ClangTidyASTConsumerFactory Factory(Context);
   return Factory.getCheckOptions();
 }
@@ -558,9 +557,10 @@ runClangTidy(clang::tidy::ClangTidyContext &Context,
   Context.setProfileStoragePrefix(StoreCheckProfile);
 
   ClangTidyDiagnosticConsumer DiagConsumer(Context, nullptr, true, ApplyAnyFix);
-  DiagnosticsEngine DE(new DiagnosticIDs(), new DiagnosticOptions(),
-                       &DiagConsumer, /*ShouldOwnClient=*/false);
-  Context.setDiagnosticsEngine(&DE);
+  auto DiagOpts = std::make_unique<DiagnosticOptions>();
+  DiagnosticsEngine DE(new DiagnosticIDs(), *DiagOpts, &DiagConsumer,
+                       /*ShouldOwnClient=*/false);
+  Context.setDiagnosticsEngine(std::move(DiagOpts), &DE);
   Tool.setDiagnosticConsumer(&DiagConsumer);
 
   class ActionFactory : public FrontendActionFactory {
diff --git a/clang-tools-extra/clang-tidy/ClangTidyDiagnosticConsumer.cpp b/clang-tools-extra/clang-tidy/ClangTidyDiagnosticConsumer.cpp
index b216970bfbd8c..a0253a5fd1a48 100644
--- a/clang-tools-extra/clang-tidy/ClangTidyDiagnosticConsumer.cpp
+++ b/clang-tools-extra/clang-tidy/ClangTidyDiagnosticConsumer.cpp
@@ -49,7 +49,7 @@ namespace {
 class ClangTidyDiagnosticRenderer : public DiagnosticRenderer {
 public:
   ClangTidyDiagnosticRenderer(const LangOptions &LangOpts,
-                              DiagnosticOptions *DiagOpts,
+                              DiagnosticOptions &DiagOpts,
                               ClangTidyError &Error)
       : DiagnosticRenderer(LangOpts, DiagOpts), Error(Error) {}
 
@@ -429,7 +429,7 @@ void ClangTidyDiagnosticConsumer::HandleDiagnostic(
     forwardDiagnostic(Info);
   } else {
     ClangTidyDiagnosticRenderer Converter(
-        Context.getLangOpts(), &Context.DiagEngine->getDiagnosticOptions(),
+        Context.getLangOpts(), Context.DiagEngine->getDiagnosticOptions(),
         Errors.back());
     SmallString<100> Message;
     Info.FormatDiagnostic(Message);
diff --git a/clang-tools-extra/clang-tidy/ClangTidyDiagnosticConsumer.h b/clang-tools-extra/clang-tidy/ClangTidyDiagnosticConsumer.h
index d6cf6a2b2731e..bd7a1bf2c11c7 100644
--- a/clang-tools-extra/clang-tidy/ClangTidyDiagnosticConsumer.h
+++ b/clang-tools-extra/clang-tidy/ClangTidyDiagnosticConsumer.h
@@ -75,7 +75,9 @@ class ClangTidyContext {
   /// Sets the DiagnosticsEngine that diag() will emit diagnostics to.
   // FIXME: this is required initialization, and should be a constructor param.
   // Fix the context -> diag engine -> consumer -> context initialization cycle.
-  void setDiagnosticsEngine(DiagnosticsEngine *DiagEngine) {
+  void setDiagnosticsEngine(std::unique_ptr<DiagnosticOptions> DiagOpts,
+                            DiagnosticsEngine *DiagEngine) {
+    this->DiagOpts = std::move(DiagOpts);
     this->DiagEngine = DiagEngine;
   }
 
@@ -231,6 +233,7 @@ class ClangTidyContext {
   // Writes to Stats.
   friend class ClangTidyDiagnosticConsumer;
 
+  std::unique_ptr<DiagnosticOptions> DiagOpts = nullptr;
   DiagnosticsEngine *DiagEngine = nullptr;
   std::unique_ptr<ClangTidyOptionsProvider> OptionsProvider;
 
diff --git a/clang-tools-extra/clang-tidy/ExpandModularHeadersPPCallbacks.cpp b/clang-tools-extra/clang-tidy/ExpandModularHeadersPPCallbacks.cpp
index 03a3e8404e069..6a84704434c33 100644
--- a/clang-tools-extra/clang-tidy/ExpandModularHeadersPPCallbacks.cpp
+++ b/clang-tools-extra/clang-tidy/ExpandModularHeadersPPCallbacks.cpp
@@ -71,7 +71,7 @@ ExpandModularHeadersPPCallbacks::ExpandModularHeadersPPCallbacks(
       InMemoryFs(new llvm::vfs::InMemoryFileSystem),
       Sources(Compiler.getSourceManager()),
       // Forward the new diagnostics to the original DiagnosticConsumer.
-      Diags(new DiagnosticIDs, new DiagnosticOptions,
+      Diags(new DiagnosticIDs, DiagOpts,
             new ForwardingDiagnosticConsumer(Compiler.getDiagnosticClient())),
       LangOpts(Compiler.getLangOpts()), HSOpts(Compiler.getHeaderSearchOpts()) {
   // Add a FileSystem containing the extra files needed in place of modular
diff --git a/clang-tools-extra/clang-tidy/ExpandModularHeadersPPCallbacks.h b/clang-tools-extra/clang-tidy/ExpandModularHeadersPPCallbacks.h
index a263681b3c633..c3478917ef498 100644
--- a/clang-tools-extra/clang-tidy/ExpandModularHeadersPPCallbacks.h
+++ b/clang-tools-extra/clang-tidy/ExpandModularHeadersPPCallbacks.h
@@ -128,6 +128,7 @@ class ExpandModularHeadersPPCallbacks : public PPCallbacks {
   llvm::IntrusiveRefCntPtr<llvm::vfs::InMemoryFileSystem> InMemoryFs;
 
   SourceManager &Sources;
+  DiagnosticOptions DiagOpts;
   DiagnosticsEngine Diags;
   LangOptions LangOpts;
   HeaderSearchOptions HSOpts;
diff --git a/clang-tools-extra/clangd/Compiler.cpp b/clang-tools-extra/clangd/Compiler.cpp
index 9be0152afd2f7..8b3865c8a8e5c 100644
--- a/clang-tools-extra/clangd/Compiler.cpp
+++ b/clang-tools-extra/clangd/Compiler.cpp
@@ -110,8 +110,9 @@ buildCompilerInvocation(const ParseInputs &Inputs, clang::DiagnosticConsumer &D,
   CIOpts.VFS = Inputs.TFS->view(Inputs.CompileCommand.Directory);
   CIOpts.CC1Args = CC1Args;
   CIOpts.RecoverOnError = true;
-  CIOpts.Diags = CompilerInstance::createDiagnostics(
-      *CIOpts.VFS, new DiagnosticOptions, &D, false);
+  DiagnosticOptions DiagOpts;
+  CIOpts.Diags =
+      CompilerInstance::createDiagnostics(*CIOpts.VFS, DiagOpts, &D, false);
   CIOpts.ProbePrecompiled = false;
   std::unique_ptr<CompilerInvocation> CI = createInvocation(ArgStrs, CIOpts);
   if (!CI)
diff --git a/clang-tools-extra/clangd/ModulesBuilder.cpp b/clang-tools-extra/clangd/ModulesBuilder.cpp
index c1878f91b5e16..bf77f43bd28bb 100644
--- a/clang-tools-extra/clangd/ModulesBuilder.cpp
+++ b/clang-tools-extra/clangd/ModulesBuilder.cpp
@@ -187,9 +187,9 @@ bool IsModuleFileUpToDate(PathRef ModuleFilePath,
   HSOpts.ValidateASTInputFilesContent = true;
 
   clang::clangd::IgnoreDiagnostics IgnoreDiags;
+  DiagnosticOptions DiagOpts;
   IntrusiveRefCntPtr<DiagnosticsEngine> Diags =
-      CompilerInstance::createDiagnostics(*VFS, new DiagnosticOptions,
-                                          &IgnoreDiags,
+      CompilerInstance::createDiagnostics(*VFS, DiagOpts, &IgnoreDiags,
                                           /*ShouldOwnClient=*/false);
 
   LangOptions LangOpts;
diff --git a/clang-tools-extra/clangd/ParsedAST.cpp b/clang-tools-extra/clangd/ParsedAST.cpp
index 3f63daaf400db..9e1f6bb977226 100644
--- a/clang-tools-extra/clangd/ParsedAST.cpp
+++ b/clang-tools-extra/clangd/ParsedAST.cpp
@@ -556,7 +556,8 @@ ParsedAST::build(llvm::StringRef Filename, const ParseInputs &Inputs,
         *AllCTFactories, Cfg.Diagnostics.ClangTidy.FastCheckFilter);
     CTContext.emplace(std::make_unique<tidy::DefaultOptionsProvider>(
         tidy::ClangTidyGlobalOptions(), ClangTidyOpts));
-    CTContext->setDiagnosticsEngine(&Clang->getDiagnostics());
+    // The lifetime of DiagnosticOptions is managed by \c Clang.
+    CTContext->setDiagnosticsEngine(nullptr, &Clang->getDiagnostics());
     CTContext->setASTContext(&Clang->getASTContext());
     CTContext->setCurrentFile(Filename);
     CTContext->setSelfContainedDiags(true);
diff --git a/clang-tools-extra/clangd/Preamble.cpp b/clang-tools-extra/clangd/Preamble.cpp
index ba9a53db8a0dc..7b4d63ff197e7 100644
--- a/clang-tools-extra/clangd/Preamble.cpp
+++ b/clang-tools-extra/clangd/Preamble.cpp
@@ -615,7 +615,7 @@ buildPreamble(PathRef FileName, CompilerInvocation CI,
       });
   auto VFS = Inputs.TFS->view(Inputs.CompileCommand.Directory);
   llvm::IntrusiveRefCntPtr<DiagnosticsEngine> PreambleDiagsEngine =
-      CompilerInstance::createDiagnostics(*VFS, &CI.getDiagnosticOpts(),
+      CompilerInstance::createDiagnostics(*VFS, CI.getDiagnosticOpts(),
                                           &PreambleDiagnostics,
                                           /*ShouldOwnClient=*/false);
   const Config &Cfg = Config::current();
diff --git a/clang-tools-extra/clangd/SystemIncludeExtractor.cpp b/clang-tools-extra/clangd/SystemIncludeExtractor.cpp
index 6417bf8765622..0b067e8b0b2b2 100644
--- a/clang-tools-extra/clangd/SystemIncludeExtractor.cpp
+++ b/clang-tools-extra/clangd/SystemIncludeExtractor.cpp
@@ -253,7 +253,8 @@ namespace {
 bool isValidTarget(llvm::StringRef Triple) {
   std::shared_ptr<TargetOptions> TargetOpts(new TargetOptions);
   TargetOpts->Triple = Triple.str();
-  DiagnosticsEngine Diags(new DiagnosticIDs, new DiagnosticOptions,
+  DiagnosticOptions DiagOpts;
+  DiagnosticsEngine Diags(new DiagnosticIDs, DiagOpts,
                           new IgnoringDiagConsumer);
   llvm::IntrusiveRefCntPtr<TargetInfo> Target =
       TargetInfo::CreateTargetInfo(Diags, *TargetOpts);
diff --git a/clang-tools-extra/clangd/unittests/ConfigCompileTests.cpp b/clang-tools-extra/clangd/unittests/ConfigCompileTests.cpp
index c3e484a1a79c4..75d0ff244038d 100644
--- a/clang-tools-extra/clangd/unittests/ConfigCompileTests.cpp
+++ b/clang-tools-extra/clangd/unittests/ConfigCompileTests.cpp
@@ -298,7 +298,8 @@ TEST_F(ConfigCompileTests, DiagnosticSuppression) {
                                    "unreachable-code", "unused-variable",
                                    "typecheck_bool_condition",
                                    "unexpected_friend", "warn_alloca"));
-  clang::DiagnosticsEngine DiagEngine(new DiagnosticIDs, nullptr,
+  clang::DiagnosticOptions DiagOpts;
+  clang::DiagnosticsEngine DiagEngine(new DiagnosticIDs, DiagOpts,
                                       new clang::IgnoringDiagConsumer);
 
   using Diag = clang::Diagnostic;
diff --git a/clang-tools-extra/clangd/unittests/tweaks/TweakTests.cpp b/clang-tools-extra/clangd/unittests/tweaks/TweakTests.cpp
index 8bd40c1429012..e39b70224d97c 100644
--- a/clang-tools-extra/clangd/unittests/tweaks/TweakTests.cpp
+++ b/clang-tools-extra/clangd/unittests/tweaks/TweakTests.cpp
@@ -44,7 +44,8 @@ TEST(FileEdits, AbsolutePath) {
   for (const auto *Path : RelPaths)
     MemFS->addFile(Path, 0, llvm::MemoryBuffer::getMemBuffer("", Path));
   FileManager FM(FileSystemOptions(), MemFS);
-  DiagnosticsEngine DE(new DiagnosticIDs, new DiagnosticOptions);
+  DiagnosticOptions DiagOpts;
+  DiagnosticsEngine DE(new DiagnosticIDs, DiagOpts);
   SourceManager SM(DE, FM);
 
   for (const auto *Path : RelPaths) {
diff --git a/clang-tools-extra/include-cleaner/unittests/RecordTest.cpp b/clang-tools-extra/include-cleaner/unittests/RecordTest.cpp
index a10c0d5a54a95..91d2697712b6e 100644
--- a/clang-tools-extra/include-cleaner/unittests/RecordTest.cpp
+++ b/clang-tools-extra/include-cleaner/unittests/RecordTest.cpp
@@ -618,8 +618,8 @@ TEST_F(PragmaIncludeTest, ExportInUnnamedBuffer) {
                  llvm::MemoryBuffer::getMemBufferCopy(Extra.getValue(),
                                                       /*BufferName=*/""));
 
-  auto DiagOpts = llvm::makeIntrusiveRefCnt<DiagnosticOptions>();
-  auto Diags = CompilerInstance::createDiagnostics(*VFS, DiagOpts.get());
+  DiagnosticOptions DiagOpts;
+  auto Diags = CompilerInstance::createDiagnostics(*VFS, DiagOpts);
   auto Invocation = std::make_unique<CompilerInvocation>();
   ASSERT_TRUE(CompilerInvocation::CreateFromArgs(*Invocation, {Filename.data()},
                                                  *Diags, "clang"));
diff --git a/clang-tools-extra/include-cleaner/unittests/WalkASTTest.cpp b/clang-tools-extra/include-cleaner/unittests/WalkASTTest.cpp
index e45ea36f7938e..5223eb563e4cb 100644
--- a/clang-tools-extra/include-cleaner/unittests/WalkASTTest.cpp
+++ b/clang-tools-extra/include-cleaner/unittests/WalkASTTest.cpp
@@ -85,9 +85,9 @@ std::vector<Decl::Kind> testWalk(llvm::StringRef TargetCode,
   // For each difference, show the target point in context, like a diagnostic.
   std::string DiagBuf;
   llvm::raw_string_ostream DiagOS(DiagBuf);
-  auto *DiagOpts = new DiagnosticOptions();
-  DiagOpts->ShowLevel = 0;
-  DiagOpts->ShowNoteIncludeStack = 0;
+  DiagnosticOptions DiagOpts;
+  DiagOpts.ShowLevel = 0;
+  DiagOpts.ShowNoteIncludeStack = 0;
   TextDiagnostic Diag(DiagOS, AST.context().getLangOpts(), DiagOpts);
   auto DiagnosePoint = [&](llvm::StringRef Message, unsigned Offset) {
     Diag.emitDiagnostic(
diff --git a/clang-tools-extra/modularize/ModularizeUtilities.cpp b/clang-tools-extra/modularize/ModularizeUtilities.cpp
index 576e863c8a9d2..b04eb80a67717 100644
--- a/clang-tools-extra/modularize/ModularizeUtilities.cpp
+++ b/clang-tools-extra/modularize/ModularizeUtilities.cpp
@@ -48,10 +48,8 @@ ModularizeUtilities::ModularizeUtilities(...
[truncated]

@llvmbot
Copy link
Member

llvmbot commented May 12, 2025

@llvm/pr-subscribers-hlsl

Author: Jan Svoboda (jansvoboda11)

Changes

The DiagnosticOptions class is currently intrusively reference-counted, which makes reasoning about its lifetime very difficult in some cases. For example, CompilerInvocation owns the DiagnosticOptions instance (wrapped in llvm::IntrusiveRefCntPtr) and only exposes an accessor returning DiagnosticOptions &amp;. One would think this gives CompilerInvocation exclusive ownership of the object, but that's not the case:

void shareOwnership(CompilerInvocation &amp;CI) {
  llvm::IntrusiveRefCntPtr&lt;DiagnosticOptions&gt; CoOwner = &amp;CI.getDiagnosticOptions();
 // ...
}

This is a perfectly valid pattern that is being actually used in the codebase.

I would like to ensure the ownership of DiagnosticOptions by CompilerInvocation is guaranteed to be exclusive. This can be leveraged for a copy-on-write optimization later on. This PR changes usages of DiagnosticOptions across clang, clang-tools-extra and lldb to not be intrusively reference-counted.


Patch is 189.21 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/139584.diff

134 Files Affected:

  • (modified) clang-tools-extra/clang-apply-replacements/tool/ClangApplyReplacementsMain.cpp (+2-2)
  • (modified) clang-tools-extra/clang-change-namespace/tool/ClangChangeNamespace.cpp (+3-3)
  • (modified) clang-tools-extra/clang-include-fixer/tool/ClangIncludeFixer.cpp (+3-3)
  • (modified) clang-tools-extra/clang-move/tool/ClangMove.cpp (+3-3)
  • (modified) clang-tools-extra/clang-query/Query.cpp (+1-1)
  • (modified) clang-tools-extra/clang-reorder-fields/tool/ClangReorderFields.cpp (+3-3)
  • (modified) clang-tools-extra/clang-tidy/ClangTidy.cpp (+12-12)
  • (modified) clang-tools-extra/clang-tidy/ClangTidyDiagnosticConsumer.cpp (+2-2)
  • (modified) clang-tools-extra/clang-tidy/ClangTidyDiagnosticConsumer.h (+4-1)
  • (modified) clang-tools-extra/clang-tidy/ExpandModularHeadersPPCallbacks.cpp (+1-1)
  • (modified) clang-tools-extra/clang-tidy/ExpandModularHeadersPPCallbacks.h (+1)
  • (modified) clang-tools-extra/clangd/Compiler.cpp (+3-2)
  • (modified) clang-tools-extra/clangd/ModulesBuilder.cpp (+2-2)
  • (modified) clang-tools-extra/clangd/ParsedAST.cpp (+2-1)
  • (modified) clang-tools-extra/clangd/Preamble.cpp (+1-1)
  • (modified) clang-tools-extra/clangd/SystemIncludeExtractor.cpp (+2-1)
  • (modified) clang-tools-extra/clangd/unittests/ConfigCompileTests.cpp (+2-1)
  • (modified) clang-tools-extra/clangd/unittests/tweaks/TweakTests.cpp (+2-1)
  • (modified) clang-tools-extra/include-cleaner/unittests/RecordTest.cpp (+2-2)
  • (modified) clang-tools-extra/include-cleaner/unittests/WalkASTTest.cpp (+3-3)
  • (modified) clang-tools-extra/modularize/ModularizeUtilities.cpp (+2-4)
  • (modified) clang-tools-extra/modularize/ModularizeUtilities.h (+1-1)
  • (modified) clang-tools-extra/unittests/clang-apply-replacements/ApplyReplacementsTest.cpp (+2-2)
  • (modified) clang-tools-extra/unittests/clang-tidy/ClangTidyOptionsTest.cpp (+9-9)
  • (modified) clang-tools-extra/unittests/clang-tidy/ClangTidyTest.h (+3-3)
  • (modified) clang/include/clang/Basic/Diagnostic.h (+3-3)
  • (modified) clang/include/clang/Basic/DiagnosticOptions.h (+1-3)
  • (modified) clang/include/clang/Basic/SourceManager.h (+1)
  • (modified) clang/include/clang/Frontend/ASTUnit.h (+2)
  • (modified) clang/include/clang/Frontend/CompilerInstance.h (+1-1)
  • (modified) clang/include/clang/Frontend/CompilerInvocation.h (+1-1)
  • (modified) clang/include/clang/Frontend/DiagnosticRenderer.h (+3-4)
  • (modified) clang/include/clang/Frontend/LogDiagnosticPrinter.h (+2-2)
  • (modified) clang/include/clang/Frontend/SARIFDiagnostic.h (+1-1)
  • (modified) clang/include/clang/Frontend/SARIFDiagnosticPrinter.h (+2-2)
  • (modified) clang/include/clang/Frontend/SerializedDiagnosticPrinter.h (+1-1)
  • (modified) clang/include/clang/Frontend/TextDiagnostic.h (+1-1)
  • (modified) clang/include/clang/Frontend/TextDiagnosticPrinter.h (+2-2)
  • (modified) clang/include/clang/Serialization/ASTReader.h (+4-5)
  • (modified) clang/lib/Basic/Diagnostic.cpp (+5-5)
  • (modified) clang/lib/Basic/SourceManager.cpp (+2-2)
  • (modified) clang/lib/CrossTU/CrossTranslationUnit.cpp (+9-9)
  • (modified) clang/lib/Frontend/ASTMerge.cpp (+4-5)
  • (modified) clang/lib/Frontend/ASTUnit.cpp (+2)
  • (modified) clang/lib/Frontend/ChainedIncludesSource.cpp (+2-2)
  • (modified) clang/lib/Frontend/CompilerInstance.cpp (+13-14)
  • (modified) clang/lib/Frontend/CompilerInvocation.cpp (+7-20)
  • (modified) clang/lib/Frontend/CreateInvocationFromCommandLine.cpp (+9-5)
  • (modified) clang/lib/Frontend/DiagnosticRenderer.cpp (+8-9)
  • (modified) clang/lib/Frontend/FrontendAction.cpp (+2-3)
  • (modified) clang/lib/Frontend/FrontendActions.cpp (+8-8)
  • (modified) clang/lib/Frontend/LogDiagnosticPrinter.cpp (+2-2)
  • (modified) clang/lib/Frontend/SARIFDiagnostic.cpp (+2-2)
  • (modified) clang/lib/Frontend/SARIFDiagnosticPrinter.cpp (+3-4)
  • (modified) clang/lib/Frontend/SerializedDiagnosticPrinter.cpp (+15-14)
  • (modified) clang/lib/Frontend/TextDiagnostic.cpp (+39-40)
  • (modified) clang/lib/Frontend/TextDiagnosticPrinter.cpp (+6-9)
  • (modified) clang/lib/Interpreter/Interpreter.cpp (+4-4)
  • (modified) clang/lib/Rewrite/HTMLRewrite.cpp (+2-2)
  • (modified) clang/lib/Serialization/ASTReader.cpp (+12-13)
  • (modified) clang/lib/Testing/TestAST.cpp (+1-1)
  • (modified) clang/lib/Tooling/CompilationDatabase.cpp (+4-4)
  • (modified) clang/lib/Tooling/Core/Replacement.cpp (+2-2)
  • (modified) clang/lib/Tooling/DependencyScanning/DependencyScanningWorker.cpp (+3-3)
  • (modified) clang/lib/Tooling/Refactoring.cpp (+4-4)
  • (modified) clang/lib/Tooling/Tooling.cpp (+4-4)
  • (modified) clang/tools/c-index-test/core_main.cpp (+4-2)
  • (modified) clang/tools/clang-extdef-mapping/ClangExtDefMapGen.cpp (+7-5)
  • (modified) clang/tools/clang-format/ClangFormat.cpp (+4-4)
  • (modified) clang/tools/clang-import-test/clang-import-test.cpp (+2-2)
  • (modified) clang/tools/clang-installapi/ClangInstallAPI.cpp (+4-4)
  • (modified) clang/tools/clang-scan-deps/ClangScanDeps.cpp (+5-4)
  • (modified) clang/tools/diagtool/ShowEnabledWarnings.cpp (+3-3)
  • (modified) clang/tools/diagtool/TreeView.cpp (+2-2)
  • (modified) clang/tools/driver/cc1_main.cpp (+2-2)
  • (modified) clang/tools/driver/cc1as_main.cpp (+4-4)
  • (modified) clang/tools/driver/cc1gen_reproducer_main.cpp (+3-3)
  • (modified) clang/tools/driver/driver.cpp (+5-6)
  • (modified) clang/tools/libclang/CIndex.cpp (+5-4)
  • (modified) clang/tools/libclang/CIndexCodeCompletion.cpp (+5-5)
  • (modified) clang/tools/libclang/CIndexDiagnostic.cpp (+8-9)
  • (modified) clang/tools/libclang/Indexing.cpp (+2-1)
  • (modified) clang/unittests/AST/ASTVectorTest.cpp (+2-1)
  • (modified) clang/unittests/AST/CommentLexer.cpp (+4-6)
  • (modified) clang/unittests/AST/CommentParser.cpp (+4-6)
  • (modified) clang/unittests/AST/CommentTextTest.cpp (+2-1)
  • (modified) clang/unittests/AST/ExternalASTSourceTest.cpp (+2-2)
  • (modified) clang/unittests/Analysis/FlowSensitive/UncheckedOptionalAccessModelTest.cpp (+2-3)
  • (modified) clang/unittests/Analysis/MacroExpansionContextTest.cpp (+3-3)
  • (modified) clang/unittests/Analysis/UnsafeBufferUsageTest.cpp (+2-1)
  • (modified) clang/unittests/Basic/DiagnosticTest.cpp (+14-9)
  • (modified) clang/unittests/Basic/SarifTest.cpp (+3-3)
  • (modified) clang/unittests/Basic/SourceManagerTest.cpp (+4-5)
  • (modified) clang/unittests/Driver/DXCModeTest.cpp (+6-6)
  • (modified) clang/unittests/Driver/SanitizerArgsTest.cpp (+3-4)
  • (modified) clang/unittests/Driver/SimpleDiagnosticConsumer.h (+2-3)
  • (modified) clang/unittests/Driver/ToolChainTest.cpp (+36-35)
  • (modified) clang/unittests/Frontend/ASTUnitTest.cpp (+14-13)
  • (modified) clang/unittests/Frontend/CompilerInstanceTest.cpp (+6-5)
  • (modified) clang/unittests/Frontend/CompilerInvocationTest.cpp (+2-1)
  • (modified) clang/unittests/Frontend/OutputStreamTest.cpp (+6-6)
  • (modified) clang/unittests/Frontend/PCHPreambleTest.cpp (+3-1)
  • (modified) clang/unittests/Frontend/ReparseWorkingDirTest.cpp (+2-1)
  • (modified) clang/unittests/Frontend/SearchPathTest.cpp (+2-2)
  • (modified) clang/unittests/Frontend/TextDiagnosticTest.cpp (+4-4)
  • (modified) clang/unittests/Frontend/UtilsTest.cpp (+5-4)
  • (modified) clang/unittests/Interpreter/InterpreterTest.cpp (+9-6)
  • (modified) clang/unittests/Lex/HeaderSearchTest.cpp (+2-1)
  • (modified) clang/unittests/Lex/LexerTest.cpp (+4-6)
  • (modified) clang/unittests/Lex/ModuleDeclStateTest.cpp (+2-1)
  • (modified) clang/unittests/Lex/PPCallbacksTest.cpp (+4-4)
  • (modified) clang/unittests/Lex/PPConditionalDirectiveRecordTest.cpp (+4-6)
  • (modified) clang/unittests/Lex/PPDependencyDirectivesTest.cpp (+2-1)
  • (modified) clang/unittests/Lex/PPMemoryAllocationsTest.cpp (+2-1)
  • (modified) clang/unittests/Parse/ParseHLSLRootSignatureTest.cpp (+2-2)
  • (modified) clang/unittests/Sema/SemaNoloadLookupTest.cpp (+2-2)
  • (modified) clang/unittests/Serialization/ForceCheckFileInputTest.cpp (+4-4)
  • (modified) clang/unittests/Serialization/LoadSpecLazilyTest.cpp (+2-1)
  • (modified) clang/unittests/Serialization/ModuleCacheTest.cpp (+4-2)
  • (modified) clang/unittests/Serialization/NoCommentsTest.cpp (+2-1)
  • (modified) clang/unittests/Serialization/PreambleInNamedModulesTest.cpp (+2-1)
  • (modified) clang/unittests/Serialization/VarDeclConstantInitTest.cpp (+2-1)
  • (modified) clang/unittests/Support/TimeProfilerTest.cpp (+2-2)
  • (modified) clang/unittests/Tooling/RewriterTestContext.h (+4-5)
  • (modified) clang/unittests/Tooling/Syntax/TokensTest.cpp (+2-1)
  • (modified) clang/unittests/Tooling/Syntax/TreeTestBase.cpp (+1-1)
  • (modified) clang/unittests/Tooling/Syntax/TreeTestBase.h (+2-2)
  • (modified) clang/unittests/Tooling/ToolingTest.cpp (+4-4)
  • (modified) lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp (+5-5)
  • (modified) lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionSourceCode.cpp (+1-2)
  • (modified) lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp (+13-8)
  • (modified) lldb/source/Plugins/Language/ClangCommon/ClangHighlighter.cpp (+1-2)
  • (modified) lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp (+2-1)
  • (modified) lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h (+1)
diff --git a/clang-tools-extra/clang-apply-replacements/tool/ClangApplyReplacementsMain.cpp b/clang-tools-extra/clang-apply-replacements/tool/ClangApplyReplacementsMain.cpp
index 68b5743c6540f..062e236d3e51f 100644
--- a/clang-tools-extra/clang-apply-replacements/tool/ClangApplyReplacementsMain.cpp
+++ b/clang-tools-extra/clang-apply-replacements/tool/ClangApplyReplacementsMain.cpp
@@ -96,9 +96,9 @@ int main(int argc, char **argv) {
   cl::SetVersionPrinter(printVersion);
   cl::ParseCommandLineOptions(argc, argv);
 
-  IntrusiveRefCntPtr<DiagnosticOptions> DiagOpts(new DiagnosticOptions());
+  DiagnosticOptions DiagOpts;
   DiagnosticsEngine Diagnostics(
-      IntrusiveRefCntPtr<DiagnosticIDs>(new DiagnosticIDs()), DiagOpts.get());
+      IntrusiveRefCntPtr<DiagnosticIDs>(new DiagnosticIDs()), DiagOpts);
 
   // Determine a formatting style from options.
   auto FormatStyleOrError = format::getStyle(FormatStyleOpt, FormatStyleConfig,
diff --git a/clang-tools-extra/clang-change-namespace/tool/ClangChangeNamespace.cpp b/clang-tools-extra/clang-change-namespace/tool/ClangChangeNamespace.cpp
index 22d26db0c11bc..2a8fe2d06d185 100644
--- a/clang-tools-extra/clang-change-namespace/tool/ClangChangeNamespace.cpp
+++ b/clang-tools-extra/clang-change-namespace/tool/ClangChangeNamespace.cpp
@@ -126,10 +126,10 @@ int main(int argc, const char **argv) {
   if (int Result = Tool.run(Factory.get()))
     return Result;
   LangOptions DefaultLangOptions;
-  IntrusiveRefCntPtr<DiagnosticOptions> DiagOpts = new DiagnosticOptions();
-  clang::TextDiagnosticPrinter DiagnosticPrinter(errs(), &*DiagOpts);
+  DiagnosticOptions DiagOpts;
+  clang::TextDiagnosticPrinter DiagnosticPrinter(errs(), DiagOpts);
   DiagnosticsEngine Diagnostics(
-      IntrusiveRefCntPtr<DiagnosticIDs>(new DiagnosticIDs()), &*DiagOpts,
+      IntrusiveRefCntPtr<DiagnosticIDs>(new DiagnosticIDs()), DiagOpts,
       &DiagnosticPrinter, false);
   auto &FileMgr = Tool.getFiles();
   SourceManager Sources(Diagnostics, FileMgr);
diff --git a/clang-tools-extra/clang-include-fixer/tool/ClangIncludeFixer.cpp b/clang-tools-extra/clang-include-fixer/tool/ClangIncludeFixer.cpp
index 6e51f25a66407..746ba7bcea015 100644
--- a/clang-tools-extra/clang-include-fixer/tool/ClangIncludeFixer.cpp
+++ b/clang-tools-extra/clang-include-fixer/tool/ClangIncludeFixer.cpp
@@ -455,9 +455,9 @@ int includeFixerMain(int argc, const char **argv) {
   }
 
   // Set up a new source manager for applying the resulting replacements.
-  IntrusiveRefCntPtr<DiagnosticOptions> DiagOpts(new DiagnosticOptions);
-  DiagnosticsEngine Diagnostics(new DiagnosticIDs, &*DiagOpts);
-  TextDiagnosticPrinter DiagnosticPrinter(outs(), &*DiagOpts);
+  DiagnosticOptions DiagOpts;
+  DiagnosticsEngine Diagnostics(new DiagnosticIDs, DiagOpts);
+  TextDiagnosticPrinter DiagnosticPrinter(outs(), DiagOpts);
   SourceManager SM(Diagnostics, tool.getFiles());
   Diagnostics.setClient(&DiagnosticPrinter, false);
 
diff --git a/clang-tools-extra/clang-move/tool/ClangMove.cpp b/clang-tools-extra/clang-move/tool/ClangMove.cpp
index 655ea81ee37d4..750eb952714f7 100644
--- a/clang-tools-extra/clang-move/tool/ClangMove.cpp
+++ b/clang-tools-extra/clang-move/tool/ClangMove.cpp
@@ -176,10 +176,10 @@ int main(int argc, const char **argv) {
     }
   }
 
-  IntrusiveRefCntPtr<DiagnosticOptions> DiagOpts(new DiagnosticOptions());
-  clang::TextDiagnosticPrinter DiagnosticPrinter(errs(), &*DiagOpts);
+  DiagnosticOptions DiagOpts;
+  clang::TextDiagnosticPrinter DiagnosticPrinter(errs(), DiagOpts);
   DiagnosticsEngine Diagnostics(
-      IntrusiveRefCntPtr<DiagnosticIDs>(new DiagnosticIDs()), &*DiagOpts,
+      IntrusiveRefCntPtr<DiagnosticIDs>(new DiagnosticIDs()), DiagOpts,
       &DiagnosticPrinter, false);
   auto &FileMgr = Tool.getFiles();
   SourceManager SM(Diagnostics, FileMgr);
diff --git a/clang-tools-extra/clang-query/Query.cpp b/clang-tools-extra/clang-query/Query.cpp
index 382aa5d6fe25e..574b64ee0f759 100644
--- a/clang-tools-extra/clang-query/Query.cpp
+++ b/clang-tools-extra/clang-query/Query.cpp
@@ -172,7 +172,7 @@ bool MatchQuery::run(llvm::raw_ostream &OS, QuerySession &QS) const {
           clang::SourceRange R = BI->second.getSourceRange();
           if (R.isValid()) {
             TextDiagnostic TD(OS, AST->getASTContext().getLangOpts(),
-                              &AST->getDiagnostics().getDiagnosticOptions());
+                              AST->getDiagnostics().getDiagnosticOptions());
             TD.emitDiagnostic(
                 FullSourceLoc(R.getBegin(), AST->getSourceManager()),
                 DiagnosticsEngine::Note, "\"" + BI->first + "\" binds here",
diff --git a/clang-tools-extra/clang-reorder-fields/tool/ClangReorderFields.cpp b/clang-tools-extra/clang-reorder-fields/tool/ClangReorderFields.cpp
index 5b77ee7b5738c..03502525417b2 100644
--- a/clang-tools-extra/clang-reorder-fields/tool/ClangReorderFields.cpp
+++ b/clang-tools-extra/clang-reorder-fields/tool/ClangReorderFields.cpp
@@ -72,10 +72,10 @@ int main(int argc, const char **argv) {
 
   int ExitCode = Tool.run(Factory.get());
   LangOptions DefaultLangOptions;
-  IntrusiveRefCntPtr<DiagnosticOptions> DiagOpts(new DiagnosticOptions());
-  TextDiagnosticPrinter DiagnosticPrinter(errs(), &*DiagOpts);
+  DiagnosticOptions DiagOpts;
+  TextDiagnosticPrinter DiagnosticPrinter(errs(), DiagOpts);
   DiagnosticsEngine Diagnostics(
-      IntrusiveRefCntPtr<DiagnosticIDs>(new DiagnosticIDs()), &*DiagOpts,
+      IntrusiveRefCntPtr<DiagnosticIDs>(new DiagnosticIDs()), DiagOpts,
       &DiagnosticPrinter, false);
 
   auto &FileMgr = Tool.getFiles();
diff --git a/clang-tools-extra/clang-tidy/ClangTidy.cpp b/clang-tools-extra/clang-tidy/ClangTidy.cpp
index 733a53a0f5dcc..26f9afbc0880e 100644
--- a/clang-tools-extra/clang-tidy/ClangTidy.cpp
+++ b/clang-tools-extra/clang-tidy/ClangTidy.cpp
@@ -97,15 +97,14 @@ class ErrorReporter {
   ErrorReporter(ClangTidyContext &Context, FixBehaviour ApplyFixes,
                 llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem> BaseFS)
       : Files(FileSystemOptions(), std::move(BaseFS)),
-        DiagOpts(new DiagnosticOptions()),
-        DiagPrinter(new TextDiagnosticPrinter(llvm::outs(), &*DiagOpts)),
-        Diags(IntrusiveRefCntPtr<DiagnosticIDs>(new DiagnosticIDs), &*DiagOpts,
+        DiagPrinter(new TextDiagnosticPrinter(llvm::outs(), DiagOpts)),
+        Diags(IntrusiveRefCntPtr<DiagnosticIDs>(new DiagnosticIDs), DiagOpts,
               DiagPrinter),
         SourceMgr(Diags, Files), Context(Context), ApplyFixes(ApplyFixes) {
-    DiagOpts->ShowColors = Context.getOptions().UseColor.value_or(
+    DiagOpts.ShowColors = Context.getOptions().UseColor.value_or(
         llvm::sys::Process::StandardOutHasColors());
     DiagPrinter->BeginSourceFile(LangOpts);
-    if (DiagOpts->ShowColors && !llvm::sys::Process::StandardOutIsDisplayed()) {
+    if (DiagOpts.ShowColors && !llvm::sys::Process::StandardOutIsDisplayed()) {
       llvm::sys::Process::UseANSIEscapeCodes(true);
     }
   }
@@ -308,7 +307,7 @@ class ErrorReporter {
 
   FileManager Files;
   LangOptions LangOpts; // FIXME: use langopts from each original file
-  IntrusiveRefCntPtr<DiagnosticOptions> DiagOpts;
+  DiagnosticOptions DiagOpts;
   DiagnosticConsumer *DiagPrinter;
   DiagnosticsEngine Diags;
   SourceManager SourceMgr;
@@ -516,10 +515,10 @@ getCheckOptions(const ClangTidyOptions &Options,
                                                 Options),
       AllowEnablingAnalyzerAlphaCheckers);
   ClangTidyDiagnosticConsumer DiagConsumer(Context);
-  DiagnosticsEngine DE(llvm::makeIntrusiveRefCnt<DiagnosticIDs>(),
-                       llvm::makeIntrusiveRefCnt<DiagnosticOptions>(),
+  auto DiagOpts = std::make_unique<DiagnosticOptions>();
+  DiagnosticsEngine DE(llvm::makeIntrusiveRefCnt<DiagnosticIDs>(), *DiagOpts,
                        &DiagConsumer, /*ShouldOwnClient=*/false);
-  Context.setDiagnosticsEngine(&DE);
+  Context.setDiagnosticsEngine(std::move(DiagOpts), &DE);
   ClangTidyASTConsumerFactory Factory(Context);
   return Factory.getCheckOptions();
 }
@@ -558,9 +557,10 @@ runClangTidy(clang::tidy::ClangTidyContext &Context,
   Context.setProfileStoragePrefix(StoreCheckProfile);
 
   ClangTidyDiagnosticConsumer DiagConsumer(Context, nullptr, true, ApplyAnyFix);
-  DiagnosticsEngine DE(new DiagnosticIDs(), new DiagnosticOptions(),
-                       &DiagConsumer, /*ShouldOwnClient=*/false);
-  Context.setDiagnosticsEngine(&DE);
+  auto DiagOpts = std::make_unique<DiagnosticOptions>();
+  DiagnosticsEngine DE(new DiagnosticIDs(), *DiagOpts, &DiagConsumer,
+                       /*ShouldOwnClient=*/false);
+  Context.setDiagnosticsEngine(std::move(DiagOpts), &DE);
   Tool.setDiagnosticConsumer(&DiagConsumer);
 
   class ActionFactory : public FrontendActionFactory {
diff --git a/clang-tools-extra/clang-tidy/ClangTidyDiagnosticConsumer.cpp b/clang-tools-extra/clang-tidy/ClangTidyDiagnosticConsumer.cpp
index b216970bfbd8c..a0253a5fd1a48 100644
--- a/clang-tools-extra/clang-tidy/ClangTidyDiagnosticConsumer.cpp
+++ b/clang-tools-extra/clang-tidy/ClangTidyDiagnosticConsumer.cpp
@@ -49,7 +49,7 @@ namespace {
 class ClangTidyDiagnosticRenderer : public DiagnosticRenderer {
 public:
   ClangTidyDiagnosticRenderer(const LangOptions &LangOpts,
-                              DiagnosticOptions *DiagOpts,
+                              DiagnosticOptions &DiagOpts,
                               ClangTidyError &Error)
       : DiagnosticRenderer(LangOpts, DiagOpts), Error(Error) {}
 
@@ -429,7 +429,7 @@ void ClangTidyDiagnosticConsumer::HandleDiagnostic(
     forwardDiagnostic(Info);
   } else {
     ClangTidyDiagnosticRenderer Converter(
-        Context.getLangOpts(), &Context.DiagEngine->getDiagnosticOptions(),
+        Context.getLangOpts(), Context.DiagEngine->getDiagnosticOptions(),
         Errors.back());
     SmallString<100> Message;
     Info.FormatDiagnostic(Message);
diff --git a/clang-tools-extra/clang-tidy/ClangTidyDiagnosticConsumer.h b/clang-tools-extra/clang-tidy/ClangTidyDiagnosticConsumer.h
index d6cf6a2b2731e..bd7a1bf2c11c7 100644
--- a/clang-tools-extra/clang-tidy/ClangTidyDiagnosticConsumer.h
+++ b/clang-tools-extra/clang-tidy/ClangTidyDiagnosticConsumer.h
@@ -75,7 +75,9 @@ class ClangTidyContext {
   /// Sets the DiagnosticsEngine that diag() will emit diagnostics to.
   // FIXME: this is required initialization, and should be a constructor param.
   // Fix the context -> diag engine -> consumer -> context initialization cycle.
-  void setDiagnosticsEngine(DiagnosticsEngine *DiagEngine) {
+  void setDiagnosticsEngine(std::unique_ptr<DiagnosticOptions> DiagOpts,
+                            DiagnosticsEngine *DiagEngine) {
+    this->DiagOpts = std::move(DiagOpts);
     this->DiagEngine = DiagEngine;
   }
 
@@ -231,6 +233,7 @@ class ClangTidyContext {
   // Writes to Stats.
   friend class ClangTidyDiagnosticConsumer;
 
+  std::unique_ptr<DiagnosticOptions> DiagOpts = nullptr;
   DiagnosticsEngine *DiagEngine = nullptr;
   std::unique_ptr<ClangTidyOptionsProvider> OptionsProvider;
 
diff --git a/clang-tools-extra/clang-tidy/ExpandModularHeadersPPCallbacks.cpp b/clang-tools-extra/clang-tidy/ExpandModularHeadersPPCallbacks.cpp
index 03a3e8404e069..6a84704434c33 100644
--- a/clang-tools-extra/clang-tidy/ExpandModularHeadersPPCallbacks.cpp
+++ b/clang-tools-extra/clang-tidy/ExpandModularHeadersPPCallbacks.cpp
@@ -71,7 +71,7 @@ ExpandModularHeadersPPCallbacks::ExpandModularHeadersPPCallbacks(
       InMemoryFs(new llvm::vfs::InMemoryFileSystem),
       Sources(Compiler.getSourceManager()),
       // Forward the new diagnostics to the original DiagnosticConsumer.
-      Diags(new DiagnosticIDs, new DiagnosticOptions,
+      Diags(new DiagnosticIDs, DiagOpts,
             new ForwardingDiagnosticConsumer(Compiler.getDiagnosticClient())),
       LangOpts(Compiler.getLangOpts()), HSOpts(Compiler.getHeaderSearchOpts()) {
   // Add a FileSystem containing the extra files needed in place of modular
diff --git a/clang-tools-extra/clang-tidy/ExpandModularHeadersPPCallbacks.h b/clang-tools-extra/clang-tidy/ExpandModularHeadersPPCallbacks.h
index a263681b3c633..c3478917ef498 100644
--- a/clang-tools-extra/clang-tidy/ExpandModularHeadersPPCallbacks.h
+++ b/clang-tools-extra/clang-tidy/ExpandModularHeadersPPCallbacks.h
@@ -128,6 +128,7 @@ class ExpandModularHeadersPPCallbacks : public PPCallbacks {
   llvm::IntrusiveRefCntPtr<llvm::vfs::InMemoryFileSystem> InMemoryFs;
 
   SourceManager &Sources;
+  DiagnosticOptions DiagOpts;
   DiagnosticsEngine Diags;
   LangOptions LangOpts;
   HeaderSearchOptions HSOpts;
diff --git a/clang-tools-extra/clangd/Compiler.cpp b/clang-tools-extra/clangd/Compiler.cpp
index 9be0152afd2f7..8b3865c8a8e5c 100644
--- a/clang-tools-extra/clangd/Compiler.cpp
+++ b/clang-tools-extra/clangd/Compiler.cpp
@@ -110,8 +110,9 @@ buildCompilerInvocation(const ParseInputs &Inputs, clang::DiagnosticConsumer &D,
   CIOpts.VFS = Inputs.TFS->view(Inputs.CompileCommand.Directory);
   CIOpts.CC1Args = CC1Args;
   CIOpts.RecoverOnError = true;
-  CIOpts.Diags = CompilerInstance::createDiagnostics(
-      *CIOpts.VFS, new DiagnosticOptions, &D, false);
+  DiagnosticOptions DiagOpts;
+  CIOpts.Diags =
+      CompilerInstance::createDiagnostics(*CIOpts.VFS, DiagOpts, &D, false);
   CIOpts.ProbePrecompiled = false;
   std::unique_ptr<CompilerInvocation> CI = createInvocation(ArgStrs, CIOpts);
   if (!CI)
diff --git a/clang-tools-extra/clangd/ModulesBuilder.cpp b/clang-tools-extra/clangd/ModulesBuilder.cpp
index c1878f91b5e16..bf77f43bd28bb 100644
--- a/clang-tools-extra/clangd/ModulesBuilder.cpp
+++ b/clang-tools-extra/clangd/ModulesBuilder.cpp
@@ -187,9 +187,9 @@ bool IsModuleFileUpToDate(PathRef ModuleFilePath,
   HSOpts.ValidateASTInputFilesContent = true;
 
   clang::clangd::IgnoreDiagnostics IgnoreDiags;
+  DiagnosticOptions DiagOpts;
   IntrusiveRefCntPtr<DiagnosticsEngine> Diags =
-      CompilerInstance::createDiagnostics(*VFS, new DiagnosticOptions,
-                                          &IgnoreDiags,
+      CompilerInstance::createDiagnostics(*VFS, DiagOpts, &IgnoreDiags,
                                           /*ShouldOwnClient=*/false);
 
   LangOptions LangOpts;
diff --git a/clang-tools-extra/clangd/ParsedAST.cpp b/clang-tools-extra/clangd/ParsedAST.cpp
index 3f63daaf400db..9e1f6bb977226 100644
--- a/clang-tools-extra/clangd/ParsedAST.cpp
+++ b/clang-tools-extra/clangd/ParsedAST.cpp
@@ -556,7 +556,8 @@ ParsedAST::build(llvm::StringRef Filename, const ParseInputs &Inputs,
         *AllCTFactories, Cfg.Diagnostics.ClangTidy.FastCheckFilter);
     CTContext.emplace(std::make_unique<tidy::DefaultOptionsProvider>(
         tidy::ClangTidyGlobalOptions(), ClangTidyOpts));
-    CTContext->setDiagnosticsEngine(&Clang->getDiagnostics());
+    // The lifetime of DiagnosticOptions is managed by \c Clang.
+    CTContext->setDiagnosticsEngine(nullptr, &Clang->getDiagnostics());
     CTContext->setASTContext(&Clang->getASTContext());
     CTContext->setCurrentFile(Filename);
     CTContext->setSelfContainedDiags(true);
diff --git a/clang-tools-extra/clangd/Preamble.cpp b/clang-tools-extra/clangd/Preamble.cpp
index ba9a53db8a0dc..7b4d63ff197e7 100644
--- a/clang-tools-extra/clangd/Preamble.cpp
+++ b/clang-tools-extra/clangd/Preamble.cpp
@@ -615,7 +615,7 @@ buildPreamble(PathRef FileName, CompilerInvocation CI,
       });
   auto VFS = Inputs.TFS->view(Inputs.CompileCommand.Directory);
   llvm::IntrusiveRefCntPtr<DiagnosticsEngine> PreambleDiagsEngine =
-      CompilerInstance::createDiagnostics(*VFS, &CI.getDiagnosticOpts(),
+      CompilerInstance::createDiagnostics(*VFS, CI.getDiagnosticOpts(),
                                           &PreambleDiagnostics,
                                           /*ShouldOwnClient=*/false);
   const Config &Cfg = Config::current();
diff --git a/clang-tools-extra/clangd/SystemIncludeExtractor.cpp b/clang-tools-extra/clangd/SystemIncludeExtractor.cpp
index 6417bf8765622..0b067e8b0b2b2 100644
--- a/clang-tools-extra/clangd/SystemIncludeExtractor.cpp
+++ b/clang-tools-extra/clangd/SystemIncludeExtractor.cpp
@@ -253,7 +253,8 @@ namespace {
 bool isValidTarget(llvm::StringRef Triple) {
   std::shared_ptr<TargetOptions> TargetOpts(new TargetOptions);
   TargetOpts->Triple = Triple.str();
-  DiagnosticsEngine Diags(new DiagnosticIDs, new DiagnosticOptions,
+  DiagnosticOptions DiagOpts;
+  DiagnosticsEngine Diags(new DiagnosticIDs, DiagOpts,
                           new IgnoringDiagConsumer);
   llvm::IntrusiveRefCntPtr<TargetInfo> Target =
       TargetInfo::CreateTargetInfo(Diags, *TargetOpts);
diff --git a/clang-tools-extra/clangd/unittests/ConfigCompileTests.cpp b/clang-tools-extra/clangd/unittests/ConfigCompileTests.cpp
index c3e484a1a79c4..75d0ff244038d 100644
--- a/clang-tools-extra/clangd/unittests/ConfigCompileTests.cpp
+++ b/clang-tools-extra/clangd/unittests/ConfigCompileTests.cpp
@@ -298,7 +298,8 @@ TEST_F(ConfigCompileTests, DiagnosticSuppression) {
                                    "unreachable-code", "unused-variable",
                                    "typecheck_bool_condition",
                                    "unexpected_friend", "warn_alloca"));
-  clang::DiagnosticsEngine DiagEngine(new DiagnosticIDs, nullptr,
+  clang::DiagnosticOptions DiagOpts;
+  clang::DiagnosticsEngine DiagEngine(new DiagnosticIDs, DiagOpts,
                                       new clang::IgnoringDiagConsumer);
 
   using Diag = clang::Diagnostic;
diff --git a/clang-tools-extra/clangd/unittests/tweaks/TweakTests.cpp b/clang-tools-extra/clangd/unittests/tweaks/TweakTests.cpp
index 8bd40c1429012..e39b70224d97c 100644
--- a/clang-tools-extra/clangd/unittests/tweaks/TweakTests.cpp
+++ b/clang-tools-extra/clangd/unittests/tweaks/TweakTests.cpp
@@ -44,7 +44,8 @@ TEST(FileEdits, AbsolutePath) {
   for (const auto *Path : RelPaths)
     MemFS->addFile(Path, 0, llvm::MemoryBuffer::getMemBuffer("", Path));
   FileManager FM(FileSystemOptions(), MemFS);
-  DiagnosticsEngine DE(new DiagnosticIDs, new DiagnosticOptions);
+  DiagnosticOptions DiagOpts;
+  DiagnosticsEngine DE(new DiagnosticIDs, DiagOpts);
   SourceManager SM(DE, FM);
 
   for (const auto *Path : RelPaths) {
diff --git a/clang-tools-extra/include-cleaner/unittests/RecordTest.cpp b/clang-tools-extra/include-cleaner/unittests/RecordTest.cpp
index a10c0d5a54a95..91d2697712b6e 100644
--- a/clang-tools-extra/include-cleaner/unittests/RecordTest.cpp
+++ b/clang-tools-extra/include-cleaner/unittests/RecordTest.cpp
@@ -618,8 +618,8 @@ TEST_F(PragmaIncludeTest, ExportInUnnamedBuffer) {
                  llvm::MemoryBuffer::getMemBufferCopy(Extra.getValue(),
                                                       /*BufferName=*/""));
 
-  auto DiagOpts = llvm::makeIntrusiveRefCnt<DiagnosticOptions>();
-  auto Diags = CompilerInstance::createDiagnostics(*VFS, DiagOpts.get());
+  DiagnosticOptions DiagOpts;
+  auto Diags = CompilerInstance::createDiagnostics(*VFS, DiagOpts);
   auto Invocation = std::make_unique<CompilerInvocation>();
   ASSERT_TRUE(CompilerInvocation::CreateFromArgs(*Invocation, {Filename.data()},
                                                  *Diags, "clang"));
diff --git a/clang-tools-extra/include-cleaner/unittests/WalkASTTest.cpp b/clang-tools-extra/include-cleaner/unittests/WalkASTTest.cpp
index e45ea36f7938e..5223eb563e4cb 100644
--- a/clang-tools-extra/include-cleaner/unittests/WalkASTTest.cpp
+++ b/clang-tools-extra/include-cleaner/unittests/WalkASTTest.cpp
@@ -85,9 +85,9 @@ std::vector<Decl::Kind> testWalk(llvm::StringRef TargetCode,
   // For each difference, show the target point in context, like a diagnostic.
   std::string DiagBuf;
   llvm::raw_string_ostream DiagOS(DiagBuf);
-  auto *DiagOpts = new DiagnosticOptions();
-  DiagOpts->ShowLevel = 0;
-  DiagOpts->ShowNoteIncludeStack = 0;
+  DiagnosticOptions DiagOpts;
+  DiagOpts.ShowLevel = 0;
+  DiagOpts.ShowNoteIncludeStack = 0;
   TextDiagnostic Diag(DiagOS, AST.context().getLangOpts(), DiagOpts);
   auto DiagnosePoint = [&](llvm::StringRef Message, unsigned Offset) {
     Diag.emitDiagnostic(
diff --git a/clang-tools-extra/modularize/ModularizeUtilities.cpp b/clang-tools-extra/modularize/ModularizeUtilities.cpp
index 576e863c8a9d2..b04eb80a67717 100644
--- a/clang-tools-extra/modularize/ModularizeUtilities.cpp
+++ b/clang-tools-extra/modularize/ModularizeUtilities.cpp
@@ -48,10 +48,8 @@ ModularizeUtilities::ModularizeUtilities(...
[truncated]

@jansvoboda11 jansvoboda11 requested a review from benlangmuir May 13, 2025 16:57
@cor3ntin cor3ntin requested a review from AaronBallman May 14, 2025 09:40
Copy link
Contributor

@cor3ntin cor3ntin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The clang parts look like a nice improvement, thanks!

Please wait for a few other people to review it though.

@@ -2032,6 +2032,7 @@ class SourceManagerForFile {
// as they are created in `createSourceManagerForFile` so that they can be
// deleted in the reverse order as they are created.
std::unique_ptr<FileManager> FileMgr;
std::unique_ptr<DiagnosticOptions> DiagOpts;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't like that in some cases we have a unique_ptr and later (ATSUnit) we use a shared_ptr<>. It leaves an author unable to know given some arbitrary DiagnosticOptions* what the lifetime and/or ownership rules are.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think I understand. Now that DiagnosticOptions are not intrusively reference-counted, raw pointers have clearer semantics than before (typically nullable non-owning borrow), no? I'd also argue that using values, references, raw pointers, unique_ptr and shared_ptr depending on the context is the clearest way to communicate lifetimes and ownership. Regardless, there's only one raw pointer to DiagnosticOptions remaining after my patch in clang::tooling::ToolInvocation, and that has exactly the semantics you'd expect: optional borrow where the owner is someone else and you expect them to keep the object alive long enough.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jansvoboda11 the problem is that now an author does not know if a given DiagnosticOption is a unique_ptr or a shared_ptr. A given DiagnosticOption* may or may not be protectable, etc depending on the context and origin of the object.

Philosophically I prefer intrusive refcounts over shared_ptr because to me they make the lifetime much clearer as the lifetime rules are embedded in the type, but I don't think that's an issue in this PR.

My understanding is that the goal of this PR is to say "For API purposes, a given DiagnosticOption reference is only live as long as the API object that vends it. As an implementation detail there are some cases where it can outlast the vending object, but that's not generally part of the user visible API."

That's a perfectly reasonable change, but my concern is that by mixing and matching shared and unique_ptr an author loses the ability to reason about what a given object's lifetime is. It seems like the reason for shared_ptr is to deal with some slightly gross bits of the API, and I wonder if it's possible to fix those APIs so we can just use unique_ptr everywhere?

Copy link
Contributor

@Bigcheese Bigcheese left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm. I agree this makes the lifetime clearer.

@jansvoboda11 jansvoboda11 merged commit 9e306ad into llvm:main May 22, 2025
14 checks passed
@jansvoboda11 jansvoboda11 deleted the diag-opts-std branch May 22, 2025 19:33
@llvm-ci
Copy link
Collaborator

llvm-ci commented May 22, 2025

LLVM Buildbot has detected a new failure on builder cross-project-tests-sie-ubuntu-dwarf5 running on doug-worker-1b while building clang-tools-extra,clang,lldb at step 5 "build-unified-tree".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/163/builds/19518

Here is the relevant piece of the build log for the reference
Step 5 (build-unified-tree) failure: build (failure)
...
26.318 [1112/8/15] Building CXX object tools/clang/lib/Driver/CMakeFiles/obj.clangDriver.dir/Compilation.cpp.o
27.099 [1111/8/16] Building CXX object tools/clang/lib/ASTMatchers/Dynamic/CMakeFiles/obj.clangDynamicASTMatchers.dir/Parser.cpp.o
28.191 [1110/8/17] Building CXX object tools/clang/lib/Interpreter/CMakeFiles/obj.clangInterpreter.dir/DeviceOffload.cpp.o
33.748 [1109/8/18] Building CXX object lib/CodeGen/AsmPrinter/CMakeFiles/LLVMAsmPrinter.dir/AsmPrinter.cpp.o
35.183 [1108/8/19] Building CXX object tools/clang/lib/Basic/CMakeFiles/obj.clangBasic.dir/DiagnosticOptions.cpp.o
35.539 [1107/8/20] Building CXX object lib/LTO/CMakeFiles/LLVMLTO.dir/LTO.cpp.o
36.685 [1106/8/21] Building CXX object tools/clang/lib/Parse/CMakeFiles/obj.clangParse.dir/ParseAST.cpp.o
37.078 [1105/8/22] Building CXX object tools/clang/tools/clang-format/CMakeFiles/clang-format.dir/ClangFormat.cpp.o
37.720 [1104/8/23] Building CXX object tools/clang/lib/Basic/CMakeFiles/obj.clangBasic.dir/Diagnostic.cpp.o
40.451 [1103/8/24] Building CXX object tools/clang/tools/clang-fuzzer/handle-cxx/CMakeFiles/obj.clangHandleCXX.dir/handle_cxx.cpp.o
FAILED: tools/clang/tools/clang-fuzzer/handle-cxx/CMakeFiles/obj.clangHandleCXX.dir/handle_cxx.cpp.o 
/opt/ccache/bin/g++ -DCLANG_EXPORTS -DGTEST_HAS_RTTI=0 -D_DEBUG -D_GLIBCXX_ASSERTIONS -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu-dwarf5/build/tools/clang/tools/clang-fuzzer/handle-cxx -I/home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu-dwarf5/llvm-project/clang/tools/clang-fuzzer/handle-cxx -I/home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu-dwarf5/llvm-project/clang/include -I/home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu-dwarf5/build/tools/clang/include -I/home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu-dwarf5/build/include -I/home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu-dwarf5/llvm-project/llvm/include -I/home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu-dwarf5/llvm-project/clang/tools/clang-fuzzer/handle-cxx/. -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-uninitialized -Wno-nonnull -Wno-class-memaccess -Wno-redundant-move -Wno-pessimizing-move -Wno-noexcept-type -Wno-unnecessary-virtual-specifier -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -Wno-misleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -fno-common -Woverloaded-virtual -fno-strict-aliasing -O3 -DNDEBUG  -fno-exceptions -funwind-tables -fno-rtti -UNDEBUG -std=c++17 -MD -MT tools/clang/tools/clang-fuzzer/handle-cxx/CMakeFiles/obj.clangHandleCXX.dir/handle_cxx.cpp.o -MF tools/clang/tools/clang-fuzzer/handle-cxx/CMakeFiles/obj.clangHandleCXX.dir/handle_cxx.cpp.o.d -o tools/clang/tools/clang-fuzzer/handle-cxx/CMakeFiles/obj.clangHandleCXX.dir/handle_cxx.cpp.o -c /home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu-dwarf5/llvm-project/clang/tools/clang-fuzzer/handle-cxx/handle_cxx.cpp
/home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu-dwarf5/llvm-project/clang/tools/clang-fuzzer/handle-cxx/handle_cxx.cpp: In function ‘void clang_fuzzer::HandleCXX(const string&, const char*, const std::vector<const char*>&)’:
/home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu-dwarf5/llvm-project/clang/tools/clang-fuzzer/handle-cxx/handle_cxx.cpp:38:20: error: no matching function for call to ‘clang::DiagnosticsEngine::DiagnosticsEngine(llvm::IntrusiveRefCntPtr<clang::DiagnosticIDs>, clang::DiagnosticOptions*, clang::IgnoringDiagConsumer*, bool)’
   38 |       &Diags, false);
      |                    ^
In file included from /home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu-dwarf5/llvm-project/clang/include/clang/AST/NestedNameSpecifier.h:18,
                 from /home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu-dwarf5/llvm-project/clang/include/clang/AST/Type.h:21,
                 from /home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu-dwarf5/llvm-project/clang/include/clang/AST/CanonicalType.h:17,
                 from /home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu-dwarf5/llvm-project/clang/include/clang/AST/ASTContext.h:18,
                 from /home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu-dwarf5/llvm-project/clang/include/clang/Frontend/ASTUnit.h:17,
                 from /home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu-dwarf5/llvm-project/clang/include/clang/Frontend/FrontendAction.h:23,
                 from /home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu-dwarf5/llvm-project/clang/include/clang/CodeGen/CodeGenAction.h:12,
                 from /home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu-dwarf5/llvm-project/clang/tools/clang-fuzzer/handle-cxx/handle_cxx.cpp:15:
/home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu-dwarf5/llvm-project/clang/include/clang/Basic/Diagnostic.h:568:12: note: candidate: ‘clang::DiagnosticsEngine::DiagnosticsEngine(llvm::IntrusiveRefCntPtr<clang::DiagnosticIDs>, clang::DiagnosticOptions&, clang::DiagnosticConsumer*, bool)’
  568 |   explicit DiagnosticsEngine(IntrusiveRefCntPtr<DiagnosticIDs> Diags,
      |            ^~~~~~~~~~~~~~~~~
/home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu-dwarf5/llvm-project/clang/include/clang/Basic/Diagnostic.h:569:49: note:   no known conversion for argument 2 from ‘clang::DiagnosticOptions*’ to ‘clang::DiagnosticOptions&’
  569 |                              DiagnosticOptions &DiagOpts,
      |                              ~~~~~~~~~~~~~~~~~~~^~~~~~~~
In file included from /home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu-dwarf5/llvm-project/clang/include/clang/Basic/DiagnosticIDs.h:19,
                 from /home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu-dwarf5/llvm-project/clang/include/clang/Basic/Diagnostic.h:17,
                 from /home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu-dwarf5/llvm-project/clang/include/clang/AST/NestedNameSpecifier.h:18,
                 from /home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu-dwarf5/llvm-project/clang/include/clang/AST/Type.h:21,
                 from /home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu-dwarf5/llvm-project/clang/include/clang/AST/CanonicalType.h:17,
                 from /home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu-dwarf5/llvm-project/clang/include/clang/AST/ASTContext.h:18,
                 from /home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu-dwarf5/llvm-project/clang/include/clang/Frontend/ASTUnit.h:17,
                 from /home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu-dwarf5/llvm-project/clang/include/clang/Frontend/FrontendAction.h:23,
                 from /home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu-dwarf5/llvm-project/clang/include/clang/CodeGen/CodeGenAction.h:12,
                 from /home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu-dwarf5/llvm-project/clang/tools/clang-fuzzer/handle-cxx/handle_cxx.cpp:15:
/home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu-dwarf5/llvm-project/llvm/include/llvm/ADT/IntrusiveRefCntPtr.h: In instantiation of ‘static void llvm::IntrusiveRefCntPtrInfo<T>::retain(T*) [with T = clang::DiagnosticOptions]’:
/home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu-dwarf5/llvm-project/llvm/include/llvm/ADT/IntrusiveRefCntPtr.h:228:40:   required from ‘void llvm::IntrusiveRefCntPtr<T>::retain() [with T = clang::DiagnosticOptions]’
/home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu-dwarf5/llvm-project/llvm/include/llvm/ADT/IntrusiveRefCntPtr.h:180:43:   required from ‘llvm::IntrusiveRefCntPtr<T>::IntrusiveRefCntPtr(T*) [with T = clang::DiagnosticOptions]’
/home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu-dwarf5/llvm-project/clang/tools/clang-fuzzer/handle-cxx/handle_cxx.cpp:35:74:   required from here
/home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu-dwarf5/llvm-project/llvm/include/llvm/ADT/IntrusiveRefCntPtr.h:163:37: error: ‘class clang::DiagnosticOptions’ has no member named ‘Retain’
  163 |   static void retain(T *obj) { obj->Retain(); }
      |                                ~~~~~^~~~~~
/home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu-dwarf5/llvm-project/llvm/include/llvm/ADT/IntrusiveRefCntPtr.h: In instantiation of ‘static void llvm::IntrusiveRefCntPtrInfo<T>::release(T*) [with T = clang::DiagnosticOptions]’:
/home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu-dwarf5/llvm-project/llvm/include/llvm/ADT/IntrusiveRefCntPtr.h:233:41:   required from ‘void llvm::IntrusiveRefCntPtr<T>::release() [with T = clang::DiagnosticOptions]’

@llvm-ci
Copy link
Collaborator

llvm-ci commented May 22, 2025

LLVM Buildbot has detected a new failure on builder lldb-x86_64-debian running on lldb-x86_64-debian while building clang-tools-extra,clang,lldb at step 4 "build".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/162/builds/22979

Here is the relevant piece of the build log for the reference
Step 4 (build) failure: build (failure)
...
148.840 [180/72/906] Building CXX object tools/clang/tools/libclang/CMakeFiles/libclang.dir/CIndexDiagnostic.cpp.o
148.923 [179/72/907] Linking CXX static library lib/libclangCrossTU.a
148.966 [178/72/908] Linking CXX static library lib/libclangExtractAPI.a
148.975 [177/72/909] Building CXX object tools/clang/tools/libclang/CMakeFiles/libclang.dir/CXComment.cpp.o
149.073 [176/72/910] Linking CXX static library lib/libclangToolingRefactoring.a
149.114 [175/72/911] Building CXX object tools/clang/lib/StaticAnalyzer/Checkers/CMakeFiles/obj.clangStaticAnalyzerCheckers.dir/StreamChecker.cpp.o
149.127 [174/72/912] Linking CXX executable bin/clang-format
149.160 [173/72/913] Linking CXX static library lib/libclangTransformer.a
149.180 [172/72/914] Linking CXX static library lib/libclangStaticAnalyzerCore.a
149.189 [171/72/915] Building CXX object tools/clang/tools/clang-fuzzer/handle-cxx/CMakeFiles/obj.clangHandleCXX.dir/handle_cxx.cpp.o
FAILED: tools/clang/tools/clang-fuzzer/handle-cxx/CMakeFiles/obj.clangHandleCXX.dir/handle_cxx.cpp.o 
/usr/bin/clang++ -DCLANG_EXPORTS -DGTEST_HAS_RTTI=0 -D_DEBUG -D_GLIBCXX_ASSERTIONS -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/home/worker/2.0.1/lldb-x86_64-debian/build/tools/clang/tools/clang-fuzzer/handle-cxx -I/home/worker/2.0.1/lldb-x86_64-debian/llvm-project/clang/tools/clang-fuzzer/handle-cxx -I/home/worker/2.0.1/lldb-x86_64-debian/llvm-project/clang/include -I/home/worker/2.0.1/lldb-x86_64-debian/build/tools/clang/include -I/home/worker/2.0.1/lldb-x86_64-debian/build/include -I/home/worker/2.0.1/lldb-x86_64-debian/llvm-project/llvm/include -I/home/worker/2.0.1/lldb-x86_64-debian/llvm-project/clang/tools/clang-fuzzer/handle-cxx/. -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wc++98-compat-extra-semi -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -Wmisleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -fno-common -Woverloaded-virtual -Wno-nested-anon-types -O3 -DNDEBUG  -fno-exceptions -funwind-tables -fno-rtti -UNDEBUG -std=c++17 -MD -MT tools/clang/tools/clang-fuzzer/handle-cxx/CMakeFiles/obj.clangHandleCXX.dir/handle_cxx.cpp.o -MF tools/clang/tools/clang-fuzzer/handle-cxx/CMakeFiles/obj.clangHandleCXX.dir/handle_cxx.cpp.o.d -o tools/clang/tools/clang-fuzzer/handle-cxx/CMakeFiles/obj.clangHandleCXX.dir/handle_cxx.cpp.o -c /home/worker/2.0.1/lldb-x86_64-debian/llvm-project/clang/tools/clang-fuzzer/handle-cxx/handle_cxx.cpp
/home/worker/2.0.1/lldb-x86_64-debian/llvm-project/clang/tools/clang-fuzzer/handle-cxx/handle_cxx.cpp:36:21: error: no matching constructor for initialization of 'clang::DiagnosticsEngine'
  DiagnosticsEngine Diagnostics(
                    ^
/home/worker/2.0.1/lldb-x86_64-debian/llvm-project/clang/include/clang/Basic/Diagnostic.h:568:12: note: candidate constructor not viable: no known conversion from 'clang::DiagnosticOptions *' to 'clang::DiagnosticOptions &' for 2nd argument; remove &
  explicit DiagnosticsEngine(IntrusiveRefCntPtr<DiagnosticIDs> Diags,
           ^
/home/worker/2.0.1/lldb-x86_64-debian/llvm-project/clang/include/clang/Basic/Diagnostic.h:572:3: note: candidate constructor not viable: requires 1 argument, but 4 were provided
  DiagnosticsEngine(const DiagnosticsEngine &) = delete;
  ^
In file included from /home/worker/2.0.1/lldb-x86_64-debian/llvm-project/clang/tools/clang-fuzzer/handle-cxx/handle_cxx.cpp:15:
In file included from /home/worker/2.0.1/lldb-x86_64-debian/llvm-project/clang/include/clang/CodeGen/CodeGenAction.h:12:
In file included from /home/worker/2.0.1/lldb-x86_64-debian/llvm-project/clang/include/clang/Frontend/FrontendAction.h:23:
In file included from /home/worker/2.0.1/lldb-x86_64-debian/llvm-project/clang/include/clang/Frontend/ASTUnit.h:17:
In file included from /home/worker/2.0.1/lldb-x86_64-debian/llvm-project/clang/include/clang/AST/ASTContext.h:18:
In file included from /home/worker/2.0.1/lldb-x86_64-debian/llvm-project/clang/include/clang/AST/CanonicalType.h:17:
In file included from /home/worker/2.0.1/lldb-x86_64-debian/llvm-project/clang/include/clang/AST/Type.h:21:
In file included from /home/worker/2.0.1/lldb-x86_64-debian/llvm-project/clang/include/clang/AST/NestedNameSpecifier.h:18:
In file included from /home/worker/2.0.1/lldb-x86_64-debian/llvm-project/clang/include/clang/Basic/Diagnostic.h:17:
In file included from /home/worker/2.0.1/lldb-x86_64-debian/llvm-project/clang/include/clang/Basic/DiagnosticIDs.h:19:
/home/worker/2.0.1/lldb-x86_64-debian/llvm-project/llvm/include/llvm/ADT/IntrusiveRefCntPtr.h:163:37: error: no member named 'Retain' in 'clang::DiagnosticOptions'
  static void retain(T *obj) { obj->Retain(); }
                               ~~~  ^
/home/worker/2.0.1/lldb-x86_64-debian/llvm-project/llvm/include/llvm/ADT/IntrusiveRefCntPtr.h:228:34: note: in instantiation of member function 'llvm::IntrusiveRefCntPtrInfo<clang::DiagnosticOptions>::retain' requested here
      IntrusiveRefCntPtrInfo<T>::retain(Obj);
                                 ^
/home/worker/2.0.1/lldb-x86_64-debian/llvm-project/llvm/include/llvm/ADT/IntrusiveRefCntPtr.h:180:43: note: in instantiation of member function 'llvm::IntrusiveRefCntPtr<clang::DiagnosticOptions>::retain' requested here
  IntrusiveRefCntPtr(T *obj) : Obj(obj) { retain(); }
                                          ^
/home/worker/2.0.1/lldb-x86_64-debian/llvm-project/clang/tools/clang-fuzzer/handle-cxx/handle_cxx.cpp:35:52: note: in instantiation of member function 'llvm::IntrusiveRefCntPtr<clang::DiagnosticOptions>::IntrusiveRefCntPtr' requested here
  IntrusiveRefCntPtr<DiagnosticOptions> DiagOpts = new DiagnosticOptions();
                                                   ^
In file included from /home/worker/2.0.1/lldb-x86_64-debian/llvm-project/clang/tools/clang-fuzzer/handle-cxx/handle_cxx.cpp:15:
In file included from /home/worker/2.0.1/lldb-x86_64-debian/llvm-project/clang/include/clang/CodeGen/CodeGenAction.h:12:
In file included from /home/worker/2.0.1/lldb-x86_64-debian/llvm-project/clang/include/clang/Frontend/FrontendAction.h:23:
In file included from /home/worker/2.0.1/lldb-x86_64-debian/llvm-project/clang/include/clang/Frontend/ASTUnit.h:17:
In file included from /home/worker/2.0.1/lldb-x86_64-debian/llvm-project/clang/include/clang/AST/ASTContext.h:18:
In file included from /home/worker/2.0.1/lldb-x86_64-debian/llvm-project/clang/include/clang/AST/CanonicalType.h:17:

kazutakahirata added a commit that referenced this pull request May 22, 2025
…ons` (#139584)"

This reverts commit 9e306ad.

Multiple builtbot failures have been reported:
#139584
@llvm-ci
Copy link
Collaborator

llvm-ci commented May 22, 2025

LLVM Buildbot has detected a new failure on builder llvm-clang-x86_64-sie-ubuntu-fast running on sie-linux-worker while building clang-tools-extra,clang,lldb at step 5 "build-unified-tree".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/144/builds/25826

Here is the relevant piece of the build log for the reference
Step 5 (build-unified-tree) failure: build (failure)
...
351.105 [605/40/924] Building CXX object tools/clang/tools/driver/CMakeFiles/clang.dir/driver.cpp.o
351.119 [604/40/925] Building CXX object tools/clang/tools/extra/modularize/CMakeFiles/modularize.dir/CoverageChecker.cpp.o
351.239 [603/40/926] Building CXX object tools/clang/tools/extra/clang-tidy/portability/CMakeFiles/obj.clangTidyPortabilityModule.dir/SIMDIntrinsicsCheck.cpp.o
351.960 [602/40/927] Building CXX object tools/clang/tools/clang-diff/CMakeFiles/clang-diff.dir/ClangDiff.cpp.o
352.409 [601/40/928] Building CXX object tools/clang/tools/extra/clang-tidy/readability/CMakeFiles/obj.clangTidyReadabilityModule.dir/AvoidNestedConditionalOperatorCheck.cpp.o
352.560 [600/40/929] Building CXX object tools/clang/lib/Interpreter/CMakeFiles/obj.clangInterpreter.dir/IncrementalParser.cpp.o
352.751 [599/40/930] Building CXX object tools/clang/tools/clang-refactor/CMakeFiles/clang-refactor.dir/TestSupport.cpp.o
352.794 [598/40/931] Building CXX object tools/clang/lib/StaticAnalyzer/Checkers/CMakeFiles/obj.clangStaticAnalyzerCheckers.dir/WebKit/MemoryUnsafeCastChecker.cpp.o
352.825 [597/40/932] Building CXX object tools/clang/tools/extra/clang-tidy/performance/CMakeFiles/obj.clangTidyPerformanceModule.dir/EnumSizeCheck.cpp.o
353.342 [596/40/933] Building CXX object tools/clang/tools/clang-fuzzer/handle-cxx/CMakeFiles/obj.clangHandleCXX.dir/handle_cxx.cpp.o
FAILED: tools/clang/tools/clang-fuzzer/handle-cxx/CMakeFiles/obj.clangHandleCXX.dir/handle_cxx.cpp.o 
CCACHE_CPP2=yes CCACHE_HASHDIR=yes CCACHE_SLOPPINESS=pch_defines,time_macros /usr/bin/ccache /usr/bin/g++ -DCLANG_EXPORTS -DGTEST_HAS_RTTI=0 -D_DEBUG -D_GLIBCXX_ASSERTIONS -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/build/tools/clang/tools/clang-fuzzer/handle-cxx -I/home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/llvm-project/clang/tools/clang-fuzzer/handle-cxx -I/home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/llvm-project/clang/include -I/home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/build/tools/clang/include -I/home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/build/include -I/home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/llvm-project/llvm/include -I/home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/llvm-project/clang/tools/clang-fuzzer/handle-cxx/. -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-uninitialized -Wno-nonnull -Wno-class-memaccess -Wno-redundant-move -Wno-pessimizing-move -Wno-noexcept-type -Wno-unnecessary-virtual-specifier -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -Wno-misleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -fno-common -Woverloaded-virtual -fno-strict-aliasing -O3 -DNDEBUG  -fno-exceptions -funwind-tables -fno-rtti -UNDEBUG -std=c++17 -MD -MT tools/clang/tools/clang-fuzzer/handle-cxx/CMakeFiles/obj.clangHandleCXX.dir/handle_cxx.cpp.o -MF tools/clang/tools/clang-fuzzer/handle-cxx/CMakeFiles/obj.clangHandleCXX.dir/handle_cxx.cpp.o.d -o tools/clang/tools/clang-fuzzer/handle-cxx/CMakeFiles/obj.clangHandleCXX.dir/handle_cxx.cpp.o -c /home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/llvm-project/clang/tools/clang-fuzzer/handle-cxx/handle_cxx.cpp
/home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/llvm-project/clang/tools/clang-fuzzer/handle-cxx/handle_cxx.cpp: In function ‘void clang_fuzzer::HandleCXX(const string&, const char*, const std::vector<const char*>&)’:
/home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/llvm-project/clang/tools/clang-fuzzer/handle-cxx/handle_cxx.cpp:38:20: error: no matching function for call to ‘clang::DiagnosticsEngine::DiagnosticsEngine(llvm::IntrusiveRefCntPtr<clang::DiagnosticIDs>, clang::DiagnosticOptions*, clang::IgnoringDiagConsumer*, bool)’
   38 |       &Diags, false);
      |                    ^
In file included from /home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/llvm-project/clang/include/clang/AST/NestedNameSpecifier.h:18,
                 from /home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/llvm-project/clang/include/clang/AST/Type.h:21,
                 from /home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/llvm-project/clang/include/clang/AST/CanonicalType.h:17,
                 from /home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/llvm-project/clang/include/clang/AST/ASTContext.h:18,
                 from /home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/llvm-project/clang/include/clang/Frontend/ASTUnit.h:17,
                 from /home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/llvm-project/clang/include/clang/Frontend/FrontendAction.h:23,
                 from /home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/llvm-project/clang/include/clang/CodeGen/CodeGenAction.h:12,
                 from /home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/llvm-project/clang/tools/clang-fuzzer/handle-cxx/handle_cxx.cpp:15:
/home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/llvm-project/clang/include/clang/Basic/Diagnostic.h:568:12: note: candidate: ‘clang::DiagnosticsEngine::DiagnosticsEngine(llvm::IntrusiveRefCntPtr<clang::DiagnosticIDs>, clang::DiagnosticOptions&, clang::DiagnosticConsumer*, bool)’
  568 |   explicit DiagnosticsEngine(IntrusiveRefCntPtr<DiagnosticIDs> Diags,
      |            ^~~~~~~~~~~~~~~~~
/home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/llvm-project/clang/include/clang/Basic/Diagnostic.h:569:49: note:   no known conversion for argument 2 from ‘clang::DiagnosticOptions*’ to ‘clang::DiagnosticOptions&’
  569 |                              DiagnosticOptions &DiagOpts,
      |                              ~~~~~~~~~~~~~~~~~~~^~~~~~~~
In file included from /home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/llvm-project/clang/include/clang/Basic/DiagnosticIDs.h:19,
                 from /home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/llvm-project/clang/include/clang/Basic/Diagnostic.h:17,
                 from /home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/llvm-project/clang/include/clang/AST/NestedNameSpecifier.h:18,
                 from /home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/llvm-project/clang/include/clang/AST/Type.h:21,
                 from /home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/llvm-project/clang/include/clang/AST/CanonicalType.h:17,
                 from /home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/llvm-project/clang/include/clang/AST/ASTContext.h:18,
                 from /home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/llvm-project/clang/include/clang/Frontend/ASTUnit.h:17,
                 from /home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/llvm-project/clang/include/clang/Frontend/FrontendAction.h:23,
                 from /home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/llvm-project/clang/include/clang/CodeGen/CodeGenAction.h:12,
                 from /home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/llvm-project/clang/tools/clang-fuzzer/handle-cxx/handle_cxx.cpp:15:
/home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/llvm-project/llvm/include/llvm/ADT/IntrusiveRefCntPtr.h: In instantiation of ‘static void llvm::IntrusiveRefCntPtrInfo<T>::retain(T*) [with T = clang::DiagnosticOptions]’:
/home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/llvm-project/llvm/include/llvm/ADT/IntrusiveRefCntPtr.h:228:40:   required from ‘void llvm::IntrusiveRefCntPtr<T>::retain() [with T = clang::DiagnosticOptions]’
/home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/llvm-project/llvm/include/llvm/ADT/IntrusiveRefCntPtr.h:180:43:   required from ‘llvm::IntrusiveRefCntPtr<T>::IntrusiveRefCntPtr(T*) [with T = clang::DiagnosticOptions]’
/home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/llvm-project/clang/tools/clang-fuzzer/handle-cxx/handle_cxx.cpp:35:74:   required from here
/home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/llvm-project/llvm/include/llvm/ADT/IntrusiveRefCntPtr.h:163:37: error: ‘class clang::DiagnosticOptions’ has no member named ‘Retain’
  163 |   static void retain(T *obj) { obj->Retain(); }
      |                                ~~~~~^~~~~~
/home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/llvm-project/llvm/include/llvm/ADT/IntrusiveRefCntPtr.h: In instantiation of ‘static void llvm::IntrusiveRefCntPtrInfo<T>::release(T*) [with T = clang::DiagnosticOptions]’:
/home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/llvm-project/llvm/include/llvm/ADT/IntrusiveRefCntPtr.h:233:41:   required from ‘void llvm::IntrusiveRefCntPtr<T>::release() [with T = clang::DiagnosticOptions]’

@kazutakahirata
Copy link
Contributor

@jansvoboda11 I've revered your PR due buildbot failures above (and my local build failures with the same error messages). I'm happy to try your revised patch to see if it build cleanly. Thanks!

@llvm-ci
Copy link
Collaborator

llvm-ci commented May 22, 2025

LLVM Buildbot has detected a new failure on builder llvm-clang-x86_64-win-fast running on as-builder-3 while building clang-tools-extra,clang,lldb at step 6 "build-unified-tree".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/2/builds/24607

Here is the relevant piece of the build log for the reference
Step 6 (build-unified-tree) failure: build (failure)
...
[4129/4211] Building RC object tools\sancov\CMakeFiles\sancov.dir\__\__\resources\windows_version_resource.rc.res
[4130/4211] Linking CXX executable bin\llvm-yaml-parser-fuzzer.exe
[4131/4211] Linking CXX executable bin\llvm-yaml-numeric-parser-fuzzer.exe
[4132/4211] Linking CXX executable bin\llvm-readobj.exe
[4133/4211] Linking CXX static library lib\LLVMOptDriver.lib
[4134/4211] Linking CXX executable bin\llvm-sim.exe
[4135/4211] Linking CXX executable bin\llvm-profgen.exe
[4136/4211] Generating ../../bin/llvm-readelf.exe
[4137/4211] Linking CXX executable bin\llvm-rtdyld.exe
[4138/4211] Building CXX object tools\clang\tools\clang-fuzzer\handle-cxx\CMakeFiles\obj.clangHandleCXX.dir\handle_cxx.cpp.obj
FAILED: tools/clang/tools/clang-fuzzer/handle-cxx/CMakeFiles/obj.clangHandleCXX.dir/handle_cxx.cpp.obj 
C:\ninja\ccache.exe C:\PROGRA~1\MICROS~2\2022\COMMUN~1\VC\Tools\MSVC\1438~1.331\bin\Hostx64\x64\cl.exe  /nologo /TP -DCLANG_BUILD_STATIC -DGTEST_HAS_RTTI=0 -DUNICODE -D_CRT_NONSTDC_NO_DEPRECATE -D_CRT_NONSTDC_NO_WARNINGS -D_CRT_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS -D_HAS_EXCEPTIONS=0 -D_SCL_SECURE_NO_DEPRECATE -D_SCL_SECURE_NO_WARNINGS -D_UNICODE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -IC:\buildbot\as-builder-3\llvm-clang-x86_64-win-fast\build\tools\clang\tools\clang-fuzzer\handle-cxx -IC:\buildbot\as-builder-3\llvm-clang-x86_64-win-fast\llvm-project\clang\tools\clang-fuzzer\handle-cxx -IC:\buildbot\as-builder-3\llvm-clang-x86_64-win-fast\llvm-project\clang\include -IC:\buildbot\as-builder-3\llvm-clang-x86_64-win-fast\build\tools\clang\include -IC:\buildbot\as-builder-3\llvm-clang-x86_64-win-fast\build\include -IC:\buildbot\as-builder-3\llvm-clang-x86_64-win-fast\llvm-project\llvm\include -IC:\buildbot\as-builder-3\llvm-clang-x86_64-win-fast\llvm-project\clang\tools\clang-fuzzer\handle-cxx\. /DWIN32 /D_WINDOWS   /Zc:inline /Zc:preprocessor /Zc:__cplusplus /Oi /bigobj /permissive- /W4 -wd4141 -wd4146 -wd4244 -wd4267 -wd4291 -wd4351 -wd4456 -wd4457 -wd4458 -wd4459 -wd4503 -wd4624 -wd4722 -wd4100 -wd4127 -wd4512 -wd4505 -wd4610 -wd4510 -wd4702 -wd4245 -wd4706 -wd4310 -wd4701 -wd4703 -wd4389 -wd4611 -wd4805 -wd4204 -wd4577 -wd4091 -wd4592 -wd4319 -wd4709 -wd5105 -wd4324 -wd4251 -wd4275 -w14062 -we4238 /Gw /O2 /Ob2 /DNDEBUG -MD  /EHs-c- /GR- -std:c++17 /showIncludes /Fotools\clang\tools\clang-fuzzer\handle-cxx\CMakeFiles\obj.clangHandleCXX.dir\handle_cxx.cpp.obj /Fdtools\clang\tools\clang-fuzzer\handle-cxx\CMakeFiles\obj.clangHandleCXX.dir\ /FS -c C:\buildbot\as-builder-3\llvm-clang-x86_64-win-fast\llvm-project\clang\tools\clang-fuzzer\handle-cxx\handle_cxx.cpp
C:\buildbot\as-builder-3\llvm-clang-x86_64-win-fast\llvm-project\clang\tools\clang-fuzzer\handle-cxx\handle_cxx.cpp(36): error C2665: 'clang::DiagnosticsEngine::DiagnosticsEngine': no overloaded function could convert all the argument types
C:\buildbot\as-builder-3\llvm-clang-x86_64-win-fast\llvm-project\clang\include\clang/Basic/Diagnostic.h(568): note: could be 'clang::DiagnosticsEngine::DiagnosticsEngine(llvm::IntrusiveRefCntPtr<clang::DiagnosticIDs>,clang::DiagnosticOptions &,clang::DiagnosticConsumer *,bool)'
C:\buildbot\as-builder-3\llvm-clang-x86_64-win-fast\llvm-project\clang\tools\clang-fuzzer\handle-cxx\handle_cxx.cpp(36): note: 'clang::DiagnosticsEngine::DiagnosticsEngine(llvm::IntrusiveRefCntPtr<clang::DiagnosticIDs>,clang::DiagnosticOptions &,clang::DiagnosticConsumer *,bool)': cannot convert argument 2 from 'T *' to 'clang::DiagnosticOptions &'
        with
        [
            T=clang::DiagnosticOptions
        ]
C:\buildbot\as-builder-3\llvm-clang-x86_64-win-fast\llvm-project\clang\tools\clang-fuzzer\handle-cxx\handle_cxx.cpp(36): note: while trying to match the argument list '(llvm::IntrusiveRefCntPtr<clang::DiagnosticIDs>, T *, clang::IgnoringDiagConsumer *, bool)'
        with
        [
            T=clang::DiagnosticOptions
        ]
[4139/4211] Linking CXX executable bin\llvm-size.exe
[4140/4211] Building CXX object tools\clang\lib\StaticAnalyzer\Checkers\CMakeFiles\obj.clangStaticAnalyzerCheckers.dir\WebKit\ForwardDeclChecker.cpp.obj
[4141/4211] Linking CXX executable bin\llvm-tli-checker.exe
[4142/4211] Building CXX object tools\clang\tools\libclang\CMakeFiles\libclang.dir\CIndexHigh.cpp.obj
[4143/4211] Linking CXX executable bin\llvm-symbolizer.exe
[4144/4211] Linking CXX executable bin\yaml2obj.exe
[4145/4211] Linking CXX executable bin\llvm-xray.exe
[4146/4211] Linking CXX executable bin\sanstats.exe
[4147/4211] Linking CXX executable bin\verify-uselistorder.exe
[4148/4211] Building CXX object tools\clang\tools\clang-installapi\CMakeFiles\clang-installapi.dir\Options.cpp.obj
[4149/4211] Linking CXX executable bin\obj2yaml.exe
[4150/4211] Linking CXX executable bin\sancov.exe
[4151/4211] Building CXX object tools\clang\tools\libclang\CMakeFiles\libclang.dir\CIndexDiagnostic.cpp.obj
[4152/4211] Linking CXX executable bin\llvm-lto2.exe
[4153/4211] Building CXX object tools\clang\tools\libclang\CMakeFiles\libclang.dir\CIndexUSRs.cpp.obj
[4154/4211] Building CXX object tools\clang\lib\StaticAnalyzer\Checkers\CMakeFiles\obj.clangStaticAnalyzerCheckers.dir\WebKit\RetainPtrCtorAdoptChecker.cpp.obj
[4155/4211] Building CXX object tools\clang\lib\Interpreter\CMakeFiles\obj.clangInterpreter.dir\DeviceOffload.cpp.obj
[4156/4211] Building CXX object tools\clang\tools\libclang\CMakeFiles\libclang.dir\CXString.cpp.obj
[4157/4211] Linking CXX executable bin\diagtool.exe
[4158/4211] Linking CXX executable bin\llvm-split.exe
[4159/4211] Linking CXX executable bin\llvm-opt-fuzzer.exe
[4160/4211] Building CXX object tools\clang\lib\StaticAnalyzer\Frontend\CMakeFiles\obj.clangStaticAnalyzerFrontend.dir\CheckerRegistry.cpp.obj
[4161/4211] Building CXX object tools\clang\tools\libclang\CMakeFiles\libclang.dir\CXStoredDiagnostic.cpp.obj
[4162/4211] Building CXX object tools\clang\tools\clang-refactor\CMakeFiles\clang-refactor.dir\TestSupport.cpp.obj
[4163/4211] Building CXX object tools\clang\tools\libclang\CMakeFiles\libclang.dir\CXSourceLocation.cpp.obj

@jansvoboda11
Copy link
Contributor Author

@jansvoboda11 I've revered your PR due buildbot failures above (and my local build failures with the same error messages). I'm happy to try your revised patch to see if it build cleanly. Thanks!

I already forward-fixed both failures: d25f95f and b544853.

@llvm-ci
Copy link
Collaborator

llvm-ci commented May 22, 2025

LLVM Buildbot has detected a new failure on builder arc-builder running on arc-worker while building clang-tools-extra,clang,lldb at step 5 "build-unified-tree".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/3/builds/16354

Here is the relevant piece of the build log for the reference
Step 5 (build-unified-tree) failure: build (failure)
...
  306 |   bool visitInputFile(StringRef Filename, bool isSystem,
      |        ^~~~~~~~~~~~~~
cc1plus: note: unrecognized command-line option '-Wno-unnecessary-virtual-specifier' may have been intended to silence earlier diagnostics
584.018 [398/16/608] Building CXX object tools/clang/lib/Frontend/CMakeFiles/obj.clangFrontend.dir/PrecompiledPreamble.cpp.o
584.392 [397/16/609] Building CXX object tools/clang/lib/Frontend/Rewrite/CMakeFiles/obj.clangRewriteFrontend.dir/RewriteTest.cpp.o
584.585 [396/16/610] Building CXX object tools/clang/lib/Frontend/Rewrite/CMakeFiles/obj.clangRewriteFrontend.dir/HTMLPrint.cpp.o
588.780 [395/16/611] Building CXX object tools/clang/lib/Tooling/CMakeFiles/obj.clangTooling.dir/FixIt.cpp.o
589.428 [394/16/612] Building CXX object tools/clang/lib/Frontend/Rewrite/CMakeFiles/obj.clangRewriteFrontend.dir/RewriteModernObjC.cpp.o
589.543 [393/16/613] Building CXX object tools/clang/lib/Frontend/Rewrite/CMakeFiles/obj.clangRewriteFrontend.dir/RewriteObjC.cpp.o
594.163 [392/16/614] Building CXX object tools/clang/tools/clang-fuzzer/handle-cxx/CMakeFiles/obj.clangHandleCXX.dir/handle_cxx.cpp.o
FAILED: tools/clang/tools/clang-fuzzer/handle-cxx/CMakeFiles/obj.clangHandleCXX.dir/handle_cxx.cpp.o 
/usr/bin/c++ -DCLANG_EXPORTS -DGTEST_HAS_RTTI=0 -D_DEBUG -D_GLIBCXX_ASSERTIONS -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -Itools/clang/tools/clang-fuzzer/handle-cxx -I/buildbot/worker/arc-folder/llvm-project/clang/tools/clang-fuzzer/handle-cxx -I/buildbot/worker/arc-folder/llvm-project/clang/include -Itools/clang/include -Iinclude -I/buildbot/worker/arc-folder/llvm-project/llvm/include -I/buildbot/worker/arc-folder/llvm-project/clang/tools/clang-fuzzer/handle-cxx/. -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-uninitialized -Wno-nonnull -Wno-class-memaccess -Wno-redundant-move -Wno-pessimizing-move -Wno-noexcept-type -Wno-unnecessary-virtual-specifier -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -Wno-misleading-indentation -fdiagnostics-color -ffunction-sections -fdata-sections -fno-common -Woverloaded-virtual -fno-strict-aliasing -O3 -DNDEBUG  -fno-exceptions -funwind-tables -fno-rtti -UNDEBUG -std=c++17 -MD -MT tools/clang/tools/clang-fuzzer/handle-cxx/CMakeFiles/obj.clangHandleCXX.dir/handle_cxx.cpp.o -MF tools/clang/tools/clang-fuzzer/handle-cxx/CMakeFiles/obj.clangHandleCXX.dir/handle_cxx.cpp.o.d -o tools/clang/tools/clang-fuzzer/handle-cxx/CMakeFiles/obj.clangHandleCXX.dir/handle_cxx.cpp.o -c /buildbot/worker/arc-folder/llvm-project/clang/tools/clang-fuzzer/handle-cxx/handle_cxx.cpp
/buildbot/worker/arc-folder/llvm-project/clang/tools/clang-fuzzer/handle-cxx/handle_cxx.cpp: In function 'void clang_fuzzer::HandleCXX(const string&, const char*, const std::vector<const char*>&)':
/buildbot/worker/arc-folder/llvm-project/clang/tools/clang-fuzzer/handle-cxx/handle_cxx.cpp:38:20: error: no matching function for call to 'clang::DiagnosticsEngine::DiagnosticsEngine(llvm::IntrusiveRefCntPtr<clang::DiagnosticIDs>, clang::DiagnosticOptions*, clang::IgnoringDiagConsumer*, bool)'
   38 |       &Diags, false);
      |                    ^
In file included from /buildbot/worker/arc-folder/llvm-project/clang/include/clang/AST/NestedNameSpecifier.h:18,
                 from /buildbot/worker/arc-folder/llvm-project/clang/include/clang/AST/Type.h:21,
                 from /buildbot/worker/arc-folder/llvm-project/clang/include/clang/AST/CanonicalType.h:17,
                 from /buildbot/worker/arc-folder/llvm-project/clang/include/clang/AST/ASTContext.h:18,
                 from /buildbot/worker/arc-folder/llvm-project/clang/include/clang/Frontend/ASTUnit.h:17,
                 from /buildbot/worker/arc-folder/llvm-project/clang/include/clang/Frontend/FrontendAction.h:23,
                 from /buildbot/worker/arc-folder/llvm-project/clang/include/clang/CodeGen/CodeGenAction.h:12,
                 from /buildbot/worker/arc-folder/llvm-project/clang/tools/clang-fuzzer/handle-cxx/handle_cxx.cpp:15:
/buildbot/worker/arc-folder/llvm-project/clang/include/clang/Basic/Diagnostic.h:568:12: note: candidate: 'clang::DiagnosticsEngine::DiagnosticsEngine(llvm::IntrusiveRefCntPtr<clang::DiagnosticIDs>, clang::DiagnosticOptions&, clang::DiagnosticConsumer*, bool)'
  568 |   explicit DiagnosticsEngine(IntrusiveRefCntPtr<DiagnosticIDs> Diags,
      |            ^~~~~~~~~~~~~~~~~
/buildbot/worker/arc-folder/llvm-project/clang/include/clang/Basic/Diagnostic.h:569:49: note:   no known conversion for argument 2 from 'clang::DiagnosticOptions*' to 'clang::DiagnosticOptions&'
  569 |                              DiagnosticOptions &DiagOpts,
      |                              ~~~~~~~~~~~~~~~~~~~^~~~~~~~
In file included from /buildbot/worker/arc-folder/llvm-project/clang/include/clang/Basic/DiagnosticIDs.h:19,
                 from /buildbot/worker/arc-folder/llvm-project/clang/include/clang/Basic/Diagnostic.h:17,
                 from /buildbot/worker/arc-folder/llvm-project/clang/include/clang/AST/NestedNameSpecifier.h:18,
                 from /buildbot/worker/arc-folder/llvm-project/clang/include/clang/AST/Type.h:21,
                 from /buildbot/worker/arc-folder/llvm-project/clang/include/clang/AST/CanonicalType.h:17,
                 from /buildbot/worker/arc-folder/llvm-project/clang/include/clang/AST/ASTContext.h:18,
                 from /buildbot/worker/arc-folder/llvm-project/clang/include/clang/Frontend/ASTUnit.h:17,
                 from /buildbot/worker/arc-folder/llvm-project/clang/include/clang/Frontend/FrontendAction.h:23,
                 from /buildbot/worker/arc-folder/llvm-project/clang/include/clang/CodeGen/CodeGenAction.h:12,
                 from /buildbot/worker/arc-folder/llvm-project/clang/tools/clang-fuzzer/handle-cxx/handle_cxx.cpp:15:
/buildbot/worker/arc-folder/llvm-project/llvm/include/llvm/ADT/IntrusiveRefCntPtr.h: In instantiation of 'static void llvm::IntrusiveRefCntPtrInfo<T>::retain(T*) [with T = clang::DiagnosticOptions]':
/buildbot/worker/arc-folder/llvm-project/llvm/include/llvm/ADT/IntrusiveRefCntPtr.h:228:40:   required from 'void llvm::IntrusiveRefCntPtr<T>::retain() [with T = clang::DiagnosticOptions]'
/buildbot/worker/arc-folder/llvm-project/llvm/include/llvm/ADT/IntrusiveRefCntPtr.h:180:43:   required from 'llvm::IntrusiveRefCntPtr<T>::IntrusiveRefCntPtr(T*) [with T = clang::DiagnosticOptions]'
/buildbot/worker/arc-folder/llvm-project/clang/tools/clang-fuzzer/handle-cxx/handle_cxx.cpp:35:74:   required from here
/buildbot/worker/arc-folder/llvm-project/llvm/include/llvm/ADT/IntrusiveRefCntPtr.h:163:37: error: 'class clang::DiagnosticOptions' has no member named 'Retain'
  163 |   static void retain(T *obj) { obj->Retain(); }
      |                                ~~~~~^~~~~~
/buildbot/worker/arc-folder/llvm-project/llvm/include/llvm/ADT/IntrusiveRefCntPtr.h: In instantiation of 'static void llvm::IntrusiveRefCntPtrInfo<T>::release(T*) [with T = clang::DiagnosticOptions]':
/buildbot/worker/arc-folder/llvm-project/llvm/include/llvm/ADT/IntrusiveRefCntPtr.h:233:41:   required from 'void llvm::IntrusiveRefCntPtr<T>::release() [with T = clang::DiagnosticOptions]'

jansvoboda11 added a commit that referenced this pull request May 22, 2025
…ions` (#139584)"

This reverts commit e2a8855. Build failures were fixed right away and reverting the original commit without the fixes breaks the build again.
@jansvoboda11
Copy link
Contributor Author

Reverted the revert, since the build now fails due to the forward-fixes not being reverted...

@kazutakahirata
Copy link
Contributor

@jansvoboda11 I've revered your PR due buildbot failures above (and my local build failures with the same error messages). I'm happy to try your revised patch to see if it build cleanly. Thanks!

I already forward-fixed both failures: d25f95f and b544853.

Ah, I just realized. Thanks!

Even if I reapply your patch, I still get:

llvm/include/llvm/ADT/IntrusiveRefCntPtr.h:163:37: error: no member named 'Retain' in 'clang::DiagnosticOptions'
  163 |   static void retain(T *obj) { obj->Retain(); }
      |                                ~~~  ^
llvm/include/llvm/ADT/IntrusiveRefCntPtr.h:164:38: error: no member named 'Release' in 'clang::DiagnosticOptions'
  164 |   static void release(T *obj) { obj->Release(); }
      |                                 ~~~  ^

among other things.

I'm not sure these are related to your PR.

@jansvoboda11
Copy link
Contributor Author

Are those in the upstream repo? If so, where are they coming from? I have a sparse checkout, so it's possible I missed some non-Clang and non-LLDB usages of DiagnosticOptions.

@llvm-ci
Copy link
Collaborator

llvm-ci commented May 22, 2025

LLVM Buildbot has detected a new failure on builder clang-aarch64-quick running on linaro-clang-aarch64-quick while building clang-tools-extra,clang,lldb at step 4 "build stage 1".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/65/builds/17038

Here is the relevant piece of the build log for the reference
Step 4 (build stage 1) failure: 'ninja' (failure)
...
[879/1636] Building CXX object tools/clang/tools/diagtool/CMakeFiles/diagtool.dir/ShowEnabledWarnings.cpp.o
[880/1636] Building CXX object tools/clang/tools/clang-refactor/CMakeFiles/clang-refactor.dir/ClangRefactor.cpp.o
[881/1636] Building CXX object tools/clang/tools/extra/clang-tidy/CMakeFiles/obj.clangTidy.dir/ClangTidyDiagnosticConsumer.cpp.o
[882/1636] Building CXX object tools/clang/tools/extra/clang-tidy/android/CMakeFiles/obj.clangTidyAndroidModule.dir/CloexecAcceptCheck.cpp.o
[883/1636] Building CXX object tools/clang/lib/Format/CMakeFiles/obj.clangFormat.dir/Format.cpp.o
[884/1636] Building CXX object tools/clang/tools/extra/clang-tidy/android/CMakeFiles/obj.clangTidyAndroidModule.dir/CloexecCreatCheck.cpp.o
[885/1636] Building CXX object tools/clang/tools/clang-installapi/CMakeFiles/clang-installapi.dir/ClangInstallAPI.cpp.o
[886/1636] Building CXX object tools/clang/tools/driver/CMakeFiles/clang.dir/driver.cpp.o
[887/1636] Building CXX object tools/clang/tools/extra/modularize/CMakeFiles/modularize.dir/ModularizeUtilities.cpp.o
[888/1636] Building CXX object tools/clang/tools/clang-fuzzer/handle-cxx/CMakeFiles/obj.clangHandleCXX.dir/handle_cxx.cpp.o
FAILED: tools/clang/tools/clang-fuzzer/handle-cxx/CMakeFiles/obj.clangHandleCXX.dir/handle_cxx.cpp.o 
/usr/local/bin/c++ -DCLANG_EXPORTS -DGTEST_HAS_RTTI=0 -D_DEBUG -D_GLIBCXX_ASSERTIONS -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/home/tcwg-buildbot/worker/clang-aarch64-quick/stage1/tools/clang/tools/clang-fuzzer/handle-cxx -I/home/tcwg-buildbot/worker/clang-aarch64-quick/llvm/clang/tools/clang-fuzzer/handle-cxx -I/home/tcwg-buildbot/worker/clang-aarch64-quick/llvm/clang/include -I/home/tcwg-buildbot/worker/clang-aarch64-quick/stage1/tools/clang/include -I/home/tcwg-buildbot/worker/clang-aarch64-quick/stage1/include -I/home/tcwg-buildbot/worker/clang-aarch64-quick/llvm/llvm/include -I/home/tcwg-buildbot/worker/clang-aarch64-quick/llvm/clang/tools/clang-fuzzer/handle-cxx/. -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wc++98-compat-extra-semi -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -Wmisleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -fno-common -Woverloaded-virtual -Wno-nested-anon-types -O3 -DNDEBUG -std=c++17  -fno-exceptions -funwind-tables -fno-rtti -UNDEBUG -MD -MT tools/clang/tools/clang-fuzzer/handle-cxx/CMakeFiles/obj.clangHandleCXX.dir/handle_cxx.cpp.o -MF tools/clang/tools/clang-fuzzer/handle-cxx/CMakeFiles/obj.clangHandleCXX.dir/handle_cxx.cpp.o.d -o tools/clang/tools/clang-fuzzer/handle-cxx/CMakeFiles/obj.clangHandleCXX.dir/handle_cxx.cpp.o -c /home/tcwg-buildbot/worker/clang-aarch64-quick/llvm/clang/tools/clang-fuzzer/handle-cxx/handle_cxx.cpp
../llvm/clang/tools/clang-fuzzer/handle-cxx/handle_cxx.cpp:36:21: error: no matching constructor for initialization of 'DiagnosticsEngine'
   36 |   DiagnosticsEngine Diagnostics(
      |                     ^
   37 |       IntrusiveRefCntPtr<clang::DiagnosticIDs>(new DiagnosticIDs()), &*DiagOpts,
      |       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   38 |       &Diags, false);
      |       ~~~~~~~~~~~~~
../llvm/clang/include/clang/Basic/Diagnostic.h:568:12: note: candidate constructor not viable: no known conversion from 'clang::DiagnosticOptions *' to 'DiagnosticOptions &' for 2nd argument; remove &
  568 |   explicit DiagnosticsEngine(IntrusiveRefCntPtr<DiagnosticIDs> Diags,
      |            ^
  569 |                              DiagnosticOptions &DiagOpts,
      |                              ~~~~~~~~~~~~~~~~~~~~~~~~~~~
../llvm/clang/include/clang/Basic/Diagnostic.h:572:3: note: candidate constructor not viable: requires 1 argument, but 4 were provided
  572 |   DiagnosticsEngine(const DiagnosticsEngine &) = delete;
      |   ^                 ~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ../llvm/clang/tools/clang-fuzzer/handle-cxx/handle_cxx.cpp:15:
In file included from ../llvm/clang/include/clang/CodeGen/CodeGenAction.h:12:
In file included from ../llvm/clang/include/clang/Frontend/FrontendAction.h:23:
In file included from ../llvm/clang/include/clang/Frontend/ASTUnit.h:17:
In file included from ../llvm/clang/include/clang/AST/ASTContext.h:18:
In file included from ../llvm/clang/include/clang/AST/CanonicalType.h:17:
In file included from ../llvm/clang/include/clang/AST/Type.h:21:
In file included from ../llvm/clang/include/clang/AST/NestedNameSpecifier.h:18:
In file included from ../llvm/clang/include/clang/Basic/Diagnostic.h:17:
In file included from ../llvm/clang/include/clang/Basic/DiagnosticIDs.h:19:
../llvm/llvm/include/llvm/ADT/IntrusiveRefCntPtr.h:163:37: error: no member named 'Retain' in 'clang::DiagnosticOptions'
  163 |   static void retain(T *obj) { obj->Retain(); }
      |                                ~~~  ^
../llvm/llvm/include/llvm/ADT/IntrusiveRefCntPtr.h:228:34: note: in instantiation of member function 'llvm::IntrusiveRefCntPtrInfo<clang::DiagnosticOptions>::retain' requested here
  228 |       IntrusiveRefCntPtrInfo<T>::retain(Obj);
      |                                  ^
../llvm/llvm/include/llvm/ADT/IntrusiveRefCntPtr.h:180:43: note: in instantiation of member function 'llvm::IntrusiveRefCntPtr<clang::DiagnosticOptions>::retain' requested here
  180 |   IntrusiveRefCntPtr(T *obj) : Obj(obj) { retain(); }
      |                                           ^
../llvm/clang/tools/clang-fuzzer/handle-cxx/handle_cxx.cpp:35:52: note: in instantiation of member function 'llvm::IntrusiveRefCntPtr<clang::DiagnosticOptions>::IntrusiveRefCntPtr' requested here
   35 |   IntrusiveRefCntPtr<DiagnosticOptions> DiagOpts = new DiagnosticOptions();
      |                                                    ^

@llvm-ci
Copy link
Collaborator

llvm-ci commented May 22, 2025

LLVM Buildbot has detected a new failure on builder cross-project-tests-sie-ubuntu running on doug-worker-1a while building clang-tools-extra,clang,lldb at step 5 "build-unified-tree".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/181/builds/20223

Here is the relevant piece of the build log for the reference
Step 5 (build-unified-tree) failure: build (failure)
...
1477.760 [284/8/856] Building CXX object tools/clang/lib/Interpreter/CMakeFiles/obj.clangInterpreter.dir/InterpreterUtils.cpp.o
1478.302 [283/8/857] Building CXX object tools/clang/tools/diagtool/CMakeFiles/diagtool.dir/ShowEnabledWarnings.cpp.o
1479.530 [282/8/858] Building CXX object tools/clang/lib/Interpreter/CMakeFiles/obj.clangInterpreter.dir/InterpreterValuePrinter.cpp.o
1482.433 [281/8/859] Building CXX object tools/clang/tools/driver/CMakeFiles/clang.dir/cc1as_main.cpp.o
1482.539 [280/8/860] Building CXX object tools/clang/tools/driver/CMakeFiles/clang.dir/cc1gen_reproducer_main.cpp.o
1483.114 [279/8/861] Building CXX object tools/clang/tools/driver/CMakeFiles/clang.dir/driver.cpp.o
1486.438 [278/8/862] Building CXX object tools/clang/lib/Interpreter/CMakeFiles/obj.clangInterpreter.dir/Interpreter.cpp.o
1487.867 [277/8/863] Building CXX object tools/clang/tools/driver/CMakeFiles/clang.dir/cc1_main.cpp.o
1488.683 [276/8/864] Building CXX object tools/clang/tools/clang-diff/CMakeFiles/clang-diff.dir/ClangDiff.cpp.o
1490.640 [275/8/865] Building CXX object tools/clang/tools/clang-fuzzer/handle-cxx/CMakeFiles/obj.clangHandleCXX.dir/handle_cxx.cpp.o
FAILED: tools/clang/tools/clang-fuzzer/handle-cxx/CMakeFiles/obj.clangHandleCXX.dir/handle_cxx.cpp.o 
/opt/ccache/bin/g++ -DCLANG_EXPORTS -DGTEST_HAS_RTTI=0 -D_DEBUG -D_GLIBCXX_ASSERTIONS -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu/build/tools/clang/tools/clang-fuzzer/handle-cxx -I/home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu/llvm-project/clang/tools/clang-fuzzer/handle-cxx -I/home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu/llvm-project/clang/include -I/home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu/build/tools/clang/include -I/home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu/build/include -I/home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu/llvm-project/llvm/include -I/home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu/llvm-project/clang/tools/clang-fuzzer/handle-cxx/. -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-uninitialized -Wno-nonnull -Wno-class-memaccess -Wno-redundant-move -Wno-pessimizing-move -Wno-noexcept-type -Wno-unnecessary-virtual-specifier -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -Wno-misleading-indentation -fdiagnostics-color -ffunction-sections -fdata-sections -fno-common -Woverloaded-virtual -fno-strict-aliasing -O3 -DNDEBUG  -fno-exceptions -funwind-tables -fno-rtti -UNDEBUG -std=c++17 -MD -MT tools/clang/tools/clang-fuzzer/handle-cxx/CMakeFiles/obj.clangHandleCXX.dir/handle_cxx.cpp.o -MF tools/clang/tools/clang-fuzzer/handle-cxx/CMakeFiles/obj.clangHandleCXX.dir/handle_cxx.cpp.o.d -o tools/clang/tools/clang-fuzzer/handle-cxx/CMakeFiles/obj.clangHandleCXX.dir/handle_cxx.cpp.o -c /home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu/llvm-project/clang/tools/clang-fuzzer/handle-cxx/handle_cxx.cpp
/home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu/llvm-project/clang/tools/clang-fuzzer/handle-cxx/handle_cxx.cpp: In function ‘void clang_fuzzer::HandleCXX(const string&, const char*, const std::vector<const char*>&)’:
/home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu/llvm-project/clang/tools/clang-fuzzer/handle-cxx/handle_cxx.cpp:38:20: error: no matching function for call to ‘clang::DiagnosticsEngine::DiagnosticsEngine(llvm::IntrusiveRefCntPtr<clang::DiagnosticIDs>, clang::DiagnosticOptions*, clang::IgnoringDiagConsumer*, bool)’
   38 |       &Diags, false);
      |                    ^
In file included from /home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu/llvm-project/clang/include/clang/AST/NestedNameSpecifier.h:18,
                 from /home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu/llvm-project/clang/include/clang/AST/Type.h:21,
                 from /home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu/llvm-project/clang/include/clang/AST/CanonicalType.h:17,
                 from /home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu/llvm-project/clang/include/clang/AST/ASTContext.h:18,
                 from /home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu/llvm-project/clang/include/clang/Frontend/ASTUnit.h:17,
                 from /home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu/llvm-project/clang/include/clang/Frontend/FrontendAction.h:23,
                 from /home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu/llvm-project/clang/include/clang/CodeGen/CodeGenAction.h:12,
                 from /home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu/llvm-project/clang/tools/clang-fuzzer/handle-cxx/handle_cxx.cpp:15:
/home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu/llvm-project/clang/include/clang/Basic/Diagnostic.h:568:12: note: candidate: ‘clang::DiagnosticsEngine::DiagnosticsEngine(llvm::IntrusiveRefCntPtr<clang::DiagnosticIDs>, clang::DiagnosticOptions&, clang::DiagnosticConsumer*, bool)’
  568 |   explicit DiagnosticsEngine(IntrusiveRefCntPtr<DiagnosticIDs> Diags,
      |            ^~~~~~~~~~~~~~~~~
/home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu/llvm-project/clang/include/clang/Basic/Diagnostic.h:569:49: note:   no known conversion for argument 2 from ‘clang::DiagnosticOptions*’ to ‘clang::DiagnosticOptions&’
  569 |                              DiagnosticOptions &DiagOpts,
      |                              ~~~~~~~~~~~~~~~~~~~^~~~~~~~
In file included from /home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu/llvm-project/clang/include/clang/Basic/DiagnosticIDs.h:19,
                 from /home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu/llvm-project/clang/include/clang/Basic/Diagnostic.h:17,
                 from /home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu/llvm-project/clang/include/clang/AST/NestedNameSpecifier.h:18,
                 from /home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu/llvm-project/clang/include/clang/AST/Type.h:21,
                 from /home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu/llvm-project/clang/include/clang/AST/CanonicalType.h:17,
                 from /home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu/llvm-project/clang/include/clang/AST/ASTContext.h:18,
                 from /home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu/llvm-project/clang/include/clang/Frontend/ASTUnit.h:17,
                 from /home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu/llvm-project/clang/include/clang/Frontend/FrontendAction.h:23,
                 from /home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu/llvm-project/clang/include/clang/CodeGen/CodeGenAction.h:12,
                 from /home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu/llvm-project/clang/tools/clang-fuzzer/handle-cxx/handle_cxx.cpp:15:
/home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu/llvm-project/llvm/include/llvm/ADT/IntrusiveRefCntPtr.h: In instantiation of ‘static void llvm::IntrusiveRefCntPtrInfo<T>::retain(T*) [with T = clang::DiagnosticOptions]’:
/home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu/llvm-project/llvm/include/llvm/ADT/IntrusiveRefCntPtr.h:228:40:   required from ‘void llvm::IntrusiveRefCntPtr<T>::retain() [with T = clang::DiagnosticOptions]’
/home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu/llvm-project/llvm/include/llvm/ADT/IntrusiveRefCntPtr.h:180:43:   required from ‘llvm::IntrusiveRefCntPtr<T>::IntrusiveRefCntPtr(T*) [with T = clang::DiagnosticOptions]’
/home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu/llvm-project/clang/tools/clang-fuzzer/handle-cxx/handle_cxx.cpp:35:74:   required from here
/home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu/llvm-project/llvm/include/llvm/ADT/IntrusiveRefCntPtr.h:163:37: error: ‘class clang::DiagnosticOptions’ has no member named ‘Retain’
  163 |   static void retain(T *obj) { obj->Retain(); }
      |                                ~~~~~^~~~~~
/home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu/llvm-project/llvm/include/llvm/ADT/IntrusiveRefCntPtr.h: In instantiation of ‘static void llvm::IntrusiveRefCntPtrInfo<T>::release(T*) [with T = clang::DiagnosticOptions]’:
/home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu/llvm-project/llvm/include/llvm/ADT/IntrusiveRefCntPtr.h:233:41:   required from ‘void llvm::IntrusiveRefCntPtr<T>::release() [with T = clang::DiagnosticOptions]’

@kazutakahirata
Copy link
Contributor

@jansvoboda11 I also see:

clang-tools-extra/clang-tidy/plugin/ClangTidyPlugin.cpp:45:51: error: too few arguments to function call, expected 2, have 1
   45 |     Context->setDiagnosticsEngine(DiagEngine.get());
      |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~                 ^

Another one:

clang/include/clang/Frontend/LogDiagnosticPrinter.h:54:22: error: private field 'DiagOpts' is not used [-Werror,-Wunused-private-field]             
   54 |   DiagnosticOptions &DiagOpts;                                                                                                                                                                
      |                      ^                                                                                                                                                                        

from clang/lib/Frontend/LogDiagnosticPrinter.cpp.

llvm/include/llvm/ADT/IntrusiveRefCntPtr.h:163:37: error: no member named 'Retain' in 'clang::DiagnosticOptions'                                    
  163 |   static void retain(T *obj) { obj->Retain(); }                                                                                                                                               
      |                                ~~~  ^                                                                                                                                                         

from flang/lib/Frontend/CompilerInvocation.cpp.

@jansvoboda11
Copy link
Contributor Author

Thanks, I'll fix those ASAP.

llvm-sync bot pushed a commit to arm/arm-toolchain that referenced this pull request May 22, 2025
…gnosticOptions` (#139584)"

This reverts commit 9e306ad.

Multiple builtbot failures have been reported:
llvm/llvm-project#139584
@kazutakahirata
Copy link
Contributor

Thanks, I'll fix those ASAP.

@jansvoboda11 Please feel free to add me as a reviewer. I am happy to build things with your fix.

@llvm-ci
Copy link
Collaborator

llvm-ci commented May 22, 2025

LLVM Buildbot has detected a new failure on builder amdgpu-offload-rhel-8-cmake-build-only running on rocm-docker-rhel-8 while building clang-tools-extra,clang,lldb at step 4 "annotate".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/204/builds/10167

Here is the relevant piece of the build log for the reference
Step 4 (annotate) failure: '../llvm-zorg/zorg/buildbot/builders/annotated/amdgpu-offload-cmake.py --jobs=32' (failure)
...
[6848/7815] Building CXX object tools/clang/tools/libclang/CMakeFiles/libclang.dir/CXCompilationDatabase.cpp.o
[6849/7815] Building CXX object tools/clang/tools/diagtool/CMakeFiles/diagtool.dir/ShowEnabledWarnings.cpp.o
[6850/7815] Linking CXX executable bin/diagtool
[6851/7815] Building CXX object tools/clang/tools/clang-refactor/CMakeFiles/clang-refactor.dir/TestSupport.cpp.o
[6852/7815] Building CXX object tools/clang/tools/libclang/CMakeFiles/libclang.dir/CIndexer.cpp.o
[6853/7815] Building CXX object tools/clang/tools/driver/CMakeFiles/clang.dir/driver.cpp.o
[6854/7815] Building CXX object tools/clang/tools/libclang/CMakeFiles/libclang.dir/CXLoadedDiagnostic.cpp.o
[6855/7815] Building CXX object tools/clang/lib/Interpreter/CMakeFiles/obj.clangInterpreter.dir/InterpreterUtils.cpp.o
[6856/7815] Building CXX object tools/clang/tools/libclang/CMakeFiles/libclang.dir/FatalErrorHandler.cpp.o
[6857/7815] Building CXX object tools/clang/tools/clang-fuzzer/handle-cxx/CMakeFiles/obj.clangHandleCXX.dir/handle_cxx.cpp.o
FAILED: tools/clang/tools/clang-fuzzer/handle-cxx/CMakeFiles/obj.clangHandleCXX.dir/handle_cxx.cpp.o 
ccache /usr/bin/c++ -DCLANG_EXPORTS -DGTEST_HAS_RTTI=0 -D_DEBUG -D_GLIBCXX_ASSERTIONS -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/build/tools/clang/tools/clang-fuzzer/handle-cxx -I/home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/llvm-project/clang/tools/clang-fuzzer/handle-cxx -I/home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/llvm-project/clang/include -I/home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/build/tools/clang/include -I/home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/build/include -I/home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/llvm-project/llvm/include -I/home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/llvm-project/clang/tools/clang-fuzzer/handle-cxx/. -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-uninitialized -Wno-nonnull -Wno-class-memaccess -Wno-noexcept-type -Wno-unnecessary-virtual-specifier -Wdelete-non-virtual-dtor -Wno-comment -Wno-misleading-indentation -fdiagnostics-color -ffunction-sections -fdata-sections -fno-common -Woverloaded-virtual -fno-strict-aliasing -O3 -DNDEBUG -std=c++17  -fno-exceptions -funwind-tables -fno-rtti -UNDEBUG -MD -MT tools/clang/tools/clang-fuzzer/handle-cxx/CMakeFiles/obj.clangHandleCXX.dir/handle_cxx.cpp.o -MF tools/clang/tools/clang-fuzzer/handle-cxx/CMakeFiles/obj.clangHandleCXX.dir/handle_cxx.cpp.o.d -o tools/clang/tools/clang-fuzzer/handle-cxx/CMakeFiles/obj.clangHandleCXX.dir/handle_cxx.cpp.o -c /home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/llvm-project/clang/tools/clang-fuzzer/handle-cxx/handle_cxx.cpp
/home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/llvm-project/clang/tools/clang-fuzzer/handle-cxx/handle_cxx.cpp: In function ‘void clang_fuzzer::HandleCXX(const string&, const char*, const std::vector<const char*>&)’:
/home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/llvm-project/clang/tools/clang-fuzzer/handle-cxx/handle_cxx.cpp:38:20: error: no matching function for call to ‘clang::DiagnosticsEngine::DiagnosticsEngine(llvm::IntrusiveRefCntPtr<clang::DiagnosticIDs>, clang::DiagnosticOptions*, clang::IgnoringDiagConsumer*, bool)’
       &Diags, false);
                    ^
In file included from /home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/llvm-project/clang/include/clang/AST/NestedNameSpecifier.h:18,
                 from /home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/llvm-project/clang/include/clang/AST/Type.h:21,
                 from /home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/llvm-project/clang/include/clang/AST/CanonicalType.h:17,
                 from /home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/llvm-project/clang/include/clang/AST/ASTContext.h:18,
                 from /home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/llvm-project/clang/include/clang/Frontend/ASTUnit.h:17,
                 from /home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/llvm-project/clang/include/clang/Frontend/FrontendAction.h:23,
                 from /home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/llvm-project/clang/include/clang/CodeGen/CodeGenAction.h:12,
                 from /home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/llvm-project/clang/tools/clang-fuzzer/handle-cxx/handle_cxx.cpp:15:
/home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/llvm-project/clang/include/clang/Basic/Diagnostic.h:568:12: note: candidate: ‘clang::DiagnosticsEngine::DiagnosticsEngine(llvm::IntrusiveRefCntPtr<clang::DiagnosticIDs>, clang::DiagnosticOptions&, clang::DiagnosticConsumer*, bool)’
   explicit DiagnosticsEngine(IntrusiveRefCntPtr<DiagnosticIDs> Diags,
            ^~~~~~~~~~~~~~~~~
/home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/llvm-project/clang/include/clang/Basic/Diagnostic.h:568:12: note:   no known conversion for argument 2 from ‘clang::DiagnosticOptions*’ to ‘clang::DiagnosticOptions&’
In file included from /home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/llvm-project/clang/include/clang/Basic/DiagnosticIDs.h:19,
                 from /home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/llvm-project/clang/include/clang/Basic/Diagnostic.h:17,
                 from /home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/llvm-project/clang/include/clang/AST/NestedNameSpecifier.h:18,
                 from /home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/llvm-project/clang/include/clang/AST/Type.h:21,
                 from /home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/llvm-project/clang/include/clang/AST/CanonicalType.h:17,
                 from /home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/llvm-project/clang/include/clang/AST/ASTContext.h:18,
                 from /home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/llvm-project/clang/include/clang/Frontend/ASTUnit.h:17,
                 from /home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/llvm-project/clang/include/clang/Frontend/FrontendAction.h:23,
                 from /home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/llvm-project/clang/include/clang/CodeGen/CodeGenAction.h:12,
                 from /home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/llvm-project/clang/tools/clang-fuzzer/handle-cxx/handle_cxx.cpp:15:
/home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/llvm-project/llvm/include/llvm/ADT/IntrusiveRefCntPtr.h: In instantiation of ‘static void llvm::IntrusiveRefCntPtrInfo<T>::retain(T*) [with T = clang::DiagnosticOptions]’:
/home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/llvm-project/llvm/include/llvm/ADT/IntrusiveRefCntPtr.h:228:40:   required from ‘void llvm::IntrusiveRefCntPtr<T>::retain() [with T = clang::DiagnosticOptions]’
/home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/llvm-project/llvm/include/llvm/ADT/IntrusiveRefCntPtr.h:180:43:   required from ‘llvm::IntrusiveRefCntPtr<T>::IntrusiveRefCntPtr(T*) [with T = clang::DiagnosticOptions]’
/home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/llvm-project/clang/tools/clang-fuzzer/handle-cxx/handle_cxx.cpp:35:74:   required from here
/home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/llvm-project/llvm/include/llvm/ADT/IntrusiveRefCntPtr.h:163:37: error: ‘class clang::DiagnosticOptions’ has no member named ‘Retain’
   static void retain(T *obj) { obj->Retain(); }
                                ~~~~~^~~~~~
/home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/llvm-project/llvm/include/llvm/ADT/IntrusiveRefCntPtr.h: In instantiation of ‘static void llvm::IntrusiveRefCntPtrInfo<T>::release(T*) [with T = clang::DiagnosticOptions]’:
/home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/llvm-project/llvm/include/llvm/ADT/IntrusiveRefCntPtr.h:233:41:   required from ‘void llvm::IntrusiveRefCntPtr<T>::release() [with T = clang::DiagnosticOptions]’
/home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/llvm-project/llvm/include/llvm/ADT/IntrusiveRefCntPtr.h:196:27:   required from ‘llvm::IntrusiveRefCntPtr<T>::~IntrusiveRefCntPtr() [with T = clang::DiagnosticOptions]’
/home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/llvm-project/clang/tools/clang-fuzzer/handle-cxx/handle_cxx.cpp:35:74:   required from here
Step 7 (build cmake config) failure: build cmake config (failure)
...
[6848/7815] Building CXX object tools/clang/tools/libclang/CMakeFiles/libclang.dir/CXCompilationDatabase.cpp.o
[6849/7815] Building CXX object tools/clang/tools/diagtool/CMakeFiles/diagtool.dir/ShowEnabledWarnings.cpp.o
[6850/7815] Linking CXX executable bin/diagtool
[6851/7815] Building CXX object tools/clang/tools/clang-refactor/CMakeFiles/clang-refactor.dir/TestSupport.cpp.o
[6852/7815] Building CXX object tools/clang/tools/libclang/CMakeFiles/libclang.dir/CIndexer.cpp.o
[6853/7815] Building CXX object tools/clang/tools/driver/CMakeFiles/clang.dir/driver.cpp.o
[6854/7815] Building CXX object tools/clang/tools/libclang/CMakeFiles/libclang.dir/CXLoadedDiagnostic.cpp.o
[6855/7815] Building CXX object tools/clang/lib/Interpreter/CMakeFiles/obj.clangInterpreter.dir/InterpreterUtils.cpp.o
[6856/7815] Building CXX object tools/clang/tools/libclang/CMakeFiles/libclang.dir/FatalErrorHandler.cpp.o
[6857/7815] Building CXX object tools/clang/tools/clang-fuzzer/handle-cxx/CMakeFiles/obj.clangHandleCXX.dir/handle_cxx.cpp.o
FAILED: tools/clang/tools/clang-fuzzer/handle-cxx/CMakeFiles/obj.clangHandleCXX.dir/handle_cxx.cpp.o 
ccache /usr/bin/c++ -DCLANG_EXPORTS -DGTEST_HAS_RTTI=0 -D_DEBUG -D_GLIBCXX_ASSERTIONS -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/build/tools/clang/tools/clang-fuzzer/handle-cxx -I/home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/llvm-project/clang/tools/clang-fuzzer/handle-cxx -I/home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/llvm-project/clang/include -I/home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/build/tools/clang/include -I/home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/build/include -I/home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/llvm-project/llvm/include -I/home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/llvm-project/clang/tools/clang-fuzzer/handle-cxx/. -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-uninitialized -Wno-nonnull -Wno-class-memaccess -Wno-noexcept-type -Wno-unnecessary-virtual-specifier -Wdelete-non-virtual-dtor -Wno-comment -Wno-misleading-indentation -fdiagnostics-color -ffunction-sections -fdata-sections -fno-common -Woverloaded-virtual -fno-strict-aliasing -O3 -DNDEBUG -std=c++17  -fno-exceptions -funwind-tables -fno-rtti -UNDEBUG -MD -MT tools/clang/tools/clang-fuzzer/handle-cxx/CMakeFiles/obj.clangHandleCXX.dir/handle_cxx.cpp.o -MF tools/clang/tools/clang-fuzzer/handle-cxx/CMakeFiles/obj.clangHandleCXX.dir/handle_cxx.cpp.o.d -o tools/clang/tools/clang-fuzzer/handle-cxx/CMakeFiles/obj.clangHandleCXX.dir/handle_cxx.cpp.o -c /home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/llvm-project/clang/tools/clang-fuzzer/handle-cxx/handle_cxx.cpp
/home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/llvm-project/clang/tools/clang-fuzzer/handle-cxx/handle_cxx.cpp: In function ‘void clang_fuzzer::HandleCXX(const string&, const char*, const std::vector<const char*>&)’:
/home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/llvm-project/clang/tools/clang-fuzzer/handle-cxx/handle_cxx.cpp:38:20: error: no matching function for call to ‘clang::DiagnosticsEngine::DiagnosticsEngine(llvm::IntrusiveRefCntPtr<clang::DiagnosticIDs>, clang::DiagnosticOptions*, clang::IgnoringDiagConsumer*, bool)’
       &Diags, false);
                    ^
In file included from /home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/llvm-project/clang/include/clang/AST/NestedNameSpecifier.h:18,
                 from /home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/llvm-project/clang/include/clang/AST/Type.h:21,
                 from /home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/llvm-project/clang/include/clang/AST/CanonicalType.h:17,
                 from /home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/llvm-project/clang/include/clang/AST/ASTContext.h:18,
                 from /home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/llvm-project/clang/include/clang/Frontend/ASTUnit.h:17,
                 from /home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/llvm-project/clang/include/clang/Frontend/FrontendAction.h:23,
                 from /home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/llvm-project/clang/include/clang/CodeGen/CodeGenAction.h:12,
                 from /home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/llvm-project/clang/tools/clang-fuzzer/handle-cxx/handle_cxx.cpp:15:
/home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/llvm-project/clang/include/clang/Basic/Diagnostic.h:568:12: note: candidate: ‘clang::DiagnosticsEngine::DiagnosticsEngine(llvm::IntrusiveRefCntPtr<clang::DiagnosticIDs>, clang::DiagnosticOptions&, clang::DiagnosticConsumer*, bool)’
   explicit DiagnosticsEngine(IntrusiveRefCntPtr<DiagnosticIDs> Diags,
            ^~~~~~~~~~~~~~~~~
/home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/llvm-project/clang/include/clang/Basic/Diagnostic.h:568:12: note:   no known conversion for argument 2 from ‘clang::DiagnosticOptions*’ to ‘clang::DiagnosticOptions&’
In file included from /home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/llvm-project/clang/include/clang/Basic/DiagnosticIDs.h:19,
                 from /home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/llvm-project/clang/include/clang/Basic/Diagnostic.h:17,
                 from /home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/llvm-project/clang/include/clang/AST/NestedNameSpecifier.h:18,
                 from /home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/llvm-project/clang/include/clang/AST/Type.h:21,
                 from /home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/llvm-project/clang/include/clang/AST/CanonicalType.h:17,
                 from /home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/llvm-project/clang/include/clang/AST/ASTContext.h:18,
                 from /home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/llvm-project/clang/include/clang/Frontend/ASTUnit.h:17,
                 from /home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/llvm-project/clang/include/clang/Frontend/FrontendAction.h:23,
                 from /home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/llvm-project/clang/include/clang/CodeGen/CodeGenAction.h:12,
                 from /home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/llvm-project/clang/tools/clang-fuzzer/handle-cxx/handle_cxx.cpp:15:
/home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/llvm-project/llvm/include/llvm/ADT/IntrusiveRefCntPtr.h: In instantiation of ‘static void llvm::IntrusiveRefCntPtrInfo<T>::retain(T*) [with T = clang::DiagnosticOptions]’:
/home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/llvm-project/llvm/include/llvm/ADT/IntrusiveRefCntPtr.h:228:40:   required from ‘void llvm::IntrusiveRefCntPtr<T>::retain() [with T = clang::DiagnosticOptions]’
/home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/llvm-project/llvm/include/llvm/ADT/IntrusiveRefCntPtr.h:180:43:   required from ‘llvm::IntrusiveRefCntPtr<T>::IntrusiveRefCntPtr(T*) [with T = clang::DiagnosticOptions]’
/home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/llvm-project/clang/tools/clang-fuzzer/handle-cxx/handle_cxx.cpp:35:74:   required from here
/home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/llvm-project/llvm/include/llvm/ADT/IntrusiveRefCntPtr.h:163:37: error: ‘class clang::DiagnosticOptions’ has no member named ‘Retain’
   static void retain(T *obj) { obj->Retain(); }
                                ~~~~~^~~~~~
/home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/llvm-project/llvm/include/llvm/ADT/IntrusiveRefCntPtr.h: In instantiation of ‘static void llvm::IntrusiveRefCntPtrInfo<T>::release(T*) [with T = clang::DiagnosticOptions]’:
/home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/llvm-project/llvm/include/llvm/ADT/IntrusiveRefCntPtr.h:233:41:   required from ‘void llvm::IntrusiveRefCntPtr<T>::release() [with T = clang::DiagnosticOptions]’
/home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/llvm-project/llvm/include/llvm/ADT/IntrusiveRefCntPtr.h:196:27:   required from ‘llvm::IntrusiveRefCntPtr<T>::~IntrusiveRefCntPtr() [with T = clang::DiagnosticOptions]’
/home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/llvm-project/clang/tools/clang-fuzzer/handle-cxx/handle_cxx.cpp:35:74:   required from here

@llvm-ci
Copy link
Collaborator

llvm-ci commented May 22, 2025

LLVM Buildbot has detected a new failure on builder amdgpu-offload-rhel-9-cmake-build-only running on rocm-docker-rhel-9 while building clang-tools-extra,clang,lldb at step 4 "annotate".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/205/builds/10145

Here is the relevant piece of the build log for the reference
Step 4 (annotate) failure: '../llvm-zorg/zorg/buildbot/builders/annotated/amdgpu-offload-cmake.py --jobs=32' (failure)
...
[6956/7815] Building HLFIROpInterfaces.h.inc...
[6957/7815] Building Passes.h.inc...
[6958/7815] Building HLFIROps.cpp.inc...
[6959/7815] Building HLFIRTypes.h.inc...
[6960/7815] Building Passes.h.inc...
[6961/7815] Building Passes.h.inc...
[6962/7815] Building HLFIROps.h.inc...
[6963/7815] Generating VCSVersion.inc
[6964/7815] Linking CXX shared library lib/libFortranDecimal.so.21.0git
[6965/7815] Building CXX object tools/clang/tools/clang-fuzzer/handle-cxx/CMakeFiles/obj.clangHandleCXX.dir/handle_cxx.cpp.o
FAILED: tools/clang/tools/clang-fuzzer/handle-cxx/CMakeFiles/obj.clangHandleCXX.dir/handle_cxx.cpp.o 
ccache /usr/bin/c++ -DCLANG_EXPORTS -DGTEST_HAS_RTTI=0 -D_DEBUG -D_GLIBCXX_ASSERTIONS -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/build/tools/clang/tools/clang-fuzzer/handle-cxx -I/home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/llvm-project/clang/tools/clang-fuzzer/handle-cxx -I/home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/llvm-project/clang/include -I/home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/build/tools/clang/include -I/home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/build/include -I/home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/llvm-project/llvm/include -I/home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/llvm-project/clang/tools/clang-fuzzer/handle-cxx/. -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-uninitialized -Wno-nonnull -Wno-class-memaccess -Wno-redundant-move -Wno-pessimizing-move -Wno-noexcept-type -Wno-unnecessary-virtual-specifier -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -Wno-misleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -fno-common -Woverloaded-virtual -fno-strict-aliasing -O3 -DNDEBUG -std=c++17  -fno-exceptions -funwind-tables -fno-rtti -UNDEBUG -MD -MT tools/clang/tools/clang-fuzzer/handle-cxx/CMakeFiles/obj.clangHandleCXX.dir/handle_cxx.cpp.o -MF tools/clang/tools/clang-fuzzer/handle-cxx/CMakeFiles/obj.clangHandleCXX.dir/handle_cxx.cpp.o.d -o tools/clang/tools/clang-fuzzer/handle-cxx/CMakeFiles/obj.clangHandleCXX.dir/handle_cxx.cpp.o -c /home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/llvm-project/clang/tools/clang-fuzzer/handle-cxx/handle_cxx.cpp
/home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/llvm-project/clang/tools/clang-fuzzer/handle-cxx/handle_cxx.cpp: In function ‘void clang_fuzzer::HandleCXX(const string&, const char*, const std::vector<const char*>&)’:
/home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/llvm-project/clang/tools/clang-fuzzer/handle-cxx/handle_cxx.cpp:38:20: error: no matching function for call to ‘clang::DiagnosticsEngine::DiagnosticsEngine(llvm::IntrusiveRefCntPtr<clang::DiagnosticIDs>, clang::DiagnosticOptions*, clang::IgnoringDiagConsumer*, bool)’
   38 |       &Diags, false);
      |                    ^
In file included from /home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/llvm-project/clang/include/clang/AST/NestedNameSpecifier.h:18,
                 from /home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/llvm-project/clang/include/clang/AST/Type.h:21,
                 from /home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/llvm-project/clang/include/clang/AST/CanonicalType.h:17,
                 from /home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/llvm-project/clang/include/clang/AST/ASTContext.h:18,
                 from /home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/llvm-project/clang/include/clang/Frontend/ASTUnit.h:17,
                 from /home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/llvm-project/clang/include/clang/Frontend/FrontendAction.h:23,
                 from /home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/llvm-project/clang/include/clang/CodeGen/CodeGenAction.h:12,
                 from /home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/llvm-project/clang/tools/clang-fuzzer/handle-cxx/handle_cxx.cpp:15:
/home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/llvm-project/clang/include/clang/Basic/Diagnostic.h:568:12: note: candidate: ‘clang::DiagnosticsEngine::DiagnosticsEngine(llvm::IntrusiveRefCntPtr<clang::DiagnosticIDs>, clang::DiagnosticOptions&, clang::DiagnosticConsumer*, bool)’
  568 |   explicit DiagnosticsEngine(IntrusiveRefCntPtr<DiagnosticIDs> Diags,
      |            ^~~~~~~~~~~~~~~~~
/home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/llvm-project/clang/include/clang/Basic/Diagnostic.h:569:49: note:   no known conversion for argument 2 from ‘clang::DiagnosticOptions*’ to ‘clang::DiagnosticOptions&’
  569 |                              DiagnosticOptions &DiagOpts,
      |                              ~~~~~~~~~~~~~~~~~~~^~~~~~~~
In file included from /home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/llvm-project/clang/include/clang/Basic/DiagnosticIDs.h:19,
                 from /home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/llvm-project/clang/include/clang/Basic/Diagnostic.h:17,
                 from /home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/llvm-project/clang/include/clang/AST/NestedNameSpecifier.h:18,
                 from /home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/llvm-project/clang/include/clang/AST/Type.h:21,
                 from /home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/llvm-project/clang/include/clang/AST/CanonicalType.h:17,
                 from /home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/llvm-project/clang/include/clang/AST/ASTContext.h:18,
                 from /home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/llvm-project/clang/include/clang/Frontend/ASTUnit.h:17,
                 from /home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/llvm-project/clang/include/clang/Frontend/FrontendAction.h:23,
                 from /home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/llvm-project/clang/include/clang/CodeGen/CodeGenAction.h:12,
                 from /home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/llvm-project/clang/tools/clang-fuzzer/handle-cxx/handle_cxx.cpp:15:
/home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/llvm-project/llvm/include/llvm/ADT/IntrusiveRefCntPtr.h: In instantiation of ‘static void llvm::IntrusiveRefCntPtrInfo<T>::retain(T*) [with T = clang::DiagnosticOptions]’:
/home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/llvm-project/llvm/include/llvm/ADT/IntrusiveRefCntPtr.h:228:40:   required from ‘void llvm::IntrusiveRefCntPtr<T>::retain() [with T = clang::DiagnosticOptions]’
/home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/llvm-project/llvm/include/llvm/ADT/IntrusiveRefCntPtr.h:180:43:   required from ‘llvm::IntrusiveRefCntPtr<T>::IntrusiveRefCntPtr(T*) [with T = clang::DiagnosticOptions]’
/home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/llvm-project/clang/tools/clang-fuzzer/handle-cxx/handle_cxx.cpp:35:74:   required from here
/home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/llvm-project/llvm/include/llvm/ADT/IntrusiveRefCntPtr.h:163:37: error: ‘class clang::DiagnosticOptions’ has no member named ‘Retain’
  163 |   static void retain(T *obj) { obj->Retain(); }
      |                                ~~~~~^~~~~~
/home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/llvm-project/llvm/include/llvm/ADT/IntrusiveRefCntPtr.h: In instantiation of ‘static void llvm::IntrusiveRefCntPtrInfo<T>::release(T*) [with T = clang::DiagnosticOptions]’:
/home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/llvm-project/llvm/include/llvm/ADT/IntrusiveRefCntPtr.h:233:41:   required from ‘void llvm::IntrusiveRefCntPtr<T>::release() [with T = clang::DiagnosticOptions]’
Step 7 (build cmake config) failure: build cmake config (failure)
...
[6956/7815] Building HLFIROpInterfaces.h.inc...
[6957/7815] Building Passes.h.inc...
[6958/7815] Building HLFIROps.cpp.inc...
[6959/7815] Building HLFIRTypes.h.inc...
[6960/7815] Building Passes.h.inc...
[6961/7815] Building Passes.h.inc...
[6962/7815] Building HLFIROps.h.inc...
[6963/7815] Generating VCSVersion.inc
[6964/7815] Linking CXX shared library lib/libFortranDecimal.so.21.0git
[6965/7815] Building CXX object tools/clang/tools/clang-fuzzer/handle-cxx/CMakeFiles/obj.clangHandleCXX.dir/handle_cxx.cpp.o
FAILED: tools/clang/tools/clang-fuzzer/handle-cxx/CMakeFiles/obj.clangHandleCXX.dir/handle_cxx.cpp.o 
ccache /usr/bin/c++ -DCLANG_EXPORTS -DGTEST_HAS_RTTI=0 -D_DEBUG -D_GLIBCXX_ASSERTIONS -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/build/tools/clang/tools/clang-fuzzer/handle-cxx -I/home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/llvm-project/clang/tools/clang-fuzzer/handle-cxx -I/home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/llvm-project/clang/include -I/home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/build/tools/clang/include -I/home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/build/include -I/home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/llvm-project/llvm/include -I/home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/llvm-project/clang/tools/clang-fuzzer/handle-cxx/. -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-uninitialized -Wno-nonnull -Wno-class-memaccess -Wno-redundant-move -Wno-pessimizing-move -Wno-noexcept-type -Wno-unnecessary-virtual-specifier -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -Wno-misleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -fno-common -Woverloaded-virtual -fno-strict-aliasing -O3 -DNDEBUG -std=c++17  -fno-exceptions -funwind-tables -fno-rtti -UNDEBUG -MD -MT tools/clang/tools/clang-fuzzer/handle-cxx/CMakeFiles/obj.clangHandleCXX.dir/handle_cxx.cpp.o -MF tools/clang/tools/clang-fuzzer/handle-cxx/CMakeFiles/obj.clangHandleCXX.dir/handle_cxx.cpp.o.d -o tools/clang/tools/clang-fuzzer/handle-cxx/CMakeFiles/obj.clangHandleCXX.dir/handle_cxx.cpp.o -c /home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/llvm-project/clang/tools/clang-fuzzer/handle-cxx/handle_cxx.cpp
/home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/llvm-project/clang/tools/clang-fuzzer/handle-cxx/handle_cxx.cpp: In function ‘void clang_fuzzer::HandleCXX(const string&, const char*, const std::vector<const char*>&)’:
/home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/llvm-project/clang/tools/clang-fuzzer/handle-cxx/handle_cxx.cpp:38:20: error: no matching function for call to ‘clang::DiagnosticsEngine::DiagnosticsEngine(llvm::IntrusiveRefCntPtr<clang::DiagnosticIDs>, clang::DiagnosticOptions*, clang::IgnoringDiagConsumer*, bool)’
   38 |       &Diags, false);
      |                    ^
In file included from /home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/llvm-project/clang/include/clang/AST/NestedNameSpecifier.h:18,
                 from /home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/llvm-project/clang/include/clang/AST/Type.h:21,
                 from /home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/llvm-project/clang/include/clang/AST/CanonicalType.h:17,
                 from /home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/llvm-project/clang/include/clang/AST/ASTContext.h:18,
                 from /home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/llvm-project/clang/include/clang/Frontend/ASTUnit.h:17,
                 from /home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/llvm-project/clang/include/clang/Frontend/FrontendAction.h:23,
                 from /home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/llvm-project/clang/include/clang/CodeGen/CodeGenAction.h:12,
                 from /home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/llvm-project/clang/tools/clang-fuzzer/handle-cxx/handle_cxx.cpp:15:
/home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/llvm-project/clang/include/clang/Basic/Diagnostic.h:568:12: note: candidate: ‘clang::DiagnosticsEngine::DiagnosticsEngine(llvm::IntrusiveRefCntPtr<clang::DiagnosticIDs>, clang::DiagnosticOptions&, clang::DiagnosticConsumer*, bool)’
  568 |   explicit DiagnosticsEngine(IntrusiveRefCntPtr<DiagnosticIDs> Diags,
      |            ^~~~~~~~~~~~~~~~~
/home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/llvm-project/clang/include/clang/Basic/Diagnostic.h:569:49: note:   no known conversion for argument 2 from ‘clang::DiagnosticOptions*’ to ‘clang::DiagnosticOptions&’
  569 |                              DiagnosticOptions &DiagOpts,
      |                              ~~~~~~~~~~~~~~~~~~~^~~~~~~~
In file included from /home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/llvm-project/clang/include/clang/Basic/DiagnosticIDs.h:19,
                 from /home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/llvm-project/clang/include/clang/Basic/Diagnostic.h:17,
                 from /home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/llvm-project/clang/include/clang/AST/NestedNameSpecifier.h:18,
                 from /home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/llvm-project/clang/include/clang/AST/Type.h:21,
                 from /home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/llvm-project/clang/include/clang/AST/CanonicalType.h:17,
                 from /home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/llvm-project/clang/include/clang/AST/ASTContext.h:18,
                 from /home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/llvm-project/clang/include/clang/Frontend/ASTUnit.h:17,
                 from /home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/llvm-project/clang/include/clang/Frontend/FrontendAction.h:23,
                 from /home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/llvm-project/clang/include/clang/CodeGen/CodeGenAction.h:12,
                 from /home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/llvm-project/clang/tools/clang-fuzzer/handle-cxx/handle_cxx.cpp:15:
/home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/llvm-project/llvm/include/llvm/ADT/IntrusiveRefCntPtr.h: In instantiation of ‘static void llvm::IntrusiveRefCntPtrInfo<T>::retain(T*) [with T = clang::DiagnosticOptions]’:
/home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/llvm-project/llvm/include/llvm/ADT/IntrusiveRefCntPtr.h:228:40:   required from ‘void llvm::IntrusiveRefCntPtr<T>::retain() [with T = clang::DiagnosticOptions]’
/home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/llvm-project/llvm/include/llvm/ADT/IntrusiveRefCntPtr.h:180:43:   required from ‘llvm::IntrusiveRefCntPtr<T>::IntrusiveRefCntPtr(T*) [with T = clang::DiagnosticOptions]’
/home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/llvm-project/clang/tools/clang-fuzzer/handle-cxx/handle_cxx.cpp:35:74:   required from here
/home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/llvm-project/llvm/include/llvm/ADT/IntrusiveRefCntPtr.h:163:37: error: ‘class clang::DiagnosticOptions’ has no member named ‘Retain’
  163 |   static void retain(T *obj) { obj->Retain(); }
      |                                ~~~~~^~~~~~
/home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/llvm-project/llvm/include/llvm/ADT/IntrusiveRefCntPtr.h: In instantiation of ‘static void llvm::IntrusiveRefCntPtrInfo<T>::release(T*) [with T = clang::DiagnosticOptions]’:
/home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/llvm-project/llvm/include/llvm/ADT/IntrusiveRefCntPtr.h:233:41:   required from ‘void llvm::IntrusiveRefCntPtr<T>::release() [with T = clang::DiagnosticOptions]’

@llvm-ci
Copy link
Collaborator

llvm-ci commented May 22, 2025

LLVM Buildbot has detected a new failure on builder amdgpu-offload-ubuntu-22-cmake-build-only running on rocm-docker-ubu-22 while building clang-tools-extra,clang,lldb at step 4 "annotate".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/203/builds/11354

Here is the relevant piece of the build log for the reference
Step 4 (annotate) failure: '../llvm-zorg/zorg/buildbot/builders/annotated/amdgpu-offload-cmake.py --jobs=32' (failure)
...
[6893/7815] Building CXX object tools/clang/tools/libclang/CMakeFiles/libclang.dir/CXCompilationDatabase.cpp.o
[6894/7815] Building CXX object tools/clang/tools/diagtool/CMakeFiles/diagtool.dir/ShowEnabledWarnings.cpp.o
[6895/7815] Linking CXX executable bin/diagtool
[6896/7815] Building CXX object tools/clang/tools/clang-refactor/CMakeFiles/clang-refactor.dir/TestSupport.cpp.o
[6897/7815] Building CXX object tools/clang/tools/libclang/CMakeFiles/libclang.dir/CIndexer.cpp.o
[6898/7815] Building CXX object tools/clang/lib/StaticAnalyzer/Checkers/CMakeFiles/obj.clangStaticAnalyzerCheckers.dir/WebKit/ForwardDeclChecker.cpp.o
[6899/7815] Building CXX object tools/clang/tools/driver/CMakeFiles/clang.dir/driver.cpp.o
[6900/7815] Building CXX object tools/clang/tools/libclang/CMakeFiles/libclang.dir/CXLoadedDiagnostic.cpp.o
[6901/7815] Building CXX object tools/clang/tools/libclang/CMakeFiles/libclang.dir/FatalErrorHandler.cpp.o
[6902/7815] Building CXX object tools/clang/tools/clang-fuzzer/handle-cxx/CMakeFiles/obj.clangHandleCXX.dir/handle_cxx.cpp.o
FAILED: tools/clang/tools/clang-fuzzer/handle-cxx/CMakeFiles/obj.clangHandleCXX.dir/handle_cxx.cpp.o 
ccache /usr/bin/c++ -DCLANG_EXPORTS -DGTEST_HAS_RTTI=0 -D_DEBUG -D_GLIBCXX_ASSERTIONS -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/build/tools/clang/tools/clang-fuzzer/handle-cxx -I/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/clang/tools/clang-fuzzer/handle-cxx -I/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/clang/include -I/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/build/tools/clang/include -I/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/build/include -I/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/llvm/include -I/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/clang/tools/clang-fuzzer/handle-cxx/. -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-uninitialized -Wno-nonnull -Wno-class-memaccess -Wno-redundant-move -Wno-pessimizing-move -Wno-noexcept-type -Wno-unnecessary-virtual-specifier -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -Wno-misleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -fno-common -Woverloaded-virtual -fno-strict-aliasing -O3 -DNDEBUG  -fno-exceptions -funwind-tables -fno-rtti -UNDEBUG -std=c++17 -MD -MT tools/clang/tools/clang-fuzzer/handle-cxx/CMakeFiles/obj.clangHandleCXX.dir/handle_cxx.cpp.o -MF tools/clang/tools/clang-fuzzer/handle-cxx/CMakeFiles/obj.clangHandleCXX.dir/handle_cxx.cpp.o.d -o tools/clang/tools/clang-fuzzer/handle-cxx/CMakeFiles/obj.clangHandleCXX.dir/handle_cxx.cpp.o -c /home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/clang/tools/clang-fuzzer/handle-cxx/handle_cxx.cpp
/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/clang/tools/clang-fuzzer/handle-cxx/handle_cxx.cpp: In function ‘void clang_fuzzer::HandleCXX(const string&, const char*, const std::vector<const char*>&)’:
/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/clang/tools/clang-fuzzer/handle-cxx/handle_cxx.cpp:38:20: error: no matching function for call to ‘clang::DiagnosticsEngine::DiagnosticsEngine(llvm::IntrusiveRefCntPtr<clang::DiagnosticIDs>, clang::DiagnosticOptions*, clang::IgnoringDiagConsumer*, bool)’
   38 |       &Diags, false);
      |                    ^
In file included from /home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/clang/include/clang/AST/NestedNameSpecifier.h:18,
                 from /home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/clang/include/clang/AST/Type.h:21,
                 from /home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/clang/include/clang/AST/CanonicalType.h:17,
                 from /home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/clang/include/clang/AST/ASTContext.h:18,
                 from /home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/clang/include/clang/Frontend/ASTUnit.h:17,
                 from /home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/clang/include/clang/Frontend/FrontendAction.h:23,
                 from /home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/clang/include/clang/CodeGen/CodeGenAction.h:12,
                 from /home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/clang/tools/clang-fuzzer/handle-cxx/handle_cxx.cpp:15:
/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/clang/include/clang/Basic/Diagnostic.h:568:12: note: candidate: ‘clang::DiagnosticsEngine::DiagnosticsEngine(llvm::IntrusiveRefCntPtr<clang::DiagnosticIDs>, clang::DiagnosticOptions&, clang::DiagnosticConsumer*, bool)’
  568 |   explicit DiagnosticsEngine(IntrusiveRefCntPtr<DiagnosticIDs> Diags,
      |            ^~~~~~~~~~~~~~~~~
/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/clang/include/clang/Basic/Diagnostic.h:569:49: note:   no known conversion for argument 2 from ‘clang::DiagnosticOptions*’ to ‘clang::DiagnosticOptions&’
  569 |                              DiagnosticOptions &DiagOpts,
      |                              ~~~~~~~~~~~~~~~~~~~^~~~~~~~
In file included from /home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/clang/include/clang/Basic/DiagnosticIDs.h:19,
                 from /home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/clang/include/clang/Basic/Diagnostic.h:17,
                 from /home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/clang/include/clang/AST/NestedNameSpecifier.h:18,
                 from /home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/clang/include/clang/AST/Type.h:21,
                 from /home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/clang/include/clang/AST/CanonicalType.h:17,
                 from /home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/clang/include/clang/AST/ASTContext.h:18,
                 from /home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/clang/include/clang/Frontend/ASTUnit.h:17,
                 from /home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/clang/include/clang/Frontend/FrontendAction.h:23,
                 from /home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/clang/include/clang/CodeGen/CodeGenAction.h:12,
                 from /home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/clang/tools/clang-fuzzer/handle-cxx/handle_cxx.cpp:15:
/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/llvm/include/llvm/ADT/IntrusiveRefCntPtr.h: In instantiation of ‘static void llvm::IntrusiveRefCntPtrInfo<T>::retain(T*) [with T = clang::DiagnosticOptions]’:
/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/llvm/include/llvm/ADT/IntrusiveRefCntPtr.h:228:40:   required from ‘void llvm::IntrusiveRefCntPtr<T>::retain() [with T = clang::DiagnosticOptions]’
/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/llvm/include/llvm/ADT/IntrusiveRefCntPtr.h:180:43:   required from ‘llvm::IntrusiveRefCntPtr<T>::IntrusiveRefCntPtr(T*) [with T = clang::DiagnosticOptions]’
/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/clang/tools/clang-fuzzer/handle-cxx/handle_cxx.cpp:35:74:   required from here
/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/llvm/include/llvm/ADT/IntrusiveRefCntPtr.h:163:37: error: ‘class clang::DiagnosticOptions’ has no member named ‘Retain’
  163 |   static void retain(T *obj) { obj->Retain(); }
      |                                ~~~~~^~~~~~
/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/llvm/include/llvm/ADT/IntrusiveRefCntPtr.h: In instantiation of ‘static void llvm::IntrusiveRefCntPtrInfo<T>::release(T*) [with T = clang::DiagnosticOptions]’:
/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/llvm/include/llvm/ADT/IntrusiveRefCntPtr.h:233:41:   required from ‘void llvm::IntrusiveRefCntPtr<T>::release() [with T = clang::DiagnosticOptions]’
Step 7 (build cmake config) failure: build cmake config (failure)
...
[6893/7815] Building CXX object tools/clang/tools/libclang/CMakeFiles/libclang.dir/CXCompilationDatabase.cpp.o
[6894/7815] Building CXX object tools/clang/tools/diagtool/CMakeFiles/diagtool.dir/ShowEnabledWarnings.cpp.o
[6895/7815] Linking CXX executable bin/diagtool
[6896/7815] Building CXX object tools/clang/tools/clang-refactor/CMakeFiles/clang-refactor.dir/TestSupport.cpp.o
[6897/7815] Building CXX object tools/clang/tools/libclang/CMakeFiles/libclang.dir/CIndexer.cpp.o
[6898/7815] Building CXX object tools/clang/lib/StaticAnalyzer/Checkers/CMakeFiles/obj.clangStaticAnalyzerCheckers.dir/WebKit/ForwardDeclChecker.cpp.o
[6899/7815] Building CXX object tools/clang/tools/driver/CMakeFiles/clang.dir/driver.cpp.o
[6900/7815] Building CXX object tools/clang/tools/libclang/CMakeFiles/libclang.dir/CXLoadedDiagnostic.cpp.o
[6901/7815] Building CXX object tools/clang/tools/libclang/CMakeFiles/libclang.dir/FatalErrorHandler.cpp.o
[6902/7815] Building CXX object tools/clang/tools/clang-fuzzer/handle-cxx/CMakeFiles/obj.clangHandleCXX.dir/handle_cxx.cpp.o
FAILED: tools/clang/tools/clang-fuzzer/handle-cxx/CMakeFiles/obj.clangHandleCXX.dir/handle_cxx.cpp.o 
ccache /usr/bin/c++ -DCLANG_EXPORTS -DGTEST_HAS_RTTI=0 -D_DEBUG -D_GLIBCXX_ASSERTIONS -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/build/tools/clang/tools/clang-fuzzer/handle-cxx -I/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/clang/tools/clang-fuzzer/handle-cxx -I/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/clang/include -I/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/build/tools/clang/include -I/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/build/include -I/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/llvm/include -I/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/clang/tools/clang-fuzzer/handle-cxx/. -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-uninitialized -Wno-nonnull -Wno-class-memaccess -Wno-redundant-move -Wno-pessimizing-move -Wno-noexcept-type -Wno-unnecessary-virtual-specifier -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -Wno-misleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -fno-common -Woverloaded-virtual -fno-strict-aliasing -O3 -DNDEBUG  -fno-exceptions -funwind-tables -fno-rtti -UNDEBUG -std=c++17 -MD -MT tools/clang/tools/clang-fuzzer/handle-cxx/CMakeFiles/obj.clangHandleCXX.dir/handle_cxx.cpp.o -MF tools/clang/tools/clang-fuzzer/handle-cxx/CMakeFiles/obj.clangHandleCXX.dir/handle_cxx.cpp.o.d -o tools/clang/tools/clang-fuzzer/handle-cxx/CMakeFiles/obj.clangHandleCXX.dir/handle_cxx.cpp.o -c /home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/clang/tools/clang-fuzzer/handle-cxx/handle_cxx.cpp
/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/clang/tools/clang-fuzzer/handle-cxx/handle_cxx.cpp: In function ‘void clang_fuzzer::HandleCXX(const string&, const char*, const std::vector<const char*>&)’:
/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/clang/tools/clang-fuzzer/handle-cxx/handle_cxx.cpp:38:20: error: no matching function for call to ‘clang::DiagnosticsEngine::DiagnosticsEngine(llvm::IntrusiveRefCntPtr<clang::DiagnosticIDs>, clang::DiagnosticOptions*, clang::IgnoringDiagConsumer*, bool)’
   38 |       &Diags, false);
      |                    ^
In file included from /home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/clang/include/clang/AST/NestedNameSpecifier.h:18,
                 from /home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/clang/include/clang/AST/Type.h:21,
                 from /home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/clang/include/clang/AST/CanonicalType.h:17,
                 from /home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/clang/include/clang/AST/ASTContext.h:18,
                 from /home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/clang/include/clang/Frontend/ASTUnit.h:17,
                 from /home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/clang/include/clang/Frontend/FrontendAction.h:23,
                 from /home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/clang/include/clang/CodeGen/CodeGenAction.h:12,
                 from /home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/clang/tools/clang-fuzzer/handle-cxx/handle_cxx.cpp:15:
/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/clang/include/clang/Basic/Diagnostic.h:568:12: note: candidate: ‘clang::DiagnosticsEngine::DiagnosticsEngine(llvm::IntrusiveRefCntPtr<clang::DiagnosticIDs>, clang::DiagnosticOptions&, clang::DiagnosticConsumer*, bool)’
  568 |   explicit DiagnosticsEngine(IntrusiveRefCntPtr<DiagnosticIDs> Diags,
      |            ^~~~~~~~~~~~~~~~~
/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/clang/include/clang/Basic/Diagnostic.h:569:49: note:   no known conversion for argument 2 from ‘clang::DiagnosticOptions*’ to ‘clang::DiagnosticOptions&’
  569 |                              DiagnosticOptions &DiagOpts,
      |                              ~~~~~~~~~~~~~~~~~~~^~~~~~~~
In file included from /home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/clang/include/clang/Basic/DiagnosticIDs.h:19,
                 from /home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/clang/include/clang/Basic/Diagnostic.h:17,
                 from /home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/clang/include/clang/AST/NestedNameSpecifier.h:18,
                 from /home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/clang/include/clang/AST/Type.h:21,
                 from /home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/clang/include/clang/AST/CanonicalType.h:17,
                 from /home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/clang/include/clang/AST/ASTContext.h:18,
                 from /home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/clang/include/clang/Frontend/ASTUnit.h:17,
                 from /home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/clang/include/clang/Frontend/FrontendAction.h:23,
                 from /home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/clang/include/clang/CodeGen/CodeGenAction.h:12,
                 from /home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/clang/tools/clang-fuzzer/handle-cxx/handle_cxx.cpp:15:
/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/llvm/include/llvm/ADT/IntrusiveRefCntPtr.h: In instantiation of ‘static void llvm::IntrusiveRefCntPtrInfo<T>::retain(T*) [with T = clang::DiagnosticOptions]’:
/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/llvm/include/llvm/ADT/IntrusiveRefCntPtr.h:228:40:   required from ‘void llvm::IntrusiveRefCntPtr<T>::retain() [with T = clang::DiagnosticOptions]’
/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/llvm/include/llvm/ADT/IntrusiveRefCntPtr.h:180:43:   required from ‘llvm::IntrusiveRefCntPtr<T>::IntrusiveRefCntPtr(T*) [with T = clang::DiagnosticOptions]’
/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/clang/tools/clang-fuzzer/handle-cxx/handle_cxx.cpp:35:74:   required from here
/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/llvm/include/llvm/ADT/IntrusiveRefCntPtr.h:163:37: error: ‘class clang::DiagnosticOptions’ has no member named ‘Retain’
  163 |   static void retain(T *obj) { obj->Retain(); }
      |                                ~~~~~^~~~~~
/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/llvm/include/llvm/ADT/IntrusiveRefCntPtr.h: In instantiation of ‘static void llvm::IntrusiveRefCntPtrInfo<T>::release(T*) [with T = clang::DiagnosticOptions]’:
/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/llvm/include/llvm/ADT/IntrusiveRefCntPtr.h:233:41:   required from ‘void llvm::IntrusiveRefCntPtr<T>::release() [with T = clang::DiagnosticOptions]’

@llvm-ci
Copy link
Collaborator

llvm-ci commented May 22, 2025

LLVM Buildbot has detected a new failure on builder premerge-monolithic-linux running on premerge-linux-1 while building clang-tools-extra,clang,lldb at step 6 "build-unified-tree".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/153/builds/32614

Here is the relevant piece of the build log for the reference
Step 6 (build-unified-tree) failure: build (failure)
...
50.945 [5704/58/322] Building CXX object tools/clang/lib/ASTMatchers/Dynamic/CMakeFiles/obj.clangDynamicASTMatchers.dir/Parser.cpp.o
51.315 [5703/58/323] Building CXX object tools/clang/lib/AST/CMakeFiles/obj.clangAST.dir/ParentMapContext.cpp.o
51.350 [5702/58/324] Building CXX object tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/ScopeInfo.cpp.o
51.778 [5701/58/325] Building CXX object tools/clang/lib/ASTMatchers/Dynamic/CMakeFiles/obj.clangDynamicASTMatchers.dir/VariantValue.cpp.o
51.879 [5700/58/326] Building CXX object tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/HLSLBuiltinTypeDeclBuilder.cpp.o
51.926 [5699/58/327] Building CXX object tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/HLSLExternalSemaSource.cpp.o
52.534 [5698/58/328] Building CXX object tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/MultiplexExternalSemaSource.cpp.o
52.811 [5697/58/329] Building CXX object tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/CheckExprLifetime.cpp.o
53.109 [5696/58/330] Building CXX object tools/clang/lib/CrossTU/CMakeFiles/obj.clangCrossTU.dir/CrossTranslationUnit.cpp.o
53.322 [5695/58/331] Building CXX object tools/flang/tools/flang-driver/CMakeFiles/flang.dir/driver.cpp.o
FAILED: tools/flang/tools/flang-driver/CMakeFiles/flang.dir/driver.cpp.o 
CCACHE_CPP2=yes CCACHE_HASHDIR=yes CCACHE_SLOPPINESS=pch_defines,time_macros /usr/bin/ccache /usr/bin/clang++ -DFLANG_INCLUDE_TESTS=1 -DGTEST_HAS_RTTI=0 -DLLVM_BUILD_STATIC -D_DEBUG -D_GLIBCXX_ASSERTIONS -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/build/buildbot/premerge-monolithic-linux/build/tools/flang/tools/flang-driver -I/build/buildbot/premerge-monolithic-linux/llvm-project/flang/tools/flang-driver -I/build/buildbot/premerge-monolithic-linux/llvm-project/flang/include -I/build/buildbot/premerge-monolithic-linux/build/tools/flang/include -I/build/buildbot/premerge-monolithic-linux/build/include -I/build/buildbot/premerge-monolithic-linux/llvm-project/llvm/include -isystem /build/buildbot/premerge-monolithic-linux/llvm-project/flang/../mlir/include -isystem /build/buildbot/premerge-monolithic-linux/build/tools/mlir/include -isystem /build/buildbot/premerge-monolithic-linux/build/tools/clang/include -isystem /build/buildbot/premerge-monolithic-linux/llvm-project/llvm/../clang/include -gmlt -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wc++98-compat-extra-semi -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -Wmisleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -Wno-deprecated-copy -Wno-string-conversion -Wno-ctad-maybe-unsupported -Wno-unused-command-line-argument -Wstring-conversion           -Wcovered-switch-default -Wno-nested-anon-types -Xclang -fno-pch-timestamp -O3 -DNDEBUG  -fno-exceptions -funwind-tables -fno-rtti -UNDEBUG -std=c++17 -MD -MT tools/flang/tools/flang-driver/CMakeFiles/flang.dir/driver.cpp.o -MF tools/flang/tools/flang-driver/CMakeFiles/flang.dir/driver.cpp.o.d -o tools/flang/tools/flang-driver/CMakeFiles/flang.dir/driver.cpp.o -c /build/buildbot/premerge-monolithic-linux/llvm-project/flang/tools/flang-driver/driver.cpp
/build/buildbot/premerge-monolithic-linux/llvm-project/flang/tools/flang-driver/driver.cpp:127:28: error: no matching constructor for initialization of 'clang::DiagnosticsEngine'
  clang::DiagnosticsEngine diags(diagID, &*diagOpts, diagClient);
                           ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/build/buildbot/premerge-monolithic-linux/llvm-project/llvm/../clang/include/clang/Basic/Diagnostic.h:568:12: note: candidate constructor not viable: no known conversion from 'clang::DiagnosticOptions *' to 'DiagnosticOptions &' for 2nd argument; remove &
  explicit DiagnosticsEngine(IntrusiveRefCntPtr<DiagnosticIDs> Diags,
           ^
/build/buildbot/premerge-monolithic-linux/llvm-project/llvm/../clang/include/clang/Basic/Diagnostic.h:572:3: note: candidate constructor not viable: requires 1 argument, but 3 were provided
  DiagnosticsEngine(const DiagnosticsEngine &) = delete;
  ^
In file included from /build/buildbot/premerge-monolithic-linux/llvm-project/flang/tools/flang-driver/driver.cpp:18:
In file included from /build/buildbot/premerge-monolithic-linux/llvm-project/llvm/../clang/include/clang/Driver/Driver.h:12:
In file included from /build/buildbot/premerge-monolithic-linux/llvm-project/llvm/../clang/include/clang/Basic/Diagnostic.h:17:
In file included from /build/buildbot/premerge-monolithic-linux/llvm-project/llvm/../clang/include/clang/Basic/DiagnosticIDs.h:19:
/build/buildbot/premerge-monolithic-linux/llvm-project/llvm/include/llvm/ADT/IntrusiveRefCntPtr.h:163:37: error: no member named 'Retain' in 'clang::DiagnosticOptions'
  static void retain(T *obj) { obj->Retain(); }
                               ~~~  ^
/build/buildbot/premerge-monolithic-linux/llvm-project/llvm/include/llvm/ADT/IntrusiveRefCntPtr.h:228:34: note: in instantiation of member function 'llvm::IntrusiveRefCntPtrInfo<clang::DiagnosticOptions>::retain' requested here
      IntrusiveRefCntPtrInfo<T>::retain(Obj);
                                 ^
/build/buildbot/premerge-monolithic-linux/llvm-project/llvm/include/llvm/ADT/IntrusiveRefCntPtr.h:180:43: note: in instantiation of member function 'llvm::IntrusiveRefCntPtr<clang::DiagnosticOptions>::retain' requested here
  IntrusiveRefCntPtr(T *obj) : Obj(obj) { retain(); }
                                          ^
/build/buildbot/premerge-monolithic-linux/llvm-project/flang/tools/flang-driver/driver.cpp:118:7: note: in instantiation of member function 'llvm::IntrusiveRefCntPtr<clang::DiagnosticOptions>::IntrusiveRefCntPtr' requested here
      createAndPopulateDiagOpts(args);
      ^
In file included from /build/buildbot/premerge-monolithic-linux/llvm-project/flang/tools/flang-driver/driver.cpp:18:
In file included from /build/buildbot/premerge-monolithic-linux/llvm-project/llvm/../clang/include/clang/Driver/Driver.h:12:
In file included from /build/buildbot/premerge-monolithic-linux/llvm-project/llvm/../clang/include/clang/Basic/Diagnostic.h:17:
In file included from /build/buildbot/premerge-monolithic-linux/llvm-project/llvm/../clang/include/clang/Basic/DiagnosticIDs.h:19:
/build/buildbot/premerge-monolithic-linux/llvm-project/llvm/include/llvm/ADT/IntrusiveRefCntPtr.h:164:38: error: no member named 'Release' in 'clang::DiagnosticOptions'
  static void release(T *obj) { obj->Release(); }
                                ~~~  ^
/build/buildbot/premerge-monolithic-linux/llvm-project/llvm/include/llvm/ADT/IntrusiveRefCntPtr.h:233:34: note: in instantiation of member function 'llvm::IntrusiveRefCntPtrInfo<clang::DiagnosticOptions>::release' requested here
      IntrusiveRefCntPtrInfo<T>::release(Obj);
                                 ^
/build/buildbot/premerge-monolithic-linux/llvm-project/llvm/include/llvm/ADT/IntrusiveRefCntPtr.h:196:27: note: in instantiation of member function 'llvm::IntrusiveRefCntPtr<clang::DiagnosticOptions>::release' requested here
  ~IntrusiveRefCntPtr() { release(); }

@llvm-ci
Copy link
Collaborator

llvm-ci commented May 23, 2025

LLVM Buildbot has detected a new failure on builder ppc64le-flang-rhel-clang running on ppc64le-flang-rhel-test while building clang-tools-extra,clang,lldb at step 5 "build-unified-tree".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/157/builds/28805

Here is the relevant piece of the build log for the reference
Step 5 (build-unified-tree) failure: build (failure)
...
34.802 [577/457/5787] Building CXX object tools/clang/lib/CodeGen/CMakeFiles/obj.clangCodeGen.dir/Targets/SystemZ.cpp.o
34.811 [577/456/5788] Building CXX object tools/clang/lib/AST/CMakeFiles/obj.clangAST.dir/ODRDiagsEmitter.cpp.o
34.839 [577/455/5789] Building CXX object tools/clang/lib/Frontend/CMakeFiles/obj.clangFrontend.dir/CreateInvocationFromCommandLine.cpp.o
34.842 [577/454/5790] Building CXX object tools/clang/lib/AST/CMakeFiles/obj.clangAST.dir/CommentSema.cpp.o
34.911 [577/453/5791] Building CXX object tools/clang/lib/Basic/CMakeFiles/obj.clangBasic.dir/Targets.cpp.o
34.925 [577/452/5792] Building CXX object tools/clang/lib/CodeGen/CMakeFiles/obj.clangCodeGen.dir/Targets/PPC.cpp.o
34.995 [577/451/5793] Building CXX object tools/clang/lib/StaticAnalyzer/Core/CMakeFiles/obj.clangStaticAnalyzerCore.dir/CheckerContext.cpp.o
35.014 [577/450/5794] Building CXX object tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/SemaAVR.cpp.o
35.066 [577/449/5795] Building CXX object tools/clang/lib/StaticAnalyzer/Core/CMakeFiles/obj.clangStaticAnalyzerCore.dir/BugSuppression.cpp.o
35.127 [577/448/5796] Building CXX object tools/clang/tools/clang-fuzzer/handle-cxx/CMakeFiles/obj.clangHandleCXX.dir/handle_cxx.cpp.o
FAILED: tools/clang/tools/clang-fuzzer/handle-cxx/CMakeFiles/obj.clangHandleCXX.dir/handle_cxx.cpp.o 
ccache /home/buildbots/llvm-external-buildbots/clang.19.1.7/bin/clang++ -DCLANG_EXPORTS -DGTEST_HAS_RTTI=0 -D_DEBUG -D_GLIBCXX_ASSERTIONS -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/home/buildbots/llvm-external-buildbots/workers/ppc64le-flang-rhel-test/ppc64le-flang-rhel-clang-build/build/tools/clang/tools/clang-fuzzer/handle-cxx -I/home/buildbots/llvm-external-buildbots/workers/ppc64le-flang-rhel-test/ppc64le-flang-rhel-clang-build/llvm-project/clang/tools/clang-fuzzer/handle-cxx -I/home/buildbots/llvm-external-buildbots/workers/ppc64le-flang-rhel-test/ppc64le-flang-rhel-clang-build/llvm-project/clang/include -I/home/buildbots/llvm-external-buildbots/workers/ppc64le-flang-rhel-test/ppc64le-flang-rhel-clang-build/build/tools/clang/include -I/home/buildbots/llvm-external-buildbots/workers/ppc64le-flang-rhel-test/ppc64le-flang-rhel-clang-build/build/include -I/home/buildbots/llvm-external-buildbots/workers/ppc64le-flang-rhel-test/ppc64le-flang-rhel-clang-build/llvm-project/llvm/include -I/home/buildbots/llvm-external-buildbots/workers/ppc64le-flang-rhel-test/ppc64le-flang-rhel-clang-build/llvm-project/clang/tools/clang-fuzzer/handle-cxx/. -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wc++98-compat-extra-semi -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -Wmisleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -fno-common -Woverloaded-virtual -Wno-nested-anon-types -O3 -DNDEBUG -std=c++17  -fno-exceptions -funwind-tables -fno-rtti -UNDEBUG -MD -MT tools/clang/tools/clang-fuzzer/handle-cxx/CMakeFiles/obj.clangHandleCXX.dir/handle_cxx.cpp.o -MF tools/clang/tools/clang-fuzzer/handle-cxx/CMakeFiles/obj.clangHandleCXX.dir/handle_cxx.cpp.o.d -o tools/clang/tools/clang-fuzzer/handle-cxx/CMakeFiles/obj.clangHandleCXX.dir/handle_cxx.cpp.o -c /home/buildbots/llvm-external-buildbots/workers/ppc64le-flang-rhel-test/ppc64le-flang-rhel-clang-build/llvm-project/clang/tools/clang-fuzzer/handle-cxx/handle_cxx.cpp
/home/buildbots/llvm-external-buildbots/workers/ppc64le-flang-rhel-test/ppc64le-flang-rhel-clang-build/llvm-project/clang/tools/clang-fuzzer/handle-cxx/handle_cxx.cpp:36:21: error: no matching constructor for initialization of 'DiagnosticsEngine'
   36 |   DiagnosticsEngine Diagnostics(
      |                     ^
   37 |       IntrusiveRefCntPtr<clang::DiagnosticIDs>(new DiagnosticIDs()), &*DiagOpts,
      |       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   38 |       &Diags, false);
      |       ~~~~~~~~~~~~~
/home/buildbots/llvm-external-buildbots/workers/ppc64le-flang-rhel-test/ppc64le-flang-rhel-clang-build/llvm-project/clang/include/clang/Basic/Diagnostic.h:568:12: note: candidate constructor not viable: no known conversion from 'clang::DiagnosticOptions *' to 'DiagnosticOptions &' for 2nd argument; remove &
  568 |   explicit DiagnosticsEngine(IntrusiveRefCntPtr<DiagnosticIDs> Diags,
      |            ^
  569 |                              DiagnosticOptions &DiagOpts,
      |                              ~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/buildbots/llvm-external-buildbots/workers/ppc64le-flang-rhel-test/ppc64le-flang-rhel-clang-build/llvm-project/clang/include/clang/Basic/Diagnostic.h:572:3: note: candidate constructor not viable: requires 1 argument, but 4 were provided
  572 |   DiagnosticsEngine(const DiagnosticsEngine &) = delete;
      |   ^                 ~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /home/buildbots/llvm-external-buildbots/workers/ppc64le-flang-rhel-test/ppc64le-flang-rhel-clang-build/llvm-project/clang/tools/clang-fuzzer/handle-cxx/handle_cxx.cpp:15:
In file included from /home/buildbots/llvm-external-buildbots/workers/ppc64le-flang-rhel-test/ppc64le-flang-rhel-clang-build/llvm-project/clang/include/clang/CodeGen/CodeGenAction.h:12:
In file included from /home/buildbots/llvm-external-buildbots/workers/ppc64le-flang-rhel-test/ppc64le-flang-rhel-clang-build/llvm-project/clang/include/clang/Frontend/FrontendAction.h:23:
In file included from /home/buildbots/llvm-external-buildbots/workers/ppc64le-flang-rhel-test/ppc64le-flang-rhel-clang-build/llvm-project/clang/include/clang/Frontend/ASTUnit.h:17:
In file included from /home/buildbots/llvm-external-buildbots/workers/ppc64le-flang-rhel-test/ppc64le-flang-rhel-clang-build/llvm-project/clang/include/clang/AST/ASTContext.h:18:
In file included from /home/buildbots/llvm-external-buildbots/workers/ppc64le-flang-rhel-test/ppc64le-flang-rhel-clang-build/llvm-project/clang/include/clang/AST/CanonicalType.h:17:
In file included from /home/buildbots/llvm-external-buildbots/workers/ppc64le-flang-rhel-test/ppc64le-flang-rhel-clang-build/llvm-project/clang/include/clang/AST/Type.h:21:
In file included from /home/buildbots/llvm-external-buildbots/workers/ppc64le-flang-rhel-test/ppc64le-flang-rhel-clang-build/llvm-project/clang/include/clang/AST/NestedNameSpecifier.h:18:
In file included from /home/buildbots/llvm-external-buildbots/workers/ppc64le-flang-rhel-test/ppc64le-flang-rhel-clang-build/llvm-project/clang/include/clang/Basic/Diagnostic.h:17:
In file included from /home/buildbots/llvm-external-buildbots/workers/ppc64le-flang-rhel-test/ppc64le-flang-rhel-clang-build/llvm-project/clang/include/clang/Basic/DiagnosticIDs.h:19:
/home/buildbots/llvm-external-buildbots/workers/ppc64le-flang-rhel-test/ppc64le-flang-rhel-clang-build/llvm-project/llvm/include/llvm/ADT/IntrusiveRefCntPtr.h:163:37: error: no member named 'Retain' in 'clang::DiagnosticOptions'
  163 |   static void retain(T *obj) { obj->Retain(); }
      |                                ~~~  ^
/home/buildbots/llvm-external-buildbots/workers/ppc64le-flang-rhel-test/ppc64le-flang-rhel-clang-build/llvm-project/llvm/include/llvm/ADT/IntrusiveRefCntPtr.h:228:34: note: in instantiation of member function 'llvm::IntrusiveRefCntPtrInfo<clang::DiagnosticOptions>::retain' requested here
  228 |       IntrusiveRefCntPtrInfo<T>::retain(Obj);
      |                                  ^
/home/buildbots/llvm-external-buildbots/workers/ppc64le-flang-rhel-test/ppc64le-flang-rhel-clang-build/llvm-project/llvm/include/llvm/ADT/IntrusiveRefCntPtr.h:180:43: note: in instantiation of member function 'llvm::IntrusiveRefCntPtr<clang::DiagnosticOptions>::retain' requested here
  180 |   IntrusiveRefCntPtr(T *obj) : Obj(obj) { retain(); }
      |                                           ^
/home/buildbots/llvm-external-buildbots/workers/ppc64le-flang-rhel-test/ppc64le-flang-rhel-clang-build/llvm-project/clang/tools/clang-fuzzer/handle-cxx/handle_cxx.cpp:35:52: note: in instantiation of member function 'llvm::IntrusiveRefCntPtr<clang::DiagnosticOptions>::IntrusiveRefCntPtr' requested here
   35 |   IntrusiveRefCntPtr<DiagnosticOptions> DiagOpts = new DiagnosticOptions();
      |                                                    ^

@llvm-ci
Copy link
Collaborator

llvm-ci commented May 23, 2025

LLVM Buildbot has detected a new failure on builder llvm-x86_64-debian-dylib running on gribozavr4 while building clang-tools-extra,clang,lldb at step 5 "build-unified-tree".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/60/builds/28206

Here is the relevant piece of the build log for the reference
Step 5 (build-unified-tree) failure: build (failure)
...
134.306 [2947/96/4298] Building CXX object tools/clang/tools/extra/clang-tidy/utils/CMakeFiles/obj.clangTidyUtils.dir/Matchers.cpp.o
134.336 [2946/96/4299] Building CXX object tools/clang/tools/extra/clang-tidy/utils/CMakeFiles/obj.clangTidyUtils.dir/ExprSequence.cpp.o
134.477 [2945/96/4300] Building CXX object tools/clang/tools/extra/clang-tidy/utils/CMakeFiles/obj.clangTidyUtils.dir/IncludeSorter.cpp.o
135.822 [2944/96/4301] Building CXX object tools/clang/lib/Analysis/plugins/SampleAnalyzer/CMakeFiles/SampleAnalyzerPlugin.dir/MainCallChecker.cpp.o
135.922 [2943/96/4302] Building CXX object tools/clang/tools/clang-extdef-mapping/CMakeFiles/clang-extdef-mapping.dir/ClangExtDefMapGen.cpp.o
136.682 [2942/96/4303] Building CXX object tools/clang/tools/extra/clang-tidy/zircon/CMakeFiles/obj.clangTidyZirconModule.dir/ZirconTidyModule.cpp.o
136.904 [2941/96/4304] Building CXX object tools/clang/lib/CodeGen/CMakeFiles/obj.clangCodeGen.dir/CGVTT.cpp.o
136.960 [2940/96/4305] Building CXX object tools/clang/lib/ASTMatchers/CMakeFiles/obj.clangASTMatchers.dir/ASTMatchFinder.cpp.o
137.015 [2939/96/4306] Building CXX object tools/clang/lib/CodeGen/CMakeFiles/obj.clangCodeGen.dir/CGExprConstant.cpp.o
137.053 [2938/96/4307] Building CXX object tools/clang/tools/extra/clang-tidy/plugin/CMakeFiles/obj.clangTidyPlugin.dir/ClangTidyPlugin.cpp.o
FAILED: tools/clang/tools/extra/clang-tidy/plugin/CMakeFiles/obj.clangTidyPlugin.dir/ClangTidyPlugin.cpp.o 
CCACHE_CPP2=yes CCACHE_HASHDIR=yes CCACHE_SLOPPINESS=pch_defines,time_macros /usr/bin/ccache /usr/bin/clang++ -DGTEST_HAS_RTTI=0 -D_DEBUG -D_GLIBCXX_ASSERTIONS -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/b/1/llvm-x86_64-debian-dylib/build/tools/clang/tools/extra/clang-tidy/plugin -I/b/1/llvm-x86_64-debian-dylib/llvm-project/clang-tools-extra/clang-tidy/plugin -I/b/1/llvm-x86_64-debian-dylib/build/tools/clang/tools/extra/clang-tidy -I/b/1/llvm-x86_64-debian-dylib/llvm-project/clang/include -I/b/1/llvm-x86_64-debian-dylib/build/tools/clang/include -I/b/1/llvm-x86_64-debian-dylib/build/include -I/b/1/llvm-x86_64-debian-dylib/llvm-project/llvm/include -fPIC -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wc++98-compat-extra-semi -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -Wmisleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -fno-common -Woverloaded-virtual -Wno-nested-anon-types -O3 -DNDEBUG  -fno-exceptions -funwind-tables -fno-rtti -UNDEBUG -std=c++17 -MD -MT tools/clang/tools/extra/clang-tidy/plugin/CMakeFiles/obj.clangTidyPlugin.dir/ClangTidyPlugin.cpp.o -MF tools/clang/tools/extra/clang-tidy/plugin/CMakeFiles/obj.clangTidyPlugin.dir/ClangTidyPlugin.cpp.o.d -o tools/clang/tools/extra/clang-tidy/plugin/CMakeFiles/obj.clangTidyPlugin.dir/ClangTidyPlugin.cpp.o -c /b/1/llvm-x86_64-debian-dylib/llvm-project/clang-tools-extra/clang-tidy/plugin/ClangTidyPlugin.cpp
/b/1/llvm-x86_64-debian-dylib/llvm-project/clang-tools-extra/clang-tidy/plugin/ClangTidyPlugin.cpp:45:51: error: too few arguments to function call, expected 2, have 1
    Context->setDiagnosticsEngine(DiagEngine.get());
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~                 ^
/b/1/llvm-x86_64-debian-dylib/llvm-project/clang-tools-extra/clang-tidy/plugin/../ClangTidyDiagnosticConsumer.h:78:8: note: 'setDiagnosticsEngine' declared here
  void setDiagnosticsEngine(std::unique_ptr<DiagnosticOptions> DiagOpts,
       ^
In file included from /b/1/llvm-x86_64-debian-dylib/llvm-project/clang-tools-extra/clang-tidy/plugin/ClangTidyPlugin.cpp:9:
In file included from /b/1/llvm-x86_64-debian-dylib/llvm-project/clang-tools-extra/clang-tidy/plugin/../ClangTidy.h:12:
In file included from /b/1/llvm-x86_64-debian-dylib/llvm-project/clang-tools-extra/clang-tidy/plugin/../ClangTidyDiagnosticConsumer.h:12:
In file included from /b/1/llvm-x86_64-debian-dylib/llvm-project/clang-tools-extra/clang-tidy/plugin/../ClangTidyOptions.h:12:
In file included from /b/1/llvm-x86_64-debian-dylib/llvm-project/llvm/include/llvm/ADT/IntrusiveRefCntPtr.h:66:
In file included from /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/memory:83:
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/unique_ptr.h:962:34: error: no matching constructor for initialization of 'clang::DiagnosticsEngine'
    { return unique_ptr<_Tp>(new _Tp(std::forward<_Args>(__args)...)); }
                                 ^   ~~~~~~~~~~~~~~~~~~~~~~~~~~~
/b/1/llvm-x86_64-debian-dylib/llvm-project/clang-tools-extra/clang-tidy/plugin/ClangTidyPlugin.cpp:43:28: note: in instantiation of function template specialization 'std::make_unique<clang::DiagnosticsEngine, clang::DiagnosticIDs *, clang::DiagnosticOptions *, clang::tidy::ClangTidyDiagnosticConsumer *&>' requested here
    auto DiagEngine = std::make_unique<DiagnosticsEngine>(
                           ^
/b/1/llvm-x86_64-debian-dylib/llvm-project/clang/include/clang/Basic/Diagnostic.h:568:12: note: candidate constructor not viable: no known conversion from 'clang::DiagnosticOptions *' to 'clang::DiagnosticOptions &' for 2nd argument; dereference the argument with *
  explicit DiagnosticsEngine(IntrusiveRefCntPtr<DiagnosticIDs> Diags,
           ^
/b/1/llvm-x86_64-debian-dylib/llvm-project/clang/include/clang/Basic/Diagnostic.h:572:3: note: candidate constructor not viable: requires 1 argument, but 3 were provided
  DiagnosticsEngine(const DiagnosticsEngine &) = delete;
  ^
2 errors generated.
137.157 [2938/95/4308] Building CXX object tools/clang/lib/AST/CMakeFiles/obj.clangAST.dir/ASTContext.cpp.o
137.359 [2938/94/4309] Building CXX object tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/SemaDeclAttr.cpp.o
137.663 [2938/93/4310] Building CXX object tools/clang/tools/extra/clang-tidy/zircon/CMakeFiles/obj.clangTidyZirconModule.dir/TemporaryObjectsCheck.cpp.o
137.816 [2938/92/4311] Building CXX object tools/clang/lib/CodeGen/CMakeFiles/obj.clangCodeGen.dir/CGException.cpp.o
137.905 [2938/91/4312] Building CXX object tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/SemaChecking.cpp.o
138.004 [2938/90/4313] Building CXX object tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/SemaLookup.cpp.o
138.072 [2938/89/4314] Building CXX object tools/clang/lib/CodeGen/CMakeFiles/obj.clangCodeGen.dir/CGExprAgg.cpp.o
138.171 [2938/88/4315] Building CXX object tools/clang/lib/CodeGen/CMakeFiles/obj.clangCodeGen.dir/CGExprComplex.cpp.o
138.278 [2938/87/4316] Building CXX object tools/clang/lib/CodeGen/CMakeFiles/obj.clangCodeGen.dir/CGExprCXX.cpp.o
138.315 [2938/86/4317] Building CXX object tools/clang/tools/extra/clang-tidy/modernize/CMakeFiles/obj.clangTidyModernizeModule.dir/ConcatNestedNamespacesCheck.cpp.o
139.398 [2938/85/4318] Building CXX object tools/clang/lib/CodeGen/CMakeFiles/obj.clangCodeGen.dir/ConstantInitBuilder.cpp.o
139.817 [2938/84/4319] Building CXX object tools/clang/tools/extra/clang-tidy/google/CMakeFiles/obj.clangTidyGoogleModule.dir/DefaultArgumentsCheck.cpp.o

@llvm-ci
Copy link
Collaborator

llvm-ci commented May 23, 2025

LLVM Buildbot has detected a new failure on builder clang-x86_64-debian-fast running on gribozavr4 while building clang-tools-extra,clang,lldb at step 5 "build-unified-tree".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/56/builds/26567

Here is the relevant piece of the build log for the reference
Step 5 (build-unified-tree) failure: build (failure)
...
             ^~~~~~~~~~~~~~~~
/b/1/clang-x86_64-debian-fast/llvm.src/clang/include/clang/Serialization/ASTReader.h:1829:14: note: did you mean 'NewLoadedModuleFile'?
  /// \param LoadedModuleFile The optional out-parameter refers to the new
             ^~~~~~~~~~~~~~~~
             NewLoadedModuleFile
53 warnings generated.
174.514 [915/96/5272] Building CXX object tools/clang/lib/Format/CMakeFiles/obj.clangFormat.dir/Format.cpp.o
174.589 [914/96/5273] Linking CXX static library lib/libclangFormat.a
175.033 [913/96/5274] Linking CXX executable bin/clang-format
175.215 [912/96/5275] Building CXX object tools/clang/tools/clang-fuzzer/handle-cxx/CMakeFiles/obj.clangHandleCXX.dir/handle_cxx.cpp.o
FAILED: tools/clang/tools/clang-fuzzer/handle-cxx/CMakeFiles/obj.clangHandleCXX.dir/handle_cxx.cpp.o 
CCACHE_CPP2=yes CCACHE_HASHDIR=yes CCACHE_SLOPPINESS=pch_defines,time_macros /usr/bin/ccache /usr/bin/clang++ -DCLANG_EXPORTS -DGTEST_HAS_RTTI=0 -D_DEBUG -D_GLIBCXX_ASSERTIONS -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/b/1/clang-x86_64-debian-fast/llvm.obj/tools/clang/tools/clang-fuzzer/handle-cxx -I/b/1/clang-x86_64-debian-fast/llvm.src/clang/tools/clang-fuzzer/handle-cxx -I/b/1/clang-x86_64-debian-fast/llvm.src/clang/include -I/b/1/clang-x86_64-debian-fast/llvm.obj/tools/clang/include -I/b/1/clang-x86_64-debian-fast/llvm.obj/include -I/b/1/clang-x86_64-debian-fast/llvm.src/llvm/include -I/b/1/clang-x86_64-debian-fast/llvm.src/clang/tools/clang-fuzzer/handle-cxx/. -std=c++11 -Wdocumentation -Wno-documentation-deprecated-sync -fPIC -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wc++98-compat-extra-semi -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -Wmisleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -fno-common -Woverloaded-virtual -Wno-nested-anon-types -O3 -DNDEBUG  -fno-exceptions -funwind-tables -fno-rtti -UNDEBUG -std=c++17 -MD -MT tools/clang/tools/clang-fuzzer/handle-cxx/CMakeFiles/obj.clangHandleCXX.dir/handle_cxx.cpp.o -MF tools/clang/tools/clang-fuzzer/handle-cxx/CMakeFiles/obj.clangHandleCXX.dir/handle_cxx.cpp.o.d -o tools/clang/tools/clang-fuzzer/handle-cxx/CMakeFiles/obj.clangHandleCXX.dir/handle_cxx.cpp.o -c /b/1/clang-x86_64-debian-fast/llvm.src/clang/tools/clang-fuzzer/handle-cxx/handle_cxx.cpp
In file included from /b/1/clang-x86_64-debian-fast/llvm.src/clang/tools/clang-fuzzer/handle-cxx/handle_cxx.cpp:15:
In file included from /b/1/clang-x86_64-debian-fast/llvm.src/clang/include/clang/CodeGen/CodeGenAction.h:12:
In file included from /b/1/clang-x86_64-debian-fast/llvm.src/clang/include/clang/Frontend/FrontendAction.h:23:
In file included from /b/1/clang-x86_64-debian-fast/llvm.src/clang/include/clang/Frontend/ASTUnit.h:17:
In file included from /b/1/clang-x86_64-debian-fast/llvm.src/clang/include/clang/AST/ASTContext.h:21:
In file included from /b/1/clang-x86_64-debian-fast/llvm.src/clang/include/clang/AST/Decl.h:17:
/b/1/clang-x86_64-debian-fast/llvm.src/clang/include/clang/AST/APValue.h:391:14: warning: parameter 'UninitArray' not found in the function declaration [-Wdocumentation]
  /// \param UninitArray Marker. Pass an empty UninitArray.
             ^~~~~~~~~~~
/b/1/clang-x86_64-debian-fast/llvm.src/clang/include/clang/AST/APValue.h:400:14: warning: parameter 'UninitStruct' not found in the function declaration [-Wdocumentation]
  /// \param UninitStruct Marker. Pass an empty UninitStruct.
             ^~~~~~~~~~~~
In file included from /b/1/clang-x86_64-debian-fast/llvm.src/clang/tools/clang-fuzzer/handle-cxx/handle_cxx.cpp:15:
In file included from /b/1/clang-x86_64-debian-fast/llvm.src/clang/include/clang/CodeGen/CodeGenAction.h:12:
In file included from /b/1/clang-x86_64-debian-fast/llvm.src/clang/include/clang/Frontend/FrontendAction.h:23:
In file included from /b/1/clang-x86_64-debian-fast/llvm.src/clang/include/clang/Frontend/ASTUnit.h:17:
In file included from /b/1/clang-x86_64-debian-fast/llvm.src/clang/include/clang/AST/ASTContext.h:21:
In file included from /b/1/clang-x86_64-debian-fast/llvm.src/clang/include/clang/AST/Decl.h:22:
/b/1/clang-x86_64-debian-fast/llvm.src/clang/include/clang/AST/ExternalASTSource.h:165:39: warning: empty paragraph passed to '\param' command [-Wdocumentation]
  /// specializations for the \param D.
                              ~~~~~~~~^
/b/1/clang-x86_64-debian-fast/llvm.src/clang/include/clang/AST/ExternalASTSource.h:165:38: warning: parameter 'D.' not found in the function declaration [-Wdocumentation]
  /// specializations for the \param D.
                                     ^~
/b/1/clang-x86_64-debian-fast/llvm.src/clang/include/clang/AST/ExternalASTSource.h:171:44: warning: empty paragraph passed to '\param' command [-Wdocumentation]
  /// args specified by \param TemplateArgs.
                        ~~~~~~~~~~~~~~~~~~~^
/b/1/clang-x86_64-debian-fast/llvm.src/clang/include/clang/AST/ExternalASTSource.h:171:32: warning: parameter 'TemplateArgs.' not found in the function declaration [-Wdocumentation]
  /// args specified by \param TemplateArgs.
                               ^~~~~~~~~~~~~
/b/1/clang-x86_64-debian-fast/llvm.src/clang/include/clang/AST/ExternalASTSource.h:171:32: note: did you mean 'TemplateArgs'?
  /// args specified by \param TemplateArgs.
                               ^~~~~~~~~~~~~
                               TemplateArgs
In file included from /b/1/clang-x86_64-debian-fast/llvm.src/clang/tools/clang-fuzzer/handle-cxx/handle_cxx.cpp:15:
In file included from /b/1/clang-x86_64-debian-fast/llvm.src/clang/include/clang/CodeGen/CodeGenAction.h:12:
In file included from /b/1/clang-x86_64-debian-fast/llvm.src/clang/include/clang/Frontend/FrontendAction.h:23:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clang:as-a-library libclang and C++ API clang:dataflow Clang Dataflow Analysis framework - https://clang.llvm.org/docs/DataFlowAnalysisIntro.html clang:driver 'clang' and 'clang++' user-facing binaries. Not 'clang-cl' clang:frontend Language frontend issues, e.g. anything involving "Sema" clang:modules C++20 modules and Clang Header Modules clang Clang issues not falling into any other category clang-format clang-tidy clang-tools-extra clangd HLSL HLSL Language Support lldb
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants