[cfe-commits] r86001 - in /cfe/trunk: include/clang/Basic/DiagnosticSemaKinds.td lib/Sema/SemaDeclAttr.cpp test/Sema/callingconv.c test/Sema/stdcall-fastcall.c

Chris Lattner clattner at apple.com
Wed Nov 4 19:43:43 PST 2009


On Nov 4, 2009, at 4:30 PM, John McCall wrote:

>
> The second is that I think this policy about fixits is both (1)  
> misguided and (2) not really being followed with any consistency.  I  
> mean, the parser has a fixit which inserts semicolons at the end of  
> declarations;  there's no way that that's 100% correct, but it's  
> still the most likely solution, so it's still really useful.  - 
> Wparentheses has a fixit which inserts the parentheses;  that's  
> useful because it tells the user how to suppress the diagnostic, but  
> if we really think it's 100% correct, we shouldn't bother emitting  
> the diagnostic in the first place.

The most important thing is that the fixit follows how error recovery  
happens.

> The truth is that users should never blindly apply fixits, and any  
> tool which lets them do so is probably really dangerous.  Once you  
> accept that, fixits become just another axis of communication,  
> suggesting the likely source of errors and how they might be resolved.

On the one hand, I agree, on the other hand, I violently disagree.  If  
we are disciplined about fixits and only emit them when they are  
guaranteed to align with our error recovery then we get a very  
interesting property: if all errors emitted by the compiler have  
fixits, then we know that applying them all is a) safe (in the sense  
that the file will now compile), and b) will fix all the errors in the  
file.

This implies that when recovering with a fixit that we should not set  
decl invalid etc.

-Chris



More information about the cfe-commits mailing list