From: "Théo Lebrun" <theo.lebrun@bootlin.com>
To: "Masahiro Yamada" <masahiroy@kernel.org>
Cc: "Nathan Chancellor" <nathan@kernel.org>,
"Nicolas Schier" <nicolas@fjasle.eu>,
"Nick Desaulniers" <ndesaulniers@google.com>,
"Bill Wendling" <morbo@google.com>,
"Justin Stitt" <justinstitt@google.com>, <llvm@lists.linux.dev>,
<linux-kbuild@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
"Thomas Petazzoni" <thomas.petazzoni@bootlin.com>
Subject: Re: [PATCH] scripts: run-clang-tools: add file filtering option
Date: Mon, 05 Aug 2024 10:39:40 +0200 [thread overview]
Message-ID: <D37UCSKCEVI5.100JF8WJR9DNY@bootlin.com> (raw)
In-Reply-To: <CAK7LNARmV89PJV3sd93WwqLLQD0fg9mBOMetzECLriF8295zVA@mail.gmail.com>
Hello Masahiro,
On Sat Aug 3, 2024 at 10:42 AM CEST, Masahiro Yamada wrote:
> On Thu, Jul 4, 2024 at 6:28 PM Théo Lebrun <theo.lebrun@bootlin.com> wrote:
> > +def filter_entries(datastore, filters):
> > + for entry in datastore:
> > + if filters == []:
> > + yield entry
> > + continue
>
> Maybe, this can be checked on the caller side.
> (Note, I did not test this at all)
>
> if args.file_filter:
> datastore = filter_entries(datastore, args.file_filter)
Agreed.
> > +
> > + assert entry['file'].startswith(entry['directory'])
> > + # filepath is relative to the directory, to avoid matching on the absolute path
>
> Does this assertion work with the separate output directory
> (O= option)?
>
> Just try this command:
>
> $ make LLVM=1 O=/tmp/foo clang-tidy
Indeed this does not work. It requires some changes to Makefiles to see
that it does not work, as this assertion is only used when a filter is
passed (which current cmd_clang_tools cannot do).
What would you recommend to fix that? If we take the first entry:
{
"command": "clang ...",
"directory": "/tmp/foo",
"file": "/ABSOLUTE/PATH/linux-clang-tidy/arch/mips/crypto/crc32-mips.c"
},
I don't see an easy way to know that "/ABSOLUTE/PATH/linux-clang-tidy/"
should be removed. We could probably compute it from the command value
but that isn't a great way forward.
There are some entries that look like this. Those are easy to deal with.
{
"command": "clang ...",
"directory": "/tmp/foo",
"file": "/tmp/foo/drivers/tty/vt/defkeymap.c"
}
Regards,
--
Théo Lebrun, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
next prev parent reply other threads:[~2024-08-05 8:41 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-04 9:28 [PATCH] scripts: run-clang-tools: add file filtering option Théo Lebrun
2024-08-02 22:35 ` Nathan Chancellor
2024-08-03 9:16 ` Masahiro Yamada
2024-08-05 8:12 ` Théo Lebrun
2024-08-03 8:42 ` Masahiro Yamada
2024-08-05 8:39 ` Théo Lebrun [this message]
2024-08-06 9:49 ` 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=D37UCSKCEVI5.100JF8WJR9DNY@bootlin.com \
--to=theo.lebrun@bootlin.com \
--cc=justinstitt@google.com \
--cc=linux-kbuild@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=llvm@lists.linux.dev \
--cc=masahiroy@kernel.org \
--cc=morbo@google.com \
--cc=nathan@kernel.org \
--cc=ndesaulniers@google.com \
--cc=nicolas@fjasle.eu \
--cc=thomas.petazzoni@bootlin.com \
/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