forked from OSchip/llvm-project
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) ^ ( ) llvm-svn: 157897
This commit is contained in:
parent
5097e4f38a
commit
cdfb1ae7f7
|
@ -8092,7 +8092,7 @@ static void DiagnoseBitwisePrecedence(Sema &Self, BinaryOperatorKind Opc,
|
|||
<< 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);
|
||||
|
|
|
@ -35,13 +35,22 @@ void f(void)
|
|||
{
|
||||
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: {{^ }} ( )
|
||||
|
|
Loading…
Reference in New Issue