[cfe-dev] Create compile_commands.json directly

Csaba Raduly via cfe-dev cfe-dev at lists.llvm.org
Mon Dec 27 13:49:29 PST 2021


Hi David,
Are you thinking about -MJ ?
(https://clang.llvm.org/docs/ClangCommandLineReference.html#dependency-file-generation)

Csaba

On Mon, 27 Dec 2021 at 21:14, David Butler via cfe-dev
<cfe-dev at lists.llvm.org> wrote:
>
> 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
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev



-- 
You can get very substantial performance improvements
by not doing the right thing. - Scott Meyers, An Effective C++11/14 Sampler
So if you're looking for a completely portable, 100% standards-conformant way
to get the wrong information: this is what you want. - Scott Meyers (C++TDaWYK)


More information about the cfe-dev mailing list