blob: 90255c5e2b64357e1738c00fa5c28ae2a21dbb36 [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 Kornienko40d307d2016-01-29 15:21:32 +000015#include "ImplicitCastInLoopCheck.h"
Justin Lebarecb10f42016-12-14 03:15:01 +000016#include "InefficientStringConcatenationCheck.h"
17#include "TypePromotionInMathFnCheck.h"
Alexander Kornienkob959f4c2015-12-30 10:24:40 +000018#include "UnnecessaryCopyInitialization.h"
Felix Berger3c8edde2016-03-29 02:42:38 +000019#include "UnnecessaryValueParamCheck.h"
Alexander Kornienkob959f4c2015-12-30 10:24:40 +000020
21namespace clang {
22namespace tidy {
23namespace performance {
24
25class PerformanceModule : public ClangTidyModule {
26public:
27 void addCheckFactories(ClangTidyCheckFactories &CheckFactories) override {
Samuel Benzaquen51e15232016-02-12 19:28:14 +000028 CheckFactories.registerCheck<FasterStringFindCheck>(
29 "performance-faster-string-find");
Alexander Kornienko5aebfe22016-01-29 15:54:26 +000030 CheckFactories.registerCheck<ForRangeCopyCheck>(
31 "performance-for-range-copy");
Alexander Kornienko40d307d2016-01-29 15:21:32 +000032 CheckFactories.registerCheck<ImplicitCastInLoopCheck>(
33 "performance-implicit-cast-in-loop");
Alexander Kornienkodcbf57d2016-08-03 23:06:03 +000034 CheckFactories.registerCheck<InefficientStringConcatenationCheck>(
35 "performance-inefficient-string-concatenation");
Justin Lebarecb10f42016-12-14 03:15:01 +000036 CheckFactories.registerCheck<TypePromotionInMathFnCheck>(
37 "performance-type-promotion-in-math-fn");
Alexander Kornienkob959f4c2015-12-30 10:24:40 +000038 CheckFactories.registerCheck<UnnecessaryCopyInitialization>(
39 "performance-unnecessary-copy-initialization");
Felix Berger3c8edde2016-03-29 02:42:38 +000040 CheckFactories.registerCheck<UnnecessaryValueParamCheck>(
41 "performance-unnecessary-value-param");
Alexander Kornienkob959f4c2015-12-30 10:24:40 +000042 }
43};
44
45// Register the PerformanceModule using this statically initialized variable.
46static ClangTidyModuleRegistry::Add<PerformanceModule>
47 X("performance-module", "Adds performance checks.");
48
49} // namespace performance
50
51// This anchor is used to force the linker to link in the generated object file
52// and thus register the PerformanceModule.
53volatile int PerformanceModuleAnchorSource = 0;
54
55} // namespace tidy
56} // namespace clang