]> granicus.if.org Git - clang/commit
When diagnosing suspicious precedence or assignments, move the fix-it
authorDouglas Gregor <dgregor@apple.com>
Wed, 14 Apr 2010 16:09:52 +0000 (16:09 +0000)
committerDouglas Gregor <dgregor@apple.com>
Wed, 14 Apr 2010 16:09:52 +0000 (16:09 +0000)
commit55b38842d12ffd9f9ff3a0e16fae2cfe61ab0fe6
treeac0f2a717a844791f26dfd50218cace8b1572c20
parent868e78d59d2dfaf9cda511925e5a58f3a712db96
When diagnosing suspicious precedence or assignments, move the fix-it
that adds parentheses from the main diagnostic down to a new
note. This way, when the fix-it represents a choice between two
options, each of the options is associted with a note. There is no
default option in such cases. For example:

/Users/dgregor/t.c:2:9: warning: & has lower precedence than ==; ==
will be
      evaluated first [-Wparentheses]
  if (x & y == 0) {
        ^~~~~~~~
/Users/dgregor/t.c:2:9: note: place parentheses around the &
expression to
      evaluate it first
  if (x & y == 0) {
        ^
      (    )
/Users/dgregor/t.c:2:9: note: place parentheses around the ==
expression to
      silence this warning
  if (x & y == 0) {
        ^
          (     )

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@101249 91177308-0d34-0410-b5e6-96231b3b80d8
include/clang/Basic/DiagnosticSemaKinds.td
lib/Sema/SemaExpr.cpp
test/Misc/tabstop.c
test/Sema/parentheses.c
test/SemaCXX/warn-assignment-condition.cpp