Gabor Horvath | 3880bee | 2015-02-07 19:54:19 +0000 | [diff] [blame] | 1 | //===--- InefficientAlgorithmCheck.h - clang-tidy----------------*- C++ -*-===// |
| 2 | // |
Chandler Carruth | 2946cd7 | 2019-01-19 08:50:56 +0000 | [diff] [blame] | 3 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
| 4 | // See https://llvm.org/LICENSE.txt for license information. |
| 5 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
Gabor Horvath | 3880bee | 2015-02-07 19:54:19 +0000 | [diff] [blame] | 6 | // |
| 7 | //===----------------------------------------------------------------------===// |
| 8 | |
Alexander Kornienko | 6e39e68 | 2017-11-27 13:06:28 +0000 | [diff] [blame] | 9 | #ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_PERFORMANCE_INEFFICIENTALGORITHMCHECK_H |
| 10 | #define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_PERFORMANCE_INEFFICIENTALGORITHMCHECK_H |
Gabor Horvath | 3880bee | 2015-02-07 19:54:19 +0000 | [diff] [blame] | 11 | |
Alexander Kornienko | 478fc5c | 2019-03-25 12:38:26 +0000 | [diff] [blame] | 12 | #include "../ClangTidyCheck.h" |
Gabor Horvath | 3880bee | 2015-02-07 19:54:19 +0000 | [diff] [blame] | 13 | |
| 14 | namespace clang { |
| 15 | namespace tidy { |
Alexander Kornienko | 6e39e68 | 2017-11-27 13:06:28 +0000 | [diff] [blame] | 16 | namespace performance { |
Gabor Horvath | 3880bee | 2015-02-07 19:54:19 +0000 | [diff] [blame] | 17 | |
Alexander Kornienko | f8ed0a8 | 2015-08-27 18:01:58 +0000 | [diff] [blame] | 18 | /// Warns on inefficient use of STL algorithms on associative containers. |
Gabor Horvath | 3880bee | 2015-02-07 19:54:19 +0000 | [diff] [blame] | 19 | /// |
| 20 | /// Associative containers implements some of the algorithms as methods which |
| 21 | /// should be preferred to the algorithms in the algorithm header. The methods |
| 22 | /// can take advanatage of the order of the elements. |
| 23 | class InefficientAlgorithmCheck : public ClangTidyCheck { |
| 24 | public: |
| 25 | InefficientAlgorithmCheck(StringRef Name, ClangTidyContext *Context) |
| 26 | : ClangTidyCheck(Name, Context) {} |
| 27 | void registerMatchers(ast_matchers::MatchFinder *Finder) override; |
| 28 | void check(const ast_matchers::MatchFinder::MatchResult &Result) override; |
| 29 | }; |
| 30 | |
Alexander Kornienko | 6e39e68 | 2017-11-27 13:06:28 +0000 | [diff] [blame] | 31 | } // namespace performance |
Gabor Horvath | 3880bee | 2015-02-07 19:54:19 +0000 | [diff] [blame] | 32 | } // namespace tidy |
| 33 | } // namespace clang |
| 34 | |
Alexander Kornienko | 6e39e68 | 2017-11-27 13:06:28 +0000 | [diff] [blame] | 35 | #endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_PERFORMANCE_INEFFICIENTALGORITHMCHECK_H |