Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(5365)

Issue 1591041: [PATCH] Add an option to limit the number of overload candidates printed (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
13 years, 10 months ago by Jeffrey Yasskin
Modified:
13 years, 10 months ago
Reviewers:
chandlerc, cfe-commits
Base URL:
https://llvm.org/svn/llvm-project/cfe/trunk/
Visibility:
Public.

Description

When there are lots of operator<<s, clang produces significantly worse diagnostics than gcc, simply because of the size of the output. This patch adds a -fshow-diagnostics=best option to limit clang to 4 overload candidates, as a first cut.

Patch Set 1 #

Patch Set 2 : Change to -fshow-diagnostics=all|best and make all the default #

Total comments: 8
Unified diffs Side-by-side diffs Delta from patch set Stats (+67 lines, -9 lines) Patch
M include/clang/Basic/Diagnostic.h View 1 3 chunks +14 lines, -1 line 4 comments Download
M include/clang/Basic/DiagnosticSemaKinds.td View 1 1 chunk +3 lines, -0 lines 0 comments Download
M include/clang/Driver/CC1Options.td View 1 1 chunk +3 lines, -0 lines 0 comments Download
M include/clang/Driver/Options.td View 1 1 chunk +1 line, -0 lines 0 comments Download
M include/clang/Frontend/DiagnosticOptions.h View 1 3 chunks +5 lines, -0 lines 2 comments Download
M lib/Basic/Diagnostic.cpp View 1 1 chunk +1 line, -0 lines 0 comments Download
M lib/Driver/Tools.cpp View 1 1 chunk +3 lines, -0 lines 0 comments Download
M lib/Frontend/CompilerInvocation.cpp View 1 1 chunk +12 lines, -1 line 0 comments Download
M lib/Frontend/Warnings.cpp View 1 1 chunk +2 lines, -0 lines 0 comments Download
M lib/Sema/SemaOverload.cpp View 1 3 chunks +20 lines, -5 lines 2 comments Download
M test/SemaCXX/overloaded-builtin-operators.cpp View 1 2 chunks +3 lines, -2 lines 0 comments Download

Messages

Total messages: 13
Jeffrey Yasskin
Please take a look. If you prefer reviewing diffs, they're behind the "Download raw patch ...
13 years, 10 months ago (2010-06-08 01:03:30 UTC) #1
dgregor_apple.com
On Jun 7, 2010, at 6:03 PM, jyasskin@gmail.com wrote: > Reviewers: cfe-commits_cs.uiuc.edu, > > Message: ...
13 years, 10 months ago (2010-06-08 14:49:34 UTC) #2
Jeffrey Yasskin (google)
On Tue, Jun 8, 2010 at 7:49 AM, Douglas Gregor <dgregor@apple.com> wrote: > > On ...
13 years, 10 months ago (2010-06-08 20:06:50 UTC) #3
dgregor_apple.com
On Jun 8, 2010, at 1:06 PM, Jeffrey Yasskin wrote: > On Tue, Jun 8, ...
13 years, 10 months ago (2010-06-08 20:52:40 UTC) #4
Jeffrey Yasskin (google)
On Tue, Jun 8, 2010 at 1:52 PM, Douglas Gregor <dgregor@apple.com> wrote: > > On ...
13 years, 10 months ago (2010-06-08 20:59:57 UTC) #5
dgregor_apple.com
On Jun 8, 2010, at 1:59 PM, Jeffrey Yasskin wrote: > On Tue, Jun 8, ...
13 years, 10 months ago (2010-06-08 21:01:49 UTC) #6
Jeffrey Yasskin (google)
On Tue, Jun 8, 2010 at 2:01 PM, Douglas Gregor <dgregor@apple.com> wrote: > > On ...
13 years, 10 months ago (2010-06-08 21:02:53 UTC) #7
Jeffrey Yasskin (google)
On Tue, Jun 8, 2010 at 2:02 PM, Jeffrey Yasskin <jyasskin@google.com> wrote: > On Tue, ...
13 years, 10 months ago (2010-06-09 07:51:04 UTC) #8
Jeffrey Yasskin (google)
Ping :) On Wed, Jun 9, 2010 at 12:50 AM, Jeffrey Yasskin <jyasskin@google.com> wrote: > ...
13 years, 10 months ago (2010-06-10 20:30:32 UTC) #9
chandlerc
Just a few tweaks I think, and looks good to me. Probably good for post-commit ...
13 years, 10 months ago (2010-06-10 22:58:47 UTC) #10
Jeffrey Yasskin
I've committed this as r105815. Let me know if anything needs to change. http://codereview.appspot.com/1591041/diff/8001/3006 File ...
13 years, 10 months ago (2010-06-11 05:58:20 UTC) #11
clattner_apple.com
On Jun 8, 2010, at 1:52 PM, Douglas Gregor wrote: >> >> > >> > ...
13 years, 10 months ago (2010-06-13 05:23:28 UTC) #12
dgregor_apple.com
13 years, 10 months ago (2010-06-14 14:33:16 UTC) #13
On Jun 9, 2010, at 12:50 AM, Jeffrey Yasskin wrote:

> On Tue, Jun 8, 2010 at 2:02 PM, Jeffrey Yasskin <jyasskin@google.com> wrote:
>> On Tue, Jun 8, 2010 at 2:01 PM, Douglas Gregor <dgregor@apple.com> wrote:
>>> 
>>> On Jun 8, 2010, at 1:59 PM, Jeffrey Yasskin wrote:
>>> 
>>>> On Tue, Jun 8, 2010 at 1:52 PM, Douglas Gregor <dgregor@apple.com> wrote:
>>>>> 
>>>>> On Jun 8, 2010, at 1:06 PM, Jeffrey Yasskin wrote:
>>>>> 
>>>>> On Tue, Jun 8, 2010 at 7:49 AM, Douglas Gregor <dgregor@apple.com> wrote:
>>>>>> 
>>>>>> On Jun 7, 2010, at 6:03 PM, jyasskin@gmail.com wrote:
>>>>>> 
>>>>>>> Reviewers: cfe-commits_cs.uiuc.edu,
>>>>>>> 
>>>>>>> Message:
>>>>>>> Please take a look. If you prefer reviewing diffs, they're behind the
>>>>>>> "Download raw patch set" link.
>>>>>>> 
>>>>>>> Description:
>>>>>>> When there are lots of operator<<s, clang produces significantly worse
>>>>>>> diagnostics than gcc, simply because of the size of the output. This
>>>>>>> patch limits clang to 4 overload candidates, with the ability to show
>>>>>>> the rest by passing -fshow-all-overloads, as a first cut. We'll want to
>>>>>>> refine that later as examples of bad behavior come up.
>>>>>> 
>>>>>> 
>>>>>> Unless we can be fairly sure that the "right" operator<< is in those
first
>>>>>> 4 overload candidates, I don't think this is a good idea. Unlike with
>>>>>> suppressing inner template/macro instantiation histories, this change is
>>>>>> likely to suppress important information.
>>>>>> 
>>>>> 
>>>>> I agree that it will sometimes suppress important information. That's why
I
>>>>> added the -fshow-all-overloads flag so the user can get it back if they
need
>>>>> it.
>>>>> 
>>>>> Sure, and it's good to have -fshow-all-overloads for any kind of pruning.
My
>>>>> concern is that if the pruning is not good by default, we'll end up
causing
>>>>> more harm than good: the user will have to bounce between
>>>>> -fshow-all-overloads and non-fshow-all-overloads whenever they hit
problems.
>>>>> That's worse than having a longer diagnostic chain in the first place.
>>>>> 
>>>>> But in cases like the one below, there are too many overloads printed to
>>>>> find the "right" one, even if it were present, and they just discourage
>>>>> users from reading any of them. 4 is clearly not the right cut-off in all
>>>>> cases, and cutting off after a drop in quality is likely to be better in
>>>>> many cases, but it fixes some of the most egregious behavior pretty
easily.
>>>>> We can fix places where it omits useful overloads as they come up.
>>>>> 
>>>>> We can, but our heuristics are known not to be that good, so we won't even
>>>>> have a good sense of how useful this change is until we have better
>>>>> heuristics.
>>>>> 
>>>>> If you prefer, I can look for a quality drop based
>>>>> on CompareOverloadCandidatesForDisplay instead of the fixed cutoff. I'll
>>>>> want a hard cutoff around 6-10 anyway, since at that point I think most
>>>>> users give up on our errors and just stare at the source instead.
>>>>> 
>>>>> I think a quality-based cutoff is the only workable solution, so IMO we
need
>>>>> that before we can turn this behavior on by default.
>>>>> It would probably make sense to have the flag set
>>>>> -fshow-overloads={best,all}
>>>>> so that we have the option later of adding different tweaks/heuristics
>>>>> (e.g., "detailed", to really show what happens for each overload).
>>>>> Otherwise, we'll end up with several -fshow-*-overloads flags.
>>>> 
>>>> That does sound better. Would you accept a -fshow-overloads={best,all}
>>>> that defaulted to 'all' and had 'best' do the 4-overload cutoff, or
>>>> would you want 'best' to look for a quality change in the first
>>>> version?
>>> 
>>> So long as the default remains "all" until we have decent heuristics for a
quality-based cutoff, I'm happy to have support for "best" in the tree with the
4-overload cutoff.
>>> 
>> 
>> Will do. Thanks!
> 
> This is done. New patch at
> http://codereview.appspot.com/download/issue1591041_8001.diff


Looks good.

	- Doug
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b