clang
3.7.0
|
#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/STLExtras.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/SmallString.h"
#include <algorithm>
#include <cstdlib>
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 } |
enum | OverloadCandidateKind |
anonymous enum |
Enumerator | |
---|---|
ft_default | |
ft_different_class | |
ft_parameter_arity | |
ft_parameter_mismatch | |
ft_return_type | |
ft_qualifer_mismatch |
Definition at line 2461 of file SemaOverload.cpp.
Definition at line 8536 of file SemaOverload.cpp.
|
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 6952 of file SemaOverload.cpp.
References clang::Sema::AddBuiltinCandidate(), clang::Sema::Context, clang::ASTContext::getCanonicalType(), clang::ASTContext::getLValueReferenceType(), clang::ASTContext::getVolatileType(), and clang::CanQual< T >::isVolatileQualified().
|
static |
Add a single candidate to the overload set.
Definition at line 10380 of file SemaOverload.cpp.
References clang::Sema::AddOverloadCandidate(), clang::Sema::AddTemplateOverloadCandidate(), and clang::DeclAccessPair::getDecl().
Referenced by clang::Sema::AddOverloadedCallCandidates(), and DiagnoseTwoPhaseLookup().
|
static |
Adopt the given qualifiers for the given type.
Definition at line 2117 of file SemaOverload.cpp.
References clang::Qualifiers::compatiblyIncludes(), clang::ASTContext::getQualifiedType(), clang::QualType::getQualifiers(), and clang::QualType::getUnqualifiedType().
Referenced by clang::Sema::isObjCPointerConversion().
|
static |
Attempts to recover from a call where no functions were found.
Returns true if new candidates were found.
Definition at line 10634 of file SemaOverload.cpp.
References clang::Sema::ActOnCallExpr(), clang::CXXScopeSpec::Adopt(), clang::Sema::BuildDeclarationNameExpr(), clang::Sema::BuildPossibleImplicitMemberExpr(), clang::Sema::BuildTemplateIdExpr(), clang::OverloadExpr::copyTemplateArgumentsInto(), clang::OverloadCandidateSet::CSK_Normal, clang::Sema::DiagnoseEmptyLookup(), DiagnoseTwoPhaseLookup(), clang::ExprError(), clang::Expr::getExprLoc(), clang::OverloadExpr::getName(), clang::OverloadExpr::getNameLoc(), clang::OverloadExpr::getQualifierLoc(), clang::OverloadExpr::getTemplateKeywordLoc(), clang::OverloadExpr::hasExplicitTemplateArgs(), clang::Sema::IsBuildingRecoveryCallExpr, clang::SourceLocation::isValid(), clang::Sema::LookupOrdinaryName, and MakeValidator().
Referenced by FinishOverloadedCallExpr().
|
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 1908 of file SemaOverload.cpp.
References clang::ASTContext::getCanonicalType(), clang::QualType::getLocalQualifiers(), clang::QualType::getLocalUnqualifiedType(), clang::ASTContext::getObjCObjectPointerType(), clang::Type::getPointeeType(), clang::ASTContext::getPointerType(), clang::ASTContext::getQualifiedType(), clang::QualType::getQualifiers(), clang::Type::getTypeClass(), clang::QualType::getUnqualifiedType(), clang::QualType::isNull(), clang::Type::isObjCIdType(), clang::Type::isObjCQualifiedIdType(), and clang::Qualifiers::removeObjCLifetime().
Referenced by clang::Sema::isObjCPointerConversion(), and clang::Sema::IsPointerConversion().
|
static |
Determine whether a declaration with the specified name could be moved into a different namespace.
Definition at line 10472 of file SemaOverload.cpp.
References clang::DeclarationName::getCXXOverloadedOperator().
Referenced by DiagnoseTwoPhaseLookup().
|
static |
checkArgPlaceholdersForOverload - Check a set of call operands for placeholders.
Definition at line 837 of file SemaOverload.cpp.
References checkPlaceholderForOverload().
Referenced by clang::Sema::BuildCallToMemberFunction(), clang::Sema::BuildCallToObjectOfClassType(), and clang::Sema::buildOverloadedCallSet().
|
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 8887 of file SemaOverload.cpp.
References clang::DeclarationName::CXXOperatorName, clang::OverloadCandidate::DeductionFailure, clang::OverloadCandidate::FailureKind, clang::OverloadCandidate::Function, clang::NamedDecl::getDeclName(), clang::FunctionDecl::getMinRequiredArguments(), clang::DeclarationName::getNameKind(), clang::Decl::isInvalidDecl(), clang::ovl_fail_bad_deduction, clang::ovl_fail_too_few_arguments, clang::ovl_fail_too_many_arguments, clang::DeductionFailureInfo::Result, clang::Sema::TDK_TooFewArguments, and clang::Sema::TDK_TooManyArguments.
Referenced by DiagnoseArityMismatch(), and DiagnoseBadDeduction().
|
static |
Check that the specified conversion is permitted in a converted constant expression, according to C++11 [expr.const]p3. Return true if the conversion is acceptable.
Definition at line 4929 of file SemaOverload.cpp.
References clang::StandardConversionSequence::getFromType(), clang::StandardConversionSequence::getToType(), clang::ICK_Array_To_Pointer, clang::ICK_Block_Pointer_Conversion, clang::ICK_Boolean_Conversion, clang::ICK_Compatible_Conversion, clang::ICK_Complex_Conversion, clang::ICK_Complex_Promotion, clang::ICK_Complex_Real, clang::ICK_Derived_To_Base, clang::ICK_Floating_Conversion, clang::ICK_Floating_Integral, clang::ICK_Floating_Promotion, clang::ICK_Function_To_Pointer, clang::ICK_Identity, clang::ICK_Integral_Conversion, clang::ICK_Integral_Promotion, clang::ICK_Lvalue_To_Rvalue, clang::ICK_NoReturn_Adjustment, clang::ICK_Num_Conversion_Kinds, clang::ICK_Pointer_Conversion, clang::ICK_Pointer_Member, clang::ICK_Qualification, clang::ICK_TransparentUnionConversion, clang::ICK_Vector_Conversion, clang::ICK_Vector_Splat, clang::ICK_Writeback_Conversion, clang::ICK_Zero_Event_Conversion, clang::Type::isBooleanType(), clang::Type::isIntegralOrUnscopedEnumerationType(), clang::Type::isNullPtrType(), and clang::StandardConversionSequence::Second.
Referenced by CheckConvertedConstantExpression().
|
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 4992 of file SemaOverload.cpp.
References clang::Sema::AA_Converting, clang::UserDefinedConversionSequence::After, clang::ImplicitConversionSequence::AmbiguousConversion, clang::ImplicitConversionSequence::BadConversion, CheckConvertedConstantConversions(), checkPlaceholderForOverload(), clang::Sema::Context, clang::Expr::EvalStatus::Diag, clang::Sema::Diag(), clang::Sema::DiagnoseMultipleUserDefinedConversion(), clang::StandardConversionSequence::DirectBinding, clang::ImplicitConversionSequence::EllipsisConversion, clang::Expr::EvaluateAsLValue(), clang::Expr::EvaluateAsRValue(), clang::ExprError(), clang::ActionResult< PtrTy, CompressInvalid >::get(), clang::APValue::getAsString(), clang::ImplicitConversionSequence::getKind(), clang::Sema::getLangOpts(), clang::StandardConversionSequence::getNarrowingKind(), clang::Expr::getType(), clang::APValue::isInt(), clang::ActionResult< PtrTy, CompressInvalid >::isInvalid(), clang::Type::isReferenceType(), clang::NK_Constant_Narrowing, clang::NK_Not_Narrowing, clang::NK_Type_Narrowing, clang::NK_Variable_Narrowing, clang::Sema::PerformImplicitConversion(), clang::StandardConversionSequence::ReferenceBinding, clang::Result, clang::ImplicitConversionSequence::Standard, clang::ImplicitConversionSequence::StandardConversion, TryCopyInitialization(), clang::ImplicitConversionSequence::UserDefined, clang::ImplicitConversionSequence::UserDefinedConversion, and clang::Expr::EvalResult::Val.
Referenced by clang::Sema::ActOnCaseStmt(), clang::Sema::ActOnFinishSwitchStmt(), clang::Sema::CheckConvertedConstantExpression(), clang::Sema::CheckEnumConstant(), and clang::Sema::CheckTemplateArgument().
|
static |
checkPlaceholderForOverload - Do any interesting placeholder-like preprocessing on the given expression.
unbridgedCasts | a collection to which to add unbridged casts; without this, they will be immediately diagnosed as errors |
Return true on unrecoverable error.
Definition at line 807 of file SemaOverload.cpp.
References clang::Sema::CheckPlaceholderExpr(), clang::ActionResult< PtrTy, CompressInvalid >::get(), clang::Type::getAsPlaceholderType(), clang::Expr::getType(), and clang::ActionResult< PtrTy, CompressInvalid >::isInvalid().
Referenced by clang::Sema::BuildCallToObjectOfClassType(), clang::Sema::BuildOverloadedArrowExpr(), checkArgPlaceholdersForOverload(), CheckConvertedConstantExpression(), clang::Sema::CreateOverloadedArraySubscriptExpr(), clang::Sema::CreateOverloadedBinOp(), clang::Sema::CreateOverloadedUnaryOp(), clang::Sema::PerformContextuallyConvertToBool(), clang::Sema::PerformContextuallyConvertToObjCPointer(), and clang::Sema::PerformImplicitConversion().
|
static |
Definition at line 5293 of file SemaOverload.cpp.
References clang::Sema::AddConversionCandidate(), clang::Sema::AddTemplateConversionCandidate(), clang::DeclAccessPair::getDecl(), clang::Decl::getDeclContext(), clang::FunctionTemplateDecl::getTemplatedDecl(), and clang::UnresolvedSetImpl::size().
Referenced by clang::Sema::PerformContextualImplicitConversion().
|
static |
CollectVRQualifiers - This routine returns Volatile/Restrict qualifiers, if any, found in visible type conversion functions found in ArgExpr's type.
Definition at line 6976 of file SemaOverload.cpp.
References clang::Qualifiers::addRestrict(), clang::Qualifiers::addVolatile(), clang::Type::getAs(), clang::ASTContext::getCanonicalType(), clang::RecordType::getDecl(), clang::Type::getPointeeType(), clang::Expr::getType(), clang::CXXRecordDecl::getVisibleConversionFunctions(), clang::CXXRecordDecl::hasDefinition(), clang::Qualifiers::hasRestrict(), clang::Qualifiers::hasVolatile(), clang::QualType::isRestrictQualified(), and clang::QualType::isVolatileQualified().
Referenced by clang::Sema::AddBuiltinOperatorCandidates().
|
static |
Compare the user-defined conversion functions or constructors of two user-defined conversion sequences to determine whether any ordering is possible.
Definition at line 3226 of file SemaOverload.cpp.
References clang::ImplicitConversionSequence::Better, clang::CXXConversionDecl::getConversionType(), clang::Sema::getLangOpts(), clang::CXXMethodDecl::getParent(), clang::ImplicitConversionSequence::Indistinguishable, clang::Type::isBlockPointerType(), clang::CXXRecordDecl::isLambda(), and clang::ImplicitConversionSequence::Worse.
Referenced by CompareImplicitConversionSequences(), and clang::isBetterOverloadCandidate().
|
static |
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). As part of these checks, we also look at conversions between Objective-C interface types.
Definition at line 3742 of file SemaOverload.cpp.
References clang::ImplicitConversionSequence::Better, clang::ASTContext::canAssignObjCInterfaces(), clang::Sema::Context, clang::StandardConversionSequence::First, clang::ASTContext::getArrayDecayedType(), clang::Type::getAs(), clang::ASTContext::getCanonicalType(), clang::MemberPointerType::getClass(), clang::StandardConversionSequence::getFromType(), clang::StandardConversionSequence::getToType(), clang::QualType::getUnqualifiedType(), clang::ASTContext::hasSameType(), clang::ASTContext::hasSameUnqualifiedType(), clang::ICK_Array_To_Pointer, clang::ICK_Derived_To_Base, clang::ICK_Pointer_Conversion, clang::ICK_Pointer_Member, clang::ImplicitConversionSequence::Indistinguishable, clang::Sema::IsDerivedFrom(), clang::Type::isMemberPointerType(), clang::ObjCObjectPointerType::isObjCClassType(), clang::ObjCObjectPointerType::isObjCIdType(), clang::Type::isPointerType(), clang::StandardConversionSequence::Second, and clang::ImplicitConversionSequence::Worse.
Referenced by CompareStandardConversionSequences().
|
static |
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).
Definition at line 3267 of file SemaOverload.cpp.
References clang::UserDefinedConversionSequence::After, clang::ImplicitConversionSequence::Better, compareConversionFunctions(), CompareStandardConversionSequences(), clang::UserDefinedConversionSequence::ConversionFunction, clang::ImplicitConversionSequence::getKind(), clang::ImplicitConversionSequence::getKindRank(), clang::Sema::getLangOpts(), hasDeprecatedStringLiteralToCharPtrConversion(), clang::ImplicitConversionSequence::Indistinguishable, clang::ImplicitConversionSequence::isBad(), clang::ImplicitConversionSequence::isStandard(), clang::ImplicitConversionSequence::isStdInitializerListElement(), clang::ImplicitConversionSequence::isUserDefined(), clang::Result, clang::ImplicitConversionSequence::Standard, clang::ImplicitConversionSequence::UserDefined, and clang::ImplicitConversionSequence::Worse.
Referenced by clang::isBetterOverloadCandidate(), and TryListConversion().
|
static |
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).
Definition at line 3629 of file SemaOverload.cpp.
References clang::ImplicitConversionSequence::Better, clang::Sema::Context, clang::StandardConversionSequence::DeprecatedStringLiteralToCharPtr, clang::StandardConversionSequence::First, clang::ASTContext::getCanonicalType(), clang::QualType::getCVRQualifiers(), clang::ASTContext::getQualifiedType(), clang::StandardConversionSequence::getToType(), clang::ASTContext::getUnqualifiedArrayType(), clang::ASTContext::hasSameUnqualifiedType(), clang::ICK_Qualification, clang::ImplicitConversionSequence::Indistinguishable, clang::QualType::isMoreQualifiedThan(), clang::StandardConversionSequence::QualificationIncludesObjCLifetime, clang::Result, clang::StandardConversionSequence::Second, clang::StandardConversionSequence::Third, clang::ASTContext::UnwrapSimilarPointerTypes(), and clang::ImplicitConversionSequence::Worse.
Referenced by CompareStandardConversionSequences().
|
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 3456 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(), and clang::isBetterOverloadCandidate().
|
static |
Definition at line 3383 of file SemaOverload.cpp.
References clang::ImplicitConversionSequence::Better, clang::StandardConversionSequence::getToType(), clang::ASTContext::hasSameType(), hasSimilarType(), clang::ICK_Identity, clang::ImplicitConversionSequence::Indistinguishable, clang::StandardConversionSequence::isIdentityConversion(), clang::Result, clang::StandardConversionSequence::Second, clang::StandardConversionSequence::Third, and clang::ImplicitConversionSequence::Worse.
Referenced by CompareStandardConversionSequences().
|
static |
CompleteNonViableCandidate - Normally, overload resolution only computes up to the first. Produces the FixIt set if possible.
Definition at line 9546 of file SemaOverload.cpp.
References clang::OverloadCandidate::BuiltinTypes, clang::OverloadCandidate::Conversions, clang::OverloadCandidate::FailureKind, clang::OverloadCandidate::Fix, clang::OverloadCandidate::Function, clang::Type::getAs(), clang::CXXConversionDecl::getConversionType(), clang::Sema::getLangOpts(), clang::QualType::getNonReferenceType(), clang::FunctionProtoType::getNumParams(), clang::FunctionProtoType::getParamType(), clang::Type::getPointeeType(), clang::ValueDecl::getType(), clang::OverloadCandidate::IgnoreObjectArgument, clang::ImplicitConversionSequence::isBad(), clang::ImplicitConversionSequence::isInitialized(), clang::OverloadCandidate::IsSurrogate, clang::OverloadCandidate::NumConversions, clang::ovl_fail_bad_conversion, clang::OverloadCandidate::ParamTypes, clang::ConversionFixItGenerator::setConversionChecker(), clang::ImplicitConversionSequence::setEllipsis(), clang::OverloadCandidate::Surrogate, TryCopyInitialization(), clang::OverloadCandidate::TryToFixBadConversion(), and clang::OverloadCandidate::Viable.
Referenced by clang::OverloadCandidateSet::NoteCandidates().
|
static |
A convenience routine for creating a decayed reference to a function.
Definition at line 43 of file SemaOverload.cpp.
References clang::Sema::Context, clang::Sema::DefaultFunctionArrayConversion(), clang::Sema::DiagnoseUseOfDecl(), clang::ExprError(), clang::ActionResult< PtrTy, CompressInvalid >::get(), clang::ValueDecl::getType(), clang::ActionResult< PtrTy, CompressInvalid >::isInvalid(), clang::Sema::MarkDeclRefReferenced(), clang::DeclRefExpr::setHadMultipleCandidates(), and clang::VK_LValue.
Referenced by clang::Sema::BuildCallToObjectOfClassType(), clang::Sema::BuildLiteralOperatorCall(), clang::Sema::BuildOverloadedArrowExpr(), clang::Sema::CreateOverloadedArraySubscriptExpr(), clang::Sema::CreateOverloadedBinOp(), and clang::Sema::CreateOverloadedUnaryOp().
|
static |
Definition at line 5196 of file SemaOverload.cpp.
References clang::Sema::ContextualImplicitConverter::diagnoseAmbiguous(), clang::ExprError(), clang::CXXConversionDecl::getConversionType(), clang::QualType::getNonReferenceType(), clang::Sema::ContextualImplicitConverter::noteAmbiguous(), clang::UnresolvedSetImpl::size(), and clang::Sema::ContextualImplicitConverter::Suppress.
Referenced by clang::Sema::PerformContextualImplicitConversion().
General arity mismatch diagnosis over a candidate in a candidate set.
Definition at line 8915 of file SemaOverload.cpp.
References clang::Sema::Diag(), clang::Type::getAs(), clang::NamedDecl::getDeclName(), clang::FunctionDecl::getDescribedFunctionTemplate(), clang::Decl::getLocation(), clang::FunctionDecl::getMinRequiredArguments(), clang::FunctionDecl::getParamDecl(), and clang::ValueDecl::getType().
Referenced by DiagnoseArityMismatch(), DiagnoseBadDeduction(), and NoteFunctionCandidate().
|
static |
Arity mismatch diagnosis specific to a function overload candidate.
Definition at line 8959 of file SemaOverload.cpp.
References CheckArityMismatch(), DiagnoseArityMismatch(), and clang::OverloadCandidate::Function.
|
static |
Definition at line 8668 of file SemaOverload.cpp.
References clang::ImplicitConversionSequence::Bad, clang::Sema::Context, clang::OverloadCandidate::Conversions, clang::Sema::Diag(), clang::OverloadCandidate::Fix, clang::BadConversionSequence::FromExpr, clang::OverloadCandidate::Function, clang::Qualifiers::getAddressSpace(), clang::CanQual< T >::getAs(), clang::Type::getAs(), clang::QualType::getCanonicalType(), clang::ASTContext::getCanonicalType(), clang::Qualifiers::getCVRQualifiers(), clang::BadConversionSequence::getFromType(), clang::Decl::getLocation(), clang::QualType::getNonReferenceType(), clang::Qualifiers::getObjCGCAttr(), clang::Qualifiers::getObjCLifetime(), clang::ObjCObjectPointerType::getPointeeType(), clang::CanQual< T >::getQualifiers(), clang::BadConversionSequence::getToType(), clang::CanQual< T >::getUnqualifiedType(), clang::ConversionFixItGenerator::Hints, clang::Expr::IgnoreParens(), clang::CanQual< T >::isAtLeastAsQualifiedAs(), clang::ImplicitConversionSequence::isBad(), clang::Sema::IsDerivedFrom(), clang::Type::isIncompleteType(), clang::Expr::isLValue(), clang::Type::isLValueReferenceType(), clang::ConversionFixItGenerator::Kind, clang::ASTContext::OverloadTy, and clang::Sema::PDiag().
Referenced by NoteFunctionCandidate().
|
static |
Diagnose a failed template-argument deduction.
Definition at line 8976 of file SemaOverload.cpp.
References clang::QualifierCollector::apply(), clang::Sema::Context, clang::Sema::Diag(), DiagnoseArityMismatch(), clang::OverloadExpr::FindResult::Expression, clang::OverloadExpr::find(), clang::TemplateArgument::getAsTemplate(), clang::TemplateName::getAsTemplateDecl(), clang::TemplateArgument::getAsType(), clang::NamedDecl::getDeclName(), getDescribedTemplate(), clang::Sema::getDiagnostics(), clang::DeductionFailureInfo::getExpr(), clang::DeductionFailureInfo::getFirstArg(), clang::TemplateArgument::getKind(), clang::TemplateName::getKind(), clang::Decl::getLocation(), clang::NamedDecl::getName(), clang::OverloadExpr::getName(), clang::DeductionFailureInfo::getSecondArg(), clang::DeductionFailureInfo::getSFINAEDiagnostic(), clang::Sema::getTemplateArgumentBindingsText(), clang::DeductionFailureInfo::getTemplateArgumentList(), clang::DeductionFailureInfo::getTemplateParameter(), clang::TypeDecl::getTypeForDecl(), clang::ASTContext::hasSameType(), clang::DeductionFailureInfo::Result, clang::QualifierCollector::strip(), clang::Sema::TDK_FailedOverloadResolution, clang::Sema::TDK_Incomplete, clang::Sema::TDK_Inconsistent, clang::Sema::TDK_InstantiationDepth, clang::Sema::TDK_InvalidExplicitArguments, clang::Sema::TDK_MiscellaneousDeductionFailure, clang::Sema::TDK_NonDeducedMismatch, clang::Sema::TDK_SubstitutionFailure, clang::Sema::TDK_Success, clang::Sema::TDK_TooFewArguments, clang::Sema::TDK_TooManyArguments, clang::Sema::TDK_Underqualified, clang::TemplateArgument::Template, and clang::TemplateName::Template.
Referenced by DiagnoseBadDeduction(), clang::TemplateSpecCandidate::NoteDeductionFailure(), and NoteFunctionCandidate().
|
static |
Diagnose a failed template-argument deduction, for function calls.
Definition at line 9165 of file SemaOverload.cpp.
References CheckArityMismatch(), clang::OverloadCandidate::DeductionFailure, DiagnoseBadDeduction(), clang::OverloadCandidate::Function, clang::DeductionFailureInfo::Result, clang::Sema::TDK_TooFewArguments, and clang::Sema::TDK_TooManyArguments.
|
static |
CUDA: diagnose an invalid call across targets.
Definition at line 9177 of file SemaOverload.cpp.
References clang::Sema::CurContext, clang::Sema::CXXCopyAssignment, clang::Sema::CXXCopyConstructor, clang::Sema::CXXDefaultConstructor, clang::Sema::CXXMoveAssignment, clang::Sema::CXXMoveConstructor, clang::Sema::Diag(), clang::OverloadCandidate::Function, clang::Type::getAs(), clang::FunctionDecl::getNumParams(), clang::FunctionDecl::getParamDecl(), clang::CXXMethodDecl::getParent(), clang::ValueDecl::getType(), clang::Sema::IdentifyCUDATarget(), clang::Sema::inferCUDATargetForImplicitSpecialMember(), and clang::Decl::isImplicit().
Referenced by NoteFunctionCandidate().
|
static |
Definition at line 9231 of file SemaOverload.cpp.
References clang::DeductionFailureInfo::Data, clang::OverloadCandidate::DeductionFailure, clang::Sema::Diag(), clang::OverloadCandidate::Function, and clang::Decl::getLocation().
Referenced by NoteFunctionCandidate().
|
static |
Definition at line 5214 of file SemaOverload.cpp.
References clang::Sema::BuildCXXMemberCallExpr(), clang::Sema::CheckMemberOperatorAccess(), clang::CK_UserDefinedConversion, clang::Sema::Context, clang::ImplicitCastExpr::Create(), clang::FixItHint::CreateInsertion(), clang::Sema::ContextualImplicitConverter::diagnoseExplicitConv(), clang::ActionResult< PtrTy, CompressInvalid >::get(), clang::QualType::getAsStringInternal(), clang::CXXConversionDecl::getConversionType(), clang::Expr::getExprLoc(), clang::Sema::getLocForEndOfToken(), clang::QualType::getNonReferenceType(), clang::Sema::getPrintingPolicy(), clang::Expr::getType(), clang::NamedDecl::getUnderlyingDecl(), clang::Expr::getValueKind(), clang::ActionResult< PtrTy, CompressInvalid >::isInvalid(), clang::Sema::isSFINAEContext(), clang::Sema::ContextualImplicitConverter::noteExplicitConv(), clang::Result, clang::UnresolvedSetImpl::size(), and clang::Sema::ContextualImplicitConverter::Suppress.
Referenced by clang::Sema::PerformContextualImplicitConversion().
|
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 10490 of file SemaOverload.cpp.
References clang::Sema::ActiveTemplateInstantiations, AddOverloadedCallCandidate(), clang::LookupResult::begin(), canBeDeclaredInNamespace(), clang::LookupResult::clear(), clang::Sema::CurContext, clang::Sema::Diag(), clang::LookupResult::empty(), clang::DeclContext::Encloses(), clang::LookupResult::end(), clang::Sema::FindAssociatedClassesAndNamespaces(), clang::LookupResult::getLookupName(), clang::LookupResult::getNameLoc(), clang::DeclContext::getParent(), clang::NamedDecl::getQualifiedNameAsString(), clang::Sema::getStdNamespace(), clang::CXXScopeSpec::isEmpty(), clang::Sema::LookupQualifiedName(), clang::OR_Success, and clang::LookupResult::suppressDiagnostics().
Referenced by BuildRecoveryCallExpr(), and DiagnoseTwoPhaseOperatorLookup().
|
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 10594 of file SemaOverload.cpp.
References clang::Sema::Context, clang::OverloadCandidateSet::CSK_Operator, clang::ASTContext::DeclarationNames, DiagnoseTwoPhaseLookup(), clang::DeclarationNameTable::getCXXOperatorName(), and clang::Sema::LookupOperatorName.
Referenced by clang::Sema::CreateOverloadedBinOp(), and clang::Sema::CreateOverloadedUnaryOp().
|
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 5131 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().
|
static |
Look for a user-defined conversion to an value reference-compatible with DeclType. Return true if something definite is found.
Definition at line 4029 of file SemaOverload.cpp.
References clang::AmbiguousConversionSequence::addConversion(), clang::Sema::AddConversionCandidate(), clang::Sema::AddTemplateConversionCandidate(), clang::UserDefinedConversionSequence::After, clang::ImplicitConversionSequence::Ambiguous, clang::UserDefinedConversionSequence::Before, clang::Sema::CompareReferenceRelationship(), clang::UserDefinedConversionSequence::ConversionFunction, clang::OverloadCandidateSet::CSK_Normal, clang::StandardConversionSequence::DirectBinding, clang::UserDefinedConversionSequence::EllipsisConversion, clang::UserDefinedConversionSequence::FoundConversionFunction, clang::Type::getAs(), clang::Decl::getDeclContext(), clang::QualType::getNonReferenceType(), clang::ReferenceType::getPointeeType(), clang::FunctionTemplateDecl::getTemplatedDecl(), clang::QualType::getUnqualifiedType(), clang::UserDefinedConversionSequence::HadMultipleCandidates, clang::Type::isFunctionType(), clang::Type::isLValueReferenceType(), clang::Type::isRecordType(), clang::Type::isRValueReferenceType(), clang::OR_Ambiguous, clang::OR_Deleted, clang::OR_No_Viable_Function, clang::OR_Success, clang::Sema::Ref_Incompatible, clang::StandardConversionSequence::ReferenceBinding, clang::ImplicitConversionSequence::setAmbiguous(), clang::ImplicitConversionSequence::setUserDefined(), and clang::ImplicitConversionSequence::UserDefined.
Referenced by TryReferenceInit().
|
static |
Definition at line 5282 of file SemaOverload.cpp.
References clang::Sema::DefaultLvalueConversion(), clang::Sema::ContextualImplicitConverter::diagnoseNoMatch(), clang::Expr::getType(), clang::Sema::ContextualImplicitConverter::match(), and clang::Sema::ContextualImplicitConverter::Suppress.
Referenced by clang::Sema::PerformContextualImplicitConversion().
|
static |
FinishOverloadedCallExpr - given an OverloadCandidateSet, builds and returns the completed call expression. If overload resolution fails, emits diagnostics and returns ExprError()
Definition at line 10767 of file SemaOverload.cpp.
References BuildRecoveryCallExpr(), clang::Sema::BuildResolvedCallExpr(), clang::Sema::CheckUnresolvedLookupAccess(), clang::Sema::Diag(), clang::Sema::DiagnoseUseOfDecl(), clang::OverloadCandidateSet::empty(), clang::ExprError(), clang::Sema::FixOverloadedFunctionReference(), clang::Sema::getDeletedOrUnavailableSuffix(), clang::OverloadExpr::getName(), clang::OverloadExpr::getNameLoc(), clang::ActionResult< PtrTy, CompressInvalid >::isInvalid(), clang::OverloadCandidateSet::NoteCandidates(), clang::OCD_AllCandidates, clang::OCD_ViableCandidates, clang::OR_Ambiguous, clang::OR_Deleted, clang::OR_No_Viable_Function, and clang::OR_Success.
Referenced by clang::Sema::BuildForRangeBeginEndCall(), and clang::Sema::BuildOverloadedCallExpr().
|
static |
Definition at line 8965 of file SemaOverload.cpp.
Referenced by DiagnoseBadDeduction().
|
static |
GetImplicitConversionName - Return the name of this kind of implicit conversion.
Definition at line 140 of file SemaOverload.cpp.
References clang::ICK_Num_Conversion_Kinds.
Referenced by clang::StandardConversionSequence::dump().
|
static |
Definition at line 9381 of file SemaOverload.cpp.
References clang::OverloadCandidate::Function, clang::Decl::getLocation(), clang::OverloadCandidate::IsSurrogate, and clang::OverloadCandidate::Surrogate.
|
static |
Definition at line 9698 of file SemaOverload.cpp.
References clang::Decl::getLocation(), and clang::TemplateSpecCandidate::Specialization.
|
static |
Definition at line 3256 of file SemaOverload.cpp.
References clang::UserDefinedConversionSequence::Before, clang::StandardConversionSequence::DeprecatedStringLiteralToCharPtr, clang::ImplicitConversionSequence::isStandard(), clang::ImplicitConversionSequence::isUserDefined(), clang::ImplicitConversionSequence::Standard, and clang::ImplicitConversionSequence::UserDefined.
Referenced by CompareImplicitConversionSequences().
|
static |
Definition at line 3370 of file SemaOverload.cpp.
References clang::ASTContext::getUnqualifiedArrayType(), clang::ASTContext::hasSameUnqualifiedType(), and clang::ASTContext::UnwrapSimilarPointerTypes().
Referenced by compareStandardConversionSubsets().
Skip any implicit casts which could be either part of a narrowing conversion or after one in an implicit conversion.
Definition at line 247 of file SemaOverload.cpp.
References clang::CK_FloatingCast, clang::CK_FloatingToBoolean, clang::CK_FloatingToIntegral, clang::CK_IntegralCast, clang::CK_IntegralToBoolean, clang::CK_IntegralToFloating, and clang::CK_NoOp.
Referenced by clang::StandardConversionSequence::getNarrowingKind().
|
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 5526 of file SemaOverload.cpp.
References clang::Type::getAs(), clang::QualType::getNonReferenceType(), clang::FunctionProtoType::getNumParams(), clang::FunctionProtoType::getParamType(), clang::ValueDecl::getType(), clang::ASTContext::hasSameUnqualifiedType(), clang::Type::isDependentType(), clang::Type::isEnumeralType(), clang::QualType::isNull(), and clang::Type::isRecordType().
Referenced by clang::Sema::AddOverloadCandidate().
|
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.
ConvType | The return type of the conversion function. |
ToType | The type we are converting to. |
AllowObjCPointerConversion | Allow a conversion from one Objective-C pointer to another. |
Definition at line 6199 of file SemaOverload.cpp.
References clang::Sema::Context, clang::QualType::getNonReferenceType(), clang::ASTContext::hasSameUnqualifiedType(), clang::Sema::isObjCPointerConversion(), and clang::Sema::IsQualificationConversion().
Referenced by clang::Sema::AddConversionCandidate().
|
static |
Determine whether one of the given reference bindings is better than the other based on what kind of bindings they are.
Definition at line 3427 of file SemaOverload.cpp.
References clang::StandardConversionSequence::BindsImplicitObjectArgumentWithoutRefQualifier, clang::StandardConversionSequence::BindsToFunctionLvalue, clang::StandardConversionSequence::BindsToRvalue, and clang::StandardConversionSequence::IsLvalueReference.
Referenced by CompareStandardConversionSequences().
|
static |
Definition at line 2883 of file SemaOverload.cpp.
References clang::Type::getAs(), clang::QualType::getNonReferenceType(), clang::FunctionProtoType::getNumParams(), clang::FunctionProtoType::getParamType(), clang::ValueDecl::getType(), and clang::ASTContext::hasSameUnqualifiedType().
Referenced by IsInitializerListConstructorConversion(), and IsUserDefinedConversion().
|
static |
Definition at line 2897 of file SemaOverload.cpp.
References clang::Sema::AddOverloadCandidate(), clang::Sema::AddTemplateOverloadCandidate(), clang::UserDefinedConversionSequence::After, clang::UserDefinedConversionSequence::Before, clang::DeclContextLookupResult::begin(), clang::OverloadCandidateSet::BestViableFunction(), clang::Sema::Context, clang::UserDefinedConversionSequence::ConversionFunction, clang::DeclContextLookupResult::end(), clang::UserDefinedConversionSequence::FoundConversionFunction, clang::Decl::getAccess(), clang::PointerType::getPointeeType(), clang::FunctionTemplateDecl::getTemplatedDecl(), clang::CXXMethodDecl::getThisType(), clang::UserDefinedConversionSequence::HadMultipleCandidates, isFirstArgumentCompatibleWithType(), clang::Sema::isInitListConstructor(), clang::Decl::isInvalidDecl(), clang::Sema::LookupConstructors(), clang::DeclAccessPair::make(), clang::OR_Ambiguous, clang::OR_Deleted, clang::OR_No_Viable_Function, clang::OR_Success, clang::Result, clang::StandardConversionSequence::setAllToTypes(), clang::StandardConversionSequence::setAsIdentityConversion(), clang::StandardConversionSequence::setFromType(), and clang::OverloadCandidateSet::size().
Referenced by IsUserDefinedConversion().
|
static |
Determine whether the lifetime conversion between the two given qualifiers sets is nontrivial.
Definition at line 2761 of file SemaOverload.cpp.
References clang::Qualifiers::getObjCLifetime(), clang::Qualifiers::hasConst(), and clang::Qualifiers::OCL_ExplicitNone.
Referenced by clang::Sema::CompareReferenceRelationship(), and clang::Sema::IsQualificationConversion().
Definition at line 5812 of file SemaOverload.cpp.
Referenced by clang::Sema::CheckEnableIf(), and clang::isBetterOverloadCandidate().
|
static |
Definition at line 1950 of file SemaOverload.cpp.
References clang::Expr::getType(), clang::Type::isEnumeralType(), clang::Type::isIntegerType(), clang::Expr::isNullPointerConstant(), clang::Expr::isTypeDependent(), clang::Expr::isValueDependent(), clang::Expr::NPC_ValueDependentIsNotNull, and clang::Expr::NPC_ValueDependentIsNull.
Referenced by clang::Sema::IsPointerConversion().
|
static |
Definition at line 10868 of file SemaOverload.cpp.
References clang::UnresolvedSetImpl::begin(), and clang::UnresolvedSetImpl::size().
Referenced by clang::Sema::CreateOverloadedBinOp(), and clang::Sema::CreateOverloadedUnaryOp().
|
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 1399 of file SemaOverload.cpp.
References clang::ASTContext::BoolTy, clang::Sema::Context, clang::StandardConversionSequence::CopyConstructor, clang::StandardConversionSequence::DeprecatedStringLiteralToCharPtr, clang::Expr::EvaluateKnownConstInt(), clang::Sema::ExtractUnqualifiedFunctionType(), clang::StandardConversionSequence::First, clang::Sema::FixOverloadedFunctionReference(), clang::ASTContext::getArrayDecayedType(), clang::Type::getAs(), clang::Sema::getASTContext(), clang::ASTContext::getCanonicalType(), clang::Sema::getLangOpts(), clang::QualType::getLocalQualifiers(), clang::QualType::getLocalUnqualifiedType(), clang::ASTContext::getMemberPointerType(), 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_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_To_Pointer, clang::ICK_Identity, clang::ICK_Integral_Conversion, clang::ICK_Integral_Promotion, clang::ICK_Lvalue_To_Rvalue, clang::ICK_NoReturn_Adjustment, clang::ICK_Pointer_Conversion, clang::ICK_Pointer_Member, clang::ICK_Qualification, clang::ICK_TransparentUnionConversion, clang::ICK_Writeback_Conversion, clang::ICK_Zero_Event_Conversion, clang::Expr::IgnoreParens(), clang::StandardConversionSequence::IncompatibleObjC, 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::Type::isFunctionType(), clang::Expr::isGLValue(), clang::Expr::isIntegerConstantExpr(), clang::Type::isIntegralOrUnscopedEnumerationType(), clang::Sema::IsIntegralPromotion(), clang::Type::isIntegralType(), clang::Sema::IsMemberPointerConversion(), clang::Type::isMemberPointerType(), clang::Sema::IsNoReturnConversion(), clang::Type::isNullPtrType(), clang::Sema::isObjCWritebackConversion(), clang::Sema::IsPointerConversion(), clang::Sema::IsQualificationConversion(), clang::Type::isRealFloatingType(), clang::Type::isRecordType(), clang::CXXMethodDecl::isStatic(), clang::Sema::IsStringLiteralToNonConstPointerConversion(), IsTransparentUnionStandardConversion(), IsVectorConversion(), 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(), clang::ASTContext::typesAreCompatible(), and clang::UO_AddrOf.
Referenced by IsTransparentUnionStandardConversion(), tryAtomicConversion(), and TryImplicitConversion().
|
static |
Definition at line 1678 of file SemaOverload.cpp.
References clang::RecordDecl::fields(), clang::Type::getAsUnionType(), clang::RecordType::getDecl(), clang::Expr::getType(), clang::Decl::hasAttr(), and IsStandardConversion().
Referenced by IsStandardConversion().
Determine whether the given type is valid, e.g., it is not an invalid C++ class.
Definition at line 3937 of file SemaOverload.cpp.
References clang::Type::getAsCXXRecordDecl().
Referenced by clang::Sema::CompareReferenceRelationship().
|
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.
AllowExplicit | true if the conversion should consider C++0x "explicit" conversion functions as well as non-explicit conversion functions (C++0x [class.conv.fct]p2). |
AllowObjCConversionOnExplicit | true 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 2984 of file SemaOverload.cpp.
References clang::Sema::AddConversionCandidate(), clang::Sema::AddOverloadCandidate(), clang::Sema::AddTemplateConversionCandidate(), clang::Sema::AddTemplateOverloadCandidate(), clang::UserDefinedConversionSequence::After, clang::UserDefinedConversionSequence::Before, clang::DeclContextLookupResult::begin(), clang::OverloadCandidateSet::BestViableFunction(), clang::OverloadCandidateSet::clear(), clang::Sema::Context, clang::UserDefinedConversionSequence::ConversionFunction, clang::UserDefinedConversionSequence::EllipsisConversion, clang::DeclContextLookupResult::end(), clang::UserDefinedConversionSequence::FoundConversionFunction, clang::Decl::getAccess(), clang::Type::getAs(), clang::DeclAccessPair::getDecl(), clang::Decl::getDeclContext(), clang::Expr::getExprLoc(), clang::PointerType::getPointeeType(), clang::FunctionTemplateDecl::getTemplatedDecl(), clang::Expr::getType(), clang::UserDefinedConversionSequence::HadMultipleCandidates, clang::ASTContext::hasSameUnqualifiedType(), clang::Sema::IsDerivedFrom(), isFirstArgumentCompatibleWithType(), clang::Type::isIncompleteType(), IsInitializerListConstructorConversion(), clang::Decl::isInvalidDecl(), clang::Sema::LookupConstructors(), clang::DeclAccessPair::make(), clang::OR_Ambiguous, clang::OR_Deleted, clang::OR_No_Viable_Function, clang::OR_Success, clang::Sema::RequireCompleteType(), clang::Result, clang::StandardConversionSequence::setAllToTypes(), clang::StandardConversionSequence::setAsIdentityConversion(), clang::StandardConversionSequence::setFromType(), and clang::OverloadCandidateSet::size().
Referenced by clang::Sema::DiagnoseMultipleUserDefinedConversion(), and TryUserDefinedConversion().
|
static |
Determine whether the conversion from FromType to ToType is a valid vector conversion.
ICK | Will be set to the vector conversion kind, if this is a vector conversion. |
Definition at line 1346 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(), and clang::Type::isVectorType().
Referenced by IsStandardConversion().
|
static |
Definition at line 10622 of file SemaOverload.cpp.
Referenced by BuildRecoveryCallExpr().
|
static |
Definition at line 9368 of file SemaOverload.cpp.
References clang::OverloadCandidate::Conversions, clang::ImplicitConversionSequence::DiagnoseAmbiguousConversion(), clang::ImplicitConversionSequence::isAmbiguous(), clang::ImplicitConversionSequence::isBad(), clang::OverloadCandidate::NumConversions, and clang::Sema::PDiag().
Referenced by clang::OverloadCandidateSet::NoteCandidates().
|
static |
Definition at line 9349 of file SemaOverload.cpp.
References clang::OverloadCandidate::BuiltinTypes, clang::Sema::Diag(), clang::QualType::getAsString(), clang::OverloadCandidate::NumConversions, and clang::OverloadCandidate::ParamTypes.
Referenced by clang::OverloadCandidateSet::NoteCandidates().
|
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 9253 of file SemaOverload.cpp.
References clang::OverloadCandidate::Conversions, clang::Sema::Diag(), DiagnoseArityMismatch(), DiagnoseBadConversion(), DiagnoseBadDeduction(), DiagnoseBadTarget(), DiagnoseFailedEnableIfAttr(), clang::OverloadCandidate::FailureKind, clang::OverloadCandidate::Function, clang::Decl::getLocation(), clang::FunctionDecl::getPrimaryTemplate(), clang::OverloadCandidate::IgnoreObjectArgument, clang::ImplicitConversionSequence::isBad(), clang::FunctionDecl::isDeleted(), clang::FunctionDecl::isDeletedAsWritten(), clang::Sema::isFunctionConsideredUnavailable(), clang::Sema::NoteOverloadCandidate(), clang::OverloadCandidate::NumConversions, clang::ovl_fail_bad_conversion, clang::ovl_fail_bad_deduction, clang::ovl_fail_bad_final_conversion, clang::ovl_fail_bad_target, clang::ovl_fail_enable_if, clang::ovl_fail_final_conversion_not_exact, clang::ovl_fail_illegal_constructor, clang::ovl_fail_too_few_arguments, clang::ovl_fail_too_many_arguments, clang::ovl_fail_trivial_conversion, and clang::OverloadCandidate::Viable.
Referenced by clang::OverloadCandidateSet::NoteCandidates().
|
static |
Definition at line 9316 of file SemaOverload.cpp.
References clang::Sema::Context, clang::Sema::Diag(), clang::Type::getAs(), clang::CXXConversionDecl::getConversionType(), clang::Decl::getLocation(), clang::ASTContext::getLValueReferenceType(), clang::Type::getPointeeType(), clang::ASTContext::getPointerType(), clang::ASTContext::getRValueReferenceType(), and clang::OverloadCandidate::Surrogate.
Referenced by clang::OverloadCandidateSet::NoteCandidates().
|
static |
Definition at line 9389 of file SemaOverload.cpp.
References clang::DeductionFailureInfo::Result, clang::Sema::TDK_FailedOverloadResolution, clang::Sema::TDK_Incomplete, clang::Sema::TDK_Inconsistent, clang::Sema::TDK_InstantiationDepth, clang::Sema::TDK_Invalid, clang::Sema::TDK_InvalidExplicitArguments, clang::Sema::TDK_MiscellaneousDeductionFailure, clang::Sema::TDK_NonDeducedMismatch, clang::Sema::TDK_SubstitutionFailure, clang::Sema::TDK_Success, clang::Sema::TDK_TooFewArguments, clang::Sema::TDK_TooManyArguments, and clang::Sema::TDK_Underqualified.
|
static |
Definition at line 5254 of file SemaOverload.cpp.
References clang::Sema::BuildCXXMemberCallExpr(), clang::Sema::CheckMemberOperatorAccess(), clang::CK_UserDefinedConversion, clang::Sema::Context, clang::ImplicitCastExpr::Create(), clang::Sema::ContextualImplicitConverter::diagnoseConversion(), clang::ActionResult< PtrTy, CompressInvalid >::get(), clang::CXXConversionDecl::getConversionType(), clang::Expr::getExprLoc(), clang::QualType::getNonReferenceType(), clang::Expr::getType(), clang::NamedDecl::getUnderlyingDecl(), clang::Expr::getValueKind(), clang::ActionResult< PtrTy, CompressInvalid >::isInvalid(), clang::Sema::isSFINAEContext(), clang::Result, and clang::Sema::ContextualImplicitConverter::SuppressConversion.
Referenced by clang::Sema::PerformContextualImplicitConversion().
|
static |
If successful, updates SCS's
second and third steps in the conversion sequence to finish the conversion.
Definition at line 2860 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().
|
static |
TryContextuallyConvertToBool - Attempt to contextually convert the expression From to bool (C++0x [conv]p3).
Definition at line 4899 of file SemaOverload.cpp.
References clang::ASTContext::BoolTy, clang::Sema::Context, and TryImplicitConversion().
Referenced by clang::Sema::AddBuiltinCandidate(), and clang::Sema::PerformContextuallyConvertToBool().
|
static |
TryContextuallyConvertToObjCPointer - Attempt to contextually convert the expression From to an Objective-C pointer type.
Definition at line 5142 of file SemaOverload.cpp.
References clang::UserDefinedConversionSequence::After, clang::ImplicitConversionSequence::AmbiguousConversion, clang::ImplicitConversionSequence::BadConversion, clang::Sema::Context, dropPointerConversion(), clang::ImplicitConversionSequence::EllipsisConversion, clang::ImplicitConversionSequence::getKind(), clang::ASTContext::getObjCIdType(), clang::ImplicitConversionSequence::Standard, clang::ImplicitConversionSequence::StandardConversion, TryImplicitConversion(), clang::ImplicitConversionSequence::UserDefined, and clang::ImplicitConversionSequence::UserDefinedConversion.
Referenced by clang::Sema::PerformContextuallyConvertToObjCPointer().
|
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 4685 of file SemaOverload.cpp.
References clang::Type::isReferenceType(), TryImplicitConversion(), TryListConversion(), and TryReferenceInit().
Referenced by clang::Sema::AddBuiltinCandidate(), clang::Sema::AddConversionCandidate(), clang::Sema::AddOverloadCandidate(), clang::Sema::AddSurrogateCandidate(), CheckConvertedConstantExpression(), CompleteNonViableCandidate(), TryCopyInitialization(), and TryListConversion().
|
static |
Definition at line 4709 of file SemaOverload.cpp.
References clang::ImplicitConversionSequence::isBad(), and TryCopyInitialization().
|
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.
AllowObjCWritebackConversion | Whether 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 1189 of file SemaOverload.cpp.
References clang::Sema::Context, clang::StandardConversionSequence::CopyConstructor, clang::Type::getAs(), clang::Sema::getLangOpts(), 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(), clang::Sema::PerformImplicitConversion(), TryContextuallyConvertToBool(), TryContextuallyConvertToObjCPointer(), TryCopyInitialization(), clang::Sema::TryImplicitConversion(), and TryReferenceInit().
|
static |
TryListConversion - Try to copy-initialize a value of type ToType from the initializer list From.
Definition at line 4431 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::QualType::isConstQualified(), clang::Sema::IsDerivedFrom(), clang::ImplicitConversionSequence::isEllipsis(), clang::ImplicitConversionSequence::isFailure(), clang::StandardConversionSequence::IsLvalueReference, clang::Type::isLValueReferenceType(), clang::QualType::isNull(), clang::Type::isRecordType(), clang::Type::isReferenceType(), clang::Type::isRValueReferenceType(), clang::ImplicitConversionSequence::isStandard(), 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::RequireCompleteType(), clang::Sema::ResolveAddressOfOverloadedFunction(), clang::Result, 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().
|
static |
TryObjectArgumentInitialization - Try to initialize the object parameter of the given member function (Method
) from the expression From
.
Definition at line 4725 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::AddConversionCandidate(), clang::Sema::AddMethodCandidate(), clang::Sema::AddSurrogateCandidate(), and clang::Sema::PerformObjectArgumentInitialization().
|
static |
Compute an implicit conversion sequence for reference initialization.
Definition at line 4155 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::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_With_Added_Qualification, clang::Sema::Ref_Incompatible, clang::Sema::Ref_Related, clang::Qualifiers::removeObjCGCAttr(), clang::Qualifiers::removeObjCLifetime(), clang::Sema::RequireCompleteType(), clang::Sema::ResolveAddressOfOverloadedFunction(), clang::ImplicitConversionSequence::setBad(), and TryImplicitConversion().
Referenced by TryCopyInitialization(), and TryListConversion().
|
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 1088 of file SemaOverload.cpp.
References clang::AmbiguousConversionSequence::addConversion(), clang::ImplicitConversionSequence::Ambiguous, clang::UserDefinedConversionSequence::Before, clang::Sema::Context, clang::UserDefinedConversionSequence::ConversionFunction, clang::StandardConversionSequence::CopyConstructor, clang::OverloadCandidateSet::CSK_Normal, clang::ASTContext::getCanonicalType(), clang::Expr::getExprLoc(), 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().