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

Checks for common roundabout ways to express starts_with and / ends_with and suggests replacing with the simpler method when it is / available. More...

#include <UseStartsEndsWithCheck.h>

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

Public Member Functions

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

Detailed Description

Checks for common roundabout ways to express starts_with and / ends_with and suggests replacing with the simpler method when it is / available.

Notably, this will work with std::string and / std::string_view.

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

Definition at line 23 of file UseStartsEndsWithCheck.h.

Constructor & Destructor Documentation

◆ UseStartsEndsWithCheck()

clang::tidy::modernize::UseStartsEndsWithCheck::UseStartsEndsWithCheck ( StringRef Name,
ClangTidyContext * Context )

Definition at line 98 of file UseStartsEndsWithCheck.cpp.

Member Function Documentation

◆ check()

void clang::tidy::modernize::UseStartsEndsWithCheck::check ( const ast_matchers::MatchFinder::MatchResult & Result)
override

◆ getCheckTraversalKind()

std::optional< TraversalKind > clang::tidy::modernize::UseStartsEndsWithCheck::getCheckTraversalKind ( ) const
inlineoverride

Definition at line 31 of file UseStartsEndsWithCheck.h.

◆ isLanguageVersionSupported()

bool clang::tidy::modernize::UseStartsEndsWithCheck::isLanguageVersionSupported ( const LangOptions & LangOpts) const
inlineoverride

Definition at line 28 of file UseStartsEndsWithCheck.h.

◆ registerMatchers()

void clang::tidy::modernize::UseStartsEndsWithCheck::registerMatchers ( ast_matchers::MatchFinder * Finder)
override

Definition at line 102 of file UseStartsEndsWithCheck.cpp.


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