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