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