Alexander Kornienko | b959f4c | 2015-12-30 10:24:40 +0000 | [diff] [blame] | 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" |
Samuel Benzaquen | 51e1523 | 2016-02-12 19:28:14 +0000 | [diff] [blame] | 13 | #include "FasterStringFindCheck.h" |
Alexander Kornienko | 5aebfe2 | 2016-01-29 15:54:26 +0000 | [diff] [blame] | 14 | #include "ForRangeCopyCheck.h" |
Alexander Kornienko | 40d307d | 2016-01-29 15:21:32 +0000 | [diff] [blame] | 15 | #include "ImplicitCastInLoopCheck.h" |
Justin Lebar | ecb10f4 | 2016-12-14 03:15:01 +0000 | [diff] [blame^] | 16 | #include "InefficientStringConcatenationCheck.h" |
| 17 | #include "TypePromotionInMathFnCheck.h" |
Alexander Kornienko | b959f4c | 2015-12-30 10:24:40 +0000 | [diff] [blame] | 18 | #include "UnnecessaryCopyInitialization.h" |
Felix Berger | 3c8edde | 2016-03-29 02:42:38 +0000 | [diff] [blame] | 19 | #include "UnnecessaryValueParamCheck.h" |
Alexander Kornienko | b959f4c | 2015-12-30 10:24:40 +0000 | [diff] [blame] | 20 | |
| 21 | namespace clang { |
| 22 | namespace tidy { |
| 23 | namespace performance { |
| 24 | |
| 25 | class PerformanceModule : public ClangTidyModule { |
| 26 | public: |
| 27 | void addCheckFactories(ClangTidyCheckFactories &CheckFactories) override { |
Samuel Benzaquen | 51e1523 | 2016-02-12 19:28:14 +0000 | [diff] [blame] | 28 | CheckFactories.registerCheck<FasterStringFindCheck>( |
| 29 | "performance-faster-string-find"); |
Alexander Kornienko | 5aebfe2 | 2016-01-29 15:54:26 +0000 | [diff] [blame] | 30 | CheckFactories.registerCheck<ForRangeCopyCheck>( |
| 31 | "performance-for-range-copy"); |
Alexander Kornienko | 40d307d | 2016-01-29 15:21:32 +0000 | [diff] [blame] | 32 | CheckFactories.registerCheck<ImplicitCastInLoopCheck>( |
| 33 | "performance-implicit-cast-in-loop"); |
Alexander Kornienko | dcbf57d | 2016-08-03 23:06:03 +0000 | [diff] [blame] | 34 | CheckFactories.registerCheck<InefficientStringConcatenationCheck>( |
| 35 | "performance-inefficient-string-concatenation"); |
Justin Lebar | ecb10f4 | 2016-12-14 03:15:01 +0000 | [diff] [blame^] | 36 | CheckFactories.registerCheck<TypePromotionInMathFnCheck>( |
| 37 | "performance-type-promotion-in-math-fn"); |
Alexander Kornienko | b959f4c | 2015-12-30 10:24:40 +0000 | [diff] [blame] | 38 | CheckFactories.registerCheck<UnnecessaryCopyInitialization>( |
| 39 | "performance-unnecessary-copy-initialization"); |
Felix Berger | 3c8edde | 2016-03-29 02:42:38 +0000 | [diff] [blame] | 40 | CheckFactories.registerCheck<UnnecessaryValueParamCheck>( |
| 41 | "performance-unnecessary-value-param"); |
Alexander Kornienko | b959f4c | 2015-12-30 10:24:40 +0000 | [diff] [blame] | 42 | } |
| 43 | }; |
| 44 | |
| 45 | // Register the PerformanceModule using this statically initialized variable. |
| 46 | static ClangTidyModuleRegistry::Add<PerformanceModule> |
| 47 | X("performance-module", "Adds performance checks."); |
| 48 | |
| 49 | } // namespace performance |
| 50 | |
| 51 | // This anchor is used to force the linker to link in the generated object file |
| 52 | // and thus register the PerformanceModule. |
| 53 | volatile int PerformanceModuleAnchorSource = 0; |
| 54 | |
| 55 | } // namespace tidy |
| 56 | } // namespace clang |