RE: clangd cannot handle tree_nocb.h

From: David Laight
Date: Thu Apr 20 2023 - 07:51:14 EST


From: Fangrui Song
> Sent: 19 April 2023 21:02
....
> Some information about Clang based language servers
>
> It's good practice to ensure that a header file is self-contained. If
> not, for example, if a.c includes a.h, which is not self-contained,
> a.h is generally compiled on its own (as if using clang [options] a.h)
> to confine diagnostics/completion results to a.h and not to other
> headers included by a.c.
>
> However, this design choice may cause language servers to emit
> diagnostics that you don't see when building the project.

That really doesn't work for .h files that contain program
generated data used to initialise arrays.

They may not even contain numbers, just references to
#defines that that including file is expected to define.

So there will always be .h files that are not compilable.

David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)