clang 20.0.0git
|
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 , CSK_AddressOfOverloadSet } |
using | iterator = SmallVectorImpl< OverloadCandidate >::iterator |
Public Member Functions | |
OverloadCandidateSet (SourceLocation Loc, CandidateSetKind CSK, OperatorRewriteInfo RewriteInfo={}) | |
OverloadCandidateSet (const OverloadCandidateSet &)=delete | |
OverloadCandidateSet & | operator= (const OverloadCandidateSet &)=delete |
~OverloadCandidateSet () | |
SourceLocation | getLocation () const |
CandidateSetKind | getKind () const |
OperatorRewriteInfo | getRewriteInfo () const |
bool | shouldDeferDiags (Sema &S, ArrayRef< Expr * > Args, SourceLocation OpLoc) |
Whether diagnostics should be deferred. | |
bool | isNewCandidate (Decl *F, OverloadCandidateParamOrder PO=OverloadCandidateParamOrder::Normal) |
Determine when this overload candidate will be new to the overload set. | |
void | exclude (Decl *F) |
Exclude a function from being considered by overload resolution. | |
void | clear (CandidateSetKind CSK) |
Clear out all of the candidates. | |
iterator | begin () |
iterator | end () |
size_t | size () const |
bool | empty () const |
ConversionSequenceList | allocateConversionSequences (unsigned NumConversions) |
Allocate storage for conversion sequences for NumConversions conversions. | |
OverloadCandidate & | addCandidate (unsigned NumConversions=0, ConversionSequenceList Conversions=std::nullopt) |
Add a new candidate with NumConversions conversion sequence slots to the overload set. | |
OverloadingResult | BestViableFunction (Sema &S, SourceLocation Loc, OverloadCandidateSet::iterator &Best) |
Find the best viable function on this overload set, if it exists. | |
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. | |
void | NoteCandidates (Sema &S, ArrayRef< Expr * > Args, ArrayRef< OverloadCandidate * > Cands, StringRef Opc="", SourceLocation OpLoc=SourceLocation()) |
LangAS | getDestAS () |
void | setDestAS (LangAS AS) |
OverloadCandidateSet - A set of overload candidates, used in C++ overload resolution (C++ 13.3).
Definition at line 1008 of file Overload.h.
using clang::OverloadCandidateSet::iterator = SmallVectorImpl<OverloadCandidate>::iterator |
Definition at line 1185 of file Overload.h.
Definition at line 1010 of file Overload.h.
|
inline |
Definition at line 1153 of file Overload.h.
|
delete |
|
inline |
Definition at line 1158 of file Overload.h.
|
inline |
Add a new candidate with NumConversions conversion sequence slots to the overload set.
Definition at line 1210 of file Overload.h.
References allocateConversionSequences(), and clang::C.
Referenced by clang::Sema::ActOnExplicitInstantiation(), clang::Sema::AddBuiltinCandidate(), clang::Sema::AddConversionCandidate(), clang::Sema::AddMethodCandidate(), clang::Sema::AddMethodTemplateCandidate(), clang::Sema::AddOverloadCandidate(), clang::Sema::AddSurrogateCandidate(), clang::Sema::AddTemplateConversionCandidate(), and clang::Sema::AddTemplateOverloadCandidate().
|
inline |
Allocate storage for conversion sequences for NumConversions conversions.
Definition at line 1196 of file Overload.h.
Referenced by addCandidate(), and clang::Sema::CheckNonDependentConversions().
|
inline |
Definition at line 1187 of file Overload.h.
Referenced by clang::Sema::AddArgumentDependentLookupCandidates(), BestViableFunction(), clang::Sema::BuildCallToObjectOfClassType(), CompleteCandidates(), ComputeSelectedDestructor(), FindConversionForRefInit(), markUnaddressableCandidatesUnviable(), NoteCandidates(), clang::TemplateSpecCandidateSet::NoteCandidates(), and TryUserDefinedConversion().
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.
Loc | The location of the function name (or operator symbol) for which overload resolution occurs. |
Best | If overload resolution was successful or found a deleted function, Best points to the candidate function found. |
Definition at line 10727 of file SemaOverload.cpp.
References begin(), clang::OverloadCandidate::Best, clang::SemaCUDA::CFP_SameSide, clang::SemaCUDA::CFP_WrongSide, CSK_AddressOfOverloadSet, clang::Sema::CUDA(), clang::Sema::diagnoseEquivalentInternalLinkageDeclarations(), end(), clang::OverloadCandidate::Function, clang::Sema::getCurFunctionDecl(), clang::Sema::getLangOpts(), clang::SemaCUDA::IdentifyPreference(), clang::isBetterOverloadCandidate(), clang::Sema::isEquivalentInternalLinkageDeclaration(), Loc, clang::OverloadCandidate::NotValidBecauseConstraintExprHasError(), clang::OR_Ambiguous, clang::OR_Deleted, clang::OR_No_Viable_Function, clang::OR_Success, and clang::OverloadCandidate::Viable.
Referenced by clang::Sema::ActOnExplicitInstantiation(), clang::Sema::BuildCallToMemberFunction(), clang::Sema::BuildCallToObjectOfClassType(), clang::Sema::BuildForRangeBeginEndCall(), clang::Sema::BuildLiteralOperatorCall(), clang::Sema::BuildOverloadedArrowExpr(), clang::Sema::BuildOverloadedCallExpr(), clang::Sema::buildOverloadedCallSet(), ComputeSelectedDestructor(), clang::Sema::CreateOverloadedArraySubscriptExpr(), clang::Sema::CreateOverloadedBinOp(), clang::Sema::CreateOverloadedUnaryOp(), clang::Sema::DeduceTemplateSpecializationFromInitializer(), clang::InitializationSequence::Diagnose(), clang::Sema::DiagnoseEmptyLookup(), DiagnoseTwoPhaseLookup(), FindConditionalOverload(), FindConversionForRefInit(), clang::InitializationSequence::InitializeFrom(), IsInitializerListConstructorConversion(), IsUserDefinedConversion(), clang::Sema::LookupSpecialMember(), clang::Sema::PerformContextualImplicitConversion(), resolveAllocationOverload(), resolveBuiltinNewDeleteOverload(), ResolveConstructorOverload(), tryDiagnoseOverloadedCast(), TryRefInitWithConversionFunction(), TryTypoCorrectionForCall(), and TryUserDefinedConversion().
void OverloadCandidateSet::clear | ( | CandidateSetKind | CSK | ) |
Clear out all of the candidates.
Definition at line 1125 of file SemaOverload.cpp.
Referenced by clang::Sema::BuildForRangeBeginEndCall(), clang::Sema::DeduceTemplateSpecializationFromInitializer(), IsInitializerListConstructorConversion(), IsUserDefinedConversion(), ResolveConstructorOverload(), TryRefInitWithConversionFunction(), and TryUserDefinedConversion().
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 12520 of file SemaOverload.cpp.
References begin(), CompleteNonViableCandidate(), end(), clang::OCD_AllCandidates, clang::OCD_AmbiguousCandidates, clang::OCD_ViableCandidates, and size().
Referenced by clang::Sema::BuildOverloadedArrowExpr(), clang::Sema::CreateOverloadedBinOp(), clang::InitializationSequence::Diagnose(), clang::Sema::DiagnoseMultipleUserDefinedConversion(), NoteCandidates(), resolveAllocationOverload(), and shouldDeferDiags().
|
inline |
Definition at line 1191 of file Overload.h.
Referenced by clang::Sema::ActOnExplicitInstantiation(), clang::Sema::BuildCallToObjectOfClassType(), clang::Sema::BuildForRangeBeginEndCall(), clang::Sema::BuildOverloadedArrowExpr(), clang::Sema::buildOverloadedCallSet(), ComputeSelectedDestructor(), clang::Sema::CreateOverloadedArraySubscriptExpr(), clang::Sema::DiagnoseMultipleUserDefinedConversion(), FinishOverloadedCallExpr(), clang::SemaCodeCompletion::ProduceCallSignatureHelp(), tryDiagnoseOverloadedCast(), and TryReferenceInitializationCore().
|
inline |
Definition at line 1188 of file Overload.h.
Referenced by clang::Sema::AddArgumentDependentLookupCandidates(), BestViableFunction(), clang::Sema::BuildCallToObjectOfClassType(), chooseRecoveryType(), CompleteCandidates(), DiagnoseTwoPhaseLookup(), FindConversionForRefInit(), FinishOverloadedCallExpr(), markUnaddressableCandidatesUnviable(), NoteCandidates(), clang::TemplateSpecCandidateSet::NoteCandidates(), and TryUserDefinedConversion().
|
inline |
Exclude a function from being considered by overload resolution.
Definition at line 1177 of file Overload.h.
References isNewCandidate(), clang::Normal, and clang::Reversed.
Referenced by clang::Sema::CreateOverloadedBinOp().
|
inline |
Definition at line 1245 of file Overload.h.
Referenced by clang::Sema::AddOverloadCandidate().
|
inline |
Definition at line 1161 of file Overload.h.
Referenced by clang::Sema::AddMethodCandidate(), clang::Sema::AddOverloadCandidate(), FinishOverloadedCallExpr(), and mergeCandidatesWithResults().
|
inline |
Definition at line 1160 of file Overload.h.
References Loc.
Referenced by clang::Sema::AddConversionCandidate(), clang::Sema::AddMethodCandidate(), clang::Sema::AddMethodTemplateCandidate(), clang::Sema::AddOverloadCandidate(), clang::Sema::AddSurrogateCandidate(), clang::Sema::AddTemplateConversionCandidate(), clang::Sema::AddTemplateOverloadCandidate(), clang::Sema::CheckNonDependentConversions(), and clang::Sema::LookupOverloadedBinOp().
|
inline |
Definition at line 1162 of file Overload.h.
Referenced by clang::Sema::AddArgumentDependentLookupCandidates(), clang::Sema::AddMemberOperatorCandidates(), clang::Sema::AddMethodCandidate(), clang::Sema::AddMethodTemplateCandidate(), clang::Sema::AddNonMemberOperatorCandidates(), clang::Sema::AddOverloadCandidate(), clang::Sema::AddTemplateOverloadCandidate(), clang::Sema::CreateOverloadedBinOp(), and clang::Sema::LookupOverloadedBinOp().
|
inline |
Determine when this overload candidate will be new to the overload set.
Definition at line 1169 of file Overload.h.
References clang::Decl::getCanonicalDecl().
Referenced by clang::Sema::AddConversionCandidate(), clang::Sema::AddMethodCandidate(), clang::Sema::AddMethodTemplateCandidate(), clang::Sema::AddOverloadCandidate(), clang::Sema::AddSurrogateCandidate(), clang::Sema::AddTemplateConversionCandidate(), clang::Sema::AddTemplateOverloadCandidate(), and exclude().
void OverloadCandidateSet::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.
Definition at line 12584 of file SemaOverload.cpp.
References begin(), CompleteCandidates(), clang::SemaBase::Diag(), end(), MaybeDiagnoseAmbiguousConstraints(), NoteCandidates(), clang::OCD_AmbiguousCandidates, and shouldDeferDiags().
Referenced by clang::Sema::ActOnExplicitInstantiation(), clang::Sema::BuildCallToMemberFunction(), clang::Sema::BuildCallToObjectOfClassType(), clang::Sema::BuildCXXForRangeStmt(), clang::Sema::BuildLiteralOperatorCall(), BuildNonArrayForRange(), clang::Sema::BuildOverloadedArrowExpr(), CheckCXX98CompatAccessibleCopy(), ComputeSelectedDestructor(), CopyObject(), clang::Sema::CreateOverloadedArraySubscriptExpr(), clang::Sema::CreateOverloadedBinOp(), clang::Sema::CreateOverloadedUnaryOp(), clang::Sema::DeduceTemplateSpecializationFromInitializer(), clang::InitializationSequence::Diagnose(), clang::Sema::DiagnoseMultipleUserDefinedConversion(), clang::Sema::DiagnoseUseOfDeletedFunction(), FinishOverloadedCallExpr(), NoteCandidates(), resolveAllocationOverload(), resolveBuiltinNewDeleteOverload(), and tryDiagnoseOverloadedCast().
void OverloadCandidateSet::NoteCandidates | ( | Sema & | S, |
ArrayRef< Expr * > | Args, | ||
ArrayRef< OverloadCandidate * > | Cands, | ||
StringRef | Opc = "" , |
||
SourceLocation | OpLoc = SourceLocation() |
||
) |
Definition at line 12608 of file SemaOverload.cpp.
References clang::SemaBase::Diag(), clang::Sema::Diags, E, clang::OverloadCandidate::Function, clang::DiagnosticsEngine::getNumOverloadCandidatesToShow(), clang::DiagnosticsEngine::getShowOverloads(), int, clang::OverloadCandidate::IsSurrogate, NoteAmbiguousUserConversions(), NoteBuiltinOperatorCandidate(), NoteFunctionCandidate(), NoteSurrogateCandidate(), clang::DiagnosticsEngine::overloadCandidatesShown(), clang::Ovl_Best, shouldDeferDiags(), and clang::OverloadCandidate::Viable.
|
delete |
|
inline |
Definition at line 1247 of file Overload.h.
References CSK_InitByConstructor, and CSK_InitByUserDefinedConversion.
Referenced by ResolveConstructorOverload(), and TryUserDefinedConversion().
bool OverloadCandidateSet::shouldDeferDiags | ( | Sema & | S, |
ArrayRef< Expr * > | Args, | ||
SourceLocation | OpLoc | ||
) |
Whether diagnostics should be deferred.
Definition at line 12563 of file SemaOverload.cpp.
References CompleteCandidates(), clang::Sema::getLangOpts(), clang::OCD_AllCandidates, and clang::ovl_fail_bad_target.
Referenced by clang::Sema::CreateOverloadedBinOp(), and NoteCandidates().
|
inline |
Definition at line 1190 of file Overload.h.
Referenced by clang::Sema::BuildCallToMemberFunction(), clang::Sema::BuildCallToObjectOfClassType(), clang::Sema::BuildLiteralOperatorCall(), clang::Sema::BuildOverloadedArrowExpr(), CompleteCandidates(), CopyObject(), clang::Sema::CreateOverloadedArraySubscriptExpr(), clang::Sema::CreateOverloadedBinOp(), clang::Sema::CreateOverloadedUnaryOp(), FindConversionForRefInit(), IsInitializerListConstructorConversion(), IsUserDefinedConversion(), clang::TemplateSpecCandidateSet::NoteCandidates(), TryConstructorInitialization(), TryRefInitWithConversionFunction(), and TryUserDefinedConversion().