clang-tools  14.0.0git
UseAnyOfAllOfCheck.h
Go to the documentation of this file.
1 //===--- UseAnyOfAllOfCheck.h - clang-tidy-----------------------*- C++ -*-===//
2 //
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
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_READABILITY_USEALGORITHMCHECK_H
10 #define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_READABILITY_USEALGORITHMCHECK_H
11 
12 #include "../ClangTidyCheck.h"
13 #include "../utils/IncludeInserter.h"
14 
15 namespace clang {
16 namespace tidy {
17 namespace readability {
18 
19 /// Finds ranged-based for loops that can be replaced by a call to std::any_of
20 /// or std::all_of.
21 ///
22 /// For the user-facing documentation see:
23 /// http://clang.llvm.org/extra/clang-tidy/checks/readability-use-anyofallof.html
25 public:
27 
28  bool isLanguageVersionSupported(const LangOptions &LangOpts) const override {
29  return LangOpts.CPlusPlus11;
30  }
31 
32  void registerMatchers(ast_matchers::MatchFinder *Finder) override;
33  void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
34 };
35 
36 } // namespace readability
37 } // namespace tidy
38 } // namespace clang
39 
40 #endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_READABILITY_USEALGORITHMCHECK_H
clang::tidy::ClangTidyCheck::ClangTidyCheck
ClangTidyCheck(StringRef CheckName, ClangTidyContext *Context)
Initializes the check with CheckName and Context.
Definition: ClangTidyCheck.cpp:18
clang::tidy::readability::UseAnyOfAllOfCheck::isLanguageVersionSupported
bool isLanguageVersionSupported(const LangOptions &LangOpts) const override
Override this to disable registering matchers and PP callbacks if an invalid language version is bein...
Definition: UseAnyOfAllOfCheck.h:28
clang::tidy::ClangTidyCheck
Base class for all clang-tidy checks.
Definition: ClangTidyCheck.h:54
clang::tidy::readability::UseAnyOfAllOfCheck::check
void check(const ast_matchers::MatchFinder::MatchResult &Result) override
ClangTidyChecks that register ASTMatchers should do the actual work in here.
Definition: UseAnyOfAllOfCheck.cpp:89
clang::tidy::readability::UseAnyOfAllOfCheck
Finds ranged-based for loops that can be replaced by a call to std::any_of or std::all_of.
Definition: UseAnyOfAllOfCheck.h:24
clang::tidy::readability::UseAnyOfAllOfCheck::registerMatchers
void registerMatchers(ast_matchers::MatchFinder *Finder) override
Override this to register AST matchers with Finder.
Definition: UseAnyOfAllOfCheck.cpp:43
clang
===– Representation.cpp - ClangDoc Representation --------—*- C++ -*-===//
Definition: ApplyReplacements.h:27