[clang-tools-extra] [clang-tidy] Create a check for signed and unsigned integers comparison (PR #113144)
Julian Schmidt via cfe-commits
cfe-commits at lists.llvm.org
Thu Oct 31 16:53:53 PDT 2024
================
@@ -0,0 +1,43 @@
+.. title:: clang-tidy - modernize-use-integer-sign-comparison
+
+modernize-use-integer-sign-comparison
+=====================================
+
+Replace comparisons between signed and unsigned integers with their safe
+``std::cmp_*`` alternative.
+
+Examples of fixes created by the check:
+
+.. code-block:: c++
+
+ uint func(int bla)
+ {
+ uint result;
+ if (result == bla)
+ return 0;
+
+ return 1;
+ }
+
+becomes
+
+.. code-block:: c++
+
+ #include <utility>
+
+ uint func(int bla)
+ {
+ uint result;
+ if (std::cmp_equal(result, bla))
+ return 0;
+
+ return 1;
+ }
+
+Options
+-------
----------------
5chmidti wrote:
The check does have an option called `IsQtApplication`. Please document it here
https://github.com/llvm/llvm-project/pull/113144
More information about the cfe-commits
mailing list