1 //===--- MiscTidyModule.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 "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"
36 namespace clang::tidy
{
39 class MiscModule
: public ClangTidyModule
{
41 void addCheckFactories(ClangTidyCheckFactories
&CheckFactories
) override
{
42 CheckFactories
.registerCheck
<ConfusableIdentifierCheck
>(
43 "misc-confusable-identifiers");
44 CheckFactories
.registerCheck
<ConstCorrectnessCheck
>(
45 "misc-const-correctness");
46 CheckFactories
.registerCheck
<CoroutineHostileRAIICheck
>(
47 "misc-coroutine-hostile-raii");
48 CheckFactories
.registerCheck
<DefinitionsInHeadersCheck
>(
49 "misc-definitions-in-headers");
50 CheckFactories
.registerCheck
<HeaderIncludeCycleCheck
>(
51 "misc-header-include-cycle");
52 CheckFactories
.registerCheck
<IncludeCleanerCheck
>("misc-include-cleaner");
53 CheckFactories
.registerCheck
<MisleadingBidirectionalCheck
>(
54 "misc-misleading-bidirectional");
55 CheckFactories
.registerCheck
<MisleadingIdentifierCheck
>(
56 "misc-misleading-identifier");
57 CheckFactories
.registerCheck
<MisplacedConstCheck
>("misc-misplaced-const");
58 CheckFactories
.registerCheck
<NewDeleteOverloadsCheck
>(
59 "misc-new-delete-overloads");
60 CheckFactories
.registerCheck
<NoRecursionCheck
>("misc-no-recursion");
61 CheckFactories
.registerCheck
<NonCopyableObjectsCheck
>(
62 "misc-non-copyable-objects");
63 CheckFactories
.registerCheck
<NonPrivateMemberVariablesInClassesCheck
>(
64 "misc-non-private-member-variables-in-classes");
65 CheckFactories
.registerCheck
<RedundantExpressionCheck
>(
66 "misc-redundant-expression");
67 CheckFactories
.registerCheck
<StaticAssertCheck
>("misc-static-assert");
68 CheckFactories
.registerCheck
<ThrowByValueCatchByReferenceCheck
>(
69 "misc-throw-by-value-catch-by-reference");
70 CheckFactories
.registerCheck
<UnconventionalAssignOperatorCheck
>(
71 "misc-unconventional-assign-operator");
72 CheckFactories
.registerCheck
<UniqueptrResetReleaseCheck
>(
73 "misc-uniqueptr-reset-release");
74 CheckFactories
.registerCheck
<UnusedAliasDeclsCheck
>(
75 "misc-unused-alias-decls");
76 CheckFactories
.registerCheck
<UnusedParametersCheck
>(
77 "misc-unused-parameters");
78 CheckFactories
.registerCheck
<UnusedUsingDeclsCheck
>(
79 "misc-unused-using-decls");
80 CheckFactories
.registerCheck
<UseAnonymousNamespaceCheck
>(
81 "misc-use-anonymous-namespace");
82 CheckFactories
.registerCheck
<UseInternalLinkageCheck
>(
83 "misc-use-internal-linkage");
89 // Register the MiscTidyModule using this statically initialized variable.
90 static ClangTidyModuleRegistry::Add
<misc::MiscModule
>
91 X("misc-module", "Adds miscellaneous lint checks.");
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;
97 } // namespace clang::tidy