Open RKSimon opened 4 months ago
@llvm/issue-subscribers-clang-tidy
Author: Simon Pilgrim (RKSimon)
Code bases that prefer more parens can adopt this pattern, but llvm-project should probably avoid it.
The ternary conditional pattern [-+*%] \w+ \?
is a common idiom used in many codebases, e.g. I == E - 1 ? Size : Layout->getElementOffset(I + 1)
.
Adding parentheses around these expressions seems to provide little benefit in terms of readability or maintainability, given the churn cost. Consider suppressing these static analyzer reports for this specific pattern.
As reported on #85868 (and case inside llvm/clang fixed by #90391)
We have cases like:
Similar to #84481 it'd be much easier to read if this was: