[cfe-commits] r157897 - in /cfe/trunk: lib/Sema/SemaExpr.cpp test/Misc/tabstop.c

Nico Weber nicolasweber at gmx.de
Sun Jun 3 00:07:01 PDT 2012


Author: nico
Date: Sun Jun  3 02:07:00 2012
New Revision: 157897

URL: http://llvm.org/viewvc/llvm-project?rev=157897&view=rev
Log:
Improve fixit for comparison operator on lhs of bitwise operator.

Before:
test.cc:2:18: note: place parentheses around the == expression to silence this warning
  if (0 == flags & 0xdd)
                 ^
                   (   )

Now:
test.cc:2:18: note: place parentheses around the == expression to silence this warning
  if (0 == flags & 0xdd)
                 ^
      (         )


Modified:
    cfe/trunk/lib/Sema/SemaExpr.cpp
    cfe/trunk/test/Misc/tabstop.c

Modified: cfe/trunk/lib/Sema/SemaExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=157897&r1=157896&r2=157897&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExpr.cpp Sun Jun  3 02:07:00 2012
@@ -8092,7 +8092,7 @@
     << DiagRange << BinOp::getOpcodeStr(Opc) << OpStr;
   SuggestParentheses(Self, OpLoc,
     Self.PDiag(diag::note_precedence_bitwise_silence) << OpStr,
-    RHSExpr->getSourceRange());
+    (isLeftComp ? LHSExpr : RHSExpr)->getSourceRange());
   SuggestParentheses(Self, OpLoc,
     Self.PDiag(diag::note_precedence_bitwise_first) << BinOp::getOpcodeStr(Opc),
     ParensRange);

Modified: cfe/trunk/test/Misc/tabstop.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Misc/tabstop.c?rev=157897&r1=157896&r2=157897&view=diff
==============================================================================
--- cfe/trunk/test/Misc/tabstop.c (original)
+++ cfe/trunk/test/Misc/tabstop.c Sun Jun  3 02:07:00 2012
@@ -35,13 +35,22 @@
 {
 	if (0	& 1	== 1)
 	{}
+
+	if (1 == 0	& 1)
+	{}
 }
 
 // CHECK-3: {{^   }}if (0 & 1   == 1)
 // CHECK-3: {{^   }}        (       )
+// CHECK-3: {{^   }}if (1 == 0  & 1)
+// CHECK-3: {{^   }}    (     )
 
 // CHECK-4: {{^    }}if (0   & 1 == 1)
 // CHECK-4: {{^    }}          (     )
+// CHECK-4: {{^    }}if (1 == 0  & 1)
+// CHECK-4: {{^    }}    (     )
 
 // CHECK-5: {{^     }}if (0     & 1  == 1)
 // CHECK-5: {{^     }}            (      )
+// CHECK-5: {{^     }}if (1 == 0     & 1)
+// CHECK-5: {{^     }}    (     )





More information about the cfe-commits mailing list