1//===--- ReadabilityTidyModule.cpp - clang-tidy ---------------------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#include "../ClangTidy.h"
10#include "../ClangTidyModule.h"
11#include "../ClangTidyModuleRegistry.h"
12#include "AvoidConstParamsInDecls.h"
13#include "AvoidNestedConditionalOperatorCheck.h"
14#include "AvoidReturnWithVoidValueCheck.h"
15#include "AvoidUnconditionalPreprocessorIfCheck.h"
16#include "BracesAroundStatementsCheck.h"
17#include "ConstReturnTypeCheck.h"
18#include "ContainerContainsCheck.h"
19#include "ContainerDataPointerCheck.h"
20#include "ContainerSizeEmptyCheck.h"
21#include "ConvertMemberFunctionsToStatic.h"
22#include "DeleteNullPointerCheck.h"
23#include "DuplicateIncludeCheck.h"
24#include "ElseAfterReturnCheck.h"
25#include "EnumInitialValueCheck.h"
26#include "FunctionCognitiveComplexityCheck.h"
27#include "FunctionSizeCheck.h"
28#include "IdentifierLengthCheck.h"
29#include "IdentifierNamingCheck.h"
30#include "ImplicitBoolConversionCheck.h"
31#include "InconsistentDeclarationParameterNameCheck.h"
32#include "IsolateDeclarationCheck.h"
33#include "MagicNumbersCheck.h"
34#include "MakeMemberFunctionConstCheck.h"
35#include "MisleadingIndentationCheck.h"
36#include "MisplacedArrayIndexCheck.h"
37#include "NamedParameterCheck.h"
38#include "NonConstParameterCheck.h"
39#include "OperatorsRepresentationCheck.h"
40#include "QualifiedAutoCheck.h"
41#include "RedundantAccessSpecifiersCheck.h"
42#include "RedundantCastingCheck.h"
43#include "RedundantControlFlowCheck.h"
44#include "RedundantDeclarationCheck.h"
45#include "RedundantFunctionPtrDereferenceCheck.h"
46#include "RedundantInlineSpecifierCheck.h"
47#include "RedundantMemberInitCheck.h"
48#include "RedundantPreprocessorCheck.h"
49#include "RedundantSmartptrGetCheck.h"
50#include "RedundantStringCStrCheck.h"
51#include "RedundantStringInitCheck.h"
52#include "ReferenceToConstructedTemporaryCheck.h"
53#include "SimplifyBooleanExprCheck.h"
54#include "SimplifySubscriptExprCheck.h"
55#include "StaticAccessedThroughInstanceCheck.h"
56#include "StaticDefinitionInAnonymousNamespaceCheck.h"
57#include "StringCompareCheck.h"
58#include "SuspiciousCallArgumentCheck.h"
59#include "UniqueptrDeleteReleaseCheck.h"
60#include "UppercaseLiteralSuffixCheck.h"
61#include "UseAnyOfAllOfCheck.h"
62#include "UseStdMinMaxCheck.h"
63
64namespace clang::tidy {
65namespace readability {
66
67class ReadabilityModule : public ClangTidyModule {
68public:
69 void addCheckFactories(ClangTidyCheckFactories &CheckFactories) override {
70 CheckFactories.registerCheck<AvoidConstParamsInDecls>(
71 CheckName: "readability-avoid-const-params-in-decls");
72 CheckFactories.registerCheck<AvoidNestedConditionalOperatorCheck>(
73 CheckName: "readability-avoid-nested-conditional-operator");
74 CheckFactories.registerCheck<AvoidReturnWithVoidValueCheck>(
75 CheckName: "readability-avoid-return-with-void-value");
76 CheckFactories.registerCheck<AvoidUnconditionalPreprocessorIfCheck>(
77 CheckName: "readability-avoid-unconditional-preprocessor-if");
78 CheckFactories.registerCheck<BracesAroundStatementsCheck>(
79 CheckName: "readability-braces-around-statements");
80 CheckFactories.registerCheck<ConstReturnTypeCheck>(
81 CheckName: "readability-const-return-type");
82 CheckFactories.registerCheck<ContainerContainsCheck>(
83 CheckName: "readability-container-contains");
84 CheckFactories.registerCheck<ContainerDataPointerCheck>(
85 CheckName: "readability-container-data-pointer");
86 CheckFactories.registerCheck<ContainerSizeEmptyCheck>(
87 CheckName: "readability-container-size-empty");
88 CheckFactories.registerCheck<ConvertMemberFunctionsToStatic>(
89 CheckName: "readability-convert-member-functions-to-static");
90 CheckFactories.registerCheck<DeleteNullPointerCheck>(
91 CheckName: "readability-delete-null-pointer");
92 CheckFactories.registerCheck<DuplicateIncludeCheck>(
93 CheckName: "readability-duplicate-include");
94 CheckFactories.registerCheck<ElseAfterReturnCheck>(
95 CheckName: "readability-else-after-return");
96 CheckFactories.registerCheck<EnumInitialValueCheck>(
97 CheckName: "readability-enum-initial-value");
98 CheckFactories.registerCheck<FunctionCognitiveComplexityCheck>(
99 CheckName: "readability-function-cognitive-complexity");
100 CheckFactories.registerCheck<FunctionSizeCheck>(
101 CheckName: "readability-function-size");
102 CheckFactories.registerCheck<IdentifierLengthCheck>(
103 CheckName: "readability-identifier-length");
104 CheckFactories.registerCheck<IdentifierNamingCheck>(
105 CheckName: "readability-identifier-naming");
106 CheckFactories.registerCheck<ImplicitBoolConversionCheck>(
107 CheckName: "readability-implicit-bool-conversion");
108 CheckFactories.registerCheck<RedundantInlineSpecifierCheck>(
109 CheckName: "readability-redundant-inline-specifier");
110 CheckFactories.registerCheck<InconsistentDeclarationParameterNameCheck>(
111 CheckName: "readability-inconsistent-declaration-parameter-name");
112 CheckFactories.registerCheck<IsolateDeclarationCheck>(
113 CheckName: "readability-isolate-declaration");
114 CheckFactories.registerCheck<MagicNumbersCheck>(
115 CheckName: "readability-magic-numbers");
116 CheckFactories.registerCheck<MakeMemberFunctionConstCheck>(
117 CheckName: "readability-make-member-function-const");
118 CheckFactories.registerCheck<MisleadingIndentationCheck>(
119 CheckName: "readability-misleading-indentation");
120 CheckFactories.registerCheck<MisplacedArrayIndexCheck>(
121 CheckName: "readability-misplaced-array-index");
122 CheckFactories.registerCheck<OperatorsRepresentationCheck>(
123 CheckName: "readability-operators-representation");
124 CheckFactories.registerCheck<QualifiedAutoCheck>(
125 CheckName: "readability-qualified-auto");
126 CheckFactories.registerCheck<RedundantAccessSpecifiersCheck>(
127 CheckName: "readability-redundant-access-specifiers");
128 CheckFactories.registerCheck<RedundantCastingCheck>(
129 CheckName: "readability-redundant-casting");
130 CheckFactories.registerCheck<RedundantFunctionPtrDereferenceCheck>(
131 CheckName: "readability-redundant-function-ptr-dereference");
132 CheckFactories.registerCheck<RedundantMemberInitCheck>(
133 CheckName: "readability-redundant-member-init");
134 CheckFactories.registerCheck<RedundantPreprocessorCheck>(
135 CheckName: "readability-redundant-preprocessor");
136 CheckFactories.registerCheck<ReferenceToConstructedTemporaryCheck>(
137 CheckName: "readability-reference-to-constructed-temporary");
138 CheckFactories.registerCheck<SimplifySubscriptExprCheck>(
139 CheckName: "readability-simplify-subscript-expr");
140 CheckFactories.registerCheck<StaticAccessedThroughInstanceCheck>(
141 CheckName: "readability-static-accessed-through-instance");
142 CheckFactories.registerCheck<StaticDefinitionInAnonymousNamespaceCheck>(
143 CheckName: "readability-static-definition-in-anonymous-namespace");
144 CheckFactories.registerCheck<StringCompareCheck>(
145 CheckName: "readability-string-compare");
146 CheckFactories.registerCheck<readability::NamedParameterCheck>(
147 CheckName: "readability-named-parameter");
148 CheckFactories.registerCheck<NonConstParameterCheck>(
149 CheckName: "readability-non-const-parameter");
150 CheckFactories.registerCheck<RedundantControlFlowCheck>(
151 CheckName: "readability-redundant-control-flow");
152 CheckFactories.registerCheck<RedundantDeclarationCheck>(
153 CheckName: "readability-redundant-declaration");
154 CheckFactories.registerCheck<RedundantSmartptrGetCheck>(
155 CheckName: "readability-redundant-smartptr-get");
156 CheckFactories.registerCheck<RedundantStringCStrCheck>(
157 CheckName: "readability-redundant-string-cstr");
158 CheckFactories.registerCheck<RedundantStringInitCheck>(
159 CheckName: "readability-redundant-string-init");
160 CheckFactories.registerCheck<SimplifyBooleanExprCheck>(
161 CheckName: "readability-simplify-boolean-expr");
162 CheckFactories.registerCheck<SuspiciousCallArgumentCheck>(
163 CheckName: "readability-suspicious-call-argument");
164 CheckFactories.registerCheck<UniqueptrDeleteReleaseCheck>(
165 CheckName: "readability-uniqueptr-delete-release");
166 CheckFactories.registerCheck<UppercaseLiteralSuffixCheck>(
167 CheckName: "readability-uppercase-literal-suffix");
168 CheckFactories.registerCheck<UseAnyOfAllOfCheck>(
169 CheckName: "readability-use-anyofallof");
170 CheckFactories.registerCheck<UseStdMinMaxCheck>(
171 CheckName: "readability-use-std-min-max");
172 }
173};
174
175// Register the ReadabilityModule using this statically initialized variable.
176static ClangTidyModuleRegistry::Add<ReadabilityModule>
177 X("readability-module", "Adds readability-related checks.");
178
179} // namespace readability
180
181// This anchor is used to force the linker to link in the generated object file
182// and thus register the ReadabilityModule.
183volatile int ReadabilityModuleAnchorSource = 0;
184
185} // namespace clang::tidy
186

source code of clang-tools-extra/clang-tidy/readability/ReadabilityTidyModule.cpp