xref: /llvm-project/clang-tools-extra/clang-tidy/readability/ReadabilityTidyModule.cpp (revision 3a02722a40677c6ea39b9fe8624f439c417c282c)
1 //===--- ReadabilityTidyModule.cpp - clang-tidy ---------------------------===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 
10 #include "../ClangTidy.h"
11 #include "../ClangTidyModule.h"
12 #include "../ClangTidyModuleRegistry.h"
13 #include "AvoidConstParamsInDecls.h"
14 #include "BracesAroundStatementsCheck.h"
15 #include "ConstReturnTypeCheck.h"
16 #include "ContainerSizeEmptyCheck.h"
17 #include "DeleteNullPointerCheck.h"
18 #include "DeletedDefaultCheck.h"
19 #include "ElseAfterReturnCheck.h"
20 #include "FunctionSizeCheck.h"
21 #include "IdentifierNamingCheck.h"
22 #include "ImplicitBoolConversionCheck.h"
23 #include "InconsistentDeclarationParameterNameCheck.h"
24 #include "IsolateDeclarationCheck.h"
25 #include "MagicNumbersCheck.h"
26 #include "MisleadingIndentationCheck.h"
27 #include "MisplacedArrayIndexCheck.h"
28 #include "NamedParameterCheck.h"
29 #include "NonConstParameterCheck.h"
30 #include "RedundantControlFlowCheck.h"
31 #include "RedundantDeclarationCheck.h"
32 #include "RedundantFunctionPtrDereferenceCheck.h"
33 #include "RedundantMemberInitCheck.h"
34 #include "RedundantSmartptrGetCheck.h"
35 #include "RedundantStringCStrCheck.h"
36 #include "RedundantStringInitCheck.h"
37 #include "SimplifyBooleanExprCheck.h"
38 #include "SimplifySubscriptExprCheck.h"
39 #include "StaticAccessedThroughInstanceCheck.h"
40 #include "StaticDefinitionInAnonymousNamespaceCheck.h"
41 #include "StringCompareCheck.h"
42 #include "UniqueptrDeleteReleaseCheck.h"
43 #include "UppercaseLiteralSuffixCheck.h"
44 
45 namespace clang {
46 namespace tidy {
47 namespace readability {
48 
49 class ReadabilityModule : public ClangTidyModule {
50 public:
51   void addCheckFactories(ClangTidyCheckFactories &CheckFactories) override {
52     CheckFactories.registerCheck<AvoidConstParamsInDecls>(
53         "readability-avoid-const-params-in-decls");
54     CheckFactories.registerCheck<BracesAroundStatementsCheck>(
55         "readability-braces-around-statements");
56     CheckFactories.registerCheck<ConstReturnTypeCheck>(
57         "readability-const-return-type");
58     CheckFactories.registerCheck<ContainerSizeEmptyCheck>(
59         "readability-container-size-empty");
60     CheckFactories.registerCheck<DeleteNullPointerCheck>(
61         "readability-delete-null-pointer");
62     CheckFactories.registerCheck<DeletedDefaultCheck>(
63         "readability-deleted-default");
64     CheckFactories.registerCheck<ElseAfterReturnCheck>(
65         "readability-else-after-return");
66     CheckFactories.registerCheck<FunctionSizeCheck>(
67         "readability-function-size");
68     CheckFactories.registerCheck<IdentifierNamingCheck>(
69         "readability-identifier-naming");
70     CheckFactories.registerCheck<ImplicitBoolConversionCheck>(
71         "readability-implicit-bool-conversion");
72     CheckFactories.registerCheck<InconsistentDeclarationParameterNameCheck>(
73         "readability-inconsistent-declaration-parameter-name");
74     CheckFactories.registerCheck<IsolateDeclarationCheck>(
75         "readability-isolate-declaration");
76     CheckFactories.registerCheck<MagicNumbersCheck>(
77         "readability-magic-numbers");
78     CheckFactories.registerCheck<MisleadingIndentationCheck>(
79         "readability-misleading-indentation");
80     CheckFactories.registerCheck<MisplacedArrayIndexCheck>(
81         "readability-misplaced-array-index");
82     CheckFactories.registerCheck<RedundantFunctionPtrDereferenceCheck>(
83         "readability-redundant-function-ptr-dereference");
84     CheckFactories.registerCheck<RedundantMemberInitCheck>(
85         "readability-redundant-member-init");
86     CheckFactories.registerCheck<SimplifySubscriptExprCheck>(
87         "readability-simplify-subscript-expr");
88     CheckFactories.registerCheck<StaticAccessedThroughInstanceCheck>(
89         "readability-static-accessed-through-instance");
90     CheckFactories.registerCheck<StaticDefinitionInAnonymousNamespaceCheck>(
91         "readability-static-definition-in-anonymous-namespace");
92     CheckFactories.registerCheck<StringCompareCheck>(
93         "readability-string-compare");
94     CheckFactories.registerCheck<readability::NamedParameterCheck>(
95         "readability-named-parameter");
96     CheckFactories.registerCheck<NonConstParameterCheck>(
97         "readability-non-const-parameter");
98     CheckFactories.registerCheck<RedundantControlFlowCheck>(
99         "readability-redundant-control-flow");
100     CheckFactories.registerCheck<RedundantDeclarationCheck>(
101         "readability-redundant-declaration");
102     CheckFactories.registerCheck<RedundantSmartptrGetCheck>(
103         "readability-redundant-smartptr-get");
104     CheckFactories.registerCheck<RedundantStringCStrCheck>(
105         "readability-redundant-string-cstr");
106     CheckFactories.registerCheck<RedundantStringInitCheck>(
107         "readability-redundant-string-init");
108     CheckFactories.registerCheck<SimplifyBooleanExprCheck>(
109         "readability-simplify-boolean-expr");
110     CheckFactories.registerCheck<UniqueptrDeleteReleaseCheck>(
111         "readability-uniqueptr-delete-release");
112     CheckFactories.registerCheck<UppercaseLiteralSuffixCheck>(
113         "readability-uppercase-literal-suffix");
114   }
115 };
116 
117 // Register the ReadabilityModule using this statically initialized variable.
118 static ClangTidyModuleRegistry::Add<ReadabilityModule>
119     X("readability-module", "Adds readability-related checks.");
120 
121 } // namespace readability
122 
123 // This anchor is used to force the linker to link in the generated object file
124 // and thus register the ReadabilityModule.
125 volatile int ReadabilityModuleAnchorSource = 0;
126 
127 } // namespace tidy
128 } // namespace clang
129