File tree Expand file tree Collapse file tree 3 files changed +17
-1
lines changed Expand file tree Collapse file tree 3 files changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -89,7 +89,8 @@ static void fixGenericExprCastToBool(DiagnosticBuilder &Diag,
89
89
90
90
const Expr *SubExpr = Cast->getSubExpr ();
91
91
92
- bool NeedInnerParens = utils::fixit::areParensNeededForStatement (*SubExpr);
92
+ bool NeedInnerParens =
93
+ utils::fixit::areParensNeededForStatement (*SubExpr->IgnoreImpCasts ());
93
94
bool NeedOuterParens =
94
95
Parent != nullptr && utils::fixit::areParensNeededForStatement (*Parent);
95
96
Original file line number Diff line number Diff line change @@ -381,6 +381,11 @@ Changes in existing checks
381
381
declarations and macros in system headers. The documentation is also improved
382
382
to differentiate the general options from the specific ones.
383
383
384
+ - Improved :doc: `readability-implicit-bool-conversion
385
+ <clang-tidy/checks/readability/implicit-bool-conversion>` check by correctly
386
+ adding parentheses when the inner expression are implicitly converted
387
+ multiple times.
388
+
384
389
- Improved :doc: `readability-qualified-auto
385
390
<clang-tidy/checks/readability/qualified-auto>` check by adding the option
386
391
`IgnoreAliasing `, that allows not looking at underlying types of type aliases.
Original file line number Diff line number Diff line change @@ -547,3 +547,13 @@ namespace PR71848 {
547
547
// CHECK-FIXES: return static_cast<int>( foo );
548
548
}
549
549
}
550
+
551
+ namespace PR161318 {
552
+ int AddParenOutsideOfCompoundAssignOp () {
553
+ int val = -1 ;
554
+ while (val >>= 7 ) {
555
+ // CHECK-MESSAGES: :[[@LINE-1]]:11: warning: implicit conversion 'int' -> 'bool' [readability-implicit-bool-conversion]
556
+ // CHECK-FIXES: while((val >>= 7) != 0) {
557
+ }
558
+ }
559
+ }
You can’t perform that action at this time.
0 commit comments