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 "BracesAroundStatementsCheck.h"
14 #include "ContainerSizeEmptyCheck.h"
15 #include "ElseAfterReturnCheck.h"
16 #include "FunctionSizeCheck.h"
17 #include "IdentifierNamingCheck.h"
18 #include "ImplicitBoolCastCheck.h"
19 #include "InconsistentDeclarationParameterNameCheck.h"
20 #include "NamedParameterCheck.h"
21 #include "RedundantControlFlowCheck.h"
22 #include "RedundantSmartptrGetCheck.h"
23 #include "RedundantStringCStrCheck.h"
24 #include "RedundantStringInitCheck.h"
25 #include "SimplifyBooleanExprCheck.h"
26 #include "UniqueptrDeleteReleaseCheck.h"
27 
28 namespace clang {
29 namespace tidy {
30 namespace readability {
31 
32 class ReadabilityModule : public ClangTidyModule {
33 public:
34   void addCheckFactories(ClangTidyCheckFactories &CheckFactories) override {
35     CheckFactories.registerCheck<BracesAroundStatementsCheck>(
36         "readability-braces-around-statements");
37     CheckFactories.registerCheck<ContainerSizeEmptyCheck>(
38         "readability-container-size-empty");
39     CheckFactories.registerCheck<ElseAfterReturnCheck>(
40         "readability-else-after-return");
41     CheckFactories.registerCheck<FunctionSizeCheck>(
42         "readability-function-size");
43     CheckFactories.registerCheck<IdentifierNamingCheck>(
44         "readability-identifier-naming");
45     CheckFactories.registerCheck<ImplicitBoolCastCheck>(
46         "readability-implicit-bool-cast");
47     CheckFactories.registerCheck<InconsistentDeclarationParameterNameCheck>(
48         "readability-inconsistent-declaration-parameter-name");
49     CheckFactories.registerCheck<readability::NamedParameterCheck>(
50         "readability-named-parameter");
51     CheckFactories.registerCheck<RedundantControlFlowCheck>(
52         "readability-redundant-control-flow");
53     CheckFactories.registerCheck<RedundantSmartptrGetCheck>(
54         "readability-redundant-smartptr-get");
55     CheckFactories.registerCheck<RedundantStringCStrCheck>(
56         "readability-redundant-string-cstr");
57     CheckFactories.registerCheck<RedundantStringInitCheck>(
58         "readability-redundant-string-init");
59     CheckFactories.registerCheck<SimplifyBooleanExprCheck>(
60         "readability-simplify-boolean-expr");
61     CheckFactories.registerCheck<UniqueptrDeleteReleaseCheck>(
62         "readability-uniqueptr-delete-release");
63   }
64 };
65 
66 // Register the ReadabilityModule using this statically initialized variable.
67 static ClangTidyModuleRegistry::Add<ReadabilityModule>
68     X("readability-module", "Adds readability-related checks.");
69 
70 } // namespace readability
71 
72 // This anchor is used to force the linker to link in the generated object file
73 // and thus register the ReadabilityModule.
74 volatile int ReadabilityModuleAnchorSource = 0;
75 
76 } // namespace tidy
77 } // namespace clang
78