clang-tools  3.9.0
PerformanceTidyModule.cpp
Go to the documentation of this file.
1 //===--- 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 
14 #include "FasterStringFindCheck.h"
15 #include "ForRangeCopyCheck.h"
19 
20 namespace clang {
21 namespace tidy {
22 namespace performance {
23 
25 public:
26  void addCheckFactories(ClangTidyCheckFactories &CheckFactories) override {
27  CheckFactories.registerCheck<FasterStringFindCheck>(
28  "performance-faster-string-find");
29  CheckFactories.registerCheck<ForRangeCopyCheck>(
30  "performance-for-range-copy");
31  CheckFactories.registerCheck<ImplicitCastInLoopCheck>(
32  "performance-implicit-cast-in-loop");
34  "performance-unnecessary-copy-initialization");
36  "performance-unnecessary-value-param");
37  }
38 };
39 
40 // Register the PerformanceModule using this statically initialized variable.
41 static 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.
49 
50 } // namespace tidy
51 } // namespace clang
void registerCheck(StringRef CheckName)
Registers the CheckType with the name Name.
A collection of ClangTidyCheckFactory instances.
volatile int PerformanceModuleAnchorSource
Optimize calls to std::string::find() and friends when the needle passed is a single character string...
A clang-tidy module groups a number of ClangTidyChecks and gives them a prefixed name.
void addCheckFactories(ClangTidyCheckFactories &CheckFactories) override
Implement this function in order to register all CheckFactories belonging to this module...
A check that flags value parameters of expensive to copy types that can safely be converted to const ...
A check that detects copied loop variables and suggests using const references.
static ClangTidyModuleRegistry::Add< PerformanceModule > X("performance-module","Adds performance checks.")