blob: 51a8728bf73cb36c70f7148a285bc35965d60467 [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 Kornienko6e39e682017-11-27 13:06:28 +000019#include "MoveConstructorInitCheck.h"
Justin Lebarecb10f42016-12-14 03:15:01 +000020#include "TypePromotionInMathFnCheck.h"
Alexander Kornienkob959f4c2015-12-30 10:24:40 +000021#include "UnnecessaryCopyInitialization.h"
Felix Berger3c8edde2016-03-29 02:42:38 +000022#include "UnnecessaryValueParamCheck.h"
Alexander Kornienkob959f4c2015-12-30 10:24:40 +000023
24namespace clang {
25namespace tidy {
26namespace performance {
27
28class PerformanceModule : public ClangTidyModule {
29public:
30 void addCheckFactories(ClangTidyCheckFactories &CheckFactories) override {
Samuel Benzaquen51e15232016-02-12 19:28:14 +000031 CheckFactories.registerCheck<FasterStringFindCheck>(
32 "performance-faster-string-find");
Alexander Kornienko5aebfe22016-01-29 15:54:26 +000033 CheckFactories.registerCheck<ForRangeCopyCheck>(
34 "performance-for-range-copy");
Alexander Kornienkof1a65522017-08-08 14:53:52 +000035 CheckFactories.registerCheck<ImplicitConversionInLoopCheck>(
36 "performance-implicit-conversion-in-loop");
Alexander Kornienko6e39e682017-11-27 13:06:28 +000037 CheckFactories.registerCheck<InefficientAlgorithmCheck>(
38 "performance-inefficient-algorithm");
Alexander Kornienkodcbf57d2016-08-03 23:06:03 +000039 CheckFactories.registerCheck<InefficientStringConcatenationCheck>(
40 "performance-inefficient-string-concatenation");
Haojian Wuc5cc0332017-04-18 07:46:39 +000041 CheckFactories.registerCheck<InefficientVectorOperationCheck>(
42 "performance-inefficient-vector-operation");
Alexander Kornienko6e39e682017-11-27 13:06:28 +000043 CheckFactories.registerCheck<MoveConstructorInitCheck>(
44 "performance-move-constructor-init");
Justin Lebarecb10f42016-12-14 03:15:01 +000045 CheckFactories.registerCheck<TypePromotionInMathFnCheck>(
46 "performance-type-promotion-in-math-fn");
Alexander Kornienkob959f4c2015-12-30 10:24:40 +000047 CheckFactories.registerCheck<UnnecessaryCopyInitialization>(
48 "performance-unnecessary-copy-initialization");
Felix Berger3c8edde2016-03-29 02:42:38 +000049 CheckFactories.registerCheck<UnnecessaryValueParamCheck>(
50 "performance-unnecessary-value-param");
Alexander Kornienkob959f4c2015-12-30 10:24:40 +000051 }
52};
53
54// Register the PerformanceModule using this statically initialized variable.
55static ClangTidyModuleRegistry::Add<PerformanceModule>
56 X("performance-module", "Adds performance checks.");
57
58} // namespace performance
59
60// This anchor is used to force the linker to link in the generated object file
61// and thus register the PerformanceModule.
62volatile int PerformanceModuleAnchorSource = 0;
63
64} // namespace tidy
65} // namespace clang