[clang-tidy] Correctly add parentheses in `readability-implicit-bool-conversion` (#162215)
For `CompoundAssignOperator` in condition, there will be two layers of
`ImplicitCastExpr`, for code:
```
int val = -1;
while(val >>= 7) {
}
```
While statement's AST:
```
WhileStmt <line:4:5, line:5:5>
|-ImplicitCastExpr <line:4:11, col:18> 'bool' <IntegralToBoolean>
| `-ImplicitCastExpr <col:11, col:18> 'int' <LValueToRValue>
| `-CompoundAssignOperator <col:11, col:18> 'int' lvalue '>>=' ComputeLHSTy='int' ComputeResultTy='int'
| |-DeclRefExpr <col:11> 'int' lvalue Var 0x20290cb8 'val' 'int'
| `-IntegerLiteral <col:18> 'int' 7
`-CompoundStmt <col:21, line:5:5>
```
This is not taken into account by the check when determining whether
brackets need to be added.
Closes #161318.
GitOrigin-RevId: 4d29460b43e7826300b396a1ff30e5069f42c56c
3 files changed