clang-tools 20.0.0git
modernize/UseRangesCheck.h
Go to the documentation of this file.
1//===--- UseRangesCheck.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_MODERNIZE_USERANGESCHECK_H
10#define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MODERNIZE_USERANGESCHECK_H
11
12#include "../utils/UseRangesCheck.h"
13
14namespace clang::tidy::modernize {
15
16/// Detects calls to standard library iterator algorithms that could be
17/// replaced with a ranges version instead
18///
19/// For the user-facing documentation see:
20/// http://clang.llvm.org/extra/clang-tidy/checks/modernize/use-ranges.html
22public:
23 UseRangesCheck(StringRef CheckName, ClangTidyContext *Context);
24
26
27 ReplacerMap getReplacerMap() const override;
28
29 ArrayRef<std::pair<StringRef, StringRef>>
30 getFreeBeginEndMethods() const override;
31
32 std::optional<ReverseIteratorDescriptor>
33 getReverseDescriptor() const override;
34
35 bool isLanguageVersionSupported(const LangOptions &LangOpts) const override;
36
37private:
38 bool UseReversePipe;
39};
40
41} // namespace clang::tidy::modernize
42
43#endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MODERNIZE_USERANGESCHECK_H
Every ClangTidyCheck reports errors through a DiagnosticsEngine provided by this context.
Detects calls to standard library iterator algorithms that could be replaced with a ranges version in...
bool isLanguageVersionSupported(const LangOptions &LangOpts) const override
Override this to disable registering matchers and PP callbacks if an invalid language version is bein...
ArrayRef< std::pair< StringRef, StringRef > > getFreeBeginEndMethods() const override
Gets the fully qualified names of begin and end functions.
void storeOptions(ClangTidyOptions::OptionMap &Options) override
Should store all options supported by this check with their current values or default values for opti...
ReplacerMap getReplacerMap() const override
Gets a map of function to replace and methods to create the replacements.
std::optional< ReverseIteratorDescriptor > getReverseDescriptor() const override
Base class for handling converting std iterator algorithms to a range equivalent.
llvm::StringMap< llvm::IntrusiveRefCntPtr< Replacer > > ReplacerMap
llvm::StringMap< ClangTidyValue > OptionMap