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