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

Vladimir Plyashkun via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 11 08:48:24 PDT 2022


vladimir.plyashkun added inline comments.


================
Comment at: clang-tools-extra/clang-tidy/hicpp/SignedBitwiseCheck.cpp:100
                  "%select{binary|unary}0 bitwise operator")
-      << IsUnary << SignedOperand->getSourceRange();
+      << IsUnary << Location;
 }
----------------
njames93 wrote:
> Seems pretty useless to pass the begin location of the Unary/Binary operator here.
> The only source locations that are of interest is the operator location and the whole range of the SignedOperand.
> Based on the issues with jetbrains rendering, I also imagine clangd would have the same issue, We'd likely want to have the diag locations as the SignedOperand begin(like this patch). Then pass the whole source range of the signed operand(like it currently is).
> I'm either way on whether we would need to pass the location of the operator `(BinaryOp|UnaryOp)->getOperatorLoc()`
My initial point was to preserve current behaviour as much as possible, but i agree that `(BinaryOp|UnaryOp)->getOperatorLoc()` is much better in this case.


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