-
Notifications
You must be signed in to change notification settings - Fork 15.2k
[clang-tidy][NFC][doc] improve "options" sections of bugprone- and modernize- checks
#133525
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[clang-tidy][NFC][doc] improve "options" sections of bugprone- and modernize- checks
#133525
Conversation
|
@llvm/pr-subscribers-clang-tidy @llvm/pr-subscribers-clang-tools-extra Author: Baranov Victor (vbvictor) ChangesImproved "options" sections of
Full diff: https://github.com/llvm/llvm-project/pull/133525.diff 15 Files Affected:
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..1a8698d4366c9 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
@@ -53,4 +53,4 @@ Options
If set to non-zero, 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..a7fb17a4d6937 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
@@ -53,4 +53,4 @@ Options
If set to non-zero, 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..61eaf5cf43b1c 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,11 @@ 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. Default
+ containers with their ``emplace``-like methods are ``vector``, ``deque``,
+ ``forward_list``, ``list``, ``set``, ``map``, ``multiset``, ``multimap``,
+ ``unordered_set``, ``unordered_map``, ``unordered_multiset``,
+ ``unordered_multimap``, ``stack``, ``queue``, ``priority_queue``.
Example
^^^^^^^
|
clang-tools-extra/docs/clang-tidy/checks/modernize/make-shared.rst
Outdated
Show resolved
Hide resolved
clang-tools-extra/docs/clang-tidy/checks/modernize/make-unique.rst
Outdated
Show resolved
Hide resolved
clang-tools-extra/docs/clang-tidy/checks/modernize/use-emplace.rst
Outdated
Show resolved
Hide resolved
carlosgalvezp
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks for improving the docs!
|
@carlosgalvezp, Can you please help land this PR? Thank you |
…`modernize-` checks (llvm#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`.
Improved "options" sections of
bugprone-andmodernize-checks:Optionskeyword to be a delimiter between "body" and "options" parts of docs1totrue.