[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <D37UCSKCEVI5.100JF8WJR9DNY@bootlin.com>
Date: Mon, 05 Aug 2024 10:39:40 +0200
From: Théo Lebrun <theo.lebrun@...tlin.com>
To: "Masahiro Yamada" <masahiroy@...nel.org>
Cc: "Nathan Chancellor" <nathan@...nel.org>, "Nicolas Schier"
<nicolas@...sle.eu>, "Nick Desaulniers" <ndesaulniers@...gle.com>, "Bill
Wendling" <morbo@...gle.com>, "Justin Stitt" <justinstitt@...gle.com>,
<llvm@...ts.linux.dev>, <linux-kbuild@...r.kernel.org>,
<linux-kernel@...r.kernel.org>, "Thomas Petazzoni"
<thomas.petazzoni@...tlin.com>
Subject: Re: [PATCH] scripts: run-clang-tools: add file filtering option
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@...tlin.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
Powered by blists - more mailing lists