summaryrefslogtreecommitdiffstats
path: root/clang
diff options
context:
space:
mode:
authorRichard Trieu <rtrieu@google.com>2013-04-18 01:04:37 +0000
committerRichard Trieu <rtrieu@google.com>2013-04-18 01:04:37 +0000
commite089497121ddbcbed3131ee2e064c7434164dc46 (patch)
tree69e8f7dc65a16d06ae7f53a6900751e996476db7 /clang
parent89af58991a007bdebd1450c499c888bce93d84f2 (diff)
downloadbcm5719-llvm-e089497121ddbcbed3131ee2e064c7434164dc46.tar.gz
bcm5719-llvm-e089497121ddbcbed3131ee2e064c7434164dc46.zip
Switch the note order for -Woverloaded-shift-op-parentheses so that the note
with the silence fix-it comes first. This is more consistent with the rest of the warnings in -Wparentheses. llvm-svn: 179742
Diffstat (limited to 'clang')
-rw-r--r--clang/lib/Sema/SemaExpr.cpp8
-rw-r--r--clang/test/Sema/parentheses.cpp20
2 files changed, 16 insertions, 12 deletions
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp
index ce60f9171fd..fb0e9ef687c 100644
--- a/clang/lib/Sema/SemaExpr.cpp
+++ b/clang/lib/Sema/SemaExpr.cpp
@@ -8894,14 +8894,14 @@ static void DiagnoseShiftCompare(Sema &S, SourceLocation OpLoc,
S.Diag(OpLoc, diag::warn_overloaded_shift_in_comparison)
<< LHSExpr->getSourceRange() << RHSExpr->getSourceRange()
<< (Kind == OO_LessLess);
- SuggestParentheses(S, OpLoc,
- S.PDiag(diag::note_evaluate_comparison_first),
- SourceRange(OCE->getArg(1)->getLocStart(),
- RHSExpr->getLocEnd()));
SuggestParentheses(S, OCE->getOperatorLoc(),
S.PDiag(diag::note_precedence_silence)
<< (Kind == OO_LessLess ? "<<" : ">>"),
OCE->getSourceRange());
+ SuggestParentheses(S, OpLoc,
+ S.PDiag(diag::note_evaluate_comparison_first),
+ SourceRange(OCE->getArg(1)->getLocStart(),
+ RHSExpr->getLocEnd()));
}
/// DiagnoseBinOpPrecedence - Emit warnings for expressions with tricky
diff --git a/clang/test/Sema/parentheses.cpp b/clang/test/Sema/parentheses.cpp
index 7288f8cb2f0..ac2694f72e1 100644
--- a/clang/test/Sema/parentheses.cpp
+++ b/clang/test/Sema/parentheses.cpp
@@ -48,16 +48,20 @@ void f(Stream& s, bool b) {
// CHECK: fix-it:"{{.*}}":{[[@LINE-6]]:32-[[@LINE-6]]:32}:")"
(void)(s << 5 == 1); // expected-warning {{overloaded operator << has lower precedence than comparison operator}} \
- // expected-note {{place parentheses around comparison expression to evaluate it first}} \
- // expected-note {{place parentheses around the '<<' expression to silence this warning}}
+ // expected-note {{place parentheses around the '<<' expression to silence this warning}} \
+ // expected-note {{place parentheses around comparison expression to evaluate it first}}
+ // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:10-[[@LINE-3]]:10}:"("
+ // CHECK: fix-it:"{{.*}}":{[[@LINE-4]]:16-[[@LINE-4]]:16}:")"
+ // CHECK: fix-it:"{{.*}}":{[[@LINE-5]]:15-[[@LINE-5]]:15}:"("
+ // CHECK: fix-it:"{{.*}}":{[[@LINE-6]]:21-[[@LINE-6]]:21}:")"
(void)(s >> 5 == 1); // expected-warning {{overloaded operator >> has lower precedence than comparison operator}} \
- // expected-note {{place parentheses around comparison expression to evaluate it first}} \
- // expected-note {{place parentheses around the '>>' expression to silence this warning}}
- // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:15-[[@LINE-3]]:15}:"("
- // CHECK: fix-it:"{{.*}}":{[[@LINE-4]]:21-[[@LINE-4]]:21}:")"
- // CHECK: fix-it:"{{.*}}":{[[@LINE-5]]:10-[[@LINE-5]]:10}:"("
- // CHECK: fix-it:"{{.*}}":{[[@LINE-6]]:16-[[@LINE-6]]:16}:")"
+ // expected-note {{place parentheses around the '>>' expression to silence this warning}} \
+ // expected-note {{place parentheses around comparison expression to evaluate it first}}
+ // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:10-[[@LINE-3]]:10}:"("
+ // CHECK: fix-it:"{{.*}}":{[[@LINE-4]]:16-[[@LINE-4]]:16}:")"
+ // CHECK: fix-it:"{{.*}}":{[[@LINE-5]]:15-[[@LINE-5]]:15}:"("
+ // CHECK: fix-it:"{{.*}}":{[[@LINE-6]]:21-[[@LINE-6]]:21}:")"
}
struct S {
OpenPOWER on IntegriCloud