[clang-tidy][docs] Update check options with boolean values instead of non-zero/0/1

Using bools instead of integers better conveys the expected value of the option.

Reviewed By: Eugene.Zelenko, aaron.ballman

Differential Revision: https://reviews.llvm.org/D92652
This commit is contained in:
Nathan James 2020-12-07 12:13:56 +00:00
parent a1cb9cbf5c
commit 980618145b
No known key found for this signature in database
GPG Key ID: CC007AFCDA90AA5F
47 changed files with 118 additions and 118 deletions

View File

@ -24,17 +24,17 @@ Options
.. option:: StrictMode
When zero (default value), the check will ignore leading and trailing
When `false` (default value), the check will ignore leading and trailing
underscores and case when comparing names -- otherwise they are taken into
account.
.. option:: IgnoreSingleArgument
When true, the check will ignore the single argument.
When `true`, the check will ignore the single argument.
.. option:: CommentBoolLiterals
When true, the check will add argument comments in the format
When `true`, the check will add argument comments in the format
``/*ParameterName=*/`` right before the boolean literal argument.
Before:

View File

@ -62,4 +62,4 @@ Options
.. option:: CheckImplicitCasts
If non-zero, enables detection of implicit casts. Default is non-zero.
If `true`, enables detection of implicit casts. Default is `true`.

View File

@ -57,9 +57,9 @@ Rewrite based on the destination array
efficient than the safe version.
- If copy to the destination array can overflow [1] and
``AreSafeFunctionsAvailable`` is set to ``Yes``, ``y`` or non-zero and it is
possible to obtain the capacity of the destination array then the new function
could be the safe version (ending with ``cpy_s``).
:option:`WantToUseSafeFunctions` is set to `true` and it is possible to
obtain the capacity of the destination array then the new function could be
the safe version (ending with ``cpy_s``).
- If the new function is could be safe version and C++ files are analysed and
the destination array is plain ``char``/``wchar_t`` without ``un/signed`` then
@ -127,6 +127,6 @@ Options
.. option:: WantToUseSafeFunctions
An integer non-zero value specifying if the target environment is considered
to implement '_s' suffixed memory and string handler functions which are
safer than older versions (e.g. 'memcpy_s()'). The default value is ``1``.
The value `true` specifies that the target environment is considered to
implement '_s' suffixed memory and string handler functions which are safer
than older versions (e.g. 'memcpy_s()'). The default value is `true`.

View File

@ -48,8 +48,8 @@ Options
.. option:: Invert
If non-zero, inverts the check, i.e. flags names that are not reserved.
Default is `0`.
If `true`, inverts the check, i.e. flags names that are not reserved.
Default is `false`.
.. option:: AllowedIdentifiers

View File

@ -4,7 +4,7 @@ bugprone-signed-char-misuse
===========================
`cert-str34-c` redirects here as an alias for this check. For the CERT alias,
the `DiagnoseSignedUnsignedCharComparisons` option is set to `0`.
the `DiagnoseSignedUnsignedCharComparisons` option is set to `false`.
Finds those ``signed char`` -> integer conversions which might indicate a
programming error. The basic problem with the ``signed char``, that it might
@ -114,5 +114,5 @@ so both arguments will have the same type.
.. option:: DiagnoseSignedUnsignedCharComparisons
When nonzero, the check will warn on ``signed char``/``unsigned char`` comparisons,
otherwise these comparisons are ignored. By default, this option is set to ``1``.
When `true`, the check will warn on ``signed char``/``unsigned char`` comparisons,
otherwise these comparisons are ignored. By default, this option is set to `true`.

View File

@ -169,21 +169,21 @@ Options
.. option:: WarnOnSizeOfConstant
When non-zero, the check will warn on an expression like
``sizeof(CONSTANT)``. Default is `1`.
When `true`, the check will warn on an expression like
``sizeof(CONSTANT)``. Default is `true`.
.. option:: WarnOnSizeOfIntegerExpression
When non-zero, the check will warn on an expression like ``sizeof(expr)``
where the expression results in an integer. Default is `0`.
When `true`, the check will warn on an expression like ``sizeof(expr)``
where the expression results in an integer. Default is `false`.
.. option:: WarnOnSizeOfThis
When non-zero, the check will warn on an expression like ``sizeof(this)``.
Default is `1`.
When `true`, the check will warn on an expression like ``sizeof(this)``.
Default is `true`.
.. option:: WarnOnSizeOfCompareToConstant
When non-zero, the check will warn on an expression like
When `true`, the check will warn on an expression like
``sizeof(epxr) <= k`` for a suspicious constant `k` while `k` is `0` or
greater than `0x8000`. Default is `1`.
greater than `0x8000`. Default is `true`.

View File

@ -38,8 +38,8 @@ Options
.. option:: WarnOnLargeLength
When non-zero, the check will warn on a string with a length greater than
`LargeLengthThreshold`. Default is `1`.
When `true`, the check will warn on a string with a length greater than
:option:`LargeLengthThreshold`. Default is `true`.
.. option:: LargeLengthThreshold

View File

@ -42,11 +42,11 @@ Options
.. option:: WarnOnImplicitComparison
When non-zero, the check will warn on implicit comparison. `1` by default.
When `true`, the check will warn on implicit comparison. `true` by default.
.. option:: WarnOnLogicalNotComparison
When non-zero, the check will warn on logical not comparison. `0` by default.
When `true`, the check will warn on logical not comparison. `false` by default.
.. option:: StringCompareLikeFunctions

View File

@ -4,7 +4,7 @@ bugprone-unhandled-self-assignment
==================================
`cert-oop54-cpp` redirects here as an alias for this check. For the CERT alias,
the `WarnOnlyIfThisHasSuspiciousField` option is set to `0`.
the `WarnOnlyIfThisHasSuspiciousField` option is set to `false`.
Finds user-defined copy assignment operators which do not protect the code
against self-assignment either by checking self-assignment explicitly or
@ -120,5 +120,5 @@ temporary object into ``this`` (needs a move assignment operator):
.. option:: WarnOnlyIfThisHasSuspiciousField
When non-zero, the check will warn only if the container class of the copy assignment operator
has any suspicious fields (pointer or C array). This option is set to `1` by default.
When `true`, the check will warn only if the container class of the copy assignment operator
has any suspicious fields (pointer or C array). This option is set to `true` by default.

View File

@ -25,9 +25,9 @@ Options
Boolean flag to warn on all macros except those with CAPS_ONLY names.
This option is intended to ease introduction of this check into older
code bases. Default value is `0`/`false`.
code bases. Default value is `false`.
.. option:: IgnoreCommandLineMacros
Boolean flag to toggle ignoring command-line-defined macros.
Default value is `1`/`true`.
Default value is `true`.

View File

@ -32,15 +32,15 @@ Options
.. option:: WarnOnFloatingPointNarrowingConversion
When non-zero, the check will warn on narrowing floating point conversion
(e.g. ``double`` to ``float``). `1` by default.
When `true`, the check will warn on narrowing floating point conversion
(e.g. ``double`` to ``float``). `true` by default.
.. option:: PedanticMode
When non-zero, the check will warn on assigning a floating point constant
When `true`, the check will warn on assigning a floating point constant
to an integer value even if the floating point value is exactly
representable in the destination type (e.g. ``int i = 1.0;``).
`0` by default.
`false` by default.
FAQ
---

View File

@ -85,7 +85,7 @@ Here ``n`` can be initialized in the constructor initialization list, unlike
.. option:: UseAssignment
If this option is set to non-zero (default is `0`), the check will initialize
If this option is set to `true` (default is `false`), the check will initialize
members with an assignment. In this case the fix of the first example looks
like this:

View File

@ -29,13 +29,13 @@ Options
.. option:: IgnoreArrays
If set to non-zero, the check will not warn about array members that are not
If set to `true`, the check will not warn about array members that are not
zero-initialized during construction. For performance critical code, it may
be important to not initialize fixed-size array members. Default is `0`.
be important to not initialize fixed-size array members. Default is `false`.
.. option:: UseAssignment
If set to non-zero, the check will provide fix-its with literal initializers
If set to `true`, the check will provide fix-its with literal initializers
\( ``int i = 0;`` \) instead of curly braces \( ``int i{};`` \).
This rule is part of the "Type safety" profile of the C++ Core

View File

@ -25,7 +25,7 @@ Options
.. option:: AllowSoleDefaultDtor
When set to `1` (default is `0`), this check doesn't flag classes with a sole, explicitly
When set to `true` (default is `false`), this check doesn't flag classes with a sole, explicitly
defaulted destructor. An example for such a class is:
.. code-block:: c++
@ -36,7 +36,7 @@ Options
.. option:: AllowMissingMoveFunctions
When set to `1` (default is `0`), this check doesn't flag classes which define no move
When set to `true` (default is `false`), this check doesn't flag classes which define no move
operations at all. It still flags classes which define only one of either
move constructor or move assignment operator. With this option enabled, the following class won't be flagged:
@ -50,7 +50,7 @@ Options
.. option:: AllowMissingMoveFunctionsWhenCopyIsDeleted
When set to `1` (default is `0`), this check doesn't flag classes which define deleted copy
When set to `true` (default is `false`), this check doesn't flag classes which define deleted copy
operations but don't define move operations. This flags is related to Google C++ Style Guide
https://google.github.io/styleguide/cppguide.html#Copyable_Movable_Types. With this option enabled, the
following class won't be flagged:

View File

@ -93,4 +93,4 @@ Options
.. option:: WarnOnMissingElse
Boolean flag that activates a warning for missing ``else`` branches.
Default is `0`.
Default is `false`.

View File

@ -100,5 +100,5 @@ Options
.. option:: UseHeaderFileExtension
When non-zero, the check will use the file extension to distinguish header
files. Default is `1`.
When `true`, the check will use the file extension to distinguish header
files. Default is `true`.

View File

@ -33,7 +33,7 @@ Options
Triggers detection of violations of the CERT recommendation ERR09-CPP. Throw
anonymous temporaries.
Default is `1`.
Default is `true`.
.. option:: WarnOnLargeObject
@ -41,12 +41,12 @@ Options
object by value is not dangerous but affects the performance negatively. The
maximum size of an object allowed to be caught without warning can be set
using the `MaxSize` option.
Default is `0`.
Default is `false`.
.. option:: MaxSize
Determines the maximum size of an object allowed to be caught without
warning. Only applicable if `WarnOnLargeObject` is set to `1`. If option is
set by the user to `std::numeric_limits<uint64_t>::max()` then it reverts to
the default value.
warning. Only applicable if :option:`WarnOnLargeObject` is set to `true`. If
the option is set by the user to `std::numeric_limits<uint64_t>::max()` then
it reverts to the default value.
Default is the size of `size_t`.

View File

@ -35,7 +35,7 @@ Options
.. option:: StrictMode
When zero (default value), the check will ignore trivially unused parameters,
When `false` (default value), the check will ignore trivially unused parameters,
i.e. when the corresponding function has an empty body (and in case of
constructors - no constructor initializers). When the function body is empty,
an unused parameter is unlikely to be unnoticed by a human reader, and

View File

@ -46,7 +46,7 @@ Options
.. option:: PermissiveParameterList
If the option is set to non-zero, the check will append ``auto&&...`` to the end
If the option is set to `true`, the check will append ``auto&&...`` to the end
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

View File

@ -46,5 +46,5 @@ Options
.. option:: IgnoreMacros
If set to non-zero, the check will not give warnings inside macros. Default
is `1`.
If set to `true`, the check will not give warnings inside macros. Default
is `true`.

View File

@ -46,5 +46,5 @@ Options
.. option:: IgnoreMacros
If set to non-zero, the check will not give warnings inside macros. Default
is `1`.
If set to `true`, the check will not give warnings inside macros. Default
is `true`.

View File

@ -162,5 +162,5 @@ Options
.. option:: ValuesOnly
When non-zero, the check only warns about copied parameters that are already
passed by value. Default is `0`.
When `true`, the check only warns about copied parameters that are already
passed by value. Default is `false`.

View File

@ -183,8 +183,8 @@ Options
names having a length less than the option value. The option affects
expressions only, not iterators.
Spaces between multi-lexeme type names (``long int``) are considered as one.
If ``RemoveStars`` option (see below) is set to non-zero, then ``*s`` in
the type are also counted as a part of the type name.
If the :option:`RemoveStars` option (see below) is set to `true`, then ``*s``
in the type are also counted as a part of the type name.
.. code-block:: c++
@ -216,7 +216,7 @@ Options
.. option:: RemoveStars
If the option is set to non-zero (default is `0`), the check will remove
If the option is set to `true` (default is `false`), the check will remove
stars from the non-typedef pointer types when replacing type names with
``auto``. Otherwise, the check will leave stars. For example:

View File

@ -24,5 +24,5 @@ Options
.. option:: IgnoreMacros
If set to non-zero, the check will not give warnings inside macros. Default
is `1`.
If set to `true`, the check will not give warnings inside macros. Default
is `true`.

View File

@ -36,7 +36,7 @@ Options
.. option:: UseAssignment
If this option is set to non-zero (default is `0`), the check will initialise
If this option is set to `true` (default is `false`), the check will initialise
members with an assignment. For example:
.. code-block:: c++
@ -50,5 +50,5 @@ Options
.. option:: IgnoreMacros
If this option is set to non-zero (default is `1`), the check will not warn
If this option is set to `true` (default is `true`), the check will not warn
about members declared inside macros.

View File

@ -104,15 +104,15 @@ Options
.. option:: IgnoreImplicitConstructors
When non-zero, the check will ignore implicitly constructed arguments of
When `true`, the check will ignore implicitly constructed arguments of
``push_back``, e.g.
.. code-block:: c++
std::vector<std::string> v;
v.push_back("a"); // Ignored when IgnoreImplicitConstructors is ``1``.
v.push_back("a"); // Ignored when IgnoreImplicitConstructors is `true`.
Default is ``0``.
Default is `false`.
.. option:: SmartPointers

View File

@ -32,5 +32,5 @@ Options
.. option:: IgnoreMacros
If set to non-zero, the check will not give warnings inside macros. Default
is `1`.
If set to `true`, the check will not give warnings inside macros. Default
is `true`.

View File

@ -26,5 +26,5 @@ all other member functions implemented.
.. option:: IgnoreMacros
If this option is set to non-zero (default is `1`), the check will not warn
If this option is set to `true` (default is `true`), the check will not warn
about functions declared inside macros.

View File

@ -87,4 +87,4 @@ transforms to:
~bar() noexcept(false);
}
if the :option:`UseNoexceptFalse` option is set to `0`.
if the :option:`UseNoexceptFalse` option is set to `false`.

View File

@ -25,15 +25,15 @@ Options
.. option:: IgnoreDestructors
If set to non-zero, this check will not diagnose destructors. Default is `0`.
If set to `true`, this check will not diagnose destructors. Default is `false`.
.. option:: AllowOverrideAndFinal
If set to non-zero, this check will not diagnose ``override`` as redundant
If set to `true`, this check will not diagnose ``override`` as redundant
with ``final``. This is useful when code will be compiled by a compiler with
warning/error checking flags requiring ``override`` explicitly on overridden
members, such as ``gcc -Wsuggest-override``/``gcc -Werror=suggest-override``.
Default is `0`.
Default is `false`.
.. option:: OverrideSpelling

View File

@ -32,8 +32,8 @@ Options
.. option:: SafeMode
If the option is set to non-zero, the check will not diagnose cases where
If the option is set to `true`, the check will not diagnose cases where
using a transparent functor cannot be guaranteed to produce identical results
as the original code. The default value for this option is `0`.
as the original code. The default value for this option is `false`.
This check requires using C++14 or higher to run.

View File

@ -35,5 +35,5 @@ Options
.. option:: IgnoreMacros
If set to non-zero, the check will not give warnings inside macros. Default
is `1`.
If set to `true`, the check will not give warnings inside macros. Default
is `true`.

View File

@ -23,8 +23,8 @@ Options
.. option:: WarnOnAllAutoCopies
When non-zero, warns on any use of `auto` as the type of the range-based for
loop variable. Default is `0`.
When `true`, warns on any use of `auto` as the type of the range-based for
loop variable. Default is `false`.
.. option:: AllowedTypes

View File

@ -55,5 +55,5 @@ Options
.. option:: StrictMode
When zero, the check will only check the string usage in ``while``, ``for``
and ``for-range`` statements. Default is `0`.
When `false`, the check will only check the string usage in ``while``, ``for``
and ``for-range`` statements. Default is `false`.

View File

@ -61,6 +61,6 @@ Options
.. option:: EnableProto
When non-zero, the check will also warn on inefficient operations for proto
When `true`, the check will also warn on inefficient operations for proto
repeated fields. Otherwise, the check only warns on inefficient vector
operations. Default is `0`.
operations. Default is `false`.

View File

@ -33,5 +33,5 @@ Options
.. option:: CheckTriviallyCopyableMove
If non-zero, enables detection of trivially copyable types that do not
have a move constructor. Default is non-zero.
If `true`, enables detection of trivially copyable types that do not
have a move constructor. Default is `true`.

View File

@ -6,7 +6,7 @@ portability-simd-intrinsics
Finds SIMD intrinsics calls and suggests ``std::experimental::simd`` (`P0214`_)
alternatives.
If the option ``Suggest`` is set to non-zero, for
If the option :option:`Suggest` is set to `true`, for
.. code-block:: c++
@ -37,7 +37,7 @@ Options
.. option:: Suggest
If this option is set to non-zero (default is `0`), the check will suggest
If this option is set to `true` (default is `false`), the check will suggest
`P0214`_ alternatives, otherwise it only points out the intrinsic function is
non-portable.

View File

@ -138,9 +138,9 @@ After:
.. option:: AggressiveDependentMemberLookup
When set to `1` the check will look in dependent base classes for dependent
When set to `true` the check will look in dependent base classes for dependent
member references that need changing. This can lead to errors with template
specializations so the default value is `0`.
specializations so the default value is `false`.
For example using values of:
@ -162,7 +162,7 @@ Before:
}
};
After if AggressiveDependentMemberLookup is ``0``:
After if AggressiveDependentMemberLookup is `false`:
.. code-block:: c++
@ -178,7 +178,7 @@ After if AggressiveDependentMemberLookup is ``0``:
}
};
After if AggressiveDependentMemberLookup is ``1``:
After if AggressiveDependentMemberLookup is `true`:
.. code-block:: c++
@ -999,9 +999,9 @@ After:
.. option:: IgnoreMainLikeFunctions
When set to `1` functions that have a similar signature to ``main`` or
When set to `true` functions that have a similar signature to ``main`` or
``wmain`` won't enforce checks on the names of their parameters.
Default value is `0`.
Default value is `false`.
.. option:: InlineNamespaceCase

View File

@ -126,10 +126,10 @@ Options
.. option:: AllowIntegerConditions
When non-zero, the check will allow conditional integer conversions. Default
is `0`.
When `true`, the check will allow conditional integer conversions. Default
is `false`.
.. option:: AllowPointerConditions
When non-zero, the check will allow conditional pointer conversions. Default
is `0`.
When `true`, the check will allow conditional pointer conversions. Default
is `false`.

View File

@ -54,10 +54,10 @@ the definition or the first declaration seen in a translation unit.
.. option:: IgnoreMacros
If this option is set to non-zero (default is `1`), the check will not warn
If this option is set to `true` (default is `true`), the check will not warn
about names declared inside macros.
.. option:: Strict
If this option is set to non-zero (default is `0`), then names must match
If this option is set to `true` (default is `false`), then names must match
exactly (or be absent).

View File

@ -55,9 +55,9 @@ Options
.. option:: AddConstToQualified
When set to `1` the check will add const qualifiers variables defined as
When set to `true` the check will add const qualifiers variables defined as
``auto *`` or ``auto &`` when applicable.
Default value is '1'.
Default value is `true`.
.. code-block:: c++
@ -65,7 +65,7 @@ Options
auto *Foo2 = cast<const int *>(Bar2);
auto &Foo3 = cast<const int &>(Bar3);
If AddConstToQualified is set to `0`, it will be transformed into:
If AddConstToQualified is set to `false`, it will be transformed into:
.. code-block:: c++
@ -81,4 +81,4 @@ Otherwise it will be transformed into:
const auto *Foo2 = cast<const int *>(Bar2);
const auto &Foo3 = cast<const int &>(Bar3);
Note in the LLVM alias, the default value is `0`.
Note in the LLVM alias, the default value is `false`.

View File

@ -31,10 +31,10 @@ Options
.. option:: CheckFirstDeclaration
If set to non-zero, the check will also diagnose if the first access
If set to `true`, the check will also diagnose if the first access
specifier declaration is redundant (e.g. ``private`` inside ``class``,
or ``public`` inside ``struct`` or ``union``).
Default is `0`.
Default is `false`.
Example
^^^^^^^

View File

@ -33,5 +33,5 @@ Options
.. option:: IgnoreMacros
If set to non-zero, the check will not give warnings inside macros. Default
is `1`.
If set to `true`, the check will not give warnings inside macros. Default
is `true`.

View File

@ -25,9 +25,9 @@ Options
.. option:: IgnoreBaseInCopyConstructors
Default is ``0``.
Default is `false`.
When non-zero, the check will ignore unnecessary base class initializations
When `true`, the check will ignore unnecessary base class initializations
within copy constructors, since some compilers issue warnings/errors when
base classes are not explicitly intialized in copy constructors. For example,
``gcc`` with ``-Wextra`` or ``-Werror=extra`` issues warning or error

View File

@ -17,5 +17,5 @@ Examples:
.. option:: IgnoreMacros
If this option is set to non-zero (default is `1`), the check will not warn
If this option is set to `true` (default is `true`), the check will not warn
about calls inside macros.

View File

@ -77,10 +77,10 @@ Options
.. option:: ChainedConditionalReturn
If non-zero, conditional boolean return statements at the end of an
``if/else if`` chain will be transformed. Default is `0`.
If `true`, conditional boolean return statements at the end of an
``if/else if`` chain will be transformed. Default is `false`.
.. option:: ChainedConditionalAssignment
If non-zero, conditional boolean assignments at the end of an ``if/else
if`` chain will be transformed. Default is `0`.
If `true`, conditional boolean assignments at the end of an ``if/else
if`` chain will be transformed. Default is `false`.

View File

@ -52,5 +52,5 @@ Given a list `L;uL`:
.. option:: IgnoreMacros
If this option is set to non-zero (default is `1`), the check will not warn
If this option is set to `true` (default is `true`), the check will not warn
about literal suffixes inside macros.