diff options
author | Chris Warner <73851242+cwarner-8702@users.noreply.github.com> | 2024-07-15 12:36:00 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-07-15 21:36:00 +0200 |
commit | f964e8a3f9ef9789f9075694cb887d0b3986d304 (patch) | |
tree | e1b58f51c0da724b312f6ab7e0612f0060ff3b0a /README.md | |
parent | 1301cf486639c31353b2eede4596f3216c0d49ea (diff) | |
download | llvm-f964e8a3f9ef9789f9075694cb887d0b3986d304.zip llvm-f964e8a3f9ef9789f9075694cb887d0b3986d304.tar.gz llvm-f964e8a3f9ef9789f9075694cb887d0b3986d304.tar.bz2 |
[clang-tidy] bugprone-implicit-widening ignores const exprs that fit (#98352)
Add an option to the
`bugprone-implicit-widening-of-multiplication-result` clang-tidy checker
to suppress warnings when the expression is made up of all compile-time
constants (literals, `constexpr` values or results, etc.) and the result
of the multiplication is guaranteed to fit in both the source and
destination types.
This currently only works for signed integer types:
* For unsigned integers, the well-defined rollover behavior on overflow
prevents the checker from detecting that the expression does not
actually fit in the source expr type, and would produce false negatives.
I have a somewhat-hacky stab at addressing this I'd like to submit as a
follow-on PR
* For floating-point types, there's probably a little additional work to
be done to `Expr` to calculate the result at compile time
Even still, this seems like a helpful addition just for signed types,
and additional types can be added.
Diffstat (limited to 'README.md')
0 files changed, 0 insertions, 0 deletions