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