clang-tools 22.0.0git
clang::tidy::utils::UseRangesCheck Class Referenceabstract

Base class for handling converting std iterator algorithms to a range equivalent. More...

#include <UseRangesCheck.h>

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

Classes

struct  Indexes
class  Replacer
struct  ReverseIteratorDescriptor

Public Types

using Signature = SmallVector<Indexes, 2>
using ReplacerMap = llvm::StringMap<llvm::IntrusiveRefCntPtr<Replacer>>

Public Member Functions

 UseRangesCheck (StringRef Name, ClangTidyContext *Context)
virtual ReplacerMap getReplacerMap () const =0
 Gets a map of function to replace and methods to create the replacements.
virtual DiagnosticBuilder createDiag (const CallExpr &Call)
 Create a diagnostic for the CallExpr Override this to support custom diagnostic messages.
virtual std::optional< ReverseIteratorDescriptorgetReverseDescriptor () const
virtual ArrayRef< std::pair< StringRef, StringRef > > getFreeBeginEndMethods () const
 Gets the fully qualified names of begin and end functions.
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

Detailed Description

Base class for handling converting std iterator algorithms to a range equivalent.

Definition at line 26 of file utils/UseRangesCheck.h.

Member Typedef Documentation

◆ ReplacerMap

using clang::tidy::utils::UseRangesCheck::ReplacerMap = llvm::StringMap<llvm::IntrusiveRefCntPtr<Replacer>>

Definition at line 62 of file utils/UseRangesCheck.h.

◆ Signature

Definition at line 35 of file utils/UseRangesCheck.h.

Constructor & Destructor Documentation

◆ UseRangesCheck()

clang::tidy::utils::UseRangesCheck::UseRangesCheck ( StringRef Name,
ClangTidyContext * Context )

Definition at line 285 of file utils/UseRangesCheck.cpp.

References clang::tidy::utils::IncludeSorter().

Member Function Documentation

◆ check()

◆ createDiag()

DiagnosticBuilder clang::tidy::utils::UseRangesCheck::createDiag ( const CallExpr & Call)
virtual

Create a diagnostic for the CallExpr Override this to support custom diagnostic messages.

Reimplemented in clang::tidy::boost::UseRangesCheck, and clang::tidy::llvm_check::UseRangesCheck.

Definition at line 305 of file utils/UseRangesCheck.cpp.

Referenced by check().

◆ getCheckTraversalKind()

std::optional< TraversalKind > clang::tidy::utils::UseRangesCheck::getCheckTraversalKind ( ) const
override

Definition at line 319 of file utils/UseRangesCheck.cpp.

◆ getFreeBeginEndMethods()

ArrayRef< std::pair< StringRef, StringRef > > clang::tidy::utils::UseRangesCheck::getFreeBeginEndMethods ( ) const
virtual

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 in clang::tidy::boost::UseRangesCheck, clang::tidy::llvm_check::UseRangesCheck, and clang::tidy::modernize::UseRangesCheck.

Definition at line 315 of file utils/UseRangesCheck.cpp.

Referenced by registerMatchers().

◆ getReplacerMap()

virtual ReplacerMap clang::tidy::utils::UseRangesCheck::getReplacerMap ( ) const
pure virtual

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

Implemented in clang::tidy::boost::UseRangesCheck, clang::tidy::llvm_check::UseRangesCheck, and clang::tidy::modernize::UseRangesCheck.

Referenced by registerMatchers().

◆ getReverseDescriptor()

std::optional< UseRangesCheck::ReverseIteratorDescriptor > clang::tidy::utils::UseRangesCheck::getReverseDescriptor ( ) const
virtual

◆ isLanguageVersionSupported()

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

Definition at line 280 of file utils/UseRangesCheck.cpp.

◆ registerMatchers()

void clang::tidy::utils::UseRangesCheck::registerMatchers ( ast_matchers::MatchFinder * Finder)
final

◆ registerPPCallbacks()

void clang::tidy::utils::UseRangesCheck::registerPPCallbacks ( const SourceManager & SM,
Preprocessor * PP,
Preprocessor * ModuleExpanderPP )
final

Definition at line 291 of file utils/UseRangesCheck.cpp.

◆ storeOptions()

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

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