From: | Peter Eisentraut <peter(at)eisentraut(dot)org> |
---|---|
To: | Peter Geoghegan <pg(at)bowt(dot)ie> |
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-22 14:08:18 |
Message-ID: | 97ca4166-e858-4ac1-8abf-95c790b1a768@eisentraut.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On 15.01.25 20:51, Peter Geoghegan wrote:
> 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?
I had turned automatic header insertion off until now and didn't think
to turn it back on yet. I'll give it another try sometime.
I'm unclear on what role clang-tidy would play in this.
From | Date | Subject | |
---|---|---|---|
Next Message | Yura Sokolov | 2025-01-22 14:09:19 | Re: [RFC] Lock-free XLog Reservation from WAL |
Previous Message | Aleksander Alekseev | 2025-01-22 14:05:01 | Re: [PATCH] Improve code coverage of network address functions |