[clang] [clang][DependencyScanning] Logging Dependency Scanning Events (PR #195896)
Qiongsi Wu via cfe-commits
cfe-commits at lists.llvm.org
Thu Jul 2 11:48:39 PDT 2026
================
@@ -0,0 +1,58 @@
+// Test logging events for the scan-by-name path using CompilerInstanceWithContext.
+// This test also covers the case where the compiler spawns a new thread to scan
+// an included module.
+// Specifically, when the compiler scans dependency for module N on thread TID1,
+// it creates a different thread TID2 to scan for M. TID2 discovers that M has
+// been built, picks up the up-to-date pcm, and returns back to TID1.
+// RUN: rm -rf %t
+// RUN: split-file %s %t
+// RUN: sed -e "s|DIR|%/t|g" %t/cdb.json.template > %t/cdb.json
+
+// RUN: clang-scan-deps -compilation-database %t/cdb.json \
+// RUN: -format experimental-full -log-path=%t/scan.log -j 1 \
+// RUN: -module-names=M,N -o %t/deps.json
+// RUN: FileCheck %s < %t/scan.log
+
+// CHECK: [{{[0-9]+\.[0-9]+}}] [[#PID:]] [[#TID1:]]: init_compiler_instance_with_context:{{.*}}
----------------
qiongsiwu wrote:
No you are exactly right that `compiler_instance_with_context` is not shared across threads. Good suggestion regarding TID2. I added a new event to show when TID2 is created.
https://github.com/llvm/llvm-project/pull/195896
More information about the cfe-commits
mailing list