This is an archive of the discontinued LLVM Phabricator instance.

[lldb] Allow limiting the number of error diagnostics when parsing an expression
ClosedPublic

Authored by teemperor on Oct 6 2020, 5:34 AM.

Details

Summary

While debugging another bug I found out that we currently don't set any limit for the
number of diagnostics Clang emits. If a user does something that generates a lot of
errors (like including some long header file from within the expression function), then
we currently spam the LLDB output with potentially thousands of Clang error diagnostics.

Clang sets a default limit of 20 errors, but given that LLDB is often used interactively
for small expressions I would say a limit of 5 is enough. The limit is implemented as a
setting, so if a user cares about seeing having a million errors printed to their terminal
then they can just increase the settings value.

Diff Detail

Event Timeline

teemperor requested review of this revision.Oct 6 2020, 5:34 AM
teemperor created this revision.
mib accepted this revision.Oct 6 2020, 5:50 AM

LGTM! Have you considered also adding an option to the expression command object ? May be some people would like to change the error limit for a specific expression...

This revision is now accepted and ready to land.Oct 6 2020, 5:50 AM
mib added inline comments.Oct 6 2020, 5:51 AM
lldb/include/lldb/Target/Target.h
176

Nit: Could you rename this to GetExpressionErrorLimit to stay consistent with the previous method ?

In D88889#2314156, @mib wrote:

LGTM! Have you considered also adding an option to the expression command object ? May be some people would like to change the error limit for a specific expression...

I think that would also work. Not sure if we really have a pattern for whether an option should be a setting or not, but I usually add really obscure options that 99.99% of users never change to the settings. Mostly because this way they don't clutter the expr help page (which is already huge) and we don't have to add all the respective code permanently to SWIG/SBExpressionOptions/ExpressionOption.

shafik accepted this revision.Oct 6 2020, 9:31 AM

LGTM

Herald added a project: Restricted Project. · View Herald TranscriptOct 13 2020, 8:13 AM