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