[cfe-dev] Linux kernel compile_commands.json

Tom Roeder via cfe-dev cfe-dev at lists.llvm.org
Wed Mar 6 10:52:07 PST 2019


FYI, I have been working on using clang LibTooling on the Linux kernel.

A couple of months ago, I wrote a script that generates
compile_commands.json directly from the output of the Linux KBuild system
and committed it to the Linux kernel source tree as
scripts/gen_compile_commands.py.

I've been using this script and its output successfully ever since to run
LibTooling-based tools on the kernel, including the static analyzer, clangd
(through Vim), analyze-build (for creating the AST files for cross-TU
static analysis), etc. This was also the motivation for my recent AST patch
(r354916) to handle GNU ChooseExpr.

Those who are looking to use clang tools on the Linux kernel can see the
upstream source (scripts/gen_compile_commands.py:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=b30204640192234d18f9168f19f9cd693485b86d
).
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20190306/d1dcc0a8/attachment.html>


More information about the cfe-dev mailing list