[clang] [clang][clang-scan-deps] Add named modules to format 'experimental-full' (PR #145221)
Naveen Seth Hanig via cfe-commits
cfe-commits at lists.llvm.org
Wed Aug 13 21:24:06 PDT 2025
================
@@ -188,13 +192,23 @@ class FullDependencyConsumer : public DependencyConsumer {
ContextHash = std::move(Hash);
}
+ void handleProvidedAndRequiredStdCXXModules(
+ std::optional<P1689ModuleInfo> Provided,
+ std::vector<P1689ModuleInfo> Requires) override {
+ ModuleName = Provided ? Provided->ModuleName : "";
----------------
naveen-seth wrote:
`ModuleName` stores the name of the exported standard C++ module.
After `takeTranslationUnitDeps()`, it is stored in the `TranslationUnitDeps.ID.ModuleName` field [(here)](
https://github.com/naveen-seth/llvm-project/blob/74772e0e1b54f8f2648c1bcc0311d3389156ab7c/clang/lib/Tooling/DependencyScanning/DependencyScanningTool.cpp#L174).
I don't think this should be dead code because it is used in `ClangScanDeps.cpp` when printing the `--experimental-full` format (first reassigned [here](https://github.com/naveen-seth/llvm-project/blob/4936fc5a5663717ef6f3617320875b07fa201304/clang/tools/clang-scan-deps/ClangScanDeps.cpp#L407C8-L407C19), then used for printing [here](https://github.com/naveen-seth/llvm-project/blob/4936fc5a5663717ef6f3617320875b07fa201304/clang/tools/clang-scan-deps/ClangScanDeps.cpp#L525-L526)).
Maybe it would improve clarity if we keep `ContextHash` and `ModuleName` together in a `ModuleID` field within `FullDependencyConsumer`, just as TranslationUnitDeps does, rather than keeping them ungrouped.
This would then directly lead people to the documentation of `ModuleID.ModuleName` [(here)](https://github.com/naveen-seth/llvm-project/blob/4936fc5a5663717ef6f3617320875b07fa201304/clang/include/clang/Tooling/DependencyScanning/ModuleDepCollector.h#L93).
https://github.com/llvm/llvm-project/pull/145221
More information about the cfe-commits
mailing list