[clang] [clang][DependencyScanning] Add a Clang Driver Option to Enable Dependency Scanning Logging (PR #211966)

Jan Svoboda via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 19 10:51:42 PDT 2026


================
@@ -125,6 +127,9 @@ buildCompilation(ArrayRef<std::string> ArgStrs, DiagnosticsEngine &Diags,
     return std::make_pair(nullptr, nullptr);
   }
 
+  Logger.enable(
+      Compilation->getArgs().getLastArgValue(options::OPT_fdepscan_log_path));
----------------
jansvoboda11 wrote:

Thanks for the info. I think this is fine conceptually, especially now that the Clang driver itself embeds the scanner. But for libclang clients, the logger needs to be scoped to individual scan queries, not to the entire service. Imagine having a project where some targets have `-fdepscan-log-path` and some don't. If you scan them in parallel, this will enable logging for the ones without the argument mid-scan and the output will be non-sensical.

Another way of being able to extend the scanner configuration without having to coordinate with the build system was to provide a way to pass arbitrary string to the service options API in libclang and then parse the configuration out of that. This gives you the same flexibility but scopes the logger enablement correctly.

https://github.com/llvm/llvm-project/pull/211966


More information about the cfe-commits mailing list