[clang] [ExprConstant] Handle shift overflow the same way as other kinds of overflow (PR #99579)

via cfe-commits cfe-commits at lists.llvm.org
Thu Jul 18 15:04:18 PDT 2024


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff 49b2c30feb3730ccb1ba075dd37e68d47095bb23 1137011c51285b083cab6c15de670e64337d3de0 --extensions c,h,cpp -- clang/lib/AST/ExprConstant.cpp clang/lib/AST/Interp/Interp.h clang/test/AST/Interp/shifts.cpp clang/test/CXX/basic/basic.types/p10.cpp clang/test/Sema/constant-builtins-2.c clang/test/Sema/shift-count-negative.c clang/test/Sema/shift-count-overflow.c clang/test/Sema/shift-negative-value.c
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/clang/lib/AST/Interp/Interp.h b/clang/lib/AST/Interp/Interp.h
index 1b17db61d7..fa74e995ed 100644
--- a/clang/lib/AST/Interp/Interp.h
+++ b/clang/lib/AST/Interp/Interp.h
@@ -160,7 +160,8 @@ bool CheckShift(InterpState &S, CodePtr OpPC, const LT &LHS, const RT &RHS,
       S.CCEDiag(E, diag::note_constexpr_lshift_of_negative) << LHS.toAPSInt();
       if (!S.noteUndefinedBehavior())
         return false;
-    } else if (LHS.toUnsigned().countLeadingZeros() < static_cast<unsigned>(RHS)) {
+    } else if (LHS.toUnsigned().countLeadingZeros() <
+               static_cast<unsigned>(RHS)) {
       S.CCEDiag(E, diag::note_constexpr_lshift_discards);
       if (!S.noteUndefinedBehavior())
         return false;

``````````

</details>


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


More information about the cfe-commits mailing list