| 1 | //===------- HICPPTidyModule.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 "../bugprone/UndelegatedConstructorCheck.h" |
| 13 | #include "../bugprone/UseAfterMoveCheck.h" |
| 14 | #include "../cppcoreguidelines/AvoidGotoCheck.h" |
| 15 | #include "../cppcoreguidelines/NoMallocCheck.h" |
| 16 | #include "../cppcoreguidelines/ProBoundsArrayToPointerDecayCheck.h" |
| 17 | #include "../cppcoreguidelines/ProTypeMemberInitCheck.h" |
| 18 | #include "../cppcoreguidelines/ProTypeVarargCheck.h" |
| 19 | #include "../cppcoreguidelines/SpecialMemberFunctionsCheck.h" |
| 20 | #include "../google/ExplicitConstructorCheck.h" |
| 21 | #include "../misc/NewDeleteOverloadsCheck.h" |
| 22 | #include "../misc/StaticAssertCheck.h" |
| 23 | #include "../modernize/AvoidCArraysCheck.h" |
| 24 | #include "../modernize/DeprecatedHeadersCheck.h" |
| 25 | #include "../modernize/UseAutoCheck.h" |
| 26 | #include "../modernize/UseEmplaceCheck.h" |
| 27 | #include "../modernize/UseEqualsDefaultCheck.h" |
| 28 | #include "../modernize/UseEqualsDeleteCheck.h" |
| 29 | #include "../modernize/UseNoexceptCheck.h" |
| 30 | #include "../modernize/UseNullptrCheck.h" |
| 31 | #include "../modernize/UseOverrideCheck.h" |
| 32 | #include "../performance/MoveConstArgCheck.h" |
| 33 | #include "../performance/NoexceptMoveConstructorCheck.h" |
| 34 | #include "../readability/BracesAroundStatementsCheck.h" |
| 35 | #include "../readability/FunctionSizeCheck.h" |
| 36 | #include "../readability/NamedParameterCheck.h" |
| 37 | #include "../readability/UppercaseLiteralSuffixCheck.h" |
| 38 | #include "ExceptionBaseclassCheck.h" |
| 39 | #include "IgnoredRemoveResultCheck.h" |
| 40 | #include "MultiwayPathsCoveredCheck.h" |
| 41 | #include "NoAssemblerCheck.h" |
| 42 | #include "SignedBitwiseCheck.h" |
| 43 | |
| 44 | namespace clang::tidy { |
| 45 | namespace hicpp { |
| 46 | |
| 47 | class HICPPModule : public ClangTidyModule { |
| 48 | public: |
| 49 | void addCheckFactories(ClangTidyCheckFactories &CheckFactories) override { |
| 50 | CheckFactories.registerCheck<modernize::AvoidCArraysCheck>( |
| 51 | CheckName: "hicpp-avoid-c-arrays"); |
| 52 | CheckFactories.registerCheck<cppcoreguidelines::AvoidGotoCheck>( |
| 53 | CheckName: "hicpp-avoid-goto"); |
| 54 | CheckFactories.registerCheck<readability::BracesAroundStatementsCheck>( |
| 55 | CheckName: "hicpp-braces-around-statements"); |
| 56 | CheckFactories.registerCheck<modernize::DeprecatedHeadersCheck>( |
| 57 | CheckName: "hicpp-deprecated-headers"); |
| 58 | CheckFactories.registerCheck<ExceptionBaseclassCheck>( |
| 59 | CheckName: "hicpp-exception-baseclass"); |
| 60 | CheckFactories.registerCheck<IgnoredRemoveResultCheck>( |
| 61 | CheckName: "hicpp-ignored-remove-result"); |
| 62 | CheckFactories.registerCheck<MultiwayPathsCoveredCheck>( |
| 63 | CheckName: "hicpp-multiway-paths-covered"); |
| 64 | CheckFactories.registerCheck<SignedBitwiseCheck>(CheckName: "hicpp-signed-bitwise"); |
| 65 | CheckFactories.registerCheck<google::ExplicitConstructorCheck>( |
| 66 | CheckName: "hicpp-explicit-conversions"); |
| 67 | CheckFactories.registerCheck<readability::FunctionSizeCheck>( |
| 68 | CheckName: "hicpp-function-size"); |
| 69 | CheckFactories.registerCheck<readability::NamedParameterCheck>( |
| 70 | CheckName: "hicpp-named-parameter"); |
| 71 | CheckFactories.registerCheck<bugprone::UseAfterMoveCheck>( |
| 72 | CheckName: "hicpp-invalid-access-moved"); |
| 73 | CheckFactories.registerCheck<cppcoreguidelines::ProTypeMemberInitCheck>( |
| 74 | CheckName: "hicpp-member-init"); |
| 75 | CheckFactories.registerCheck<performance::MoveConstArgCheck>( |
| 76 | CheckName: "hicpp-move-const-arg"); |
| 77 | CheckFactories.registerCheck<misc::NewDeleteOverloadsCheck>( |
| 78 | CheckName: "hicpp-new-delete-operators"); |
| 79 | CheckFactories.registerCheck<performance::NoexceptMoveConstructorCheck>( |
| 80 | CheckName: "hicpp-noexcept-move"); |
| 81 | CheckFactories |
| 82 | .registerCheck<cppcoreguidelines::ProBoundsArrayToPointerDecayCheck>( |
| 83 | CheckName: "hicpp-no-array-decay"); |
| 84 | CheckFactories.registerCheck<NoAssemblerCheck>(CheckName: "hicpp-no-assembler"); |
| 85 | CheckFactories.registerCheck<cppcoreguidelines::NoMallocCheck>( |
| 86 | CheckName: "hicpp-no-malloc"); |
| 87 | CheckFactories |
| 88 | .registerCheck<cppcoreguidelines::SpecialMemberFunctionsCheck>( |
| 89 | CheckName: "hicpp-special-member-functions"); |
| 90 | CheckFactories.registerCheck<misc::StaticAssertCheck>( |
| 91 | CheckName: "hicpp-static-assert"); |
| 92 | CheckFactories.registerCheck<modernize::UseAutoCheck>(CheckName: "hicpp-use-auto"); |
| 93 | CheckFactories.registerCheck<bugprone::UndelegatedConstructorCheck>( |
| 94 | CheckName: "hicpp-undelegated-constructor"); |
| 95 | CheckFactories.registerCheck<modernize::UseEmplaceCheck>( |
| 96 | CheckName: "hicpp-use-emplace"); |
| 97 | CheckFactories.registerCheck<modernize::UseEqualsDefaultCheck>( |
| 98 | CheckName: "hicpp-use-equals-default"); |
| 99 | CheckFactories.registerCheck<modernize::UseEqualsDeleteCheck>( |
| 100 | CheckName: "hicpp-use-equals-delete"); |
| 101 | CheckFactories.registerCheck<modernize::UseNoexceptCheck>( |
| 102 | CheckName: "hicpp-use-noexcept"); |
| 103 | CheckFactories.registerCheck<modernize::UseNullptrCheck>( |
| 104 | CheckName: "hicpp-use-nullptr"); |
| 105 | CheckFactories.registerCheck<modernize::UseOverrideCheck>( |
| 106 | CheckName: "hicpp-use-override"); |
| 107 | CheckFactories.registerCheck<readability::UppercaseLiteralSuffixCheck>( |
| 108 | CheckName: "hicpp-uppercase-literal-suffix"); |
| 109 | CheckFactories.registerCheck<cppcoreguidelines::ProTypeVarargCheck>( |
| 110 | CheckName: "hicpp-vararg"); |
| 111 | } |
| 112 | }; |
| 113 | |
| 114 | // Register the HICPPModule using this statically initialized variable. |
| 115 | static ClangTidyModuleRegistry::Add<HICPPModule> |
| 116 | X("hicpp-module", "Adds High-Integrity C++ checks."); |
| 117 | |
| 118 | } // namespace hicpp |
| 119 | |
| 120 | // This anchor is used to force the linker to link in the generated object file |
| 121 | // and thus register the HICPPModule. |
| 122 | volatile int HICPPModuleAnchorSource = 0; // NOLINT(misc-use-internal-linkage) |
| 123 | |
| 124 | } // namespace clang::tidy |
| 125 |
