9#include "../ClangTidy.h"
10#include "../ClangTidyModule.h"
11#include "../ClangTidyModuleRegistry.h"
12#include "../misc/NonPrivateMemberVariablesInClassesCheck.h"
13#include "../misc/UnconventionalAssignOperatorCheck.h"
14#include "../modernize/AvoidCArraysCheck.h"
15#include "../modernize/MacroToEnumCheck.h"
16#include "../modernize/UseDefaultMemberInitCheck.h"
17#include "../modernize/UseOverrideCheck.h"
18#include "../performance/NoexceptDestructorCheck.h"
19#include "../performance/NoexceptMoveConstructorCheck.h"
20#include "../performance/NoexceptSwapCheck.h"
21#include "../readability/MagicNumbersCheck.h"
54namespace cppcoreguidelines {
61 "cppcoreguidelines-avoid-capturing-lambda-coroutines");
63 "cppcoreguidelines-avoid-c-arrays");
65 "cppcoreguidelines-avoid-const-or-ref-data-members");
67 "cppcoreguidelines-avoid-do-while");
69 "cppcoreguidelines-avoid-goto");
71 "cppcoreguidelines-avoid-magic-numbers");
73 "cppcoreguidelines-avoid-non-const-global-variables");
75 "cppcoreguidelines-avoid-reference-coroutine-parameters");
77 "cppcoreguidelines-explicit-virtual-functions");
79 "cppcoreguidelines-init-variables");
81 "cppcoreguidelines-interfaces-global-init");
83 "cppcoreguidelines-macro-to-enum");
85 "cppcoreguidelines-macro-usage");
87 "cppcoreguidelines-misleading-capture-default-by-value");
89 "cppcoreguidelines-missing-std-forward");
91 "cppcoreguidelines-narrowing-conversions");
94 "cppcoreguidelines-no-suspend-with-lock");
96 "cppcoreguidelines-noexcept-destructor");
98 "cppcoreguidelines-noexcept-move-operations");
100 "cppcoreguidelines-noexcept-swap");
102 "cppcoreguidelines-non-private-member-variables-in-classes");
104 "cppcoreguidelines-owning-memory");
106 "cppcoreguidelines-prefer-member-initializer");
108 "cppcoreguidelines-pro-bounds-array-to-pointer-decay");
110 "cppcoreguidelines-pro-bounds-constant-array-index");
112 "cppcoreguidelines-pro-bounds-pointer-arithmetic");
114 "cppcoreguidelines-pro-type-const-cast");
116 "cppcoreguidelines-pro-type-cstyle-cast");
118 "cppcoreguidelines-pro-type-member-init");
120 "cppcoreguidelines-pro-type-reinterpret-cast");
122 "cppcoreguidelines-pro-type-static-cast-downcast");
124 "cppcoreguidelines-pro-type-union-access");
126 "cppcoreguidelines-pro-type-vararg");
128 "cppcoreguidelines-rvalue-reference-param-not-moved");
130 "cppcoreguidelines-special-member-functions");
133 "cppcoreguidelines-use-default-member-init");
135 "cppcoreguidelines-c-copy-assignment-signature");
137 "cppcoreguidelines-virtual-class-destructor");
144 Opts[
"cppcoreguidelines-non-private-member-variables-in-classes."
145 "IgnoreClassesWithAllMemberVariablesBeingPublic"] =
"true";
152static ClangTidyModuleRegistry::Add<CppCoreGuidelinesModule>
153 X(
"cppcoreguidelines-module",
"Adds checks for the C++ Core Guidelines.");
A collection of ClangTidyCheckFactory instances.
void registerCheck(llvm::StringRef CheckName)
Registers the CheckType with the name Name.
A clang-tidy module groups a number of ClangTidyChecks and gives them a prefixed name.
Flags C++20 coroutine lambdas with non-empty capture lists that may cause use-after-free errors and s...
Const-qualified or reference data members in classes should be avoided, as they make the class non-co...
do-while loops are less readable than plan while loops, and can lead to subtle bugs.
The usage of goto for control flow is error prone and should be replaced with looping constructs.
Non-const global variables hide dependencies and make the dependencies subject to unpredictable chang...
Warns on coroutines that accept reference parameters.
A module containing checks of the C++ Core Guidelines.
ClangTidyOptions getModuleOptions() override
Gets default options for checks defined in this module.
void addCheckFactories(ClangTidyCheckFactories &CheckFactories) override
Implement this function in order to register all CheckFactories belonging to this module.
Find uninitialized local variables.
Flags possible initialization order issues of static variables.
Find macro usage that is considered problematic because better language constructs exist for the task...
Warns when lambda specify a by-value capture default and capture this.
Warns when a function accepting a forwarding reference does anything besides forwarding (with std::fo...
Checks for narrowing conversions, e.g: int i = 0; i += 0.1;.
This checker is concerned with C-style memory management and suggest modern alternatives to it.
Flag coroutines that suspend while any lock guard is alive.
Checks for common use cases for gsl::owner and enforces the unique owner nature of it whenever possib...
Finds member initializations in the constructor body which can be placed into the initialization list...
This check flags all array to pointer decays.
This checks that all array subscriptions on static arrays and std::arrays have a constant index and a...
Flags all kinds of pointer arithmetic that have result of pointer type, i.e.
Imposes limitations on the use of const_cast within C++ code.
This check flags all use of C-style casts that perform a static_cast downcast, const_cast,...
Implements C++ Core Guidelines Type.6.
Flags all occurrences of reinterpret_cast.
Checks for usages of static_cast, where a base class is downcasted to a derived class.
This check flags all access to members of unions.
This check flags all calls to c-style variadic functions and all use of va_arg.
Warns when an rvalue reference function parameter is never moved within the function body.
Flags slicing (incomplete copying of an object's state) of member variables or vtable.
Checks for classes where some, but not all, of the special member functions are defined.
Finds base classes whose destructor is neither public and virtual nor protected and non-virtual.
This checker finds classes that not only contain the data (non-static member variables),...
Finds declarations of assignment operators with the wrong return and/or argument types and definition...
Find C-style array types and recommend to use std::array<> / std::vector<>.
Replaces groups of related macros with an unscoped anonymous enum.
Convert a default constructor's member initializers into default member initializers.
Use C++11's override and remove virtual where applicable.
Detects magic numbers, integer and floating point literals embedded in code.
volatile int CppCoreGuidelinesModuleAnchorSource
Contains options for clang-tidy.
OptionMap CheckOptions
Key-value mapping used to store check-specific options.
llvm::StringMap< ClangTidyValue > OptionMap