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