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