[PATCH] D131678: hicpp-signed-bitwise - Return location of the operand (and not of the operator beginning)

Carlos Galvez via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 11 07:43:55 PDT 2022


carlosgalvezp added a comment.

On the other hand, if the `0xFF` becomes `0xFFu`, then Clang performs an integer promotion to `unsigned int` instead of `int`, and that's why clang-tidy no longer complains.

I'm not sure that's correct behavior, however:

  If int can represent the entire range of values of the original type (or the range of values of the original bit field), the value is converted to type int. Otherwise the value is converted to unsigned int.

https://en.cppreference.com/w/c/language/conversion

In this case, an `int` can represent fully all values of an `uint8_t`.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D131678/new/

https://reviews.llvm.org/D131678



More information about the cfe-commits mailing list