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