aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/Sema/SemaExpr.cpp2
-rw-r--r--test/Misc/tabstop.c9
2 files changed, 10 insertions, 1 deletions
diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp
index 17260c29c9..362bafaa40 100644
--- a/lib/Sema/SemaExpr.cpp
+++ b/lib/Sema/SemaExpr.cpp
@@ -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);
diff --git a/test/Misc/tabstop.c b/test/Misc/tabstop.c
index 49c4d7bebb..7f59b6ab32 100644
--- a/test/Misc/tabstop.c
+++ b/test/Misc/tabstop.c
@@ -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: {{^ }} ( )