[clangd-dev] ClangD - Dropped Diagnostic Outside of main file.

Sam McCall via clangd-dev clangd-dev at lists.llvm.org
Mon Aug 13 07:32:54 PDT 2018

+clangd-dev at lists.llvm.org
On Fri, Aug 10, 2018 at 12:13 AM Dan Walmsley <dan at walms.co.uk> wrote:

> Hi, I hope you dont mind me contacting you directly.
I don't mind at all, but I'm out on parental leave so can't give this the
attention it deserves. Adding the dev list.

> https://github.com/llvm-mirror/clang-tools-extra/blame/86961faaaf0b56b1c5dac2ed979987879cbc5294/clangd/Diagnostics.cpp#L376
> I am integrating ClangD with an open source IDE. I have come across a
> minor issue, but its most likely my inexperience with clangd.
> So if I have a file that includes another file and that file has an
> include that cant be found, the diagnostics for that missing include get
> dropped.
> How would I be able to indicate to the users that there is a missing
> include file, or get hold of the dropped diagnostic without the user having
> to open that file first?
So if we're dropping the "foo.h was not found" diagnostic when the missing
file is directly included by the active file, this is just a bug we should
fix. (I seem to recall this might be happening, at least in some

For diagnostics that occur in other files, we do currently just drop them,
but we should do something smarter. (This includes transitive includes like
main.cc -> foo.h -> bar.h where bar.h is missing, but also if foo.h has a
syntax error).

I'd suggest we synthesize a diagnostic at the #include site that says
something like:

> Included file had errors:
> foo.h:21: Missing ';'
> foo.h:43: No such member 'qux', did you mean 'quux'
> ...

What do you think?
(And anyone on clangd-dev want to take this up before I get back to work?)

Any hints or advice is greatly appreciated.
> Many Thanks
> Dan - working on AvalonStudio http://github.com/VitalElement/AvalonStudio
Hadn't heard about AvalonStudio, will check it out!
Please hit up clangd-dev if we can help!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/clangd-dev/attachments/20180813/b4424921/attachment.html>

More information about the clangd-dev mailing list