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