[clangd-dev] Disabling automatic insertion of include

Doug Schaefer via clangd-dev clangd-dev at lists.llvm.org
Fri Apr 12 08:28:55 PDT 2019

Can we at least make it less aggressive? I'm working on a GTK app and it keeps inserting includes when I already have the symbols available to me through a different one. Or is that the intent?


On Thu, 2019-04-11 at 10:48 +0200, Ilya Biryukov via clangd-dev wrote:
We actually have something very similar implemented in the code ("clangd/CanonicalIncludes.h"), but we don't support the IWYU mapping file format.
I'm not sure how much work implementing that is, though.

On Wed, Apr 10, 2019 at 11:28 PM Simon Marchi via clangd-dev <clangd-dev at lists.llvm.org<mailto:clangd-dev at lists.llvm.org>> wrote:
On 2019-04-10 4:23 a.m., Ilya Biryukov wrote:
> FWIW, having a mapping for libraries like glib seems useful even if they do get patched to add IWYU pragmas.
> There always a rather large amount of older versions floating around...
> Sam McCall via clangd-dev <clangd-dev at lists.llvm.org<mailto:clangd-dev at lists.llvm.org> <mailto:clangd-dev at lists.llvm.org<mailto:clangd-dev at lists.llvm.org>>> schrieb am Mi., 10. Apr. 2019, 09:22:
>     I'm a little hesitant to mention this, as it's a bit of a pandora's box, but...
>     If it's hard to get prominent libraries like glib patched, we could have a lookup table, and pretend we saw such directives...

IWYU seems to support the equivalent of pragmas, but specified outside the headers,
and calls that "Mappings":


It would probably be possible to write such a mapping file for a specific version of the glib
library.  Then, it would be a matter of making clangd read and respect those, like it would
respect the pragmas.  But it would be the user's responsibility to configure that properly.

As sugar on top, clangd could always ship with some built-in IWYU mapping files contributed
by the community (is there a repository of such files for various libraries somewhere?).  I
am not sure though how it would identify that a certain library is in use (and which version)
to load the appropriate mapping file.

clangd-dev mailing list
clangd-dev at lists.llvm.org<mailto:clangd-dev at lists.llvm.org>


clangd-dev mailing list

clangd-dev at lists.llvm.org<mailto:clangd-dev at lists.llvm.org>


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/clangd-dev/attachments/20190412/393c6676/attachment.html>

More information about the clangd-dev mailing list