From: | Peter Geoghegan <pg(at)bowt(dot)ie> |
---|---|
To: | Peter Eisentraut <peter(at)eisentraut(dot)org> |
Cc: | pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Subject: | Re: IWYU annotations |
Date: | 2025-01-15 19:51:23 |
Message-ID: | CAH2-Wznps81j08_R86q7m=96a7T4UNK3QBZe-Xz5jwd==GE6rQ@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Wed, Jan 15, 2025 at 2:21 PM Peter Eisentraut <peter(at)eisentraut(dot)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
From | Date | Subject | |
---|---|---|---|
Next Message | Melanie Plageman | 2025-01-15 20:03:09 | Re: Eagerly scan all-visible pages to amortize aggressive vacuum |
Previous Message | Nathan Bossart | 2025-01-15 19:47:18 | Re: convert libpgport's pqsignal() to a void function |