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 | f1a6552 | 2017-08-08 14:53:52 +0000 | [diff] [blame] | 15 | #include "ImplicitConversionInLoopCheck.h" |
Alexander Kornienko | 6e39e68 | 2017-11-27 13:06:28 +0000 | [diff] [blame] | 16 | #include "InefficientAlgorithmCheck.h" |
Justin Lebar | ecb10f4 | 2016-12-14 03:15:01 +0000 | [diff] [blame] | 17 | #include "InefficientStringConcatenationCheck.h" |
Haojian Wu | c5cc033 | 2017-04-18 07:46:39 +0000 | [diff] [blame] | 18 | #include "InefficientVectorOperationCheck.h" |
Alexander Kornienko | 1bfcba8 | 2017-11-28 16:41:03 +0000 | [diff] [blame^] | 19 | #include "MoveConstArgCheck.h" |
Alexander Kornienko | 6e39e68 | 2017-11-27 13:06:28 +0000 | [diff] [blame] | 20 | #include "MoveConstructorInitCheck.h" |
Alexander Kornienko | 1bfcba8 | 2017-11-28 16:41:03 +0000 | [diff] [blame^] | 21 | #include "NoexceptMoveConstructorCheck.h" |
Justin Lebar | ecb10f4 | 2016-12-14 03:15:01 +0000 | [diff] [blame] | 22 | #include "TypePromotionInMathFnCheck.h" |
Alexander Kornienko | b959f4c | 2015-12-30 10:24:40 +0000 | [diff] [blame] | 23 | #include "UnnecessaryCopyInitialization.h" |
Felix Berger | 3c8edde | 2016-03-29 02:42:38 +0000 | [diff] [blame] | 24 | #include "UnnecessaryValueParamCheck.h" |
Alexander Kornienko | b959f4c | 2015-12-30 10:24:40 +0000 | [diff] [blame] | 25 | |
| 26 | namespace clang { |
| 27 | namespace tidy { |
| 28 | namespace performance { |
| 29 | |
| 30 | class PerformanceModule : public ClangTidyModule { |
| 31 | public: |
| 32 | void addCheckFactories(ClangTidyCheckFactories &CheckFactories) override { |
Samuel Benzaquen | 51e1523 | 2016-02-12 19:28:14 +0000 | [diff] [blame] | 33 | CheckFactories.registerCheck<FasterStringFindCheck>( |
| 34 | "performance-faster-string-find"); |
Alexander Kornienko | 5aebfe2 | 2016-01-29 15:54:26 +0000 | [diff] [blame] | 35 | CheckFactories.registerCheck<ForRangeCopyCheck>( |
| 36 | "performance-for-range-copy"); |
Alexander Kornienko | f1a6552 | 2017-08-08 14:53:52 +0000 | [diff] [blame] | 37 | CheckFactories.registerCheck<ImplicitConversionInLoopCheck>( |
| 38 | "performance-implicit-conversion-in-loop"); |
Alexander Kornienko | 6e39e68 | 2017-11-27 13:06:28 +0000 | [diff] [blame] | 39 | CheckFactories.registerCheck<InefficientAlgorithmCheck>( |
| 40 | "performance-inefficient-algorithm"); |
Alexander Kornienko | dcbf57d | 2016-08-03 23:06:03 +0000 | [diff] [blame] | 41 | CheckFactories.registerCheck<InefficientStringConcatenationCheck>( |
| 42 | "performance-inefficient-string-concatenation"); |
Haojian Wu | c5cc033 | 2017-04-18 07:46:39 +0000 | [diff] [blame] | 43 | CheckFactories.registerCheck<InefficientVectorOperationCheck>( |
| 44 | "performance-inefficient-vector-operation"); |
Alexander Kornienko | 1bfcba8 | 2017-11-28 16:41:03 +0000 | [diff] [blame^] | 45 | CheckFactories.registerCheck<MoveConstArgCheck>( |
| 46 | "performance-move-const-arg"); |
Alexander Kornienko | 6e39e68 | 2017-11-27 13:06:28 +0000 | [diff] [blame] | 47 | CheckFactories.registerCheck<MoveConstructorInitCheck>( |
| 48 | "performance-move-constructor-init"); |
Alexander Kornienko | 1bfcba8 | 2017-11-28 16:41:03 +0000 | [diff] [blame^] | 49 | CheckFactories.registerCheck<NoexceptMoveConstructorCheck>( |
| 50 | "performance-noexcept-move-constructor"); |
Justin Lebar | ecb10f4 | 2016-12-14 03:15:01 +0000 | [diff] [blame] | 51 | CheckFactories.registerCheck<TypePromotionInMathFnCheck>( |
| 52 | "performance-type-promotion-in-math-fn"); |
Alexander Kornienko | b959f4c | 2015-12-30 10:24:40 +0000 | [diff] [blame] | 53 | CheckFactories.registerCheck<UnnecessaryCopyInitialization>( |
| 54 | "performance-unnecessary-copy-initialization"); |
Felix Berger | 3c8edde | 2016-03-29 02:42:38 +0000 | [diff] [blame] | 55 | CheckFactories.registerCheck<UnnecessaryValueParamCheck>( |
| 56 | "performance-unnecessary-value-param"); |
Alexander Kornienko | b959f4c | 2015-12-30 10:24:40 +0000 | [diff] [blame] | 57 | } |
| 58 | }; |
| 59 | |
| 60 | // Register the PerformanceModule using this statically initialized variable. |
| 61 | static ClangTidyModuleRegistry::Add<PerformanceModule> |
| 62 | X("performance-module", "Adds performance checks."); |
| 63 | |
| 64 | } // namespace performance |
| 65 | |
| 66 | // This anchor is used to force the linker to link in the generated object file |
| 67 | // and thus register the PerformanceModule. |
| 68 | volatile int PerformanceModuleAnchorSource = 0; |
| 69 | |
| 70 | } // namespace tidy |
| 71 | } // namespace clang |