clang  6.0.0svn
Enumerations | Functions
SemaOverload.cpp File Reference
#include "clang/Sema/Overload.h"
#include "clang/AST/ASTContext.h"
#include "clang/AST/CXXInheritance.h"
#include "clang/AST/DeclObjC.h"
#include "clang/AST/Expr.h"
#include "clang/AST/ExprCXX.h"
#include "clang/AST/ExprObjC.h"
#include "clang/AST/TypeOrdering.h"
#include "clang/Basic/Diagnostic.h"
#include "clang/Basic/DiagnosticOptions.h"
#include "clang/Basic/PartialDiagnostic.h"
#include "clang/Basic/TargetInfo.h"
#include "clang/Sema/Initialization.h"
#include "clang/Sema/Lookup.h"
#include "clang/Sema/SemaInternal.h"
#include "clang/Sema/Template.h"
#include "clang/Sema/TemplateDeduction.h"
#include "llvm/ADT/DenseSet.h"
#include "llvm/ADT/Optional.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/SmallString.h"
#include <algorithm>
#include <cstdlib>
Include dependency graph for SemaOverload.cpp:

Go to the source code of this file.

Enumerations

enum  {
  ft_default, ft_different_class, ft_parameter_arity, ft_parameter_mismatch,
  ft_return_type, ft_qualifer_mismatch, ft_noexcept
}
 
enum  Comparison
 
enum  OverloadCandidateKind
 

Functions

static bool functionHasPassObjectSizeParams (const FunctionDecl *FD)
 
static ExprResult CreateFunctionRefExpr (Sema &S, FunctionDecl *Fn, NamedDecl *FoundDecl, const Expr *Base, bool HadMultipleCandidates, SourceLocation Loc=SourceLocation(), const DeclarationNameLoc &LocInfo=DeclarationNameLoc())
 A convenience routine for creating a decayed reference to a function. More...
 
static bool IsStandardConversion (Sema &S, Expr *From, QualType ToType, bool InOverloadResolution, StandardConversionSequence &SCS, bool CStyle, bool AllowObjCWritebackConversion)
 IsStandardConversion - Determines whether there is a standard conversion sequence (C++ [conv], C++ [over.ics.scs]) from the expression From to the type ToType. More...
 
static bool IsTransparentUnionStandardConversion (Sema &S, Expr *From, QualType &ToType, bool InOverloadResolution, StandardConversionSequence &SCS, bool CStyle)
 
static OverloadingResult IsUserDefinedConversion (Sema &S, Expr *From, QualType ToType, UserDefinedConversionSequence &User, OverloadCandidateSet &CandidateSet, bool AllowExplicit, bool AllowObjCConversionOnExplicit)
 Determines whether there is a user-defined conversion sequence (C++ [over.ics.user]) that converts expression From to the type ToType. More...
 
static ImplicitConversionSequence::CompareKind CompareStandardConversionSequences (Sema &S, SourceLocation Loc, const StandardConversionSequence &SCS1, const StandardConversionSequence &SCS2)
 CompareStandardConversionSequences - Compare two standard conversion sequences to determine whether one is better than the other or if they are indistinguishable (C++ 13.3.3.2p3). More...
 
static ImplicitConversionSequence::CompareKind CompareQualificationConversions (Sema &S, const StandardConversionSequence &SCS1, const StandardConversionSequence &SCS2)
 CompareQualificationConversions - Compares two standard conversion sequences to determine whether they can be ranked based on their qualification conversions (C++ 13.3.3.2p3 bullet 3). More...
 
static ImplicitConversionSequence::CompareKind CompareDerivedToBaseConversions (Sema &S, SourceLocation Loc, const StandardConversionSequence &SCS1, const StandardConversionSequence &SCS2)
 CompareDerivedToBaseConversions - Compares two standard conversion sequences to determine whether they can be ranked based on their various kinds of derived-to-base conversions (C++ [over.ics.rank]p4b3). More...
 
static const char * GetImplicitConversionName (ImplicitConversionKind Kind)
 GetImplicitConversionName - Return the name of this kind of implicit conversion. More...
 
static const ExprIgnoreNarrowingConversion (const Expr *Converted)
 Skip any implicit casts which could be either part of a narrowing conversion or after one in an implicit conversion. More...
 
static bool checkPlaceholderForOverload (Sema &S, Expr *&E, UnbridgedCastsSet *unbridgedCasts=nullptr)
 checkPlaceholderForOverload - Do any interesting placeholder-like preprocessing on the given expression. More...
 
static bool checkArgPlaceholdersForOverload (Sema &S, MultiExprArg Args, UnbridgedCastsSet &unbridged)
 checkArgPlaceholdersForOverload - Check a set of call operands for placeholders. More...
 
static ImplicitConversionSequence TryUserDefinedConversion (Sema &S, Expr *From, QualType ToType, bool SuppressUserConversions, bool AllowExplicit, bool InOverloadResolution, bool CStyle, bool AllowObjCWritebackConversion, bool AllowObjCConversionOnExplicit)
 Tries a user-defined conversion from From to ToType. More...
 
static ImplicitConversionSequence TryImplicitConversion (Sema &S, Expr *From, QualType ToType, bool SuppressUserConversions, bool AllowExplicit, bool InOverloadResolution, bool CStyle, bool AllowObjCWritebackConversion, bool AllowObjCConversionOnExplicit)
 TryImplicitConversion - Attempt to perform an implicit conversion from the given expression (Expr) to the given type (ToType). More...
 
static bool IsVectorConversion (Sema &S, QualType FromType, QualType ToType, ImplicitConversionKind &ICK)
 Determine whether the conversion from FromType to ToType is a valid vector conversion. More...
 
static bool tryAtomicConversion (Sema &S, Expr *From, QualType ToType, bool InOverloadResolution, StandardConversionSequence &SCS, bool CStyle)
 
  • Determine whether this is a conversion from a scalar type to an atomic type.
More...
 
static QualType BuildSimilarlyQualifiedPointerType (const Type *FromPtr, QualType ToPointee, QualType ToType, ASTContext &Context, bool StripObjCLifetime=false)
 BuildSimilarlyQualifiedPointerType - In a pointer conversion from the pointer type FromPtr to a pointer to type ToPointee, with the same type qualifiers as FromPtr has on its pointee type. More...
 
static bool isNullPointerConstantForConversion (Expr *Expr, bool InOverloadResolution, ASTContext &Context)
 
static QualType AdoptQualifiers (ASTContext &Context, QualType T, Qualifiers Qs)
 Adopt the given qualifiers for the given type. More...
 
static const FunctionProtoTypetryGetFunctionProtoType (QualType FromType)
 Attempts to get the FunctionProtoType from a Type. More...
 
static bool isNonTrivialObjCLifetimeConversion (Qualifiers FromQuals, Qualifiers ToQuals)
 Determine whether the lifetime conversion between the two given qualifiers sets is nontrivial. More...
 
static bool isFirstArgumentCompatibleWithType (ASTContext &Context, CXXConstructorDecl *Constructor, QualType Type)
 
static OverloadingResult IsInitializerListConstructorConversion (Sema &S, Expr *From, QualType ToType, CXXRecordDecl *To, UserDefinedConversionSequence &User, OverloadCandidateSet &CandidateSet, bool AllowExplicit)
 
static ImplicitConversionSequence::CompareKind compareConversionFunctions (Sema &S, FunctionDecl *Function1, FunctionDecl *Function2)
 Compare the user-defined conversion functions or constructors of two user-defined conversion sequences to determine whether any ordering is possible. More...
 
static bool hasDeprecatedStringLiteralToCharPtrConversion (const ImplicitConversionSequence &ICS)
 
static ImplicitConversionSequence::CompareKind CompareImplicitConversionSequences (Sema &S, SourceLocation Loc, const ImplicitConversionSequence &ICS1, const ImplicitConversionSequence &ICS2)
 CompareImplicitConversionSequences - Compare two implicit conversion sequences to determine whether one is better than the other or if they are indistinguishable (C++ 13.3.3.2). More...
 
static bool hasSimilarType (ASTContext &Context, QualType T1, QualType T2)
 
static ImplicitConversionSequence::CompareKind compareStandardConversionSubsets (ASTContext &Context, const StandardConversionSequence &SCS1, const StandardConversionSequence &SCS2)
 
static bool isBetterReferenceBindingKind (const StandardConversionSequence &SCS1, const StandardConversionSequence &SCS2)
 Determine whether one of the given reference bindings is better than the other based on what kind of bindings they are. More...
 
static bool isTypeValid (QualType T)
 Determine whether the given type is valid, e.g., it is not an invalid C++ class. More...
 
static bool FindConversionForRefInit (Sema &S, ImplicitConversionSequence &ICS, QualType DeclType, SourceLocation DeclLoc, Expr *Init, QualType T2, bool AllowRvalues, bool AllowExplicit)
 Look for a user-defined conversion to a value reference-compatible with DeclType. More...
 
static ImplicitConversionSequence TryReferenceInit (Sema &S, Expr *Init, QualType DeclType, SourceLocation DeclLoc, bool SuppressUserConversions, bool AllowExplicit)
 Compute an implicit conversion sequence for reference initialization. More...
 
static ImplicitConversionSequence TryCopyInitialization (Sema &S, Expr *From, QualType ToType, bool SuppressUserConversions, bool InOverloadResolution, bool AllowObjCWritebackConversion, bool AllowExplicit)
 TryCopyInitialization - Try to copy-initialize a value of type ToType from the expression From. More...
 
static ImplicitConversionSequence TryListConversion (Sema &S, InitListExpr *From, QualType ToType, bool SuppressUserConversions, bool InOverloadResolution, bool AllowObjCWritebackConversion)
 TryListConversion - Try to copy-initialize a value of type ToType from the initializer list From. More...
 
static bool TryCopyInitialization (const CanQualType FromQTy, const CanQualType ToQTy, Sema &S, SourceLocation Loc, ExprValueKind FromVK)
 
static ImplicitConversionSequence TryObjectArgumentInitialization (Sema &S, SourceLocation Loc, QualType FromType, Expr::Classification FromClassification, CXXMethodDecl *Method, CXXRecordDecl *ActingContext)
 TryObjectArgumentInitialization - Try to initialize the object parameter of the given member function (Method) from the expression From. More...
 
static ImplicitConversionSequence TryContextuallyConvertToBool (Sema &S, Expr *From)
 TryContextuallyConvertToBool - Attempt to contextually convert the expression From to bool (C++0x [conv]p3). More...
 
static bool CheckConvertedConstantConversions (Sema &S, StandardConversionSequence &SCS)
 Check that the specified conversion is permitted in a converted constant expression, according to C++11 [expr.const]p3. More...
 
static ExprResult CheckConvertedConstantExpression (Sema &S, Expr *From, QualType T, APValue &Value, Sema::CCEKind CCE, bool RequireInt)
 CheckConvertedConstantExpression - Check that the expression From is a converted constant expression of type T, perform the conversion and produce the converted expression, per C++11 [expr.const]p3. More...
 
static void dropPointerConversion (StandardConversionSequence &SCS)
 dropPointerConversions - If the given standard conversion sequence involves any pointer conversions, remove them. More...
 
static ImplicitConversionSequence TryContextuallyConvertToObjCPointer (Sema &S, Expr *From)
 TryContextuallyConvertToObjCPointer - Attempt to contextually convert the expression From to an Objective-C pointer type. More...
 
static ExprResult diagnoseAmbiguousConversion (Sema &SemaRef, SourceLocation Loc, Expr *From, Sema::ContextualImplicitConverter &Converter, QualType T, UnresolvedSetImpl &ViableConversions)
 
static bool diagnoseNoViableConversion (Sema &SemaRef, SourceLocation Loc, Expr *&From, Sema::ContextualImplicitConverter &Converter, QualType T, bool HadMultipleCandidates, UnresolvedSetImpl &ExplicitConversions)
 
static bool recordConversion (Sema &SemaRef, SourceLocation Loc, Expr *&From, Sema::ContextualImplicitConverter &Converter, QualType T, bool HadMultipleCandidates, DeclAccessPair &Found)
 
static ExprResult finishContextualImplicitConversion (Sema &SemaRef, SourceLocation Loc, Expr *From, Sema::ContextualImplicitConverter &Converter)
 
static void collectViableConversionCandidates (Sema &SemaRef, Expr *From, QualType ToType, UnresolvedSetImpl &ViableConversions, OverloadCandidateSet &CandidateSet)
 
static bool IsAcceptableNonMemberOperatorCandidate (ASTContext &Context, FunctionDecl *Fn, ArrayRef< Expr *> Args)
 IsAcceptableNonMemberOperatorCandidate - Determine whether Fn is an acceptable non-member overloaded operator for a call whose arguments have types T1 (and, if non-empty, T2). More...
 
static SmallVector< EnableIfAttr *, 4 > getOrderedEnableIfAttrs (const FunctionDecl *Function)
 
static bool convertArgsForAvailabilityChecks (Sema &S, FunctionDecl *Function, Expr *ThisArg, ArrayRef< Expr *> Args, Sema::SFINAETrap &Trap, bool MissingImplicitThis, Expr *&ConvertedThis, SmallVectorImpl< Expr *> &ConvertedArgs)
 
template<typename CheckFn >
static bool diagnoseDiagnoseIfAttrsWith (Sema &S, const NamedDecl *ND, bool ArgDependent, SourceLocation Loc, CheckFn &&IsSuccessful)
 
static bool isAllowableExplicitConversion (Sema &S, QualType ConvType, QualType ToType, bool AllowObjCPointerConversion)
 Determine whether this is an allowable conversion from the result of an explicit conversion operator to the expected type, per C++ [over.match.conv]p1 and [over.match.ref]p1. More...
 
static void AddBuiltinAssignmentOperatorCandidates (Sema &S, QualType T, ArrayRef< Expr *> Args, OverloadCandidateSet &CandidateSet)
 Helper function for AddBuiltinOperatorCandidates() that adds the volatile- and non-volatile-qualified assignment operators for the given type to the candidate set. More...
 
static Qualifiers CollectVRQualifiers (ASTContext &Context, Expr *ArgExpr)
 CollectVRQualifiers - This routine returns Volatile/Restrict qualifiers, if any, found in visible type conversion functions found in ArgExpr's type. More...
 
static Comparison compareEnableIfAttrs (const Sema &S, const FunctionDecl *Cand1, const FunctionDecl *Cand2)
 Compares the enable_if attributes of two FunctionDecls, for the purposes of overload resolution. More...
 
static bool isFunctionAlwaysEnabled (const ASTContext &Ctx, const FunctionDecl *FD)
 
static bool checkAddressOfFunctionIsAvailable (Sema &S, const FunctionDecl *FD, bool Complain, bool InOverloadResolution, SourceLocation Loc)
 Returns true if we can take the address of the function. More...
 
static bool checkAddressOfCandidateIsAvailable (Sema &S, const FunctionDecl *FD)
 
static void DiagnoseBadConversion (Sema &S, OverloadCandidate *Cand, unsigned I, bool TakingCandidateAddress)
 
static bool CheckArityMismatch (Sema &S, OverloadCandidate *Cand, unsigned NumArgs)
 Additional arity mismatch diagnosis specific to a function overload candidates. More...
 
static void DiagnoseArityMismatch (Sema &S, NamedDecl *Found, Decl *D, unsigned NumFormalArgs)
 General arity mismatch diagnosis over a candidate in a candidate set. More...
 
static void DiagnoseArityMismatch (Sema &S, OverloadCandidate *Cand, unsigned NumFormalArgs)
 Arity mismatch diagnosis specific to a function overload candidate. More...
 
static TemplateDeclgetDescribedTemplate (Decl *Templated)
 
static void DiagnoseBadDeduction (Sema &S, NamedDecl *Found, Decl *Templated, DeductionFailureInfo &DeductionFailure, unsigned NumArgs, bool TakingCandidateAddress)
 Diagnose a failed template-argument deduction. More...
 
static void DiagnoseBadDeduction (Sema &S, OverloadCandidate *Cand, unsigned NumArgs, bool TakingCandidateAddress)
 Diagnose a failed template-argument deduction, for function calls. More...
 
static void DiagnoseBadTarget (Sema &S, OverloadCandidate *Cand)
 CUDA: diagnose an invalid call across targets. More...
 
static void DiagnoseFailedEnableIfAttr (Sema &S, OverloadCandidate *Cand)
 
static void DiagnoseOpenCLExtensionDisabled (Sema &S, OverloadCandidate *Cand)
 
static void NoteFunctionCandidate (Sema &S, OverloadCandidate *Cand, unsigned NumArgs, bool TakingCandidateAddress)
 Generates a 'note' diagnostic for an overload candidate. More...
 
static void NoteSurrogateCandidate (Sema &S, OverloadCandidate *Cand)
 
static void NoteBuiltinOperatorCandidate (Sema &S, StringRef Opc, SourceLocation OpLoc, OverloadCandidate *Cand)
 
static void NoteAmbiguousUserConversions (Sema &S, SourceLocation OpLoc, OverloadCandidate *Cand)
 
static SourceLocation GetLocationForCandidate (const OverloadCandidate *Cand)
 
static unsigned RankDeductionFailure (const DeductionFailureInfo &DFI)
 
static void CompleteNonViableCandidate (Sema &S, OverloadCandidate *Cand, ArrayRef< Expr *> Args)
 CompleteNonViableCandidate - Normally, overload resolution only computes up to the first bad conversion. More...
 
static SourceLocation GetLocationForCandidate (const TemplateSpecCandidate *Cand)
 
static bool completeFunctionType (Sema &S, FunctionDecl *FD, SourceLocation Loc, bool Complain=true)
 
static void AddOverloadedCallCandidate (Sema &S, DeclAccessPair FoundDecl, TemplateArgumentListInfo *ExplicitTemplateArgs, ArrayRef< Expr *> Args, OverloadCandidateSet &CandidateSet, bool PartialOverloading, bool KnownValid)
 Add a single candidate to the overload set. More...
 
static bool canBeDeclaredInNamespace (const DeclarationName &Name)
 Determine whether a declaration with the specified name could be moved into a different namespace. More...
 
static bool DiagnoseTwoPhaseLookup (Sema &SemaRef, SourceLocation FnLoc, const CXXScopeSpec &SS, LookupResult &R, OverloadCandidateSet::CandidateSetKind CSK, TemplateArgumentListInfo *ExplicitTemplateArgs, ArrayRef< Expr *> Args, bool *DoDiagnoseEmptyLookup=nullptr)
 Attempt to recover from an ill-formed use of a non-dependent name in a template, where the non-dependent name was declared after the template was defined. More...
 
static bool DiagnoseTwoPhaseOperatorLookup (Sema &SemaRef, OverloadedOperatorKind Op, SourceLocation OpLoc, ArrayRef< Expr *> Args)
 Attempt to recover from ill-formed use of a non-dependent operator in a template, where the non-dependent operator was declared after the template was defined. More...
 
static std::unique_ptr< CorrectionCandidateCallbackMakeValidator (Sema &SemaRef, MemberExpr *ME, size_t NumArgs, bool HasTemplateArgs, bool AllowTypoCorrection)
 
static ExprResult BuildRecoveryCallExpr (Sema &SemaRef, Scope *S, Expr *Fn, UnresolvedLookupExpr *ULE, SourceLocation LParenLoc, MutableArrayRef< Expr *> Args, SourceLocation RParenLoc, bool EmptyLookup, bool AllowTypoCorrection)
 Attempts to recover from a call where no functions were found. More...
 
static ExprResult FinishOverloadedCallExpr (Sema &SemaRef, Scope *S, Expr *Fn, UnresolvedLookupExpr *ULE, SourceLocation LParenLoc, MultiExprArg Args, SourceLocation RParenLoc, Expr *ExecConfig, OverloadCandidateSet *CandidateSet, OverloadCandidateSet::iterator *Best, OverloadingResult OverloadResult, bool AllowTypoCorrection)
 FinishOverloadedCallExpr - given an OverloadCandidateSet, builds and returns the completed call expression. More...
 
static void markUnaddressableCandidatesUnviable (Sema &S, OverloadCandidateSet &CS)
 
static bool IsOverloaded (const UnresolvedSetImpl &Functions)
 

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
ft_default 
ft_different_class 
ft_parameter_arity 
ft_parameter_mismatch 
ft_return_type 
ft_qualifer_mismatch 
ft_noexcept 

Definition at line 2696 of file SemaOverload.cpp.

◆ Comparison

enum Comparison
strong

Definition at line 8807 of file SemaOverload.cpp.

◆ OverloadCandidateKind

Definition at line 9204 of file SemaOverload.cpp.

Function Documentation

◆ AddBuiltinAssignmentOperatorCandidates()

static void AddBuiltinAssignmentOperatorCandidates ( Sema S,
QualType  T,
ArrayRef< Expr *>  Args,
OverloadCandidateSet CandidateSet 
)
static

Helper function for AddBuiltinOperatorCandidates() that adds the volatile- and non-volatile-qualified assignment operators for the given type to the candidate set.

Definition at line 7518 of file SemaOverload.cpp.

◆ AddOverloadedCallCandidate()

static void AddOverloadedCallCandidate ( Sema S,
DeclAccessPair  FoundDecl,
TemplateArgumentListInfo ExplicitTemplateArgs,
ArrayRef< Expr *>  Args,
OverloadCandidateSet CandidateSet,
bool  PartialOverloading,
bool  KnownValid 
)
static

Add a single candidate to the overload set.

Definition at line 11376 of file SemaOverload.cpp.

◆ AdoptQualifiers()

static QualType AdoptQualifiers ( ASTContext Context,
QualType  T,
Qualifiers  Qs 
)
static

Adopt the given qualifiers for the given type.

Definition at line 2349 of file SemaOverload.cpp.

◆ BuildRecoveryCallExpr()

static ExprResult BuildRecoveryCallExpr ( Sema SemaRef,
Scope S,
Expr Fn,
UnresolvedLookupExpr ULE,
SourceLocation  LParenLoc,
MutableArrayRef< Expr *>  Args,
SourceLocation  RParenLoc,
bool  EmptyLookup,
bool  AllowTypoCorrection 
)
static

◆ BuildSimilarlyQualifiedPointerType()

static QualType BuildSimilarlyQualifiedPointerType ( const Type FromPtr,
QualType  ToPointee,
QualType  ToType,
ASTContext Context,
bool  StripObjCLifetime = false 
)
static

BuildSimilarlyQualifiedPointerType - In a pointer conversion from the pointer type FromPtr to a pointer to type ToPointee, with the same type qualifiers as FromPtr has on its pointee type.

ToType, if non-empty, will be a pointer to ToType that may or may not have the right set of qualifiers on its pointee.

Conversions to 'id' subsume cv-qualifier conversions.

Definition at line 2141 of file SemaOverload.cpp.

◆ canBeDeclaredInNamespace()

static bool canBeDeclaredInNamespace ( const DeclarationName Name)
static

Determine whether a declaration with the specified name could be moved into a different namespace.

Definition at line 11472 of file SemaOverload.cpp.

◆ checkAddressOfCandidateIsAvailable()

static bool checkAddressOfCandidateIsAvailable ( Sema S,
const FunctionDecl FD 
)
static

Definition at line 9335 of file SemaOverload.cpp.

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

◆ checkAddressOfFunctionIsAvailable()

static bool checkAddressOfFunctionIsAvailable ( Sema S,
const FunctionDecl FD,
bool  Complain,
bool  InOverloadResolution,
SourceLocation  Loc 
)
static

Returns true if we can take the address of the function.

Parameters
Complain- If true, we'll emit a diagnostic
InOverloadResolution- For the purposes of emitting a diagnostic, are we in overload resolution?
Loc- The location of the statement we're complaining about. Ignored if we're not complaining, or if we're in overload resolution.

Definition at line 9300 of file SemaOverload.cpp.

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

◆ checkArgPlaceholdersForOverload()

static bool checkArgPlaceholdersForOverload ( Sema S,
MultiExprArg  Args,
UnbridgedCastsSet &  unbridged 
)
static

checkArgPlaceholdersForOverload - Check a set of call operands for placeholders.

Definition at line 911 of file SemaOverload.cpp.

References checkPlaceholderForOverload().

Referenced by clang::Sema::BuildCallToObjectOfClassType(), and clang::Sema::buildOverloadedCallSet().

◆ CheckArityMismatch()

static bool CheckArityMismatch ( Sema S,
OverloadCandidate Cand,
unsigned  NumArgs 
)
static

Additional arity mismatch diagnosis specific to a function overload candidates.

This is not covered by the more general DiagnoseArityMismatch() over a candidate in any candidate set.

Definition at line 9653 of file SemaOverload.cpp.

◆ CheckConvertedConstantConversions()

static bool CheckConvertedConstantConversions ( Sema S,
StandardConversionSequence SCS 
)
static

◆ CheckConvertedConstantExpression()

static ExprResult CheckConvertedConstantExpression ( Sema S,
Expr From,
QualType  T,
APValue Value,
Sema::CCEKind  CCE,
bool  RequireInt 
)
static

CheckConvertedConstantExpression - Check that the expression From is a converted constant expression of type T, perform the conversion and produce the converted expression, per C++11 [expr.const]p3.

Definition at line 5281 of file SemaOverload.cpp.

References clang::Sema::AA_Converting, clang::UserDefinedConversionSequence::After, clang::ImplicitConversionSequence::AmbiguousConversion, clang::ImplicitConversionSequence::BadConversion, clang::Sema::CCEK_ConstexprIf, CheckConvertedConstantConversions(), checkPlaceholderForOverload(), clang::Sema::Context, clang::Expr::EvalStatus::Diag, clang::Sema::Diag(), clang::Sema::DiagnoseMultipleUserDefinedConversion(), clang::StandardConversionSequence::DirectBinding, clang::ImplicitConversionSequence::EllipsisConversion, clang::ExprError(), clang::ActionResult< PtrTy, CompressInvalid >::get(), clang::APValue::getAsString(), clang::ImplicitConversionSequence::getKind(), clang::Sema::getLangOpts(), clang::Stmt::getLocStart(), clang::StandardConversionSequence::getNarrowingKind(), clang::Stmt::getSourceRange(), clang::Expr::getType(), clang::APValue::isInt(), clang::ActionResult< PtrTy, CompressInvalid >::isInvalid(), clang::Type::isReferenceType(), clang::NK_Constant_Narrowing, clang::NK_Dependent_Narrowing, clang::NK_Not_Narrowing, clang::NK_Type_Narrowing, clang::NK_Variable_Narrowing, clang::Sema::PerformImplicitConversion(), clang::StandardConversionSequence::ReferenceBinding, clang::ImplicitConversionSequence::Standard, clang::ImplicitConversionSequence::StandardConversion, clang::T, TryContextuallyConvertToBool(), TryCopyInitialization(), clang::ImplicitConversionSequence::UserDefined, clang::ImplicitConversionSequence::UserDefinedConversion, and clang::Expr::EvalResult::Val.

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

◆ checkPlaceholderForOverload()

static bool checkPlaceholderForOverload ( Sema S,
Expr *&  E,
UnbridgedCastsSet *  unbridgedCasts = nullptr 
)
static

checkPlaceholderForOverload - Do any interesting placeholder-like preprocessing on the given expression.

Parameters
unbridgedCastsa collection to which to add unbridged casts; without this, they will be immediately diagnosed as errors

Return true on unrecoverable error.

Definition at line 881 of file SemaOverload.cpp.

Referenced by clang::Sema::BuildCallToObjectOfClassType(), clang::Sema::BuildOverloadedArrowExpr(), checkArgPlaceholdersForOverload(), CheckConvertedConstantExpression(), clang::Sema::PerformContextuallyConvertToBool(), and clang::Sema::PerformContextuallyConvertToObjCPointer().

◆ collectViableConversionCandidates()

static void collectViableConversionCandidates ( Sema SemaRef,
Expr From,
QualType  ToType,
UnresolvedSetImpl ViableConversions,
OverloadCandidateSet CandidateSet 
)
static

Definition at line 5597 of file SemaOverload.cpp.

◆ CollectVRQualifiers()

static Qualifiers CollectVRQualifiers ( ASTContext Context,
Expr ArgExpr 
)
static

CollectVRQualifiers - This routine returns Volatile/Restrict qualifiers, if any, found in visible type conversion functions found in ArgExpr's type.

Definition at line 7542 of file SemaOverload.cpp.

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

◆ compareConversionFunctions()

static ImplicitConversionSequence::CompareKind compareConversionFunctions ( Sema S,
FunctionDecl Function1,
FunctionDecl Function2 
)
static

◆ CompareDerivedToBaseConversions()

static ImplicitConversionSequence::CompareKind CompareDerivedToBaseConversions ( Sema S,
SourceLocation  Loc,
const StandardConversionSequence SCS1,
const StandardConversionSequence SCS2 
)
static

◆ compareEnableIfAttrs()

static Comparison compareEnableIfAttrs ( const Sema S,
const FunctionDecl Cand1,
const FunctionDecl Cand2 
)
static

Compares the enable_if attributes of two FunctionDecls, for the purposes of overload resolution.

Cand1's set of enable_if attributes are said to be "better" than Cand2's iff Cand1's first N enable_if attributes have precisely the same conditions as Cand2's first N enable_if attributes (where N = the number of enable_if attributes on Cand2), and Cand1 has more than N enable_if attributes.

Note that you can have a pair of candidates such that Cand1's enable_if attributes are worse than Cand2's, and Cand2's enable_if attributes are worse than Cand1's.

Definition at line 8821 of file SemaOverload.cpp.

◆ CompareImplicitConversionSequences()

static ImplicitConversionSequence::CompareKind CompareImplicitConversionSequences ( Sema S,
SourceLocation  Loc,
const ImplicitConversionSequence ICS1,
const ImplicitConversionSequence ICS2 
)
static

◆ CompareQualificationConversions()

static ImplicitConversionSequence::CompareKind CompareQualificationConversions ( Sema S,
const StandardConversionSequence SCS1,
const StandardConversionSequence SCS2 
)
static

◆ CompareStandardConversionSequences()

static ImplicitConversionSequence::CompareKind CompareStandardConversionSequences ( Sema S,
SourceLocation  Loc,
const StandardConversionSequence SCS1,
const StandardConversionSequence SCS2 
)
static

CompareStandardConversionSequences - Compare two standard conversion sequences to determine whether one is better than the other or if they are indistinguishable (C++ 13.3.3.2p3).

Definition at line 3709 of file SemaOverload.cpp.

References clang::ImplicitConversionSequence::Better, clang::ASTContext::canAssignObjCInterfaces(), CompareDerivedToBaseConversions(), CompareQualificationConversions(), compareStandardConversionSubsets(), clang::Sema::Context, clang::StandardConversionSequence::First, clang::ASTContext::getArrayDecayedType(), clang::Type::getAs(), clang::ASTContext::getCanonicalType(), clang::StandardConversionSequence::getFromType(), clang::Sema::getLangOpts(), clang::Type::getPointeeType(), clang::ASTContext::getQualifiedType(), clang::StandardConversionSequence::getRank(), clang::StandardConversionSequence::getToType(), clang::ASTContext::getTypeSize(), clang::ASTContext::getUnqualifiedArrayType(), clang::QualType::getUnqualifiedType(), clang::ASTContext::hasSameType(), clang::ICK_Array_To_Pointer, clang::ICK_Floating_Integral, clang::ICK_Integral_Conversion, clang::ImplicitConversionSequence::Indistinguishable, isBetterReferenceBindingKind(), clang::Sema::IsDerivedFrom(), clang::QualType::isMoreQualifiedThan(), clang::StandardConversionSequence::isPointerConversionToBool(), clang::StandardConversionSequence::isPointerConversionToVoidPointer(), clang::StandardConversionSequence::ObjCLifetimeConversionBinding, clang::StandardConversionSequence::ReferenceBinding, clang::StandardConversionSequence::Second, and clang::ImplicitConversionSequence::Worse.

Referenced by CompareImplicitConversionSequences().

◆ compareStandardConversionSubsets()

static ImplicitConversionSequence::CompareKind compareStandardConversionSubsets ( ASTContext Context,
const StandardConversionSequence SCS1,
const StandardConversionSequence SCS2 
)
static

Definition at line 3636 of file SemaOverload.cpp.

Referenced by CompareStandardConversionSequences().

◆ completeFunctionType()

static bool completeFunctionType ( Sema S,
FunctionDecl FD,
SourceLocation  Loc,
bool  Complain = true 
)
static

◆ CompleteNonViableCandidate()

static void CompleteNonViableCandidate ( Sema S,
OverloadCandidate Cand,
ArrayRef< Expr *>  Args 
)
static

CompleteNonViableCandidate - Normally, overload resolution only computes up to the first bad conversion.

Produces the FixIt set if possible.

Definition at line 10396 of file SemaOverload.cpp.

◆ convertArgsForAvailabilityChecks()

static bool convertArgsForAvailabilityChecks ( Sema S,
FunctionDecl Function,
Expr ThisArg,
ArrayRef< Expr *>  Args,
Sema::SFINAETrap Trap,
bool  MissingImplicitThis,
Expr *&  ConvertedThis,
SmallVectorImpl< Expr *> &  ConvertedArgs 
)
static

◆ CreateFunctionRefExpr()

static ExprResult CreateFunctionRefExpr ( Sema S,
FunctionDecl Fn,
NamedDecl FoundDecl,
const Expr Base,
bool  HadMultipleCandidates,
SourceLocation  Loc = SourceLocation(),
const DeclarationNameLoc LocInfo = DeclarationNameLoc() 
)
static

A convenience routine for creating a decayed reference to a function.

Definition at line 50 of file SemaOverload.cpp.

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

◆ diagnoseAmbiguousConversion()

static ExprResult diagnoseAmbiguousConversion ( Sema SemaRef,
SourceLocation  Loc,
Expr From,
Sema::ContextualImplicitConverter Converter,
QualType  T,
UnresolvedSetImpl ViableConversions 
)
static

◆ DiagnoseArityMismatch() [1/2]

static void DiagnoseArityMismatch ( Sema S,
NamedDecl Found,
Decl D,
unsigned  NumFormalArgs 
)
static

General arity mismatch diagnosis over a candidate in a candidate set.

Definition at line 9681 of file SemaOverload.cpp.

◆ DiagnoseArityMismatch() [2/2]

static void DiagnoseArityMismatch ( Sema S,
OverloadCandidate Cand,
unsigned  NumFormalArgs 
)
static

Arity mismatch diagnosis specific to a function overload candidate.

Definition at line 9727 of file SemaOverload.cpp.

◆ DiagnoseBadConversion()

static void DiagnoseBadConversion ( Sema S,
OverloadCandidate Cand,
unsigned  I,
bool  TakingCandidateAddress 
)
static

Definition at line 9414 of file SemaOverload.cpp.

◆ DiagnoseBadDeduction() [1/2]

static void DiagnoseBadDeduction ( Sema S,
NamedDecl Found,
Decl Templated,
DeductionFailureInfo DeductionFailure,
unsigned  NumArgs,
bool  TakingCandidateAddress 
)
static

Diagnose a failed template-argument deduction.

Definition at line 9741 of file SemaOverload.cpp.

Referenced by clang::TemplateSpecCandidate::NoteDeductionFailure().

◆ DiagnoseBadDeduction() [2/2]

static void DiagnoseBadDeduction ( Sema S,
OverloadCandidate Cand,
unsigned  NumArgs,
bool  TakingCandidateAddress 
)
static

Diagnose a failed template-argument deduction, for function calls.

Definition at line 9976 of file SemaOverload.cpp.

◆ DiagnoseBadTarget()

static void DiagnoseBadTarget ( Sema S,
OverloadCandidate Cand 
)
static

CUDA: diagnose an invalid call across targets.

Definition at line 9989 of file SemaOverload.cpp.

◆ diagnoseDiagnoseIfAttrsWith()

template<typename CheckFn >
static bool diagnoseDiagnoseIfAttrsWith ( Sema S,
const NamedDecl ND,
bool  ArgDependent,
SourceLocation  Loc,
CheckFn &&  IsSuccessful 
)
static

Definition at line 6271 of file SemaOverload.cpp.

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

◆ DiagnoseFailedEnableIfAttr()

static void DiagnoseFailedEnableIfAttr ( Sema S,
OverloadCandidate Cand 
)
static

Definition at line 10044 of file SemaOverload.cpp.

◆ diagnoseNoViableConversion()

static bool diagnoseNoViableConversion ( Sema SemaRef,
SourceLocation  Loc,
Expr *&  From,
Sema::ContextualImplicitConverter Converter,
QualType  T,
bool  HadMultipleCandidates,
UnresolvedSetImpl ExplicitConversions 
)
static

◆ DiagnoseOpenCLExtensionDisabled()

static void DiagnoseOpenCLExtensionDisabled ( Sema S,
OverloadCandidate Cand 
)
static

Definition at line 10053 of file SemaOverload.cpp.

◆ DiagnoseTwoPhaseLookup()

static bool DiagnoseTwoPhaseLookup ( Sema SemaRef,
SourceLocation  FnLoc,
const CXXScopeSpec SS,
LookupResult R,
OverloadCandidateSet::CandidateSetKind  CSK,
TemplateArgumentListInfo ExplicitTemplateArgs,
ArrayRef< Expr *>  Args,
bool DoDiagnoseEmptyLookup = nullptr 
)
static

Attempt to recover from an ill-formed use of a non-dependent name in a template, where the non-dependent name was declared after the template was defined.

This is common in code written for a compilers which do not correctly implement two-stage name lookup.

Returns true if a viable candidate was found and a diagnostic was issued.

Definition at line 11490 of file SemaOverload.cpp.

References clang::LookupResult::clear(), clang::Sema::CurContext, clang::LookupResult::empty(), clang::DeclContext::getParent(), clang::Sema::inTemplateInstantiation(), clang::CXXScopeSpec::isEmpty(), clang::Sema::LookupQualifiedName(), and clang::LookupResult::suppressDiagnostics().

Referenced by BuildRecoveryCallExpr(), and DiagnoseTwoPhaseOperatorLookup().

◆ DiagnoseTwoPhaseOperatorLookup()

static bool DiagnoseTwoPhaseOperatorLookup ( Sema SemaRef,
OverloadedOperatorKind  Op,
SourceLocation  OpLoc,
ArrayRef< Expr *>  Args 
)
static

Attempt to recover from ill-formed use of a non-dependent operator in a template, where the non-dependent operator was declared after the template was defined.

Returns true if a viable candidate was found and a diagnostic was issued.

Definition at line 11594 of file SemaOverload.cpp.

References clang::Sema::Context, clang::OverloadCandidateSet::CSK_Operator, clang::ASTContext::DeclarationNames, DiagnoseTwoPhaseLookup(), clang::DeclarationNameTable::getCXXOperatorName(), clang::Sema::IsBuildingRecoveryCallExpr, and clang::Sema::LookupOperatorName.

◆ dropPointerConversion()

static void dropPointerConversion ( StandardConversionSequence SCS)
static

dropPointerConversions - If the given standard conversion sequence involves any pointer conversions, remove them.

This may change the result type of the conversion sequence.

Definition at line 5434 of file SemaOverload.cpp.

References clang::ICK_Identity, clang::ICK_Pointer_Conversion, clang::StandardConversionSequence::Second, clang::StandardConversionSequence::Third, and clang::StandardConversionSequence::ToTypePtrs.

Referenced by TryContextuallyConvertToObjCPointer().

◆ FindConversionForRefInit()

static bool FindConversionForRefInit ( Sema S,
ImplicitConversionSequence ICS,
QualType  DeclType,
SourceLocation  DeclLoc,
Expr Init,
QualType  T2,
bool  AllowRvalues,
bool  AllowExplicit 
)
static

Look for a user-defined conversion to a value reference-compatible with DeclType.

Return true if something definite is found.

Definition at line 4308 of file SemaOverload.cpp.

References clang::OverloadCandidateSet::CSK_InitByUserDefinedConversion, clang::Type::getAs(), and clang::Type::isRecordType().

Referenced by TryReferenceInit().

◆ finishContextualImplicitConversion()

static ExprResult finishContextualImplicitConversion ( Sema SemaRef,
SourceLocation  Loc,
Expr From,
Sema::ContextualImplicitConverter Converter 
)
static

◆ FinishOverloadedCallExpr()

static ExprResult FinishOverloadedCallExpr ( Sema SemaRef,
Scope S,
Expr Fn,
UnresolvedLookupExpr ULE,
SourceLocation  LParenLoc,
MultiExprArg  Args,
SourceLocation  RParenLoc,
Expr ExecConfig,
OverloadCandidateSet CandidateSet,
OverloadCandidateSet::iterator Best,
OverloadingResult  OverloadResult,
bool  AllowTypoCorrection 
)
static

◆ functionHasPassObjectSizeParams()

static bool functionHasPassObjectSizeParams ( const FunctionDecl FD)
static

Definition at line 42 of file SemaOverload.cpp.

References P, and clang::FunctionDecl::parameters().

◆ getDescribedTemplate()

static TemplateDecl* getDescribedTemplate ( Decl Templated)
static

◆ GetImplicitConversionName()

static const char* GetImplicitConversionName ( ImplicitConversionKind  Kind)
static

GetImplicitConversionName - Return the name of this kind of implicit conversion.

Definition at line 150 of file SemaOverload.cpp.

Referenced by clang::StandardConversionSequence::dump().

◆ GetLocationForCandidate() [1/2]

static SourceLocation GetLocationForCandidate ( const OverloadCandidate Cand)
static

◆ GetLocationForCandidate() [2/2]

static SourceLocation GetLocationForCandidate ( const TemplateSpecCandidate Cand)
static

◆ getOrderedEnableIfAttrs()

static SmallVector<EnableIfAttr *, 4> getOrderedEnableIfAttrs ( const FunctionDecl Function)
static

Definition at line 6160 of file SemaOverload.cpp.

References clang::Decl::getAttrs(), and clang::Decl::hasAttrs().

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

◆ hasDeprecatedStringLiteralToCharPtrConversion()

static bool hasDeprecatedStringLiteralToCharPtrConversion ( const ImplicitConversionSequence ICS)
static

◆ hasSimilarType()

static bool hasSimilarType ( ASTContext Context,
QualType  T1,
QualType  T2 
)
static

Definition at line 3623 of file SemaOverload.cpp.

◆ IgnoreNarrowingConversion()

static const Expr* IgnoreNarrowingConversion ( const Expr Converted)
static

Skip any implicit casts which could be either part of a narrowing conversion or after one in an implicit conversion.

Definition at line 260 of file SemaOverload.cpp.

Referenced by clang::StandardConversionSequence::getNarrowingKind().

◆ IsAcceptableNonMemberOperatorCandidate()

static bool IsAcceptableNonMemberOperatorCandidate ( ASTContext Context,
FunctionDecl Fn,
ArrayRef< Expr *>  Args 
)
static

IsAcceptableNonMemberOperatorCandidate - Determine whether Fn is an acceptable non-member overloaded operator for a call whose arguments have types T1 (and, if non-empty, T2).

This routine implements the check in C++ [over.match.oper]p3b2 concerning enumeration types.

Definition at line 5831 of file SemaOverload.cpp.

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

◆ isAllowableExplicitConversion()

static bool isAllowableExplicitConversion ( Sema S,
QualType  ConvType,
QualType  ToType,
bool  AllowObjCPointerConversion 
)
static

Determine whether this is an allowable conversion from the result of an explicit conversion operator to the expected type, per C++ [over.match.conv]p1 and [over.match.ref]p1.

Parameters
ConvTypeThe return type of the conversion function.
ToTypeThe type we are converting to.
AllowObjCPointerConversionAllow a conversion from one Objective-C pointer to another.
Returns
true if the conversion is allowable, false otherwise.

Definition at line 6757 of file SemaOverload.cpp.

◆ isBetterReferenceBindingKind()

static bool isBetterReferenceBindingKind ( const StandardConversionSequence SCS1,
const StandardConversionSequence SCS2 
)
static

◆ isFirstArgumentCompatibleWithType()

static bool isFirstArgumentCompatibleWithType ( ASTContext Context,
CXXConstructorDecl Constructor,
QualType  Type 
)
static

◆ isFunctionAlwaysEnabled()

static bool isFunctionAlwaysEnabled ( const ASTContext Ctx,
const FunctionDecl FD 
)
static

Definition at line 9281 of file SemaOverload.cpp.

References clang::Decl::specific_attrs().

◆ IsInitializerListConstructorConversion()

static OverloadingResult IsInitializerListConstructorConversion ( Sema S,
Expr From,
QualType  ToType,
CXXRecordDecl To,
UserDefinedConversionSequence User,
OverloadCandidateSet CandidateSet,
bool  AllowExplicit 
)
static

◆ isNonTrivialObjCLifetimeConversion()

static bool isNonTrivialObjCLifetimeConversion ( Qualifiers  FromQuals,
Qualifiers  ToQuals 
)
static

Determine whether the lifetime conversion between the two given qualifiers sets is nontrivial.

Definition at line 3034 of file SemaOverload.cpp.

References clang::Qualifiers::getObjCLifetime(), clang::Qualifiers::hasConst(), and clang::Qualifiers::OCL_ExplicitNone.

◆ isNullPointerConstantForConversion()

static bool isNullPointerConstantForConversion ( Expr Expr,
bool  InOverloadResolution,
ASTContext Context 
)
static

Definition at line 2183 of file SemaOverload.cpp.

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

◆ IsOverloaded()

static bool IsOverloaded ( const UnresolvedSetImpl Functions)
static

◆ IsStandardConversion()

static bool IsStandardConversion ( Sema S,
Expr From,
QualType  ToType,
bool  InOverloadResolution,
StandardConversionSequence SCS,
bool  CStyle,
bool  AllowObjCWritebackConversion 
)
static

IsStandardConversion - Determines whether there is a standard conversion sequence (C++ [conv], C++ [over.ics.scs]) from the expression From to the type ToType.

Standard conversion sequences only consider non-class types; for conversions that involve class types, use TryImplicitConversion. If a conversion exists, SCS will contain the standard conversion sequence required to perform this conversion and this routine will return true. Otherwise, this routine will return false and the value of SCS is unspecified.

Definition at line 1572 of file SemaOverload.cpp.

References clang::ASTContext::BoolTy, clang::Sema::checkAddressOfFunctionIsAvailable(), clang::Sema::CheckSingleAssignmentConstraints(), clang::Sema::Compatible, clang::Sema::CompatiblePointerDiscardsQualifiers, clang::Sema::Context, clang::StandardConversionSequence::CopyConstructor, clang::StandardConversionSequence::DeprecatedStringLiteralToCharPtr, clang::Expr::EvaluateKnownConstInt(), clang::Sema::ExtractUnqualifiedFunctionType(), clang::StandardConversionSequence::First, clang::Sema::FixOverloadedFunctionReference(), clang::ASTContext::Float128Ty, clang::ASTContext::getArrayDecayedType(), clang::Type::getAs(), clang::Sema::getASTContext(), clang::ASTContext::getCanonicalType(), clang::ASTContext::getFloatTypeSemantics(), clang::Sema::getLangOpts(), clang::QualType::getLocalQualifiers(), clang::QualType::getLocalUnqualifiedType(), clang::ASTContext::getMemberPointerType(), IteratorComparison::getOpcode(), clang::CXXMethodDecl::getParent(), clang::ASTContext::getPointerType(), clang::Expr::getType(), clang::ValueDecl::getType(), clang::ASTContext::getTypeDeclType(), clang::QualType::getUnqualifiedType(), clang::ASTContext::hasSameType(), clang::ASTContext::hasSameUnqualifiedType(), clang::ICK_Array_To_Pointer, clang::ICK_Block_Pointer_Conversion, clang::ICK_Boolean_Conversion, clang::ICK_C_Only_Conversion, clang::ICK_Compatible_Conversion, clang::ICK_Complex_Conversion, clang::ICK_Complex_Promotion, clang::ICK_Complex_Real, clang::ICK_Floating_Conversion, clang::ICK_Floating_Integral, clang::ICK_Floating_Promotion, clang::ICK_Function_Conversion, clang::ICK_Function_To_Pointer, clang::ICK_Identity, clang::ICK_Incompatible_Pointer_Conversion, clang::ICK_Integral_Conversion, clang::ICK_Integral_Promotion, clang::ICK_Lvalue_To_Rvalue, clang::ICK_Pointer_Conversion, clang::ICK_Pointer_Member, clang::ICK_Qualification, clang::ICK_TransparentUnionConversion, clang::ICK_Writeback_Conversion, clang::ICK_Zero_Event_Conversion, clang::ICK_Zero_Queue_Conversion, clang::Expr::IgnoreParenCasts(), clang::Expr::IgnoreParens(), clang::StandardConversionSequence::IncompatibleObjC, clang::Sema::IncompatiblePointer, clang::Sema::IncompatiblePointerSign, clang::Type::isAnyComplexType(), clang::Type::isAnyPointerType(), clang::Type::isArithmeticType(), clang::Type::isArrayType(), clang::Sema::IsBlockPointerConversion(), clang::Type::isBlockPointerType(), clang::Type::isBooleanType(), clang::Sema::IsComplexPromotion(), clang::Type::isEventT(), clang::Sema::IsFloatingPointPromotion(), clang::Sema::IsFunctionConversion(), clang::Type::isFunctionType(), clang::Expr::isGLValue(), clang::Expr::isIntegerConstantExpr(), clang::Type::isIntegralOrUnscopedEnumerationType(), clang::Sema::IsIntegralPromotion(), clang::Type::isIntegralType(), clang::Sema::IsMemberPointerConversion(), clang::Type::isMemberPointerType(), clang::Type::isNullPtrType(), clang::Sema::isObjCWritebackConversion(), clang::Sema::IsPointerConversion(), clang::Sema::IsQualificationConversion(), clang::Type::isQueueT(), clang::Type::isRealFloatingType(), clang::Type::isRecordType(), clang::CXXMethodDecl::isStatic(), clang::Sema::IsStringLiteralToNonConstPointerConversion(), IsTransparentUnionStandardConversion(), IsVectorConversion(), clang::ASTContext::LongDoubleTy, clang::ASTContext::OverloadTy, clang::StandardConversionSequence::QualificationIncludesObjCLifetime, clang::Sema::ResolveAddressOfOverloadedFunction(), clang::StandardConversionSequence::Second, clang::StandardConversionSequence::setAllToTypes(), clang::StandardConversionSequence::setAsIdentityConversion(), clang::StandardConversionSequence::setFromType(), clang::StandardConversionSequence::setToType(), clang::StandardConversionSequence::Third, tryAtomicConversion(), and clang::ASTContext::typesAreCompatible().

Referenced by IsTransparentUnionStandardConversion(), tryAtomicConversion(), and TryImplicitConversion().

◆ IsTransparentUnionStandardConversion()

static bool IsTransparentUnionStandardConversion ( Sema S,
Expr From,
QualType ToType,
bool  InOverloadResolution,
StandardConversionSequence SCS,
bool  CStyle 
)
static

◆ isTypeValid()

static bool isTypeValid ( QualType  T)
static

Determine whether the given type is valid, e.g., it is not an invalid C++ class.

Definition at line 4204 of file SemaOverload.cpp.

References clang::Type::getAsCXXRecordDecl().

◆ IsUserDefinedConversion()

static OverloadingResult IsUserDefinedConversion ( Sema S,
Expr From,
QualType  ToType,
UserDefinedConversionSequence User,
OverloadCandidateSet CandidateSet,
bool  AllowExplicit,
bool  AllowObjCConversionOnExplicit 
)
static

Determines whether there is a user-defined conversion sequence (C++ [over.ics.user]) that converts expression From to the type ToType.

If such a conversion exists, User will contain the user-defined conversion sequence that performs such a conversion and this routine will return true. Otherwise, this routine returns false and User is unspecified.

Parameters
AllowExplicittrue if the conversion should consider C++0x "explicit" conversion functions as well as non-explicit conversion functions (C++0x [class.conv.fct]p2).
AllowObjCConversionOnExplicittrue if the conversion should allow an extra Objective-C pointer conversion on uses of explicit constructors. Requires AllowExplicit to also be set.

Definition at line 3249 of file SemaOverload.cpp.

References clang::Sema::AddOverloadCandidate(), clang::Sema::AddTemplateOverloadCandidate(), clang::OverloadCandidateSet::clear(), clang::Sema::Context, clang::OverloadCandidateSet::CSK_InitByUserDefinedConversion, clang::Type::getAs(), clang::getConstructorInfo(), clang::Expr::getExprLoc(), clang::Stmt::getLocStart(), clang::Expr::getType(), clang::ASTContext::hasSameUnqualifiedType(), clang::Sema::isCompleteType(), clang::Sema::IsDerivedFrom(), isFirstArgumentCompatibleWithType(), IsInitializerListConstructorConversion(), clang::Sema::LookupConstructors(), and clang::OR_No_Viable_Function.

Referenced by clang::Sema::DiagnoseMultipleUserDefinedConversion(), and TryUserDefinedConversion().

◆ IsVectorConversion()

static bool IsVectorConversion ( Sema S,
QualType  FromType,
QualType  ToType,
ImplicitConversionKind ICK 
)
static

Determine whether the conversion from FromType to ToType is a valid vector conversion.

Parameters
ICKWill be set to the vector conversion kind, if this is a vector conversion.

Definition at line 1519 of file SemaOverload.cpp.

References clang::ASTContext::areCompatibleVectorTypes(), clang::Sema::Context, clang::ASTContext::hasSameUnqualifiedType(), clang::ICK_Vector_Conversion, clang::ICK_Vector_Splat, clang::Type::isArithmeticType(), clang::Type::isExtVectorType(), clang::Sema::isLaxVectorConversion(), clang::Type::isVectorType(), and tryAtomicConversion().

Referenced by IsStandardConversion().

◆ MakeValidator()

static std::unique_ptr<CorrectionCandidateCallback> MakeValidator ( Sema SemaRef,
MemberExpr ME,
size_t  NumArgs,
bool  HasTemplateArgs,
bool  AllowTypoCorrection 
)
static

Definition at line 11622 of file SemaOverload.cpp.

Referenced by BuildRecoveryCallExpr().

◆ markUnaddressableCandidatesUnviable()

static void markUnaddressableCandidatesUnviable ( Sema S,
OverloadCandidateSet CS 
)
static

Definition at line 11859 of file SemaOverload.cpp.

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

◆ NoteAmbiguousUserConversions()

static void NoteAmbiguousUserConversions ( Sema S,
SourceLocation  OpLoc,
OverloadCandidate Cand 
)
static

Definition at line 10210 of file SemaOverload.cpp.

◆ NoteBuiltinOperatorCandidate()

static void NoteBuiltinOperatorCandidate ( Sema S,
StringRef  Opc,
SourceLocation  OpLoc,
OverloadCandidate Cand 
)
static

Definition at line 10191 of file SemaOverload.cpp.

◆ NoteFunctionCandidate()

static void NoteFunctionCandidate ( Sema S,
OverloadCandidate Cand,
unsigned  NumArgs,
bool  TakingCandidateAddress 
)
static

Generates a 'note' diagnostic for an overload candidate.

We've already generated a primary error at the call site.

It really does need to be a single diagnostic with its caret pointed at the candidate declaration. Yes, this creates some major challenges of technical writing. Yes, this makes pointing out problems with specific arguments quite awkward. It's still better than generating twenty screens of text for every failed overload.

It would be great to be able to express per-candidate problems more richly for those diagnostic clients that cared, but we'd still have to be just as careful with the default diagnostics.

Definition at line 10073 of file SemaOverload.cpp.

◆ NoteSurrogateCandidate()

static void NoteSurrogateCandidate ( Sema S,
OverloadCandidate Cand 
)
static

Definition at line 10159 of file SemaOverload.cpp.

◆ RankDeductionFailure()

static unsigned RankDeductionFailure ( const DeductionFailureInfo DFI)
static

◆ recordConversion()

static bool recordConversion ( Sema SemaRef,
SourceLocation  Loc,
Expr *&  From,
Sema::ContextualImplicitConverter Converter,
QualType  T,
bool  HadMultipleCandidates,
DeclAccessPair Found 
)
static

◆ tryAtomicConversion()

static bool tryAtomicConversion ( Sema S,
Expr From,
QualType  ToType,
bool  InOverloadResolution,
StandardConversionSequence SCS,
bool  CStyle 
)
static

  • Determine whether this is a conversion from a scalar type to an atomic type.

If successful, updates SCS's second and third steps in the conversion sequence to finish the conversion.

Definition at line 3137 of file SemaOverload.cpp.

References clang::Type::getAs(), clang::AtomicType::getValueType(), IsStandardConversion(), clang::StandardConversionSequence::QualificationIncludesObjCLifetime, clang::StandardConversionSequence::Second, clang::StandardConversionSequence::setToType(), and clang::StandardConversionSequence::Third.

Referenced by IsStandardConversion(), and IsVectorConversion().

◆ TryContextuallyConvertToBool()

static ImplicitConversionSequence TryContextuallyConvertToBool ( Sema S,
Expr From 
)
static

TryContextuallyConvertToBool - Attempt to contextually convert the expression From to bool (C++0x [conv]p3).

Definition at line 5185 of file SemaOverload.cpp.

References clang::ASTContext::BoolTy, clang::Sema::Context, and TryImplicitConversion().

Referenced by CheckConvertedConstantExpression(), and clang::Sema::PerformContextuallyConvertToBool().

◆ TryContextuallyConvertToObjCPointer()

static ImplicitConversionSequence TryContextuallyConvertToObjCPointer ( Sema S,
Expr From 
)
static

◆ TryCopyInitialization() [1/2]

static ImplicitConversionSequence TryCopyInitialization ( Sema S,
Expr From,
QualType  ToType,
bool  SuppressUserConversions,
bool  InOverloadResolution,
bool  AllowObjCWritebackConversion,
bool  AllowExplicit 
)
static

TryCopyInitialization - Try to copy-initialize a value of type ToType from the expression From.

Return the implicit conversion sequence required to pass this argument, which may be a bad conversion sequence (meaning that the argument cannot be passed to a parameter of this type). If SuppressUserConversions, then we do not permit any user-defined conversion sequences.

Definition at line 4970 of file SemaOverload.cpp.

References clang::Stmt::getLocStart(), clang::Type::isReferenceType(), TryImplicitConversion(), TryListConversion(), and TryReferenceInit().

Referenced by CheckConvertedConstantExpression(), TryCopyInitialization(), TryListConversion(), and TryReferenceInit().

◆ TryCopyInitialization() [2/2]

static bool TryCopyInitialization ( const CanQualType  FromQTy,
const CanQualType  ToQTy,
Sema S,
SourceLocation  Loc,
ExprValueKind  FromVK 
)
static

◆ tryGetFunctionProtoType()

static const FunctionProtoType* tryGetFunctionProtoType ( QualType  FromType)
static

Attempts to get the FunctionProtoType from a Type.

Handles MemberFunctionPointers properly.

Definition at line 2708 of file SemaOverload.cpp.

References clang::Type::getAs(), and clang::Type::getPointeeType().

◆ TryImplicitConversion()

static ImplicitConversionSequence TryImplicitConversion ( Sema S,
Expr From,
QualType  ToType,
bool  SuppressUserConversions,
bool  AllowExplicit,
bool  InOverloadResolution,
bool  CStyle,
bool  AllowObjCWritebackConversion,
bool  AllowObjCConversionOnExplicit 
)
static

TryImplicitConversion - Attempt to perform an implicit conversion from the given expression (Expr) to the given type (ToType).

This function returns an implicit conversion sequence that can be used to perform the initialization. Given

void f(float f); void g(int i) { f(i); }

this routine would produce an implicit conversion sequence to describe the initialization of f from i, which will be a standard conversion sequence containing an lvalue-to-rvalue conversion (C++ 4.1) followed by a floating-integral conversion (C++ 4.9). Note that this routine only determines how the conversion can be performed; it does not actually perform the conversion. As such, it will not produce any diagnostics if no conversion is available, but will instead return an implicit conversion sequence of kind "BadConversion".

If SuppressUserConversions, then user-defined conversions are not permitted. If AllowExplicit, then explicit user-defined conversions are permitted.

Parameters
AllowObjCWritebackConversionWhether we allow the Objective-C writeback conversion, which allows __autoreleasing id* parameters to be initialized with __strong id* or __weak id* arguments.

Definition at line 1311 of file SemaOverload.cpp.

References clang::Sema::Context, clang::StandardConversionSequence::CopyConstructor, clang::Type::getAs(), clang::Sema::getLangOpts(), clang::Stmt::getLocStart(), clang::Expr::getType(), clang::ASTContext::hasSameUnqualifiedType(), clang::ICK_Derived_To_Base, clang::Sema::IsDerivedFrom(), IsStandardConversion(), clang::BadConversionSequence::no_conversion, clang::StandardConversionSequence::Second, clang::StandardConversionSequence::setAllToTypes(), clang::StandardConversionSequence::setAsIdentityConversion(), clang::ImplicitConversionSequence::setBad(), clang::StandardConversionSequence::setFromType(), clang::ImplicitConversionSequence::setStandard(), clang::ImplicitConversionSequence::Standard, and TryUserDefinedConversion().

Referenced by clang::Sema::CheckSingleAssignmentConstraints(), TryContextuallyConvertToBool(), TryContextuallyConvertToObjCPointer(), TryCopyInitialization(), clang::Sema::TryImplicitConversion(), and TryReferenceInit().

◆ TryListConversion()

static ImplicitConversionSequence TryListConversion ( Sema S,
InitListExpr From,
QualType  ToType,
bool  SuppressUserConversions,
bool  InOverloadResolution,
bool  AllowObjCWritebackConversion 
)
static

TryListConversion - Try to copy-initialize a value of type ToType from the initializer list From.

Definition at line 4712 of file SemaOverload.cpp.

References clang::UserDefinedConversionSequence::After, clang::UserDefinedConversionSequence::Before, clang::StandardConversionSequence::BindsImplicitObjectArgumentWithoutRefQualifier, clang::StandardConversionSequence::BindsToFunctionLvalue, clang::StandardConversionSequence::BindsToRvalue, clang::Sema::CanPerformCopyInitialization(), CompareImplicitConversionSequences(), clang::Sema::CompareReferenceRelationship(), clang::Sema::Context, clang::UserDefinedConversionSequence::ConversionFunction, clang::Type::getAs(), clang::ASTContext::getAsArrayType(), clang::ASTContext::getCanonicalType(), clang::ArrayType::getElementType(), clang::InitListExpr::getInit(), clang::InitListExpr::getLocStart(), clang::InitListExpr::getNumInits(), clang::Expr::getType(), clang::ValueDecl::getType(), clang::ASTContext::hasSameUnqualifiedType(), clang::InitializedEntity::InitializeParameter(), clang::Type::isAggregateType(), clang::Type::isArrayType(), clang::ImplicitConversionSequence::isBad(), clang::Sema::isCompleteType(), clang::QualType::isConstQualified(), clang::Sema::IsDerivedFrom(), clang::StandardConversionSequence::IsLvalueReference, clang::Type::isLValueReferenceType(), clang::QualType::isNull(), clang::Type::isRecordType(), clang::Type::isReferenceType(), clang::Type::isRValueReferenceType(), clang::Sema::isStdInitializerList(), clang::QualType::isVolatileQualified(), clang::BadConversionSequence::lvalue_ref_to_rvalue, clang::BadConversionSequence::no_conversion, clang::StandardConversionSequence::ObjCLifetimeConversionBinding, clang::ASTContext::OverloadTy, clang::Sema::Ref_Related, clang::StandardConversionSequence::ReferenceBinding, clang::Sema::ResolveAddressOfOverloadedFunction(), clang::StandardConversionSequence::setAllToTypes(), clang::StandardConversionSequence::setAsIdentityConversion(), clang::ImplicitConversionSequence::setBad(), clang::StandardConversionSequence::setFromType(), clang::ImplicitConversionSequence::setStandard(), clang::ImplicitConversionSequence::setStdInitializerListElement(), clang::ImplicitConversionSequence::setUserDefined(), clang::ImplicitConversionSequence::Standard, TryCopyInitialization(), TryReferenceInit(), TryUserDefinedConversion(), clang::ImplicitConversionSequence::UserDefined, clang::ImplicitConversionSequence::Worse, and X.

Referenced by TryCopyInitialization().

◆ TryObjectArgumentInitialization()

static ImplicitConversionSequence TryObjectArgumentInitialization ( Sema S,
SourceLocation  Loc,
QualType  FromType,
Expr::Classification  FromClassification,
CXXMethodDecl Method,
CXXRecordDecl ActingContext 
)
static

TryObjectArgumentInitialization - Try to initialize the object parameter of the given member function (Method) from the expression From.

Definition at line 5010 of file SemaOverload.cpp.

References clang::BadConversionSequence::bad_qualifiers, clang::StandardConversionSequence::BindsImplicitObjectArgumentWithoutRefQualifier, clang::StandardConversionSequence::BindsToFunctionLvalue, clang::StandardConversionSequence::BindsToRvalue, clang::Qualifiers::Const, clang::Sema::Context, clang::StandardConversionSequence::DirectBinding, clang::Type::getAs(), clang::ASTContext::getCanonicalType(), clang::ASTContext::getCVRQualifiedType(), clang::QualType::getCVRQualifiers(), clang::QualType::getLocalUnqualifiedType(), clang::Type::getPointeeType(), clang::CXXMethodDecl::getRefQualifier(), clang::ASTContext::getTypeDeclType(), clang::CXXMethodDecl::getTypeQualifiers(), clang::ICK_Derived_To_Base, clang::ICK_Identity, clang::QualType::isAtLeastAsQualifiedAs(), clang::Sema::IsDerivedFrom(), clang::Expr::Classification::isLValue(), clang::StandardConversionSequence::IsLvalueReference, clang::Type::isRecordType(), clang::Expr::Classification::isRValue(), clang::BadConversionSequence::lvalue_ref_to_rvalue, clang::StandardConversionSequence::ReferenceBinding, clang::RQ_LValue, clang::RQ_None, clang::RQ_RValue, clang::BadConversionSequence::rvalue_ref_to_lvalue, clang::StandardConversionSequence::Second, clang::StandardConversionSequence::setAllToTypes(), clang::StandardConversionSequence::setAsIdentityConversion(), clang::ImplicitConversionSequence::setBad(), clang::StandardConversionSequence::setFromType(), clang::ImplicitConversionSequence::setStandard(), clang::ImplicitConversionSequence::Standard, clang::BadConversionSequence::unrelated_class, and clang::Qualifiers::Volatile.

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

◆ TryReferenceInit()

static ImplicitConversionSequence TryReferenceInit ( Sema S,
Expr Init,
QualType  DeclType,
SourceLocation  DeclLoc,
bool  SuppressUserConversions,
bool  AllowExplicit 
)
static

Compute an implicit conversion sequence for reference initialization.

Definition at line 4435 of file SemaOverload.cpp.

References clang::Expr::Classify(), clang::Sema::CompareReferenceRelationship(), clang::Qualifiers::compatiblyIncludes(), clang::Sema::Context, FindConversionForRefInit(), clang::Type::getAs(), clang::QualType::getAsOpaquePtr(), clang::ASTContext::getCanonicalType(), clang::Sema::getLangOpts(), clang::QualType::getQualifiers(), clang::Expr::getType(), clang::ValueDecl::getType(), clang::ICK_Compatible_Conversion, clang::ICK_Derived_To_Base, clang::ICK_Identity, clang::ICK_Lvalue_To_Rvalue, clang::Type::isArrayType(), clang::Sema::isCompleteType(), clang::QualType::isConstQualified(), clang::Type::isFunctionType(), clang::Expr::Classification::isLValue(), clang::Expr::Classification::isPRValue(), clang::Type::isRecordType(), clang::Type::isReferenceType(), clang::Expr::Classification::isRValue(), clang::Type::isRValueReferenceType(), clang::QualType::isVolatileQualified(), clang::Expr::Classification::isXValue(), clang::BadConversionSequence::lvalue_ref_to_rvalue, clang::BadConversionSequence::no_conversion, clang::ASTContext::OverloadTy, clang::Sema::Ref_Compatible, clang::Sema::Ref_Incompatible, clang::Sema::Ref_Related, clang::Qualifiers::removeObjCGCAttr(), clang::Qualifiers::removeObjCLifetime(), clang::Qualifiers::removeUnaligned(), clang::Sema::ResolveAddressOfOverloadedFunction(), clang::ImplicitConversionSequence::setBad(), TryCopyInitialization(), and TryImplicitConversion().

Referenced by TryCopyInitialization(), and TryListConversion().

◆ TryUserDefinedConversion()

static ImplicitConversionSequence TryUserDefinedConversion ( Sema S,
Expr From,
QualType  ToType,
bool  SuppressUserConversions,
bool  AllowExplicit,
bool  InOverloadResolution,
bool  CStyle,
bool  AllowObjCWritebackConversion,
bool  AllowObjCConversionOnExplicit 
)
static

Tries a user-defined conversion from From to ToType.

Produces an implicit conversion sequence for when a standard conversion is not an option. See TryImplicitConversion for more information.

Definition at line 1208 of file SemaOverload.cpp.

References clang::AmbiguousConversionSequence::addConversion(), clang::ImplicitConversionSequence::Ambiguous, clang::OverloadCandidateSet::begin(), clang::Sema::Context, clang::UserDefinedConversionSequence::ConversionFunction, clang::StandardConversionSequence::CopyConstructor, clang::OverloadCandidateSet::CSK_Normal, clang::OverloadCandidateSet::end(), clang::UserDefinedConversionSequence::FoundConversionFunction, clang::StandardConversionSequence::FoundCopyConstructor, clang::ASTContext::getCanonicalType(), clang::Expr::getExprLoc(), clang::Stmt::getLocStart(), clang::Expr::getType(), clang::CanQual< T >::getUnqualifiedType(), clang::QualType::getUnqualifiedType(), clang::ICK_Derived_To_Base, clang::Sema::IsDerivedFrom(), IsUserDefinedConversion(), clang::BadConversionSequence::no_conversion, clang::OR_Ambiguous, clang::OR_Deleted, clang::OR_No_Viable_Function, clang::OR_Success, clang::StandardConversionSequence::Second, clang::StandardConversionSequence::setAllToTypes(), clang::ImplicitConversionSequence::setAmbiguous(), clang::StandardConversionSequence::setAsIdentityConversion(), clang::ImplicitConversionSequence::setBad(), clang::StandardConversionSequence::setFromType(), clang::AmbiguousConversionSequence::setFromType(), clang::ImplicitConversionSequence::setStandard(), clang::AmbiguousConversionSequence::setToType(), clang::ImplicitConversionSequence::setUserDefined(), clang::ImplicitConversionSequence::Standard, and clang::ImplicitConversionSequence::UserDefined.

Referenced by TryImplicitConversion(), and TryListConversion().