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