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>(CheckName: "abseil-str-cat-append");
63 CheckFactories.registerCheck<StringFindStartswithCheck>(
64 CheckName: "abseil-string-find-startswith");
65 CheckFactories.registerCheck<StringFindStrContainsCheck>(
66 CheckName: "abseil-string-find-str-contains");
67 CheckFactories.registerCheck<TimeComparisonCheck>(CheckName: "abseil-time-comparison");
68 CheckFactories.registerCheck<TimeSubtractionCheck>(
69 CheckName: "abseil-time-subtraction");
70 CheckFactories.registerCheck<UpgradeDurationConversionsCheck>(
71 CheckName: "abseil-upgrade-duration-conversions");
72 }
73};
74
75// Register the AbseilModule using this statically initialized variable.
76static ClangTidyModuleRegistry::Add<AbseilModule> X("abseil-module",
77 "Add Abseil checks.");
78
79} // namespace abseil
80
81// This anchor is used to force the linker to link in the generated object file
82// and thus register the AbseilModule.
83volatile int AbseilModuleAnchorSource = 0; // NOLINT(misc-use-internal-linkage)
84
85} // namespace clang::tidy
86

Provided by KDAB

Privacy Policy
Learn to use CMake with our Intro Training
Find out more

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