[clang-tools-extra] [clang-tidy][NFC][doc] improve "options" sections of `misc-`, `cppcore-` and other checks (PR #133694)
Baranov Victor via cfe-commits
cfe-commits at lists.llvm.org
Mon Mar 31 07:57:23 PDT 2025
https://github.com/vbvictor updated https://github.com/llvm/llvm-project/pull/133694
>From 3f2086a843ccbc2dca5185199bbb91c366bcae06 Mon Sep 17 00:00:00 2001
From: Victor Baranov <bar.victor.2002 at gmail.com>
Date: Mon, 31 Mar 2025 13:12:23 +0300
Subject: [PATCH 1/3] [clang-tidy] improve docs for various checks
---
.../checks/android/comparison-in-temp-failure-retry.rst | 1 +
.../docs/clang-tidy/checks/cert/msc51-cpp.rst | 2 +-
.../docs/clang-tidy/checks/concurrency/mt-unsafe.rst | 3 +++
.../clang-tidy/checks/cppcoreguidelines/no-malloc.rst | 6 +++---
.../checks/cppcoreguidelines/owning-memory.rst | 4 ++--
.../pro-bounds-constant-array-index.rst | 1 +
.../checks/cppcoreguidelines/pro-type-member-init.rst | 1 +
.../clang-tidy/checks/misc/coroutine-hostile-raii.rst | 8 ++++----
.../docs/clang-tidy/checks/misc/include-cleaner.rst | 4 ++--
.../misc/non-private-member-variables-in-classes.rst | 9 +++++----
10 files changed, 23 insertions(+), 16 deletions(-)
diff --git a/clang-tools-extra/docs/clang-tidy/checks/android/comparison-in-temp-failure-retry.rst b/clang-tools-extra/docs/clang-tidy/checks/android/comparison-in-temp-failure-retry.rst
index 93112ee2bea64..31cc72b0579c4 100644
--- a/clang-tools-extra/docs/clang-tidy/checks/android/comparison-in-temp-failure-retry.rst
+++ b/clang-tools-extra/docs/clang-tidy/checks/android/comparison-in-temp-failure-retry.rst
@@ -41,3 +41,4 @@ Options
.. option:: RetryMacros
A comma-separated list of the names of retry macros to be checked.
+ Default is `TEMP_FAILURE_RETRY`.
diff --git a/clang-tools-extra/docs/clang-tidy/checks/cert/msc51-cpp.rst b/clang-tools-extra/docs/clang-tidy/checks/cert/msc51-cpp.rst
index 1e0e34efe0a58..99e550aef0e7a 100644
--- a/clang-tools-extra/docs/clang-tidy/checks/cert/msc51-cpp.rst
+++ b/clang-tools-extra/docs/clang-tidy/checks/cert/msc51-cpp.rst
@@ -37,4 +37,4 @@ Options
.. option:: DisallowedSeedTypes
A comma-separated list of the type names which are disallowed.
- Default values are ``time_t``, ``std::time_t``.
+ Default value is `time_t,std::time_t`.
diff --git a/clang-tools-extra/docs/clang-tidy/checks/concurrency/mt-unsafe.rst b/clang-tools-extra/docs/clang-tidy/checks/concurrency/mt-unsafe.rst
index 4e46ba1edc34f..337be787d962b 100644
--- a/clang-tools-extra/docs/clang-tidy/checks/concurrency/mt-unsafe.rst
+++ b/clang-tools-extra/docs/clang-tidy/checks/concurrency/mt-unsafe.rst
@@ -32,6 +32,9 @@ Examples:
sleep(1); // implementation may use SIGALRM
+Options
+-------
+
.. option:: FunctionSet
Specifies which functions in libc should be considered thread-safe,
diff --git a/clang-tools-extra/docs/clang-tidy/checks/cppcoreguidelines/no-malloc.rst b/clang-tools-extra/docs/clang-tidy/checks/cppcoreguidelines/no-malloc.rst
index 237520aa6690a..e3a162078a3b8 100644
--- a/clang-tools-extra/docs/clang-tidy/checks/cppcoreguidelines/no-malloc.rst
+++ b/clang-tools-extra/docs/clang-tidy/checks/cppcoreguidelines/no-malloc.rst
@@ -35,14 +35,14 @@ Options
.. option:: Allocations
Semicolon-separated list of fully qualified names of memory allocation functions.
- Defaults to ``::malloc;::calloc``.
+ Defaults to `::malloc;::calloc`.
.. option:: Deallocations
Semicolon-separated list of fully qualified names of memory allocation functions.
- Defaults to ``::free``.
+ Defaults to `::free`.
.. option:: Reallocations
Semicolon-separated list of fully qualified names of memory allocation functions.
- Defaults to ``::realloc``.
+ Defaults to `::realloc`.
diff --git a/clang-tools-extra/docs/clang-tidy/checks/cppcoreguidelines/owning-memory.rst b/clang-tools-extra/docs/clang-tidy/checks/cppcoreguidelines/owning-memory.rst
index 3c91d09dda1f2..4fc49f8bd6eee 100644
--- a/clang-tools-extra/docs/clang-tidy/checks/cppcoreguidelines/owning-memory.rst
+++ b/clang-tools-extra/docs/clang-tidy/checks/cppcoreguidelines/owning-memory.rst
@@ -95,14 +95,14 @@ Options
Semicolon-separated list of fully qualified names of legacy functions that create
resources but cannot introduce ``gsl::owner<>``.
- Defaults to ``::malloc;::aligned_alloc;::realloc;::calloc;::fopen;::freopen;::tmpfile``.
+ Defaults to `::malloc;::aligned_alloc;::realloc;::calloc;::fopen;::freopen;::tmpfile`.
.. option:: LegacyResourceConsumers
Semicolon-separated list of fully qualified names of legacy functions expecting
resource owners as pointer arguments but cannot introduce ``gsl::owner<>``.
- Defaults to ``::free;::realloc;::freopen;::fclose``.
+ Defaults to `::free;::realloc;::freopen;::fclose`.
Limitations
diff --git a/clang-tools-extra/docs/clang-tidy/checks/cppcoreguidelines/pro-bounds-constant-array-index.rst b/clang-tools-extra/docs/clang-tidy/checks/cppcoreguidelines/pro-bounds-constant-array-index.rst
index 4e877676cf1fe..9b82e0c45a314 100644
--- a/clang-tools-extra/docs/clang-tidy/checks/cppcoreguidelines/pro-bounds-constant-array-index.rst
+++ b/clang-tools-extra/docs/clang-tidy/checks/cppcoreguidelines/pro-bounds-constant-array-index.rst
@@ -21,6 +21,7 @@ Options
The check can generate fixes after this option has been set to the name of
the include file that contains ``gsl::at()``, e.g. `"gsl/gsl.h"`.
+ Default is an empty string.
.. option:: IncludeStyle
diff --git a/clang-tools-extra/docs/clang-tidy/checks/cppcoreguidelines/pro-type-member-init.rst b/clang-tools-extra/docs/clang-tidy/checks/cppcoreguidelines/pro-type-member-init.rst
index 97af01a895e1c..3c6797bce9450 100644
--- a/clang-tools-extra/docs/clang-tidy/checks/cppcoreguidelines/pro-type-member-init.rst
+++ b/clang-tools-extra/docs/clang-tidy/checks/cppcoreguidelines/pro-type-member-init.rst
@@ -37,6 +37,7 @@ Options
If set to `true`, the check will provide fix-its with literal initializers
\( ``int i = 0;`` \) instead of curly braces \( ``int i{};`` \).
+ Default is `false`.
This rule is part of the `Type safety (Type.6)
<https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Pro-type-memberinit>`_
diff --git a/clang-tools-extra/docs/clang-tidy/checks/misc/coroutine-hostile-raii.rst b/clang-tools-extra/docs/clang-tidy/checks/misc/coroutine-hostile-raii.rst
index a39c1853b313c..53375b40f4d0e 100644
--- a/clang-tools-extra/docs/clang-tidy/checks/misc/coroutine-hostile-raii.rst
+++ b/clang-tools-extra/docs/clang-tidy/checks/misc/coroutine-hostile-raii.rst
@@ -45,8 +45,8 @@ Options
A semicolon-separated list of qualified types which should not be allowed to
persist across suspension points.
- Eg: ``my::lockable; a::b;::my::other::lockable;``
- The default value of this option is `"std::lock_guard;std::scoped_lock"`.
+ Eg: `my::lockable;a::b;::my::other::lockable;`
+ The default value of this option is `std::lock_guard;std::scoped_lock`.
.. option:: AllowedAwaitablesList
@@ -78,6 +78,6 @@ Options
co_await wait();
}
- Eg: ``my::safe::awaitable;other::awaitable``
- The default value of this option is empty string `""`.
+ Eg: `my::safe::awaitable;other::awaitable`
+ The default value of this option is an empty string.
diff --git a/clang-tools-extra/docs/clang-tidy/checks/misc/include-cleaner.rst b/clang-tools-extra/docs/clang-tidy/checks/misc/include-cleaner.rst
index e40335b2543b2..d112f01cbc0b1 100644
--- a/clang-tools-extra/docs/clang-tidy/checks/misc/include-cleaner.rst
+++ b/clang-tools-extra/docs/clang-tidy/checks/misc/include-cleaner.rst
@@ -31,8 +31,8 @@ Options
A semicolon-separated list of regexes to disable insertion/removal of header
files that match this regex as a suffix. E.g., `foo/.*` disables
- insertion/removal for all headers under the directory `foo`. By default, no
- headers will be ignored.
+ insertion/removal for all headers under the directory `foo`. Default is an
+ empty string, no headers will be ignored.
.. option:: DeduplicateFindings
diff --git a/clang-tools-extra/docs/clang-tidy/checks/misc/non-private-member-variables-in-classes.rst b/clang-tools-extra/docs/clang-tidy/checks/misc/non-private-member-variables-in-classes.rst
index 57990622e60cd..9d5b7f6673159 100644
--- a/clang-tools-extra/docs/clang-tidy/checks/misc/non-private-member-variables-in-classes.rst
+++ b/clang-tools-extra/docs/clang-tidy/checks/misc/non-private-member-variables-in-classes.rst
@@ -17,10 +17,11 @@ Options
.. option:: IgnoreClassesWithAllMemberVariablesBeingPublic
- Allows to completely ignore classes if **all** the member variables in that
- class a declared with a ``public`` access specifier.
+ When `true`, allows to completely ignore classes if **all** the member
+ variables in that class declared with a ``public`` access specifier.
+ Default is `false`.
.. option:: IgnorePublicMemberVariables
- Allows to ignore (not diagnose) **all** the member variables declared with
- a ``public`` access specifier.
+ When `true`, allows to ignore (not diagnose) **all** the member variables
+ declared with a ``public`` access specifier. Default is `false`.
>From a8322e7c2a09c93b4e222690faab6c03fd182257 Mon Sep 17 00:00:00 2001
From: Victor Baranov <bar.victor.2002 at gmail.com>
Date: Mon, 31 Mar 2025 13:30:23 +0300
Subject: [PATCH 2/3] add readability fixes
---
.../clang-tidy/checks/readability/container-data-pointer.rst | 2 +-
.../clang-tidy/checks/readability/container-size-empty.rst | 3 +++
.../readability/inconsistent-declaration-parameter-name.rst | 3 +++
.../checks/readability/redundant-inline-specifier.rst | 2 +-
.../clang-tidy/checks/readability/redundant-smartptr-get.rst | 2 ++
5 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/clang-tools-extra/docs/clang-tidy/checks/readability/container-data-pointer.rst b/clang-tools-extra/docs/clang-tidy/checks/readability/container-data-pointer.rst
index 0d10829ed3c2f..a4eff16cbab14 100644
--- a/clang-tools-extra/docs/clang-tidy/checks/readability/container-data-pointer.rst
+++ b/clang-tools-extra/docs/clang-tidy/checks/readability/container-data-pointer.rst
@@ -18,4 +18,4 @@ Options
.. option:: IgnoredContainers
Semicolon-separated list of containers regexp for which this check won't be
- enforced. Default is `empty`.
+ enforced. Default is an empty string.
diff --git a/clang-tools-extra/docs/clang-tidy/checks/readability/container-size-empty.rst b/clang-tools-extra/docs/clang-tidy/checks/readability/container-size-empty.rst
index 43ad74f60dbe5..da6f770b3d74b 100644
--- a/clang-tools-extra/docs/clang-tidy/checks/readability/container-size-empty.rst
+++ b/clang-tools-extra/docs/clang-tidy/checks/readability/container-size-empty.rst
@@ -25,6 +25,9 @@ The check issues warning if a container has ``empty()`` and ``size()`` or
`size_type` can be any kind of integer type.
+Options
+-------
+
.. option:: ExcludedComparisonTypes
A semicolon-separated list of class names for which the check will ignore
diff --git a/clang-tools-extra/docs/clang-tidy/checks/readability/inconsistent-declaration-parameter-name.rst b/clang-tools-extra/docs/clang-tidy/checks/readability/inconsistent-declaration-parameter-name.rst
index 95341d52da4f6..4661d2cd8c9a4 100644
--- a/clang-tools-extra/docs/clang-tidy/checks/readability/inconsistent-declaration-parameter-name.rst
+++ b/clang-tools-extra/docs/clang-tidy/checks/readability/inconsistent-declaration-parameter-name.rst
@@ -52,6 +52,9 @@ In the case of multiple redeclarations or function template specializations,
a warning is issued for every redeclaration or specialization inconsistent with
the definition or the first declaration seen in a translation unit.
+Options
+-------
+
.. option:: IgnoreMacros
If this option is set to `true` (default is `true`), the check will not warn
diff --git a/clang-tools-extra/docs/clang-tidy/checks/readability/redundant-inline-specifier.rst b/clang-tools-extra/docs/clang-tidy/checks/readability/redundant-inline-specifier.rst
index eee324cddab48..c33c05b42e500 100644
--- a/clang-tools-extra/docs/clang-tidy/checks/readability/redundant-inline-specifier.rst
+++ b/clang-tools-extra/docs/clang-tidy/checks/readability/redundant-inline-specifier.rst
@@ -29,4 +29,4 @@ Options
.. option:: StrictMode
If set to `true`, the check will also flag functions and variables that
- already have internal linkage as redundant.
+ already have internal linkage as redundant. Default is `false`.
diff --git a/clang-tools-extra/docs/clang-tidy/checks/readability/redundant-smartptr-get.rst b/clang-tools-extra/docs/clang-tidy/checks/readability/redundant-smartptr-get.rst
index 20851b0acad97..ab8a3681907e3 100644
--- a/clang-tools-extra/docs/clang-tidy/checks/readability/redundant-smartptr-get.rst
+++ b/clang-tools-extra/docs/clang-tidy/checks/readability/redundant-smartptr-get.rst
@@ -14,6 +14,8 @@ Examples:
*ptr->get() ==> **ptr
if (ptr.get() == nullptr) ... => if (ptr == nullptr) ...
+Options
+-------
.. option:: IgnoreMacros
>From 21d14b7669191c4a94c29d63b1de8f74ae5f6e9a Mon Sep 17 00:00:00 2001
From: Baranov Victor <bar.victor.2002 at gmail.com>
Date: Mon, 31 Mar 2025 17:57:15 +0300
Subject: [PATCH 3/3] Update
clang-tools-extra/docs/clang-tidy/checks/misc/coroutine-hostile-raii.rst
---
.../docs/clang-tidy/checks/misc/coroutine-hostile-raii.rst | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/clang-tools-extra/docs/clang-tidy/checks/misc/coroutine-hostile-raii.rst b/clang-tools-extra/docs/clang-tidy/checks/misc/coroutine-hostile-raii.rst
index 53375b40f4d0e..bd9baab06e24f 100644
--- a/clang-tools-extra/docs/clang-tidy/checks/misc/coroutine-hostile-raii.rst
+++ b/clang-tools-extra/docs/clang-tidy/checks/misc/coroutine-hostile-raii.rst
@@ -45,7 +45,7 @@ Options
A semicolon-separated list of qualified types which should not be allowed to
persist across suspension points.
- Eg: `my::lockable;a::b;::my::other::lockable;`
+ Eg: `my::lockable;a::b;::my::other::lockable`
The default value of this option is `std::lock_guard;std::scoped_lock`.
.. option:: AllowedAwaitablesList
More information about the cfe-commits
mailing list