[docs] Add LICENSE.txt to the root of the mono-repo
[llvm-project.git] / clang-tools-extra / clang-tidy / abseil / AbseilTidyModule.cpp
blob5d99e6b50075445223fb5c919dd46db39396b431
1 //===------- AbseilTidyModule.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 //===----------------------------------------------------------------------===//
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 {
33 namespace tidy {
34 namespace abseil {
36 class AbseilModule : public ClangTidyModule {
37 public:
38 void addCheckFactories(ClangTidyCheckFactories &CheckFactories) override {
39 CheckFactories.registerCheck<CleanupCtadCheck>("abseil-cleanup-ctad");
40 CheckFactories.registerCheck<DurationAdditionCheck>(
41 "abseil-duration-addition");
42 CheckFactories.registerCheck<DurationComparisonCheck>(
43 "abseil-duration-comparison");
44 CheckFactories.registerCheck<DurationConversionCastCheck>(
45 "abseil-duration-conversion-cast");
46 CheckFactories.registerCheck<DurationDivisionCheck>(
47 "abseil-duration-division");
48 CheckFactories.registerCheck<DurationFactoryFloatCheck>(
49 "abseil-duration-factory-float");
50 CheckFactories.registerCheck<DurationFactoryScaleCheck>(
51 "abseil-duration-factory-scale");
52 CheckFactories.registerCheck<DurationSubtractionCheck>(
53 "abseil-duration-subtraction");
54 CheckFactories.registerCheck<DurationUnnecessaryConversionCheck>(
55 "abseil-duration-unnecessary-conversion");
56 CheckFactories.registerCheck<FasterStrsplitDelimiterCheck>(
57 "abseil-faster-strsplit-delimiter");
58 CheckFactories.registerCheck<NoInternalDependenciesCheck>(
59 "abseil-no-internal-dependencies");
60 CheckFactories.registerCheck<NoNamespaceCheck>("abseil-no-namespace");
61 CheckFactories.registerCheck<RedundantStrcatCallsCheck>(
62 "abseil-redundant-strcat-calls");
63 CheckFactories.registerCheck<StrCatAppendCheck>(
64 "abseil-str-cat-append");
65 CheckFactories.registerCheck<StringFindStartswithCheck>(
66 "abseil-string-find-startswith");
67 CheckFactories.registerCheck<StringFindStrContainsCheck>(
68 "abseil-string-find-str-contains");
69 CheckFactories.registerCheck<TimeComparisonCheck>(
70 "abseil-time-comparison");
71 CheckFactories.registerCheck<TimeSubtractionCheck>(
72 "abseil-time-subtraction");
73 CheckFactories.registerCheck<UpgradeDurationConversionsCheck>(
74 "abseil-upgrade-duration-conversions");
78 // Register the AbseilModule using this statically initialized variable.
79 static ClangTidyModuleRegistry::Add<AbseilModule> X("abseil-module",
80 "Add Abseil checks.");
82 } // namespace abseil
84 // This anchor is used to force the linker to link in the generated object file
85 // and thus register the AbseilModule.
86 volatile int AbseilModuleAnchorSource = 0;
88 } // namespace tidy
89 } // namespace clang