[cfe-dev] Create compile_commands.json directly

David Butler via cfe-dev cfe-dev at lists.llvm.org
Mon Dec 27 12:13:53 PST 2021


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:
https://llvm.discourse.group/t/create-compile-commands-json-directly/5063


More information about the cfe-dev mailing list