[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 08:37:24 PST 2018


tmroeder added a comment.

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

> I don't understand the point here. Why would you want to include pre-processing-only commands in the compilation database?


Sorry for not being clear enough.

I don't want to include entries with -E. However, in the Linux kernel build, some build commands with -E occur after the regular build step, and that means that without the append option, the output .json file for those objects gets overwritten with a useless entry.

I originally thought that the simplest fix was to add a flag that appended to a json file instead of overwriting it. However, thinking about it some more, it would be nice if DumpCompilationDatabase refused to write such entries, since then I wouldn't care about the append version of this flag. I could drop the rest of this code (and fix the tests) if I could instead add the following after the check for -### at the top of DumpCompilationDatabase.

  if (C.getArgs().hasArg(options::OPT_E))
    return;

What do you think? I don't want to break anyone who depends on the current behavior of -MJ, but I think it's reasonable for DumpCompilationDatabase to output only entries it can use.


Repository:
  rC Clang

https://reviews.llvm.org/D54657





More information about the cfe-commits mailing list