| 1 |
//===--- ReadabilityTidyModule.cpp - clang-tidy ---------------------------===// |
| 2 |
// |
| 3 |
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
| 4 |
// See https://llvm.org/LICENSE.txt for license information. |
| 5 |
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 6 |
// |
| 7 |
//===----------------------------------------------------------------------===// |
| 8 |
|
| 9 |
#include "../ClangTidy.h" |
| 10 |
#include "../ClangTidyModule.h" |
| 11 |
#include "../ClangTidyModuleRegistry.h" |
| 12 |
#include "AvoidConstParamsInDecls.h" |
| 13 |
#include "BracesAroundStatementsCheck.h" |
| 14 |
#include "ConstReturnTypeCheck.h" |
| 15 |
#include "ContainerContainsCheck.h" |
| 16 |
#include "ContainerDataPointerCheck.h" |
| 17 |
#include "ContainerSizeEmptyCheck.h" |
| 18 |
#include "ConvertMemberFunctionsToStatic.h" |
| 19 |
#include "DeleteNullPointerCheck.h" |
| 20 |
#include "DuplicateIncludeCheck.h" |
| 21 |
#include "ElseAfterReturnCheck.h" |
| 22 |
#include "FunctionCognitiveComplexityCheck.h" |
| 23 |
#include "FunctionSizeCheck.h" |
| 24 |
#include "IdentifierLengthCheck.h" |
| 25 |
#include "IdentifierNamingCheck.h" |
| 26 |
#include "ImplicitBoolConversionCheck.h" |
| 27 |
#include "InconsistentDeclarationParameterNameCheck.h" |
| 28 |
#include "IsolateDeclarationCheck.h" |
| 29 |
#include "MagicNumbersCheck.h" |
| 30 |
#include "MakeMemberFunctionConstCheck.h" |
| 31 |
#include "MisleadingIndentationCheck.h" |
| 32 |
#include "MisplacedArrayIndexCheck.h" |
| 33 |
#include "NamedParameterCheck.h" |
| 34 |
#include "NonConstParameterCheck.h" |
| 35 |
#include "QualifiedAutoCheck.h" |
| 36 |
#include "RedundantAccessSpecifiersCheck.h" |
| 37 |
#include "RedundantControlFlowCheck.h" |
| 38 |
#include "RedundantDeclarationCheck.h" |
| 39 |
#include "RedundantFunctionPtrDereferenceCheck.h" |
| 40 |
#include "RedundantMemberInitCheck.h" |
| 41 |
#include "RedundantPreprocessorCheck.h" |
| 42 |
#include "RedundantSmartptrGetCheck.h" |
| 43 |
#include "RedundantStringCStrCheck.h" |
| 44 |
#include "RedundantStringInitCheck.h" |
| 45 |
#include "SimplifyBooleanExprCheck.h" |
| 46 |
#include "SimplifySubscriptExprCheck.h" |
| 47 |
#include "StaticAccessedThroughInstanceCheck.h" |
| 48 |
#include "StaticDefinitionInAnonymousNamespaceCheck.h" |
| 49 |
#include "StringCompareCheck.h" |
| 50 |
#include "SuspiciousCallArgumentCheck.h" |
| 51 |
#include "UniqueptrDeleteReleaseCheck.h" |
| 52 |
#include "UppercaseLiteralSuffixCheck.h" |
| 53 |
#include "UseAnyOfAllOfCheck.h" |
| 54 |
|
| 55 |
namespace clang::tidy { |
| 56 |
namespace readability { |
| 57 |
|
| 58 |
class ReadabilityModule : public ClangTidyModule { |
| 59 |
public: |
| 60 |
void addCheckFactories(ClangTidyCheckFactories &CheckFactories) override { |
| 61 |
CheckFactories.registerCheck<AvoidConstParamsInDecls>( |
| 62 |
"readability-avoid-const-params-in-decls"); |
| 63 |
CheckFactories.registerCheck<BracesAroundStatementsCheck>( |
| 64 |
"readability-braces-around-statements"); |
| 65 |
CheckFactories.registerCheck<ConstReturnTypeCheck>( |
| 66 |
"readability-const-return-type"); |
| 67 |
CheckFactories.registerCheck<ContainerContainsCheck>( |
| 68 |
"readability-container-contains"); |
| 69 |
CheckFactories.registerCheck<ContainerDataPointerCheck>( |
| 70 |
"readability-container-data-pointer"); |
| 71 |
CheckFactories.registerCheck<ContainerSizeEmptyCheck>( |
| 72 |
"readability-container-size-empty"); |
| 73 |
CheckFactories.registerCheck<ConvertMemberFunctionsToStatic>( |
| 74 |
"readability-convert-member-functions-to-static"); |
| 75 |
CheckFactories.registerCheck<DeleteNullPointerCheck>( |
| 76 |
"readability-delete-null-pointer"); |
| 77 |
CheckFactories.registerCheck<DuplicateIncludeCheck>( |
| 78 |
"readability-duplicate-include"); |
| 79 |
CheckFactories.registerCheck<ElseAfterReturnCheck>( |
| 80 |
"readability-else-after-return"); |
| 81 |
CheckFactories.registerCheck<FunctionCognitiveComplexityCheck>( |
| 82 |
"readability-function-cognitive-complexity"); |
| 83 |
CheckFactories.registerCheck<FunctionSizeCheck>( |
| 84 |
"readability-function-size"); |
| 85 |
CheckFactories.registerCheck<IdentifierLengthCheck>( |
| 86 |
"readability-identifier-length"); |
| 87 |
CheckFactories.registerCheck<IdentifierNamingCheck>( |
| 88 |
"readability-identifier-naming"); |
| 89 |
CheckFactories.registerCheck<ImplicitBoolConversionCheck>( |
| 90 |
"readability-implicit-bool-conversion"); |
| 91 |
CheckFactories.registerCheck<InconsistentDeclarationParameterNameCheck>( |
| 92 |
"readability-inconsistent-declaration-parameter-name"); |
| 93 |
CheckFactories.registerCheck<IsolateDeclarationCheck>( |
| 94 |
"readability-isolate-declaration"); |
| 95 |
CheckFactories.registerCheck<MagicNumbersCheck>( |
| 96 |
"readability-magic-numbers"); |
| 97 |
CheckFactories.registerCheck<MakeMemberFunctionConstCheck>( |
| 98 |
"readability-make-member-function-const"); |
| 99 |
CheckFactories.registerCheck<MisleadingIndentationCheck>( |
| 100 |
"readability-misleading-indentation"); |
| 101 |
CheckFactories.registerCheck<MisplacedArrayIndexCheck>( |
| 102 |
"readability-misplaced-array-index"); |
| 103 |
CheckFactories.registerCheck<QualifiedAutoCheck>( |
| 104 |
"readability-qualified-auto"); |
| 105 |
CheckFactories.registerCheck<RedundantAccessSpecifiersCheck>( |
| 106 |
"readability-redundant-access-specifiers"); |
| 107 |
CheckFactories.registerCheck<RedundantFunctionPtrDereferenceCheck>( |
| 108 |
"readability-redundant-function-ptr-dereference"); |
| 109 |
CheckFactories.registerCheck<RedundantMemberInitCheck>( |
| 110 |
"readability-redundant-member-init"); |
| 111 |
CheckFactories.registerCheck<RedundantPreprocessorCheck>( |
| 112 |
"readability-redundant-preprocessor"); |
| 113 |
CheckFactories.registerCheck<SimplifySubscriptExprCheck>( |
| 114 |
"readability-simplify-subscript-expr"); |
| 115 |
CheckFactories.registerCheck<StaticAccessedThroughInstanceCheck>( |
| 116 |
"readability-static-accessed-through-instance"); |
| 117 |
CheckFactories.registerCheck<StaticDefinitionInAnonymousNamespaceCheck>( |
| 118 |
"readability-static-definition-in-anonymous-namespace"); |
| 119 |
CheckFactories.registerCheck<StringCompareCheck>( |
| 120 |
"readability-string-compare"); |
| 121 |
CheckFactories.registerCheck<readability::NamedParameterCheck>( |
| 122 |
"readability-named-parameter"); |
| 123 |
CheckFactories.registerCheck<NonConstParameterCheck>( |
| 124 |
"readability-non-const-parameter"); |
| 125 |
CheckFactories.registerCheck<RedundantControlFlowCheck>( |
| 126 |
"readability-redundant-control-flow"); |
| 127 |
CheckFactories.registerCheck<RedundantDeclarationCheck>( |
| 128 |
"readability-redundant-declaration"); |
| 129 |
CheckFactories.registerCheck<RedundantSmartptrGetCheck>( |
| 130 |
"readability-redundant-smartptr-get"); |
| 131 |
CheckFactories.registerCheck<RedundantStringCStrCheck>( |
| 132 |
"readability-redundant-string-cstr"); |
| 133 |
CheckFactories.registerCheck<RedundantStringInitCheck>( |
| 134 |
"readability-redundant-string-init"); |
| 135 |
CheckFactories.registerCheck<SimplifyBooleanExprCheck>( |
| 136 |
"readability-simplify-boolean-expr"); |
| 137 |
CheckFactories.registerCheck<SuspiciousCallArgumentCheck>( |
| 138 |
"readability-suspicious-call-argument"); |
| 139 |
CheckFactories.registerCheck<UniqueptrDeleteReleaseCheck>( |
| 140 |
"readability-uniqueptr-delete-release"); |
| 141 |
CheckFactories.registerCheck<UppercaseLiteralSuffixCheck>( |
| 142 |
"readability-uppercase-literal-suffix"); |
| 143 |
CheckFactories.registerCheck<UseAnyOfAllOfCheck>( |
| 144 |
"readability-use-anyofallof"); |
| 145 |
} |
| 146 |
}; |
| 147 |
|
| 148 |
// Register the ReadabilityModule using this statically initialized variable. |
| 149 |
static ClangTidyModuleRegistry::Add<ReadabilityModule> |
| 150 |
X("readability-module", "Adds readability-related checks."); |
| 151 |
|
| 152 |
} // namespace readability |
| 153 |
|
| 154 |
// This anchor is used to force the linker to link in the generated object file |
| 155 |
// and thus register the ReadabilityModule. |
| 156 |
volatile int ReadabilityModuleAnchorSource = 0; |
| 157 |
|
| 158 |
} // namespace clang::tidy |