1 //===------- AbseilTidyModule.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 "CleanupCtadCheck.h"
13 #include "DurationAdditionCheck.h"
14 #include "DurationComparisonCheck.h"
15 #include "DurationConversionCastCheck.h"
16 #include "DurationDivisionCheck.h"
17 #include "DurationFactoryFloatCheck.h"
18 #include "DurationFactoryScaleCheck.h"
19 #include "DurationSubtractionCheck.h"
20 #include "DurationUnnecessaryConversionCheck.h"
21 #include "FasterStrsplitDelimiterCheck.h"
22 #include "NoInternalDependenciesCheck.h"
23 #include "NoNamespaceCheck.h"
24 #include "RedundantStrcatCallsCheck.h"
25 #include "StrCatAppendCheck.h"
26 #include "StringFindStartswithCheck.h"
27 #include "StringFindStrContainsCheck.h"
28 #include "TimeComparisonCheck.h"
29 #include "TimeSubtractionCheck.h"
30 #include "UpgradeDurationConversionsCheck.h"
32 namespace clang::tidy
{
35 class AbseilModule
: public ClangTidyModule
{
37 void addCheckFactories(ClangTidyCheckFactories
&CheckFactories
) override
{
38 CheckFactories
.registerCheck
<CleanupCtadCheck
>("abseil-cleanup-ctad");
39 CheckFactories
.registerCheck
<DurationAdditionCheck
>(
40 "abseil-duration-addition");
41 CheckFactories
.registerCheck
<DurationComparisonCheck
>(
42 "abseil-duration-comparison");
43 CheckFactories
.registerCheck
<DurationConversionCastCheck
>(
44 "abseil-duration-conversion-cast");
45 CheckFactories
.registerCheck
<DurationDivisionCheck
>(
46 "abseil-duration-division");
47 CheckFactories
.registerCheck
<DurationFactoryFloatCheck
>(
48 "abseil-duration-factory-float");
49 CheckFactories
.registerCheck
<DurationFactoryScaleCheck
>(
50 "abseil-duration-factory-scale");
51 CheckFactories
.registerCheck
<DurationSubtractionCheck
>(
52 "abseil-duration-subtraction");
53 CheckFactories
.registerCheck
<DurationUnnecessaryConversionCheck
>(
54 "abseil-duration-unnecessary-conversion");
55 CheckFactories
.registerCheck
<FasterStrsplitDelimiterCheck
>(
56 "abseil-faster-strsplit-delimiter");
57 CheckFactories
.registerCheck
<NoInternalDependenciesCheck
>(
58 "abseil-no-internal-dependencies");
59 CheckFactories
.registerCheck
<NoNamespaceCheck
>("abseil-no-namespace");
60 CheckFactories
.registerCheck
<RedundantStrcatCallsCheck
>(
61 "abseil-redundant-strcat-calls");
62 CheckFactories
.registerCheck
<StrCatAppendCheck
>(
63 "abseil-str-cat-append");
64 CheckFactories
.registerCheck
<StringFindStartswithCheck
>(
65 "abseil-string-find-startswith");
66 CheckFactories
.registerCheck
<StringFindStrContainsCheck
>(
67 "abseil-string-find-str-contains");
68 CheckFactories
.registerCheck
<TimeComparisonCheck
>(
69 "abseil-time-comparison");
70 CheckFactories
.registerCheck
<TimeSubtractionCheck
>(
71 "abseil-time-subtraction");
72 CheckFactories
.registerCheck
<UpgradeDurationConversionsCheck
>(
73 "abseil-upgrade-duration-conversions");
77 // Register the AbseilModule using this statically initialized variable.
78 static ClangTidyModuleRegistry::Add
<AbseilModule
> X("abseil-module",
79 "Add Abseil checks.");
83 // This anchor is used to force the linker to link in the generated object file
84 // and thus register the AbseilModule.
85 volatile int AbseilModuleAnchorSource
= 0;
87 } // namespace clang::tidy