clang-tools 22.0.0git
clang::tidy::modernize::UseRangesCheck Class Reference

Detects calls to standard library iterator algorithms that could be replaced with a ranges version instead. More...

#include <UseRangesCheck.h>

Inheritance diagram for clang::tidy::modernize::UseRangesCheck:
[legend]

Public Member Functions

 UseRangesCheck (StringRef CheckName, ClangTidyContext *Context)
void storeOptions (ClangTidyOptions::OptionMap &Opts) override
ReplacerMap getReplacerMap () const override
 Gets a map of function to replace and methods to create the replacements.
ArrayRef< std::pair< StringRef, StringRef > > getFreeBeginEndMethods () const override
 Gets the fully qualified names of begin and end functions.
std::optional< ReverseIteratorDescriptorgetReverseDescriptor () const override
bool isLanguageVersionSupported (const LangOptions &LangOpts) const override
Public Member Functions inherited from clang::tidy::utils::UseRangesCheck
 UseRangesCheck (StringRef Name, ClangTidyContext *Context)
virtual DiagnosticBuilder createDiag (const CallExpr &Call)
 Create a diagnostic for the CallExpr Override this to support custom diagnostic messages.
void registerPPCallbacks (const SourceManager &SM, Preprocessor *PP, Preprocessor *ModuleExpanderPP) final
void registerMatchers (ast_matchers::MatchFinder *Finder) final
void check (const ast_matchers::MatchFinder::MatchResult &Result) final
bool isLanguageVersionSupported (const LangOptions &LangOpts) const override
void storeOptions (ClangTidyOptions::OptionMap &Opts) override
std::optional< TraversalKind > getCheckTraversalKind () const override

Additional Inherited Members

Public Types inherited from clang::tidy::utils::UseRangesCheck
using Signature = SmallVector<Indexes, 2>
using ReplacerMap = llvm::StringMap<llvm::IntrusiveRefCntPtr<Replacer>>

Detailed Description

Detects calls to standard library iterator algorithms that could be replaced with a ranges version instead.

For the user-facing documentation see: https://clang.llvm.org/extra/clang-tidy/checks/modernize/use-ranges.html

Definition at line 21 of file modernize/UseRangesCheck.h.

Constructor & Destructor Documentation

◆ UseRangesCheck()

clang::tidy::modernize::UseRangesCheck::UseRangesCheck ( StringRef CheckName,
ClangTidyContext * Context )

Definition at line 178 of file modernize/UseRangesCheck.cpp.

References UseRangesCheck().

Referenced by UseRangesCheck().

Member Function Documentation

◆ getFreeBeginEndMethods()

ArrayRef< std::pair< StringRef, StringRef > > clang::tidy::modernize::UseRangesCheck::getFreeBeginEndMethods ( ) const
overridevirtual

Gets the fully qualified names of begin and end functions.

The functions must take the container as their one and only argument ::std::begin and ::std::end are a common example

Reimplemented from clang::tidy::utils::UseRangesCheck.

Definition at line 192 of file modernize/UseRangesCheck.cpp.

◆ getReplacerMap()

utils::UseRangesCheck::ReplacerMap clang::tidy::modernize::UseRangesCheck::getReplacerMap ( ) const
overridevirtual

Gets a map of function to replace and methods to create the replacements.

Implements clang::tidy::utils::UseRangesCheck.

Definition at line 137 of file modernize/UseRangesCheck.cpp.

References clang::tidy::modernize::SinglePivotRangeNames, clang::tidy::modernize::SingleRangeNames, and clang::tidy::modernize::TwoRangeNames.

◆ getReverseDescriptor()

std::optional< UseRangesCheck::ReverseIteratorDescriptor > clang::tidy::modernize::UseRangesCheck::getReverseDescriptor ( ) const
overridevirtual

Reimplemented from clang::tidy::utils::UseRangesCheck.

Definition at line 198 of file modernize/UseRangesCheck.cpp.

◆ isLanguageVersionSupported()

bool clang::tidy::modernize::UseRangesCheck::isLanguageVersionSupported ( const LangOptions & LangOpts) const
override

Definition at line 187 of file modernize/UseRangesCheck.cpp.

◆ storeOptions()

void clang::tidy::modernize::UseRangesCheck::storeOptions ( ClangTidyOptions::OptionMap & Opts)
override

The documentation for this class was generated from the following files: