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