Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions clang-tools-extra/docs/clang-tidy/checks/boost/use-ranges.rst
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ If calls are made using reverse iterators on containers, The code will be
fixed using the ``boost::adaptors::reverse`` adaptor.

.. code-block:: c++

auto AreSame = std::equal(Items1.rbegin(), Items1.rend(),
std::crbegin(Items2), std::crend(Items2));

Expand All @@ -166,7 +166,7 @@ Options
is `llvm`.

.. option:: IncludeBoostSystem

If `true` (default value) the boost headers are included as system headers
with angle brackets (`#include <boost.hpp>`), otherwise quotes are used
(`#include "boost.hpp"`).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Such assignments are bug-prone because they may have been intended as equality t

This check finds all assignments within `if` conditions, including ones that are not flagged
by `-Wparentheses` due to an extra set of parentheses, and including assignments that call
an overloaded `operator=()`. The identified assignments violate
an overloaded `operator=()`. The identified assignments violate
`BARR group "Rule 8.2.c" <https://barrgroup.com/embedded-systems/books/embedded-c-coding-standard/statement-rules/if-else-statements>`_.

.. code-block:: c++
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Possible fixes:
- marking copy and move constructors and assignment operators deleted.
- using class member method instead of class member variable with function
object types.
- passing ``this`` pointer as parameter
- passing ``this`` pointer as parameter.

Options
-------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ bugprone-crtp-constructor-accessibility
Detects error-prone Curiously Recurring Template Pattern usage, when the CRTP
can be constructed outside itself and the derived class.

The CRTP is an idiom, in which a class derives from a template class, where
The CRTP is an idiom, in which a class derives from a template class, where
itself is the template argument. It should be ensured that if a class is
intended to be a base class in this idiom, it can only be instantiated if
the derived class is its template argument.
Expand All @@ -23,7 +23,7 @@ Example:

class Derived : CRTP<Derived> {};

Below can be seen some common mistakes that will allow the breaking of the
Below can be seen some common mistakes that will allow the breaking of the
idiom.

If the constructor of a class intended to be used in a CRTP is public, then
Expand Down Expand Up @@ -62,7 +62,7 @@ Example:
class Bad : CRTP<Good> {};
Bad BadInstance;

To ensure that no accidental instantiation happens, the best practice is to
To ensure that no accidental instantiation happens, the best practice is to
make the constructor private and declare the derived class as friend. Note
that as a tradeoff, this also gives the derived class access to every other
private members of the CRTP. However, constructors can still be public or
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Finds derived class methods that shadow a (non-virtual) base class method.

In order to be considered "shadowing", methods must have the same signature
(i.e. the same name, same number of parameters, same parameter types, etc).
Only checks public, non-templated methods.
Only checks public, non-templated methods.

The below example is bugprone because consumers of the ``Derived`` class will
expect the ``reset`` method to do the work of ``Base::reset()`` in addition to extra
Expand All @@ -27,4 +27,4 @@ This is also a violation of the Liskov Substitution Principle.
struct Derived : public Base {
void reset() {/* reset the derived class, but not the base class */};
};
};
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
bugprone-incorrect-enable-shared-from-this
==========================================

Detect classes or structs that do not publicly inherit from
``std::enable_shared_from_this``, because unintended behavior will
Detect classes or structs that do not publicly inherit from
``std::enable_shared_from_this``, because unintended behavior will
otherwise occur when calling ``shared_from_this``.

Consider the following code:
Expand All @@ -15,7 +15,7 @@ Consider the following code:

// private inheritance
class BadExample : std::enable_shared_from_this<BadExample> {

// ``shared_from_this``` unintended behaviour
// `libstdc++` implementation returns uninitialized ``weak_ptr``
public:
Expand All @@ -29,6 +29,6 @@ Consider the following code:
b_ex->bar();
}

Using `libstdc++` implementation, ``shared_from_this`` will throw
``std::bad_weak_ptr``. When ``using_not_public()`` is called, this code will
Using `libstdc++` implementation, ``shared_from_this`` will throw
``std::bad_weak_ptr``. When ``using_not_public()`` is called, this code will
crash without exception handling.
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ Options
Default: `false`.

.. code-block:: c++

void bar(Base b[], Derived d[]) {
b += 1; // warning, as Base declares a virtual destructor
d += 1; // warning only if IgnoreVirtualDeclarationsOnly is set to false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,17 @@ Options

.. option:: MemSetNames

Specify extra functions to flag that act similarly to ``memset``. Specify
Specify extra functions to flag that act similarly to ``memset``. Specify
names in a semicolon-delimited list. Default is an empty string.

.. option:: MemCpyNames

Specify extra functions to flag that act similarly to ``memcpy``. Specify
Specify extra functions to flag that act similarly to ``memcpy``. Specify
names in a semicolon-delimited list. Default is an empty string.

.. option:: MemCmpNames

Specify extra functions to flag that act similarly to ``memcmp``. Specify
Specify extra functions to flag that act similarly to ``memcmp``. Specify
names in a semicolon-delimited list. Default is an empty string.

This check corresponds to the CERT C++ Coding Standard rule
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Example
S(int);
~S();
};

const S &fn(const S &a) {
return a;
}
Expand All @@ -35,7 +35,7 @@ This issue can be resolved by declaring an overload of the problematic function
where the ``const &`` parameter is instead declared as ``&&``. The developer has
to ensure that the implementation of that function does not produce a
use-after-free, the exact error that this check is warning against.
Marking such an ``&&`` overload as ``deleted``, will silence the warning as
Marking such an ``&&`` overload as ``deleted``, will silence the warning as
well. In the case of different ``const &`` parameters being returned depending
on the control flow of the function, an overload where all problematic
``const &`` parameters have been declared as ``&&`` will resolve the issue.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ Options

Selects which set of functions is considered as asynchronous-safe
(and therefore allowed in signal handlers). It can be set to the following values:

``minimal``
Selects a minimal set that is defined in the CERT SIG30-C rule.
and includes functions ``abort()``, ``_Exit()``, ``quick_exit()`` and
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Examples:
std::string_view("test", 0);

Passing an invalid first character position parameter to constructor will
cause ``std::out_of_range`` exception at runtime.
cause ``std::out_of_range`` exception at runtime.

Examples:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ The problem with this construct is that if ``realloc`` fails it returns a
null pointer but does not deallocate the original memory. If no other variable
is pointing to it, the original memory block is not available any more for the
program to use or free. In either case ``p = realloc(p, size);`` indicates bad
coding style and can be replaced by ``q = realloc(p, size);``.
coding style and can be replaced by ``q = realloc(p, size);``.

The pointer expression (used at ``realloc``) can be a variable or a field member
of a data structure, but can not contain function calls or unresolved types.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ different from the number of data members inside the union.
A struct or a class is considered to be a tagged union if it has
exactly one union data member and exactly one enum data member and
any number of other data members that are neither unions or enums.
Furthermore, the types of the union and the enum members must
Furthermore, the types of the union and the enum members must
not come from system header files nor the ``std`` namespace.

Example:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ checked. The format is the following, without newlines:
.. code::
bugprone-unsafe-functions.CustomFunctions="
functionRegex1[, replacement1[, reason1]];
functionRegex1[, replacement1[, reason1]];
functionRegex2[, replacement2[, reason2]];
...
"
Expand All @@ -104,7 +104,7 @@ As an example, the configuration `^original$, replacement, is deprecated;`
will produce the following diagnostic message.

.. code:: c
original(); // warning: function 'original' is deprecated; 'replacement' should be used instead.
::std::original(); // no-warning
original_function(); // no-warning
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,19 +42,19 @@ Options
Semicolon-separated list of regular expressions matching class names that
overwrites the default exclusion list. The default is:
`::std::map;::std::unordered_map;::std::flat_map`.

.. option:: FixMode

Determines what fixes are suggested. Either `none`, `at` (use
``a.at(index)`` if a fitting function exists) or `function` (use a
Determines what fixes are suggested. Either `none`, `at` (use
``a.at(index)`` if a fitting function exists) or `function` (use a
function ``f(a, index)``). The default is `none`.

.. option:: FixFunction

The function to use in the `function` mode. For C++23 and beyond, the
passed function must support the empty subscript operator, i.e., the case
where ``a[]`` becomes ``f(a)``. :option:`FixFunctionEmptyArgs` can be
used to override the suggested function in that case. The default is `gsl::at`.
used to override the suggested function in that case. The default is `gsl::at`.

.. option:: FixFunctionEmptyArgs

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ For example non-compliant code:
Should become:

.. code-block:: c++

// Small anonymous namespace for class declaration
namespace {

Expand All @@ -48,7 +48,7 @@ Should become:
};
}

// placed method definition outside of the anonymous namespace
bool StringSort::operator<(const char *RHS) const {}
Expand All @@ -70,4 +70,4 @@ Options
.. option:: AllowMemberFunctionsInClass

When `true`, only methods defined in anonymous namespace outside of the
corresponding class will be warned. Default value is `true`.
corresponding class will be warned. Default value is `true`.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Example
.. code-block:: c++

auto it = std::find(vec.begin(), vec.end(), value);
bool all = std::all_of(vec.begin(), vec.end(),
bool all = std::all_of(vec.begin(), vec.end(),
[](int x) { return x > 0; });

Transforms to:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ Options
.. option:: AnalyzePointers

Enable or disable the analysis of pointers variables, like
``int *ptr = &i;``. For specific checks, see
``int *ptr = &i;``. For specific checks, see
:option:`WarnPointersAsValues` and :option:`WarnPointersAsPointers`.
Default is `true`.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Findings correspond to https://clangd.llvm.org/design/include-cleaner.
Example:

.. code-block:: c++

// foo.h
class Foo{};
// bar.h
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ the ``using`` keyword is not considered as visibility change by this check.
private:
virtual void f_priv();
};

class B: public A {
public:
void f_priv(); // warning: changed visibility from private to public
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
modernize-min-max-use-initializer-list
======================================

Replaces nested ``std::min`` and ``std::max`` calls with an initializer list
Replaces nested ``std::min`` and ``std::max`` calls with an initializer list
where applicable.

For instance, consider the following code:
Expand All @@ -21,8 +21,8 @@ The check will transform the above code to:
Performance Considerations
==========================

While this check simplifies the code and makes it more readable, it may cause
performance degradation for non-trivial types due to the need to copy objects
While this check simplifies the code and makes it more readable, it may cause
performance degradation for non-trivial types due to the need to copy objects
into the initializer list.

To avoid this, it is recommended to use `std::ref` or `std::cref` for
Expand All @@ -47,4 +47,4 @@ Options
.. option:: IgnoreTrivialTypesOfSizeAbove

An integer specifying the size (in bytes) above which trivial types are
ignored. Default is `32`.
ignored. Default is `32`.
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Options

#define IS_SIGNED(T) std::is_signed<T>::value

Defaults to `false`.
Defaults to `false`.


Limitations
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ If calls are made using reverse iterators on containers, The code will be
fixed using the ``std::views::reverse`` adaptor.

.. code-block:: c++

auto AreSame = std::equal(Items1.rbegin(), Items1.rend(),
std::crbegin(Items2), std::crend(Items2));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,9 @@ Options

template <typename T>
using Lock = std::lock_guard<T>; // warning: use 'std::scoped_lock' instead of 'std::lock_guard'

using LockMutex = std::lock_guard<std::mutex>; // warning: use 'std::scoped_lock' instead of 'std::lock_guard'

typedef std::lock_guard<std::mutex> LockDef; // warning: use 'std::scoped_lock' instead of 'std::lock_guard'

using std::lock_guard; // warning: use 'std::scoped_lock' instead of 'std::lock_guard'
using std::lock_guard; // warning: use 'std::scoped_lock' instead of 'std::lock_guard'
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ modernize-use-starts-ends-with
==============================

Checks for common roundabout ways to express ``starts_with`` and ``ends_with``
and suggests replacing with the simpler method when it is available. Notably,
and suggests replacing with the simpler method when it is available. Notably,
this will work with ``std::string`` and ``std::string_view``.

Covered scenarios:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ Options

.. option:: StrFormatLikeFunctions

A semicolon-separated list of regular expressions matching the
A semicolon-separated list of regular expressions matching the
(fully qualified) names of functions to replace, with the requirement that
the first parameter contains the printf-style format string and the
arguments to be formatted follow immediately afterwards. Qualified member
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ Options

.. option:: PrintfLikeFunctions

A semicolon-separated list of regular expressions matching the
A semicolon-separated list of regular expressions matching the
(fully qualified) names of functions to replace, with the requirement
that the first parameter contains the printf-style format string and the
arguments to be formatted follow immediately afterwards. Qualified member
Expand All @@ -134,13 +134,13 @@ Options

.. option:: FprintfLikeFunctions

A semicolon-separated list of regular expressions matching the
A semicolon-separated list of regular expressions matching the
(fully qualified) names of functions to replace, with the requirement
that the first parameter is retained, the second parameter contains the
printf-style format string and the arguments to be formatted follow
immediately afterwards. Qualified member function names are supported,
but the replacement function name must be unqualified. If neither this
option nor `PrintfLikeFunctions` are set then the default value is
option nor `PrintfLikeFunctions` are set then the default value is
`fprintf;absl::FPrintF`, otherwise it is the empty string.


Expand Down
Loading
Loading