[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
Tue Jan 3 19:06:15 PST 2023
ChuanqiXu added a comment.
> 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?
Correct. The semantics of `--p1689-targeted-output=` should be the same with the main compiler output (.o file).
> If we really want to avoid writing compilation databases, I think that clang-scan-deps -format=p1689 -- <clang_flags> -std=c++20 <input> -o <output> is much cleaner/generic/reusable than clang-scan-deps -format=p1689 --p1689-targeted-file-name=<input> --p1689-targeted-output=<output> -- <clang_flags> -std=c++20. I understand that FixedCompilationDatabase currently doesn't know what the input/output is unless you explicitly pass that in. What if we were able to construct some kind of CompilationDatabase by properly parsing the given complete command line into CompilerInvocation and poking at FrontendOptions?
I was worrying about the complexity and I wanted to reuse FixedCompilationDatabase. I'd like to see if we can implement it simply.
> You still need to know where to put the P1689 <https://reviews.llvm.org/P1689> output and where the make-style dependency info for files read during the scan need to go. I see these as distinctly clang-scan-deps flags and should be *before* the --. Basically, it seems weird to me to have the clang flags end up telling the scanner where to put the -MF info (as it is now, but you want even fewer flags which I don't think is workable as the information just isn't there).
Do you think it is OK to write: `clang-scan-deps -format=p1689 -- clang++ -std=c++20 -MD -MT <target_name> -MF <dep_file> -c input_file <any_other_needed_opts> -o output_file`?
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D137534/new/
https://reviews.llvm.org/D137534
More information about the cfe-commits
mailing list