clang-tools 23.0.0git
clang::tidy::modernize::UseStringViewCheck Class Reference

Looks for functions returning std::[w|u8|u16|u32]string and suggests to change it to std::[...]string_view if possible and profitable. More...

#include <UseStringViewCheck.h>

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

Public Member Functions

 UseStringViewCheck (StringRef Name, ClangTidyContext *Context)
void storeOptions (ClangTidyOptions::OptionMap &Opts) override
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

Looks for functions returning std::[w|u8|u16|u32]string and suggests to change it to std::[...]string_view if possible and profitable.

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

Definition at line 21 of file UseStringViewCheck.h.

Constructor & Destructor Documentation

◆ UseStringViewCheck()

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

Definition at line 48 of file UseStringViewCheck.cpp.

Member Function Documentation

◆ check()

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

Definition at line 98 of file UseStringViewCheck.cpp.

References clang::tidy::modernize::fixReturns(), and FuncDecl.

◆ getCheckTraversalKind()

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

Definition at line 30 of file UseStringViewCheck.h.

◆ isLanguageVersionSupported()

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

Definition at line 27 of file UseStringViewCheck.h.

◆ registerMatchers()

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

◆ storeOptions()


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