[cfe-commits] r67823 - /cfe/trunk/lib/Sema/SemaType.cpp

Douglas Gregor dgregor at apple.com
Fri Mar 27 09:56:40 PDT 2009


On Mar 27, 2009, at 9:51 AM, Chris Lattner wrote:

> On Mar 27, 2009, at 8:34 AM, Douglas Gregor wrote:
>>> Ok, well that's kind of the design of the fixit advice:  
>>> theoretically and IDE would only show fixit advice if all  
>>> generated errors had fix it's.  If any errors were produced  
>>> without fixit advice, then we'd assume that error recovery got  
>>> confused and that none of the fixit advice is trustworthy.
>>
>> I'm about 85% convinced about that. For me, it depends on just how  
>> accurate our fix-it advice turns out to be, and I'm still going to  
>> argue that if we can't be reasonably accurate, we shouldn't suggest  
>> anything.
>
> Sure, I completely agree.  This is why we have to be really careful  
> that doing what the fixit[s] says will actually cause zero errors  
> from the next build.
>
> Incidentally, this patch:
> http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20090323/014595.html
>
> has another problem that I didn't comment on.  I don't think that  
> errors with fixit advice should *ever* return ExprError.  For  
> example, if you have:
>
> X->Y = 4;
>
> and X is a function returning a pointer to a struct with an 'int Y',  
> then adding () will fix the problem.  However, if it is a pointer to  
> a struct which 'struct a Y', then adding () won't fix it.
>
> In this case, I think that Sema should output the fixit advice, and  
> then synthesize the right AST nodes that would be built if the user  
> did add ()'s.  In the later case, this means that we'll get a second  
> error, and that error won't have fix-it advice.  Therefore that  
> invalidates the previous fixit advice.
>
> Does this seem reasonable?


Yeah, I thought about this after I'd committed the current version.  
It's a heck of a lot of work/code for one error message, especially if  
we get to the point where we're doing overload resolution to determine  
whether there is a function that can take zero arguments... but it's  
the right thing to do.

	- Doug



More information about the cfe-commits mailing list