clang 22.0.0git
clang::OverloadCandidateSet::OperatorRewriteInfo Struct Reference

Information about operator rewrites to consider when adding operator functions to a candidate set. More...

#include "clang/Sema/Overload.h"

Public Member Functions

 OperatorRewriteInfo ()
 OperatorRewriteInfo (OverloadedOperatorKind Op, SourceLocation OpLoc, bool AllowRewritten)
bool isRewrittenOperator (const FunctionDecl *FD)
 Would use of this function result in a rewrite using a different operator?
bool isAcceptableCandidate (const FunctionDecl *FD)
OverloadCandidateRewriteKind getRewriteKind (const FunctionDecl *FD, OverloadCandidateParamOrder PO)
 Determine the kind of rewrite that should be performed for this candidate.
bool isReversible ()
 Determines whether this operator could be implemented by a function with reversed parameter order.
bool allowsReversed (OverloadedOperatorKind Op)
 Determine whether reversing parameter order is allowed for operator Op.
bool shouldAddReversed (Sema &S, ArrayRef< Expr * > OriginalArgs, FunctionDecl *FD)
 Determine whether we should add a rewritten candidate for FD with reversed parameter order.

Public Attributes

OverloadedOperatorKind OriginalOperator
 The original operator as written in the source.
SourceLocation OpLoc
 The source location of the operator.
bool AllowRewrittenCandidates
 Whether we should include rewritten candidates in the overload set.

Detailed Description

Information about operator rewrites to consider when adding operator functions to a candidate set.

Definition at line 1188 of file Overload.h.

Constructor & Destructor Documentation

◆ OperatorRewriteInfo() [1/2]

clang::OverloadCandidateSet::OperatorRewriteInfo::OperatorRewriteInfo ( )
inline

Definition at line 1189 of file Overload.h.

References AllowRewrittenCandidates, false, clang::OO_None, OpLoc, and OriginalOperator.

◆ OperatorRewriteInfo() [2/2]

clang::OverloadCandidateSet::OperatorRewriteInfo::OperatorRewriteInfo ( OverloadedOperatorKind Op,
SourceLocation OpLoc,
bool AllowRewritten )
inline

Definition at line 1191 of file Overload.h.

References AllowRewrittenCandidates, OpLoc, and OriginalOperator.

Member Function Documentation

◆ allowsReversed()

bool OverloadCandidateSet::OperatorRewriteInfo::allowsReversed ( OverloadedOperatorKind Op)

Determine whether reversing parameter order is allowed for operator Op.

Definition at line 1088 of file SemaOverload.cpp.

References AllowRewrittenCandidates.

Referenced by isReversible(), clang::Sema::LookupOverloadedBinOp(), and shouldAddReversed().

◆ getRewriteKind()

OverloadCandidateRewriteKind clang::OverloadCandidateSet::OperatorRewriteInfo::getRewriteKind ( const FunctionDecl * FD,
OverloadCandidateParamOrder PO )
inline

Determine the kind of rewrite that should be performed for this candidate.

Definition at line 1227 of file Overload.h.

References clang::CRK_DifferentOperator, clang::CRK_None, clang::CRK_Reversed, isRewrittenOperator(), and clang::Reversed.

Referenced by clang::Sema::AddMethodCandidate(), AddMethodTemplateCandidateImmediately(), and clang::Sema::AddOverloadCandidate().

◆ isAcceptableCandidate()

bool clang::OverloadCandidateSet::OperatorRewriteInfo::isAcceptableCandidate ( const FunctionDecl * FD)
inline

◆ isReversible()

bool clang::OverloadCandidateSet::OperatorRewriteInfo::isReversible ( )
inline

Determines whether this operator could be implemented by a function with reversed parameter order.

Definition at line 1237 of file Overload.h.

References AllowRewrittenCandidates, allowsReversed(), clang::getRewrittenOverloadedOperator(), clang::OO_None, and OriginalOperator.

Referenced by clang::Sema::CreateOverloadedBinOp().

◆ isRewrittenOperator()

bool clang::OverloadCandidateSet::OperatorRewriteInfo::isRewrittenOperator ( const FunctionDecl * FD)
inline

Would use of this function result in a rewrite using a different operator?

Definition at line 1205 of file Overload.h.

References clang::DeclarationName::getCXXOverloadedOperator(), clang::NamedDecl::getDeclName(), and OriginalOperator.

Referenced by getRewriteKind().

◆ shouldAddReversed()

bool OverloadCandidateSet::OperatorRewriteInfo::shouldAddReversed ( Sema & S,
ArrayRef< Expr * > OriginalArgs,
FunctionDecl * FD )

Member Data Documentation

◆ AllowRewrittenCandidates

bool clang::OverloadCandidateSet::OperatorRewriteInfo::AllowRewrittenCandidates

Whether we should include rewritten candidates in the overload set.

Definition at line 1201 of file Overload.h.

Referenced by allowsReversed(), isAcceptableCandidate(), isReversible(), clang::Sema::LookupOverloadedBinOp(), OperatorRewriteInfo(), and OperatorRewriteInfo().

◆ OpLoc

SourceLocation clang::OverloadCandidateSet::OperatorRewriteInfo::OpLoc

The source location of the operator.

Definition at line 1199 of file Overload.h.

Referenced by OperatorRewriteInfo(), OperatorRewriteInfo(), and shouldAddReversed().

◆ OriginalOperator

OverloadedOperatorKind clang::OverloadCandidateSet::OperatorRewriteInfo::OriginalOperator

The original operator as written in the source.

Definition at line 1197 of file Overload.h.

Referenced by isAcceptableCandidate(), isReversible(), isRewrittenOperator(), OperatorRewriteInfo(), and OperatorRewriteInfo().


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