[RFC] New clangOptions library; Remove dependency on clangDriver from clangFrontend and flangFrontend (original) (raw)
November 4, 2025, 2:17am 1
Problem
As part of implementing [RFC][Modules] Support simple C++20 modules use from the Clang driver without a build system, we need to perform a dependency scan from the Clang driver.
This was followed by [RFC][Driver] Link the Driver against clangDependencyScanning, which got approval. However, during review of [clang][modules-driver] Add dependency scan and dependency graph (#152770 ), it was pointed out that this introduces cyclic dependencies and would fail with dynamic linking.
Proposal
To solve this, we need to break clangFrontend’s dependency on clangDriver and propose the following changes:
- Extract option-related code from
clangDriverinto a newclangOptionslibrary. BothclangDriverandclangFrontendcan then depend onclangOptionsindependently.
This would be addressed by #163659. - Move other functionality from
clangFrontendthat depends onclangDriverintoclangDriveritself, inverting the dependency relation.
This is currently implemented in PR #165277 and also removes theclangDriverdependency fromflangFrontend, as requested by Flang maintainers.
The direct dependency of clangDependencyScanning on clangDriver would be removed in a later step, as per this review comment.
@tarunprabhu @sscalpone @rnk @MaskRay @kiranchandramohan @jansvoboda11 @Endill @banach-space @cachemeifyoucan @Bigcheese @AaronBallman
Thanks for everyone’s time and input on this.
This RFC was accepted in this message.
Thank you for the RFC! I think this approach makes sense, but I’d love to hear from the driver and options code owners too.
Better separation of concerns is useful on a variety of levels. So I am in favor.
Given the lack of stated concerns, this RFC is accepted. Thanks!