@@ -167,25 +167,26 @@ void bad_with_priors() {
167167
168168void bad_with_priors2 () {
169169 bool a = false , b = true , c = true ;
170+ bool r;
170171 a xor b bitand c;
171172 // CHECK-MESSAGES: :[[@LINE-1]]:13: warning: use logical operator '&&' for boolean values instead of bitwise operator '&' [misc-bool-bitwise-operation]
172173 // CHECK-FIXES: a xor (b and c);
173174
174175 // braces added in the first change
175- a bitor b bitand c;
176- // CHECK-MESSAGES: :[[@LINE-1]]:7 : warning: use logical operator '||' for boolean values instead of bitwise operator '|' [misc-bool-bitwise-operation]
177- // CHECK-MESSAGES: :[[@LINE-2]]:15 : warning: use logical operator '&&' for boolean values instead of bitwise operator '&' [misc-bool-bitwise-operation]
178- // CHECK-FIXES: a or (b and c);
176+ r = a bitor b bitand c;
177+ // CHECK-MESSAGES: :[[@LINE-1]]:11 : warning: use logical operator '||' for boolean values instead of bitwise operator '|' [misc-bool-bitwise-operation]
178+ // CHECK-MESSAGES: :[[@LINE-2]]:19 : warning: use logical operator '&&' for boolean values instead of bitwise operator '&' [misc-bool-bitwise-operation]
179+ // CHECK-FIXES: r = a or (b and c);
179180
180- b bitand c xor a;
181- // CHECK-MESSAGES: :[[@LINE-1]]:7 : warning: use logical operator '&&' for boolean values instead of bitwise operator '&' [misc-bool-bitwise-operation]
182- // CHECK-FIXES: (b and c) xor a;
181+ r = b bitand c xor a;
182+ // CHECK-MESSAGES: :[[@LINE-1]]:11 : warning: use logical operator '&&' for boolean values instead of bitwise operator '&' [misc-bool-bitwise-operation]
183+ // CHECK-FIXES: r = (b and c) xor a;
183184
184185 // braces added in the first change
185- b bitand c bitor a;
186- // CHECK-MESSAGES: :[[@LINE-1]]:7 : warning: use logical operator '&&' for boolean values instead of bitwise operator '&' [misc-bool-bitwise-operation]
187- // CHECK-MESSAGES: :[[@LINE-2]]:16 : warning: use logical operator '||' for boolean values instead of bitwise operator '|' [misc-bool-bitwise-operation]
188- // CHECK-FIXES: (b and c) or a;
186+ r = b bitand c bitor a;
187+ // CHECK-MESSAGES: :[[@LINE-1]]:11 : warning: use logical operator '&&' for boolean values instead of bitwise operator '&' [misc-bool-bitwise-operation]
188+ // CHECK-MESSAGES: :[[@LINE-2]]:20 : warning: use logical operator '||' for boolean values instead of bitwise operator '|' [misc-bool-bitwise-operation]
189+ // CHECK-FIXES: r = (b and c) or a;
189190}
190191
191192template <typename T>
@@ -204,13 +205,13 @@ void bad_has_ancestor() {
204205 // CHECK-FIXES: a xor ident(b and c or a);
205206
206207 a bitor ident (a ? b bitand c : c);
207- // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: use logical operator '||' for boolean values instead of bitwise operator '|' [misc-bool-bitwise-operation]
208- // CHECK-MESSAGES: :[[@LINE-2]]:25: warning: use logical operator '&&' for boolean values instead of bitwise operator '&' [misc-bool-bitwise-operation]
208+ // CHECK-MESSAGES: :[[@LINE-1]]:25: warning: use logical operator '&&' for boolean values instead of bitwise operator '&' [misc-bool-bitwise-operation]
209209 // CHECK-FIXES: a bitor ident(a ? b and c : c);
210210}
211211
212212void bad_with_priors_already_braced () {
213213 bool a = false , b = true , c = true ;
214+ bool r;
214215 a and (b bitor c);
215216 // CHECK-MESSAGES: :[[@LINE-1]]:14: warning: use logical operator '||' for boolean values instead of bitwise operator '|' [misc-bool-bitwise-operation]
216217 // CHECK-FIXES: a and (b or c);
@@ -228,19 +229,19 @@ void bad_with_priors_already_braced() {
228229 // CHECK-MESSAGES: :[[@LINE-1]]:14: warning: use logical operator '&&' for boolean values instead of bitwise operator '&' [misc-bool-bitwise-operation]
229230 // CHECK-FIXES: a xor (b and c);
230231
231- a bitor (b bitand c);
232- // CHECK-MESSAGES: :[[@LINE-1]]:7 : warning: use logical operator '||' for boolean values instead of bitwise operator '|' [misc-bool-bitwise-operation]
233- // CHECK-MESSAGES: :[[@LINE-2]]:16 : warning: use logical operator '&&' for boolean values instead of bitwise operator '&' [misc-bool-bitwise-operation]
234- // CHECK-FIXES: a or (b and c);
232+ r = a bitor (b bitand c);
233+ // CHECK-MESSAGES: :[[@LINE-1]]:11 : warning: use logical operator '||' for boolean values instead of bitwise operator '|' [misc-bool-bitwise-operation]
234+ // CHECK-MESSAGES: :[[@LINE-2]]:20 : warning: use logical operator '&&' for boolean values instead of bitwise operator '&' [misc-bool-bitwise-operation]
235+ // CHECK-FIXES: r = a or (b and c);
235236
236237 (b bitand c) xor a;
237238 // CHECK-MESSAGES: :[[@LINE-1]]:8: warning: use logical operator '&&' for boolean values instead of bitwise operator '&' [misc-bool-bitwise-operation]
238239 // CHECK-FIXES: (b and c) xor a;
239240
240- (b bitand c) bitor a;
241- // CHECK-MESSAGES: :[[@LINE-1]]:8 : warning: use logical operator '&&' for boolean values instead of bitwise operator '&' [misc-bool-bitwise-operation]
242- // CHECK-MESSAGES: :[[@LINE-2]]:18 : warning: use logical operator '||' for boolean values instead of bitwise operator '|' [misc-bool-bitwise-operation]
243- // CHECK-FIXES: (b and c) or a;
241+ r = (b bitand c) bitor a;
242+ // CHECK-MESSAGES: :[[@LINE-1]]:12 : warning: use logical operator '&&' for boolean values instead of bitwise operator '&' [misc-bool-bitwise-operation]
243+ // CHECK-MESSAGES: :[[@LINE-2]]:22 : warning: use logical operator '||' for boolean values instead of bitwise operator '|' [misc-bool-bitwise-operation]
244+ // CHECK-FIXES: r = (b and c) or a;
244245}
245246
246247void bad_with_priors_compound () {
0 commit comments