[clang] [clang][modules-driver] Add dependency scan and dependency graph (PR #152770)

Naveen Seth Hanig via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 14 10:17:42 PDT 2025


================
@@ -99,5 +100,6 @@ add_clang_library(clangDriver
   LINK_LIBS
   clangBasic
   clangLex
+  clangDependencyScanning
----------------
naveen-seth wrote:

I just noticed that `clangFrontend` also depends on `clangDriver`. Earlier, I had mistakenly assumed that a static build would also fail due to dependency cycles, so I missed this.

This causes a cycle when `clangDependencies` is a dependency of `clangDriver` and leads to a failure with dynamic linking:

```
ninja: error: dependency cycle: lib/libclangFrontend.so.22.0git -> lib/libclangDriver.so.22.0git -> lib/libclangDependencyScanning.so.22.0git -> lib/libclangFrontend.so.22.0git
```

I don’t see a straightforward way to break this cycle by removing a dependency (as suggested for `clangDriver`).

Should we consider one of the other options discussed in the [RFC](https://discourse.llvm.org/t/rfc-driver-link-the-driver-against-clangdependencyscanning-clangast-clangfrontend-clangserialization-and-clanglex/87469) for linking the driver against `clangDependencies`, or is there another possible approach?

@Bigcheese 

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


More information about the cfe-commits mailing list