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