Skip to content
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

[NFC] Explicitly pass a VFS when creating DiagnosticsEngine #115852

Merged
merged 3 commits into from
Nov 21, 2024

Conversation

kadircet
Copy link
Member

Starting with 41e3919 DiagnosticsEngine
creation might perform IO. It was implicitly defaulting to
getRealFileSystem. This patch makes it explicit by pushing the decision
making to callers.

It uses ambient VFS if one is available, and keeps using
getRealFileSystem if there aren't any VFS.

Starting with 41e3919 DiagnosticsEngine
creation might perform IO. It was implicitly defaulting to
getRealFileSystem. This patch makes it explicit by pushing the decision
making to callers.

It uses ambient VFS if one is available, and keeps using
`getRealFileSystem` if there aren't any VFS.
@llvmbot llvmbot added clang Clang issues not falling into any other category clang-tools-extra clangd 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:as-a-library libclang and C++ API clang:static analyzer labels Nov 12, 2024
@llvmbot
Copy link
Member

llvmbot commented Nov 12, 2024

@llvm/pr-subscribers-clang-static-analyzer-1
@llvm/pr-subscribers-clang-modules
@llvm/pr-subscribers-clang-tools-extra
@llvm/pr-subscribers-clangd

@llvm/pr-subscribers-clang-driver

Author: kadir çetinkaya (kadircet)

Changes

Starting with 41e3919 DiagnosticsEngine
creation might perform IO. It was implicitly defaulting to
getRealFileSystem. This patch makes it explicit by pushing the decision
making to callers.

It uses ambient VFS if one is available, and keeps using
getRealFileSystem if there aren't any VFS.


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

44 Files Affected:

  • (modified) clang-tools-extra/clang-include-fixer/IncludeFixer.cpp (+2-1)
  • (modified) clang-tools-extra/clangd/Compiler.cpp (+3-3)
  • (modified) clang-tools-extra/clangd/ModulesBuilder.cpp (+2-1)
  • (modified) clang-tools-extra/clangd/Preamble.cpp (+2-2)
  • (modified) clang-tools-extra/include-cleaner/unittests/RecordTest.cpp (+10-9)
  • (modified) clang/include/clang/Frontend/CompilerInstance.h (+10-5)
  • (modified) clang/lib/Frontend/CompilerInstance.cpp (+15-18)
  • (modified) clang/lib/Frontend/CreateInvocationFromCommandLine.cpp (+4-1)
  • (modified) clang/lib/Frontend/Rewrite/FrontendActions.cpp (+1)
  • (modified) clang/lib/Interpreter/Interpreter.cpp (+2-1)
  • (modified) clang/lib/StaticAnalyzer/Frontend/ModelInjector.cpp (+1)
  • (modified) clang/lib/Testing/TestAST.cpp (+17-15)
  • (modified) clang/lib/Tooling/DependencyScanning/DependencyScanningWorker.cpp (+3-2)
  • (modified) clang/lib/Tooling/Tooling.cpp (+6-3)
  • (modified) clang/tools/c-index-test/core_main.cpp (+6-3)
  • (modified) clang/tools/clang-import-test/clang-import-test.cpp (+3-1)
  • (modified) clang/tools/clang-installapi/ClangInstallAPI.cpp (+1-1)
  • (modified) clang/tools/clang-scan-deps/ClangScanDeps.cpp (+5-2)
  • (modified) clang/tools/diagtool/ShowEnabledWarnings.cpp (+3-1)
  • (modified) clang/tools/driver/cc1_main.cpp (+2-1)
  • (modified) clang/tools/libclang/CIndex.cpp (+5-2)
  • (modified) clang/tools/libclang/Indexing.cpp (+5-4)
  • (modified) clang/unittests/AST/ExternalASTSourceTest.cpp (+2-1)
  • (modified) clang/unittests/CodeGen/TestCompiler.h (+2-1)
  • (modified) clang/unittests/Driver/DXCModeTest.cpp (+2-1)
  • (modified) clang/unittests/Driver/ToolChainTest.cpp (+1-1)
  • (modified) clang/unittests/Frontend/ASTUnitTest.cpp (+11-6)
  • (modified) clang/unittests/Frontend/CodeGenActionTest.cpp (+4-3)
  • (modified) clang/unittests/Frontend/CompilerInstanceTest.cpp (+6-3)
  • (modified) clang/unittests/Frontend/CompilerInvocationTest.cpp (+4-3)
  • (modified) clang/unittests/Frontend/FrontendActionTest.cpp (+8-6)
  • (modified) clang/unittests/Frontend/OutputStreamTest.cpp (+4-1)
  • (modified) clang/unittests/Frontend/PCHPreambleTest.cpp (+3-2)
  • (modified) clang/unittests/Frontend/ReparseWorkingDirTest.cpp (+1-1)
  • (modified) clang/unittests/Frontend/UtilsTest.cpp (+3-3)
  • (modified) clang/unittests/Sema/SemaNoloadLookupTest.cpp (+4-3)
  • (modified) clang/unittests/Serialization/ForceCheckFileInputTest.cpp (+9-6)
  • (modified) clang/unittests/Serialization/ModuleCacheTest.cpp (+6-6)
  • (modified) clang/unittests/Serialization/NoCommentsTest.cpp (+3-3)
  • (modified) clang/unittests/Serialization/PreambleInNamedModulesTest.cpp (+2-2)
  • (modified) clang/unittests/Serialization/VarDeclConstantInitTest.cpp (+3-3)
  • (modified) clang/unittests/Support/TimeProfilerTest.cpp (+2-2)
  • (modified) clang/unittests/Tooling/DependencyScanning/DependencyScannerTest.cpp (+2-1)
  • (modified) clang/unittests/Tooling/ToolingTest.cpp (+2-1)
diff --git a/clang-tools-extra/clang-include-fixer/IncludeFixer.cpp b/clang-tools-extra/clang-include-fixer/IncludeFixer.cpp
index 354f35cbadbeb9..bba8f8acc77da9 100644
--- a/clang-tools-extra/clang-include-fixer/IncludeFixer.cpp
+++ b/clang-tools-extra/clang-include-fixer/IncludeFixer.cpp
@@ -95,7 +95,8 @@ bool IncludeFixerActionFactory::runInvocation(
 
   // Create the compiler's actual diagnostics engine. We want to drop all
   // diagnostics here.
-  Compiler.createDiagnostics(new clang::IgnoringDiagConsumer,
+  Compiler.createDiagnostics(Files->getVirtualFileSystem(),
+                             new clang::IgnoringDiagConsumer,
                              /*ShouldOwnClient=*/true);
   Compiler.createSourceManager(*Files);
 
diff --git a/clang-tools-extra/clangd/Compiler.cpp b/clang-tools-extra/clangd/Compiler.cpp
index c60ab8e1b8062a..161cc9ae0ca365 100644
--- a/clang-tools-extra/clangd/Compiler.cpp
+++ b/clang-tools-extra/clangd/Compiler.cpp
@@ -110,8 +110,8 @@ 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(new DiagnosticOptions, &D, false);
+  CIOpts.Diags = CompilerInstance::createDiagnostics(
+      *CIOpts.VFS, new DiagnosticOptions, &D, false);
   CIOpts.ProbePrecompiled = false;
   std::unique_ptr<CompilerInvocation> CI = createInvocation(ArgStrs, CIOpts);
   if (!CI)
@@ -148,7 +148,7 @@ prepareCompilerInstance(std::unique_ptr<clang::CompilerInvocation> CI,
   auto Clang = std::make_unique<CompilerInstance>(
       std::make_shared<PCHContainerOperations>());
   Clang->setInvocation(std::move(CI));
-  Clang->createDiagnostics(&DiagsClient, false);
+  Clang->createDiagnostics(*VFS, &DiagsClient, false);
 
   if (auto VFSWithRemapping = createVFSFromCompilerInvocation(
           Clang->getInvocation(), Clang->getDiagnostics(), VFS))
diff --git a/clang-tools-extra/clangd/ModulesBuilder.cpp b/clang-tools-extra/clangd/ModulesBuilder.cpp
index 2bce3a20825616..29508901f85bba 100644
--- a/clang-tools-extra/clangd/ModulesBuilder.cpp
+++ b/clang-tools-extra/clangd/ModulesBuilder.cpp
@@ -188,7 +188,8 @@ bool IsModuleFileUpToDate(PathRef ModuleFilePath,
 
   clang::clangd::IgnoreDiagnostics IgnoreDiags;
   IntrusiveRefCntPtr<DiagnosticsEngine> Diags =
-      CompilerInstance::createDiagnostics(new DiagnosticOptions, &IgnoreDiags,
+      CompilerInstance::createDiagnostics(*VFS, new DiagnosticOptions,
+                                          &IgnoreDiags,
                                           /*ShouldOwnClient=*/false);
 
   LangOptions LangOpts;
diff --git a/clang-tools-extra/clangd/Preamble.cpp b/clang-tools-extra/clangd/Preamble.cpp
index c14c4d1ba103f8..ce88ec0eb88c1b 100644
--- a/clang-tools-extra/clangd/Preamble.cpp
+++ b/clang-tools-extra/clangd/Preamble.cpp
@@ -613,8 +613,9 @@ buildPreamble(PathRef FileName, CompilerInvocation CI,
         for (const auto &L : ASTListeners)
           L->sawDiagnostic(D, Diag);
       });
+  auto VFS = Inputs.TFS->view(Inputs.CompileCommand.Directory);
   llvm::IntrusiveRefCntPtr<DiagnosticsEngine> PreambleDiagsEngine =
-      CompilerInstance::createDiagnostics(&CI.getDiagnosticOpts(),
+      CompilerInstance::createDiagnostics(*VFS, &CI.getDiagnosticOpts(),
                                           &PreambleDiagnostics,
                                           /*ShouldOwnClient=*/false);
   const Config &Cfg = Config::current();
@@ -651,7 +652,6 @@ buildPreamble(PathRef FileName, CompilerInvocation CI,
         for (const auto &L : ASTListeners)
           L->beforeExecute(CI);
       });
-  auto VFS = Inputs.TFS->view(Inputs.CompileCommand.Directory);
   llvm::SmallString<32> AbsFileName(FileName);
   VFS->makeAbsolute(AbsFileName);
   auto StatCache = std::make_shared<PreambleFileStatusCache>(AbsFileName);
diff --git a/clang-tools-extra/include-cleaner/unittests/RecordTest.cpp b/clang-tools-extra/include-cleaner/unittests/RecordTest.cpp
index b5a7b9720903eb..b1bbb2eb82414c 100644
--- a/clang-tools-extra/include-cleaner/unittests/RecordTest.cpp
+++ b/clang-tools-extra/include-cleaner/unittests/RecordTest.cpp
@@ -609,15 +609,6 @@ TEST_F(PragmaIncludeTest, ExportInUnnamedBuffer) {
   )cpp";
   Inputs.ExtraFiles["foo.h"] = "";
 
-  auto Clang = std::make_unique<CompilerInstance>(
-      std::make_shared<PCHContainerOperations>());
-  Clang->createDiagnostics();
-
-  Clang->setInvocation(std::make_unique<CompilerInvocation>());
-  ASSERT_TRUE(CompilerInvocation::CreateFromArgs(
-      Clang->getInvocation(), {Filename.data()}, Clang->getDiagnostics(),
-      "clang"));
-
   // Create unnamed memory buffers for all the files.
   auto VFS = llvm::makeIntrusiveRefCnt<llvm::vfs::InMemoryFileSystem>();
   VFS->addFile(Filename, /*ModificationTime=*/0,
@@ -626,6 +617,16 @@ TEST_F(PragmaIncludeTest, ExportInUnnamedBuffer) {
     VFS->addFile(Extra.getKey(), /*ModificationTime=*/0,
                  llvm::MemoryBuffer::getMemBufferCopy(Extra.getValue(),
                                                       /*BufferName=*/""));
+
+  auto Clang = std::make_unique<CompilerInstance>(
+      std::make_shared<PCHContainerOperations>());
+  Clang->createDiagnostics(*VFS);
+
+  Clang->setInvocation(std::make_unique<CompilerInvocation>());
+  ASSERT_TRUE(CompilerInvocation::CreateFromArgs(
+      Clang->getInvocation(), {Filename.data()}, Clang->getDiagnostics(),
+      "clang"));
+
   auto *FM = Clang->createFileManager(VFS);
   ASSERT_TRUE(Clang->ExecuteAction(*Inputs.MakeAction()));
   EXPECT_THAT(
diff --git a/clang/include/clang/Frontend/CompilerInstance.h b/clang/include/clang/Frontend/CompilerInstance.h
index 338eb3c6bd028d..1220a4e29471d1 100644
--- a/clang/include/clang/Frontend/CompilerInstance.h
+++ b/clang/include/clang/Frontend/CompilerInstance.h
@@ -675,13 +675,17 @@ class CompilerInstance : public ModuleLoader {
   /// Note that this routine also replaces the diagnostic client,
   /// allocating one if one is not provided.
   ///
+  /// \param VFS is used for any IO needed when creating DiagnosticsEngine. It
+  /// doesn't replace VFS in the CompilerInstance (if any).
+  ///
   /// \param Client If non-NULL, a diagnostic client that will be
   /// attached to (and, then, owned by) the DiagnosticsEngine inside this AST
   /// unit.
   ///
   /// \param ShouldOwnClient If Client is non-NULL, specifies whether
   /// the diagnostic object should take ownership of the client.
-  void createDiagnostics(DiagnosticConsumer *Client = nullptr,
+  void createDiagnostics(llvm::vfs::FileSystem &VFS,
+                         DiagnosticConsumer *Client = nullptr,
                          bool ShouldOwnClient = true);
 
   /// Create a DiagnosticsEngine object with a the TextDiagnosticPrinter.
@@ -702,10 +706,11 @@ class CompilerInstance : public ModuleLoader {
   /// used by some diagnostics printers (for logging purposes only).
   ///
   /// \return The new object on success, or null on failure.
-  static IntrusiveRefCntPtr<DiagnosticsEngine> createDiagnostics(
-      DiagnosticOptions *Opts, DiagnosticConsumer *Client = nullptr,
-      bool ShouldOwnClient = true, const CodeGenOptions *CodeGenOpts = nullptr,
-      IntrusiveRefCntPtr<llvm::vfs::FileSystem> VFS = nullptr);
+  static IntrusiveRefCntPtr<DiagnosticsEngine>
+  createDiagnostics(llvm::vfs::FileSystem &VFS, DiagnosticOptions *Opts,
+                    DiagnosticConsumer *Client = nullptr,
+                    bool ShouldOwnClient = true,
+                    const CodeGenOptions *CodeGenOpts = nullptr);
 
   /// Create the file manager and replace any existing one with it.
   ///
diff --git a/clang/lib/Frontend/CompilerInstance.cpp b/clang/lib/Frontend/CompilerInstance.cpp
index ecc6782c7cb4fb..2569cf1bdf773b 100644
--- a/clang/lib/Frontend/CompilerInstance.cpp
+++ b/clang/lib/Frontend/CompilerInstance.cpp
@@ -332,23 +332,20 @@ static void SetupSerializedDiagnostics(DiagnosticOptions *DiagOpts,
   }
 }
 
-void CompilerInstance::createDiagnostics(DiagnosticConsumer *Client,
+void CompilerInstance::createDiagnostics(llvm::vfs::FileSystem &VFS,
+                                         DiagnosticConsumer *Client,
                                          bool ShouldOwnClient) {
-  Diagnostics = createDiagnostics(
-      &getDiagnosticOpts(), Client, ShouldOwnClient, &getCodeGenOpts(),
-      FileMgr ? FileMgr->getVirtualFileSystemPtr() : nullptr);
+  Diagnostics = createDiagnostics(VFS, &getDiagnosticOpts(), Client,
+                                  ShouldOwnClient, &getCodeGenOpts());
 }
 
 IntrusiveRefCntPtr<DiagnosticsEngine> CompilerInstance::createDiagnostics(
-    DiagnosticOptions *Opts, DiagnosticConsumer *Client, bool ShouldOwnClient,
-    const CodeGenOptions *CodeGenOpts,
-    llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem> VFS) {
+    llvm::vfs::FileSystem &VFS, DiagnosticOptions *Opts,
+    DiagnosticConsumer *Client, bool ShouldOwnClient,
+    const CodeGenOptions *CodeGenOpts) {
   IntrusiveRefCntPtr<DiagnosticIDs> DiagID(new DiagnosticIDs());
-  IntrusiveRefCntPtr<DiagnosticsEngine>
-      Diags(new DiagnosticsEngine(DiagID, Opts));
-
-  if (!VFS)
-    VFS = llvm::vfs::getRealFileSystem();
+  IntrusiveRefCntPtr<DiagnosticsEngine> Diags(
+      new DiagnosticsEngine(DiagID, Opts));
 
   // Create the diagnostic client for reporting errors or for
   // implementing -verify.
@@ -368,11 +365,10 @@ IntrusiveRefCntPtr<DiagnosticsEngine> CompilerInstance::createDiagnostics(
     SetUpDiagnosticLog(Opts, CodeGenOpts, *Diags);
 
   if (!Opts->DiagnosticSerializationFile.empty())
-    SetupSerializedDiagnostics(Opts, *Diags,
-                               Opts->DiagnosticSerializationFile);
+    SetupSerializedDiagnostics(Opts, *Diags, Opts->DiagnosticSerializationFile);
 
   // Configure our handling of diagnostics.
-  ProcessWarningOptions(*Diags, *Opts, *VFS);
+  ProcessWarningOptions(*Diags, *Opts, VFS);
 
   return Diags;
 }
@@ -1240,9 +1236,10 @@ compileModuleImpl(CompilerInstance &ImportingInstance, SourceLocation ImportLoc,
   auto &Inv = *Invocation;
   Instance.setInvocation(std::move(Invocation));
 
-  Instance.createDiagnostics(new ForwardingDiagnosticConsumer(
-                                   ImportingInstance.getDiagnosticClient()),
-                             /*ShouldOwnClient=*/true);
+  Instance.createDiagnostics(
+      ImportingInstance.getVirtualFileSystem(),
+      new ForwardingDiagnosticConsumer(ImportingInstance.getDiagnosticClient()),
+      /*ShouldOwnClient=*/true);
 
   if (llvm::is_contained(DiagOpts.SystemHeaderWarningsModules, ModuleName))
     Instance.getDiagnostics().setSuppressSystemWarnings(false);
diff --git a/clang/lib/Frontend/CreateInvocationFromCommandLine.cpp b/clang/lib/Frontend/CreateInvocationFromCommandLine.cpp
index 638757a2450240..d0b855fff2534c 100644
--- a/clang/lib/Frontend/CreateInvocationFromCommandLine.cpp
+++ b/clang/lib/Frontend/CreateInvocationFromCommandLine.cpp
@@ -22,6 +22,7 @@
 #include "llvm/ADT/STLExtras.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/Option/ArgList.h"
+#include "llvm/Support/VirtualFileSystem.h"
 #include "llvm/TargetParser/Host.h"
 using namespace clang;
 using namespace llvm::opt;
@@ -32,7 +33,9 @@ clang::createInvocation(ArrayRef<const char *> ArgList,
   assert(!ArgList.empty());
   auto Diags = Opts.Diags
                    ? std::move(Opts.Diags)
-                   : CompilerInstance::createDiagnostics(new DiagnosticOptions);
+                   : CompilerInstance::createDiagnostics(
+                         Opts.VFS ? *Opts.VFS : *llvm::vfs::getRealFileSystem(),
+                         new DiagnosticOptions);
 
   SmallVector<const char *, 16> Args(ArgList);
 
diff --git a/clang/lib/Frontend/Rewrite/FrontendActions.cpp b/clang/lib/Frontend/Rewrite/FrontendActions.cpp
index 6e1f949f543a51..5d2e1d78770959 100644
--- a/clang/lib/Frontend/Rewrite/FrontendActions.cpp
+++ b/clang/lib/Frontend/Rewrite/FrontendActions.cpp
@@ -247,6 +247,7 @@ class RewriteIncludesAction::RewriteImportsListener : public ASTReaderListener {
     Instance.setInvocation(
         std::make_shared<CompilerInvocation>(CI.getInvocation()));
     Instance.createDiagnostics(
+        CI.getVirtualFileSystem(),
         new ForwardingDiagnosticConsumer(CI.getDiagnosticClient()),
         /*ShouldOwnClient=*/true);
     Instance.getFrontendOpts().DisableFree = false;
diff --git a/clang/lib/Interpreter/Interpreter.cpp b/clang/lib/Interpreter/Interpreter.cpp
index 8eacbc6b713a19..26b174c36d3dcf 100644
--- a/clang/lib/Interpreter/Interpreter.cpp
+++ b/clang/lib/Interpreter/Interpreter.cpp
@@ -15,6 +15,7 @@
 #include "IncrementalExecutor.h"
 #include "IncrementalParser.h"
 #include "InterpreterUtils.h"
+#include "llvm/Support/VirtualFileSystem.h"
 #ifdef __EMSCRIPTEN__
 #include "Wasm.h"
 #endif // __EMSCRIPTEN__
@@ -104,7 +105,7 @@ CreateCI(const llvm::opt::ArgStringList &Argv) {
         CompilerInvocation::GetResourcesPath(Argv[0], nullptr);
 
   // Create the actual diagnostics engine.
-  Clang->createDiagnostics();
+  Clang->createDiagnostics(*llvm::vfs::getRealFileSystem());
   if (!Clang->hasDiagnostics())
     return llvm::createStringError(llvm::errc::not_supported,
                                    "Initialization failed. "
diff --git a/clang/lib/StaticAnalyzer/Frontend/ModelInjector.cpp b/clang/lib/StaticAnalyzer/Frontend/ModelInjector.cpp
index ae11fbbe32b762..168c73df393ffa 100644
--- a/clang/lib/StaticAnalyzer/Frontend/ModelInjector.cpp
+++ b/clang/lib/StaticAnalyzer/Frontend/ModelInjector.cpp
@@ -78,6 +78,7 @@ void ModelInjector::onBodySynthesis(const NamedDecl *D) {
   CompilerInstance Instance(CI.getPCHContainerOperations());
   Instance.setInvocation(std::move(Invocation));
   Instance.createDiagnostics(
+      CI.getVirtualFileSystem(),
       new ForwardingDiagnosticConsumer(CI.getDiagnosticClient()),
       /*ShouldOwnClient=*/true);
 
diff --git a/clang/lib/Testing/TestAST.cpp b/clang/lib/Testing/TestAST.cpp
index fe8b93851613dd..f7348aa068c51b 100644
--- a/clang/lib/Testing/TestAST.cpp
+++ b/clang/lib/Testing/TestAST.cpp
@@ -55,7 +55,7 @@ class StoreDiagnostics : public DiagnosticConsumer {
 // Provides "empty" ASTContext etc if we fail before parsing gets started.
 void createMissingComponents(CompilerInstance &Clang) {
   if (!Clang.hasDiagnostics())
-    Clang.createDiagnostics();
+    Clang.createDiagnostics(*llvm::vfs::getRealFileSystem());
   if (!Clang.hasFileManager())
     Clang.createFileManager();
   if (!Clang.hasSourceManager())
@@ -82,9 +82,24 @@ TestAST::TestAST(const TestInputs &In) {
   auto RecoverFromEarlyExit =
       llvm::make_scope_exit([&] { createMissingComponents(*Clang); });
 
+  std::string Filename = In.FileName;
+  if (Filename.empty())
+    Filename = getFilenameForTesting(In.Language).str();
+
+  // Set up a VFS with only the virtual file visible.
+  auto VFS = llvm::makeIntrusiveRefCnt<llvm::vfs::InMemoryFileSystem>();
+  if (auto Err = VFS->setCurrentWorkingDirectory(In.WorkingDir))
+    ADD_FAILURE() << "Failed to setWD: " << Err.message();
+  VFS->addFile(Filename, /*ModificationTime=*/0,
+               llvm::MemoryBuffer::getMemBufferCopy(In.Code, Filename));
+  for (const auto &Extra : In.ExtraFiles)
+    VFS->addFile(
+        Extra.getKey(), /*ModificationTime=*/0,
+        llvm::MemoryBuffer::getMemBufferCopy(Extra.getValue(), Extra.getKey()));
+
   // Extra error conditions are reported through diagnostics, set that up first.
   bool ErrorOK = In.ErrorOK || llvm::StringRef(In.Code).contains("error-ok");
-  Clang->createDiagnostics(new StoreDiagnostics(Diagnostics, !ErrorOK));
+  Clang->createDiagnostics(*VFS, new StoreDiagnostics(Diagnostics, !ErrorOK));
 
   // Parse cc1 argv, (typically [-std=c++20 input.cc]) into CompilerInvocation.
   std::vector<const char *> Argv;
@@ -93,9 +108,6 @@ TestAST::TestAST(const TestInputs &In) {
     Argv.push_back(S.c_str());
   for (const auto &S : In.ExtraArgs)
     Argv.push_back(S.c_str());
-  std::string Filename = In.FileName;
-  if (Filename.empty())
-    Filename = getFilenameForTesting(In.Language).str();
   Argv.push_back(Filename.c_str());
   Clang->setInvocation(std::make_unique<CompilerInvocation>());
   if (!CompilerInvocation::CreateFromArgs(Clang->getInvocation(), Argv,
@@ -105,16 +117,6 @@ TestAST::TestAST(const TestInputs &In) {
   }
   assert(!Clang->getInvocation().getFrontendOpts().DisableFree);
 
-  // Set up a VFS with only the virtual file visible.
-  auto VFS = llvm::makeIntrusiveRefCnt<llvm::vfs::InMemoryFileSystem>();
-  if (auto Err = VFS->setCurrentWorkingDirectory(In.WorkingDir))
-    ADD_FAILURE() << "Failed to setWD: " << Err.message();
-  VFS->addFile(Filename, /*ModificationTime=*/0,
-               llvm::MemoryBuffer::getMemBufferCopy(In.Code, Filename));
-  for (const auto &Extra : In.ExtraFiles)
-    VFS->addFile(
-        Extra.getKey(), /*ModificationTime=*/0,
-        llvm::MemoryBuffer::getMemBufferCopy(Extra.getValue(), Extra.getKey()));
   Clang->createFileManager(VFS);
 
   // Running the FrontendAction creates the other components: SourceManager,
diff --git a/clang/lib/Tooling/DependencyScanning/DependencyScanningWorker.cpp b/clang/lib/Tooling/DependencyScanning/DependencyScanningWorker.cpp
index fd1b7af0600da7..5a648df05e4fd3 100644
--- a/clang/lib/Tooling/DependencyScanning/DependencyScanningWorker.cpp
+++ b/clang/lib/Tooling/DependencyScanning/DependencyScanningWorker.cpp
@@ -322,7 +322,8 @@ class DependencyScanningAction : public tooling::ToolAction {
 
     // Create the compiler's actual diagnostics engine.
     sanitizeDiagOpts(ScanInstance.getDiagnosticOpts());
-    ScanInstance.createDiagnostics(DiagConsumer, /*ShouldOwnClient=*/false);
+    ScanInstance.createDiagnostics(DriverFileMgr->getVirtualFileSystem(),
+                                   DiagConsumer, /*ShouldOwnClient=*/false);
     if (!ScanInstance.hasDiagnostics())
       return false;
 
@@ -650,7 +651,7 @@ bool DependencyScanningWorker::computeDependencies(
   auto DiagOpts = CreateAndPopulateDiagOpts(FinalCCommandLine);
   sanitizeDiagOpts(*DiagOpts);
   IntrusiveRefCntPtr<DiagnosticsEngine> Diags =
-      CompilerInstance::createDiagnostics(DiagOpts.release(), &DC,
+      CompilerInstance::createDiagnostics(*FinalFS, DiagOpts.release(), &DC,
                                           /*ShouldOwnClient=*/false);
 
   // Although `Diagnostics` are used only for command-line parsing, the
diff --git a/clang/lib/Tooling/Tooling.cpp b/clang/lib/Tooling/Tooling.cpp
index ffacf9cf1f7829..88b7349ce8fed6 100644
--- a/clang/lib/Tooling/Tooling.cpp
+++ b/clang/lib/Tooling/Tooling.cpp
@@ -387,7 +387,8 @@ bool ToolInvocation::run() {
   TextDiagnosticPrinter DiagnosticPrinter(llvm::errs(), DiagOpts);
   IntrusiveRefCntPtr<DiagnosticsEngine> Diagnostics =
       CompilerInstance::createDiagnostics(
-          &*DiagOpts, DiagConsumer ? DiagConsumer : &DiagnosticPrinter, false);
+          Files->getVirtualFileSystem(), &*DiagOpts,
+          DiagConsumer ? DiagConsumer : &DiagnosticPrinter, false);
   // Although `Diagnostics` are used only for command-line parsing, the custom
   // `DiagConsumer` might expect a `SourceManager` to be present.
   SourceManager SrcMgr(*Diagnostics, *Files);
@@ -456,7 +457,8 @@ bool FrontendActionFactory::runInvocation(
   std::unique_ptr<FrontendAction> ScopedToolAction(create());
 
   // Create the compiler's actual diagnostics engine.
-  Compiler.createDiagnostics(DiagConsumer, /*ShouldOwnClient=*/false);
+  Compiler.createDiagnostics(Files->getVirtualFileSystem(), DiagConsumer,
+                             /*ShouldOwnClient=*/false);
   if (!Compiler.hasDiagnostics())
     return false;
 
@@ -652,7 +654,8 @@ class ASTBuilderAction : public ToolAction {
                      DiagnosticConsumer *DiagConsumer) override {
     std::unique_ptr<ASTUnit> AST = ASTUnit::LoadFromCompilerInvocation(
         Invocation, std::move(PCHContainerOps),
-        CompilerInstance::createDiagnostics(&Invocation->getDiagnosticOpts(),
+        CompilerInstance::createDiagnostics(Files->getVirtualFileSystem(),
+                                            &Invocation->getDiagnosticOpts(),
                                             DiagConsumer,
                                             /*ShouldOwnClient=*/false),
         Files);
diff --git a/clang/tools/c-index-test/core...
[truncated]

Copy link

github-actions bot commented Nov 12, 2024

✅ With the latest revision this PR passed the C/C++ code formatter.

Copy link
Contributor

@ilya-biryukov ilya-biryukov left a comment

Choose a reason for hiding this comment

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

LGTM, but please give others the time to chime in and approve.

Copy link
Contributor

@bricknerb bricknerb left a comment

Choose a reason for hiding this comment

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

Thanks for fixing!
It might be worth understanding whether this should have been caught by some test.
We might want to add a test or a check that would catch this.

clang/lib/Frontend/CompilerInstance.cpp Show resolved Hide resolved
clang/lib/Frontend/CompilerInstance.cpp Outdated Show resolved Hide resolved
@kadircet
Copy link
Member Author

FWIW, I am planning to land this soon if there are no concerns from other maintainers

@kadircet kadircet merged commit bdd10d9 into llvm:main Nov 21, 2024
7 of 10 checks passed
@kadircet kadircet deleted the update_ci_vfs branch November 21, 2024 11:11
@llvm-ci
Copy link
Collaborator

llvm-ci commented Nov 21, 2024

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 at step 4 "build".

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

Here is the relevant piece of the build log for the reference
Step 4 (build) failure: build (failure)

@llvm-ci
Copy link
Collaborator

llvm-ci commented Nov 21, 2024

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 at step 5 "build-unified-tree".

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

Here is the relevant piece of the build log for the reference
Step 5 (build-unified-tree) failure: build (failure)
...
244.189 [120/8/86] Linking CXX shared library lib/libLTO.so.20.0git
244.206 [119/8/87] Creating library symlink lib/libLTO.so
244.881 [118/8/88] Linking CXX executable bin/llvm-profdata
245.180 [117/8/89] Linking CXX static library lib/libclangBasic.a
245.219 [116/8/90] Linking CXX static library lib/liblldbVersion.a
245.621 [115/8/91] Linking CXX executable bin/llvm-lto
245.770 [114/8/92] Linking CXX executable bin/apinotes-test
245.928 [113/8/93] Linking CXX static library lib/libclangFrontend.a
246.467 [112/8/94] Linking CXX executable bin/clang-offload-bundler
246.601 [111/8/95] Building CXX object tools/lldb/source/Commands/CMakeFiles/lldbCommands.dir/CommandObjectTarget.cpp.o
FAILED: tools/lldb/source/Commands/CMakeFiles/lldbCommands.dir/CommandObjectTarget.cpp.o 
/opt/ccache/bin/g++ -DGTEST_HAS_RTTI=0 -DHAVE_ROUND -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/lldb/source/Commands -I/home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu-dwarf5/llvm-project/lldb/source/Commands -I/home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu-dwarf5/llvm-project/lldb/include -I/home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu-dwarf5/build/tools/lldb/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/usr/include/python3.10 -I/home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu-dwarf5/llvm-project/llvm/../clang/include -I/home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu-dwarf5/build/tools/lldb/../clang/include -I/home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu-dwarf5/llvm-project/lldb/source -I/home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu-dwarf5/build/tools/lldb/source -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -fno-lifetime-dse -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 -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -Wno-misleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -Wno-unknown-pragmas -Wno-strict-aliasing -Wno-stringop-truncation -O3 -DNDEBUG  -fno-exceptions -funwind-tables -fno-rtti -UNDEBUG -std=c++17 -MD -MT tools/lldb/source/Commands/CMakeFiles/lldbCommands.dir/CommandObjectTarget.cpp.o -MF tools/lldb/source/Commands/CMakeFiles/lldbCommands.dir/CommandObjectTarget.cpp.o.d -o tools/lldb/source/Commands/CMakeFiles/lldbCommands.dir/CommandObjectTarget.cpp.o -c /home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu-dwarf5/llvm-project/lldb/source/Commands/CommandObjectTarget.cpp
/home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu-dwarf5/llvm-project/lldb/source/Commands/CommandObjectTarget.cpp: In member function ‘virtual void CommandObjectTargetModulesDumpClangPCMInfo::DoExecute(lldb_private::Args&, lldb_private::CommandReturnObject&)’:
/home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu-dwarf5/llvm-project/lldb/source/Commands/CommandObjectTarget.cpp:2203:31: error: no matching function for call to ‘clang::CompilerInstance::createDiagnostics()’
 2203 |     compiler.createDiagnostics();
      |     ~~~~~~~~~~~~~~~~~~~~~~~~~~^~
In file included from /home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu-dwarf5/llvm-project/lldb/source/Commands/CommandObjectTarget.cpp:62:
/home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu-dwarf5/llvm-project/llvm/../clang/include/clang/Frontend/CompilerInstance.h:687:8: note: candidate: ‘void clang::CompilerInstance::createDiagnostics(llvm::vfs::FileSystem&, clang::DiagnosticConsumer*, bool)’
  687 |   void createDiagnostics(llvm::vfs::FileSystem &VFS,
      |        ^~~~~~~~~~~~~~~~~
/home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu-dwarf5/llvm-project/llvm/../clang/include/clang/Frontend/CompilerInstance.h:687:8: note:   candidate expects 3 arguments, 0 provided
/home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu-dwarf5/llvm-project/llvm/../clang/include/clang/Frontend/CompilerInstance.h:710:3: note: candidate: ‘static llvm::IntrusiveRefCntPtr<clang::DiagnosticsEngine> clang::CompilerInstance::createDiagnostics(llvm::vfs::FileSystem&, clang::DiagnosticOptions*, clang::DiagnosticConsumer*, bool, const clang::CodeGenOptions*)’
  710 |   createDiagnostics(llvm::vfs::FileSystem &VFS, DiagnosticOptions *Opts,
      |   ^~~~~~~~~~~~~~~~~
/home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu-dwarf5/llvm-project/llvm/../clang/include/clang/Frontend/CompilerInstance.h:710:3: note:   candidate expects 5 arguments, 0 provided
246.969 [111/7/96] Linking CXX static library lib/libclangCodeGen.a
248.793 [111/6/97] Linking CXX executable bin/clang-nvlink-wrapper
252.225 [111/5/98] Building CXX object tools/clang/tools/libclang/CMakeFiles/libclang.dir/CIndex.cpp.o
255.527 [111/4/99] Building CXX object tools/lldb/source/Plugins/ExpressionParser/Clang/CMakeFiles/lldbPluginExpressionParserClang.dir/ClangFunctionCaller.cpp.o
258.176 [111/3/100] Building CXX object tools/lldb/source/Plugins/ExpressionParser/Clang/CMakeFiles/lldbPluginExpressionParserClang.dir/ClangExpressionParser.cpp.o
FAILED: tools/lldb/source/Plugins/ExpressionParser/Clang/CMakeFiles/lldbPluginExpressionParserClang.dir/ClangExpressionParser.cpp.o 
/opt/ccache/bin/g++ -DGTEST_HAS_RTTI=0 -DHAVE_ROUND -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/lldb/source/Plugins/ExpressionParser/Clang -I/home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu-dwarf5/llvm-project/lldb/source/Plugins/ExpressionParser/Clang -I/home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu-dwarf5/llvm-project/lldb/include -I/home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu-dwarf5/build/tools/lldb/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/usr/include/python3.10 -I/home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu-dwarf5/llvm-project/llvm/../clang/include -I/home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu-dwarf5/build/tools/lldb/../clang/include -I/home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu-dwarf5/llvm-project/lldb/source -I/home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu-dwarf5/build/tools/lldb/source -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -fno-lifetime-dse -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 -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -Wno-misleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -Wno-unknown-pragmas -Wno-strict-aliasing -Wno-stringop-truncation -O3 -DNDEBUG  -fno-exceptions -funwind-tables -fno-rtti -UNDEBUG -std=c++17 -MD -MT tools/lldb/source/Plugins/ExpressionParser/Clang/CMakeFiles/lldbPluginExpressionParserClang.dir/ClangExpressionParser.cpp.o -MF tools/lldb/source/Plugins/ExpressionParser/Clang/CMakeFiles/lldbPluginExpressionParserClang.dir/ClangExpressionParser.cpp.o.d -o tools/lldb/source/Plugins/ExpressionParser/Clang/CMakeFiles/lldbPluginExpressionParserClang.dir/ClangExpressionParser.cpp.o -c /home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu-dwarf5/llvm-project/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
/home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu-dwarf5/llvm-project/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp: In constructor ‘lldb_private::ClangExpressionParser::ClangExpressionParser(lldb_private::ExecutionContextScope*, lldb_private::Expression&, bool, std::vector<std::__cxx11::basic_string<char> >, std::string)’:
/home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu-dwarf5/llvm-project/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp:783:32: error: no matching function for call to ‘clang::CompilerInstance::createDiagnostics()’
  783 |   m_compiler->createDiagnostics();
      |   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~
In file included from /home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu-dwarf5/llvm-project/llvm/../clang/include/clang/Frontend/FrontendAction.h:24,
                 from /home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu-dwarf5/llvm-project/llvm/../clang/include/clang/CodeGen/CodeGenAction.h:12,
                 from /home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu-dwarf5/llvm-project/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp:19:
/home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu-dwarf5/llvm-project/llvm/../clang/include/clang/Frontend/CompilerInstance.h:687:8: note: candidate: ‘void clang::CompilerInstance::createDiagnostics(llvm::vfs::FileSystem&, clang::DiagnosticConsumer*, bool)’
  687 |   void createDiagnostics(llvm::vfs::FileSystem &VFS,
      |        ^~~~~~~~~~~~~~~~~
/home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu-dwarf5/llvm-project/llvm/../clang/include/clang/Frontend/CompilerInstance.h:687:8: note:   candidate expects 3 arguments, 0 provided
/home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu-dwarf5/llvm-project/llvm/../clang/include/clang/Frontend/CompilerInstance.h:710:3: note: candidate: ‘static llvm::IntrusiveRefCntPtr<clang::DiagnosticsEngine> clang::CompilerInstance::createDiagnostics(llvm::vfs::FileSystem&, clang::DiagnosticOptions*, clang::DiagnosticConsumer*, bool, const clang::CodeGenOptions*)’
  710 |   createDiagnostics(llvm::vfs::FileSystem &VFS, DiagnosticOptions *Opts,
      |   ^~~~~~~~~~~~~~~~~
/home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu-dwarf5/llvm-project/llvm/../clang/include/clang/Frontend/CompilerInstance.h:710:3: note:   candidate expects 5 arguments, 0 provided
259.469 [111/2/101] Building CXX object tools/lldb/source/Plugins/ExpressionParser/Clang/CMakeFiles/lldbPluginExpressionParserClang.dir/ClangModulesDeclVendor.cpp.o
FAILED: tools/lldb/source/Plugins/ExpressionParser/Clang/CMakeFiles/lldbPluginExpressionParserClang.dir/ClangModulesDeclVendor.cpp.o 

@llvm-ci
Copy link
Collaborator

llvm-ci commented Nov 21, 2024

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 at step 5 "build-unified-tree".

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

Here is the relevant piece of the build log for the reference
Step 5 (build-unified-tree) failure: build (failure)
...
277.254 [120/8/86] Creating library symlink lib/libLTO.so
277.993 [119/8/87] Linking CXX executable bin/llvm-profdata
278.283 [118/8/88] Linking CXX static library lib/libclangBasic.a
278.298 [117/8/89] Linking CXX static library lib/liblldbVersion.a
278.486 [116/8/90] Linking CXX static library lib/libclangFrontend.a
278.548 [115/8/91] Linking CXX static library lib/libclangInstallAPI.a
279.170 [114/8/92] Linking CXX static library lib/libclangCodeGen.a
279.222 [113/8/93] Linking CXX static library lib/libclangRewriteFrontend.a
279.314 [112/8/94] Linking CXX static library lib/libclangTooling.a
279.326 [111/8/95] Building CXX object tools/lldb/source/Commands/CMakeFiles/lldbCommands.dir/CommandObjectTarget.cpp.o
FAILED: tools/lldb/source/Commands/CMakeFiles/lldbCommands.dir/CommandObjectTarget.cpp.o 
/opt/ccache/bin/g++ -DGTEST_HAS_RTTI=0 -DHAVE_ROUND -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/lldb/source/Commands -I/home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu/llvm-project/lldb/source/Commands -I/home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu/llvm-project/lldb/include -I/home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu/build/tools/lldb/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/usr/include/python3.8 -I/home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu/llvm-project/llvm/../clang/include -I/home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu/build/tools/lldb/../clang/include -I/home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu/llvm-project/lldb/source -I/home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu/build/tools/lldb/source -isystem /usr/include/libxml2 -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -fno-lifetime-dse -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 -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -Wno-misleading-indentation -fdiagnostics-color -ffunction-sections -fdata-sections -Wno-unknown-pragmas -Wno-strict-aliasing -Wno-stringop-truncation -O3 -DNDEBUG  -fno-exceptions -funwind-tables -fno-rtti -UNDEBUG -std=c++17 -MD -MT tools/lldb/source/Commands/CMakeFiles/lldbCommands.dir/CommandObjectTarget.cpp.o -MF tools/lldb/source/Commands/CMakeFiles/lldbCommands.dir/CommandObjectTarget.cpp.o.d -o tools/lldb/source/Commands/CMakeFiles/lldbCommands.dir/CommandObjectTarget.cpp.o -c /home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu/llvm-project/lldb/source/Commands/CommandObjectTarget.cpp
/home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu/llvm-project/lldb/source/Commands/CommandObjectTarget.cpp: In member function ‘virtual void CommandObjectTargetModulesDumpClangPCMInfo::DoExecute(lldb_private::Args&, lldb_private::CommandReturnObject&)’:
/home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu/llvm-project/lldb/source/Commands/CommandObjectTarget.cpp:2203:32: error: no matching function for call to ‘clang::CompilerInstance::createDiagnostics()’
 2203 |     compiler.createDiagnostics();
      |                                ^
In file included from /home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu/llvm-project/lldb/source/Commands/CommandObjectTarget.cpp:62:
/home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu/llvm-project/llvm/../clang/include/clang/Frontend/CompilerInstance.h:687:8: note: candidate: ‘void clang::CompilerInstance::createDiagnostics(llvm::vfs::FileSystem&, clang::DiagnosticConsumer*, bool)’
  687 |   void createDiagnostics(llvm::vfs::FileSystem &VFS,
      |        ^~~~~~~~~~~~~~~~~
/home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu/llvm-project/llvm/../clang/include/clang/Frontend/CompilerInstance.h:687:8: note:   candidate expects 3 arguments, 0 provided
/home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu/llvm-project/llvm/../clang/include/clang/Frontend/CompilerInstance.h:710:3: note: candidate: ‘static llvm::IntrusiveRefCntPtr<clang::DiagnosticsEngine> clang::CompilerInstance::createDiagnostics(llvm::vfs::FileSystem&, clang::DiagnosticOptions*, clang::DiagnosticConsumer*, bool, const clang::CodeGenOptions*)’
  710 |   createDiagnostics(llvm::vfs::FileSystem &VFS, DiagnosticOptions *Opts,
      |   ^~~~~~~~~~~~~~~~~
/home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu/llvm-project/llvm/../clang/include/clang/Frontend/CompilerInstance.h:710:3: note:   candidate expects 5 arguments, 0 provided
279.376 [111/7/96] Linking CXX static library lib/libclangIndex.a
280.628 [111/6/97] Linking CXX executable bin/llvm-lto
284.419 [111/5/98] Building CXX object tools/clang/tools/libclang/CMakeFiles/libclang.dir/CIndex.cpp.o
290.459 [111/4/99] Building CXX object tools/lldb/source/Plugins/ExpressionParser/Clang/CMakeFiles/lldbPluginExpressionParserClang.dir/ClangFunctionCaller.cpp.o
294.283 [111/3/100] Building CXX object tools/lldb/source/Plugins/ExpressionParser/Clang/CMakeFiles/lldbPluginExpressionParserClang.dir/ClangExpressionParser.cpp.o
FAILED: tools/lldb/source/Plugins/ExpressionParser/Clang/CMakeFiles/lldbPluginExpressionParserClang.dir/ClangExpressionParser.cpp.o 
/opt/ccache/bin/g++ -DGTEST_HAS_RTTI=0 -DHAVE_ROUND -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/lldb/source/Plugins/ExpressionParser/Clang -I/home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu/llvm-project/lldb/source/Plugins/ExpressionParser/Clang -I/home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu/llvm-project/lldb/include -I/home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu/build/tools/lldb/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/usr/include/python3.8 -I/home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu/llvm-project/llvm/../clang/include -I/home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu/build/tools/lldb/../clang/include -I/home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu/llvm-project/lldb/source -I/home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu/build/tools/lldb/source -isystem /usr/include/libxml2 -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -fno-lifetime-dse -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 -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -Wno-misleading-indentation -fdiagnostics-color -ffunction-sections -fdata-sections -Wno-unknown-pragmas -Wno-strict-aliasing -Wno-stringop-truncation -O3 -DNDEBUG  -fno-exceptions -funwind-tables -fno-rtti -UNDEBUG -std=c++17 -MD -MT tools/lldb/source/Plugins/ExpressionParser/Clang/CMakeFiles/lldbPluginExpressionParserClang.dir/ClangExpressionParser.cpp.o -MF tools/lldb/source/Plugins/ExpressionParser/Clang/CMakeFiles/lldbPluginExpressionParserClang.dir/ClangExpressionParser.cpp.o.d -o tools/lldb/source/Plugins/ExpressionParser/Clang/CMakeFiles/lldbPluginExpressionParserClang.dir/ClangExpressionParser.cpp.o -c /home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu/llvm-project/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
/home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu/llvm-project/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp: In constructor ‘lldb_private::ClangExpressionParser::ClangExpressionParser(lldb_private::ExecutionContextScope*, lldb_private::Expression&, bool, std::vector<std::__cxx11::basic_string<char> >, std::string)’:
/home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu/llvm-project/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp:783:33: error: no matching function for call to ‘clang::CompilerInstance::createDiagnostics()’
  783 |   m_compiler->createDiagnostics();
      |                                 ^
In file included from /home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu/llvm-project/llvm/../clang/include/clang/Frontend/FrontendAction.h:24,
                 from /home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu/llvm-project/llvm/../clang/include/clang/CodeGen/CodeGenAction.h:12,
                 from /home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu/llvm-project/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp:19:
/home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu/llvm-project/llvm/../clang/include/clang/Frontend/CompilerInstance.h:687:8: note: candidate: ‘void clang::CompilerInstance::createDiagnostics(llvm::vfs::FileSystem&, clang::DiagnosticConsumer*, bool)’
  687 |   void createDiagnostics(llvm::vfs::FileSystem &VFS,
      |        ^~~~~~~~~~~~~~~~~
/home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu/llvm-project/llvm/../clang/include/clang/Frontend/CompilerInstance.h:687:8: note:   candidate expects 3 arguments, 0 provided
/home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu/llvm-project/llvm/../clang/include/clang/Frontend/CompilerInstance.h:710:3: note: candidate: ‘static llvm::IntrusiveRefCntPtr<clang::DiagnosticsEngine> clang::CompilerInstance::createDiagnostics(llvm::vfs::FileSystem&, clang::DiagnosticOptions*, clang::DiagnosticConsumer*, bool, const clang::CodeGenOptions*)’
  710 |   createDiagnostics(llvm::vfs::FileSystem &VFS, DiagnosticOptions *Opts,
      |   ^~~~~~~~~~~~~~~~~
/home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu/llvm-project/llvm/../clang/include/clang/Frontend/CompilerInstance.h:710:3: note:   candidate expects 5 arguments, 0 provided
297.236 [111/2/101] Building CXX object tools/lldb/source/Plugins/ExpressionParser/Clang/CMakeFiles/lldbPluginExpressionParserClang.dir/ClangModulesDeclVendor.cpp.o
FAILED: tools/lldb/source/Plugins/ExpressionParser/Clang/CMakeFiles/lldbPluginExpressionParserClang.dir/ClangModulesDeclVendor.cpp.o 

@llvm-ci
Copy link
Collaborator

llvm-ci commented Nov 21, 2024

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

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

Here is the relevant piece of the build log for the reference
Step 4 (build) failure: build (failure)
...
67.517 [168/28/6185] Building CXX object tools/clang/lib/Frontend/CMakeFiles/obj.clangFrontend.dir/FrontendActions.cpp.o
67.740 [168/27/6186] Linking CXX executable bin/llvm-gsymutil
68.281 [168/26/6187] Linking CXX executable bin/llvm-lto2
68.656 [168/25/6188] Linking CXX executable bin/opt
71.829 [168/24/6189] Building CXX object tools/clang/lib/Interpreter/CMakeFiles/obj.clangInterpreter.dir/Interpreter.cpp.o
77.005 [168/23/6190] Building CXX object tools/clang/lib/CodeGen/CMakeFiles/obj.clangCodeGen.dir/BackendUtil.cpp.o
77.573 [168/22/6191] Building CXX object tools/clang/lib/Tooling/Refactoring/CMakeFiles/obj.clangToolingRefactoring.dir/Rename/USRFindingAction.cpp.o
79.609 [168/21/6192] Building CXX object tools/clang/lib/CodeGen/CMakeFiles/obj.clangCodeGen.dir/ObjectFilePCHContainerWriter.cpp.o
81.365 [168/20/6193] Building CXX object tools/clang/tools/clang-installapi/CMakeFiles/clang-installapi.dir/ClangInstallAPI.cpp.o
81.758 [168/19/6194] Building CXX object tools/lldb/source/Commands/CMakeFiles/lldbCommands.dir/CommandObjectTarget.cpp.o
FAILED: tools/lldb/source/Commands/CMakeFiles/lldbCommands.dir/CommandObjectTarget.cpp.o 
/usr/local/bin/c++ -DGTEST_HAS_RTTI=0 -DHAVE_ROUND -D_DEBUG -D_FILE_OFFSET_BITS=64 -D_GLIBCXX_ASSERTIONS -D_GNU_SOURCE -D_LARGEFILE_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/tools/lldb/source/Commands -I/home/tcwg-buildbot/worker/lldb-arm-ubuntu/llvm-project/lldb/source/Commands -I/home/tcwg-buildbot/worker/lldb-arm-ubuntu/llvm-project/lldb/include -I/home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/tools/lldb/include -I/home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/include -I/home/tcwg-buildbot/worker/lldb-arm-ubuntu/llvm-project/llvm/include -I/usr/include/python3.10 -I/home/tcwg-buildbot/worker/lldb-arm-ubuntu/llvm-project/llvm/../clang/include -I/home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/tools/lldb/../clang/include -I/home/tcwg-buildbot/worker/lldb-arm-ubuntu/llvm-project/lldb/source -I/home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/tools/lldb/source -isystem /usr/include/libxml2 -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-unknown-pragmas -Wno-strict-aliasing -Wno-vla-extension -O3 -DNDEBUG -std=c++17  -fno-exceptions -funwind-tables -fno-rtti -UNDEBUG -MD -MT tools/lldb/source/Commands/CMakeFiles/lldbCommands.dir/CommandObjectTarget.cpp.o -MF tools/lldb/source/Commands/CMakeFiles/lldbCommands.dir/CommandObjectTarget.cpp.o.d -o tools/lldb/source/Commands/CMakeFiles/lldbCommands.dir/CommandObjectTarget.cpp.o -c /home/tcwg-buildbot/worker/lldb-arm-ubuntu/llvm-project/lldb/source/Commands/CommandObjectTarget.cpp
../llvm-project/lldb/source/Commands/CommandObjectTarget.cpp:2203:14: error: no matching member function for call to 'createDiagnostics'
 2203 |     compiler.createDiagnostics();
      |     ~~~~~~~~~^~~~~~~~~~~~~~~~~
../llvm-project/clang/include/clang/Frontend/CompilerInstance.h:687:8: note: candidate function not viable: requires at least argument 'VFS', but no arguments were provided
  687 |   void createDiagnostics(llvm::vfs::FileSystem &VFS,
      |        ^                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~
  688 |                          DiagnosticConsumer *Client = nullptr,
      |                          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  689 |                          bool ShouldOwnClient = true);
      |                          ~~~~~~~~~~~~~~~~~~~~~~~~~~~
../llvm-project/clang/include/clang/Frontend/CompilerInstance.h:710:3: note: candidate function not viable: requires at least 2 arguments, but 0 were provided
  710 |   createDiagnostics(llvm::vfs::FileSystem &VFS, DiagnosticOptions *Opts,
      |   ^                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  711 |                     DiagnosticConsumer *Client = nullptr,
      |                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  712 |                     bool ShouldOwnClient = true,
      |                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  713 |                     const CodeGenOptions *CodeGenOpts = nullptr);
      |                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
83.145 [168/18/6195] Building CXX object tools/clang/lib/InstallAPI/CMakeFiles/obj.clangInstallAPI.dir/Visitor.cpp.o
85.450 [168/17/6196] Building CXX object tools/lldb/source/Plugins/ExpressionParser/Clang/CMakeFiles/lldbPluginExpressionParserClang.dir/ClangModulesDeclVendor.cpp.o
FAILED: tools/lldb/source/Plugins/ExpressionParser/Clang/CMakeFiles/lldbPluginExpressionParserClang.dir/ClangModulesDeclVendor.cpp.o 
/usr/local/bin/c++ -DGTEST_HAS_RTTI=0 -DHAVE_ROUND -D_DEBUG -D_FILE_OFFSET_BITS=64 -D_GLIBCXX_ASSERTIONS -D_GNU_SOURCE -D_LARGEFILE_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/tools/lldb/source/Plugins/ExpressionParser/Clang -I/home/tcwg-buildbot/worker/lldb-arm-ubuntu/llvm-project/lldb/source/Plugins/ExpressionParser/Clang -I/home/tcwg-buildbot/worker/lldb-arm-ubuntu/llvm-project/lldb/include -I/home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/tools/lldb/include -I/home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/include -I/home/tcwg-buildbot/worker/lldb-arm-ubuntu/llvm-project/llvm/include -I/usr/include/python3.10 -I/home/tcwg-buildbot/worker/lldb-arm-ubuntu/llvm-project/llvm/../clang/include -I/home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/tools/lldb/../clang/include -I/home/tcwg-buildbot/worker/lldb-arm-ubuntu/llvm-project/lldb/source -I/home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/tools/lldb/source -isystem /usr/include/libxml2 -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-unknown-pragmas -Wno-strict-aliasing -Wno-vla-extension -O3 -DNDEBUG -std=c++17  -fno-exceptions -funwind-tables -fno-rtti -UNDEBUG -MD -MT tools/lldb/source/Plugins/ExpressionParser/Clang/CMakeFiles/lldbPluginExpressionParserClang.dir/ClangModulesDeclVendor.cpp.o -MF tools/lldb/source/Plugins/ExpressionParser/Clang/CMakeFiles/lldbPluginExpressionParserClang.dir/ClangModulesDeclVendor.cpp.o.d -o tools/lldb/source/Plugins/ExpressionParser/Clang/CMakeFiles/lldbPluginExpressionParserClang.dir/ClangModulesDeclVendor.cpp.o -c /home/tcwg-buildbot/worker/lldb-arm-ubuntu/llvm-project/lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp
../llvm-project/lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp:709:7: error: no matching function for call to 'createDiagnostics'
  709 |       clang::CompilerInstance::createDiagnostics(diag_options_up.release(),
      |       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../llvm-project/clang/include/clang/Frontend/CompilerInstance.h:687:8: note: candidate function not viable: no known conversion from 'pointer' (aka 'clang::DiagnosticOptions *') to 'llvm::vfs::FileSystem &' for 1st argument
  687 |   void createDiagnostics(llvm::vfs::FileSystem &VFS,
      |        ^                 ~~~~~~~~~~~~~~~~~~~~~~~~~~
../llvm-project/clang/include/clang/Frontend/CompilerInstance.h:710:3: note: candidate function not viable: no known conversion from 'pointer' (aka 'clang::DiagnosticOptions *') to 'llvm::vfs::FileSystem &' for 1st argument
  710 |   createDiagnostics(llvm::vfs::FileSystem &VFS, DiagnosticOptions *Opts,
      |   ^                 ~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
85.905 [168/16/6197] Building CXX object tools/lldb/source/Plugins/ExpressionParser/Clang/CMakeFiles/lldbPluginExpressionParserClang.dir/ClangFunctionCaller.cpp.o
88.204 [168/15/6198] Building CXX object tools/clang/tools/clang-check/CMakeFiles/clang-check.dir/ClangCheck.cpp.o
88.443 [168/14/6199] Building CXX object tools/clang/tools/driver/CMakeFiles/clang.dir/cc1_main.cpp.o

@llvm-ci
Copy link
Collaborator

llvm-ci commented Nov 21, 2024

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

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

Here is the relevant piece of the build log for the reference
Step 4 (build) failure: build (failure)
...
431.158 [1335/10/5036] Building CXX object tools/lldb/source/Commands/CMakeFiles/lldbCommands.dir/CommandObjectVersion.cpp.o
431.159 [1335/9/5037] Building CXX object tools/lldb/source/Commands/CMakeFiles/lldbCommands.dir/CommandObjectType.cpp.o
431.167 [1335/8/5038] Building CXX object tools/lldb/source/Core/CMakeFiles/lldbCore.dir/AddressRange.cpp.o
431.167 [1335/7/5039] Building CXX object tools/lldb/source/Commands/CMakeFiles/lldbCommands.dir/CommandOptionsProcessAttach.cpp.o
431.167 [1335/6/5040] Building CXX object tools/lldb/source/Core/CMakeFiles/lldbCore.dir/AddressRangeListImpl.cpp.o
431.170 [1335/5/5041] Building CXX object tools/lldb/source/Commands/CMakeFiles/lldbCommands.dir/CommandOptionArgumentTable.cpp.o
431.173 [1335/4/5042] Building CXX object tools/lldb/source/Core/CMakeFiles/lldbCore.dir/Address.cpp.o
431.181 [1335/3/5043] Building CXX object tools/lldb/source/Core/CMakeFiles/lldbCore.dir/AddressResolver.cpp.o
431.182 [1335/2/5044] Building CXX object tools/lldb/source/Commands/CMakeFiles/lldbCommands.dir/CommandOptionsProcessLaunch.cpp.o
440.696 [1335/1/5045] Building CXX object tools/lldb/source/Commands/CMakeFiles/lldbCommands.dir/CommandObjectTarget.cpp.o
FAILED: tools/lldb/source/Commands/CMakeFiles/lldbCommands.dir/CommandObjectTarget.cpp.o 
/usr/local/bin/c++ -DGTEST_HAS_RTTI=0 -DHAVE_ROUND -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/lldb-aarch64-ubuntu/build/tools/lldb/source/Commands -I/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/llvm-project/lldb/source/Commands -I/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/llvm-project/lldb/include -I/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/tools/lldb/include -I/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/include -I/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/llvm-project/llvm/include -I/usr/include/python3.10 -I/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/llvm-project/llvm/../clang/include -I/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/tools/lldb/../clang/include -I/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/llvm-project/lldb/source -I/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/tools/lldb/source -isystem /usr/include/libxml2 -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-unknown-pragmas -Wno-strict-aliasing -Wno-vla-extension -O3 -DNDEBUG -std=c++17  -fno-exceptions -funwind-tables -fno-rtti -UNDEBUG -MD -MT tools/lldb/source/Commands/CMakeFiles/lldbCommands.dir/CommandObjectTarget.cpp.o -MF tools/lldb/source/Commands/CMakeFiles/lldbCommands.dir/CommandObjectTarget.cpp.o.d -o tools/lldb/source/Commands/CMakeFiles/lldbCommands.dir/CommandObjectTarget.cpp.o -c /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/llvm-project/lldb/source/Commands/CommandObjectTarget.cpp
../llvm-project/lldb/source/Commands/CommandObjectTarget.cpp:2203:14: error: no matching member function for call to 'createDiagnostics'
 2203 |     compiler.createDiagnostics();
      |     ~~~~~~~~~^~~~~~~~~~~~~~~~~
../llvm-project/clang/include/clang/Frontend/CompilerInstance.h:687:8: note: candidate function not viable: requires at least argument 'VFS', but no arguments were provided
  687 |   void createDiagnostics(llvm::vfs::FileSystem &VFS,
      |        ^                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~
  688 |                          DiagnosticConsumer *Client = nullptr,
      |                          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  689 |                          bool ShouldOwnClient = true);
      |                          ~~~~~~~~~~~~~~~~~~~~~~~~~~~
../llvm-project/clang/include/clang/Frontend/CompilerInstance.h:710:3: note: candidate function not viable: requires at least 2 arguments, but 0 were provided
  710 |   createDiagnostics(llvm::vfs::FileSystem &VFS, DiagnosticOptions *Opts,
      |   ^                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  711 |                     DiagnosticConsumer *Client = nullptr,
      |                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  712 |                     bool ShouldOwnClient = true,
      |                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  713 |                     const CodeGenOptions *CodeGenOpts = nullptr);
      |                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
ninja: build stopped: subcommand failed.

@llvm-ci
Copy link
Collaborator

llvm-ci commented Nov 21, 2024

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

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

Here is the relevant piece of the build log for the reference
Step 5 (build-unified-tree) failure: build (failure)
...
84.693 [142/31/6875] Linking CXX static library lib/libclangDoc.a
84.739 [141/31/6876] Building CXX object tools/clang/tools/extra/clangd/CMakeFiles/obj.clangDaemon.dir/index/YAMLSerialization.cpp.o
84.945 [141/30/6877] Linking CXX executable bin/clang-doc
85.141 [141/29/6878] Building CXX object tools/clang/tools/extra/clangd/fuzzer/CMakeFiles/clangd-fuzzer.dir/clangd-fuzzer.cpp.o
85.416 [141/28/6879] Building CXX object tools/clang/tools/extra/clangd/CMakeFiles/obj.clangDaemon.dir/index/StdLib.cpp.o
85.420 [141/27/6880] Building CXX object tools/clang/tools/extra/clangd/CMakeFiles/obj.clangDaemon.dir/index/Serialization.cpp.o
86.351 [141/26/6881] Building CXX object tools/lldb/tools/lldb-instr/CMakeFiles/lldb-instr.dir/Instrument.cpp.o
86.372 [140/26/6882] Building CXX object tools/clang/tools/extra/clangd/index/dex/dexp/CMakeFiles/dexp.dir/Dexp.cpp.o
86.528 [140/25/6883] Building CXX object tools/clang/tools/extra/clangd/CMakeFiles/obj.clangDaemon.dir/TUScheduler.cpp.o
86.547 [140/24/6884] Building CXX object tools/lldb/source/Commands/CMakeFiles/lldbCommands.dir/CommandObjectTarget.cpp.o
FAILED: tools/lldb/source/Commands/CMakeFiles/lldbCommands.dir/CommandObjectTarget.cpp.o 
CCACHE_CPP2=yes CCACHE_HASHDIR=yes /usr/bin/ccache /usr/bin/clang++ -DGTEST_HAS_RTTI=0 -DHAVE_ROUND -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/lldb/source/Commands -I/b/1/llvm-x86_64-debian-dylib/llvm-project/lldb/source/Commands -I/b/1/llvm-x86_64-debian-dylib/llvm-project/lldb/include -I/b/1/llvm-x86_64-debian-dylib/build/tools/lldb/include -I/b/1/llvm-x86_64-debian-dylib/build/include -I/b/1/llvm-x86_64-debian-dylib/llvm-project/llvm/include -I/b/1/llvm-x86_64-debian-dylib/llvm-project/llvm/../clang/include -I/b/1/llvm-x86_64-debian-dylib/build/tools/lldb/../clang/include -I/b/1/llvm-x86_64-debian-dylib/llvm-project/lldb/source -I/b/1/llvm-x86_64-debian-dylib/build/tools/lldb/source -isystem /usr/include/libxml2 -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 -Wno-unknown-pragmas -Wno-strict-aliasing -Wno-vla-extension -O3 -DNDEBUG  -fno-exceptions -funwind-tables -fno-rtti -UNDEBUG -std=c++17 -MD -MT tools/lldb/source/Commands/CMakeFiles/lldbCommands.dir/CommandObjectTarget.cpp.o -MF tools/lldb/source/Commands/CMakeFiles/lldbCommands.dir/CommandObjectTarget.cpp.o.d -o tools/lldb/source/Commands/CMakeFiles/lldbCommands.dir/CommandObjectTarget.cpp.o -c /b/1/llvm-x86_64-debian-dylib/llvm-project/lldb/source/Commands/CommandObjectTarget.cpp
/b/1/llvm-x86_64-debian-dylib/llvm-project/lldb/source/Commands/CommandObjectTarget.cpp:2203:14: error: no matching member function for call to 'createDiagnostics'
    compiler.createDiagnostics();
    ~~~~~~~~~^~~~~~~~~~~~~~~~~
/b/1/llvm-x86_64-debian-dylib/llvm-project/llvm/../clang/include/clang/Frontend/CompilerInstance.h:687:8: note: candidate function not viable: requires at least argument 'VFS', but no arguments were provided
  void createDiagnostics(llvm::vfs::FileSystem &VFS,
       ^
/b/1/llvm-x86_64-debian-dylib/llvm-project/llvm/../clang/include/clang/Frontend/CompilerInstance.h:710:3: note: candidate function not viable: requires at least 2 arguments, but 0 were provided
  createDiagnostics(llvm::vfs::FileSystem &VFS, DiagnosticOptions *Opts,
  ^
1 error generated.
86.551 [140/23/6885] Building CXX object tools/clang/tools/extra/clangd/indexer/CMakeFiles/clangd-indexer.dir/IndexerMain.cpp.o
86.649 [140/22/6886] Linking CXX executable bin/lldb-instr
87.382 [140/21/6887] Building CXX object tools/clang/tools/extra/clangd/CMakeFiles/obj.clangDaemon.dir/index/Background.cpp.o
87.967 [140/20/6888] Building CXX object tools/clang/tools/extra/clangd/CMakeFiles/obj.clangDaemon.dir/index/SymbolCollector.cpp.o
88.821 [140/19/6889] Building CXX object tools/clang/tools/extra/clangd/CMakeFiles/obj.clangDaemon.dir/refactor/Rename.cpp.o
89.510 [140/18/6890] Building CXX object tools/clang/tools/extra/clang-tidy/utils/CMakeFiles/obj.clangTidyUtils.dir/RenamerClangTidyCheck.cpp.o
90.461 [140/17/6891] Building CXX object tools/lldb/source/Plugins/ExpressionParser/Clang/CMakeFiles/lldbPluginExpressionParserClang.dir/ClangFunctionCaller.cpp.o
91.137 [140/16/6892] Building CXX object tools/clang/tools/extra/clang-tidy/modernize/CMakeFiles/obj.clangTidyModernizeModule.dir/DeprecatedHeadersCheck.cpp.o
91.216 [140/15/6893] Building CXX object tools/clang/tools/extra/clangd/CMakeFiles/obj.clangDaemon.dir/index/FileIndex.cpp.o
91.922 [140/14/6894] Building CXX object tools/clang/tools/extra/clangd/CMakeFiles/obj.clangDaemon.dir/Preamble.cpp.o
92.490 [140/13/6895] Building CXX object tools/clang/tools/extra/clang-tidy/modernize/CMakeFiles/obj.clangTidyModernizeModule.dir/PassByValueCheck.cpp.o
92.792 [140/12/6896] Building CXX object tools/lldb/source/Plugins/ExpressionParser/Clang/CMakeFiles/lldbPluginExpressionParserClang.dir/ClangModulesDeclVendor.cpp.o
FAILED: tools/lldb/source/Plugins/ExpressionParser/Clang/CMakeFiles/lldbPluginExpressionParserClang.dir/ClangModulesDeclVendor.cpp.o 
CCACHE_CPP2=yes CCACHE_HASHDIR=yes /usr/bin/ccache /usr/bin/clang++ -DGTEST_HAS_RTTI=0 -DHAVE_ROUND -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/lldb/source/Plugins/ExpressionParser/Clang -I/b/1/llvm-x86_64-debian-dylib/llvm-project/lldb/source/Plugins/ExpressionParser/Clang -I/b/1/llvm-x86_64-debian-dylib/llvm-project/lldb/include -I/b/1/llvm-x86_64-debian-dylib/build/tools/lldb/include -I/b/1/llvm-x86_64-debian-dylib/build/include -I/b/1/llvm-x86_64-debian-dylib/llvm-project/llvm/include -I/b/1/llvm-x86_64-debian-dylib/llvm-project/llvm/../clang/include -I/b/1/llvm-x86_64-debian-dylib/build/tools/lldb/../clang/include -I/b/1/llvm-x86_64-debian-dylib/llvm-project/lldb/source -I/b/1/llvm-x86_64-debian-dylib/build/tools/lldb/source -isystem /usr/include/libxml2 -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 -Wno-unknown-pragmas -Wno-strict-aliasing -Wno-vla-extension -O3 -DNDEBUG  -fno-exceptions -funwind-tables -fno-rtti -UNDEBUG -std=c++17 -MD -MT tools/lldb/source/Plugins/ExpressionParser/Clang/CMakeFiles/lldbPluginExpressionParserClang.dir/ClangModulesDeclVendor.cpp.o -MF tools/lldb/source/Plugins/ExpressionParser/Clang/CMakeFiles/lldbPluginExpressionParserClang.dir/ClangModulesDeclVendor.cpp.o.d -o tools/lldb/source/Plugins/ExpressionParser/Clang/CMakeFiles/lldbPluginExpressionParserClang.dir/ClangModulesDeclVendor.cpp.o -c /b/1/llvm-x86_64-debian-dylib/llvm-project/lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp
/b/1/llvm-x86_64-debian-dylib/llvm-project/lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp:709:7: error: no matching function for call to 'createDiagnostics'
      clang::CompilerInstance::createDiagnostics(diag_options_up.release(),
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/b/1/llvm-x86_64-debian-dylib/llvm-project/llvm/../clang/include/clang/Frontend/CompilerInstance.h:687:8: note: candidate function not viable: no known conversion from 'std::unique_ptr<clang::DiagnosticOptions, std::default_delete<clang::DiagnosticOptions>>::pointer' (aka 'clang::DiagnosticOptions *') to 'llvm::vfs::FileSystem &' for 1st argument
  void createDiagnostics(llvm::vfs::FileSystem &VFS,
       ^
/b/1/llvm-x86_64-debian-dylib/llvm-project/llvm/../clang/include/clang/Frontend/CompilerInstance.h:710:3: note: candidate function not viable: no known conversion from 'std::unique_ptr<clang::DiagnosticOptions, std::default_delete<clang::DiagnosticOptions>>::pointer' (aka 'clang::DiagnosticOptions *') to 'llvm::vfs::FileSystem &' for 1st argument
  createDiagnostics(llvm::vfs::FileSystem &VFS, DiagnosticOptions *Opts,
  ^
1 error generated.
94.195 [140/11/6897] Building CXX object tools/lldb/source/Plugins/ExpressionParser/Clang/CMakeFiles/lldbPluginExpressionParserClang.dir/ClangExpressionParser.cpp.o
FAILED: tools/lldb/source/Plugins/ExpressionParser/Clang/CMakeFiles/lldbPluginExpressionParserClang.dir/ClangExpressionParser.cpp.o 
CCACHE_CPP2=yes CCACHE_HASHDIR=yes /usr/bin/ccache /usr/bin/clang++ -DGTEST_HAS_RTTI=0 -DHAVE_ROUND -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/lldb/source/Plugins/ExpressionParser/Clang -I/b/1/llvm-x86_64-debian-dylib/llvm-project/lldb/source/Plugins/ExpressionParser/Clang -I/b/1/llvm-x86_64-debian-dylib/llvm-project/lldb/include -I/b/1/llvm-x86_64-debian-dylib/build/tools/lldb/include -I/b/1/llvm-x86_64-debian-dylib/build/include -I/b/1/llvm-x86_64-debian-dylib/llvm-project/llvm/include -I/b/1/llvm-x86_64-debian-dylib/llvm-project/llvm/../clang/include -I/b/1/llvm-x86_64-debian-dylib/build/tools/lldb/../clang/include -I/b/1/llvm-x86_64-debian-dylib/llvm-project/lldb/source -I/b/1/llvm-x86_64-debian-dylib/build/tools/lldb/source -isystem /usr/include/libxml2 -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 -Wno-unknown-pragmas -Wno-strict-aliasing -Wno-vla-extension -O3 -DNDEBUG  -fno-exceptions -funwind-tables -fno-rtti -UNDEBUG -std=c++17 -MD -MT tools/lldb/source/Plugins/ExpressionParser/Clang/CMakeFiles/lldbPluginExpressionParserClang.dir/ClangExpressionParser.cpp.o -MF tools/lldb/source/Plugins/ExpressionParser/Clang/CMakeFiles/lldbPluginExpressionParserClang.dir/ClangExpressionParser.cpp.o.d -o tools/lldb/source/Plugins/ExpressionParser/Clang/CMakeFiles/lldbPluginExpressionParserClang.dir/ClangExpressionParser.cpp.o -c /b/1/llvm-x86_64-debian-dylib/llvm-project/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp

sylvestre added a commit that referenced this pull request Nov 21, 2024
sylvestre added a commit that referenced this pull request Nov 21, 2024
@sylvestre
Copy link
Collaborator

I had to revert this for causing this issue with lldb:
#117145

kadircet added a commit that referenced this pull request Nov 21, 2024
yonghong-song pushed a commit to iovisor/bcc that referenced this pull request Nov 23, 2024
Upstream llvm patch
  llvm/llvm-project#115852
changed signature for function createDiagnostics().
This patch fixed the issue.

Signed-off-by: Yonghong Song <yonghong.song@linux.dev>
yonghong-song added a commit to iovisor/bcc that referenced this pull request Nov 23, 2024
Upstream llvm patch
  llvm/llvm-project#115852
changed signature for function createDiagnostics().
This patch fixed the issue.

Signed-off-by: Yonghong Song <yonghong.song@linux.dev>
swift-ci pushed a commit to swiftlang/llvm-project that referenced this pull request Nov 24, 2024
swift-ci pushed a commit to swiftlang/llvm-project that referenced this pull request Nov 25, 2024
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: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:static analyzer clang Clang issues not falling into any other category clang-tools-extra clangd
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants