Create compile_commands.json directly

I think it would be really cool if clang could output the
compile_commands.json directly, without having to use some
extra/external tool (like bear/ninja…) so, like what do people think
about a patch that that took a .json file as input, and would update
with the current job? The idea would be that this would be a good fit
for small scale usage…

Perhaps a bit more engineered solution would be to embed all the
needed information as debug info in the object file, and then the
linker does the work of updating any compile_commands.json files?

Or maybe another thing that could be done is something like the -MD
option, where a bunch of individual files get made for each
invocation, and then, later, a compile_commands.json file can be made
by concatenating all the individual files together…

Anyway, I’m looking forward to hearing other people’s thoughts on this

Also, I wasn't sure what was the best forum for this discussion, so I
have copied this here:

Hi David,
Are you thinking about -MJ ?


yes, thanks for highlighting that, I overlooked that in the documentation