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