• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //===--- UseAnyOfAllOfCheck.h - clang-tidy-----------------------*- C++ -*-===//
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 #ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_READABILITY_USEALGORITHMCHECK_H
11 #define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_READABILITY_USEALGORITHMCHECK_H
12 
13 #include "../ClangTidyCheck.h"
14 #include "../utils/IncludeInserter.h"
15 
16 namespace clang {
17 namespace tidy {
18 namespace readability {
19 
20 /// Finds ranged-based for loops that can be replaced by a call to std::any_of
21 /// or std::all_of.
22 ///
23 /// For the user-facing documentation see:
24 /// http://clang.llvm.org/extra/clang-tidy/checks/readability-use-anyofallof.html
25 class UseAnyOfAllOfCheck : public ClangTidyCheck {
26 public:
27   using ClangTidyCheck::ClangTidyCheck;
28 
isLanguageVersionSupported(const LangOptions & LangOpts)29   bool isLanguageVersionSupported(const LangOptions &LangOpts) const override {
30     return LangOpts.CPlusPlus11;
31   }
32 
33   void registerMatchers(ast_matchers::MatchFinder *Finder) override;
34   void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
35 };
36 
37 } // namespace readability
38 } // namespace tidy
39 } // namespace clang
40 
41 #endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_READABILITY_USEALGORITHMCHECK_H
42