blob: 646c6595600884e27c2059a24985246b67984481 [file] [log] [blame]
Alexander Kornienkob959f4c2015-12-30 10:24:40 +00001//===--- PeformanceTidyModule.cpp - clang-tidy ----------------------------===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9
10#include "../ClangTidy.h"
11#include "../ClangTidyModule.h"
12#include "../ClangTidyModuleRegistry.h"
Samuel Benzaquen51e15232016-02-12 19:28:14 +000013#include "FasterStringFindCheck.h"
Alexander Kornienko5aebfe22016-01-29 15:54:26 +000014#include "ForRangeCopyCheck.h"
Alexander Kornienkof1a65522017-08-08 14:53:52 +000015#include "ImplicitConversionInLoopCheck.h"
Alexander Kornienko6e39e682017-11-27 13:06:28 +000016#include "InefficientAlgorithmCheck.h"
Justin Lebarecb10f42016-12-14 03:15:01 +000017#include "InefficientStringConcatenationCheck.h"
Haojian Wuc5cc0332017-04-18 07:46:39 +000018#include "InefficientVectorOperationCheck.h"
Alexander Kornienko1bfcba82017-11-28 16:41:03 +000019#include "MoveConstArgCheck.h"
Alexander Kornienko6e39e682017-11-27 13:06:28 +000020#include "MoveConstructorInitCheck.h"
Alexander Kornienko1bfcba82017-11-28 16:41:03 +000021#include "NoexceptMoveConstructorCheck.h"
Justin Lebarecb10f42016-12-14 03:15:01 +000022#include "TypePromotionInMathFnCheck.h"
Alexander Kornienkob959f4c2015-12-30 10:24:40 +000023#include "UnnecessaryCopyInitialization.h"
Felix Berger3c8edde2016-03-29 02:42:38 +000024#include "UnnecessaryValueParamCheck.h"
Alexander Kornienkob959f4c2015-12-30 10:24:40 +000025
26namespace clang {
27namespace tidy {
28namespace performance {
29
30class PerformanceModule : public ClangTidyModule {
31public:
32 void addCheckFactories(ClangTidyCheckFactories &CheckFactories) override {
Samuel Benzaquen51e15232016-02-12 19:28:14 +000033 CheckFactories.registerCheck<FasterStringFindCheck>(
34 "performance-faster-string-find");
Alexander Kornienko5aebfe22016-01-29 15:54:26 +000035 CheckFactories.registerCheck<ForRangeCopyCheck>(
36 "performance-for-range-copy");
Alexander Kornienkof1a65522017-08-08 14:53:52 +000037 CheckFactories.registerCheck<ImplicitConversionInLoopCheck>(
38 "performance-implicit-conversion-in-loop");
Alexander Kornienko6e39e682017-11-27 13:06:28 +000039 CheckFactories.registerCheck<InefficientAlgorithmCheck>(
40 "performance-inefficient-algorithm");
Alexander Kornienkodcbf57d2016-08-03 23:06:03 +000041 CheckFactories.registerCheck<InefficientStringConcatenationCheck>(
42 "performance-inefficient-string-concatenation");
Haojian Wuc5cc0332017-04-18 07:46:39 +000043 CheckFactories.registerCheck<InefficientVectorOperationCheck>(
44 "performance-inefficient-vector-operation");
Alexander Kornienko1bfcba82017-11-28 16:41:03 +000045 CheckFactories.registerCheck<MoveConstArgCheck>(
46 "performance-move-const-arg");
Alexander Kornienko6e39e682017-11-27 13:06:28 +000047 CheckFactories.registerCheck<MoveConstructorInitCheck>(
48 "performance-move-constructor-init");
Alexander Kornienko1bfcba82017-11-28 16:41:03 +000049 CheckFactories.registerCheck<NoexceptMoveConstructorCheck>(
50 "performance-noexcept-move-constructor");
Justin Lebarecb10f42016-12-14 03:15:01 +000051 CheckFactories.registerCheck<TypePromotionInMathFnCheck>(
52 "performance-type-promotion-in-math-fn");
Alexander Kornienkob959f4c2015-12-30 10:24:40 +000053 CheckFactories.registerCheck<UnnecessaryCopyInitialization>(
54 "performance-unnecessary-copy-initialization");
Felix Berger3c8edde2016-03-29 02:42:38 +000055 CheckFactories.registerCheck<UnnecessaryValueParamCheck>(
56 "performance-unnecessary-value-param");
Alexander Kornienkob959f4c2015-12-30 10:24:40 +000057 }
58};
59
60// Register the PerformanceModule using this statically initialized variable.
61static ClangTidyModuleRegistry::Add<PerformanceModule>
62 X("performance-module", "Adds performance checks.");
63
64} // namespace performance
65
66// This anchor is used to force the linker to link in the generated object file
67// and thus register the PerformanceModule.
68volatile int PerformanceModuleAnchorSource = 0;
69
70} // namespace tidy
71} // namespace clang