[PATCH] D54657: [clang] Add -MJJ for appending to compilation databases.

Tom Roeder via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 19 13:43:00 PST 2018


tmroeder added a comment.

In https://reviews.llvm.org/D54657#1303320, @joerg wrote:

> I'm sorry, but it still sounds to me like you want to address badly written build rules by making the driver more complicated. I don't see that is a reasonable goal forward.


My goal is to build a compilation database for the Linux kernel so that I can use clang's excellent libTooling-based tools on it. I would like very much to do this in the least intrusive way possible both for the kernel and clang.

I also really like the -MJ flag, since I find it natural to ask the compiler to output a compilation database entry rather than depending on external tools. So, thank you for adding it.

Based on your feedback, I'm looking more deeply into the rules of the Linux Kbuild system to see if I can modify anything there. Preventing the -MJ flag from being passed to the -E invocations would prevent spurious entries from overwriting the entries that I need.

I think there's still an argument to be made for the code at hand, however, even though I understand that adding the check for -E adds code, hence makes the driver more complicated. In particular, I would argue that DumpCompilationDatabase should not output entries from pre-processing-only runs, since it appears to me that the other tools can't use those entries as input.

I've updated the patch to add only this check and tests now. Does this seem reasonable to you?


Repository:
  rC Clang

https://reviews.llvm.org/D54657





More information about the cfe-commits mailing list