[clang-tools-extra] [clang-tidy] Improve integer comparison by matching valid expressions outside implicitCastExpr (PR #134188)

via cfe-commits cfe-commits at lists.llvm.org
Wed Apr 2 18:32:13 PDT 2025


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 HEAD~1 HEAD --extensions cpp -- clang-tools-extra/clang-tidy/modernize/UseIntegerSignComparisonCheck.cpp clang-tools-extra/test/clang-tidy/checkers/modernize/use-integer-sign-comparison.cpp
``````````

</details>

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

``````````diff
diff --git a/clang-tools-extra/clang-tidy/modernize/UseIntegerSignComparisonCheck.cpp b/clang-tools-extra/clang-tidy/modernize/UseIntegerSignComparisonCheck.cpp
index 63e044f8c..8f2bb4c4b 100644
--- a/clang-tools-extra/clang-tidy/modernize/UseIntegerSignComparisonCheck.cpp
+++ b/clang-tools-extra/clang-tidy/modernize/UseIntegerSignComparisonCheck.cpp
@@ -54,7 +54,8 @@ intCastExpression(bool IsSigned,
   const auto StaticCastExpr = cxxStaticCastExpr(has(ImplicitCastExpr));
   const auto FunctionalCastExpr = cxxFunctionalCastExpr(has(ImplicitCastExpr));
 
-  // Match function calls or variable references not directly wrapped by an implicit cast
+  // Match function calls or variable references not directly wrapped by an
+  // implicit cast
   const auto CallIntExpr = CastBindName.empty()
                                ? callExpr(HasIntegerType)
                                : callExpr(HasIntegerType).bind(CastBindName);

``````````

</details>


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


More information about the cfe-commits mailing list