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

Chuanqi Xu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 9 23:13:37 PST 2023


ChuanqiXu marked 3 inline comments as done.
ChuanqiXu added a comment.

> I originally investigated (and ended up lost) for something like GCC where P1689 <https://reviews.llvm.org/P1689> information is extracted via -E -fdep-file=p1689.json -fdep-output=module.o -fdep-format=p1689 (which is "abusing" -E, but works), but using clang-scan-deps was where we ended up after a more-knowledgeable LLVM developer took over knowing what needed to be done.

Yeah, I believe the clang-scan-deps would be the better option and according to the talk of `clang-scan-deps` (https://llvm.org/devmtg/2019-04/slides/TechTalk-Lorenz-clang-scan-deps_Fast_dependency_scanning_for_explicit_modules.pdf), it is also the goal of `clang-scan-deps` to support c++20 modules.



================
Comment at: clang/test/ClangScanDeps/P1689.cppm:11
+// RUN: clang-scan-deps -format=p1689 \
+// RUN:   -- %clang++ -std=c++20 -c -fprebuilt-module-path=%t %t/M.cppm -o %t/M.o \
+// RUN:   | FileCheck %t/M.cppm -DPREFIX=%/t
----------------
jansvoboda11 wrote:
> I'm fairly happy with the `clang-scan-deps` interface now (besides the performance aspect mentioned in another comment).
> 
> @ChuanqiXu what would happen if you run this Clang command line directly?
> what would happen if you run this Clang command line directly?

I remember this refers to `%clang++ -std=c++20 -c -fprebuilt-module-path=%t %t/M.cppm -o %t/M.o` previously. 

And if we run this clang command line directly, it will compile the module-unit `M.cppm` into object files if all its dependent precompiled module files lives in the directory `%t`. The command line should be what will run actually.


================
Comment at: clang/test/ClangScanDeps/P1689.cppm:9
+//
+// Check the seperated dependency format.
+// RUN: clang-scan-deps -format=p1689 --p1689-targeted-file-name=%t/M.cppm --p1689-targeted-output=%t/M.o \
----------------
jansvoboda11 wrote:
> ben.boeckel wrote:
> > jansvoboda11 wrote:
> > > What does "separated" mean in this context?
> > Yeah, this isn't the right term. There are two things being done:
> > 
> > - discovering dependencies for a future compile (P1689)
> > - collecting deps for the scanning itself to know that "if included file X changes, I need to rescan"
> > 
> > Both are required for correct builds.
> @ChuanqiXu Can you write up a better comment here?
I've updated the comments to tell it is required for non-exist and potentially out-of-date files.


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

https://reviews.llvm.org/D137534



More information about the cfe-commits mailing list