clang-tools 22.0.0git
clang::tidy::bugprone::UnusedReturnValueCheck Class Reference

Detects function calls where the return value is unused. More...

#include <UnusedReturnValueCheck.h>

Inheritance diagram for clang::tidy::bugprone::UnusedReturnValueCheck:
[legend]

Public Member Functions

 UnusedReturnValueCheck (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
std::optional< TraversalKind > getCheckTraversalKind () const override

Protected Member Functions

 UnusedReturnValueCheck (StringRef Name, ClangTidyContext *Context, std::vector< StringRef > CheckedFunctions)
 UnusedReturnValueCheck (StringRef Name, ClangTidyContext *Context, std::vector< StringRef > CheckedFunctions, std::vector< StringRef > CheckedReturnTypes, bool AllowCastToVoid)

Protected Attributes

bool AllowCastToVoid

Detailed Description

Detects function calls where the return value is unused.

For the user-facing documentation see: https://clang.llvm.org/extra/clang-tidy/checks/bugprone/unused-return-value.html

Definition at line 21 of file UnusedReturnValueCheck.h.

Constructor & Destructor Documentation

◆ UnusedReturnValueCheck() [1/3]

clang::tidy::bugprone::UnusedReturnValueCheck::UnusedReturnValueCheck ( StringRef Name,
ClangTidyContext * Context )

◆ UnusedReturnValueCheck() [2/3]

clang::tidy::bugprone::UnusedReturnValueCheck::UnusedReturnValueCheck ( StringRef Name,
ClangTidyContext * Context,
std::vector< StringRef > CheckedFunctions )
protected

◆ UnusedReturnValueCheck() [3/3]

clang::tidy::bugprone::UnusedReturnValueCheck::UnusedReturnValueCheck ( StringRef Name,
ClangTidyContext * Context,
std::vector< StringRef > CheckedFunctions,
std::vector< StringRef > CheckedReturnTypes,
bool AllowCastToVoid )
protected

References AllowCastToVoid.

Member Function Documentation

◆ check()

void clang::tidy::bugprone::UnusedReturnValueCheck::check ( const ast_matchers::MatchFinder::MatchResult & Result)
override

Definition at line 217 of file UnusedReturnValueCheck.cpp.

References AllowCastToVoid, and check().

Referenced by check().

◆ getCheckTraversalKind()

std::optional< TraversalKind > clang::tidy::bugprone::UnusedReturnValueCheck::getCheckTraversalKind ( ) const
inlineoverride

Definition at line 27 of file UnusedReturnValueCheck.h.

◆ registerMatchers()

void clang::tidy::bugprone::UnusedReturnValueCheck::registerMatchers ( ast_matchers::MatchFinder * Finder)
override

◆ storeOptions()

void clang::tidy::bugprone::UnusedReturnValueCheck::storeOptions ( ClangTidyOptions::OptionMap & Opts)
override

Member Data Documentation

◆ AllowCastToVoid

bool clang::tidy::bugprone::UnusedReturnValueCheck::AllowCastToVoid
protected

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