[clang-tools-extra] [clang-tidy] Add new check `readability-use-numeric-limits` (PR #127430)
Baranov Victor via cfe-commits
cfe-commits at lists.llvm.org
Mon Feb 17 22:36:10 PST 2025
================
@@ -0,0 +1,23 @@
+.. title:: clang-tidy - readability-use-numeric-limits
+
+readability-use-numeric-limits
+==============================
+
+ Replaces certain integer literals with equivalent calls to
+ ``std::numeric_limits<T>::min()`` or ``std::numeric_limits<T>::max()``.
+
+Before:
+
+.. code-block:: c++
+
+ void foo() {
+ int32_t a = 2147483647;
+ }
+
+After:
+
+.. code-block:: c++
+
+ void foo() {
+ int32_t a = std::numeric_limits<int32_t>::max();
+ }
----------------
vbvictor wrote:
Add `IncludeStyle` option to docs as in other checks.
https://github.com/llvm/llvm-project/pull/127430
More information about the cfe-commits
mailing list