blob: a722ffb14aa100e3a3e9b3a09c34f47039bc60c0 [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"
Alexander Kornienkodcbf57d2016-08-03 23:06:03 +000013#include "InefficientStringConcatenationCheck.h"
Alexander Kornienkob959f4c2015-12-30 10:24:40 +000014
Samuel Benzaquen51e15232016-02-12 19:28:14 +000015#include "FasterStringFindCheck.h"
Alexander Kornienko5aebfe22016-01-29 15:54:26 +000016#include "ForRangeCopyCheck.h"
Alexander Kornienko40d307d2016-01-29 15:21:32 +000017#include "ImplicitCastInLoopCheck.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");
Alexander Kornienkob959f4c2015-12-30 10:24:40 +000036 CheckFactories.registerCheck<UnnecessaryCopyInitialization>(
37 "performance-unnecessary-copy-initialization");
Felix Berger3c8edde2016-03-29 02:42:38 +000038 CheckFactories.registerCheck<UnnecessaryValueParamCheck>(
39 "performance-unnecessary-value-param");
Alexander Kornienkob959f4c2015-12-30 10:24:40 +000040 }
41};
42
43// Register the PerformanceModule using this statically initialized variable.
44static ClangTidyModuleRegistry::Add<PerformanceModule>
45 X("performance-module", "Adds performance checks.");
46
47} // namespace performance
48
49// This anchor is used to force the linker to link in the generated object file
50// and thus register the PerformanceModule.
51volatile int PerformanceModuleAnchorSource = 0;
52
53} // namespace tidy
54} // namespace clang