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

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