[PATCH] D137534: [C++20] [Modules] [ClangScanDeps] Allow clang-scan-deps to without specified compilation database in P1689 (3/4)

Ben Boeckel via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jan 4 06:26:45 PST 2023


ben.boeckel added a comment.

In D137534#4024249 <https://reviews.llvm.org/D137534#4024249>, @jansvoboda11 wrote:

> I'm getting confused by the semantics of `--p1689-targeted-output=`. In D137527 <https://reviews.llvm.org/D137527>, it's used to populate `CompilerCommand::Output` which is supposed to be the main compiler output (`.o` file). Is that correct? If that's not the case and this flag is supposed to only control where to put the JSON file with the dependency information, it might as well have more generic name, like `-o` or `--output` and apply to the rest of `clang-scan-deps`, no?

So the scanner has a few jobs:

- given this command line for this object file (we do not think in terms of source files because object files are unique; source files can be reused with different flags), please write out a P1689 <https://reviews.llvm.org/P1689> file describing the module requirements and any module(s) provided (plural because Fortran supports multiple modules in a single source file and unity builds can also do this though I have no idea how likely unity module builds is ever going to be)
- the format supports doing this for a set of object files (but given the way it tangles the dep graph, is unlikely to be a perf win for incremental/developer builds; CI may prefer it, but that can be future work)
- because it is a rule that can itself read extra files that affect the scanning; this is the `-MF`-style output so that make/ninja can know "oh, frabnitz.h changed, it can affect the scan results in glom.ddi, so I will rescan")

Note that multi-arch builds are an open question (just like multi-arch `.pcm` files are I believe); the format could support it as two reports on provides/reqs, but the merged object file complicates things.

The object can be obtained from the `-o` on the command line, but the rest is "lying" if it is extracted from the clang command line and not given to `clang-scan-deps` directly. This paper may be useful for the overall strategy being used here: https://mathstuf.fedorapeople.org/fortran-modules/fortran-modules.html


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D137534/new/

https://reviews.llvm.org/D137534



More information about the cfe-commits mailing list