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