From d1bd9c4f5b004397653e7d0a1668c74422cf847a Mon Sep 17 00:00:00 2001 From: Victor Baranov Date: Sun, 3 Aug 2025 15:54:21 +0300 Subject: [PATCH] [clang-tidy][docs][NFC] Make uniform "Limitations" sections across all checks --- .../bugprone/compare-pointer-to-member-virtual-function.rst | 1 + .../clang-tidy/checks/bugprone/copy-constructor-init.rst | 4 +++- .../checks/bugprone/crtp-constructor-accessibility.rst | 4 +++- .../bugprone/nondeterministic-pointer-iteration-order.rst | 4 +++- .../checks/bugprone/redundant-branch-condition.rst | 5 +++-- .../docs/clang-tidy/checks/bugprone/sizeof-expression.rst | 3 ++- .../docs/clang-tidy/checks/bugprone/standalone-empty.rst | 4 +++- .../docs/clang-tidy/checks/misc/const-correctness.rst | 5 +++-- .../docs/clang-tidy/checks/misc/no-recursion.rst | 4 +++- .../docs/clang-tidy/checks/modernize/loop-convert.rst | 1 + .../docs/clang-tidy/checks/modernize/pass-by-value.rst | 4 ++-- .../docs/clang-tidy/checks/modernize/replace-auto-ptr.rst | 6 ++++-- .../modernize/replace-disallow-copy-and-assign-macro.rst | 5 +++-- .../docs/clang-tidy/checks/modernize/type-traits.rst | 1 + .../docs/clang-tidy/checks/modernize/use-auto.rst | 5 +++-- .../checks/modernize/use-trailing-return-type.rst | 5 +++-- .../checks/readability/function-cognitive-complexity.rst | 1 + .../checks/readability/misleading-indentation.rst | 1 + .../docs/clang-tidy/checks/readability/qualified-auto.rst | 1 + 19 files changed, 44 insertions(+), 20 deletions(-) diff --git a/clang-tools-extra/docs/clang-tidy/checks/bugprone/compare-pointer-to-member-virtual-function.rst b/clang-tools-extra/docs/clang-tidy/checks/bugprone/compare-pointer-to-member-virtual-function.rst index a8293297c1212..cc711d60e7fd8 100644 --- a/clang-tools-extra/docs/clang-tidy/checks/bugprone/compare-pointer-to-member-virtual-function.rst +++ b/clang-tools-extra/docs/clang-tidy/checks/bugprone/compare-pointer-to-member-virtual-function.rst @@ -56,6 +56,7 @@ virtual functions, thereby improving the overall stability and maintainability of your code. In scenarios involving pointers to member virtual functions, it's only advisable to employ ``nullptr`` for comparisons. + Limitations ----------- diff --git a/clang-tools-extra/docs/clang-tidy/checks/bugprone/copy-constructor-init.rst b/clang-tools-extra/docs/clang-tidy/checks/bugprone/copy-constructor-init.rst index cc3291b9b908e..02d3ddefb8adc 100644 --- a/clang-tools-extra/docs/clang-tidy/checks/bugprone/copy-constructor-init.rst +++ b/clang-tools-extra/docs/clang-tidy/checks/bugprone/copy-constructor-init.rst @@ -35,7 +35,9 @@ outcomes. The check ensures that the copy constructor of a derived class properly calls the copy constructor of the base class, helping to prevent bugs and improve code quality. -Limitations: + +Limitations +----------- * It won't generate warnings for empty classes, as there are no class members (including base class sub-objects) to worry about. diff --git a/clang-tools-extra/docs/clang-tidy/checks/bugprone/crtp-constructor-accessibility.rst b/clang-tools-extra/docs/clang-tidy/checks/bugprone/crtp-constructor-accessibility.rst index 2e22f61ec47c1..f24abfd1b5f5f 100644 --- a/clang-tools-extra/docs/clang-tidy/checks/bugprone/crtp-constructor-accessibility.rst +++ b/clang-tools-extra/docs/clang-tidy/checks/bugprone/crtp-constructor-accessibility.rst @@ -85,7 +85,9 @@ Example: CRTP AlsoCompileTimeError; -Limitations: + +Limitations +----------- * The check is not supported below C++11 diff --git a/clang-tools-extra/docs/clang-tidy/checks/bugprone/nondeterministic-pointer-iteration-order.rst b/clang-tools-extra/docs/clang-tidy/checks/bugprone/nondeterministic-pointer-iteration-order.rst index 41be0bf1c677e..33cf79eccae6b 100644 --- a/clang-tools-extra/docs/clang-tidy/checks/bugprone/nondeterministic-pointer-iteration-order.rst +++ b/clang-tools-extra/docs/clang-tidy/checks/bugprone/nondeterministic-pointer-iteration-order.rst @@ -35,7 +35,9 @@ This check only detects range-based for loops over unordered sets and maps. It also detects calls sorting-like algorithms on containers holding pointers. Other similar usages will not be found and are false negatives. -Limitations: + +Limitations +----------- * This check currently does not check if a nondeterministic iteration order is likely to be a mistake, and instead marks all such iterations as bugprone. diff --git a/clang-tools-extra/docs/clang-tidy/checks/bugprone/redundant-branch-condition.rst b/clang-tools-extra/docs/clang-tidy/checks/bugprone/redundant-branch-condition.rst index a6fff9c29ab24..c2efff8dec1cd 100644 --- a/clang-tools-extra/docs/clang-tidy/checks/bugprone/redundant-branch-condition.rst +++ b/clang-tools-extra/docs/clang-tidy/checks/bugprone/redundant-branch-condition.rst @@ -78,8 +78,9 @@ Every possible change is considered, thus if the condition variable is not a local variable of the function, it is a volatile or it has an alias (pointer or reference) then no warning is issued. -Known limitations -^^^^^^^^^^^^^^^^^ + +Limitations +----------- The ``else`` branch is not checked currently for negated condition variable: diff --git a/clang-tools-extra/docs/clang-tidy/checks/bugprone/sizeof-expression.rst b/clang-tools-extra/docs/clang-tidy/checks/bugprone/sizeof-expression.rst index 04824cc1fe0e4..09be75c9de03a 100644 --- a/clang-tools-extra/docs/clang-tidy/checks/bugprone/sizeof-expression.rst +++ b/clang-tools-extra/docs/clang-tidy/checks/bugprone/sizeof-expression.rst @@ -266,8 +266,9 @@ This check corresponds to the CERT C Coding Standard rule `ARR39-C. Do not add or subtract a scaled integer to a pointer `_. + Limitations -""""""""""" +----------- Cases where the pointee type has a size of `1` byte (such as, and most importantly, ``char``) are excluded. diff --git a/clang-tools-extra/docs/clang-tidy/checks/bugprone/standalone-empty.rst b/clang-tools-extra/docs/clang-tidy/checks/bugprone/standalone-empty.rst index 8dc60464fe2fb..8fdf2fcc6821f 100644 --- a/clang-tools-extra/docs/clang-tidy/checks/bugprone/standalone-empty.rst +++ b/clang-tools-extra/docs/clang-tidy/checks/bugprone/standalone-empty.rst @@ -30,7 +30,9 @@ A call to ``clear()`` would appropriately clear the contents of the range: ... v.clear(); -Limitations: + +Limitations +----------- * Doesn't warn if ``empty()`` is defined and used with the ignore result in the class template definition (for example in the library implementation). These diff --git a/clang-tools-extra/docs/clang-tidy/checks/misc/const-correctness.rst b/clang-tools-extra/docs/clang-tidy/checks/misc/const-correctness.rst index b13367ae5ced6..93a5762be189a 100644 --- a/clang-tools-extra/docs/clang-tidy/checks/misc/const-correctness.rst +++ b/clang-tools-extra/docs/clang-tidy/checks/misc/const-correctness.rst @@ -52,8 +52,9 @@ Note that there is the check :doc:`cppcoreguidelines-avoid-non-const-global-variables <../cppcoreguidelines/avoid-non-const-global-variables>` to enforce ``const`` correctness on all globals. -Known Limitations ------------------ + +Limitations +----------- The check does not run on `C` code. diff --git a/clang-tools-extra/docs/clang-tidy/checks/misc/no-recursion.rst b/clang-tools-extra/docs/clang-tidy/checks/misc/no-recursion.rst index c8281075ded8f..1c04dbfcad532 100644 --- a/clang-tools-extra/docs/clang-tidy/checks/misc/no-recursion.rst +++ b/clang-tools-extra/docs/clang-tidy/checks/misc/no-recursion.rst @@ -14,7 +14,9 @@ References: * JPL Institutional Coding Standard for the C Programming Language (JPL DOCID D-60411) rule `2.4 Do not use direct or indirect recursion`. * OpenCL Specification, Version 1.2 rule `6.9 Restrictions: i. Recursion is not supported. `_. -Limitations: + +Limitations +----------- * The check does not handle calls done through function pointers * The check does not handle C++ destructors diff --git a/clang-tools-extra/docs/clang-tidy/checks/modernize/loop-convert.rst b/clang-tools-extra/docs/clang-tidy/checks/modernize/loop-convert.rst index 3f4783e220501..58d61d1cdbf1f 100644 --- a/clang-tools-extra/docs/clang-tidy/checks/modernize/loop-convert.rst +++ b/clang-tools-extra/docs/clang-tidy/checks/modernize/loop-convert.rst @@ -175,6 +175,7 @@ Options A string specifying which include-style is used, `llvm` or `google`. Default is `llvm`. + Limitations ----------- diff --git a/clang-tools-extra/docs/clang-tidy/checks/modernize/pass-by-value.rst b/clang-tools-extra/docs/clang-tidy/checks/modernize/pass-by-value.rst index e884cf3c4f5df..b8d933aab702c 100644 --- a/clang-tools-extra/docs/clang-tidy/checks/modernize/pass-by-value.rst +++ b/clang-tools-extra/docs/clang-tidy/checks/modernize/pass-by-value.rst @@ -85,8 +85,8 @@ untouched: }; -Known limitations -^^^^^^^^^^^^^^^^^ +Limitations +----------- A situation where the generated code can be wrong is when the object referenced is modified before the assignment in the init-list through a "hidden" reference. diff --git a/clang-tools-extra/docs/clang-tidy/checks/modernize/replace-auto-ptr.rst b/clang-tools-extra/docs/clang-tidy/checks/modernize/replace-auto-ptr.rst index 87321316e000d..8a8c30e6c15a3 100644 --- a/clang-tools-extra/docs/clang-tidy/checks/modernize/replace-auto-ptr.rst +++ b/clang-tools-extra/docs/clang-tidy/checks/modernize/replace-auto-ptr.rst @@ -31,8 +31,10 @@ Since ``std::move()`` is a library function declared in ```` it may be necessary to add this include. The check will add the include directive when necessary. -Known Limitations ------------------ + +Limitations +----------- + * If headers modification is not activated or if a header is not allowed to be changed this check will produce broken code (compilation error), where the headers' code will stay unchanged while the code using them will be changed. diff --git a/clang-tools-extra/docs/clang-tidy/checks/modernize/replace-disallow-copy-and-assign-macro.rst b/clang-tools-extra/docs/clang-tidy/checks/modernize/replace-disallow-copy-and-assign-macro.rst index 016be6738e6dc..5ef6ae7893e9d 100644 --- a/clang-tools-extra/docs/clang-tidy/checks/modernize/replace-disallow-copy-and-assign-macro.rst +++ b/clang-tools-extra/docs/clang-tidy/checks/modernize/replace-disallow-copy-and-assign-macro.rst @@ -33,8 +33,9 @@ It will be transformed to this: const Foo &operator=(const Foo &) = delete; }; -Known Limitations ------------------ + +Limitations +----------- * Notice that the migration example above leaves the ``private`` access specification untouched. You might want to run the check :doc:`modernize-use-equals-delete diff --git a/clang-tools-extra/docs/clang-tidy/checks/modernize/type-traits.rst b/clang-tools-extra/docs/clang-tidy/checks/modernize/type-traits.rst index 0716160182cf2..91be4fb05a0a9 100644 --- a/clang-tools-extra/docs/clang-tidy/checks/modernize/type-traits.rst +++ b/clang-tools-extra/docs/clang-tidy/checks/modernize/type-traits.rst @@ -39,6 +39,7 @@ Options Defaults to `false`. + Limitations ----------- diff --git a/clang-tools-extra/docs/clang-tidy/checks/modernize/use-auto.rst b/clang-tools-extra/docs/clang-tidy/checks/modernize/use-auto.rst index 3aa5c6b07b25c..67536173aa4c6 100644 --- a/clang-tools-extra/docs/clang-tidy/checks/modernize/use-auto.rst +++ b/clang-tools-extra/docs/clang-tidy/checks/modernize/use-auto.rst @@ -166,8 +166,9 @@ that behave as casts, such as ``llvm::dyn_cast``, ``boost::lexical_cast`` and casts if the first template argument is explicit and is a type, and the function returns that type, or a pointer or reference to it. -Known Limitations ------------------ + +Limitations +----------- * If the initializer is an explicit conversion constructor, the check will not replace the type specifier even though it would be safe to do so. diff --git a/clang-tools-extra/docs/clang-tidy/checks/modernize/use-trailing-return-type.rst b/clang-tools-extra/docs/clang-tidy/checks/modernize/use-trailing-return-type.rst index 2dac7cc76f418..63b8885014e60 100644 --- a/clang-tools-extra/docs/clang-tidy/checks/modernize/use-trailing-return-type.rst +++ b/clang-tools-extra/docs/clang-tidy/checks/modernize/use-trailing-return-type.rst @@ -27,8 +27,9 @@ transforms to: virtual auto f3() const && -> float = delete; auto lambda = []() -> void {}; -Known Limitations ------------------ + +Limitations +----------- The following categories of return types cannot be rewritten currently: diff --git a/clang-tools-extra/docs/clang-tidy/checks/readability/function-cognitive-complexity.rst b/clang-tools-extra/docs/clang-tidy/checks/readability/function-cognitive-complexity.rst index ffd2b2c68c8d2..3710917f6cee1 100644 --- a/clang-tools-extra/docs/clang-tidy/checks/readability/function-cognitive-complexity.rst +++ b/clang-tools-extra/docs/clang-tidy/checks/readability/function-cognitive-complexity.rst @@ -154,6 +154,7 @@ set to `2` or smaller. If the option DescribeBasicIncrements is set to `true`, it will additionally flag the two `if` statements with the amounts by which they increase to the complexity of the function and the current nesting level. + Limitations ----------- diff --git a/clang-tools-extra/docs/clang-tidy/checks/readability/misleading-indentation.rst b/clang-tools-extra/docs/clang-tidy/checks/readability/misleading-indentation.rst index 8b6655c83564c..cac55dd8c22b9 100644 --- a/clang-tools-extra/docs/clang-tidy/checks/readability/misleading-indentation.rst +++ b/clang-tools-extra/docs/clang-tidy/checks/readability/misleading-indentation.rst @@ -31,6 +31,7 @@ Examples: foo1(); foo2(); // Not guarded by if(cond1). + Limitations ----------- diff --git a/clang-tools-extra/docs/clang-tidy/checks/readability/qualified-auto.rst b/clang-tools-extra/docs/clang-tidy/checks/readability/qualified-auto.rst index 34390e23b071c..d031b677d7618 100644 --- a/clang-tools-extra/docs/clang-tidy/checks/readability/qualified-auto.rst +++ b/clang-tools-extra/docs/clang-tidy/checks/readability/qualified-auto.rst @@ -119,6 +119,7 @@ Note in the LLVM alias, the default value is `false`. Otherwise no changes will occur. + Limitations -----------