[cfe-commits] r92975 - in /cfe/trunk: include/clang/Basic/DiagnosticSemaKinds.td lib/Sema/SemaExpr.cpp test/Sema/parentheses.c test/SemaCXX/warn-assignment-condition.cpp
Sean Hunt
rideau3 at gmail.com
Thu Jan 7 16:24:28 PST 2010
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?
Sean
More information about the cfe-commits
mailing list