Re: IWYU annotations

Поиск
Список
Период
Сортировка
От Peter Geoghegan
Тема Re: IWYU annotations
Дата
Msg-id CAH2-Wznps81j08_R86q7m=96a7T4UNK3QBZe-Xz5jwd==GE6rQ@mail.gmail.com
обсуждение исходный текст
Ответ на Re: IWYU annotations  (Peter Eisentraut <peter@eisentraut.org>)
Ответы Re: IWYU annotations
Список pgsql-hackers
On Wed, Jan 15, 2025 at 2:21 PM Peter Eisentraut <peter@eisentraut.org> wrote:
> I have committed this.  Thanks for the feedback.

Thanks for working on this.

Is it worth documenting how to get clangd working sensibly with
"--header-insertion=iwyu"?

I enabled it just now. I find that I can now use completion with a
type name, and have clangd automatically include the necessary header
file. For example, if I use completion to pull in a "StringInfoData" I
find that clangd will automatically add the necessary #include
"lib/stringinfo.h", without any special directions from me -- no
context switching required. Importantly, now that we have these
annotations, clangd won't constantly be adding useless includes that
actually come from c.h -- that made IWYU header cleaning unusable
before now.

Note that I'm relying on my clang-tidy config for this. clangd is able
to respect our conventions around headers through clang-tidy, which
has been taught Postgres-specific rules around header conventions. So
we'd actually be documenting something about clang-tidy + clangd +
Postgres header conventions, if we went through with something like
this.

It might be worth holding off for now. It's possible that I'll find
--header-insertion=iwyu has big problems in some unforeseen way. But
offhand it looks like a real improvement, even though I foresee
certain minor downsides. What do you think?

--
Peter Geoghegan



В списке pgsql-hackers по дате отправления: