clang-tools 23.0.0git
PerformanceTidyModule.cpp
Go to the documentation of this file.
1//===----------------------------------------------------------------------===//
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 "AvoidEndlCheck.h"
12#include "EnumSizeCheck.h"
14#include "ForRangeCopyCheck.h"
19#include "MoveConstArgCheck.h"
22#include "NoIntToPtrCheck.h"
25#include "NoexceptSwapCheck.h"
31
32namespace clang::tidy {
33namespace performance {
34namespace {
35
36class PerformanceModule : public ClangTidyModule {
37public:
38 void addCheckFactories(ClangTidyCheckFactories &CheckFactories) override {
39 CheckFactories.registerCheck<AvoidEndlCheck>("performance-avoid-endl");
40 CheckFactories.registerCheck<EnumSizeCheck>("performance-enum-size");
41 CheckFactories.registerCheck<FasterStringFindCheck>(
42 "performance-faster-string-find");
43 CheckFactories.registerCheck<ForRangeCopyCheck>(
44 "performance-for-range-copy");
45 CheckFactories.registerCheck<ImplicitConversionInLoopCheck>(
46 "performance-implicit-conversion-in-loop");
47 CheckFactories.registerCheck<InefficientAlgorithmCheck>(
48 "performance-inefficient-algorithm");
49 CheckFactories.registerCheck<InefficientStringConcatenationCheck>(
50 "performance-inefficient-string-concatenation");
51 CheckFactories.registerCheck<InefficientVectorOperationCheck>(
52 "performance-inefficient-vector-operation");
53 CheckFactories.registerCheck<MoveConstArgCheck>(
54 "performance-move-const-arg");
55 CheckFactories.registerCheck<MoveConstructorInitCheck>(
56 "performance-move-constructor-init");
57 CheckFactories.registerCheck<NoAutomaticMoveCheck>(
58 "performance-no-automatic-move");
59 CheckFactories.registerCheck<NoIntToPtrCheck>("performance-no-int-to-ptr");
60 CheckFactories.registerCheck<NoexceptDestructorCheck>(
61 "performance-noexcept-destructor");
62 CheckFactories.registerCheck<NoexceptMoveConstructorCheck>(
63 "performance-noexcept-move-constructor");
64 CheckFactories.registerCheck<NoexceptSwapCheck>(
65 "performance-noexcept-swap");
66 CheckFactories.registerCheck<StringViewConversionsCheck>(
67 "performance-string-view-conversions");
68 CheckFactories.registerCheck<TriviallyDestructibleCheck>(
69 "performance-trivially-destructible");
70 CheckFactories.registerCheck<TypePromotionInMathFnCheck>(
71 "performance-type-promotion-in-math-fn");
72 CheckFactories.registerCheck<UnnecessaryCopyInitializationCheck>(
73 "performance-unnecessary-copy-initialization");
74 CheckFactories.registerCheck<UnnecessaryValueParamCheck>(
75 "performance-unnecessary-value-param");
76 }
77};
78
79} // namespace
80
81// Register the PerformanceModule using this statically initialized variable.
82static ClangTidyModuleRegistry::Add<PerformanceModule>
83 X("performance-module", "Adds performance checks.");
84
85} // namespace performance
86
87// This anchor is used to force the linker to link in the generated object file
88// and thus register the PerformanceModule.
89// NOLINTNEXTLINE(misc-use-internal-linkage)
91
92} // namespace clang::tidy
static ClangTidyModuleRegistry::Add< PerformanceModule > X("performance-module", "Adds performance checks.")
volatile int PerformanceModuleAnchorSource