blob: bacc5ccb0706fb1881f4292969b6090e685bb860 [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"
18
19namespace clang {
20namespace tidy {
21namespace performance {
22
23class PerformanceModule : public ClangTidyModule {
24public:
25 void addCheckFactories(ClangTidyCheckFactories &CheckFactories) override {
Samuel Benzaquen51e15232016-02-12 19:28:14 +000026 CheckFactories.registerCheck<FasterStringFindCheck>(
27 "performance-faster-string-find");
Alexander Kornienko5aebfe22016-01-29 15:54:26 +000028 CheckFactories.registerCheck<ForRangeCopyCheck>(
29 "performance-for-range-copy");
Alexander Kornienko40d307d2016-01-29 15:21:32 +000030 CheckFactories.registerCheck<ImplicitCastInLoopCheck>(
31 "performance-implicit-cast-in-loop");
Alexander Kornienkob959f4c2015-12-30 10:24:40 +000032 CheckFactories.registerCheck<UnnecessaryCopyInitialization>(
33 "performance-unnecessary-copy-initialization");
34 }
35};
36
37// Register the PerformanceModule using this statically initialized variable.
38static ClangTidyModuleRegistry::Add<PerformanceModule>
39 X("performance-module", "Adds performance checks.");
40
41} // namespace performance
42
43// This anchor is used to force the linker to link in the generated object file
44// and thus register the PerformanceModule.
45volatile int PerformanceModuleAnchorSource = 0;
46
47} // namespace tidy
48} // namespace clang