Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp8653594ybi; Thu, 6 Jun 2019 16:49:58 -0700 (PDT) X-Google-Smtp-Source: APXvYqwUW3ZV3wnWIHBq7JauH6xNVPE3ZJ0BAVc7DqpcCgRVVULGB5dBoJub2FaszmYCH83X9QUm X-Received: by 2002:a63:1316:: with SMTP id i22mr360547pgl.274.1559864998504; Thu, 06 Jun 2019 16:49:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559864998; cv=none; d=google.com; s=arc-20160816; b=JyaGeag53vjGNr2vi1bEHHCONNNfbpjjo5IPJdOLQzEpJiGG2H0A7y7H3ivUaYre8b 4QwF7Jw9iE5Y7L/QHxqH8zz1FPv21pkbBg2l+u61N20O1gF7qq607TI+by5LJS+QZTY5 gmyliXZgimBNB2mVLzjMJQvMv1a9tART+qA7VAzpEhmf5XgWHL3wzXvGnUfioyDnngeA VF4iW1bnOrGeyQDNXavzLfQ06PQhAJ8o6CYVgnZzvew9ull7sgvpSyBbxE4WmOhVHCZ2 6gKvWGig2xmfAiUIANjqr8DGl7IIHAhWHXEglGEbC+tJQcmE5/KVoTltlVlv1nXN0JeL aJ+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=YoJ3njYYHju4gWF0UDBaqx7cQlwNKwpKTA90sZyzSuQ=; b=pYp+lgfMIjCDZyemPCuayXUQs4czcPtdpvOMbWEW96xLWsBUlNWiYhkF0v8KXtKxot V2IDOj20EuFtB931vTm642b+VX6+JrpWEzJQdzx8T0lGa3PTVWzmBGYLF6S7AYvtmdWs Y1scnLm/NJFiGvzF9bJnewx4cjxuNnsM1W9WnQhYigAWxkm9DPr2bNKcNljuTFULevW5 3JPoLPQ91owxik7a/EA8WYFP+FIyDCYSOquiGgKoRWZ64RtC+m17JhKWOm4fTb9qU/6o L9vpIQDRbnNYISNOfTR1HUOkmDHVyUhYcETrkTorJ4F9Q4bVbrdM3AM4T1E23llI2Tui ACQw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=Nu7nnn9v; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x6si176231pfo.246.2019.06.06.16.49.29; Thu, 06 Jun 2019 16:49:58 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=Nu7nnn9v; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726917AbfFFUyL (ORCPT + 99 others); Thu, 6 Jun 2019 16:54:11 -0400 Received: from mail-pl1-f196.google.com ([209.85.214.196]:37112 "EHLO mail-pl1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726711AbfFFUyL (ORCPT ); Thu, 6 Jun 2019 16:54:11 -0400 Received: by mail-pl1-f196.google.com with SMTP id bh12so1394318plb.4 for ; Thu, 06 Jun 2019 13:54:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=YoJ3njYYHju4gWF0UDBaqx7cQlwNKwpKTA90sZyzSuQ=; b=Nu7nnn9vfPpPz7sJxzqHoDx7JUBZai+/vvUUZYEVShpjf+/WoIFd69vDm490dRtAIC 3/H83DydzDP+pAjIcUz9k3WNrfVW0HsVmlqELKBg8gnj0bRoyZo8MVo1UcJiTEVY2SI+ pnj0Drye6jfQILs7l22P2xML1Elc79OSNTLn4hgwyOo/QokPL2q6Bmp14mQsmpbNN7Rk iksow+4qEgKgcWET9s4ApvtocM1MVqaHqiuwD9GJmJEWAY6uTTDP42BEuTOpf9/+GPfL WWTAxu5+ByvouWksg97xH8Dg414XiC58pgwqSdUEyZHtgoUsqO/HF76Hq1EUCG95Cvh5 cbzw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=YoJ3njYYHju4gWF0UDBaqx7cQlwNKwpKTA90sZyzSuQ=; b=IyRDWQbWkGBbUFAjIvKtbm30ZhcZT5aYe0H1tMlPSmv/MjB+nWnlIUhFM9NfTue5Zq kLfdeDVrvpuk5tsgkNRWffxnDcDV2wbgsXZ2PhIbN+su35tabHogcESyfL1qVZcXkFVt KWNbTlYHg2LttKcND4kSwHOlToLviZNr5lKgVF1ND/QdgAObQuczTjTmCm5O8cAw6Qev hsZMBBL6FpNzjaOw4G3KN6RH0SHp0+vCz7fX5zeFshuVoQ9VgKM7B7VXawtL0um9H/90 nuygm67EBKExEsyJXp58f9yZlsgDbROCBMG12Tu4321h29gBEqWoBE32m37Ki+yYgMlJ wpDg== X-Gm-Message-State: APjAAAVVaMrPSmERWZGBlm2PX6Hc/2Kqeeiqxz9XVERNTZ9yWkGbU5D2 X7jodXuGg8eHJxz4530n4K5EmQ== X-Received: by 2002:a17:902:2ba9:: with SMTP id l38mr45854802plb.300.1559854450219; Thu, 06 Jun 2019 13:54:10 -0700 (PDT) Received: from google.com ([2620:0:1008:1100:dac3:f780:2846:b802]) by smtp.gmail.com with ESMTPSA id m5sm60680pgc.84.2019.06.06.13.54.09 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Thu, 06 Jun 2019 13:54:09 -0700 (PDT) Date: Thu, 6 Jun 2019 13:54:06 -0700 From: Tom Roeder To: Raul E Rangel Cc: yamada.masahiro@socionext.com, mka@chromium.org, ndesaulniers@google.com, zwisler@chromium.org, Joe Lawrence , Kees Cook , linux-kbuild@vger.kernel.org, Petr Mladek , linux-kernel@vger.kernel.org, Michal Marek , Andy Shevchenko , Changbin Du , Tetsuo Handa , Sri Krishna chowdary , Matthew Wilcox , Mikulas Patocka , Andrew Morton Subject: Re: [RFC PATCH] kbuild: Add option to generate a Compilation Database Message-ID: <20190606205406.GA120512@google.com> References: <20190606203003.112040-1-rrangel@chromium.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190606203003.112040-1-rrangel@chromium.org> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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