1 | //===--- MiscTidyModule.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 "ConfusableIdentifierCheck.h" |
13 | #include "ConstCorrectnessCheck.h" |
14 | #include "CoroutineHostileRAIICheck.h" |
15 | #include "DefinitionsInHeadersCheck.h" |
16 | #include "HeaderIncludeCycleCheck.h" |
17 | #include "IncludeCleanerCheck.h" |
18 | #include "MisleadingBidirectional.h" |
19 | #include "MisleadingIdentifier.h" |
20 | #include "MisplacedConstCheck.h" |
21 | #include "NewDeleteOverloadsCheck.h" |
22 | #include "NoRecursionCheck.h" |
23 | #include "NonCopyableObjects.h" |
24 | #include "NonPrivateMemberVariablesInClassesCheck.h" |
25 | #include "RedundantExpressionCheck.h" |
26 | #include "StaticAssertCheck.h" |
27 | #include "ThrowByValueCatchByReferenceCheck.h" |
28 | #include "UnconventionalAssignOperatorCheck.h" |
29 | #include "UniqueptrResetReleaseCheck.h" |
30 | #include "UnusedAliasDeclsCheck.h" |
31 | #include "UnusedParametersCheck.h" |
32 | #include "UnusedUsingDeclsCheck.h" |
33 | #include "UseAnonymousNamespaceCheck.h" |
34 | #include "UseInternalLinkageCheck.h" |
35 | |
36 | namespace clang::tidy { |
37 | namespace misc { |
38 | |
39 | class MiscModule : public ClangTidyModule { |
40 | public: |
41 | void addCheckFactories(ClangTidyCheckFactories &CheckFactories) override { |
42 | CheckFactories.registerCheck<ConfusableIdentifierCheck>( |
43 | CheckName: "misc-confusable-identifiers"); |
44 | CheckFactories.registerCheck<ConstCorrectnessCheck>( |
45 | CheckName: "misc-const-correctness"); |
46 | CheckFactories.registerCheck<CoroutineHostileRAIICheck>( |
47 | CheckName: "misc-coroutine-hostile-raii"); |
48 | CheckFactories.registerCheck<DefinitionsInHeadersCheck>( |
49 | CheckName: "misc-definitions-in-headers"); |
50 | CheckFactories.registerCheck<HeaderIncludeCycleCheck>( |
51 | CheckName: "misc-header-include-cycle"); |
52 | CheckFactories.registerCheck<IncludeCleanerCheck>(CheckName: "misc-include-cleaner"); |
53 | CheckFactories.registerCheck<MisleadingBidirectionalCheck>( |
54 | CheckName: "misc-misleading-bidirectional"); |
55 | CheckFactories.registerCheck<MisleadingIdentifierCheck>( |
56 | CheckName: "misc-misleading-identifier"); |
57 | CheckFactories.registerCheck<MisplacedConstCheck>(CheckName: "misc-misplaced-const"); |
58 | CheckFactories.registerCheck<NewDeleteOverloadsCheck>( |
59 | CheckName: "misc-new-delete-overloads"); |
60 | CheckFactories.registerCheck<NoRecursionCheck>(CheckName: "misc-no-recursion"); |
61 | CheckFactories.registerCheck<NonCopyableObjectsCheck>( |
62 | CheckName: "misc-non-copyable-objects"); |
63 | CheckFactories.registerCheck<NonPrivateMemberVariablesInClassesCheck>( |
64 | CheckName: "misc-non-private-member-variables-in-classes"); |
65 | CheckFactories.registerCheck<RedundantExpressionCheck>( |
66 | CheckName: "misc-redundant-expression"); |
67 | CheckFactories.registerCheck<StaticAssertCheck>(CheckName: "misc-static-assert"); |
68 | CheckFactories.registerCheck<ThrowByValueCatchByReferenceCheck>( |
69 | CheckName: "misc-throw-by-value-catch-by-reference"); |
70 | CheckFactories.registerCheck<UnconventionalAssignOperatorCheck>( |
71 | CheckName: "misc-unconventional-assign-operator"); |
72 | CheckFactories.registerCheck<UniqueptrResetReleaseCheck>( |
73 | CheckName: "misc-uniqueptr-reset-release"); |
74 | CheckFactories.registerCheck<UnusedAliasDeclsCheck>( |
75 | CheckName: "misc-unused-alias-decls"); |
76 | CheckFactories.registerCheck<UnusedParametersCheck>( |
77 | CheckName: "misc-unused-parameters"); |
78 | CheckFactories.registerCheck<UnusedUsingDeclsCheck>( |
79 | CheckName: "misc-unused-using-decls"); |
80 | CheckFactories.registerCheck<UseAnonymousNamespaceCheck>( |
81 | CheckName: "misc-use-anonymous-namespace"); |
82 | CheckFactories.registerCheck<UseInternalLinkageCheck>( |
83 | CheckName: "misc-use-internal-linkage"); |
84 | } |
85 | }; |
86 | |
87 | } // namespace misc |
88 | |
89 | // Register the MiscTidyModule using this statically initialized variable. |
90 | static ClangTidyModuleRegistry::Add<misc::MiscModule> |
91 | X("misc-module", "Adds miscellaneous lint checks."); |
92 | |
93 | // This anchor is used to force the linker to link in the generated object file |
94 | // and thus register the MiscModule. |
95 | volatile int MiscModuleAnchorSource = 0; // NOLINT(misc-use-internal-linkage) |
96 | |
97 | } // namespace clang::tidy |
98 |