[lkml]   [2019]   [Jun]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [RFC PATCH] kbuild: Add option to generate a Compilation Database
On Thu, Jun 06, 2019 at 02:30:03PM -0600, Raul E Rangel wrote:
> Clang tooling requires a compilation database to figure out the build
> options for each file. This enables tools like clang-tidy and
> clang-check.
> See for more
> information.

I'm glad to see someone adding this to the Makefile directly. I added
scripts/ in b302046 (in Dec 2018) when I was
working on using clang-check to look for bugs in KVM. That script
sidesteps the -MJ option because I found that trying to add it as an
extra option ended up adding entries to the database that didn't work
properly in some cases. This patch adds -MJ in a different way than I
was trying, so I hope it doesn't have the same problems.

I would much prefer to have this functionality integrated into the
Makefile system directly, so if this works with clang-check over all
files and doesn't lead to spurious entries in the database, I'm all for

> Normally cmake is used to generate the compilation database, but the
> linux kernel uses make. Another option is using
> [BEAR]( which instruments
> exec to find clang invocations and generate the database that way.
> Clang 4.0.0 added the -MJ option to generate the json for each
> compilation unit.
> This patch takes advantage of the -MJ option. So it only works for
> Clang.
Can you please add details about how this was tested and compare
coverage with the existing script?


 \ /
  Last update: 2019-06-06 22:55    [W:0.079 / U:44.600 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site