[clang] [Sema] Fixed faulty shift count warning (PR #69521)

Shafik Yaghmour via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 30 09:54:30 PDT 2023


================
@@ -12143,8 +12143,7 @@ static void DiagnoseBadShiftValues(Sema& S, ExprResult &LHS, ExprResult &RHS,
     auto FXSema = S.Context.getFixedPointSemantics(LHSExprType);
     LeftSize = FXSema.getWidth() - (unsigned)FXSema.hasUnsignedPadding();
   }
-  llvm::APInt LeftBits(Right.getBitWidth(), LeftSize);
-  if (Right.uge(LeftBits)) {
+  if (Right.uge(LeftSize)) {
----------------
shafik wrote:

I feel like `LeftSizeInBits` would be a more appropriate name but the changes looks right.

https://github.com/llvm/llvm-project/pull/69521


More information about the cfe-commits mailing list