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 "ForRangeCopyCheck.h" 15 #include "ImplicitCastInLoopCheck.h" 16 #include "UnnecessaryCopyInitialization.h" 17 18 namespace clang { 19 namespace tidy { 20 namespace performance { 21 22 class PerformanceModule : public ClangTidyModule { 23 public: 24 void addCheckFactories(ClangTidyCheckFactories &CheckFactories) override { 25 CheckFactories.registerCheck<ForRangeCopyCheck>( 26 "performance-for-range-copy"); 27 CheckFactories.registerCheck<ImplicitCastInLoopCheck>( 28 "performance-implicit-cast-in-loop"); 29 CheckFactories.registerCheck<UnnecessaryCopyInitialization>( 30 "performance-unnecessary-copy-initialization"); 31 } 32 }; 33 34 // Register the PerformanceModule using this statically initialized variable. 35 static ClangTidyModuleRegistry::Add<PerformanceModule> 36 X("performance-module", "Adds performance checks."); 37 38 } // namespace performance 39 40 // This anchor is used to force the linker to link in the generated object file 41 // and thus register the PerformanceModule. 42 volatile int PerformanceModuleAnchorSource = 0; 43 44 } // namespace tidy 45 } // namespace clang 46