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

source code of clang-tools-extra/clang-tidy/hicpp/HICPPTidyModule.cpp