[clang] [clang-tools-extra] [clang-tidy] bugprone-implicit-widening ignores unsigned consts (PR #101073)

via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 26 11:03:28 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 2326a02357c74a1a913a3d572bf789d4d48af7f0 276e48b39864d2c91f97f501d9bc5ed59ca52ced --extensions h,cpp -- clang-tools-extra/clang-tidy/bugprone/ImplicitWideningOfMultiplicationResultCheck.cpp clang-tools-extra/test/clang-tidy/checkers/bugprone/implicit-widening-of-multiplication-result-constants.cpp clang/include/clang/AST/Expr.h clang/lib/AST/ExprConstant.cpp clang/unittests/AST/ASTExprTest.cpp
``````````

</details>

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

``````````diff
diff --git a/clang/unittests/AST/ASTExprTest.cpp b/clang/unittests/AST/ASTExprTest.cpp
index f9d451d8c1..4edb87a6c0 100644
--- a/clang/unittests/AST/ASTExprTest.cpp
+++ b/clang/unittests/AST/ASTExprTest.cpp
@@ -121,7 +121,8 @@ TEST(ASTExpr, NoUnsignedOverflowICE) {
   EXPECT_TRUE(ICE->isUnsigned());
   EXPECT_EQ(8u, *ICE);
 
-  const auto ICEOverflowCheck = Var->getInit()->getIntegerConstantExpr(Ctx, nullptr, true);
+  const auto ICEOverflowCheck =
+      Var->getInit()->getIntegerConstantExpr(Ctx, nullptr, true);
   EXPECT_TRUE(ICEOverflowCheck.has_value());
   EXPECT_TRUE(ICEOverflowCheck->isUnsigned());
   EXPECT_EQ(8u, *ICEOverflowCheck);
@@ -139,6 +140,7 @@ TEST(ASTExpr, CheckForUnsignedOverflowICE) {
   EXPECT_TRUE(ICE->isUnsigned());
   EXPECT_EQ(3'705'032'704u, *ICE);
 
-  const auto ICEOverflowCheck = Var->getInit()->getIntegerConstantExpr(Ctx, nullptr, true);
+  const auto ICEOverflowCheck =
+      Var->getInit()->getIntegerConstantExpr(Ctx, nullptr, true);
   EXPECT_FALSE(ICEOverflowCheck.has_value());
 }

``````````

</details>


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


More information about the cfe-commits mailing list