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

Ilya Biryukov via clangd-dev clangd-dev at lists.llvm.org
Mon Aug 13 10:51:41 PDT 2018


It should be a pretty small and localized change.
Clang has an API for consuming diagnostics and our consumer code is in
Diagnostics.cpp, most of the work is done in the HandleDiagnostic
<https://github.com/llvm-mirror/clang-tools-extra/blob/43afd58496558a361d360325743ee86c4f70569f/clangd/Diagnostics.cpp#L278>
 function.
The code there shouldn't be too hard to follow, and feel free to contact us
if you run into any problems.

The LLVM's Getting Started Guide <https://llvm.org/docs/GettingStarted.html>
is a good place to start if you haven't done any LLVM development before.

--
Regards,
Ilya Biryukov


пн, 13 авг. 2018 г. в 19:41, Dan Walmsley via clangd-dev <
clangd-dev at lists.llvm.org>:

> I could try, but someone would have to tell me where to look in the code,
> im so new to clang, llvm, etc I might be a little out of my depth 😊
>
>
>
> If this is a small change I could probably tackle it, any pointers ?
>
>
>
> Sent from Mail <https://go.microsoft.com/fwlink/?LinkId=550986> for
> Windows 10
>
>
> ------------------------------
> *From:* Ilya Biryukov <ibiryukov at google.com>
> *Sent:* Monday, August 13, 2018 4:42:58 PM
> *To:* Sam McCall
> *Cc:* dan at walms.co.uk; clangd-dev at lists.llvm.org
> *Subject:* Re: [clangd-dev] ClangD - Dropped Diagnostic Outside of main
> file.
>
> Hi Dan, Sam,
>
> Synthesizing the diagnostics sounds good!
> Also agree we should summarize all diags coming from the include in a
> single message to avoid potentially reporting a hundred diags at the same
> line.
> Please also note that we can't catch any errors in function bodies, since
> we skip those. That's one of the reasons we don't report diags from other
> files now - we just can't do it reliably.
>
> Missing files are actually the most common source of inconsistencies in
> the current file, though, reporting them is definitely the right thing to
> do!
> Dan, would you be interested in coming up with a patch to fix this? We're
> always happy to get new contributions.
>
> On Mon, Aug 13, 2018 at 4:37 PM Sam McCall via clangd-dev <
> clangd-dev at lists.llvm.org> wrote:
>
>> +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
>>> <https://nam01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fllvm-mirror%2Fclang-tools-extra%2Fblame%2F86961faaaf0b56b1c5dac2ed979987879cbc5294%2Fclangd%2FDiagnostics.cpp%23L376&data=02%7C01%7C%7C075d21f397cf4eb41cb908d601337975%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636697717921551196&sdata=j7Vra%2Bo6iFp%2B%2FPolZuCY%2FQ9uC4bEsn%2Fxn4wGdhsHoog%3D&reserved=0>
>>> 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
>> situations).
>>
>> 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
>>> <https://nam01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fgithub.com%2FVitalElement%2FAvalonStudio&data=02%7C01%7C%7C075d21f397cf4eb41cb908d601337975%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636697717921551196&sdata=n50jsSh86WxnDXZyOWQSOWipimPcPS3puCqM5ABN0%2Bg%3D&reserved=0>
>>>
>> Hadn't heard about AvalonStudio, will check it out!
>> Please hit up clangd-dev if we can help!
>> _______________________________________________
>> clangd-dev mailing list
>> clangd-dev at lists.llvm.org
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/clangd-dev
>> <https://nam01.safelinks.protection.outlook.com/?url=http%3A%2F%2Flists.llvm.org%2Fcgi-bin%2Fmailman%2Flistinfo%2Fclangd-dev&data=02%7C01%7C%7C075d21f397cf4eb41cb908d601337975%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636697717921551196&sdata=gChHsh22mty8%2Fyxd%2Bn%2FBpzQJkr7FVD6TyEedmKnQVsc%3D&reserved=0>
>>
>
>
> --
> Regards,
> Ilya Biryukov
> _______________________________________________
> clangd-dev mailing list
> clangd-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/clangd-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/clangd-dev/attachments/20180813/05bbf4b4/attachment.html>


More information about the clangd-dev mailing list