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