File tree Expand file tree Collapse file tree 3 files changed +10
-1
lines changed Expand file tree Collapse file tree 3 files changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -228,7 +228,8 @@ bool isCastAllowedInCondition(const ImplicitCastExpr *Cast,
228
228
if (!S)
229
229
return false ;
230
230
if (isa<IfStmt>(S) || isa<ConditionalOperator>(S) || isa<ForStmt>(S) ||
231
- isa<WhileStmt>(S) || isa<BinaryConditionalOperator>(S))
231
+ isa<WhileStmt>(S) || isa<DoStmt>(S) ||
232
+ isa<BinaryConditionalOperator>(S))
232
233
return true ;
233
234
if (isa<ParenExpr>(S) || isa<ImplicitCastExpr>(S) ||
234
235
isUnaryLogicalNotOperator (S) ||
Original file line number Diff line number Diff line change @@ -196,6 +196,11 @@ Changes in existing checks
196
196
<clang-tidy/checks/readability/identifier-naming>` check to emit proper
197
197
warnings when a type forward declaration precedes its definition.
198
198
199
+ - Improved :doc: `readability-implicit-bool-conversion
200
+ <clang-tidy/checks/readability/implicit-bool-conversion>` check to take
201
+ do-while loops into account for the `AllowIntegerConditions ` and
202
+ `AllowPointerConditions ` options.
203
+
199
204
Removed checks
200
205
^^^^^^^^^^^^^^
201
206
Original file line number Diff line number Diff line change @@ -38,6 +38,9 @@ void implicitConversionIntegerToBoolInConditionalsIsAllowed() {
38
38
while (functionReturningInt ()) {}
39
39
while (functionReturningPointer ()) {}
40
40
while (functionReturningInt () && !functionReturningPointer () || (!functionReturningInt () && functionReturningPointer ())) {}
41
+ do {} while (functionReturningInt ());
42
+ do {} while (functionReturningPointer ());
43
+ do {} while (functionReturningInt () && !functionReturningPointer () || (!functionReturningInt () && functionReturningPointer ()));
41
44
int value1 = functionReturningInt () ? 1 : 2 ;
42
45
int value2 = !functionReturningInt () ? 1 : 2 ;
43
46
int value3 = (functionReturningInt () && functionReturningPointer () || !functionReturningInt ()) ? 1 : 2 ;
You can’t perform that action at this time.
0 commit comments