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