ChuanqiXu added a comment.

In D139168#4026799 <https://reviews.llvm.org/D139168#4026799>, @ben.boeckel 
wrote:

> In D139168#4025277 <https://reviews.llvm.org/D139168#4025277>, @ChuanqiXu 
> wrote:
>
>> Currently we will detect `-MF` in the command line and we will write the 
>> make-format dependency output to the corresponding file once we find `-MF`.
>
> Which is fine, but docs need to mention that some clang-looking flags are 
> actually for `clang-scan-deps` and that, as such, these flags cannot just be 
> grabbed blindly from a compilation database.

Sure, agreed. I'll add docs for the series patches once they got accepted 
(otherwise we might do many useless works).

> When using clang-scan-deps with a compdb with multiple command lines, which 
> depfile path will it use? Or must all agree on the same path and options? 
> Because there should be a single one for all scanning that is performed 
> (e.g., in batch mode).

Currently, clang-scan-deps won't check for this. If we have multiple command 
lines with different `-MF` value, the make-style dependency information will be 
written to these different depfiles. If all the command lines use the same 
depfile, then the make-style dependency information will be written to the 
depfile. (BTW, We have a lock for this so we don't need to worry about data 
racing).

> Is this really simpler than just adding -MF and friends to clang-scan-deps 
> directly?

Personally, I feel the complexity of both methods are acceptable. I rewrite the 
patch since it looks like @jansvoboda11 don't like to add new command line 
options to clang-scan-deps.

I feel like we have 2 (or 3) options

1. (The current way) Extract `-MF` in the command line of clang (from 
compilation database or from the args after `--`)
2. (The original way) Specify `-MF` in the command line of clang-scan-deps.
3. (Not good) Do nothing. I feel like it is possible for build systems to get 
the make-style dependency information by scanning twice. One for P1689 
<https://reviews.llvm.org/P1689> format and one for make-format. It may be 
workable but it sounds a little bit silly.

Personally, I feel the first (current) style is cleaner.

> I'll note that I'm becoming more and more convinced that 
> `compilation_database.json` is being abused for this as we are quite 
> contorting it from its intended use case: listing the command lines to 
> compile sources. Instead, we are using it as a source of *related* 
> information that differs from the *real* command line in some important ways. 
> Namely:
>
> - dependency information extraction is re-used and therefore must be 
> different from the *real* command
> - module information must be missing from the scanning command line as it 
> cannot be known at this point as scanning is used to discover those flags in 
> the first place (usually a response file)

Agreed. But this may beyond the scope of the current patch.


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

https://reviews.llvm.org/D139168

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to