blob: b8a6d49e23472a365d83663d64bd32c6aca2ebf0 [file] [log] [blame]
Gabor Horvath3880bee2015-02-07 19:54:19 +00001//===--- InefficientAlgorithmCheck.h - clang-tidy----------------*- C++ -*-===//
2//
Chandler Carruth2946cd72019-01-19 08:50:56 +00003// 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 Horvath3880bee2015-02-07 19:54:19 +00006//
7//===----------------------------------------------------------------------===//
8
Alexander Kornienko6e39e682017-11-27 13:06:28 +00009#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_PERFORMANCE_INEFFICIENTALGORITHMCHECK_H
10#define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_PERFORMANCE_INEFFICIENTALGORITHMCHECK_H
Gabor Horvath3880bee2015-02-07 19:54:19 +000011
Alexander Kornienko478fc5c2019-03-25 12:38:26 +000012#include "../ClangTidyCheck.h"
Gabor Horvath3880bee2015-02-07 19:54:19 +000013
14namespace clang {
15namespace tidy {
Alexander Kornienko6e39e682017-11-27 13:06:28 +000016namespace performance {
Gabor Horvath3880bee2015-02-07 19:54:19 +000017
Alexander Kornienkof8ed0a82015-08-27 18:01:58 +000018/// Warns on inefficient use of STL algorithms on associative containers.
Gabor Horvath3880bee2015-02-07 19:54:19 +000019///
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.
23class InefficientAlgorithmCheck : public ClangTidyCheck {
24public:
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 Kornienko6e39e682017-11-27 13:06:28 +000031} // namespace performance
Gabor Horvath3880bee2015-02-07 19:54:19 +000032} // namespace tidy
33} // namespace clang
34
Alexander Kornienko6e39e682017-11-27 13:06:28 +000035#endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_PERFORMANCE_INEFFICIENTALGORITHMCHECK_H