blob: 984a9fb2ba1c65ce771d5ec649a3b1fc1232e3da [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"
13
Samuel Benzaquen51e15232016-02-12 19:28:14 +000014#include "FasterStringFindCheck.h"
Alexander Kornienko5aebfe22016-01-29 15:54:26 +000015#include "ForRangeCopyCheck.h"
Alexander Kornienko40d307d2016-01-29 15:21:32 +000016#include "ImplicitCastInLoopCheck.h"
Alexander Kornienkob959f4c2015-12-30 10:24:40 +000017#include "UnnecessaryCopyInitialization.h"
Felix Berger3c8edde2016-03-29 02:42:38 +000018#include "UnnecessaryValueParamCheck.h"
Alexander Kornienkob959f4c2015-12-30 10:24:40 +000019
20namespace clang {
21namespace tidy {
22namespace performance {
23
24class PerformanceModule : public ClangTidyModule {
25public:
26 void addCheckFactories(ClangTidyCheckFactories &CheckFactories) override {
Samuel Benzaquen51e15232016-02-12 19:28:14 +000027 CheckFactories.registerCheck<FasterStringFindCheck>(
28 "performance-faster-string-find");
Alexander Kornienko5aebfe22016-01-29 15:54:26 +000029 CheckFactories.registerCheck<ForRangeCopyCheck>(
30 "performance-for-range-copy");
Alexander Kornienko40d307d2016-01-29 15:21:32 +000031 CheckFactories.registerCheck<ImplicitCastInLoopCheck>(
32 "performance-implicit-cast-in-loop");
Alexander Kornienkob959f4c2015-12-30 10:24:40 +000033 CheckFactories.registerCheck<UnnecessaryCopyInitialization>(
34 "performance-unnecessary-copy-initialization");
Felix Berger3c8edde2016-03-29 02:42:38 +000035 CheckFactories.registerCheck<UnnecessaryValueParamCheck>(
36 "performance-unnecessary-value-param");
Alexander Kornienkob959f4c2015-12-30 10:24:40 +000037 }
38};
39
40// Register the PerformanceModule using this statically initialized variable.
41static ClangTidyModuleRegistry::Add<PerformanceModule>
42 X("performance-module", "Adds performance checks.");
43
44} // namespace performance
45
46// This anchor is used to force the linker to link in the generated object file
47// and thus register the PerformanceModule.
48volatile int PerformanceModuleAnchorSource = 0;
49
50} // namespace tidy
51} // namespace clang