[cfe-dev] -ferror-limit=1 by default?
David Chisnall via cfe-dev
cfe-dev at lists.llvm.org
Fri Nov 8 00:12:15 PST 2019
On 07/11/2019 18:23, Eric Christopher via cfe-dev wrote:
> Hi All!
> Replying to John here on twitter:
> where he was noticing the helpfulness of -ferror-limit=1 as making a
> huge usability difference. I acknowledge that being able to do good
> error recovery and keep going is useful in some cases, but for day to
> day interactive this might be a better usability default? Especially
> with the compiler fast enough for the edit/compile cycle?
> Thoughts? Shall we do this?
Anecdotally, I've set -ferror-limit=3 over the last six months for a
few projects that I work on. A few observations:
- The compile time for non-trivial C++ compilation units is
sufficiently long that an extra compile cycle before getting to the
second error is a noticeable delay.
- With a limit of 3 (picked in a completely non-scientific way), I
have a roughly 50:50 chance of being able to fix all three errors at the
same time and a higher chance of being able to fix 2.
- Occasionally, I will have 20 instances of the same root-cause. If
an API changes in a header, it's useful to find all callees. I think we
could do something useful with heuristics to catch things like this (for
example, if the same invalid identifier appears in multiple places in
what appears to be the same kind of scope, report them together). With
-ferror-limit=3 currently, I have multiple compile cycles to find them
all (typically, I just do one build with no error limit in these cases
- If I miss a closing brace, 0 of the errors that clang reports are
useful, at any error limit. A single check that counts the number of
open and close braces and, if they are different numbers with a fast
response would be very helpful. At the moment, it can be 10-20 seconds
for a heavily templated file before I see an error that is caused by
something that the lexer could have seen (all of the errors are then
nonsense, because they're caused by trying to parse a method definition
inside another method or similar).
TL;DR: An error limit of 3 gives me too many errors some times and not
enough at other times, I think a limit of 1 would give not enough a lot
More information about the cfe-dev