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