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