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