clang-tools 23.0.0git
clang::tidy::performance::PreferSingleCharOverloadsCheck Class Reference

Optimize calls to std::string::find() and friends when the needle passed is a single character string literal. More...

#include <PreferSingleCharOverloadsCheck.h>

Inheritance diagram for clang::tidy::performance::PreferSingleCharOverloadsCheck:
[legend]

Public Member Functions

 PreferSingleCharOverloadsCheck (StringRef Name, ClangTidyContext *Context)
bool isLanguageVersionSupported (const LangOptions &LangOpts) const override
std::optional< TraversalKind > getCheckTraversalKind () const override
void registerMatchers (ast_matchers::MatchFinder *Finder) override
void check (const ast_matchers::MatchFinder::MatchResult &Result) override
void storeOptions (ClangTidyOptions::OptionMap &Opts) override

Detailed Description

Optimize calls to std::string::find() and friends when the needle passed is a single character string literal.

The character literal overload is more efficient.

For the user-facing documentation see: https://clang.llvm.org/extra/clang-tidy/checks/performance/prefer-single-char-overloads.html

Definition at line 24 of file PreferSingleCharOverloadsCheck.h.

Constructor & Destructor Documentation

◆ PreferSingleCharOverloadsCheck()

clang::tidy::performance::PreferSingleCharOverloadsCheck::PreferSingleCharOverloadsCheck ( StringRef Name,
ClangTidyContext * Context )

Definition at line 44 of file PreferSingleCharOverloadsCheck.cpp.

Member Function Documentation

◆ check()

void clang::tidy::performance::PreferSingleCharOverloadsCheck::check ( const ast_matchers::MatchFinder::MatchResult & Result)
override

◆ getCheckTraversalKind()

std::optional< TraversalKind > clang::tidy::performance::PreferSingleCharOverloadsCheck::getCheckTraversalKind ( ) const
inlineoverride

Definition at line 30 of file PreferSingleCharOverloadsCheck.h.

◆ isLanguageVersionSupported()

bool clang::tidy::performance::PreferSingleCharOverloadsCheck::isLanguageVersionSupported ( const LangOptions & LangOpts) const
inlineoverride

Definition at line 27 of file PreferSingleCharOverloadsCheck.h.

◆ registerMatchers()

void clang::tidy::performance::PreferSingleCharOverloadsCheck::registerMatchers ( ast_matchers::MatchFinder * Finder)
override

Definition at line 57 of file PreferSingleCharOverloadsCheck.cpp.

◆ storeOptions()

void clang::tidy::performance::PreferSingleCharOverloadsCheck::storeOptions ( ClangTidyOptions::OptionMap & Opts)
override

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