[PATCH] D139168: [C++20] [Modules] [ClangScanDeps] Enable to print make-style dependency file within P1689 format (4/4)

Chuanqi Xu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Dec 5 21:27:35 PST 2022


ChuanqiXu added inline comments.


================
Comment at: clang/test/ClangScanDeps/P1689.cppm:155
 
+// CHECK-MAKE: [[PREFIX]]/impl_part.o:
+// CHECK-MAKE:   [[PREFIX]]/impl_part.cppm
----------------
ben.boeckel wrote:
> ben.boeckel wrote:
> > ChuanqiXu wrote:
> > > ben.boeckel wrote:
> > > > ChuanqiXu wrote:
> > > > > ben.boeckel wrote:
> > > > > > For scanning, this cannot be the object file. The output needs to be the P1689 output (or whatever the "main output" for the scanning rule is). This is the purpose behind the `-MT <target>` flag: to say what goes in this slot. I think it'll be necessary here (even if `clang-scan-deps` learns an `-o` flag because it is the build system that determines the "primary output").
> > > > > > 
> > > > > > I don't know if the `-MMD` and `-MD` differences are important or not; I don't think I particularly care which is default (I've used `-MD` FWIW), but it may matter for other situations.
> > > > > I am confused since the output `[[PREFIX]]/impl_part.o` is the same with `P1689` output `[[PREFIX]]/impl_part.o` and the one in the compilation database and the one specified in the command line option `--p1689-targeted-output`. What's the expected output for you in this case? (and the related command line input.)
> > > > P1689 is about specifying dependencies of *another* rule found by the dynamic content of some source. `-MF` is about *discovered* dependencies of *this* rule.
> > > hmmm sorry, I don't understand it a lot. May you explain your expectation in the form of the input and the corresponding output?
> > *This* rule outputs `foo.ddi` (in CMake terms). We need to tell make or ninja what files, if they change, *this* rule needs rerun for. That is what `-MF` is for. What I need is spelled `-MT` "normally".
> > 
> > P1689, what this rule is *doing*, is writing dependencies for the *compile* rule, so it is hooked up by *its output*. Two rules cannot have the same output, so P1689 and `-MF` have completely different things to put for their "output".
> > 
> > You can see here: https://gitlab.kitware.com/cmake/cmake/-/blob/master/.gitlab/ci/cxx_modules_rules_gcc.cmake where `-MT` gets the `<DYNDEP_FILE>` which is the `-fdep-file=` argument. `-fdep-file=` tells GCC what rule the P1689 itself is for.
> > -fdep-output= tells GCC what rule the P1689 itself is for.
> 
> Fixed.
Oh, I guess I get your point. Now we can set the output name with `-MT [[outputname]] -MD` in the input after `--`. See the above changes for example. Is this what you want?


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

https://reviews.llvm.org/D139168



More information about the cfe-commits mailing list