1 //===--- ModernizeTidyModule.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 "AvoidBindCheck.h"
13 #include "AvoidCArraysCheck.h"
14 #include "ConcatNestedNamespacesCheck.h"
15 #include "DeprecatedHeadersCheck.h"
16 #include "DeprecatedIosBaseAliasesCheck.h"
17 #include "LoopConvertCheck.h"
18 #include "MacroToEnumCheck.h"
19 #include "MakeSharedCheck.h"
20 #include "MakeUniqueCheck.h"
21 #include "PassByValueCheck.h"
22 #include "RawStringLiteralCheck.h"
23 #include "RedundantVoidArgCheck.h"
24 #include "ReplaceAutoPtrCheck.h"
25 #include "ReplaceDisallowCopyAndAssignMacroCheck.h"
26 #include "ReplaceRandomShuffleCheck.h"
27 #include "ReturnBracedInitListCheck.h"
28 #include "ShrinkToFitCheck.h"
29 #include "TypeTraitsCheck.h"
30 #include "UnaryStaticAssertCheck.h"
31 #include "UseAutoCheck.h"
32 #include "UseBoolLiteralsCheck.h"
33 #include "UseConstraintsCheck.h"
34 #include "UseDefaultMemberInitCheck.h"
35 #include "UseEmplaceCheck.h"
36 #include "UseEqualsDefaultCheck.h"
37 #include "UseEqualsDeleteCheck.h"
38 #include "UseNodiscardCheck.h"
39 #include "UseNoexceptCheck.h"
40 #include "UseNullptrCheck.h"
41 #include "UseOverrideCheck.h"
42 #include "UseStdPrintCheck.h"
43 #include "UseTrailingReturnTypeCheck.h"
44 #include "UseTransparentFunctorsCheck.h"
45 #include "UseUncaughtExceptionsCheck.h"
46 #include "UseUsingCheck.h"
48 using namespace clang::ast_matchers
;
50 namespace clang::tidy
{
53 class ModernizeModule
: public ClangTidyModule
{
55 void addCheckFactories(ClangTidyCheckFactories
&CheckFactories
) override
{
56 CheckFactories
.registerCheck
<AvoidBindCheck
>("modernize-avoid-bind");
57 CheckFactories
.registerCheck
<AvoidCArraysCheck
>("modernize-avoid-c-arrays");
58 CheckFactories
.registerCheck
<ConcatNestedNamespacesCheck
>(
59 "modernize-concat-nested-namespaces");
60 CheckFactories
.registerCheck
<DeprecatedHeadersCheck
>(
61 "modernize-deprecated-headers");
62 CheckFactories
.registerCheck
<DeprecatedIosBaseAliasesCheck
>(
63 "modernize-deprecated-ios-base-aliases");
64 CheckFactories
.registerCheck
<LoopConvertCheck
>("modernize-loop-convert");
65 CheckFactories
.registerCheck
<MacroToEnumCheck
>("modernize-macro-to-enum");
66 CheckFactories
.registerCheck
<MakeSharedCheck
>("modernize-make-shared");
67 CheckFactories
.registerCheck
<MakeUniqueCheck
>("modernize-make-unique");
68 CheckFactories
.registerCheck
<PassByValueCheck
>("modernize-pass-by-value");
69 CheckFactories
.registerCheck
<UseStdPrintCheck
>("modernize-use-std-print");
70 CheckFactories
.registerCheck
<RawStringLiteralCheck
>(
71 "modernize-raw-string-literal");
72 CheckFactories
.registerCheck
<RedundantVoidArgCheck
>(
73 "modernize-redundant-void-arg");
74 CheckFactories
.registerCheck
<ReplaceAutoPtrCheck
>(
75 "modernize-replace-auto-ptr");
76 CheckFactories
.registerCheck
<ReplaceDisallowCopyAndAssignMacroCheck
>(
77 "modernize-replace-disallow-copy-and-assign-macro");
78 CheckFactories
.registerCheck
<ReplaceRandomShuffleCheck
>(
79 "modernize-replace-random-shuffle");
80 CheckFactories
.registerCheck
<ReturnBracedInitListCheck
>(
81 "modernize-return-braced-init-list");
82 CheckFactories
.registerCheck
<ShrinkToFitCheck
>("modernize-shrink-to-fit");
83 CheckFactories
.registerCheck
<TypeTraitsCheck
>("modernize-type-traits");
84 CheckFactories
.registerCheck
<UnaryStaticAssertCheck
>(
85 "modernize-unary-static-assert");
86 CheckFactories
.registerCheck
<UseAutoCheck
>("modernize-use-auto");
87 CheckFactories
.registerCheck
<UseBoolLiteralsCheck
>(
88 "modernize-use-bool-literals");
89 CheckFactories
.registerCheck
<UseConstraintsCheck
>(
90 "modernize-use-constraints");
91 CheckFactories
.registerCheck
<UseDefaultMemberInitCheck
>(
92 "modernize-use-default-member-init");
93 CheckFactories
.registerCheck
<UseEmplaceCheck
>("modernize-use-emplace");
94 CheckFactories
.registerCheck
<UseEqualsDefaultCheck
>("modernize-use-equals-default");
95 CheckFactories
.registerCheck
<UseEqualsDeleteCheck
>(
96 "modernize-use-equals-delete");
97 CheckFactories
.registerCheck
<UseNodiscardCheck
>(
98 "modernize-use-nodiscard");
99 CheckFactories
.registerCheck
<UseNoexceptCheck
>("modernize-use-noexcept");
100 CheckFactories
.registerCheck
<UseNullptrCheck
>("modernize-use-nullptr");
101 CheckFactories
.registerCheck
<UseOverrideCheck
>("modernize-use-override");
102 CheckFactories
.registerCheck
<UseTrailingReturnTypeCheck
>(
103 "modernize-use-trailing-return-type");
104 CheckFactories
.registerCheck
<UseTransparentFunctorsCheck
>(
105 "modernize-use-transparent-functors");
106 CheckFactories
.registerCheck
<UseUncaughtExceptionsCheck
>(
107 "modernize-use-uncaught-exceptions");
108 CheckFactories
.registerCheck
<UseUsingCheck
>("modernize-use-using");
112 // Register the ModernizeTidyModule using this statically initialized variable.
113 static ClangTidyModuleRegistry::Add
<ModernizeModule
> X("modernize-module",
114 "Add modernize checks.");
116 } // namespace modernize
118 // This anchor is used to force the linker to link in the generated object file
119 // and thus register the ModernizeModule.
120 volatile int ModernizeModuleAnchorSource
= 0;
122 } // namespace clang::tidy