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