public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Tom Roeder <tmroeder@google.com>
To: Raul E Rangel <rrangel@chromium.org>
Cc: yamada.masahiro@socionext.com, mka@chromium.org,
	ndesaulniers@google.com, zwisler@chromium.org,
	Joe Lawrence <joe.lawrence@redhat.com>,
	Kees Cook <keescook@chromium.org>,
	linux-kbuild@vger.kernel.org, Petr Mladek <pmladek@suse.com>,
	linux-kernel@vger.kernel.org,
	Michal Marek <michal.lkml@markovi.net>,
	Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	Changbin Du <changbin.du@intel.com>,
	Tetsuo Handa <penguin-kernel@i-love.sakura.ne.jp>,
	Sri Krishna chowdary <schowdary@nvidia.com>,
	Matthew Wilcox <willy@infradead.org>,
	Mikulas Patocka <mpatocka@redhat.com>,
	Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [RFC PATCH] kbuild: Add option to generate a Compilation Database
Date: Thu, 6 Jun 2019 13:54:06 -0700	[thread overview]
Message-ID: <20190606205406.GA120512@google.com> (raw)
In-Reply-To: <20190606203003.112040-1-rrangel@chromium.org>

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 https://clang.llvm.org/docs/HowToSetupToolingForLLVM.html for more
> information.

I'm glad to see someone adding this to the Makefile directly. I added
scripts/gen_compile_commands.py 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
it.

> 
> Normally cmake is used to generate the compilation database, but the
> linux kernel uses make. Another option is using
> [BEAR](https://github.com/rizsotto/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. https://reviews.llvm.org/D27140
> 
> 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?

Tom

  reply	other threads:[~2019-06-06 20:54 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-06 20:30 [RFC PATCH] kbuild: Add option to generate a Compilation Database Raul E Rangel
2019-06-06 20:54 ` Tom Roeder [this message]
2019-06-06 23:40   ` Nick Desaulniers
2019-06-07 15:32     ` Tom Roeder
2019-06-18 15:16 ` Masahiro Yamada

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190606205406.GA120512@google.com \
    --to=tmroeder@google.com \
    --cc=akpm@linux-foundation.org \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=changbin.du@intel.com \
    --cc=joe.lawrence@redhat.com \
    --cc=keescook@chromium.org \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=michal.lkml@markovi.net \
    --cc=mka@chromium.org \
    --cc=mpatocka@redhat.com \
    --cc=ndesaulniers@google.com \
    --cc=penguin-kernel@i-love.sakura.ne.jp \
    --cc=pmladek@suse.com \
    --cc=rrangel@chromium.org \
    --cc=schowdary@nvidia.com \
    --cc=willy@infradead.org \
    --cc=yamada.masahiro@socionext.com \
    --cc=zwisler@chromium.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox