Skip to content

Conversation

@Bigcheese
Copy link
Contributor

While the source code isn't supposed to change during a build, in some environments it does. This adds an option that disables caching of stat failures, meaning that source files can be added to the build during scanning.

This adds a -no-cache-negative-stats option to clang-scan-deps to enable this behavior. There are no tests for clang-scan-deps as there's no reliable way to do so from it. A unit test has been added that modifies the filesystem between scans to test it.

@llvmbot llvmbot added the clang Clang issues not falling into any other category label Jun 13, 2025
@llvmbot
Copy link
Member

llvmbot commented Jun 13, 2025

@llvm/pr-subscribers-clang

Author: Michael Spencer (Bigcheese)

Changes

While the source code isn't supposed to change during a build, in some environments it does. This adds an option that disables caching of stat failures, meaning that source files can be added to the build during scanning.

This adds a -no-cache-negative-stats option to clang-scan-deps to enable this behavior. There are no tests for clang-scan-deps as there's no reliable way to do so from it. A unit test has been added that modifies the filesystem between scans to test it.


Full diff: https://github.com/llvm/llvm-project/pull/144000.diff

8 Files Affected:

  • (modified) clang/include/clang/Tooling/DependencyScanning/DependencyScanningFilesystem.h (+4-1)
  • (modified) clang/include/clang/Tooling/DependencyScanning/DependencyScanningService.h (+5-1)
  • (modified) clang/lib/Tooling/DependencyScanning/DependencyScanningFilesystem.cpp (+5-2)
  • (modified) clang/lib/Tooling/DependencyScanning/DependencyScanningService.cpp (+2-1)
  • (modified) clang/lib/Tooling/DependencyScanning/DependencyScanningWorker.cpp (+2-2)
  • (modified) clang/tools/clang-scan-deps/ClangScanDeps.cpp (+5-1)
  • (modified) clang/tools/clang-scan-deps/Opts.td (+1)
  • (modified) clang/unittests/Tooling/DependencyScanning/DependencyScannerTest.cpp (+50)
diff --git a/clang/include/clang/Tooling/DependencyScanning/DependencyScanningFilesystem.h b/clang/include/clang/Tooling/DependencyScanning/DependencyScanningFilesystem.h
index a20a89a4c2b76..7a688082a55e1 100644
--- a/clang/include/clang/Tooling/DependencyScanning/DependencyScanningFilesystem.h
+++ b/clang/include/clang/Tooling/DependencyScanning/DependencyScanningFilesystem.h
@@ -350,7 +350,8 @@ class DependencyScanningWorkerFilesystem
 
   DependencyScanningWorkerFilesystem(
       DependencyScanningFilesystemSharedCache &SharedCache,
-      IntrusiveRefCntPtr<llvm::vfs::FileSystem> FS);
+      IntrusiveRefCntPtr<llvm::vfs::FileSystem> FS,
+      bool CacheNegativeStats = true);
 
   llvm::ErrorOr<llvm::vfs::Status> status(const Twine &Path) override;
   llvm::ErrorOr<std::unique_ptr<llvm::vfs::File>>
@@ -491,6 +492,8 @@ class DependencyScanningWorkerFilesystem
   /// using them for cache lookups.
   llvm::ErrorOr<std::string> WorkingDirForCacheLookup;
 
+  bool CacheNegativeStats;
+
   void updateWorkingDirForCacheLookup();
 
   llvm::ErrorOr<StringRef>
diff --git a/clang/include/clang/Tooling/DependencyScanning/DependencyScanningService.h b/clang/include/clang/Tooling/DependencyScanning/DependencyScanningService.h
index 4e97c7bc9f36e..ceaf3c2279e7f 100644
--- a/clang/include/clang/Tooling/DependencyScanning/DependencyScanningService.h
+++ b/clang/include/clang/Tooling/DependencyScanning/DependencyScanningService.h
@@ -87,7 +87,8 @@ class DependencyScanningService {
       ScanningOptimizations OptimizeArgs = ScanningOptimizations::Default,
       bool EagerLoadModules = false, bool TraceVFS = false,
       std::time_t BuildSessionTimestamp =
-          llvm::sys::toTimeT(std::chrono::system_clock::now()));
+          llvm::sys::toTimeT(std::chrono::system_clock::now()),
+      bool CacheNegativeStats = true);
 
   ScanningMode getMode() const { return Mode; }
 
@@ -99,6 +100,8 @@ class DependencyScanningService {
 
   bool shouldTraceVFS() const { return TraceVFS; }
 
+  bool shouldCacheNegativeStats() const { return CacheNegativeStats; }
+
   DependencyScanningFilesystemSharedCache &getSharedCache() {
     return SharedCache;
   }
@@ -116,6 +119,7 @@ class DependencyScanningService {
   const bool EagerLoadModules;
   /// Whether to trace VFS accesses.
   const bool TraceVFS;
+  const bool CacheNegativeStats;
   /// The global file system cache.
   DependencyScanningFilesystemSharedCache SharedCache;
   /// The global module cache entries.
diff --git a/clang/lib/Tooling/DependencyScanning/DependencyScanningFilesystem.cpp b/clang/lib/Tooling/DependencyScanning/DependencyScanningFilesystem.cpp
index 140833050f4e9..e28c4362a0f2f 100644
--- a/clang/lib/Tooling/DependencyScanning/DependencyScanningFilesystem.cpp
+++ b/clang/lib/Tooling/DependencyScanning/DependencyScanningFilesystem.cpp
@@ -233,11 +233,12 @@ bool DependencyScanningWorkerFilesystem::shouldBypass(StringRef Path) const {
 
 DependencyScanningWorkerFilesystem::DependencyScanningWorkerFilesystem(
     DependencyScanningFilesystemSharedCache &SharedCache,
-    IntrusiveRefCntPtr<llvm::vfs::FileSystem> FS)
+    IntrusiveRefCntPtr<llvm::vfs::FileSystem> FS, bool CacheNegativeStats)
     : llvm::RTTIExtends<DependencyScanningWorkerFilesystem,
                         llvm::vfs::ProxyFileSystem>(std::move(FS)),
       SharedCache(SharedCache),
-      WorkingDirForCacheLookup(llvm::errc::invalid_argument) {
+      WorkingDirForCacheLookup(llvm::errc::invalid_argument),
+      CacheNegativeStats(CacheNegativeStats) {
   updateWorkingDirForCacheLookup();
 }
 
@@ -267,6 +268,8 @@ DependencyScanningWorkerFilesystem::computeAndStoreResult(
   llvm::ErrorOr<llvm::vfs::Status> Stat =
       getUnderlyingFS().status(OriginalFilename);
   if (!Stat) {
+    if (!CacheNegativeStats)
+      return Stat.getError();
     const auto &Entry =
         getOrEmplaceSharedEntryForFilename(FilenameForLookup, Stat.getError());
     return insertLocalEntryForFilename(FilenameForLookup, Entry);
diff --git a/clang/lib/Tooling/DependencyScanning/DependencyScanningService.cpp b/clang/lib/Tooling/DependencyScanning/DependencyScanningService.cpp
index 7f40c99f07287..c2f3cdbb02e37 100644
--- a/clang/lib/Tooling/DependencyScanning/DependencyScanningService.cpp
+++ b/clang/lib/Tooling/DependencyScanning/DependencyScanningService.cpp
@@ -15,7 +15,8 @@ using namespace dependencies;
 DependencyScanningService::DependencyScanningService(
     ScanningMode Mode, ScanningOutputFormat Format,
     ScanningOptimizations OptimizeArgs, bool EagerLoadModules, bool TraceVFS,
-    std::time_t BuildSessionTimestamp)
+    std::time_t BuildSessionTimestamp, bool CacheNegativeStats)
     : Mode(Mode), Format(Format), OptimizeArgs(OptimizeArgs),
       EagerLoadModules(EagerLoadModules), TraceVFS(TraceVFS),
+      CacheNegativeStats(CacheNegativeStats),
       BuildSessionTimestamp(BuildSessionTimestamp) {}
diff --git a/clang/lib/Tooling/DependencyScanning/DependencyScanningWorker.cpp b/clang/lib/Tooling/DependencyScanning/DependencyScanningWorker.cpp
index 9bd85479d9810..a54bcfdb509a0 100644
--- a/clang/lib/Tooling/DependencyScanning/DependencyScanningWorker.cpp
+++ b/clang/lib/Tooling/DependencyScanning/DependencyScanningWorker.cpp
@@ -611,8 +611,8 @@ DependencyScanningWorker::DependencyScanningWorker(
 
   switch (Service.getMode()) {
   case ScanningMode::DependencyDirectivesScan:
-    DepFS =
-        new DependencyScanningWorkerFilesystem(Service.getSharedCache(), FS);
+    DepFS = new DependencyScanningWorkerFilesystem(
+        Service.getSharedCache(), FS, Service.shouldCacheNegativeStats());
     BaseFS = DepFS;
     break;
   case ScanningMode::CanonicalPreprocessing:
diff --git a/clang/tools/clang-scan-deps/ClangScanDeps.cpp b/clang/tools/clang-scan-deps/ClangScanDeps.cpp
index 921ba7aadd67d..bb42f2f43aee6 100644
--- a/clang/tools/clang-scan-deps/ClangScanDeps.cpp
+++ b/clang/tools/clang-scan-deps/ClangScanDeps.cpp
@@ -85,6 +85,7 @@ static ScanningOutputFormat Format = ScanningOutputFormat::Make;
 static ScanningOptimizations OptimizeArgs;
 static std::string ModuleFilesDir;
 static bool EagerLoadModules;
+static bool CacheNegativeStats = true;
 static unsigned NumThreads = 0;
 static std::string CompilationDB;
 static std::optional<std::string> ModuleName;
@@ -191,6 +192,8 @@ static void ParseArgs(int argc, char **argv) {
 
   EagerLoadModules = Args.hasArg(OPT_eager_load_pcm);
 
+  CacheNegativeStats = !Args.hasArg(OPT_no_cache_negative_stats);
+
   if (const llvm::opt::Arg *A = Args.getLastArg(OPT_j)) {
     StringRef S{A->getValue()};
     if (!llvm::to_integer(S, NumThreads, 0)) {
@@ -1081,7 +1084,8 @@ int clang_scan_deps_main(int argc, char **argv, const llvm::ToolContext &) {
   };
 
   DependencyScanningService Service(ScanMode, Format, OptimizeArgs,
-                                    EagerLoadModules, /*TraceVFS=*/Verbose);
+                                    EagerLoadModules, /*TraceVFS=*/Verbose,
+                                    CacheNegativeStats);
 
   llvm::Timer T;
   T.startTimer();
diff --git a/clang/tools/clang-scan-deps/Opts.td b/clang/tools/clang-scan-deps/Opts.td
index 9cccbb3aaf0c8..582ae60851e1e 100644
--- a/clang/tools/clang-scan-deps/Opts.td
+++ b/clang/tools/clang-scan-deps/Opts.td
@@ -22,6 +22,7 @@ defm module_files_dir : Eq<"module-files-dir",
 
 def optimize_args_EQ : CommaJoined<["-", "--"], "optimize-args=">, HelpText<"Which command-line arguments of modules to optimize">;
 def eager_load_pcm : F<"eager-load-pcm", "Load PCM files eagerly (instead of lazily on import)">;
+def no_cache_negative_stats : F<"no-cache-negative-stats", "Don't cache stat failures">;
 
 def j : Arg<"j", "Number of worker threads to use (default: use all concurrent threads)">;
 
diff --git a/clang/unittests/Tooling/DependencyScanning/DependencyScannerTest.cpp b/clang/unittests/Tooling/DependencyScanning/DependencyScannerTest.cpp
index 683d9070b1dcf..3535f1a04f2be 100644
--- a/clang/unittests/Tooling/DependencyScanning/DependencyScannerTest.cpp
+++ b/clang/unittests/Tooling/DependencyScanning/DependencyScannerTest.cpp
@@ -384,3 +384,53 @@ TEST(DependencyScanner, ScanDepsWithDiagConsumer) {
     EXPECT_TRUE(DiagConsumer.Finished);
   }
 }
+
+TEST(DependencyScanner, NoNegativeCache) {
+  StringRef CWD = "/root";
+
+  auto VFS = new llvm::vfs::InMemoryFileSystem();
+  VFS->setCurrentWorkingDirectory(CWD);
+  auto Sept = llvm::sys::path::get_separator();
+  std::string HeaderPath =
+      std::string(llvm::formatv("{0}root{0}header.h", Sept));
+  std::string Test0Path = std::string(llvm::formatv("{0}root{0}test0.cpp", Sept));
+  std::string Test1Path = std::string(llvm::formatv("{0}root{0}test1.cpp", Sept));
+
+  VFS->addFile(Test0Path, 0,
+               llvm::MemoryBuffer::getMemBuffer(
+                   "#if __has_include(\"header.h\")\n#endif"));
+  VFS->addFile(Test1Path, 0,
+               llvm::MemoryBuffer::getMemBuffer("#include \"header.h\""));
+
+  DependencyScanningService Service(
+      ScanningMode::DependencyDirectivesScan, ScanningOutputFormat::Make,
+      ScanningOptimizations::All, false, false,
+      llvm::sys::toTimeT(std::chrono::system_clock::now()), false);
+  DependencyScanningTool ScanTool(Service, VFS);
+
+  std::vector<std::string> CommandLine0 = {"clang",
+                                           "-target",
+                                           "x86_64-apple-macosx10.7",
+                                           "-c",
+                                           "test0.cpp",
+                                           "-o"
+                                           "test0.cpp.o"};
+  std::vector<std::string> CommandLine1 = {"clang",
+                                           "-target",
+                                           "x86_64-apple-macosx10.7",
+                                           "-c",
+                                           "test1.cpp",
+                                           "-o"
+                                           "test1.cpp.o"};
+
+  std::string Result;
+  ASSERT_THAT_ERROR(
+      ScanTool.getDependencyFile(CommandLine0, CWD).moveInto(Result),
+      llvm::Succeeded());
+
+  VFS->addFile(HeaderPath, 0, llvm::MemoryBuffer::getMemBuffer(""));
+
+  ASSERT_THAT_ERROR(
+      ScanTool.getDependencyFile(CommandLine1, CWD).moveInto(Result),
+      llvm::Succeeded());
+}

@github-actions
Copy link

github-actions bot commented Jun 13, 2025

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

Copy link
Contributor

@jansvoboda11 jansvoboda11 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 think I would slightly prefer for DependencyScanningWorkerFilesystem to accept the entire service instead of its members (for the same reasons we do that in the worker, action, etc.)

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think this is passing the flag to the BuildSessionTimestamp parameter.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oops, the downside to not being able to test it from here.

While the source code isn't supposed to change during a build, in some
environments it does. This adds an option that disables caching of
stat failures, meaning that source files can be added to the build
during scanning.

This adds a `-no-cache-negative-stats` option to clang-scan-deps to
enable this behavior. There are no tests for clang-scan-deps as
there's no reliable way to do so from it. A unit test has been added
that modifies the filesystem between scans to test it.
@Bigcheese Bigcheese force-pushed the dev/no-negative-stat-cache branch from 4eef87a to d07ccf2 Compare June 13, 2025 22:00
@Bigcheese
Copy link
Contributor Author

LGTM. I think I would slightly prefer for DependencyScanningWorkerFilesystem to accept the entire service instead of its members (for the same reasons we do that in the worker, action, etc.)

I changed this, although now the tests need a service. I don't think that's a big deal as real use always has a service. It also required moving stuff out of the header as the service includes the vfs, so the service can't be a complete type in the vfs header.

@Bigcheese Bigcheese merged commit 6110dea into llvm:main Jun 20, 2025
7 checks passed
@qinkunbao
Copy link
Member

qinkunbao commented Jun 23, 2025

Hi, I think this PR broke the clang unit tests.
https://lab.llvm.org/buildbot/#/builders/164/builds/11064

Can you take a look?

[ RUN      ] DependencyScanner.NoNegativeCache
 #0 0x000055555a761a02 ___interceptor_backtrace /home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/compiler-rt/lib/msan/../sanitizer_common/sanitizer_common_interceptors.inc:4530:13
 #1 0x000055555e2aa9af llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) /home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/lib/Support/Unix/Signals.inc:0:13
 #2 0x000055555e2a4938 llvm::sys::RunSignalHandlers() /home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/lib/Support/Signals.cpp:0:5
 #3 0x000055555e2abe2d SignalHandler(int, siginfo_t*, void*) /home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/lib/Support/Unix/Signals.inc:0:3
 #4 0x000055555a79564e IsInInterceptorScope /home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/compiler-rt/lib/msan/msan_interceptors.cpp:78:10
 #5 0x000055555a79564e SignalAction(int, void*, void*) /home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/compiler-rt/lib/msan/msan_interceptors.cpp:1167:3
 #6 0x00007fffe5645250 (/lib/x86_64-linux-gnu/libc.so.6+0x45250)
 #7 0x00007fffe56a3f1c pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0xa3f1c)
 #8 0x00007fffe564519e raise (/lib/x86_64-linux-gnu/libc.so.6+0x4519e)
 #9 0x00007fffe5628902 abort (/lib/x86_64-linux-gnu/libc.so.6+0x28902)
#10 0x000055555a7234ac (/home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm_build_msan/tools/clang/unittests/./AllClangUnitTests+0x51cf4ac)
#11 0x000055555a721ebe __sanitizer::Die() /home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_termination.cpp:52:5
#12 0x000055555a7351d3 (/home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm_build_msan/tools/clang/unittests/./AllClangUnitTests+0x51e11d3)
#13 0x000055556494d559 getSourceLocation /home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/clang/lib/Lex/Lexer.cpp:1214:3
#14 0x000055556494d559 clang::Lexer::FormTokenWithChars(clang::Token&, char const*, clang::tok::TokenKind) /home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/clang/include/clang/Lex/Lexer.h:640:24
#15 0x0000555564956024 clang::Lexer::LexEndOfFile(clang::Token&, char const*) /home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/clang/lib/Lex/Lexer.cpp:0:5
#16 0x0000555564a9dd2d clang::Preprocessor::Lex(clang::Token&) /home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/clang/lib/Lex/Preprocessor.cpp:877:3
#17 0x00005555649f14d7 LexUnexpandedToken /home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/clang/include/clang/Lex/Preprocessor.h:1818:27
#18 0x00005555649f14d7 clang::Preprocessor::CheckEndOfDirective(char const*, bool) /home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/clang/lib/Lex/PPDirectives.cpp:451:5
#19 0x00005555649f5d47 clang::Preprocessor::SkipExcludedConditionalBlock(clang::SourceLocation, clang::SourceLocation, bool, bool, clang::SourceLocation) /home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/clang/lib/Lex/PPDirectives.cpp:705:20
#20 0x0000555564a00a97 ~DirectiveEvalResult /home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/clang/include/clang/Lex/Preprocessor.h:2588:10
#21 0x0000555564a00a97 ~DirectiveEvalResult /home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/clang/include/clang/Lex/Preprocessor.h:2583:10
#22 0x0000555564a00a97 clang::Preprocessor::HandleIfDirective(clang::Token&, clang::Token const&, bool) /home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/clang/lib/Lex/PPDirectives.cpp:3509:1
#23 0x00005555649ff2ae clang::Preprocessor::HandleDirective(clang::Token&) /home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/clang/lib/Lex/PPDirectives.cpp:1328:7
#24 0x0000555564961858 clang::Lexer::LexDependencyDirectiveToken(clang::Token&) /home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/clang/lib/Lex/Lexer.cpp:0:9
#25 0x0000555564a9dd2d clang::Preprocessor::Lex(clang::Token&) /home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/clang/lib/Lex/Preprocessor.cpp:877:3
#26 0x0000555566e222f1 isNot /home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/clang/include/clang/Lex/Token.h:100:47
#27 0x0000555566e222f1 clang::ReadPCHAndPreprocessAction::ExecuteAction() /home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/clang/lib/Frontend/FrontendActions.cpp:82:16
#28 0x0000555566df0452 getCompilerInstance /home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/clang/include/clang/Frontend/FrontendAction.h:121:5
#29 0x0000555566df0452 clang::FrontendAction::Execute() /home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/clang/lib/Frontend/FrontendAction.cpp:1220:26
#30 0x0000555566c6d113 getPtr /home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/include/llvm/Support/Error.h:278:42
#31 0x0000555566c6d113 operator bool /home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/include/llvm/Support/Error.h:241:16
#32 0x0000555566c6d113 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) /home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/clang/lib/Frontend/CompilerInstance.cpp:1055:23
#33 0x00005555681ff6fa (anonymous namespace)::DependencyScanningAction::runInvocation(std::__1::shared_ptr<clang::CompilerInvocation>, clang::FileManager*, std::__1::shared_ptr<clang::PCHContainerOperations>, clang::DiagnosticConsumer*) /home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/clang/lib/Tooling/DependencyScanning/DependencyScanningWorker.cpp:549:38
#34 0x00005555678c71c8 clang::tooling::ToolInvocation::run() /home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/clang/lib/Tooling/Tooling.cpp:401:20
#35 0x00005555681fa831 createAndRunToolInvocation(std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>>, (anonymous namespace)::DependencyScanningAction&, clang::FileManager&, std::__1::shared_ptr<clang::PCHContainerOperations>&, clang::DiagnosticsEngine&, clang::tooling::dependencies::DependencyConsumer&) /home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/clang/lib/Tooling/DependencyScanning/DependencyScanningWorker.cpp:722:19
#36 0x00005555681f8d53 operator() /home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/clang/lib/Tooling/DependencyScanning/DependencyScanningWorker.cpp:784:18
#37 0x00005555681f8d53 callback_fn<(lambda at /home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/clang/lib/Tooling/DependencyScanning/DependencyScanningWorker.cpp:765:40)> /home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/include/llvm/ADT/STLFunctionalExtras.h:46:12
#38 0x00005555681f8d53 operator() /home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/include/llvm/ADT/STLFunctionalExtras.h:69:12
#39 0x00005555681f8d53 forEachDriverJob /home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/clang/lib/Tooling/DependencyScanning/DependencyScanningWorker.cpp:704:10
#40 0x00005555681f8d53 clang::tooling::dependencies::DependencyScanningWorker::scanDependencies(llvm::StringRef, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>> const&, clang::tooling::dependencies::DependencyConsumer&, clang::tooling::dependencies::DependencyActionController&, clang::DiagnosticConsumer&, llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem>, std::__1::optional<llvm::StringRef>) /home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/clang/lib/Tooling/DependencyScanning/DependencyScanningWorker.cpp:764:15
#41 0x00005555681f6743 clang::tooling::dependencies::DependencyScanningWorker::computeDependencies(llvm::StringRef, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>> const&, clang::tooling::dependencies::DependencyConsumer&, clang::tooling::dependencies::DependencyActionController&, clang::DiagnosticConsumer&, std::__1::optional<llvm::MemoryBufferRef>) /home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/clang/lib/Tooling/DependencyScanning/DependencyScanningWorker.cpp:836:10
#42 0x00005555681f4f4c clang::tooling::dependencies::DependencyScanningWorker::computeDependencies(llvm::StringRef, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>> const&, clang::tooling::dependencies::DependencyConsumer&, clang::tooling::dependencies::DependencyActionController&, std::__1::optional<llvm::MemoryBufferRef>) /home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/clang/lib/Tooling/DependencyScanning/DependencyScanningWorker.cpp:645:7
#43 0x000055556820cd6f getPtr /home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/include/llvm/Support/Error.h:278:42
#44 0x000055556820cd6f operator bool /home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/include/llvm/Support/Error.h:241:16
#45 0x000055556820cd6f clang::tooling::dependencies::DependencyScanningTool::getDependencyFile(std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>> const&, llvm::StringRef) /home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/clang/lib/Tooling/DependencyScanning/DependencyScanningTool.cpp:79:7
#46 0x000055555d0e622e operator bool /home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/include/llvm/Support/Error.h:576:17
#47 0x000055555d0e622e moveInto<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > /home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/include/llvm/Support/Error.h:598:9
#48 0x000055555d0e622e DependencyScanner_NoNegativeCache_Test::TestBody() /home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/clang/unittests/Tooling/DependencyScanning/DependencyScannerTest.cpp:429:3
#49 0x000055556304a9fd os_stack_trace_getter /home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/third-party/unittest/googletest/src/gtest.cc:6239:7
#50 0x000055556304a9fd testing::Test::Run() /home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/third-party/unittest/googletest/src/gtest.cc:2694:9
#51 0x000055556304da26 os_stack_trace_getter /home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/third-party/unittest/googletest/src/gtest.cc:6239:7
#52 0x000055556304da26 testing::TestInfo::Run() /home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/third-party/unittest/googletest/src/gtest.cc:2841:11
#53 0x000055556304fd7e testing::TestSuite::Run() /home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/third-party/unittest/googletest/src/gtest.cc:0:30
#54 0x000055556307b382 testing::internal::UnitTestImpl::RunAllTests() /home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/third-party/unittest/googletest/src/gtest.cc:5921:15
#55 0x000055556307a3b2 testing::UnitTest::Run() /home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/third-party/unittest/googletest/src/gtest.cc:5484:10
#56 0x0000555563017938 main /home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/third-party/unittest/UnitTestMain/TestMain.cpp:55:3
#57 0x00007fffe562a3b8 (/lib/x86_64-linux-gnu/libc.so.6+0x2a3b8)
#58 0x00007fffe562a47b __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2a47b)
#59 0x000055555a7162e5 _start (/home/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm_build_msan/tools/clang/unittests/./AllClangUnitTests+0x51c22e5)
--
exit: -6

@qinkunbao
Copy link
Member

Hi,

I've reverted this PR according to https://llvm.org/docs/DeveloperPolicy.html#patch-reversion-policy
Please feel free to revise the patch and make the title Reland "..." provide a description of what broke and how it was fixed in the new version.

llvm-sync bot pushed a commit to arm/arm-toolchain that referenced this pull request Jun 24, 2025
DrSergei pushed a commit to DrSergei/llvm-project that referenced this pull request Jun 24, 2025
anthonyhatran pushed a commit to anthonyhatran/llvm-project that referenced this pull request Jun 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

clang Clang issues not falling into any other category

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants