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