clang-tools 22.0.0git
clang::tidy::misc::UnconventionalAssignOperatorCheck Class Reference

Finds declarations of assignment operators with the wrong return and/or argument types and definitions with good return type but wrong return statements. More...

#include <UnconventionalAssignOperatorCheck.h>

Inheritance diagram for clang::tidy::misc::UnconventionalAssignOperatorCheck:
[legend]

Public Member Functions

 UnconventionalAssignOperatorCheck (StringRef Name, ClangTidyContext *Context)
bool isLanguageVersionSupported (const LangOptions &LangOpts) const override
void registerMatchers (ast_matchers::MatchFinder *Finder) override
void check (const ast_matchers::MatchFinder::MatchResult &Result) override

Detailed Description

Finds declarations of assignment operators with the wrong return and/or argument types and definitions with good return type but wrong return statements.

  • The return type must be Class&.
  • Works with move-assign and assign by value.
  • Private and deleted operators are ignored.
  • The operator must always return *this.

For the user-facing documentation see: https://clang.llvm.org/extra/clang-tidy/checks/misc/unconventional-assign-operator.html

Definition at line 27 of file UnconventionalAssignOperatorCheck.h.

Constructor & Destructor Documentation

◆ UnconventionalAssignOperatorCheck()

clang::tidy::misc::UnconventionalAssignOperatorCheck::UnconventionalAssignOperatorCheck ( StringRef Name,
ClangTidyContext * Context )
inline

Definition at line 29 of file UnconventionalAssignOperatorCheck.h.

Member Function Documentation

◆ check()

void clang::tidy::misc::UnconventionalAssignOperatorCheck::check ( const ast_matchers::MatchFinder::MatchResult & Result)
override

Definition at line 84 of file UnconventionalAssignOperatorCheck.cpp.

◆ isLanguageVersionSupported()

bool clang::tidy::misc::UnconventionalAssignOperatorCheck::isLanguageVersionSupported ( const LangOptions & LangOpts) const
inlineoverride

Definition at line 31 of file UnconventionalAssignOperatorCheck.h.

◆ registerMatchers()

void clang::tidy::misc::UnconventionalAssignOperatorCheck::registerMatchers ( ast_matchers::MatchFinder * Finder)
override

Definition at line 27 of file UnconventionalAssignOperatorCheck.cpp.


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