]> granicus.if.org Git - clang/commitdiff
Switch the note order for -Woverloaded-shift-op-parentheses so that the note
authorRichard Trieu <rtrieu@google.com>
Thu, 18 Apr 2013 01:04:37 +0000 (01:04 +0000)
committerRichard Trieu <rtrieu@google.com>
Thu, 18 Apr 2013 01:04:37 +0000 (01:04 +0000)
with the silence fix-it comes first.  This is more consistent with the rest
of the warnings in -Wparentheses.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179742 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaExpr.cpp
test/Sema/parentheses.cpp

index ce60f9171fdb577bca4921b817b8eab70e8fe78e..fb0e9ef687c74c6ea607ebc1bc2448a9e5b88875 100644 (file)
@@ -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
index 7288f8cb2f0b00b164d1ab9d8b715a65525c6a75..ac2694f72e10530b3050a2bcb90ddb125dd6201e 100644 (file)
@@ -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 {