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 #include "InefficientStringConcatenationCheck.h" 14 15 #include "FasterStringFindCheck.h" 16 #include "ForRangeCopyCheck.h" 17 #include "ImplicitCastInLoopCheck.h" 18 #include "UnnecessaryCopyInitialization.h" 19 #include "UnnecessaryValueParamCheck.h" 20 21 namespace clang { 22 namespace tidy { 23 namespace performance { 24 25 class PerformanceModule : public ClangTidyModule { 26 public: 27 void addCheckFactories(ClangTidyCheckFactories &CheckFactories) override { 28 CheckFactories.registerCheck<FasterStringFindCheck>( 29 "performance-faster-string-find"); 30 CheckFactories.registerCheck<ForRangeCopyCheck>( 31 "performance-for-range-copy"); 32 CheckFactories.registerCheck<ImplicitCastInLoopCheck>( 33 "performance-implicit-cast-in-loop"); 34 CheckFactories.registerCheck<InefficientStringConcatenationCheck>( 35 "performance-inefficient-string-concatenation"); 36 CheckFactories.registerCheck<UnnecessaryCopyInitialization>( 37 "performance-unnecessary-copy-initialization"); 38 CheckFactories.registerCheck<UnnecessaryValueParamCheck>( 39 "performance-unnecessary-value-param"); 40 } 41 }; 42 43 // Register the PerformanceModule using this statically initialized variable. 44 static 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. 51 volatile int PerformanceModuleAnchorSource = 0; 52 53 } // namespace tidy 54 } // namespace clang 55