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