@@ -126,7 +126,6 @@ void bad_side_effects_volatile() {
126126 bool a = true ;
127127 volatile bool b = false ;
128128 bool c = true ;
129- bool r;
130129
131130 a bitor b;
132131 // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: use logical operator '||' for boolean values instead of bitwise operator '|' [misc-bool-bitwise-operation]
@@ -142,15 +141,15 @@ void bad_side_effects_volatile() {
142141 // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: use logical operator '&&' for boolean variable 'a' instead of bitwise operator '&=' [misc-bool-bitwise-operation]
143142 // CHECK-MESSAGES-NOT: :[[@LINE-2]]:{{.*}}: note: FIX-IT applied suggested code changes
144143
145- r = (a bitor c) bitor b;
146- // CHECK-MESSAGES: :[[@LINE-1]]:12 : warning: use logical operator '||' for boolean values instead of bitwise operator '|' [misc-bool-bitwise-operation]
147- // CHECK-MESSAGES: :[[@LINE-2]]:21 : warning: use logical operator '||' for boolean values instead of bitwise operator '|' [misc-bool-bitwise-operation]
148- // CHECK-FIXES: r = (a or c) bitor b;
144+ (a bitor c) bitor b;
145+ // CHECK-MESSAGES: :[[@LINE-1]]:8 : warning: use logical operator '||' for boolean values instead of bitwise operator '|' [misc-bool-bitwise-operation]
146+ // CHECK-MESSAGES: :[[@LINE-2]]:17 : warning: use logical operator '||' for boolean values instead of bitwise operator '|' [misc-bool-bitwise-operation]
147+ // CHECK-FIXES: (a or c) bitor b;
149148
150- r = a bitor c bitor b;
151- // CHECK-MESSAGES: :[[@LINE-1]]:11 : warning: use logical operator '||' for boolean values instead of bitwise operator '|' [misc-bool-bitwise-operation]
152- // CHECK-MESSAGES: :[[@LINE-2]]:19 : warning: use logical operator '||' for boolean values instead of bitwise operator '|' [misc-bool-bitwise-operation]
153- // CHECK-FIXES: r = a or c bitor b;
149+ a bitor c bitor b;
150+ // CHECK-MESSAGES: :[[@LINE-1]]:7 : warning: use logical operator '||' for boolean values instead of bitwise operator '|' [misc-bool-bitwise-operation]
151+ // CHECK-MESSAGES: :[[@LINE-2]]:15 : warning: use logical operator '||' for boolean values instead of bitwise operator '|' [misc-bool-bitwise-operation]
152+ // CHECK-FIXES: a or c bitor b;
154153}
155154
156155void bad_with_priors () {
@@ -186,20 +185,20 @@ void bad_with_priors2() {
186185 // CHECK-FIXES: a xor (b and c);
187186
188187 // braces added in the first change
189- r = a bitor b bitand c;
190- // CHECK-MESSAGES: :[[@LINE-1]]:11 : warning: use logical operator '||' for boolean values instead of bitwise operator '|' [misc-bool-bitwise-operation]
191- // CHECK-MESSAGES: :[[@LINE-2]]:19 : warning: use logical operator '&&' for boolean values instead of bitwise operator '&' [misc-bool-bitwise-operation]
192- // CHECK-FIXES: r = a or (b and c);
188+ a bitor b bitand c;
189+ // CHECK-MESSAGES: :[[@LINE-1]]:7 : warning: use logical operator '||' for boolean values instead of bitwise operator '|' [misc-bool-bitwise-operation]
190+ // CHECK-MESSAGES: :[[@LINE-2]]:15 : warning: use logical operator '&&' for boolean values instead of bitwise operator '&' [misc-bool-bitwise-operation]
191+ // CHECK-FIXES: a or (b and c);
193192
194- r = b bitand c xor a;
195- // CHECK-MESSAGES: :[[@LINE-1]]:11 : warning: use logical operator '&&' for boolean values instead of bitwise operator '&' [misc-bool-bitwise-operation]
196- // CHECK-FIXES: r = (b and c) xor a;
193+ b bitand c xor a;
194+ // CHECK-MESSAGES: :[[@LINE-1]]:7 : warning: use logical operator '&&' for boolean values instead of bitwise operator '&' [misc-bool-bitwise-operation]
195+ // CHECK-FIXES: (b and c) xor a;
197196
198197 // braces added in the first change
199- r = b bitand c bitor a;
200- // CHECK-MESSAGES: :[[@LINE-1]]:11 : warning: use logical operator '&&' for boolean values instead of bitwise operator '&' [misc-bool-bitwise-operation]
201- // CHECK-MESSAGES: :[[@LINE-2]]:20 : warning: use logical operator '||' for boolean values instead of bitwise operator '|' [misc-bool-bitwise-operation]
202- // CHECK-FIXES: r = (b and c) or a;
198+ b bitand c bitor a;
199+ // CHECK-MESSAGES: :[[@LINE-1]]:7 : warning: use logical operator '&&' for boolean values instead of bitwise operator '&' [misc-bool-bitwise-operation]
200+ // CHECK-MESSAGES: :[[@LINE-2]]:16 : warning: use logical operator '||' for boolean values instead of bitwise operator '|' [misc-bool-bitwise-operation]
201+ // CHECK-FIXES: (b and c) or a;
203202}
204203
205204template <typename T>
@@ -224,7 +223,6 @@ void bad_has_ancestor() {
224223
225224void bad_with_priors_already_braced () {
226225 bool a = false , b = true , c = true ;
227- bool r;
228226 a and (b bitor c);
229227 // CHECK-MESSAGES: :[[@LINE-1]]:14: warning: use logical operator '||' for boolean values instead of bitwise operator '|' [misc-bool-bitwise-operation]
230228 // CHECK-FIXES: a and (b or c);
@@ -242,19 +240,19 @@ void bad_with_priors_already_braced() {
242240 // CHECK-MESSAGES: :[[@LINE-1]]:14: warning: use logical operator '&&' for boolean values instead of bitwise operator '&' [misc-bool-bitwise-operation]
243241 // CHECK-FIXES: a xor (b and c);
244242
245- r = a bitor (b bitand c);
246- // CHECK-MESSAGES: :[[@LINE-1]]:11 : warning: use logical operator '||' for boolean values instead of bitwise operator '|' [misc-bool-bitwise-operation]
247- // CHECK-MESSAGES: :[[@LINE-2]]:20 : warning: use logical operator '&&' for boolean values instead of bitwise operator '&' [misc-bool-bitwise-operation]
248- // CHECK-FIXES: r = a or (b and c);
243+ a bitor (b bitand c);
244+ // CHECK-MESSAGES: :[[@LINE-1]]:7 : warning: use logical operator '||' for boolean values instead of bitwise operator '|' [misc-bool-bitwise-operation]
245+ // CHECK-MESSAGES: :[[@LINE-2]]:16 : warning: use logical operator '&&' for boolean values instead of bitwise operator '&' [misc-bool-bitwise-operation]
246+ // CHECK-FIXES: a or (b and c);
249247
250248 (b bitand c) xor a;
251249 // CHECK-MESSAGES: :[[@LINE-1]]:8: warning: use logical operator '&&' for boolean values instead of bitwise operator '&' [misc-bool-bitwise-operation]
252250 // CHECK-FIXES: (b and c) xor a;
253251
254- r = (b bitand c) bitor a;
255- // CHECK-MESSAGES: :[[@LINE-1]]:12 : warning: use logical operator '&&' for boolean values instead of bitwise operator '&' [misc-bool-bitwise-operation]
256- // CHECK-MESSAGES: :[[@LINE-2]]:22 : warning: use logical operator '||' for boolean values instead of bitwise operator '|' [misc-bool-bitwise-operation]
257- // CHECK-FIXES: r = (b and c) or a;
252+ (b bitand c) bitor a;
253+ // CHECK-MESSAGES: :[[@LINE-1]]:8 : warning: use logical operator '&&' for boolean values instead of bitwise operator '&' [misc-bool-bitwise-operation]
254+ // CHECK-MESSAGES: :[[@LINE-2]]:18 : warning: use logical operator '||' for boolean values instead of bitwise operator '|' [misc-bool-bitwise-operation]
255+ // CHECK-FIXES: (b and c) or a;
258256}
259257
260258void bad_with_priors_compound () {
0 commit comments