clang-tools 20.0.0git
Public Member Functions | List of all members
clang::tidy::boost::UseRangesCheck Class Reference

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

#include <UseRangesCheck.h>

Inheritance diagram for clang::tidy::boost::UseRangesCheck:
Inheritance graph
[legend]

Public Member Functions

 UseRangesCheck (StringRef Name, ClangTidyContext *Context)
 
void storeOptions (ClangTidyOptions::OptionMap &Options) override
 Should store all options supported by this check with their current values or default values for options that haven't been overridden.
 
ReplacerMap getReplacerMap () const override
 Gets a map of function to replace and methods to create the replacements.
 
DiagnosticBuilder createDiag (const CallExpr &Call) override
 Create a diagnostic for the CallExpr Override this to support custom diagnostic messages.
 
ArrayRef< std::pair< StringRef, StringRef > > getFreeBeginEndMethods () const override
 Gets the fully qualified names of begin and end functions.
 
std::optional< ReverseIteratorDescriptorgetReverseDescriptor () const override
 
- Public Member Functions inherited from clang::tidy::utils::UseRangesCheck
 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
 Override this to register PPCallbacks in the preprocessor.
 
void registerMatchers (ast_matchers::MatchFinder *Finder) final
 Override this to register AST matchers with Finder.
 
void check (const ast_matchers::MatchFinder::MatchResult &Result) final
 ClangTidyChecks that register ASTMatchers should do the actual work in here.
 
bool isLanguageVersionSupported (const LangOptions &LangOpts) const override
 Override this to disable registering matchers and PP callbacks if an invalid language version is being used.
 
void storeOptions (ClangTidyOptions::OptionMap &Options) override
 Should store all options supported by this check with their current values or default values for options that haven't been overridden.
 
std::optional< TraversalKind > getCheckTraversalKind () const override
 
- Public Member Functions inherited from clang::tidy::ClangTidyCheck
 ClangTidyCheck (StringRef CheckName, ClangTidyContext *Context)
 Initializes the check with CheckName and Context.
 
virtual bool isLanguageVersionSupported (const LangOptions &LangOpts) const
 Override this to disable registering matchers and PP callbacks if an invalid language version is being used.
 
virtual void registerPPCallbacks (const SourceManager &SM, Preprocessor *PP, Preprocessor *ModuleExpanderPP)
 Override this to register PPCallbacks in the preprocessor.
 
virtual void registerMatchers (ast_matchers::MatchFinder *Finder)
 Override this to register AST matchers with Finder.
 
virtual void check (const ast_matchers::MatchFinder::MatchResult &Result)
 ClangTidyChecks that register ASTMatchers should do the actual work in here.
 
DiagnosticBuilder diag (SourceLocation Loc, StringRef Description, DiagnosticIDs::Level Level=DiagnosticIDs::Warning)
 Add a diagnostic with the check's name.
 
DiagnosticBuilder diag (StringRef Description, DiagnosticIDs::Level Level=DiagnosticIDs::Warning)
 Add a diagnostic with the check's name.
 
DiagnosticBuilder configurationDiag (StringRef Description, DiagnosticIDs::Level Level=DiagnosticIDs::Warning) const
 Adds a diagnostic to report errors in the check's configuration.
 
virtual void storeOptions (ClangTidyOptions::OptionMap &Options)
 Should store all options supported by this check with their current values or default values for options that haven't been overridden.
 

Additional Inherited Members

- Public Types inherited from clang::tidy::utils::UseRangesCheck
using Signature = SmallVector< Indexes, 2 >
 
using ReplacerMap = llvm::StringMap< llvm::IntrusiveRefCntPtr< Replacer > >
 
- Protected Member Functions inherited from clang::tidy::ClangTidyCheck
StringRef getCurrentMainFile () const
 Returns the main file name of the current translation unit.
 
const LangOptions & getLangOpts () const
 Returns the language options from the context.
 
bool areDiagsSelfContained () const
 Returns true when the check is run in a use case when only 1 fix will be applied at a time.
 
StringRef getID () const override
 
- Protected Attributes inherited from clang::tidy::ClangTidyCheck
OptionsView Options
 

Detailed Description

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

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

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

Constructor & Destructor Documentation

◆ UseRangesCheck()

clang::tidy::boost::UseRangesCheck::UseRangesCheck ( StringRef  Name,
ClangTidyContext Context 
)

Definition at line 332 of file boost/UseRangesCheck.cpp.

Member Function Documentation

◆ createDiag()

DiagnosticBuilder clang::tidy::boost::UseRangesCheck::createDiag ( const CallExpr &  Call)
overridevirtual

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

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

Definition at line 343 of file boost/UseRangesCheck.cpp.

References clang::tidy::ClangTidyCheck::diag().

◆ getFreeBeginEndMethods()

ArrayRef< std::pair< StringRef, StringRef > > clang::tidy::boost::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 350 of file boost/UseRangesCheck.cpp.

◆ getReplacerMap()

utils::UseRangesCheck::ReplacerMap clang::tidy::boost::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 202 of file boost/UseRangesCheck.cpp.

References clang::tidy::ClangTidyCheck::getLangOpts(), Name, and Results.

◆ getReverseDescriptor()

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

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

Definition at line 361 of file boost/UseRangesCheck.cpp.

◆ storeOptions()

void clang::tidy::boost::UseRangesCheck::storeOptions ( ClangTidyOptions::OptionMap Options)
overridevirtual

Should store all options supported by this check with their current values or default values for options that haven't been overridden.

The check should use Options.store() to store each option it supports whether it has the default value or it has been overridden.

Reimplemented from clang::tidy::ClangTidyCheck.

Definition at line 337 of file boost/UseRangesCheck.cpp.

References clang::tidy::ClangTidyCheck::Options, clang::tidy::ClangTidyCheck::OptionsView::store(), and clang::tidy::utils::UseRangesCheck::storeOptions().


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