clang  10.0.0svn
Classes | Public Types | Public Member Functions | List of all members
clang::OverloadCandidateSet Class Reference

OverloadCandidateSet - A set of overload candidates, used in C++ overload resolution (C++ 13.3). More...

#include "clang/Sema/Overload.h"

Classes

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

Public Types

enum  CandidateSetKind { CSK_Normal, CSK_Operator, CSK_InitByUserDefinedConversion, CSK_InitByConstructor }
 
using iterator = SmallVectorImpl< OverloadCandidate >::iterator
 

Public Member Functions

 OverloadCandidateSet (SourceLocation Loc, CandidateSetKind CSK, OperatorRewriteInfo RewriteInfo={})
 
 OverloadCandidateSet (const OverloadCandidateSet &)=delete
 
OverloadCandidateSetoperator= (const OverloadCandidateSet &)=delete
 
 ~OverloadCandidateSet ()
 
SourceLocation getLocation () const
 
CandidateSetKind getKind () const
 
OperatorRewriteInfo getRewriteInfo () const
 
bool isNewCandidate (Decl *F, OverloadCandidateParamOrder PO=OverloadCandidateParamOrder::Normal)
 Determine when this overload candidate will be new to the overload set. More...
 
void clear (CandidateSetKind CSK)
 Clear out all of the candidates. More...
 
iterator begin ()
 
iterator end ()
 
size_t size () const
 
bool empty () const
 
ConversionSequenceList allocateConversionSequences (unsigned NumConversions)
 Allocate storage for conversion sequences for NumConversions conversions. More...
 
OverloadCandidateaddCandidate (unsigned NumConversions=0, ConversionSequenceList Conversions=None)
 Add a new candidate with NumConversions conversion sequence slots to the overload set. More...
 
OverloadingResult BestViableFunction (Sema &S, SourceLocation Loc, OverloadCandidateSet::iterator &Best)
 Find the best viable function on this overload set, if it exists. More...
 
SmallVector< OverloadCandidate *, 32 > CompleteCandidates (Sema &S, OverloadCandidateDisplayKind OCD, ArrayRef< Expr *> Args, SourceLocation OpLoc=SourceLocation(), llvm::function_ref< bool(OverloadCandidate &)> Filter=[](OverloadCandidate &) { return true;})
 
void NoteCandidates (PartialDiagnosticAt PA, Sema &S, OverloadCandidateDisplayKind OCD, ArrayRef< Expr *> Args, StringRef Opc="", SourceLocation Loc=SourceLocation(), llvm::function_ref< bool(OverloadCandidate &)> Filter=[](OverloadCandidate &) { return true;})
 When overload resolution fails, prints diagnostic messages containing the candidates in the candidate set. More...
 
void NoteCandidates (Sema &S, ArrayRef< Expr *> Args, ArrayRef< OverloadCandidate *> Cands, StringRef Opc="", SourceLocation OpLoc=SourceLocation())
 
LangAS getDestAS ()
 
void setDestAS (LangAS AS)
 

Detailed Description

OverloadCandidateSet - A set of overload candidates, used in C++ overload resolution (C++ 13.3).

Definition at line 875 of file Overload.h.

Member Typedef Documentation

◆ iterator

Definition at line 1016 of file Overload.h.

Member Enumeration Documentation

◆ CandidateSetKind

Enumerator
CSK_Normal 

Normal lookup.

CSK_Operator 

C++ [over.match.oper]: Lookup of operator function candidates in a call using operator syntax.

Candidates that have no parameters of class type will be skipped unless there is a parameter of (reference to) enum type and the corresponding argument is of the same enum type.

CSK_InitByUserDefinedConversion 

C++ [over.match.copy]: Copy-initialization of an object of class type by user-defined conversion.

CSK_InitByConstructor 

C++ [over.match.ctor], [over.match.list] Initialization of an object of class type by constructor, using either a parenthesized or braced list of arguments.

Definition at line 877 of file Overload.h.

Constructor & Destructor Documentation

◆ OverloadCandidateSet() [1/2]

clang::OverloadCandidateSet::OverloadCandidateSet ( SourceLocation  Loc,
CandidateSetKind  CSK,
OperatorRewriteInfo  RewriteInfo = {} 
)
inline

Definition at line 993 of file Overload.h.

◆ OverloadCandidateSet() [2/2]

clang::OverloadCandidateSet::OverloadCandidateSet ( const OverloadCandidateSet )
delete

◆ ~OverloadCandidateSet()

clang::OverloadCandidateSet::~OverloadCandidateSet ( )
inline

Definition at line 998 of file Overload.h.

Member Function Documentation

◆ addCandidate()

OverloadCandidate& clang::OverloadCandidateSet::addCandidate ( unsigned  NumConversions = 0,
ConversionSequenceList  Conversions = None 
)
inline

Add a new candidate with NumConversions conversion sequence slots to the overload set.

Definition at line 1040 of file Overload.h.

References clang::C, and clang::OverloadCandidate::Conversions.

Referenced by clang::Sema::AddBuiltinCandidate(), and clang::Sema::AddMethodCandidate().

◆ allocateConversionSequences()

ConversionSequenceList clang::OverloadCandidateSet::allocateConversionSequences ( unsigned  NumConversions)
inline

Allocate storage for conversion sequences for NumConversions conversions.

Definition at line 1027 of file Overload.h.

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

◆ begin()

iterator clang::OverloadCandidateSet::begin ( )
inline

◆ BestViableFunction()

OverloadingResult OverloadCandidateSet::BestViableFunction ( Sema S,
SourceLocation  Loc,
OverloadCandidateSet::iterator Best 
)

Find the best viable function on this overload set, if it exists.

Computes the best viable function (C++ 13.3.3) within an overload candidate set.

Parameters
LocThe location of the function name (or operator symbol) for which overload resolution occurs.
BestIf overload resolution was successful or found a deleted function, Best points to the candidate function found.
Returns
The result of overload resolution.

Definition at line 9590 of file SemaOverload.cpp.

Referenced by clang::Sema::buildOverloadedCallSet(), FindConditionalOverload(), IsInitializerListConstructorConversion(), IsUserDefinedConversion(), clang::Sema::PerformContextualImplicitConversion(), ResolveConstructorOverload(), TryRefInitWithConversionFunction(), and TryUserDefinedConversion().

◆ clear()

void OverloadCandidateSet::clear ( CandidateSetKind  CSK)

◆ CompleteCandidates()

SmallVector< OverloadCandidate *, 32 > OverloadCandidateSet::CompleteCandidates ( Sema S,
OverloadCandidateDisplayKind  OCD,
ArrayRef< Expr *>  Args,
SourceLocation  OpLoc = SourceLocation(),
llvm::function_ref< bool(OverloadCandidate &)>  Filter = [](OverloadCandidate &) { return true; } 
)

Definition at line 11025 of file SemaOverload.cpp.

◆ empty()

bool clang::OverloadCandidateSet::empty ( ) const
inline

◆ end()

iterator clang::OverloadCandidateSet::end ( )
inline

◆ getDestAS()

LangAS clang::OverloadCandidateSet::getDestAS ( )
inline

Definition at line 1075 of file Overload.h.

◆ getKind()

CandidateSetKind clang::OverloadCandidateSet::getKind ( ) const
inline

Definition at line 1001 of file Overload.h.

Referenced by clang::Sema::AddOverloadCandidate(), and mergeCandidatesWithResults().

◆ getLocation()

SourceLocation clang::OverloadCandidateSet::getLocation ( ) const
inline

Definition at line 1000 of file Overload.h.

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

◆ getRewriteInfo()

OperatorRewriteInfo clang::OverloadCandidateSet::getRewriteInfo ( ) const
inline

Definition at line 1002 of file Overload.h.

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

◆ isNewCandidate()

bool clang::OverloadCandidateSet::isNewCandidate ( Decl F,
OverloadCandidateParamOrder  PO = OverloadCandidateParamOrder::Normal 
)
inline

Determine when this overload candidate will be new to the overload set.

Definition at line 1006 of file Overload.h.

References clang::CodeGen::clear(), and clang::Decl::getCanonicalDecl().

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

◆ NoteCandidates() [1/2]

void OverloadCandidateSet::NoteCandidates ( PartialDiagnosticAt  PD,
Sema S,
OverloadCandidateDisplayKind  OCD,
ArrayRef< Expr *>  Args,
StringRef  Opc = "",
SourceLocation  OpLoc = SourceLocation(),
llvm::function_ref< bool(OverloadCandidate &)>  Filter = [](OverloadCandidate &) { return true; } 
)

When overload resolution fails, prints diagnostic messages containing the candidates in the candidate set.

Definition at line 11055 of file SemaOverload.cpp.

References clang::Sema::Diag(), and clang::tooling::Filter.

Referenced by BuildNonArrayForRange(), CheckCXX98CompatAccessibleCopy(), CopyObject(), FinishOverloadedCallExpr(), and resolveAllocationOverload().

◆ NoteCandidates() [2/2]

void OverloadCandidateSet::NoteCandidates ( Sema S,
ArrayRef< Expr *>  Args,
ArrayRef< OverloadCandidate *>  Cands,
StringRef  Opc = "",
SourceLocation  OpLoc = SourceLocation() 
)

◆ operator=()

OverloadCandidateSet& clang::OverloadCandidateSet::operator= ( const OverloadCandidateSet )
delete

◆ setDestAS()

void clang::OverloadCandidateSet::setDestAS ( LangAS  AS)
inline

◆ size()

size_t clang::OverloadCandidateSet::size ( ) const
inline

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