| 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 "AmbiguousSmartptrResetCallCheck.h" |
| 13 | #include "AvoidConstParamsInDecls.h" |
| 14 | #include "AvoidNestedConditionalOperatorCheck.h" |
| 15 | #include "AvoidReturnWithVoidValueCheck.h" |
| 16 | #include "AvoidUnconditionalPreprocessorIfCheck.h" |
| 17 | #include "BracesAroundStatementsCheck.h" |
| 18 | #include "ConstReturnTypeCheck.h" |
| 19 | #include "ContainerContainsCheck.h" |
| 20 | #include "ContainerDataPointerCheck.h" |
| 21 | #include "ContainerSizeEmptyCheck.h" |
| 22 | #include "ConvertMemberFunctionsToStatic.h" |
| 23 | #include "DeleteNullPointerCheck.h" |
| 24 | #include "DuplicateIncludeCheck.h" |
| 25 | #include "ElseAfterReturnCheck.h" |
| 26 | #include "EnumInitialValueCheck.h" |
| 27 | #include "FunctionCognitiveComplexityCheck.h" |
| 28 | #include "FunctionSizeCheck.h" |
| 29 | #include "IdentifierLengthCheck.h" |
| 30 | #include "IdentifierNamingCheck.h" |
| 31 | #include "ImplicitBoolConversionCheck.h" |
| 32 | #include "InconsistentDeclarationParameterNameCheck.h" |
| 33 | #include "IsolateDeclarationCheck.h" |
| 34 | #include "MagicNumbersCheck.h" |
| 35 | #include "MakeMemberFunctionConstCheck.h" |
| 36 | #include "MathMissingParenthesesCheck.h" |
| 37 | #include "MisleadingIndentationCheck.h" |
| 38 | #include "MisplacedArrayIndexCheck.h" |
| 39 | #include "NamedParameterCheck.h" |
| 40 | #include "NonConstParameterCheck.h" |
| 41 | #include "OperatorsRepresentationCheck.h" |
| 42 | #include "QualifiedAutoCheck.h" |
| 43 | #include "RedundantAccessSpecifiersCheck.h" |
| 44 | #include "RedundantCastingCheck.h" |
| 45 | #include "RedundantControlFlowCheck.h" |
| 46 | #include "RedundantDeclarationCheck.h" |
| 47 | #include "RedundantFunctionPtrDereferenceCheck.h" |
| 48 | #include "RedundantInlineSpecifierCheck.h" |
| 49 | #include "RedundantMemberInitCheck.h" |
| 50 | #include "RedundantPreprocessorCheck.h" |
| 51 | #include "RedundantSmartptrGetCheck.h" |
| 52 | #include "RedundantStringCStrCheck.h" |
| 53 | #include "RedundantStringInitCheck.h" |
| 54 | #include "ReferenceToConstructedTemporaryCheck.h" |
| 55 | #include "SimplifyBooleanExprCheck.h" |
| 56 | #include "SimplifySubscriptExprCheck.h" |
| 57 | #include "StaticAccessedThroughInstanceCheck.h" |
| 58 | #include "StaticDefinitionInAnonymousNamespaceCheck.h" |
| 59 | #include "StringCompareCheck.h" |
| 60 | #include "SuspiciousCallArgumentCheck.h" |
| 61 | #include "UniqueptrDeleteReleaseCheck.h" |
| 62 | #include "UppercaseLiteralSuffixCheck.h" |
| 63 | #include "UseAnyOfAllOfCheck.h" |
| 64 | #include "UseStdMinMaxCheck.h" |
| 65 | |
| 66 | namespace clang::tidy { |
| 67 | namespace readability { |
| 68 | |
| 69 | class ReadabilityModule : public ClangTidyModule { |
| 70 | public: |
| 71 | void addCheckFactories(ClangTidyCheckFactories &CheckFactories) override { |
| 72 | CheckFactories.registerCheck<AmbiguousSmartptrResetCallCheck>( |
| 73 | CheckName: "readability-ambiguous-smartptr-reset-call"); |
| 74 | CheckFactories.registerCheck<AvoidConstParamsInDecls>( |
| 75 | CheckName: "readability-avoid-const-params-in-decls"); |
| 76 | CheckFactories.registerCheck<AvoidNestedConditionalOperatorCheck>( |
| 77 | CheckName: "readability-avoid-nested-conditional-operator"); |
| 78 | CheckFactories.registerCheck<AvoidReturnWithVoidValueCheck>( |
| 79 | CheckName: "readability-avoid-return-with-void-value"); |
| 80 | CheckFactories.registerCheck<AvoidUnconditionalPreprocessorIfCheck>( |
| 81 | CheckName: "readability-avoid-unconditional-preprocessor-if"); |
| 82 | CheckFactories.registerCheck<BracesAroundStatementsCheck>( |
| 83 | CheckName: "readability-braces-around-statements"); |
| 84 | CheckFactories.registerCheck<ConstReturnTypeCheck>( |
| 85 | CheckName: "readability-const-return-type"); |
| 86 | CheckFactories.registerCheck<ContainerContainsCheck>( |
| 87 | CheckName: "readability-container-contains"); |
| 88 | CheckFactories.registerCheck<ContainerDataPointerCheck>( |
| 89 | CheckName: "readability-container-data-pointer"); |
| 90 | CheckFactories.registerCheck<ContainerSizeEmptyCheck>( |
| 91 | CheckName: "readability-container-size-empty"); |
| 92 | CheckFactories.registerCheck<ConvertMemberFunctionsToStatic>( |
| 93 | CheckName: "readability-convert-member-functions-to-static"); |
| 94 | CheckFactories.registerCheck<DeleteNullPointerCheck>( |
| 95 | CheckName: "readability-delete-null-pointer"); |
| 96 | CheckFactories.registerCheck<DuplicateIncludeCheck>( |
| 97 | CheckName: "readability-duplicate-include"); |
| 98 | CheckFactories.registerCheck<ElseAfterReturnCheck>( |
| 99 | CheckName: "readability-else-after-return"); |
| 100 | CheckFactories.registerCheck<EnumInitialValueCheck>( |
| 101 | CheckName: "readability-enum-initial-value"); |
| 102 | CheckFactories.registerCheck<FunctionCognitiveComplexityCheck>( |
| 103 | CheckName: "readability-function-cognitive-complexity"); |
| 104 | CheckFactories.registerCheck<FunctionSizeCheck>( |
| 105 | CheckName: "readability-function-size"); |
| 106 | CheckFactories.registerCheck<IdentifierLengthCheck>( |
| 107 | CheckName: "readability-identifier-length"); |
| 108 | CheckFactories.registerCheck<IdentifierNamingCheck>( |
| 109 | CheckName: "readability-identifier-naming"); |
| 110 | CheckFactories.registerCheck<ImplicitBoolConversionCheck>( |
| 111 | CheckName: "readability-implicit-bool-conversion"); |
| 112 | CheckFactories.registerCheck<MathMissingParenthesesCheck>( |
| 113 | CheckName: "readability-math-missing-parentheses"); |
| 114 | CheckFactories.registerCheck<RedundantInlineSpecifierCheck>( |
| 115 | CheckName: "readability-redundant-inline-specifier"); |
| 116 | CheckFactories.registerCheck<InconsistentDeclarationParameterNameCheck>( |
| 117 | CheckName: "readability-inconsistent-declaration-parameter-name"); |
| 118 | CheckFactories.registerCheck<IsolateDeclarationCheck>( |
| 119 | CheckName: "readability-isolate-declaration"); |
| 120 | CheckFactories.registerCheck<MagicNumbersCheck>( |
| 121 | CheckName: "readability-magic-numbers"); |
| 122 | CheckFactories.registerCheck<MakeMemberFunctionConstCheck>( |
| 123 | CheckName: "readability-make-member-function-const"); |
| 124 | CheckFactories.registerCheck<MisleadingIndentationCheck>( |
| 125 | CheckName: "readability-misleading-indentation"); |
| 126 | CheckFactories.registerCheck<MisplacedArrayIndexCheck>( |
| 127 | CheckName: "readability-misplaced-array-index"); |
| 128 | CheckFactories.registerCheck<OperatorsRepresentationCheck>( |
| 129 | CheckName: "readability-operators-representation"); |
| 130 | CheckFactories.registerCheck<QualifiedAutoCheck>( |
| 131 | CheckName: "readability-qualified-auto"); |
| 132 | CheckFactories.registerCheck<RedundantAccessSpecifiersCheck>( |
| 133 | CheckName: "readability-redundant-access-specifiers"); |
| 134 | CheckFactories.registerCheck<RedundantCastingCheck>( |
| 135 | CheckName: "readability-redundant-casting"); |
| 136 | CheckFactories.registerCheck<RedundantFunctionPtrDereferenceCheck>( |
| 137 | CheckName: "readability-redundant-function-ptr-dereference"); |
| 138 | CheckFactories.registerCheck<RedundantMemberInitCheck>( |
| 139 | CheckName: "readability-redundant-member-init"); |
| 140 | CheckFactories.registerCheck<RedundantPreprocessorCheck>( |
| 141 | CheckName: "readability-redundant-preprocessor"); |
| 142 | CheckFactories.registerCheck<ReferenceToConstructedTemporaryCheck>( |
| 143 | CheckName: "readability-reference-to-constructed-temporary"); |
| 144 | CheckFactories.registerCheck<SimplifySubscriptExprCheck>( |
| 145 | CheckName: "readability-simplify-subscript-expr"); |
| 146 | CheckFactories.registerCheck<StaticAccessedThroughInstanceCheck>( |
| 147 | CheckName: "readability-static-accessed-through-instance"); |
| 148 | CheckFactories.registerCheck<StaticDefinitionInAnonymousNamespaceCheck>( |
| 149 | CheckName: "readability-static-definition-in-anonymous-namespace"); |
| 150 | CheckFactories.registerCheck<StringCompareCheck>( |
| 151 | CheckName: "readability-string-compare"); |
| 152 | CheckFactories.registerCheck<readability::NamedParameterCheck>( |
| 153 | CheckName: "readability-named-parameter"); |
| 154 | CheckFactories.registerCheck<NonConstParameterCheck>( |
| 155 | CheckName: "readability-non-const-parameter"); |
| 156 | CheckFactories.registerCheck<RedundantControlFlowCheck>( |
| 157 | CheckName: "readability-redundant-control-flow"); |
| 158 | CheckFactories.registerCheck<RedundantDeclarationCheck>( |
| 159 | CheckName: "readability-redundant-declaration"); |
| 160 | CheckFactories.registerCheck<RedundantSmartptrGetCheck>( |
| 161 | CheckName: "readability-redundant-smartptr-get"); |
| 162 | CheckFactories.registerCheck<RedundantStringCStrCheck>( |
| 163 | CheckName: "readability-redundant-string-cstr"); |
| 164 | CheckFactories.registerCheck<RedundantStringInitCheck>( |
| 165 | CheckName: "readability-redundant-string-init"); |
| 166 | CheckFactories.registerCheck<SimplifyBooleanExprCheck>( |
| 167 | CheckName: "readability-simplify-boolean-expr"); |
| 168 | CheckFactories.registerCheck<SuspiciousCallArgumentCheck>( |
| 169 | CheckName: "readability-suspicious-call-argument"); |
| 170 | CheckFactories.registerCheck<UniqueptrDeleteReleaseCheck>( |
| 171 | CheckName: "readability-uniqueptr-delete-release"); |
| 172 | CheckFactories.registerCheck<UppercaseLiteralSuffixCheck>( |
| 173 | CheckName: "readability-uppercase-literal-suffix"); |
| 174 | CheckFactories.registerCheck<UseAnyOfAllOfCheck>( |
| 175 | CheckName: "readability-use-anyofallof"); |
| 176 | CheckFactories.registerCheck<UseStdMinMaxCheck>( |
| 177 | CheckName: "readability-use-std-min-max"); |
| 178 | } |
| 179 | }; |
| 180 | |
| 181 | // Register the ReadabilityModule using this statically initialized variable. |
| 182 | static ClangTidyModuleRegistry::Add<ReadabilityModule> |
| 183 | X("readability-module", "Adds readability-related checks."); |
| 184 | |
| 185 | } // namespace readability |
| 186 | |
| 187 | // This anchor is used to force the linker to link in the generated object file |
| 188 | // and thus register the ReadabilityModule. |
| 189 | // NOLINTNEXTLINE(misc-use-internal-linkage) |
| 190 | volatile int ReadabilityModuleAnchorSource = 0; |
| 191 | |
| 192 | } // namespace clang::tidy |
| 193 |
