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

source code of clang-tools-extra/clang-tidy/abseil/AbseilTidyModule.cpp