[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:40:15 PDT 2022
carlosgalvezp added a comment.
Hi @vladimir.plyashkun !
I looked at the screenshot in the link you posted. What is the type of `value`?
Consider that if `value` is an `uint8_t`, as per the integer promotion rules, it will be promoted to (signed) `int` before running the bitwise operation. Therefore `clang-tidy` is right to point out the problem with `value`. Check it out:
https://godbolt.org/z/8EMcPd6rd
`-DeclStmt <line:6:5, col:22>
`-VarDecl <col:5, col:18> col:10 y 'int':'int' cinit
`-BinaryOperator <col:14, col:18> 'int' '&'
|-ImplicitCastExpr <col:14> 'int' <IntegralCast>
| `-ImplicitCastExpr <col:14> 'std::uint8_t':'unsigned char' <LValueToRValue>
| `-DeclRefExpr <col:14> 'std::uint8_t':'unsigned char' lvalue Var 0x55db629e40e8 'x' 'std::uint8_t':'unsigned char'
`-IntegerLiteral <col:18> 'int' 255
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