1 // RUN: %clang_cc1 -fsyntax-only -verify %s -DSILENCE
2 // RUN: %clang_cc1 -fsyntax-only -verify %s -Wlogical-op-parentheses
3 // RUN: %clang_cc1 -fsyntax-only -verify %s -Wparentheses
4 // RUN: %clang_cc1 -fsyntax-only -fdiagnostics-parseable-fixits %s -Wlogical-op-parentheses 2>&1 | FileCheck %s
7 // expected-no-diagnostics
10 void logical_op_parentheses(unsigned i
) {
14 // expected-warning@-2 {{'&&' within '||'}}
15 // expected-note@-3 {{place parentheses around the '&&' expression to silence this warning}}
17 // CHECK: fix-it:"{{.*}}":{[[@LINE-5]]:14-[[@LINE-5]]:14}:"("
18 // CHECK: fix-it:"{{.*}}":{[[@LINE-6]]:20-[[@LINE-6]]:20}:")"
20 (void)(i
|| i
&& "w00t");
21 (void)("w00t" && i
|| i
);
23 (void)(i
|| i
&& "w00t" || i
);
25 // expected-warning@-2 {{'&&' within '||'}}
26 // expected-note@-3 {{place parentheses around the '&&' expression to silence this warning}}
28 // CHECK: fix-it:"{{.*}}":{[[@LINE-5]]:15-[[@LINE-5]]:15}:"("
29 // CHECK: fix-it:"{{.*}}":{[[@LINE-6]]:26-[[@LINE-6]]:26}:")"
31 (void)(i
|| "w00t" && i
|| i
);
33 // expected-warning@-2 {{'&&' within '||'}}
34 // expected-note@-3 {{place parentheses around the '&&' expression to silence this warning}}
36 // CHECK: fix-it:"{{.*}}":{[[@LINE-5]]:15-[[@LINE-5]]:15}:"("
37 // CHECK: fix-it:"{{.*}}":{[[@LINE-6]]:26-[[@LINE-6]]:26}:")"