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

source code of clang-tools-extra/clang-tidy/modernize/ModernizeTidyModule.cpp