On Jan 7, 2010, at 4:24 PM, Sean Hunt wrote: > On 01/07/2010 05:20 PM, Douglas Gregor wrote: >> Author: dgregor >> Date: Thu Jan 7 18:20:23 2010 >> New Revision: 92975 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=92975&view=rev >> Log: >> Improve the fix-its for -Wparentheses to ensure that the fix-it >> suggestions follow recovery. Additionally, add a note to these >> diagnostics which suggests a fix-it for changing the behavior to what >> the user probably meant. Examples: >> >> t.cpp:2:9: warning:& has lower precedence than ==; == will be evaluated >> first >> [-Wparentheses] >> if (i& j == k) { >> ^~~~~~~~ >> ( ) >> t.cpp:2:9: note: place parentheses around the& expression to evaluate it >> first >> if (i& j == k) { >> ^ >> ( ) >> >> t.cpp:14:9: warning: using the result of an assignment as a condition >> without >> parentheses [-Wparentheses] >> if (i = f()) { >> ~~^~~~~ >> ( ) >> t.cpp:14:9: note: use '==' to turn this assignment into an equality >> comparison >> if (i = f()) { >> ^ >> == > > I'm a bit confused about fix-its in general. I thought normally clang > would continue translation as if the fix-it were actually changed, but > in this case this is just a warning and so this would represent a > semantic change on a file as its parsed. > > Am I wrong?
fixits on errors suggest a solution to the problem and should coincide with recovery. fixits on warnings should just suppress the warning; they should implicitly coincide with recovery. fixits on notes suggest alternative solutions. There needn't be a primary solution. These do not need to have any correlation with recovery. John. _______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
