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" 16 #include "ImplicitCastInLoopCheck.h" 17 #include "UnnecessaryCopyInitialization.h" 18 19 namespace clang { 20 namespace tidy { 21 namespace performance { 22 23 class PerformanceModule : public ClangTidyModule { 24 public: 25 void addCheckFactories(ClangTidyCheckFactories &CheckFactories) override { 26 CheckFactories.registerCheck<FasterStringFindCheck>( 27 "performance-faster-string-find"); 28 CheckFactories.registerCheck<ForRangeCopyCheck>( 29 "performance-for-range-copy"); 30 CheckFactories.registerCheck<ImplicitCastInLoopCheck>( 31 "performance-implicit-cast-in-loop"); 32 CheckFactories.registerCheck<UnnecessaryCopyInitialization>( 33 "performance-unnecessary-copy-initialization"); 34 } 35 }; 36 37 // Register the PerformanceModule using this statically initialized variable. 38 static 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. 45 volatile int PerformanceModuleAnchorSource = 0; 46 47 } // namespace tidy 48 } // namespace clang 49