[clang-tools-extra] [clang-tidy] Create a check for signed and unsigned integers comparison (PR #113144)

via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 22 07:25:57 PDT 2024


================
@@ -129,13 +129,30 @@ New checks
   Finds cases when an uninstantiated virtual member function in a template class 
   causes cross-compiler incompatibility.
 
+- New :doc:`modernize-use-integer-sign-comparison
+  <clang-tidy/checks/modernize/use-integer-sign-comparison>` check.
+
+  Performs comparisons between signed and unsigned integer types
+  mathematically correct. If C++20 is supported a fix-it replaces
+  integers comparisons to
+  std::cmp_{equal,not_equal,{less,greater}{,_equal}} functions.
----------------
EugeneZelenko wrote:

```suggestion
  ``std::cmp_{equal,not_equal,{less,greater}{,_equal}}`` functions.
```

Or better just to list functions.

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


More information about the cfe-commits mailing list