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