xref: /llvm-project/clang-tools-extra/clang-tidy/readability/ReadabilityTidyModule.cpp (revision 399a50cf356f4881cbab46a95d2c9efed18454ba)
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 "ContainerSizeEmptyCheck.h"
16 #include "DeletedDefaultCheck.h"
17 #include "ElseAfterReturnCheck.h"
18 #include "FunctionSizeCheck.h"
19 #include "IdentifierNamingCheck.h"
20 #include "ImplicitBoolCastCheck.h"
21 #include "InconsistentDeclarationParameterNameCheck.h"
22 #include "MisplacedArrayIndexCheck.h"
23 #include "NamedParameterCheck.h"
24 #include "NonConstParameterCheck.h"
25 #include "RedundantControlFlowCheck.h"
26 #include "RedundantDeclarationCheck.h"
27 #include "RedundantMemberInitCheck.h"
28 #include "RedundantSmartptrGetCheck.h"
29 #include "RedundantStringCStrCheck.h"
30 #include "RedundantStringInitCheck.h"
31 #include "SimplifyBooleanExprCheck.h"
32 #include "StaticDefinitionInAnonymousNamespaceCheck.h"
33 #include "UniqueptrDeleteReleaseCheck.h"
34 
35 namespace clang {
36 namespace tidy {
37 namespace readability {
38 
39 class ReadabilityModule : public ClangTidyModule {
40 public:
41   void addCheckFactories(ClangTidyCheckFactories &CheckFactories) override {
42     CheckFactories.registerCheck<AvoidConstParamsInDecls>(
43         "readability-avoid-const-params-in-decls");
44     CheckFactories.registerCheck<BracesAroundStatementsCheck>(
45         "readability-braces-around-statements");
46     CheckFactories.registerCheck<ContainerSizeEmptyCheck>(
47         "readability-container-size-empty");
48     CheckFactories.registerCheck<DeletedDefaultCheck>(
49         "readability-deleted-default");
50     CheckFactories.registerCheck<ElseAfterReturnCheck>(
51         "readability-else-after-return");
52     CheckFactories.registerCheck<FunctionSizeCheck>(
53         "readability-function-size");
54     CheckFactories.registerCheck<IdentifierNamingCheck>(
55         "readability-identifier-naming");
56     CheckFactories.registerCheck<ImplicitBoolCastCheck>(
57         "readability-implicit-bool-cast");
58     CheckFactories.registerCheck<InconsistentDeclarationParameterNameCheck>(
59         "readability-inconsistent-declaration-parameter-name");
60     CheckFactories.registerCheck<MisplacedArrayIndexCheck>(
61         "readability-misplaced-array-index");
62     CheckFactories.registerCheck<RedundantMemberInitCheck>(
63         "readability-redundant-member-init");
64     CheckFactories.registerCheck<StaticDefinitionInAnonymousNamespaceCheck>(
65         "readability-static-definition-in-anonymous-namespace");
66     CheckFactories.registerCheck<readability::NamedParameterCheck>(
67         "readability-named-parameter");
68     CheckFactories.registerCheck<NonConstParameterCheck>(
69         "readability-non-const-parameter");
70     CheckFactories.registerCheck<RedundantControlFlowCheck>(
71         "readability-redundant-control-flow");
72     CheckFactories.registerCheck<RedundantDeclarationCheck>(
73         "readability-redundant-declaration");
74     CheckFactories.registerCheck<RedundantSmartptrGetCheck>(
75         "readability-redundant-smartptr-get");
76     CheckFactories.registerCheck<RedundantStringCStrCheck>(
77         "readability-redundant-string-cstr");
78     CheckFactories.registerCheck<RedundantStringInitCheck>(
79         "readability-redundant-string-init");
80     CheckFactories.registerCheck<SimplifyBooleanExprCheck>(
81         "readability-simplify-boolean-expr");
82     CheckFactories.registerCheck<UniqueptrDeleteReleaseCheck>(
83         "readability-uniqueptr-delete-release");
84   }
85 };
86 
87 // Register the ReadabilityModule using this statically initialized variable.
88 static ClangTidyModuleRegistry::Add<ReadabilityModule>
89     X("readability-module", "Adds readability-related checks.");
90 
91 } // namespace readability
92 
93 // This anchor is used to force the linker to link in the generated object file
94 // and thus register the ReadabilityModule.
95 volatile int ReadabilityModuleAnchorSource = 0;
96 
97 } // namespace tidy
98 } // namespace clang
99