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