<div dir="ltr"><div dir="ltr"><div>FYI, I have been working on using clang LibTooling on the Linux kernel.</div><div><br></div><div>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.</div><div><br></div><div>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.</div><div><br></div><div>Those who are looking to use clang tools on the Linux kernel can see the upstream source (scripts/gen_compile_commands.py: <a href="https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=b30204640192234d18f9168f19f9cd693485b86d">https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=b30204640192234d18f9168f19f9cd693485b86d</a>).</div></div></div>