[clang-tools-extra] 52639d6 - [clang-tidy][NFC][doc] improve "options" sections of `bugprone-` and `modernize-` checks (#133525)
via cfe-commits
cfe-commits at lists.llvm.org
Sun Mar 30 11:26:27 PDT 2025
Author: Baranov Victor
Date: 2025-03-30T20:26:23+02:00
New Revision: 52639d69acbed0e49fd855c8c04cd9307405e2e6
URL: https://github.com/llvm/llvm-project/commit/52639d69acbed0e49fd855c8c04cd9307405e2e6
DIFF: https://github.com/llvm/llvm-project/commit/52639d69acbed0e49fd855c8c04cd9307405e2e6.diff
LOG: [clang-tidy][NFC][doc] improve "options" sections of `bugprone-` and `modernize-` checks (#133525)
Improved "options" sections of `bugprone-` and `modernize-` checks:
1. Added `Options` keyword to be a delimiter between "body" and
"options" parts of docs
2. Added default values where was absent.
3. Improved readability of some default values by converting `1` to
`true`.
Added:
Modified:
clang-tools-extra/docs/clang-tidy/checks/bugprone/assert-side-effect.rst
clang-tools-extra/docs/clang-tidy/checks/bugprone/capturing-this-in-member-variable.rst
clang-tools-extra/docs/clang-tidy/checks/bugprone/signed-char-misuse.rst
clang-tools-extra/docs/clang-tidy/checks/bugprone/suspicious-enum-usage.rst
clang-tools-extra/docs/clang-tidy/checks/bugprone/suspicious-stringview-data-usage.rst
clang-tools-extra/docs/clang-tidy/checks/bugprone/too-small-loop-variable.rst
clang-tools-extra/docs/clang-tidy/checks/bugprone/unhandled-self-assignment.rst
clang-tools-extra/docs/clang-tidy/checks/bugprone/unintended-char-ostream-output.rst
clang-tools-extra/docs/clang-tidy/checks/modernize/avoid-bind.rst
clang-tools-extra/docs/clang-tidy/checks/modernize/avoid-c-arrays.rst
clang-tools-extra/docs/clang-tidy/checks/modernize/loop-convert.rst
clang-tools-extra/docs/clang-tidy/checks/modernize/make-shared.rst
clang-tools-extra/docs/clang-tidy/checks/modernize/make-unique.rst
clang-tools-extra/docs/clang-tidy/checks/modernize/raw-string-literal.rst
clang-tools-extra/docs/clang-tidy/checks/modernize/use-emplace.rst
Removed:
################################################################################
diff --git a/clang-tools-extra/docs/clang-tidy/checks/bugprone/assert-side-effect.rst b/clang-tools-extra/docs/clang-tidy/checks/bugprone/assert-side-effect.rst
index 1355afae92e4f..3ca712b958d04 100644
--- a/clang-tools-extra/docs/clang-tidy/checks/bugprone/assert-side-effect.rst
+++ b/clang-tools-extra/docs/clang-tidy/checks/bugprone/assert-side-effect.rst
@@ -15,6 +15,7 @@ Options
.. option:: AssertMacros
A comma-separated list of the names of assert macros to be checked.
+ Default is `assert,NSAssert,NSCAssert`.
.. option:: CheckFunctionCalls
diff --git a/clang-tools-extra/docs/clang-tidy/checks/bugprone/capturing-this-in-member-variable.rst b/clang-tools-extra/docs/clang-tidy/checks/bugprone/capturing-this-in-member-variable.rst
index bb75e9239d9b5..b09d7d5fce959 100644
--- a/clang-tools-extra/docs/clang-tidy/checks/bugprone/capturing-this-in-member-variable.rst
+++ b/clang-tools-extra/docs/clang-tidy/checks/bugprone/capturing-this-in-member-variable.rst
@@ -32,6 +32,9 @@ Possible fixes:
object types.
- passing ``this`` pointer as parameter
+Options
+-------
+
.. option:: FunctionWrapperTypes
A semicolon-separated list of names of types. Used to specify function
diff --git a/clang-tools-extra/docs/clang-tidy/checks/bugprone/signed-char-misuse.rst b/clang-tools-extra/docs/clang-tidy/checks/bugprone/signed-char-misuse.rst
index 72860e8cf2a1d..4edbad5eac81b 100644
--- a/clang-tools-extra/docs/clang-tidy/checks/bugprone/signed-char-misuse.rst
+++ b/clang-tools-extra/docs/clang-tidy/checks/bugprone/signed-char-misuse.rst
@@ -104,13 +104,16 @@ so both arguments will have the same type.
return false;
}
+Options
+-------
+
.. option:: CharTypdefsToIgnore
A semicolon-separated list of typedef names. In this list, we can list
typedefs for ``char`` or ``signed char``, which will be ignored by the
check. This is useful when a typedef introduces an integer alias like
``sal_Int8`` or ``int8_t``. In this case, human misinterpretation is not
- an issue.
+ an issue. Default is an empty string.
.. option:: DiagnoseSignedUnsignedCharComparisons
diff --git a/clang-tools-extra/docs/clang-tidy/checks/bugprone/suspicious-enum-usage.rst b/clang-tools-extra/docs/clang-tidy/checks/bugprone/suspicious-enum-usage.rst
index e87172414a23e..94f29ee11ee39 100644
--- a/clang-tools-extra/docs/clang-tidy/checks/bugprone/suspicious-enum-usage.rst
+++ b/clang-tools-extra/docs/clang-tidy/checks/bugprone/suspicious-enum-usage.rst
@@ -71,6 +71,7 @@ Examples:
Options
-------
+
.. option:: StrictMode
Default value: 0.
diff --git a/clang-tools-extra/docs/clang-tidy/checks/bugprone/suspicious-stringview-data-usage.rst b/clang-tools-extra/docs/clang-tidy/checks/bugprone/suspicious-stringview-data-usage.rst
index 9b38d83601810..de10da21e8442 100644
--- a/clang-tools-extra/docs/clang-tidy/checks/bugprone/suspicious-stringview-data-usage.rst
+++ b/clang-tools-extra/docs/clang-tidy/checks/bugprone/suspicious-stringview-data-usage.rst
@@ -43,6 +43,9 @@ lead to a compilation error due to the explicit nature of the ``std::string``
constructor. Consequently, developers might opt for ``sv.data()`` to resolve the
compilation error, albeit introducing potential hazards as discussed.
+Options
+-------
+
.. option:: StringViewTypes
Option allows users to specify custom string view-like types for analysis. It
diff --git a/clang-tools-extra/docs/clang-tidy/checks/bugprone/too-small-loop-variable.rst b/clang-tools-extra/docs/clang-tidy/checks/bugprone/too-small-loop-variable.rst
index 2c3ded952aa02..077abf0af6880 100644
--- a/clang-tools-extra/docs/clang-tidy/checks/bugprone/too-small-loop-variable.rst
+++ b/clang-tools-extra/docs/clang-tidy/checks/bugprone/too-small-loop-variable.rst
@@ -32,6 +32,9 @@ It's recommended to enable the compiler warning
`-Wtautological-constant-out-of-range-compare` as well, since check does not
inspect compile-time constant loop boundaries to avoid overlaps with the warning.
+Options
+-------
+
.. option:: MagnitudeBitsUpperLimit
Upper limit for the magnitude bits of the loop variable. If it's set the check
diff --git a/clang-tools-extra/docs/clang-tidy/checks/bugprone/unhandled-self-assignment.rst b/clang-tools-extra/docs/clang-tidy/checks/bugprone/unhandled-self-assignment.rst
index d3cdd5a12fdca..3a6245d2fe35b 100644
--- a/clang-tools-extra/docs/clang-tidy/checks/bugprone/unhandled-self-assignment.rst
+++ b/clang-tools-extra/docs/clang-tidy/checks/bugprone/unhandled-self-assignment.rst
@@ -118,6 +118,9 @@ temporary object into ``this`` (needs a move assignment operator):
}
};
+Options
+-------
+
.. option:: WarnOnlyIfThisHasSuspiciousField
When `true`, the check will warn only if the container class of the copy
diff --git a/clang-tools-extra/docs/clang-tidy/checks/bugprone/unintended-char-ostream-output.rst b/clang-tools-extra/docs/clang-tidy/checks/bugprone/unintended-char-ostream-output.rst
index ea1051847129b..95d02b3e2ddda 100644
--- a/clang-tools-extra/docs/clang-tidy/checks/bugprone/unintended-char-ostream-output.rst
+++ b/clang-tools-extra/docs/clang-tidy/checks/bugprone/unintended-char-ostream-output.rst
@@ -39,6 +39,9 @@ Or cast to char to explicitly indicate that output should be a character.
std::cout << static_cast<char>(v);
+Options
+-------
+
.. option:: CastTypeName
When `CastTypeName` is specified, the fix-it will use `CastTypeName` as the
diff --git a/clang-tools-extra/docs/clang-tidy/checks/modernize/avoid-bind.rst b/clang-tools-extra/docs/clang-tidy/checks/modernize/avoid-bind.rst
index 10374daecb660..64e7e95db8800 100644
--- a/clang-tools-extra/docs/clang-tidy/checks/modernize/avoid-bind.rst
+++ b/clang-tools-extra/docs/clang-tidy/checks/modernize/avoid-bind.rst
@@ -50,8 +50,9 @@ Options
of every placeholder parameter list. Without this, it is possible for a fix-it
to perform an incorrect transformation in the case where the result of the ``bind``
is used in the context of a type erased functor such as ``std::function`` which
- allows mismatched arguments. For example:
+ allows mismatched arguments. Default is is `false`.
+For example:
.. code-block:: c++
diff --git a/clang-tools-extra/docs/clang-tidy/checks/modernize/avoid-c-arrays.rst b/clang-tools-extra/docs/clang-tidy/checks/modernize/avoid-c-arrays.rst
index 6a386ecd0fd4b..b7a87bf23967b 100644
--- a/clang-tools-extra/docs/clang-tidy/checks/modernize/avoid-c-arrays.rst
+++ b/clang-tools-extra/docs/clang-tidy/checks/modernize/avoid-c-arrays.rst
@@ -62,6 +62,9 @@ Similarly, the ``main()`` function is ignored. Its second and third parameters
can be either ``char* argv[]`` or ``char** argv``, but cannot be
``std::array<>``.
+Options
+-------
+
.. option:: AllowStringArrays
When set to `true` (default is `false`), variables of character array type
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 0c423edca1822..3f4783e220501 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
@@ -140,6 +140,9 @@ however the check can be configured to work without C++20 by specifying a
function to reverse a range and optionally the header file where that function
lives.
+Options
+-------
+
.. option:: UseCxx20ReverseRanges
When set to true convert loops when in C++20 or later mode using
diff --git a/clang-tools-extra/docs/clang-tidy/checks/modernize/make-shared.rst b/clang-tools-extra/docs/clang-tidy/checks/modernize/make-shared.rst
index 9c1fceaa06000..982138fc5e781 100644
--- a/clang-tools-extra/docs/clang-tidy/checks/modernize/make-shared.rst
+++ b/clang-tools-extra/docs/clang-tidy/checks/modernize/make-shared.rst
@@ -51,6 +51,6 @@ Options
.. option:: IgnoreDefaultInitialization
- If set to non-zero, the check does not suggest edits that will transform
+ If set to `false`, the check does not suggest edits that will transform
default initialization into value initialization, as this can cause
- performance regressions. Default is `1`.
+ performance regressions. Default is `true`.
diff --git a/clang-tools-extra/docs/clang-tidy/checks/modernize/make-unique.rst b/clang-tools-extra/docs/clang-tidy/checks/modernize/make-unique.rst
index cd474d352bac0..1aaa8701cd0f1 100644
--- a/clang-tools-extra/docs/clang-tidy/checks/modernize/make-unique.rst
+++ b/clang-tools-extra/docs/clang-tidy/checks/modernize/make-unique.rst
@@ -51,6 +51,6 @@ Options
.. option:: IgnoreDefaultInitialization
- If set to non-zero, the check does not suggest edits that will transform
+ If set to `false`, the check does not suggest edits that will transform
default initialization into value initialization, as this can cause
- performance regressions. Default is `1`.
+ performance regressions. Default is `true`.
diff --git a/clang-tools-extra/docs/clang-tidy/checks/modernize/raw-string-literal.rst b/clang-tools-extra/docs/clang-tidy/checks/modernize/raw-string-literal.rst
index 6d7589a0011bb..66e50e80fa70b 100644
--- a/clang-tools-extra/docs/clang-tidy/checks/modernize/raw-string-literal.rst
+++ b/clang-tools-extra/docs/clang-tidy/checks/modernize/raw-string-literal.rst
@@ -45,6 +45,9 @@ An escaped horizontal tab, form feed, or vertical tab prevents the string
literal from being converted. The presence of a horizontal tab, form feed or
vertical tab in source code is not visually obvious.
+Options
+-------
+
.. option:: DelimiterStem
Custom delimiter to escape characters in raw string literals. It is used in
diff --git a/clang-tools-extra/docs/clang-tidy/checks/modernize/use-emplace.rst b/clang-tools-extra/docs/clang-tidy/checks/modernize/use-emplace.rst
index f61b93aac7c76..e020ece296475 100644
--- a/clang-tools-extra/docs/clang-tidy/checks/modernize/use-emplace.rst
+++ b/clang-tools-extra/docs/clang-tidy/checks/modernize/use-emplace.rst
@@ -163,7 +163,8 @@ Options
Semicolon-separated list of containers without their template parameters
and some ``emplace``-like method of the container. Example:
``vector::emplace_back``. Those methods will be checked for improper use and
- the check will report when a temporary is unnecessarily created.
+ the check will report when a temporary is unnecessarily created. All STL
+ containers with such member functions are supported by default.
Example
^^^^^^^
More information about the cfe-commits
mailing list