Bigcheese wrote:

> [...] But if we are able to make this to be a foundation for all clang based 
> tools to understand modules. This will be pretty valuable.

This was something I was considering during the initial proposal, but I didn't 
suggest doing it that way because I don't think we know what that API should 
look like yet, and there are still open questions about how to handle 3rd party 
modules and header units. I think the exercise of making all this work in the 
constrained environment of the Clang driver will help answer what the eventual 
API should be.

With that, there are definitely parts of ModuleDriver.cpp that could be moved 
to the DependencyScanning library, and this library will soon move out of 
tooling into its own top level library. This did make me notice an issue with 
this patch is that it likely will break shared library builds because 
DependencyScanning currently depends on Driver, and this makes Driver depend on 
DependencyScanning. I think this should be fixed by just making 
DependencyScanning not depend on the driver (I'll expand on that in another 
comment).

I think a few parts of ModuleDriver.cpp should land in DependencyScanning in 
this patch, and after the modules driver is working well see how best to 
combine that with what clangd and other tools need, but until then I'd like the 
modules driver to be flexible as we figure things out, moving shared things to 
DependencyScanning as needed.

Longer term I've been wondering if something like how the [new Swift 
driver](https://github.com/swiftlang/swift-driver) works would be interesting 
for Clang. The Swift driver can be directly used by build systems to figure out 
all the work needed to build arbitrary sets of code, including any Clang 
modules that are needed. It can also use its internal build system to build 
directly. This would be a big change for Clang in that it takes on a lot of 
build system responsibilities, but it has worked really well for Swift.

https://github.com/llvm/llvm-project/pull/152770
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to