31 #include "llvm/ADT/DenseSet.h"
32 #include "llvm/ADT/STLExtras.h"
33 #include "llvm/ADT/SmallPtrSet.h"
34 #include "llvm/ADT/SmallString.h"
38 using namespace clang;
44 bool HadMultipleCandidates,
59 if (HadMultipleCandidates)
72 bool InOverloadResolution,
75 bool AllowObjCWritebackConversion);
79 bool InOverloadResolution,
87 bool AllowObjCConversionOnExplicit);
135 return Rank[(int)Kind];
145 "Function-to-pointer",
146 "Noreturn adjustment",
148 "Integral promotion",
149 "Floating point promotion",
151 "Integral conversion",
152 "Floating conversion",
153 "Complex conversion",
154 "Floating-integral conversion",
155 "Pointer conversion",
156 "Pointer-to-member conversion",
157 "Boolean conversion",
158 "Compatible-types conversion",
159 "Derived-to-base conversion",
162 "Complex-real conversion",
163 "Block Pointer conversion",
164 "Transparent Union Conversion",
165 "Writeback conversion"
176 DeprecatedStringLiteralToCharPtr =
false;
177 QualificationIncludesObjCLifetime =
false;
178 ReferenceBinding =
false;
179 DirectBinding =
false;
180 IsLvalueReference =
true;
181 BindsToFunctionLvalue =
false;
182 BindsToRvalue =
false;
183 BindsImplicitObjectArgumentWithoutRefQualifier =
false;
184 ObjCLifetimeConversionBinding =
false;
185 CopyConstructor =
nullptr;
212 (getFromType()->isPointerType() ||
213 getFromType()->isObjCObjectPointerType() ||
214 getFromType()->isBlockPointerType() ||
215 getFromType()->isNullPtrType() ||
248 while (
const ImplicitCastExpr *ICE = dyn_cast<ImplicitCastExpr>(Converted)) {
249 switch (ICE->getCastKind()) {
257 Converted = ICE->getSubExpr();
279 const Expr *Converted,
282 assert(Ctx.
getLangOpts().CPlusPlus &&
"narrowing check outside C++");
291 if (FromType->isRealFloatingType())
292 goto FloatingIntegralConversion;
293 if (FromType->isIntegralOrUnscopedEnumerationType())
294 goto IntegralConversion;
306 FloatingIntegralConversion:
307 if (FromType->isRealFloatingType() && ToType->
isIntegralType(Ctx)) {
310 llvm::APSInt IntConstantValue;
316 Result.convertFromAPInt(IntConstantValue, IntConstantValue.isSigned(),
317 llvm::APFloat::rmNearestTiesToEven);
319 llvm::APSInt ConvertedValue = IntConstantValue;
321 Result.convertToInteger(ConvertedValue,
322 llvm::APFloat::rmTowardZero, &ignored);
324 if (IntConstantValue != ConvertedValue) {
325 ConstantValue =
APValue(IntConstantValue);
326 ConstantType = Initializer->
getType();
347 assert(ConstantValue.
isFloat());
348 llvm::APFloat FloatVal = ConstantValue.
getFloat();
351 llvm::APFloat::opStatus ConvertStatus = FloatVal.convert(
353 llvm::APFloat::rmNearestTiesToEven, &ignored);
356 if (ConvertStatus & llvm::APFloat::opOverflow) {
357 ConstantType = Initializer->
getType();
372 IntegralConversion: {
373 assert(FromType->isIntegralOrUnscopedEnumerationType());
375 const bool FromSigned = FromType->isSignedIntegerOrEnumerationType();
376 const unsigned FromWidth = Ctx.
getIntWidth(FromType);
380 if (FromWidth > ToWidth ||
381 (FromWidth == ToWidth && FromSigned != ToSigned) ||
382 (FromSigned && !ToSigned)) {
384 llvm::APSInt InitializerValue;
390 bool Narrowing =
false;
391 if (FromWidth < ToWidth) {
394 if (InitializerValue.isSigned() && InitializerValue.isNegative())
399 InitializerValue = InitializerValue.extend(
400 InitializerValue.getBitWidth() + 1);
402 llvm::APSInt ConvertedValue = InitializerValue;
403 ConvertedValue = ConvertedValue.trunc(ToWidth);
404 ConvertedValue.setIsSigned(ToSigned);
405 ConvertedValue = ConvertedValue.extend(InitializerValue.getBitWidth());
406 ConvertedValue.setIsSigned(InitializerValue.isSigned());
408 if (ConvertedValue != InitializerValue)
412 ConstantType = Initializer->
getType();
413 ConstantValue =
APValue(InitializerValue);
429 raw_ostream &OS = llvm::errs();
430 bool PrintedSomething =
false;
433 PrintedSomething =
true;
437 if (PrintedSomething) {
442 if (CopyConstructor) {
443 OS <<
" (by copy constructor)";
444 }
else if (DirectBinding) {
445 OS <<
" (direct reference binding)";
446 }
else if (ReferenceBinding) {
447 OS <<
" (reference binding)";
449 PrintedSomething =
true;
453 if (PrintedSomething) {
457 PrintedSomething =
true;
460 if (!PrintedSomething) {
461 OS <<
"No conversions required";
468 raw_ostream &OS = llvm::errs();
469 if (Before.First || Before.Second || Before.Third) {
473 if (ConversionFunction)
474 OS <<
'\'' << *ConversionFunction <<
'\'';
476 OS <<
"aggregate initialization";
486 raw_ostream &OS = llvm::errs();
487 if (isStdInitializerListElement())
488 OS <<
"Worst std::initializer_list element conversion: ";
489 switch (ConversionKind) {
490 case StandardConversion:
491 OS <<
"Standard conversion: ";
494 case UserDefinedConversion:
495 OS <<
"User-defined conversion: ";
498 case EllipsisConversion:
499 OS <<
"Ellipsis conversion";
501 case AmbiguousConversion:
502 OS <<
"Ambiguous conversion";
505 OS <<
"Bad conversion";
517 conversions().~ConversionSet();
530 struct DFIArguments {
536 struct DFIParamWithArguments : DFIArguments {
548 Result.
Result =
static_cast<unsigned>(TDK);
550 Result.
Data =
nullptr;
561 Result.
Data = Info.
Param.getOpaqueValue();
566 DFIArguments *Saved =
new (
Context) DFIArguments;
576 DFIParamWithArguments *Saved =
new (
Context) DFIParamWithArguments;
577 Saved->Param = Info.
Param;
606 switch (static_cast<Sema::TemplateDeductionResult>(
Result)) {
628 Diag->~PartialDiagnosticAt();
629 HasDiagnostic =
false;
646 switch (static_cast<Sema::TemplateDeductionResult>(
Result)) {
659 return TemplateParameter::getFromOpaqueValue(Data);
663 return static_cast<DFIParamWithArguments*
>(Data)->Param;
674 switch (static_cast<Sema::TemplateDeductionResult>(
Result)) {
700 switch (static_cast<Sema::TemplateDeductionResult>(
Result)) {
715 return &
static_cast<DFIArguments*
>(Data)->FirstArg;
726 switch (static_cast<Sema::TemplateDeductionResult>(
Result)) {
741 return &
static_cast<DFIArguments*
>(Data)->SecondArg;
752 if (static_cast<Sema::TemplateDeductionResult>(
Result) ==
754 return static_cast<Expr*
>(Data);
759 void OverloadCandidateSet::destroyCandidates() {
760 for (iterator i = begin(), e = end(); i != e; ++i) {
761 for (
unsigned ii = 0, ie = i->NumConversions; ii != ie; ++ii)
762 i->Conversions[ii].~ImplicitConversionSequence();
764 i->DeductionFailure.Destroy();
770 NumInlineSequences = 0;
776 class UnbridgedCastsSet {
786 Entry entry = { &E, E };
787 Entries.push_back(entry);
793 i = Entries.begin(), e = Entries.end(); i != e; ++i)
808 UnbridgedCastsSet *unbridgedCasts =
nullptr) {
812 if (placeholder->getKind() == BuiltinType::Overload)
return false;
816 if (placeholder->getKind() == BuiltinType::ARCUnbridgedCast &&
818 unbridgedCasts->save(S, E);
839 UnbridgedCastsSet &unbridged) {
840 for (
unsigned i = 0, e = Args.size(); i != e; ++i)
883 NamedDecl *&Match,
bool NewIsUsingDecl) {
888 bool OldIsUsingDecl =
false;
889 if (isa<UsingShadowDecl>(OldD)) {
890 OldIsUsingDecl =
true;
894 if (NewIsUsingDecl)
continue;
896 OldD = cast<UsingShadowDecl>(OldD)->getTargetDecl();
904 bool UseMemberUsingDeclRules =
905 (OldIsUsingDecl || NewIsUsingDecl) && CurContext->isRecord() &&
909 if (!IsOverload(New, OldF, UseMemberUsingDeclRules)) {
910 if (UseMemberUsingDeclRules && OldIsUsingDecl) {
911 HideUsingShadowDecl(S, cast<UsingShadowDecl>(*I));
915 if (!isa<FunctionTemplateDecl>(OldD) &&
916 !shouldLinkPossiblyHiddenDecl(*I, New))
922 }
else if (isa<UsingDecl>(OldD)) {
926 }
else if (isa<TagDecl>(OldD)) {
928 }
else if (isa<UnresolvedUsingValueDecl>(OldD)) {
937 return Ovl_NonFunction;
945 bool UseUsingDeclRules) {
960 if ((OldTemplate ==
nullptr) != (NewTemplate ==
nullptr))
973 if (isa<FunctionNoProtoType>(OldQType.
getTypePtr()) ||
974 isa<FunctionNoProtoType>(NewQType.
getTypePtr()))
983 if (OldQType != NewQType &&
985 OldType->
isVariadic() != NewType->isVariadic() ||
986 !FunctionParamTypesAreEqual(OldType, NewType)))
1001 if (!UseUsingDeclRules && NewTemplate &&
1004 false, TPL_TemplateMatch) ||
1018 if (OldMethod && NewMethod &&
1019 !OldMethod->
isStatic() && !NewMethod->isStatic()) {
1021 if (!UseUsingDeclRules &&
1023 NewMethod->getRefQualifier() ==
RQ_None)) {
1030 Diag(NewMethod->getLocation(), diag::err_ref_qualifier_overload)
1042 unsigned NewQuals = NewMethod->getTypeQualifiers();
1043 if (!getLangOpts().
CPlusPlus14 && NewMethod->isConstexpr() &&
1044 !isa<CXXConstructorDecl>(NewMethod))
1050 if (OldQuals != NewQuals)
1060 NewI != NewE || OldI != OldE; ++NewI, ++OldI) {
1061 if (NewI == NewE || OldI == OldE)
1063 llvm::FoldingSetNodeID NewID, OldID;
1065 OldI->getCond()->Profile(OldID,
Context,
true);
1080 return FD->
isUnavailable() && !cast<Decl>(CurContext)->isUnavailable();
1089 bool SuppressUserConversions,
1091 bool InOverloadResolution,
1093 bool AllowObjCWritebackConversion,
1094 bool AllowObjCConversionOnExplicit) {
1097 if (SuppressUserConversions) {
1108 Conversions, AllowExplicit,
1109 AllowObjCConversionOnExplicit)) {
1127 if (Constructor->isCopyConstructor() &&
1128 (FromCanon == ToCanon || S.
IsDerivedFrom(FromCanon, ToCanon))) {
1136 if (ToCanon != FromCanon)
1147 Cand != Conversions.end(); ++Cand)
1190 bool SuppressUserConversions,
1192 bool InOverloadResolution,
1194 bool AllowObjCWritebackConversion,
1195 bool AllowObjCConversionOnExplicit) {
1198 ICS.
Standard, CStyle, AllowObjCWritebackConversion)){
1238 AllowExplicit, InOverloadResolution, CStyle,
1239 AllowObjCWritebackConversion,
1240 AllowObjCConversionOnExplicit);
1245 bool SuppressUserConversions,
1247 bool InOverloadResolution,
1249 bool AllowObjCWritebackConversion) {
1251 SuppressUserConversions, AllowExplicit,
1252 InOverloadResolution, CStyle,
1253 AllowObjCWritebackConversion,
1266 return PerformImplicitConversion(From, ToType, Action, AllowExplicit, ICS);
1277 bool AllowObjCWritebackConversion
1278 = getLangOpts().ObjCAutoRefCount &&
1279 (Action == AA_Passing || Action == AA_Sending);
1280 if (getLangOpts().ObjC1)
1281 CheckObjCBridgeRelatedConversions(From->getLocStart(),
1282 ToType, From->
getType(), From);
1288 AllowObjCWritebackConversion,
1290 return PerformImplicitConversion(From, ToType, ICS, Action);
1308 if (TyClass != CanFrom->getTypeClass())
return false;
1309 if (TyClass != Type::FunctionProto && TyClass != Type::FunctionNoProto) {
1310 if (TyClass == Type::Pointer) {
1313 }
else if (TyClass == Type::BlockPointer) {
1316 }
else if (TyClass == Type::MemberPointer) {
1323 TyClass = CanTo->getTypeClass();
1324 if (TyClass != CanFrom->getTypeClass())
return false;
1325 if (TyClass != Type::FunctionProto && TyClass != Type::FunctionNoProto)
1329 const FunctionType *FromFn = cast<FunctionType>(CanFrom);
1331 if (!EInfo.getNoReturn())
return false;
1334 assert(
QualType(FromFn, 0).isCanonical());
1335 if (
QualType(FromFn, 0) != CanTo)
return false;
1387 bool InOverloadResolution,
1400 bool InOverloadResolution,
1403 bool AllowObjCWritebackConversion) {
1453 if (Method && !Method->
isStatic()) {
1455 "Non-unary operator on non-static member address");
1456 assert(cast<UnaryOperator>(From->
IgnoreParens())->getOpcode()
1458 "Non-address-of operator on non-static member address");
1459 const Type *ClassType
1463 assert(cast<UnaryOperator>(From->
IgnoreParens())->getOpcode() ==
1465 "Non-address-of operator for overloaded function expression");
1490 FromType = Atomic->getValueType();
1540 bool IncompatibleObjC =
false;
1594 }
else if (AllowObjCWritebackConversion &&
1598 FromType, IncompatibleObjC)) {
1604 InOverloadResolution, FromType)) {
1619 InOverloadResolution,
1642 bool ObjCLifetimeConversion;
1644 ObjCLifetimeConversion)) {
1664 CanonFrom = CanonTo;
1671 if (CanonFrom != CanonTo)
1680 bool InOverloadResolution,
1690 for (
const auto *it : UD->
fields()) {
1693 ToType = it->getType();
1724 return To->
getKind() == BuiltinType::Int;
1727 return To->
getKind() == BuiltinType::UInt;
1751 if (FromEnumType->getDecl()->isScoped())
1758 if (FromEnumType->getDecl()->isFixed()) {
1759 QualType Underlying = FromEnumType->getDecl()->getIntegerType();
1761 IsIntegralPromotion(
nullptr, Underlying, ToType);
1766 !RequireCompleteType(From->getLocStart(), FromType, 0))
1768 ToType, FromEnumType->getDecl()->getPromotionType());
1794 for (
int Idx = 0; Idx < 6; ++Idx) {
1796 if (FromSize < ToSize ||
1797 (FromSize == ToSize &&
1798 FromIsSigned == PromoteTypes[Idx]->isSignedIntegerType())) {
1818 llvm::APSInt BitWidth;
1820 MemberDecl->getBitWidth()->isIntegerConstantExpr(BitWidth,
Context)) {
1821 llvm::APSInt ToSize(BitWidth.getBitWidth(), BitWidth.isUnsigned());
1825 if (BitWidth < ToSize ||
1827 return To->
getKind() == BuiltinType::Int;
1833 return To->
getKind() == BuiltinType::UInt;
1858 if (FromBuiltin->getKind() == BuiltinType::Float &&
1859 ToBuiltin->getKind() == BuiltinType::Double)
1865 if (!getLangOpts().CPlusPlus &&
1866 (FromBuiltin->getKind() == BuiltinType::Float ||
1867 FromBuiltin->getKind() == BuiltinType::Double) &&
1868 (ToBuiltin->getKind() == BuiltinType::LongDouble))
1872 if (!getLangOpts().NativeHalfType &&
1873 FromBuiltin->getKind() == BuiltinType::Half &&
1874 ToBuiltin->getKind() == BuiltinType::Float)
1911 bool StripObjCLifetime =
false) {
1914 "Invalid similarly-qualified pointer type");
1925 if (StripObjCLifetime)
1936 if (isa<ObjCObjectPointerType>(ToType))
1945 if (isa<ObjCObjectPointerType>(ToType))
1951 bool InOverloadResolution,
1957 return !InOverloadResolution;
1981 bool InOverloadResolution,
1983 bool &IncompatibleObjC) {
1984 IncompatibleObjC =
false;
1985 if (isObjCPointerConversion(FromType, ToType, ConvertedType,
1992 ConvertedType = ToType;
1999 ConvertedType = ToType;
2006 ConvertedType = ToType;
2014 ConvertedType = ToType;
2024 ConvertedType = ToType;
2032 !getLangOpts().ObjCAutoRefCount) {
2063 if (getLangOpts().MicrosoftExt && FromPointeeType->
isFunctionType() &&
2097 !RequireCompleteType(From->getLocStart(), FromPointeeType, 0) &&
2098 IsDerivedFrom(FromPointeeType, ToPointeeType)) {
2135 bool &IncompatibleObjC) {
2136 if (!getLangOpts().ObjC1)
2148 if (ToObjCPtr && FromObjCPtr) {
2159 if (getLangOpts().
CPlusPlus && LHS && RHS &&
2161 FromObjCPtr->getPointeeType()))
2174 IncompatibleObjC =
true;
2190 if (FromObjCPtr && FromObjCPtr->isObjCBuiltinType()) {
2218 isObjCPointerConversion(FromPointeeType, ToPointeeType, ConvertedType,
2219 IncompatibleObjC)) {
2221 IncompatibleObjC =
true;
2230 isObjCPointerConversion(FromPointeeType, ToPointeeType, ConvertedType,
2231 IncompatibleObjC)) {
2246 if (FromFunctionType && ToFunctionType) {
2255 if (FromFunctionType->
getNumParams() != ToFunctionType->getNumParams() ||
2256 FromFunctionType->
isVariadic() != ToFunctionType->isVariadic() ||
2257 FromFunctionType->
getTypeQuals() != ToFunctionType->getTypeQuals())
2260 bool HasObjCConversion =
false;
2264 }
else if (isObjCPointerConversion(FromFunctionType->
getReturnType(),
2265 ToFunctionType->getReturnType(),
2266 ConvertedType, IncompatibleObjC)) {
2268 HasObjCConversion =
true;
2275 for (
unsigned ArgIdx = 0, NumArgs = FromFunctionType->
getNumParams();
2276 ArgIdx != NumArgs; ++ArgIdx) {
2278 QualType ToArgType = ToFunctionType->getParamType(ArgIdx);
2282 }
else if (isObjCPointerConversion(FromArgType, ToArgType,
2283 ConvertedType, IncompatibleObjC)) {
2285 HasObjCConversion =
true;
2292 if (HasObjCConversion) {
2296 IncompatibleObjC =
true;
2315 if (!getLangOpts().ObjCAutoRefCount ||
2357 bool IncompatibleObjC;
2359 FromPointee = ToPointee;
2360 else if (!isObjCPointerConversion(FromPointee, ToPointee, FromPointee,
2395 if (!FromFunctionType || !ToFunctionType)
2403 if (FromFunctionType->
getNumParams() != ToFunctionType->getNumParams() ||
2404 FromFunctionType->
isVariadic() != ToFunctionType->isVariadic())
2409 if (FromEInfo != ToEInfo)
2412 bool IncompatibleObjC =
false;
2414 ToFunctionType->getReturnType())) {
2418 QualType LHS = ToFunctionType->getReturnType();
2425 }
else if (isObjCPointerConversion(RHS, LHS,
2426 ConvertedType, IncompatibleObjC)) {
2427 if (IncompatibleObjC)
2436 for (
unsigned ArgIdx = 0, NumArgs = FromFunctionType->
getNumParams();
2437 ArgIdx != NumArgs; ++ArgIdx) {
2438 IncompatibleObjC =
false;
2440 QualType ToArgType = ToFunctionType->getParamType(ArgIdx);
2443 }
else if (isObjCPointerConversion(ToArgType, FromArgType,
2444 ConvertedType, IncompatibleObjC)) {
2445 if (IncompatibleObjC)
2452 if (LangOpts.ObjCAutoRefCount &&
2457 ConvertedType = ToType;
2520 if (!FromFunction || !ToFunction) {
2525 if (FromFunction->
getNumParams() != ToFunction->getNumParams()) {
2533 if (!FunctionParamTypesAreEqual(FromFunction, ToFunction, &ArgPos)) {
2535 << ToFunction->getParamType(ArgPos)
2542 ToFunction->getReturnType())) {
2549 ToQuals = ToFunction->getTypeQuals();
2550 if (FromQuals != ToQuals) {
2569 O && (O != E); ++O, ++N) {
2571 N->getUnqualifiedType())) {
2589 bool IgnoreBaseAccess) {
2591 bool IsCStyleOrFunctionalCast = IgnoreBaseAccess;
2599 DiagRuntimeBehavior(From->
getExprLoc(), From,
2600 PDiag(diag::warn_impcast_bool_to_null_pointer)
2601 << ToType << From->getSourceRange());
2602 else if (!isUnevaluatedContext())
2604 << ToType << From->getSourceRange();
2611 if (FromPointeeType->
isRecordType() && ToPointeeType->isRecordType() &&
2615 if (CheckDerivedToBaseConversion(FromPointeeType, ToPointeeType,
2617 From->getSourceRange(), &BasePath,
2632 if (FromPtrType->isObjCBuiltinType() || ToPtrType->isObjCBuiltinType())
2659 bool InOverloadResolution,
2669 ConvertedType = ToType;
2684 !RequireCompleteType(From->getLocStart(), ToClass, 0) &&
2685 IsDerivedFrom(ToClass, FromClass)) {
2703 bool IgnoreBaseAccess) {
2710 "Expr must be null pointer constant!");
2716 assert(ToPtrType &&
"No member pointer cast has a target type "
2717 "that is not a member pointer.");
2723 assert(FromClass->
isRecordType() &&
"Pointer into non-class.");
2724 assert(ToClass->isRecordType() &&
"Pointer into non-class.");
2728 bool DerivationOkay = IsDerivedFrom(ToClass, FromClass, Paths);
2729 assert(DerivationOkay &&
2730 "Should not have been called if derivation isn't OK.");
2731 (void)DerivationOkay;
2734 getUnqualifiedType())) {
2735 std::string PathDisplayStr = getAmbiguousPathsDisplayString(Paths);
2737 << 0 << FromClass << ToClass << PathDisplayStr << From->getSourceRange();
2741 if (
const RecordType *VBase = Paths.getDetectedVirtual()) {
2743 << FromClass << ToClass <<
QualType(VBase, 0)
2744 << From->getSourceRange();
2748 if (!IgnoreBaseAccess)
2749 CheckBaseClassAccess(From->
getExprLoc(), FromClass, ToClass,
2751 diag::err_downcast_from_inaccessible_base);
2754 BuildBasePathArray(Paths, BasePath);
2780 bool CStyle,
bool &ObjCLifetimeConversion) {
2783 ObjCLifetimeConversion =
false;
2793 bool PreviousToQualsIncludeConst =
true;
2794 bool UnwrappedAnyPointer =
false;
2802 UnwrappedAnyPointer =
true;
2810 UnwrappedAnyPointer) {
2813 ObjCLifetimeConversion =
true;
2838 && !PreviousToQualsIncludeConst)
2843 PreviousToQualsIncludeConst
2844 = PreviousToQualsIncludeConst && ToQuals.
hasConst();
2861 bool InOverloadResolution,
2870 InOverloadResolution, InnerSCS,
2874 SCS.
Second = InnerSCS.Second;
2875 SCS.
setToType(1, InnerSCS.getToType(1));
2876 SCS.
Third = InnerSCS.Third;
2878 = InnerSCS.QualificationIncludesObjCLifetime;
2879 SCS.
setToType(2, InnerSCS.getToType(2));
2901 bool AllowExplicit) {
2904 Con != ConEnd; ++Con) {
2912 if (ConstructorTmpl)
2916 Constructor = cast<CXXConstructorDecl>(D);
2920 (AllowExplicit || !Constructor->isExplicit());
2924 bool SuppressUserConversions =
2926 if (ConstructorTmpl)
2930 SuppressUserConversions);
2934 SuppressUserConversions);
2938 bool HadMultipleCandidates = (CandidateSet.
size() > 1);
2966 llvm_unreachable(
"Invalid OverloadResult!");
2988 bool AllowObjCConversionOnExplicit) {
2989 assert(AllowExplicit || !AllowObjCConversionOnExplicit);
2992 bool ConstructorsOnly =
false;
3008 ConstructorsOnly =
true;
3017 = dyn_cast<CXXRecordDecl>(ToRecordType->getDecl())) {
3019 Expr **Args = &From;
3020 unsigned NumArgs = 1;
3021 bool ListInitializing =
false;
3022 if (
InitListExpr *InitList = dyn_cast<InitListExpr>(From)) {
3025 S, From, ToType, ToRecordDecl, User, CandidateSet, AllowExplicit);
3029 CandidateSet.
clear();
3033 Args = InitList->getInits();
3034 NumArgs = InitList->getNumInits();
3035 ListInitializing =
true;
3040 Con != ConEnd; ++Con) {
3048 if (ConstructorTmpl)
3052 Constructor = cast<CXXConstructorDecl>(D);
3055 if (ListInitializing)
3056 Usable = Usable && (AllowExplicit || !Constructor->isExplicit());
3058 Usable = Usable &&Constructor->isConvertingConstructor(AllowExplicit);
3060 bool SuppressUserConversions = !ConstructorsOnly;
3061 if (SuppressUserConversions && ListInitializing) {
3062 SuppressUserConversions =
false;
3067 S.
Context, Constructor, ToType);
3070 if (ConstructorTmpl)
3073 llvm::makeArrayRef(Args, NumArgs),
3074 CandidateSet, SuppressUserConversions);
3079 llvm::makeArrayRef(Args, NumArgs),
3080 CandidateSet, SuppressUserConversions);
3087 if (ConstructorsOnly || isa<InitListExpr>(From)) {
3093 = dyn_cast<CXXRecordDecl>(FromRecordType->getDecl())) {
3095 const auto &Conversions = FromRecordDecl->getVisibleConversionFunctions();
3096 for (
auto I = Conversions.begin(), E = Conversions.end(); I != E; ++I) {
3100 if (isa<UsingShadowDecl>(D))
3101 D = cast<UsingShadowDecl>(D)->getTargetDecl();
3105 if ((ConvTemplate = dyn_cast<FunctionTemplateDecl>(D)))
3108 Conv = cast<CXXConversionDecl>(D);
3110 if (AllowExplicit || !Conv->isExplicit()) {
3113 ActingContext, From, ToType,
3115 AllowObjCConversionOnExplicit);
3118 From, ToType, CandidateSet,
3119 AllowObjCConversionOnExplicit);
3125 bool HadMultipleCandidates = (CandidateSet.
size() > 1);
3134 = dyn_cast<CXXConstructorDecl>(Best->Function)) {
3142 if (isa<InitListExpr>(From)) {
3146 if (Best->Conversions[0].isEllipsis())
3149 User.
Before = Best->Conversions[0].Standard;
3162 = dyn_cast<CXXConversionDecl>(Best->Function)) {
3169 User.
Before = Best->Conversions[0].Standard;
3184 User.
After = Best->FinalConversion;
3187 llvm_unreachable(
"Not a constructor or conversion function?");
3196 llvm_unreachable(
"Invalid OverloadResult!");
3206 CandidateSet,
false,
false);
3208 Diag(From->getLocStart(), diag::err_typecheck_ambiguous_condition)
3209 << From->
getType() << ToType << From->getSourceRange();
3212 diag::err_typecheck_nonviable_condition_incomplete,
3213 From->
getType(), From->getSourceRange()))
3214 Diag(From->getLocStart(), diag::err_typecheck_nonviable_condition)
3215 << From->
getType() << From->getSourceRange() << ToType;
3248 if (Block1 != Block2)
3335 if (!ICS1.
isBad()) {
3478 else if (Rank2 < Rank1)
3499 bool SCS1ConvertsToVoid
3501 bool SCS2ConvertsToVoid
3503 if (SCS1ConvertsToVoid != SCS2ConvertsToVoid) {
3508 }
else if (!SCS1ConvertsToVoid && !SCS2ConvertsToVoid) {
3514 }
else if (SCS1ConvertsToVoid && SCS2ConvertsToVoid &&
3543 if (FromObjCPtr1 && FromObjCPtr2) {
3548 if (AssignLeft != AssignRight) {
3581 if (UnqualT1 == UnqualT2) {
3593 if (isa<ArrayType>(T1) && T1Quals)
3595 if (isa<ArrayType>(T2) && T2Quals)
3654 if (UnqualT1 == UnqualT2)
3659 if (isa<ArrayType>(T1) && T1Quals)
3661 if (isa<ArrayType>(T2) && T2Quals)
3784 if (FromPointee1 == FromPointee2 && ToPointee1 != ToPointee2) {
3792 if (FromPointee1 != FromPointee2 && ToPointee1 == ToPointee2) {
3809 if (FromPtr1 && FromPtr2 && ToPtr1 && ToPtr2) {
3816 bool FromAssignRight
3825 if (ToPtr1->isObjCIdType() &&
3826 (ToPtr2->isObjCQualifiedIdType() || ToPtr2->getInterfaceDecl()))
3828 if (ToPtr2->isObjCIdType() &&
3829 (ToPtr1->isObjCQualifiedIdType() || ToPtr1->getInterfaceDecl()))
3834 if (ToPtr1->isObjCQualifiedIdType() && ToPtr2->getInterfaceDecl())
3836 if (ToPtr2->isObjCQualifiedIdType() && ToPtr1->getInterfaceDecl())
3841 if (ToPtr1->isObjCClassType() &&
3842 (ToPtr2->isObjCQualifiedClassType() || ToPtr2->getInterfaceDecl()))
3844 if (ToPtr2->isObjCClassType() &&
3845 (ToPtr1->isObjCQualifiedClassType() || ToPtr1->getInterfaceDecl()))
3850 if (ToPtr1->isObjCQualifiedClassType() && ToPtr2->getInterfaceDecl())
3852 if (ToPtr2->isObjCQualifiedClassType() && ToPtr1->getInterfaceDecl())
3858 (ToAssignLeft != ToAssignRight))
3864 (FromAssignLeft != FromAssignRight))
3882 const Type *FromPointeeType1 = FromMemPointer1->
getClass();
3883 const Type *ToPointeeType1 = ToMemPointer1->getClass();
3884 const Type *FromPointeeType2 = FromMemPointer2->getClass();
3885 const Type *ToPointeeType2 = ToMemPointer2->getClass();
3891 if (FromPointee1 == FromPointee2 && ToPointee1 != ToPointee2) {
3898 if (ToPointee1 == ToPointee2 && FromPointee1 != FromPointee2) {
3939 return !Record->isInvalidDecl();
3954 bool &DerivedToBase,
3955 bool &ObjCConversion,
3956 bool &ObjCLifetimeConversion) {
3958 "T1 must be the pointee type of the reference type");
3959 assert(!OrigT2->
isReferenceType() &&
"T2 cannot be a reference type");
3971 DerivedToBase =
false;
3972 ObjCConversion =
false;
3973 ObjCLifetimeConversion =
false;
3974 if (UnqualT1 == UnqualT2) {
3979 DerivedToBase =
true;
3983 ObjCConversion =
true;
3992 if (isa<ArrayType>(T1) && T1Quals)
3994 if (isa<ArrayType>(T2) && T2Quals)
4012 ObjCLifetimeConversion =
true;
4018 if (T1Quals == T2Quals)
4032 bool AllowExplicit) {
4033 assert(T2->
isRecordType() &&
"Can only find conversions of record types.");
4038 const auto &Conversions = T2RecordDecl->getVisibleConversionFunctions();
4039 for (
auto I = Conversions.begin(), E = Conversions.end(); I != E; ++I) {
4042 if (isa<UsingShadowDecl>(D))
4043 D = cast<UsingShadowDecl>(D)->getTargetDecl();
4051 Conv = cast<CXXConversionDecl>(D);
4055 if (!AllowExplicit && Conv->isExplicit())
4059 bool DerivedToBase =
false;
4060 bool ObjCConversion =
false;
4061 bool ObjCLifetimeConversion =
false;
4072 if (!ConvTemplate &&
4075 Conv->getConversionType().getNonReferenceType()
4076 .getUnqualifiedType(),
4078 DerivedToBase, ObjCConversion, ObjCLifetimeConversion) ==
4096 Init, DeclType, CandidateSet,
4100 DeclType, CandidateSet,
4104 bool HadMultipleCandidates = (CandidateSet.size() > 1);
4107 switch (CandidateSet.BestViableFunction(S, DeclLoc, Best,
true)) {
4119 if (!Best->FinalConversion.DirectBinding)
4131 "Expected a direct reference binding!");
4137 Cand != CandidateSet.end(); ++Cand)
4149 llvm_unreachable(
"Invalid OverloadResult!");
4157 bool SuppressUserConversions,
4158 bool AllowExplicit) {
4159 assert(DeclType->
isReferenceType() &&
"Reference init needs a reference");
4180 bool DerivedToBase =
false;
4181 bool ObjCConversion =
false;
4182 bool ObjCLifetimeConversion =
false;
4186 ObjCConversion, ObjCLifetimeConversion);
4215 ICS.Standard.setToType(0, T2);
4216 ICS.Standard.setToType(1, T1);
4217 ICS.Standard.setToType(2, T1);
4218 ICS.Standard.ReferenceBinding =
true;
4219 ICS.Standard.DirectBinding =
true;
4220 ICS.Standard.IsLvalueReference = !isRValRef;
4222 ICS.Standard.BindsToRvalue =
false;
4223 ICS.Standard.BindsImplicitObjectArgumentWithoutRefQualifier =
false;
4224 ICS.Standard.ObjCLifetimeConversionBinding = ObjCLifetimeConversion;
4225 ICS.Standard.CopyConstructor =
nullptr;
4226 ICS.Standard.DeprecatedStringLiteralToCharPtr =
false;
4273 ICS.Standard.setToType(0, T2);
4274 ICS.Standard.setToType(1, T1);
4275 ICS.Standard.setToType(2, T1);
4276 ICS.Standard.ReferenceBinding =
true;
4282 ICS.Standard.DirectBinding =
4285 ICS.Standard.IsLvalueReference = !isRValRef;
4287 ICS.Standard.BindsToRvalue = InitCategory.
isRValue();
4288 ICS.Standard.BindsImplicitObjectArgumentWithoutRefQualifier =
false;
4289 ICS.Standard.ObjCLifetimeConversionBinding = ObjCLifetimeConversion;
4290 ICS.Standard.CopyConstructor =
nullptr;
4291 ICS.Standard.DeprecatedStringLiteralToCharPtr =
false;
4314 if (ICS.isUserDefined() && isRValRef &&
4383 if (ICS.isStandard()) {
4384 ICS.Standard.ReferenceBinding =
true;
4385 ICS.Standard.IsLvalueReference = !isRValRef;
4386 ICS.Standard.BindsToFunctionLvalue =
false;
4387 ICS.Standard.BindsToRvalue =
true;
4388 ICS.Standard.BindsImplicitObjectArgumentWithoutRefQualifier =
false;
4389 ICS.Standard.ObjCLifetimeConversionBinding =
false;
4390 }
else if (ICS.isUserDefined()) {
4392 ICS.UserDefined.ConversionFunction->getReturnType()
4409 ICS.UserDefined.Before.setAsIdentityConversion();
4410 ICS.UserDefined.After.ReferenceBinding =
true;
4411 ICS.UserDefined.After.IsLvalueReference = !isRValRef;
4412 ICS.UserDefined.After.BindsToFunctionLvalue =
false;
4413 ICS.UserDefined.After.BindsToRvalue = !LValRefType;
4414 ICS.UserDefined.After.BindsImplicitObjectArgumentWithoutRefQualifier =
false;
4415 ICS.UserDefined.After.ObjCLifetimeConversionBinding =
false;
4423 bool SuppressUserConversions,
4424 bool InOverloadResolution,
4425 bool AllowObjCWritebackConversion,
4426 bool AllowExplicit =
false);
4432 bool SuppressUserConversions,
4433 bool InOverloadResolution,
4434 bool AllowObjCWritebackConversion) {
4463 SuppressUserConversions,
4464 InOverloadResolution,
4465 AllowObjCWritebackConversion);
4498 bool toStdInitializerList =
false;
4505 for (
unsigned i = 0, e = From->
getNumInits(); i < e; ++i) {
4509 InOverloadResolution,
4510 AllowObjCWritebackConversion);
4517 if (Result.
isBad() ||
4547 InOverloadResolution,
false,
4548 AllowObjCWritebackConversion,
4602 Init, ToType,
false, Found))
4607 bool dummy1 =
false;
4608 bool dummy2 =
false;
4609 bool dummy3 =
false;
4616 SuppressUserConversions,
4624 InOverloadResolution,
4625 AllowObjCWritebackConversion);
4629 "Sub-initialization cannot result in ellipsis conversion.");
4656 if (NumInits == 1 && !isa<InitListExpr>(From->
getInit(0)))
4658 SuppressUserConversions,
4659 InOverloadResolution,
4660 AllowObjCWritebackConversion);
4663 else if (NumInits == 0) {
4686 bool SuppressUserConversions,
4687 bool InOverloadResolution,
4688 bool AllowObjCWritebackConversion,
4689 bool AllowExplicit) {
4690 if (
InitListExpr *FromInitList = dyn_cast<InitListExpr>(From))
4692 InOverloadResolution,AllowObjCWritebackConversion);
4696 From->getLocStart(),
4697 SuppressUserConversions,
4701 SuppressUserConversions,
4703 InOverloadResolution,
4705 AllowObjCWritebackConversion,
4718 return !ICS.
isBad();
4732 unsigned Quals = isa<CXXDestructorDecl>(Method) ?
4746 assert(FromClassification.
isLValue());
4772 != FromTypeCanon.getLocalCVRQualifiers() &&
4775 FromType, ImplicitParamType);
4789 FromType, ImplicitParamType);
4809 if (!FromClassification.
isRValue()) {
4852 FromRecordType = From->
getType();
4853 DestType = ImplicitParamRecordType;
4867 Diag(From->getLocStart(),
4868 diag::err_member_function_call_bad_cvr)
4869 << Method->getDeclName() << FromRecordType << (CVR - 1)
4870 << From->getSourceRange();
4871 Diag(Method->getLocation(), diag::note_previous_decl)
4872 << Method->getDeclName();
4877 return Diag(From->getLocStart(),
4878 diag::err_implicit_object_parameter_init)
4879 << ImplicitParamRecordType << FromRecordType << From->getSourceRange();
4887 From = FromRes.
get();
4920 return Diag(From->getLocStart(),
4921 diag::err_typecheck_bool_condition)
4922 << From->
getType() << From->getSourceRange();
4977 llvm_unreachable(
"found a first conversion kind in Second");
4980 llvm_unreachable(
"found a third conversion kind in Second");
4986 llvm_unreachable(
"unknown conversion kind");
4997 "converted constant expression outside C++11");
5026 return S.
Diag(From->getLocStart(),
5027 diag::err_typecheck_converted_constant_expression)
5028 << From->
getType() << From->getSourceRange() << T;
5032 llvm_unreachable(
"ellipsis conversion in converted constant expression");
5037 return S.
Diag(From->getLocStart(),
5038 diag::err_typecheck_converted_constant_expression_disallowed)
5039 << From->
getType() << From->getSourceRange() << T;
5043 return S.
Diag(From->getLocStart(),
5044 diag::err_typecheck_converted_constant_expression_indirect)
5045 << From->
getType() << From->getSourceRange() << T;
5057 PreNarrowingType)) {
5065 S.
Diag(From->getLocStart(), diag::ext_cce_narrowing)
5071 S.
Diag(From->getLocStart(), diag::ext_cce_narrowing)
5072 << CCE << 0 << From->
getType() << T;
5084 (RequireInt && !Eval.
Val.
isInt())) {
5091 if (Notes.empty()) {
5098 if (Notes.size() == 1 &&
5099 Notes[0].second.getDiagID() == diag::note_invalid_subexpr_in_const_expr)
5100 S.
Diag(Notes[0].first, diag::err_expr_not_cce) << CCE;
5102 S.
Diag(From->getLocStart(), diag::err_expr_not_cce)
5103 << CCE << From->getSourceRange();
5104 for (
unsigned I = 0; I < Notes.size(); ++I)
5105 S.
Diag(Notes[I].first, Notes[I].second);
5116 llvm::APSInt &
Value,
5204 for (
unsigned I = 0, N = ViableConversions.
size(); I != N; ++I) {
5206 cast<CXXConversionDecl>(ViableConversions[I]->getUnderlyingDecl());
5216 QualType T,
bool HadMultipleCandidates,
5218 if (ExplicitConversions.
size() == 1 && !Converter.
Suppress) {
5226 std::string TypeStr;
5231 "static_cast<" + TypeStr +
">(")
5243 HadMultipleCandidates);
5256 QualType T,
bool HadMultipleCandidates,
5268 << From->getSourceRange();
5272 HadMultipleCandidates);
5287 << From->getSourceRange();
5296 for (
unsigned I = 0, N = ViableConversions.
size(); I != N; ++I) {
5300 if (isa<UsingShadowDecl>(D))
5301 D = cast<UsingShadowDecl>(D)->getTargetDecl();
5305 if ((ConvTemplate = dyn_cast<FunctionTemplateDecl>(D)))
5308 Conv = cast<CXXConversionDecl>(D);
5312 ConvTemplate, FoundDecl, ActingContext, From, ToType, CandidateSet,
5316 ToType, CandidateSet,
5350 From = result.
get();
5355 if (Converter.
match(T))
5380 } IncompleteDiagnoser(Converter, From);
5389 const auto &Conversions =
5390 cast<CXXRecordDecl>(RecordTy->
getDecl())->getVisibleConversionFunctions();
5392 bool HadMultipleCandidates =
5393 (std::distance(Conversions.begin(), Conversions.end()) > 1);
5397 bool HasUniqueTargetType =
true;
5400 for (
auto I = Conversions.begin(), E = Conversions.end(); I != E; ++I) {
5410 Conversion = cast<CXXConversionDecl>(D);
5413 "Conversion operator templates are considered potentially "
5417 if (Converter.
match(CurToType) || ConvTemplate) {
5423 ExplicitConversions.
addDecl(I.getDecl(), I.getAccess());
5428 else if (HasUniqueTargetType &&
5430 HasUniqueTargetType =
false;
5432 ViableConversions.
addDecl(I.getDecl(), I.getAccess());
5450 HadMultipleCandidates,
5451 ExplicitConversions))
5457 if (!HasUniqueTargetType)
5476 HadMultipleCandidates, Found))
5485 HadMultipleCandidates,
5486 ExplicitConversions))
5494 switch (ViableConversions.
size()) {
5497 HadMultipleCandidates,
5498 ExplicitConversions))
5508 HadMultipleCandidates, Found))
5573 bool SuppressUserConversions,
5574 bool PartialOverloading,
5575 bool AllowExplicit) {
5578 assert(Proto &&
"Functions without a prototype cannot be overloaded");
5580 "Use AddTemplateOverloadCandidate for function templates");
5582 if (
CXXMethodDecl *Method = dyn_cast<CXXMethodDecl>(Function)) {
5583 if (!isa<CXXConstructorDecl>(Method)) {
5593 Args, CandidateSet, SuppressUserConversions,
5594 PartialOverloading);
5640 if (Args.size() == 1 &&
5644 Candidate.
Viable =
false;
5657 Candidate.
Viable =
false;
5668 if (Args.size() < MinRequiredArgs && !PartialOverloading) {
5670 Candidate.
Viable =
false;
5683 Candidate.
Viable =
false;
5690 for (
unsigned ArgIdx = 0; ArgIdx < Args.size(); ++ArgIdx) {
5691 if (ArgIdx < NumParams) {
5699 SuppressUserConversions,
5705 Candidate.
Viable =
false;
5717 if (EnableIfAttr *FailedAttr =
CheckEnableIf(Function, Args)) {
5718 Candidate.
Viable =
false;
5731 for (
unsigned b = 0, e = Methods.size(); b < e; b++) {
5739 if (Args.size() < NumNamedArgs)
5742 for (
unsigned i = 0; i < NumNamedArgs; i++) {
5744 if (Args[i]->isTypeDependent()) {
5750 Expr *argExpr = Args[i];
5751 assert(argExpr &&
"SelectBestMethod(): missing expression");
5756 !param->
hasAttr<CFConsumedAttr>())
5772 if (ConversionState.
isBad()) {
5779 for (
unsigned i = NumNamedArgs, e = Args.size(); i < e; ++i) {
5780 if (Args[i]->isTypeDependent()) {
5793 if (Args.size() != NumNamedArgs)
5795 else if (Match && NumNamedArgs == 0 && Methods.size() > 1) {
5798 for (
unsigned b = 0, e = Methods.size(); b < e; b++) {
5799 QualType ReturnT = Methods[b]->getReturnType();
5815 bool MissingImplicitThis) {
5821 AttrVec::iterator E = std::remove_if(Attrs.begin(), Attrs.end(),
5823 if (Attrs.begin() == E)
5825 std::reverse(Attrs.begin(), E);
5831 bool InitializationFailed =
false;
5832 bool ContainsValueDependentExpr =
false;
5833 for (
unsigned i = 0, e = Args.size(); i != e; ++i) {
5834 if (i == 0 && !MissingImplicitThis && isa<CXXMethodDecl>(Function) &&
5835 !cast<CXXMethodDecl>(Function)->isStatic() &&
5836 !isa<CXXConstructorDecl>(Function)) {
5841 if (R.isInvalid()) {
5842 InitializationFailed =
true;
5845 ContainsValueDependentExpr |= R.get()->isValueDependent();
5846 ConvertedArgs.push_back(R.get());
5855 InitializationFailed =
true;
5859 ConvertedArgs.push_back(R.
get());
5863 if (InitializationFailed || Trap.hasErrorOccurred())
5864 return cast<EnableIfAttr>(Attrs[0]);
5866 for (AttrVec::iterator I = Attrs.begin(); I != E; ++I) {
5868 EnableIfAttr *EIA = cast<EnableIfAttr>(*I);
5869 if (EIA->getCond()->isValueDependent()) {
5874 if (!EIA->getCond()->EvaluateWithSubstitution(
5875 Result,
Context, Function, llvm::makeArrayRef(ConvertedArgs))) {
5876 if (!ContainsValueDependentExpr)
5878 }
else if (!Result.
isInt() || !Result.
getInt().getBoolValue()) {
5891 bool SuppressUserConversions,
5892 bool PartialOverloading) {
5896 if (isa<CXXMethodDecl>(FD) && !cast<CXXMethodDecl>(FD)->isStatic())
5898 cast<CXXMethodDecl>(FD)->getParent(),
5899 Args[0]->getType(), Args[0]->Classify(
Context),
5900 Args.slice(1), CandidateSet,
5901 SuppressUserConversions, PartialOverloading);
5904 SuppressUserConversions, PartialOverloading);
5911 ExplicitTemplateArgs,
5913 Args[0]->Classify(
Context), Args.slice(1),
5914 CandidateSet, SuppressUserConversions,
5915 PartialOverloading);
5918 ExplicitTemplateArgs, Args,
5919 CandidateSet, SuppressUserConversions,
5920 PartialOverloading);
5932 bool SuppressUserConversions) {
5936 if (isa<UsingShadowDecl>(Decl))
5937 Decl = cast<UsingShadowDecl>(Decl)->getTargetDecl();
5940 assert(isa<CXXMethodDecl>(TD->getTemplatedDecl()) &&
5941 "Expected a member function template");
5944 ObjectType, ObjectClassification,
5946 SuppressUserConversions);
5949 ObjectType, ObjectClassification,
5951 CandidateSet, SuppressUserConversions);
5968 bool SuppressUserConversions,
5969 bool PartialOverloading) {
5972 assert(Proto &&
"Methods without a prototype cannot be overloaded");
5973 assert(!isa<CXXConstructorDecl>(Method) &&
5974 "Use AddOverloadCandidate for constructors");
6004 Candidate.
Viable =
false;
6015 if (Args.size() < MinRequiredArgs && !PartialOverloading) {
6017 Candidate.
Viable =
false;
6032 Method, ActingContext);
6034 Candidate.
Viable =
false;
6044 Candidate.Viable =
false;
6051 for (
unsigned ArgIdx = 0; ArgIdx < Args.size(); ++ArgIdx) {
6052 if (ArgIdx < NumParams) {
6057 QualType ParamType = Proto->getParamType(ArgIdx);
6058 Candidate.Conversions[ArgIdx + 1]
6060 SuppressUserConversions,
6064 if (Candidate.Conversions[ArgIdx + 1].isBad()) {
6065 Candidate.Viable =
false;
6073 Candidate.Conversions[ArgIdx + 1].setEllipsis();
6077 if (EnableIfAttr *FailedAttr =
CheckEnableIf(Method, Args,
true)) {
6078 Candidate.Viable =
false;
6080 Candidate.DeductionFailure.Data = FailedAttr;
6097 bool SuppressUserConversions,
6098 bool PartialOverloading) {
6115 Specialization, Info, PartialOverloading)) {
6119 Candidate.
Viable =
false;
6131 assert(Specialization &&
"Missing member function template specialization?");
6132 assert(isa<CXXMethodDecl>(Specialization) &&
6133 "Specialization is not a member function?");
6135 ActingContext, ObjectType, ObjectClassification, Args,
6136 CandidateSet, SuppressUserConversions, PartialOverloading);
6148 bool SuppressUserConversions,
6149 bool PartialOverloading) {
6166 Specialization, Info, PartialOverloading)) {
6170 Candidate.
Viable =
false;
6182 assert(Specialization &&
"Missing function template specialization?");
6184 SuppressUserConversions, PartialOverloading);
6201 bool AllowObjCPointerConversion) {
6209 bool ObjCLifetimeConversion;
6211 ObjCLifetimeConversion))
6216 if (!AllowObjCPointerConversion)
6220 bool IncompatibleObjC =
false;
6238 bool AllowObjCConversionOnExplicit) {
6240 "Conversion function templates use AddTemplateConversionCandidate");
6247 if (
getLangOpts().CPlusPlus14 && ConvType->isUndeducedType()) {
6258 AllowObjCConversionOnExplicit))
6287 = cast<CXXRecordDecl>(ImplicitParamType->
getAs<
RecordType>()->getDecl());
6292 Conversion, ConversionContext);
6295 Candidate.
Viable =
false;
6306 if (FromCanon == ToCanon ||
IsDerivedFrom(FromCanon, ToCanon)) {
6307 Candidate.
Viable =
false;
6329 Candidate.
Viable =
false;
6341 From->getLocStart());
6348 switch (ICS.getKind()) {
6358 Candidate.
Viable =
false;
6370 Candidate.
Viable =
false;
6377 Candidate.
Viable =
false;
6383 "Can only end up with a standard conversion sequence or failure");
6387 Candidate.
Viable =
false;
6405 bool AllowObjCConversionOnExplicit) {
6407 "Only conversion function templates permitted here");
6416 Specialization, Info)) {
6420 Candidate.
Viable =
false;
6432 assert(Specialization &&
"Missing function template specialization?");
6434 CandidateSet, AllowObjCConversionOnExplicit);
6469 Conversion, ActingContext);
6470 if (ObjectInit.
isBad()) {
6471 Candidate.
Viable =
false;
6496 if (Args.size() > NumParams && !Proto->
isVariadic()) {
6497 Candidate.
Viable =
false;
6504 if (Args.size() < NumParams) {
6506 Candidate.
Viable =
false;
6513 for (
unsigned ArgIdx = 0, N = Args.size(); ArgIdx != N; ++ArgIdx) {
6514 if (ArgIdx < NumParams) {
6527 Candidate.
Viable =
false;
6540 Candidate.
Viable =
false;
6580 if (!T1Rec->getDecl()->getDefinition())
6588 OperEnd = Operators.
end();
6610 bool IsAssignmentOperator,
6611 unsigned NumContextualBoolArguments) {
6622 for (
unsigned ArgIdx = 0, N = Args.size(); ArgIdx != N; ++ArgIdx)
6629 for (
unsigned ArgIdx = 0, N = Args.size(); ArgIdx != N; ++ArgIdx) {
6642 if (ArgIdx < NumContextualBoolArguments) {
6644 "Contextual conversion to bool requires bool type");
6650 ArgIdx == 0 && IsAssignmentOperator,
6656 Candidate.
Viable =
false;
6669 class BuiltinCandidateTypeSet {
6671 typedef llvm::SmallPtrSet<QualType, 8> TypeSet;
6675 TypeSet PointerTypes;
6679 TypeSet MemberPointerTypes;
6683 TypeSet EnumerationTypes;
6687 TypeSet VectorTypes;
6690 bool HasNonRecordTypes;
6694 bool HasArithmeticOrEnumeralTypes;
6698 bool HasNullPtrType;
6707 bool AddPointerWithMoreQualifiedTypeVariants(
QualType Ty,
6709 bool AddMemberPointerWithMoreQualifiedTypeVariants(
QualType Ty);
6713 typedef TypeSet::iterator iterator;
6715 BuiltinCandidateTypeSet(
Sema &SemaRef)
6716 : HasNonRecordTypes(
false),
6717 HasArithmeticOrEnumeralTypes(
false),
6718 HasNullPtrType(
false),
6722 void AddTypesConvertedFrom(
QualType Ty,
6724 bool AllowUserConversions,
6725 bool AllowExplicitConversions,
6726 const Qualifiers &VisibleTypeConversionsQuals);
6729 iterator pointer_begin() {
return PointerTypes.begin(); }
6732 iterator pointer_end() {
return PointerTypes.end(); }
6735 iterator member_pointer_begin() {
return MemberPointerTypes.begin(); }
6738 iterator member_pointer_end() {
return MemberPointerTypes.end(); }
6741 iterator enumeration_begin() {
return EnumerationTypes.begin(); }
6744 iterator enumeration_end() {
return EnumerationTypes.end(); }
6746 iterator vector_begin() {
return VectorTypes.begin(); }
6747 iterator vector_end() {
return VectorTypes.end(); }
6749 bool hasNonRecordTypes() {
return HasNonRecordTypes; }
6750 bool hasArithmeticOrEnumeralTypes() {
return HasArithmeticOrEnumeralTypes; }
6751 bool hasNullPtrType()
const {
return HasNullPtrType; }
6766 BuiltinCandidateTypeSet::AddPointerWithMoreQualifiedTypeVariants(
QualType Ty,
6770 if (!PointerTypes.insert(Ty).second)
6775 bool buildObjCPtr =
false;
6779 buildObjCPtr =
true;
6791 unsigned BaseCVR = PointeeTy.getCVRQualifiers();
6797 if ((CVR | BaseCVR) != CVR)
continue;
6819 PointerTypes.insert(QPointerTy);
6835 BuiltinCandidateTypeSet::AddMemberPointerWithMoreQualifiedTypeVariants(
6838 if (!MemberPointerTypes.insert(Ty).second)
6842 assert(PointerTy &&
"type was not a member pointer type!");
6857 if ((CVR | BaseCVR) != CVR)
continue;
6860 MemberPointerTypes.insert(
6876 BuiltinCandidateTypeSet::AddTypesConvertedFrom(
QualType Ty,
6878 bool AllowUserConversions,
6879 bool AllowExplicitConversions,
6891 Ty = SemaRef.Context.getArrayDecayedType(Ty);
6898 HasNonRecordTypes = HasNonRecordTypes || !TyRec;
6901 HasArithmeticOrEnumeralTypes =
6905 PointerTypes.insert(Ty);
6909 if (!AddPointerWithMoreQualifiedTypeVariants(Ty, VisibleQuals))
6913 if (!AddMemberPointerWithMoreQualifiedTypeVariants(Ty))
6916 HasArithmeticOrEnumeralTypes =
true;
6917 EnumerationTypes.insert(Ty);
6921 HasArithmeticOrEnumeralTypes =
true;
6922 VectorTypes.insert(Ty);
6924 HasNullPtrType =
true;
6925 }
else if (AllowUserConversions && TyRec) {
6927 if (SemaRef.RequireCompleteType(Loc, Ty, 0))
6932 if (isa<UsingShadowDecl>(D))
6933 D = cast<UsingShadowDecl>(D)->getTargetDecl();
6937 if (isa<FunctionTemplateDecl>(D))
6941 if (AllowExplicitConversions || !Conv->
isExplicit()) {
6996 if (isa<UsingShadowDecl>(D))
6997 D = cast<UsingShadowDecl>(D)->getTargetDecl();
7031 class BuiltinOperatorOverloadBuilder {
7036 bool HasArithmeticOrEnumeralCandidateType;
7044 static const unsigned FirstIntegralType = 3;
7045 static const unsigned LastIntegralType = 20;
7046 static const unsigned FirstPromotedIntegralType = 3,
7047 LastPromotedIntegralType = 11;
7048 static const unsigned FirstPromotedArithmeticType = 0,
7049 LastPromotedArithmeticType = 11;
7050 static const unsigned NumArithmeticTypes = 20;
7054 assert(index < NumArithmeticTypes);
7056 ArithmeticTypes[NumArithmeticTypes] = {
7085 return S.
Context.*ArithmeticTypes[index];
7090 CanQualType getUsualArithmeticConversions(
unsigned L,
unsigned R) {
7105 Flt, Dbl, LDbl, SI, SL, SLL, S128, UI, UL, ULL, U128
7107 static const PromotedType ConversionsTable[LastPromotedArithmeticType]
7108 [LastPromotedArithmeticType] = {
7109 { Flt, Dbl, LDbl, Flt, Flt, Flt, Flt, Flt, Flt, Flt, Flt },
7110 { Dbl, Dbl, LDbl, Dbl, Dbl, Dbl, Dbl, Dbl, Dbl, Dbl, Dbl },
7111 { LDbl, LDbl, LDbl, LDbl, LDbl, LDbl, LDbl, LDbl, LDbl, LDbl, LDbl },
7112 { Flt, Dbl, LDbl, SI, SL, SLL, S128, UI, UL, ULL, U128 },
7113 { Flt, Dbl, LDbl, SL, SL, SLL, S128, Dep, UL, ULL, U128 },
7114 { Flt, Dbl, LDbl, SLL, SLL, SLL, S128, Dep, Dep, ULL, U128 },
7115 { Flt, Dbl, LDbl, S128, S128, S128, S128, S128, S128, S128, U128 },
7116 { Flt, Dbl, LDbl, UI, Dep, Dep, S128, UI, UL, ULL, U128 },
7117 { Flt, Dbl, LDbl, UL, UL, Dep, S128, UL, UL, ULL, U128 },
7118 { Flt, Dbl, LDbl, ULL, ULL, ULL, S128, ULL, ULL, ULL, U128 },
7119 { Flt, Dbl, LDbl, U128, U128, U128, U128, U128, U128, U128, U128 },
7122 assert(L < LastPromotedArithmeticType);
7123 assert(R < LastPromotedArithmeticType);
7124 int Idx = ConversionsTable[L][R];
7127 if (Idx != Dep)
return getArithmeticType(Idx);
7132 RT = getArithmeticType(R);
7137 if (LW > RW)
return LT;
7138 else if (LW < RW)
return RT;
7142 assert(L == SLL || R == SLL);
7148 void addPlusPlusMinusMinusStyleOverloads(
QualType CandidateTy,
7157 if (Args.size() == 1)
7168 if (Args.size() == 1)
7181 if (Args.size() == 1)
7190 (Qualifiers::Volatile |
7191 Qualifiers::Restrict)));
7192 if (Args.size() == 1)
7202 BuiltinOperatorOverloadBuilder(
7205 bool HasArithmeticOrEnumeralCandidateType,
7209 VisibleTypeConversionsQuals(VisibleTypeConversionsQuals),
7210 HasArithmeticOrEnumeralCandidateType(
7211 HasArithmeticOrEnumeralCandidateType),
7212 CandidateTypes(CandidateTypes),
7213 CandidateSet(CandidateSet) {
7215 assert(getArithmeticType(FirstPromotedIntegralType) == S.
Context.
IntTy &&
7216 "Invalid first promoted integral type");
7217 assert(getArithmeticType(LastPromotedIntegralType - 1)
7219 "Invalid last promoted integral type");
7220 assert(getArithmeticType(FirstPromotedArithmeticType)
7222 "Invalid first promoted arithmetic type");
7223 assert(getArithmeticType(LastPromotedArithmeticType - 1)
7225 "Invalid last promoted arithmetic type");
7246 if (!HasArithmeticOrEnumeralCandidateType)
7249 for (
unsigned Arith = (Op == OO_PlusPlus? 0 : 1);
7250 Arith < NumArithmeticTypes; ++Arith) {
7251 addPlusPlusMinusMinusStyleOverloads(
7252 getArithmeticType(Arith),
7268 void addPlusPlusMinusMinusPointerOverloads() {
7269 for (BuiltinCandidateTypeSet::iterator
7270 Ptr = CandidateTypes[0].pointer_begin(),
7271 PtrEnd = CandidateTypes[0].pointer_end();
7272 Ptr != PtrEnd; ++Ptr) {
7274 if (!(*Ptr)->getPointeeType()->isObjectType())
7277 addPlusPlusMinusMinusStyleOverloads(*Ptr,
7278 (!(*Ptr).isVolatileQualified() &&
7280 (!(*Ptr).isRestrictQualified() &&
7295 void addUnaryStarPointerOverloads() {
7296 for (BuiltinCandidateTypeSet::iterator
7297 Ptr = CandidateTypes[0].pointer_begin(),
7298 PtrEnd = CandidateTypes[0].pointer_end();
7299 Ptr != PtrEnd; ++Ptr) {
7306 if (Proto->getTypeQuals() || Proto->getRefQualifier())
7310 &ParamTy, Args, CandidateSet);
7320 void addUnaryPlusOrMinusArithmeticOverloads() {
7321 if (!HasArithmeticOrEnumeralCandidateType)
7324 for (
unsigned Arith = FirstPromotedArithmeticType;
7325 Arith < LastPromotedArithmeticType; ++Arith) {
7326 QualType ArithTy = getArithmeticType(Arith);
7331 for (BuiltinCandidateTypeSet::iterator
7332 Vec = CandidateTypes[0].vector_begin(),
7333 VecEnd = CandidateTypes[0].vector_end();
7334 Vec != VecEnd; ++Vec) {
7345 void addUnaryPlusPointerOverloads() {
7346 for (BuiltinCandidateTypeSet::iterator
7347 Ptr = CandidateTypes[0].pointer_begin(),
7348 PtrEnd = CandidateTypes[0].pointer_end();
7349 Ptr != PtrEnd; ++Ptr) {
7360 void addUnaryTildePromotedIntegralOverloads() {
7361 if (!HasArithmeticOrEnumeralCandidateType)
7364 for (
unsigned Int = FirstPromotedIntegralType;
7365 Int < LastPromotedIntegralType; ++Int) {
7366 QualType IntTy = getArithmeticType(Int);
7371 for (BuiltinCandidateTypeSet::iterator
7372 Vec = CandidateTypes[0].vector_begin(),
7373 VecEnd = CandidateTypes[0].vector_end();
7374 Vec != VecEnd; ++Vec) {
7386 void addEqualEqualOrNotEqualMemberPointerOverloads() {
7388 llvm::SmallPtrSet<QualType, 8> AddedTypes;
7390 for (
unsigned ArgIdx = 0, N = Args.size(); ArgIdx != N; ++ArgIdx) {
7391 for (BuiltinCandidateTypeSet::iterator
7392 MemPtr = CandidateTypes[ArgIdx].member_pointer_begin(),
7393 MemPtrEnd = CandidateTypes[ArgIdx].member_pointer_end();
7394 MemPtr != MemPtrEnd;
7400 QualType ParamTypes[2] = { *MemPtr, *MemPtr };
7417 void addRelationalPointerOrEnumeralOverloads() {
7431 UserDefinedBinaryOperators;
7433 for (
unsigned ArgIdx = 0, N = Args.size(); ArgIdx != N; ++ArgIdx) {
7434 if (CandidateTypes[ArgIdx].enumeration_begin() !=
7435 CandidateTypes[ArgIdx].enumeration_end()) {
7437 CEnd = CandidateSet.
end();
7439 if (!
C->Viable || !
C->Function ||
C->Function->getNumParams() != 2)
7442 if (
C->Function->isFunctionTemplateSpecialization())
7446 C->Function->getParamDecl(0)->getType().getUnqualifiedType();
7448 C->Function->getParamDecl(1)->getType().getUnqualifiedType();
7456 UserDefinedBinaryOperators.insert(
7464 llvm::SmallPtrSet<QualType, 8> AddedTypes;
7466 for (
unsigned ArgIdx = 0, N = Args.size(); ArgIdx != N; ++ArgIdx) {
7467 for (BuiltinCandidateTypeSet::iterator
7468 Ptr = CandidateTypes[ArgIdx].pointer_begin(),
7469 PtrEnd = CandidateTypes[ArgIdx].pointer_end();
7470 Ptr != PtrEnd; ++Ptr) {
7475 QualType ParamTypes[2] = { *Ptr, *Ptr };
7478 for (BuiltinCandidateTypeSet::iterator
7479 Enum = CandidateTypes[ArgIdx].enumeration_begin(),
7480 EnumEnd = CandidateTypes[ArgIdx].enumeration_end();
7481 Enum != EnumEnd; ++Enum) {
7486 if (!AddedTypes.insert(CanonType).second ||
7487 UserDefinedBinaryOperators.count(std::make_pair(CanonType,
7491 QualType ParamTypes[2] = { *Enum, *Enum };
7495 if (CandidateTypes[ArgIdx].hasNullPtrType()) {
7497 if (AddedTypes.insert(NullPtrTy).second &&
7498 !UserDefinedBinaryOperators.count(std::make_pair(NullPtrTy,
7500 QualType ParamTypes[2] = { NullPtrTy, NullPtrTy };
7527 llvm::SmallPtrSet<QualType, 8> AddedTypes;
7529 for (
int Arg = 0; Arg < 2; ++Arg) {
7530 QualType AsymetricParamTypes[2] = {
7534 for (BuiltinCandidateTypeSet::iterator
7535 Ptr = CandidateTypes[Arg].pointer_begin(),
7536 PtrEnd = CandidateTypes[Arg].pointer_end();
7537 Ptr != PtrEnd; ++Ptr) {
7542 AsymetricParamTypes[Arg] = *Ptr;
7543 if (Arg == 0 || Op == OO_Plus) {
7548 if (Op == OO_Minus) {
7553 QualType ParamTypes[2] = { *Ptr, *Ptr };
7555 Args, CandidateSet);
7590 void addGenericBinaryArithmeticOverloads(
bool isComparison) {
7591 if (!HasArithmeticOrEnumeralCandidateType)
7594 for (
unsigned Left = FirstPromotedArithmeticType;
7595 Left < LastPromotedArithmeticType; ++Left) {
7596 for (
unsigned Right = FirstPromotedArithmeticType;
7597 Right < LastPromotedArithmeticType; ++Right) {
7598 QualType LandR[2] = { getArithmeticType(Left),
7599 getArithmeticType(Right) };
7602 : getUsualArithmeticConversions(Left, Right);
7609 for (BuiltinCandidateTypeSet::iterator
7610 Vec1 = CandidateTypes[0].vector_begin(),
7611 Vec1End = CandidateTypes[0].vector_end();
7612 Vec1 != Vec1End; ++Vec1) {
7613 for (BuiltinCandidateTypeSet::iterator
7614 Vec2 = CandidateTypes[1].vector_begin(),
7615 Vec2End = CandidateTypes[1].vector_end();
7616 Vec2 != Vec2End; ++Vec2) {
7617 QualType LandR[2] = { *Vec1, *Vec2 };
7619 if (!isComparison) {
7620 if ((*Vec1)->isExtVectorType() || !(*Vec2)->isExtVectorType())
7646 if (!HasArithmeticOrEnumeralCandidateType)
7649 for (
unsigned Left = FirstPromotedIntegralType;
7650 Left < LastPromotedIntegralType; ++Left) {
7651 for (
unsigned Right = FirstPromotedIntegralType;
7652 Right < LastPromotedIntegralType; ++Right) {
7653 QualType LandR[2] = { getArithmeticType(Left),
7654 getArithmeticType(Right) };
7655 QualType Result = (Op == OO_LessLess || Op == OO_GreaterGreater)
7657 : getUsualArithmeticConversions(Left, Right);
7670 void addAssignmentMemberPointerOrEnumeralOverloads() {
7672 llvm::SmallPtrSet<QualType, 8> AddedTypes;
7674 for (
unsigned ArgIdx = 0; ArgIdx < 2; ++ArgIdx) {
7675 for (BuiltinCandidateTypeSet::iterator
7676 Enum = CandidateTypes[ArgIdx].enumeration_begin(),
7677 EnumEnd = CandidateTypes[ArgIdx].enumeration_end();
7678 Enum != EnumEnd; ++Enum) {
7685 for (BuiltinCandidateTypeSet::iterator
7686 MemPtr = CandidateTypes[ArgIdx].member_pointer_begin(),
7687 MemPtrEnd = CandidateTypes[ArgIdx].member_pointer_end();
7688 MemPtr != MemPtrEnd; ++MemPtr) {
7713 void addAssignmentPointerOverloads(
bool isEqualOp) {
7715 llvm::SmallPtrSet<QualType, 8> AddedTypes;
7717 for (BuiltinCandidateTypeSet::iterator
7718 Ptr = CandidateTypes[0].pointer_begin(),
7719 PtrEnd = CandidateTypes[0].pointer_end();
7720 Ptr != PtrEnd; ++Ptr) {
7724 else if (!(*Ptr)->getPointeeType()->isObjectType())
7735 bool NeedVolatile = !(*Ptr).isVolatileQualified() &&
7745 if (!(*Ptr).isRestrictQualified() &&
7758 (Qualifiers::Volatile |
7759 Qualifiers::Restrict)));
7767 for (BuiltinCandidateTypeSet::iterator
7768 Ptr = CandidateTypes[1].pointer_begin(),
7769 PtrEnd = CandidateTypes[1].pointer_end();
7770 Ptr != PtrEnd; ++Ptr) {
7784 bool NeedVolatile = !(*Ptr).isVolatileQualified() &&
7794 if (!(*Ptr).isRestrictQualified() &&
7807 (Qualifiers::Volatile |
7808 Qualifiers::Restrict)));
7829 void addAssignmentArithmeticOverloads(
bool isEqualOp) {
7830 if (!HasArithmeticOrEnumeralCandidateType)
7833 for (
unsigned Left = 0; Left < NumArithmeticTypes; ++Left) {
7834 for (
unsigned Right = FirstPromotedArithmeticType;
7835 Right < LastPromotedArithmeticType; ++Right) {
7837 ParamTypes[1] = getArithmeticType(Right);
7857 for (BuiltinCandidateTypeSet::iterator
7858 Vec1 = CandidateTypes[0].vector_begin(),
7859 Vec1End = CandidateTypes[0].vector_end();
7860 Vec1 != Vec1End; ++Vec1) {
7861 for (BuiltinCandidateTypeSet::iterator
7862 Vec2 = CandidateTypes[1].vector_begin(),
7863 Vec2End = CandidateTypes[1].vector_end();
7864 Vec2 != Vec2End; ++Vec2) {
7866 ParamTypes[1] = *Vec2;
7895 void addAssignmentIntegralOverloads() {
7896 if (!HasArithmeticOrEnumeralCandidateType)
7899 for (
unsigned Left = FirstIntegralType; Left < LastIntegralType; ++Left) {
7900 for (
unsigned Right = FirstPromotedIntegralType;
7901 Right < LastPromotedIntegralType; ++Right) {
7903 ParamTypes[1] = getArithmeticType(Right);
7911 ParamTypes[0] = getArithmeticType(Left);
7927 void addExclaimOverload() {
7933 void addAmpAmpOrPipePipeOverload() {
7950 void addSubscriptOverloads() {
7951 for (BuiltinCandidateTypeSet::iterator
7952 Ptr = CandidateTypes[0].pointer_begin(),
7953 PtrEnd = CandidateTypes[0].pointer_end();
7954 Ptr != PtrEnd; ++Ptr) {
7966 for (BuiltinCandidateTypeSet::iterator
7967 Ptr = CandidateTypes[1].pointer_begin(),
7968 PtrEnd = CandidateTypes[1].pointer_end();
7969 Ptr != PtrEnd; ++Ptr) {
7991 void addArrowStarOverloads() {
7992 for (BuiltinCandidateTypeSet::iterator
7993 Ptr = CandidateTypes[0].pointer_begin(),
7994 PtrEnd = CandidateTypes[0].pointer_end();
7995 Ptr != PtrEnd; ++Ptr) {
8000 if (!isa<RecordType>(C1))
8009 for (BuiltinCandidateTypeSet::iterator
8010 MemPtr = CandidateTypes[1].member_pointer_begin(),
8011 MemPtrEnd = CandidateTypes[1].member_pointer_end();
8012 MemPtr != MemPtrEnd; ++MemPtr) {
8018 QualType ParamTypes[2] = { *Ptr, *MemPtr };
8044 void addConditionalOperatorOverloads() {
8046 llvm::SmallPtrSet<QualType, 8> AddedTypes;
8048 for (
unsigned ArgIdx = 0; ArgIdx < 2; ++ArgIdx) {
8049 for (BuiltinCandidateTypeSet::iterator
8050 Ptr = CandidateTypes[ArgIdx].pointer_begin(),
8051 PtrEnd = CandidateTypes[ArgIdx].pointer_end();
8052 Ptr != PtrEnd; ++Ptr) {
8056 QualType ParamTypes[2] = { *Ptr, *Ptr };
8060 for (BuiltinCandidateTypeSet::iterator
8061 MemPtr = CandidateTypes[ArgIdx].member_pointer_begin(),
8062 MemPtrEnd = CandidateTypes[ArgIdx].member_pointer_end();
8063 MemPtr != MemPtrEnd; ++MemPtr) {
8067 QualType ParamTypes[2] = { *MemPtr, *MemPtr };
8072 for (BuiltinCandidateTypeSet::iterator
8073 Enum = CandidateTypes[ArgIdx].enumeration_begin(),
8074 EnumEnd = CandidateTypes[ArgIdx].enumeration_end();
8075 Enum != EnumEnd; ++Enum) {
8082 QualType ParamTypes[2] = { *Enum, *Enum };
8106 VisibleTypeConversionsQuals.
addConst();
8107 for (
unsigned ArgIdx = 0, N = Args.size(); ArgIdx != N; ++ArgIdx)
8110 bool HasNonRecordCandidateType =
false;
8111 bool HasArithmeticOrEnumeralCandidateType =
false;
8113 for (
unsigned ArgIdx = 0, N = Args.size(); ArgIdx != N; ++ArgIdx) {
8114 CandidateTypes.emplace_back(*
this);
8115 CandidateTypes[ArgIdx].AddTypesConvertedFrom(Args[ArgIdx]->getType(),
8118 (Op == OO_Exclaim ||
8121 VisibleTypeConversionsQuals);
8122 HasNonRecordCandidateType = HasNonRecordCandidateType ||
8123 CandidateTypes[ArgIdx].hasNonRecordTypes();
8124 HasArithmeticOrEnumeralCandidateType =
8125 HasArithmeticOrEnumeralCandidateType ||
8126 CandidateTypes[ArgIdx].hasArithmeticOrEnumeralTypes();
8134 if (!HasNonRecordCandidateType &&
8135 !(Op == OO_Exclaim || Op == OO_AmpAmp || Op == OO_PipePipe))
8139 BuiltinOperatorOverloadBuilder OpBuilder(*
this, Args,
8140 VisibleTypeConversionsQuals,
8141 HasArithmeticOrEnumeralCandidateType,
8142 CandidateTypes, CandidateSet);
8148 llvm_unreachable(
"Expected an overloaded operator");
8153 case OO_Array_Delete:
8156 "Special operators don't use AddBuiltinOperatorCandidates");
8166 if (Args.size() == 1)
8167 OpBuilder.addUnaryPlusPointerOverloads();
8171 if (Args.size() == 1) {
8172 OpBuilder.addUnaryPlusOrMinusArithmeticOverloads();
8174 OpBuilder.addBinaryPlusOrMinusPointerOverloads(Op);
8175 OpBuilder.addGenericBinaryArithmeticOverloads(
false);
8180 if (Args.size() == 1)
8181 OpBuilder.addUnaryStarPointerOverloads();
8183 OpBuilder.addGenericBinaryArithmeticOverloads(
false);
8187 OpBuilder.addGenericBinaryArithmeticOverloads(
false);
8192 OpBuilder.addPlusPlusMinusMinusArithmeticOverloads(Op);
8193 OpBuilder.addPlusPlusMinusMinusPointerOverloads();
8197 case OO_ExclaimEqual:
8198 OpBuilder.addEqualEqualOrNotEqualMemberPointerOverloads();
8204 case OO_GreaterEqual:
8205 OpBuilder.addRelationalPointerOrEnumeralOverloads();
8206 OpBuilder.addGenericBinaryArithmeticOverloads(
true);
8213 case OO_GreaterGreater:
8214 OpBuilder.addBinaryBitwiseArithmeticOverloads(Op);
8218 if (Args.size() == 1)
8224 OpBuilder.addBinaryBitwiseArithmeticOverloads(Op);
8228 OpBuilder.addUnaryTildePromotedIntegralOverloads();
8232 OpBuilder.addAssignmentMemberPointerOrEnumeralOverloads();
8237 OpBuilder.addAssignmentPointerOverloads(Op == OO_Equal);
8242 OpBuilder.addAssignmentArithmeticOverloads(Op == OO_Equal);
8245 case OO_PercentEqual:
8246 case OO_LessLessEqual:
8247 case OO_GreaterGreaterEqual:
8251 OpBuilder.addAssignmentIntegralOverloads();
8255 OpBuilder.addExclaimOverload();
8260 OpBuilder.addAmpAmpOrPipePipeOverload();
8264 OpBuilder.addSubscriptOverloads();
8268 OpBuilder.addArrowStarOverloads();
8271 case OO_Conditional:
8272 OpBuilder.addConditionalOperatorOverloads();
8273 OpBuilder.addGenericBinaryArithmeticOverloads(
false);
8291 bool PartialOverloading) {
8306 CandEnd = CandidateSet.
end();
8307 Cand != CandEnd; ++Cand)
8308 if (Cand->Function) {
8309 Fns.
erase(Cand->Function);
8319 if (ExplicitTemplateArgs)
8323 PartialOverloading);
8326 FoundDecl, ExplicitTemplateArgs,
8327 Args, CandidateSet, PartialOverloading);
8336 bool UserDefinedConversion) {
8350 unsigned StartArg = 0;
8359 assert(Cand2.
NumConversions == NumArgs &&
"Overload candidate mismatch");
8360 bool HasBetterConversion =
false;
8361 for (
unsigned ArgIdx = StartArg; ArgIdx < NumArgs; ++ArgIdx) {
8367 HasBetterConversion =
true;
8382 if (HasBetterConversion)
8392 isa<CXXConversionDecl>(Cand1.
Function) &&
8393 isa<CXXConversionDecl>(Cand2.
Function)) {
8415 bool Cand1IsSpecialization = Cand1.
Function &&
8417 bool Cand2IsSpecialization = Cand2.
Function &&
8419 if (Cand1IsSpecialization != Cand2IsSpecialization)
8420 return Cand2IsSpecialization;
8426 if (Cand1IsSpecialization && Cand2IsSpecialization) {
8448 Cand1Attrs.erase(std::remove_if(Cand1Attrs.begin(), Cand1Attrs.end(),
8451 std::reverse(Cand1Attrs.begin(), Cand1Attrs.end());
8457 Cand2Attrs.erase(std::remove_if(Cand2Attrs.begin(), Cand2Attrs.end(),
8460 std::reverse(Cand2Attrs.begin(), Cand2Attrs.end());
8465 if (Cand1Attrs.size() <= Cand2Attrs.size())
8468 auto Cand1I = Cand1Attrs.begin();
8469 for (
auto &Cand2A : Cand2Attrs) {
8470 auto &Cand1A = *Cand1I++;
8471 llvm::FoldingSetNodeID Cand1ID, Cand2ID;
8472 cast<EnableIfAttr>(Cand1A)->getCond()->Profile(Cand1ID,
8474 cast<EnableIfAttr>(Cand2A)->getCond()->Profile(Cand2ID,
8476 if (Cand1ID != Cand2ID)
8499 bool UserDefinedConversion) {
8505 UserDefinedConversion))
8519 UserDefinedConversion)) {
8526 if (Best->Function &&
8527 (Best->Function->isDeleted() ||
8540 oc_function_template,
8542 oc_constructor_template,
8543 oc_implicit_default_constructor,
8544 oc_implicit_copy_constructor,
8545 oc_implicit_move_constructor,
8546 oc_implicit_copy_assignment,
8547 oc_implicit_move_assignment,
8548 oc_implicit_inherited_constructor
8553 std::string &Description) {
8563 if (!Ctor->isImplicit())
8564 return isTemplate ? oc_constructor_template : oc_constructor;
8566 if (Ctor->getInheritedConstructor())
8567 return oc_implicit_inherited_constructor;
8569 if (Ctor->isDefaultConstructor())
8570 return oc_implicit_default_constructor;
8572 if (Ctor->isMoveConstructor())
8573 return oc_implicit_move_constructor;
8575 assert(Ctor->isCopyConstructor() &&
8576 "unexpected sort of implicit constructor");
8577 return oc_implicit_copy_constructor;
8583 if (!Meth->isImplicit())
8584 return isTemplate ? oc_method_template : oc_method;
8586 if (Meth->isMoveAssignmentOperator())
8587 return oc_implicit_move_assignment;
8589 if (Meth->isCopyAssignmentOperator())
8590 return oc_implicit_copy_assignment;
8592 assert(isa<CXXConversionDecl>(Meth) &&
"expected conversion");
8596 return isTemplate ? oc_function_template : oc_function;
8599 void MaybeEmitInheritedConstructorNote(
Sema &S,
Decl *Fn) {
8606 S.
Diag(Ctor->
getLocation(), diag::note_ovl_candidate_inherited_constructor);
8619 MaybeEmitInheritedConstructorNote(*
this, Fn);
8634 dyn_cast<FunctionTemplateDecl>((*I)->getUnderlyingDecl()) ) {
8637 = dyn_cast<FunctionDecl>((*I)->getUnderlyingDecl()) ) {
8650 S.
Diag(CaretLoc, PDiag)
8656 unsigned CandsShown = 0;
8659 if (CandsShown >= 4 && ShowOverloads ==
Ovl_Best)
8671 assert(Conv.
isBad());
8672 assert(Cand->
Function &&
"for now, candidate must be a function");
8678 bool isObjectArgument =
false;
8679 if (isa<CXXMethodDecl>(Fn) && !isa<CXXConstructorDecl>(Fn)) {
8681 isObjectArgument =
true;
8694 assert(FromExpr &&
"overload set argument came from implicit argument?");
8696 if (isa<UnaryOperator>(E))
8697 E = cast<UnaryOperator>(E)->getSubExpr()->
IgnoreParens();
8701 << (
unsigned) FnKind << FnDesc
8702 << (FromExpr ? FromExpr->getSourceRange() :
SourceRange())
8703 << ToTy << Name << I+1;
8704 MaybeEmitInheritedConstructorNote(S, Fn);
8713 CToTy = RT->getPointeeType();
8718 CFromTy = FromPT->getPointeeType(), CToTy = ToPT->getPointeeType();
8728 << (
unsigned) FnKind << FnDesc
8729 << (FromExpr ? FromExpr->getSourceRange() :
SourceRange())
8732 << (
unsigned) isObjectArgument << I+1;
8733 MaybeEmitInheritedConstructorNote(S, Fn);
8739 << (
unsigned) FnKind << FnDesc
8740 << (FromExpr ? FromExpr->getSourceRange() :
SourceRange())
8743 << (
unsigned) isObjectArgument << I+1;
8744 MaybeEmitInheritedConstructorNote(S, Fn);
8750 << (
unsigned) FnKind << FnDesc
8751 << (FromExpr ? FromExpr->getSourceRange() :
SourceRange())
8754 << (
unsigned) isObjectArgument << I+1;
8755 MaybeEmitInheritedConstructorNote(S, Fn);
8760 assert(CVR &&
"unexpected qualifiers mismatch");
8762 if (isObjectArgument) {
8764 << (
unsigned) FnKind << FnDesc
8765 << (FromExpr ? FromExpr->getSourceRange() :
SourceRange())
8766 << FromTy << (CVR - 1);
8769 << (
unsigned) FnKind << FnDesc
8770 << (FromExpr ? FromExpr->getSourceRange() :
SourceRange())
8771 << FromTy << (CVR - 1) << I+1;
8773 MaybeEmitInheritedConstructorNote(S, Fn);
8779 if (FromExpr && isa<InitListExpr>(FromExpr)) {
8781 << (
unsigned) FnKind << FnDesc
8782 << (FromExpr ? FromExpr->getSourceRange() :
SourceRange())
8783 << FromTy << ToTy << (
unsigned) isObjectArgument << I+1;
8784 MaybeEmitInheritedConstructorNote(S, Fn);
8795 S.
Diag(Fn->
getLocation(), diag::note_ovl_candidate_bad_conv_incomplete)
8796 << (
unsigned) FnKind << FnDesc
8797 << (FromExpr ? FromExpr->getSourceRange() :
SourceRange())
8798 << FromTy << ToTy << (
unsigned) isObjectArgument << I+1;
8799 MaybeEmitInheritedConstructorNote(S, Fn);
8804 unsigned BaseToDerivedConversion = 0;
8807 if (ToPtrTy->getPointeeType().isAtLeastAsQualifiedAs(
8808 FromPtrTy->getPointeeType()) &&
8809 !FromPtrTy->getPointeeType()->isIncompleteType() &&
8810 !ToPtrTy->getPointeeType()->isIncompleteType() &&
8812 FromPtrTy->getPointeeType()))
8813 BaseToDerivedConversion = 1;
8821 if (ToPtrTy->getPointeeType().isAtLeastAsQualifiedAs(
8822 FromPtrTy->getPointeeType()) &&
8823 FromIface->isSuperClassOf(ToIface))
8824 BaseToDerivedConversion = 2;
8826 if (ToRefTy->getPointeeType().isAtLeastAsQualifiedAs(FromTy) &&
8828 !ToRefTy->getPointeeType()->isIncompleteType() &&
8830 BaseToDerivedConversion = 3;
8835 << (
unsigned) FnKind << FnDesc
8836 << (FromExpr ? FromExpr->getSourceRange() :
SourceRange())
8837 << (
unsigned) isObjectArgument << I + 1;
8838 MaybeEmitInheritedConstructorNote(S, Fn);
8843 if (BaseToDerivedConversion) {
8845 diag::note_ovl_candidate_bad_base_to_derived_conv)
8846 << (
unsigned) FnKind << FnDesc
8847 << (FromExpr ? FromExpr->getSourceRange() :
SourceRange())
8848 << (BaseToDerivedConversion - 1)
8849 << FromTy << ToTy << I+1;
8850 MaybeEmitInheritedConstructorNote(S, Fn);
8854 if (isa<ObjCObjectPointerType>(CFromTy) &&
8855 isa<PointerType>(CToTy)) {
8860 << (
unsigned) FnKind << FnDesc
8861 << (FromExpr ? FromExpr->getSourceRange() :
SourceRange())
8862 << FromTy << ToTy << (
unsigned) isObjectArgument << I+1;
8863 MaybeEmitInheritedConstructorNote(S, Fn);
8870 FDiag << (
unsigned) FnKind << FnDesc
8871 << (FromExpr ? FromExpr->getSourceRange() :
SourceRange())
8872 << FromTy << ToTy << (
unsigned) isObjectArgument << I + 1
8876 for (std::vector<FixItHint>::iterator HI = Cand->
Fix.
Hints.begin(),
8877 HE = Cand->
Fix.
Hints.end(); HI != HE; ++HI)
8881 MaybeEmitInheritedConstructorNote(S, Fn);
8901 if (NumArgs < MinParams) {
8916 assert(isa<FunctionDecl>(D) &&
8917 "The templated declaration should at least be a function"
8918 " when diagnosing bad template argument deduction due to too many"
8919 " or too few arguments");
8928 unsigned mode, modeCount;
8929 if (NumFormalArgs < MinParams) {
8930 if (MinParams != FnTy->getNumParams() || FnTy->isVariadic() ||
8931 FnTy->isTemplateVariadic())
8935 modeCount = MinParams;
8937 if (MinParams != FnTy->getNumParams())
8941 modeCount = FnTy->getNumParams();
8944 std::string Description;
8954 << mode << modeCount << NumFormalArgs;
8955 MaybeEmitInheritedConstructorNote(S, Fn);
8960 unsigned NumFormalArgs) {
8966 if (
FunctionDecl *FD = dyn_cast<FunctionDecl>(Templated))
8967 return FD->getDescribedFunctionTemplate();
8968 else if (
CXXRecordDecl *RD = dyn_cast<CXXRecordDecl>(Templated))
8969 return RD->getDescribedClassTemplate();
8971 llvm_unreachable(
"Unsupported: Getting the described template declaration"
8972 " for bad deduction diagnosis");
8984 switch (DeductionFailure.
Result) {
8986 llvm_unreachable(
"TDK_success while diagnosing bad deduction");
8989 assert(ParamD &&
"no parameter found for incomplete deduction result");
8991 diag::note_ovl_candidate_incomplete_deduction)
8993 MaybeEmitInheritedConstructorNote(S, Templated);
8998 assert(ParamD &&
"no parameter found for bad qualifiers deduction result");
9016 S.
Diag(Templated->
getLocation(), diag::note_ovl_candidate_underqualified)
9018 MaybeEmitInheritedConstructorNote(S, Templated);
9023 assert(ParamD &&
"no parameter found for inconsistent deduction result");
9025 if (isa<TemplateTypeParmDecl>(ParamD))
9027 else if (isa<NonTypeTemplateParmDecl>(ParamD))
9034 diag::note_ovl_candidate_inconsistent_deduction)
9037 MaybeEmitInheritedConstructorNote(S, Templated);
9042 assert(ParamD &&
"no parameter found for invalid explicit arguments");
9045 diag::note_ovl_candidate_explicit_arg_mismatch_named)
9050 index = TTP->getIndex();
9052 = dyn_cast<NonTypeTemplateParmDecl>(ParamD))
9053 index = NTTP->getIndex();
9055 index = cast<TemplateTemplateParmDecl>(ParamD)->getIndex();
9057 diag::note_ovl_candidate_explicit_arg_mismatch_unnamed)
9060 MaybeEmitInheritedConstructorNote(S, Templated);
9070 diag::note_ovl_candidate_instantiation_depth);
9071 MaybeEmitInheritedConstructorNote(S, Templated);
9079 TemplateArgString =
" ";
9086 if (PDiag && PDiag->second.getDiagID() ==
9087 diag::err_typename_nested_not_found_enable_if) {
9090 S.
Diag(PDiag->first, diag::note_ovl_candidate_disabled_by_enable_if)
9091 <<
"'enable_if'" << TemplateArgString;
9101 SFINAEArgString =
": ";
9107 diag::note_ovl_candidate_substitution_failure)
9108 << TemplateArgString << SFINAEArgString << R;
9109 MaybeEmitInheritedConstructorNote(S, Templated);
9116 diag::note_ovl_candidate_failed_overload_resolution)
9140 diag::note_ovl_candidate_non_deduced_mismatch_qualified)
9151 diag::note_ovl_candidate_non_deduced_mismatch)
9152 << FirstTA << SecondTA;
9158 S.
Diag(Templated->
getLocation(), diag::note_ovl_candidate_bad_deduction);
9159 MaybeEmitInheritedConstructorNote(S, Templated);
9187 S.
Diag(Callee->getLocation(), diag::note_ovl_candidate_bad_target)
9188 << (
unsigned)FnKind << CalleeTarget << CallerTarget;
9200 case oc_implicit_default_constructor:
9203 case oc_implicit_copy_constructor:
9206 case oc_implicit_move_constructor:
9209 case oc_implicit_copy_assignment:
9212 case oc_implicit_move_assignment:
9217 bool ConstRHS =
false;
9221 ConstRHS = RT->getPointeeType().isConstQualified();
9236 diag::note_ovl_candidate_disabled_by_enable_if_attr)
9237 << Attr->getCond()->getSourceRange() << Attr->getMessage();
9266 MaybeEmitInheritedConstructorNote(S, Fn);
9285 S.
Diag(Fn->
getLocation(), diag::note_ovl_candidate_illegal_constructor)
9287 MaybeEmitInheritedConstructorNote(S, Fn);
9321 bool isLValueReference =
false;
9322 bool isRValueReference =
false;
9323 bool isPointer =
false;
9327 isLValueReference =
true;
9331 isRValueReference =
true;
9346 MaybeEmitInheritedConstructorNote(S, Cand->
Surrogate);
9352 assert(Cand->
NumConversions <= 2 &&
"builtin operator is not binary");
9353 std::string TypeStr(
"operator");
9359 S.
Diag(OpLoc, diag::note_ovl_builtin_unary_candidate) << TypeStr;
9364 S.
Diag(OpLoc, diag::note_ovl_builtin_binary_candidate) << TypeStr;
9371 for (
unsigned ArgIdx = 0; ArgIdx < NoOperands; ++ArgIdx) {
9373 if (ICS.
isBad())
break;
9377 S.
PDiag(diag::note_ambiguous_type_conversion));
9392 llvm_unreachable(
"TDK_success while diagnosing bad deduction");
9418 llvm_unreachable(
"Unhandled deduction result");
9422 struct CompareOverloadCandidatesForDisplay {
9426 CompareOverloadCandidatesForDisplay(
Sema &S,
size_t nArgs)
9427 : S(S), NumArgs(nArgs) {}
9432 if (L == R)
return false;
9436 if (!R->
Viable)
return true;
9455 int LDist = std::abs((
int)L->
getNumParams() - (int)NumArgs);
9456 int RDist = std::abs((
int)R->
getNumParams() - (int)NumArgs);
9457 if (LDist == RDist) {
9466 return LDist < RDist;
9484 numLFixes = (numLFixes == 0) ?
UINT_MAX : numLFixes;
9485 numRFixes = (numRFixes == 0) ?
UINT_MAX : numRFixes;
9486 if (numLFixes != numRFixes) {
9487 return numLFixes < numRFixes;
9512 if (leftBetter > 0)
return true;
9513 if (leftBetter < 0)
return false;
9554 bool Unfixable =
false;
9562 assert(ConvIdx != ConvCount &&
"no bad conversion in candidate");
9570 if (ConvIdx == ConvCount)
9574 "remaining conversion is initialized?");
9578 bool SuppressUserConversions =
false;
9581 unsigned ArgIdx = ConvIdx;
9592 if (isa<CXXMethodDecl>(Cand->
Function) &&
9593 !isa<CXXConstructorDecl>(Cand->
Function))
9597 assert(ConvCount <= 3);
9598 for (; ConvIdx != ConvCount; ++ConvIdx)
9602 SuppressUserConversions,
9611 for (; ConvIdx != ConvCount; ++ConvIdx, ++ArgIdx) {
9612 if (ArgIdx < NumParams) {
9614 S, Args[ArgIdx], Proto->
getParamType(ArgIdx), SuppressUserConversions,
9639 for (
iterator Cand =
begin(), LastCand =
end(); Cand != LastCand; ++Cand) {
9641 Cands.push_back(Cand);
9644 if (Cand->Function || Cand->IsSurrogate)
9645 Cands.push_back(Cand);
9651 std::sort(Cands.begin(), Cands.end(),
9652 CompareOverloadCandidatesForDisplay(S, Args.size()));
9654 bool ReportedAmbiguousConversions =
false;
9658 unsigned CandsShown = 0;
9659 for (I = Cands.begin(), E = Cands.end(); I != E; ++I) {
9665 if (CandsShown >= 4 && ShowOverloads ==
Ovl_Best) {
9676 "Non-viable built-in candidates are not added to Cands.");
9683 if (!ReportedAmbiguousConversions) {
9685 ReportedAmbiguousConversions =
true;
9694 S.
Diag(OpLoc, diag::note_ovl_too_many_candidates) << int(E - I);
9704 struct CompareTemplateSpecCandidatesForDisplay {
9706 CompareTemplateSpecCandidatesForDisplay(
Sema &S) : S(S) {}
9744 void TemplateSpecCandidateSet::destroyCandidates() {
9746 i->DeductionFailure.Destroy();
9751 destroyCandidates();
9765 Cands.reserve(
size());
9766 for (
iterator Cand =
begin(), LastCand =
end(); Cand != LastCand; ++Cand) {
9767 if (Cand->Specialization)
9768 Cands.push_back(Cand);
9773 std::sort(Cands.begin(), Cands.end(),
9774 CompareTemplateSpecCandidatesForDisplay(S));
9781 unsigned CandsShown = 0;
9782 for (I = Cands.begin(), E = Cands.end(); I != E; ++I) {
9788 if (CandsShown >= 4 && ShowOverloads ==
Ovl_Best)
9793 "Non-matching built-in candidates are not added to Cands.");
9798 S.
Diag(Loc, diag::note_ovl_too_many_candidates) << int(E - I);
9808 QualType Ret = PossiblyAFunctionType;
9826 class AddressOfFunctionResolver {
9836 bool TargetTypeIsNonStaticMemberFunction;
9837 bool FoundNonTemplateFunction;
9838 bool StaticMemberFunctionFromBoundPointer;
9847 AddressOfFunctionResolver(
Sema &S,
Expr *SourceExpr,
9848 const QualType &TargetType,
bool Complain)
9849 : S(S), SourceExpr(SourceExpr), TargetType(TargetType),
9850 Complain(Complain),
Context(S.getASTContext()),
9851 TargetTypeIsNonStaticMemberFunction(
9853 FoundNonTemplateFunction(
false),
9854 StaticMemberFunctionFromBoundPointer(
false),
9856 OvlExpr(OvlExprInfo.Expression),
9857 FailedCandidates(OvlExpr->getNameLoc()) {
9858 ExtractUnqualifiedFunctionTypeFromTargetType();
9860 if (TargetFunctionType->isFunctionType()) {
9862 if (!UME->isImplicitAccess() &&
9864 StaticMemberFunctionFromBoundPointer =
true;
9865 }
else if (OvlExpr->hasExplicitTemplateArgs()) {
9868 OvlExpr,
false, &dap)) {
9870 if (!Method->isStatic()) {
9874 TargetTypeIsNonStaticMemberFunction =
true;
9878 if (!OvlExprInfo.HasFormOfMemberPointer)
9882 Matches.push_back(std::make_pair(dap, Fn));
9887 if (OvlExpr->hasExplicitTemplateArgs())
9888 OvlExpr->getExplicitTemplateArgs().copyInto(OvlExplicitTemplateArgs);
9890 if (FindAllFunctionsThatMatchTargetTypeExactly()) {
9894 if (FoundNonTemplateFunction)
9895 EliminateAllTemplateMatches();
9897 EliminateAllExceptMostSpecializedTemplate();
9903 bool isTargetTypeAFunction()
const {
9904 return TargetFunctionType->isFunctionType();
9912 void inline ExtractUnqualifiedFunctionTypeFromTargetType() {
9923 if (Method->isStatic() == TargetTypeIsNonStaticMemberFunction)
9926 else if (TargetTypeIsNonStaticMemberFunction)
9939 &OvlExplicitTemplateArgs,
9940 TargetFunctionType, Specialization,
9943 FailedCandidates.addCandidate()
9956 Matches.push_back(std::make_pair(CurAccessFunPair, Specialization));
9960 bool AddMatchingNonTemplateFunction(
NamedDecl* Fn,
9965 if (Method->isStatic() == TargetTypeIsNonStaticMemberFunction)
9968 else if (TargetTypeIsNonStaticMemberFunction)
9971 if (
FunctionDecl *FunDecl = dyn_cast<FunctionDecl>(Fn)) {
9980 FunDecl->getReturnType()->isUndeducedType() &&
9986 FunDecl->getType()) ||
9989 Matches.push_back(std::make_pair(CurAccessFunPair,
9990 cast<FunctionDecl>(FunDecl->getCanonicalDecl())));
9991 FoundNonTemplateFunction =
true;
9999 bool FindAllFunctionsThatMatchTargetTypeExactly() {
10004 if (IsInvalidFormOfPointerToMemberFunction())
10008 E = OvlExpr->decls_end();
10020 = dyn_cast<FunctionTemplateDecl>(Fn)) {
10021 if (AddMatchingTemplateFunction(FunctionTemplate, I.getPair()))
10025 else if (!OvlExpr->hasExplicitTemplateArgs() &&
10026 AddMatchingNonTemplateFunction(Fn, I.getPair()))
10029 assert(Ret ||
Matches.empty());
10033 void EliminateAllExceptMostSpecializedTemplate() {
10046 for (
unsigned I = 0, E =
Matches.size(); I != E; ++I)
10052 MatchesCopy.
begin(), MatchesCopy.
end(), FailedCandidates,
10053 SourceExpr->getLocStart(), S.
PDiag(),
10055 .second->getDeclName(),
10056 S.
PDiag(diag::note_ovl_candidate) << (
unsigned)oc_function_template,
10057 Complain, TargetFunctionType);
10059 if (Result != MatchesCopy.
end()) {
10062 Matches[0].second = cast<FunctionDecl>(*Result);
10067 void EliminateAllTemplateMatches() {
10070 for (
unsigned I = 0, N =
Matches.size(); I != N; ) {
10071 if (
Matches[I].second->getPrimaryTemplate() ==
nullptr)
10081 void ComplainNoMatchesFound()
const {
10083 S.
Diag(OvlExpr->getLocStart(), diag::err_addr_ovl_no_viable)
10084 << OvlExpr->getName() << TargetFunctionType
10085 << OvlExpr->getSourceRange();
10086 if (FailedCandidates.empty())
10093 IEnd = OvlExpr->decls_end();
10096 dyn_cast<FunctionDecl>((*I)->getUnderlyingDecl()))
10098 FailedCandidates.NoteCandidates(S, OvlExpr->getLocStart());
10102 bool IsInvalidFormOfPointerToMemberFunction()
const {
10103 return TargetTypeIsNonStaticMemberFunction &&
10104 !OvlExprInfo.HasFormOfMemberPointer;
10107 void ComplainIsInvalidFormOfPointerToMemberFunction()
const {
10111 S.
Diag(OvlExpr->getNameLoc(), diag::err_addr_ovl_no_qualifier)
10112 << TargetType << OvlExpr->getSourceRange();
10115 bool IsStaticMemberFunctionFromBoundPointer()
const {
10116 return StaticMemberFunctionFromBoundPointer;
10119 void ComplainIsStaticMemberFunctionFromBoundPointer()
const {
10120 S.
Diag(OvlExpr->getLocStart(),
10121 diag::err_invalid_form_pointer_member_function)
10122 << OvlExpr->getSourceRange();
10125 void ComplainOfInvalidConversion()
const {
10126 S.
Diag(OvlExpr->getLocStart(), diag::err_addr_ovl_not_func_ptrref)
10127 << OvlExpr->getName() << TargetType;
10130 void ComplainMultipleMatchesFound()
const {
10132 S.
Diag(OvlExpr->getLocStart(), diag::err_addr_ovl_ambiguous)
10133 << OvlExpr->getName()
10134 << OvlExpr->getSourceRange();
10138 bool hadMultipleCandidates()
const {
return (OvlExpr->getNumDecls() > 1); }
10140 int getNumMatches()
const {
return Matches.size(); }
10143 if (
Matches.size() != 1)
return nullptr;
10148 if (
Matches.size() != 1)
return nullptr;
10174 bool *pHadMultipleCandidates) {
10177 AddressOfFunctionResolver Resolver(*
this, AddressOfExpr, TargetType,
10179 int NumMatches = Resolver.getNumMatches();
10181 if (NumMatches == 0 && Complain) {
10182 if (Resolver.IsInvalidFormOfPointerToMemberFunction())
10183 Resolver.ComplainIsInvalidFormOfPointerToMemberFunction();
10185 Resolver.ComplainNoMatchesFound();
10187 else if (NumMatches > 1 && Complain)
10188 Resolver.ComplainMultipleMatchesFound();
10189 else if (NumMatches == 1) {
10190 Fn = Resolver.getMatchingFunctionDecl();
10192 FoundResult = *Resolver.getMatchingFunctionAccessPair();
10194 if (Resolver.IsStaticMemberFunctionFromBoundPointer())
10195 Resolver.ComplainIsStaticMemberFunctionFromBoundPointer();
10201 if (pHadMultipleCandidates)
10202 *pHadMultipleCandidates = Resolver.hadMultipleCandidates();
10247 = cast<FunctionTemplateDecl>((*I)->getUnderlyingDecl());
10259 Specialization, Info,
10263 FailedCandidates.addCandidate()
10269 assert(Specialization &&
"no specialization and no error?");
10281 Matched = Specialization;
10282 if (FoundResult) *FoundResult = I.getPair();
10286 Matched->getReturnType()->isUndeducedType() &&
10305 ExprResult &SrcExpr,
bool doFunctionPointerConverion,
10306 bool complain,
const SourceRange& OpRangeForComplaining,
10308 unsigned DiagIDForComplaining) {
10316 ovl.Expression,
false, &found)) {
10326 if (!ovl.HasFormOfMemberPointer &&
10327 isa<CXXMethodDecl>(fn) &&
10328 cast<CXXMethodDecl>(fn)->isInstance()) {
10329 if (!complain)
return false;
10331 Diag(ovl.Expression->getExprLoc(),
10332 diag::err_bound_member_function)
10333 << 0 << ovl.Expression->getSourceRange();
10345 SingleFunctionExpression =
10349 if (doFunctionPointerConverion) {
10350 SingleFunctionExpression =
10352 if (SingleFunctionExpression.
isInvalid()) {
10359 if (!SingleFunctionExpression.
isUsable()) {
10361 Diag(OpRangeForComplaining.
getBegin(), DiagIDForComplaining)
10362 << ovl.Expression->getName()
10363 << DestTypeForComplaining
10364 << OpRangeForComplaining
10365 << ovl.Expression->getQualifierLoc().getSourceRange();
10375 SrcExpr = SingleFunctionExpression;
10385 bool PartialOverloading,
10388 if (isa<UsingShadowDecl>(Callee))
10389 Callee = cast<UsingShadowDecl>(Callee)->getTargetDecl();
10391 if (
FunctionDecl *Func = dyn_cast<FunctionDecl>(Callee)) {
10392 if (ExplicitTemplateArgs) {
10393 assert(!KnownValid &&
"Explicit template arguments?");
10398 PartialOverloading);
10403 = dyn_cast<FunctionTemplateDecl>(Callee)) {
10405 ExplicitTemplateArgs, Args, CandidateSet,
10407 PartialOverloading);
10411 assert(!KnownValid &&
"unhandled case in overloaded call candidate");
10419 bool PartialOverloading) {
10442 assert(!(*I)->getDeclContext()->isRecord());
10443 assert(isa<UsingShadowDecl>(*I) ||
10444 !(*I)->getDeclContext()->isFunctionOrMethod());
10445 assert((*I)->getUnderlyingDecl()->isFunctionOrFunctionTemplate());
10455 ExplicitTemplateArgs = &TABuffer;
10461 CandidateSet, PartialOverloading,
10466 Args, ExplicitTemplateArgs,
10467 CandidateSet, PartialOverloading);
10474 case OO_New:
case OO_Array_New:
10475 case OO_Delete:
case OO_Array_Delete:
10495 bool *DoDiagnoseEmptyLookup =
nullptr) {
10500 if (DC->isTransparentContext())
10508 if (isa<CXXRecordDecl>(DC)) {
10512 if (DoDiagnoseEmptyLookup)
10513 *DoDiagnoseEmptyLookup =
true;
10520 ExplicitTemplateArgs, Args,
10521 Candidates,
false,
false);
10524 if (Candidates.BestViableFunction(SemaRef, FnLoc, Best) !=
OR_Success) {
10536 AssociatedNamespaces,
10537 AssociatedClasses);
10541 for (Sema::AssociatedNamespaceSet::iterator
10542 it = AssociatedNamespaces.begin(),
10543 end = AssociatedNamespaces.end(); it != end; ++it) {
10555 SuggestedNamespaces.insert(*it);
10559 SemaRef.
Diag(R.
getNameLoc(), diag::err_not_found_by_two_phase_lookup)
10561 if (SuggestedNamespaces.empty()) {
10562 SemaRef.
Diag(Best->Function->getLocation(),
10563 diag::note_not_found_by_two_phase_lookup)
10565 }
else if (SuggestedNamespaces.size() == 1) {
10566 SemaRef.
Diag(Best->Function->getLocation(),
10567 diag::note_not_found_by_two_phase_lookup)
10573 SemaRef.
Diag(Best->Function->getLocation(),
10574 diag::note_not_found_by_two_phase_lookup)
10606 class BuildRecoveryCallExprRAII {
10609 BuildRecoveryCallExprRAII(
Sema &S) : SemaRef(S) {
10610 assert(SemaRef.IsBuildingRecoveryCallExpr ==
false);
10611 SemaRef.IsBuildingRecoveryCallExpr =
true;
10614 ~BuildRecoveryCallExprRAII() {
10615 SemaRef.IsBuildingRecoveryCallExpr =
false;
10621 static std::unique_ptr<CorrectionCandidateCallback>
10623 bool HasTemplateArgs,
bool AllowTypoCorrection) {
10624 if (!AllowTypoCorrection)
10625 return llvm::make_unique<NoTypoCorrectionCCC>();
10626 return llvm::make_unique<FunctionCallFilterCCC>(SemaRef, NumArgs,
10627 HasTemplateArgs, ME);
10639 bool EmptyLookup,
bool AllowTypoCorrection) {
10648 BuildRecoveryCallExprRAII RCE(SemaRef);
10658 ExplicitTemplateArgs = &TABuffer;
10663 bool DoDiagnoseEmptyLookup = EmptyLookup;
10666 ExplicitTemplateArgs, Args,
10667 &DoDiagnoseEmptyLookup) &&
10670 MakeValidator(SemaRef, dyn_cast<MemberExpr>(Fn), Args.size(),
10671 ExplicitTemplateArgs !=
nullptr, AllowTypoCorrection),
10672 ExplicitTemplateArgs, Args)))
10675 assert(!R.empty() &&
"lookup results empty despite recovery");
10680 if ((*R.begin())->isCXXClassMember())
10682 R, ExplicitTemplateArgs);
10683 else if (ExplicitTemplateArgs || TemplateKWLoc.
isValid())
10685 ExplicitTemplateArgs);
10689 if (NewFn.isInvalid())
10695 return SemaRef.
ActOnCallExpr(
nullptr, NewFn.get(), LParenLoc,
10712 assert(!ULE->
getQualifier() &&
"qualified name with ADL");
10720 llvm_unreachable(
"performing ADL for builtin");
10727 UnbridgedCastsSet UnbridgedCasts;
10742 if (CandidateSet->
empty() ||
10757 if (CandidateSet->
empty())
10760 UnbridgedCasts.restore();
10776 bool AllowTypoCorrection) {
10777 if (CandidateSet->
empty())
10780 AllowTypoCorrection);
10782 switch (OverloadResult) {
10799 AllowTypoCorrection);
10803 SemaRef.
Diag(Fn->getLocStart(),
10804 diag::err_ovl_no_viable_function_in_call)
10805 << ULE->
getName() << Fn->getSourceRange();
10811 SemaRef.
Diag(Fn->getLocStart(), diag::err_ovl_ambiguous_call)
10812 << ULE->
getName() << Fn->getSourceRange();
10817 SemaRef.
Diag(Fn->getLocStart(), diag::err_ovl_deleted_call)
10818 << (*Best)->Function->isDeleted()
10821 << Fn->getSourceRange();
10849 bool AllowTypoCorrection) {
10863 RParenLoc, ExecConfig, &CandidateSet,
10864 &Best, OverloadResult,
10865 AllowTypoCorrection);
10869 return Functions.
size() > 1 ||
10870 (Functions.
size() == 1 && isa<FunctionTemplateDecl>(*Functions.
begin()));
10896 assert(Op !=
OO_None &&
"Invalid opcode for overloaded unary operator");
10905 unsigned NumArgs = 1;
10952 bool HadMultipleCandidates = (CandidateSet.
size() > 1);
10966 if (
CXXMethodDecl *Method = dyn_cast<CXXMethodDecl>(FnDecl)) {
10971 Best->FoundDecl, Method);
10974 Input = InputRes.
get();
10985 Input = InputInit.
get();
10990 HadMultipleCandidates, OpLoc);
11002 ResultTy, VK, OpLoc,
false);
11017 Input = InputRes.
get();
11035 Diag(OpLoc, diag::err_ovl_ambiguous_oper_unary)
11038 << Input->getSourceRange();
11044 Diag(OpLoc, diag::err_ovl_deleted_oper)
11045 << Best->Function->isDeleted()
11048 << Input->getSourceRange();
11082 Expr *Args[2] = { LHS, RHS };
11091 if (Args[0]->isTypeDependent() || Args[1]->isTypeDependent()) {
11136 if (Opc ==
BO_Assign && !Args[0]->getType()->isOverloadableType())
11164 bool HadMultipleCandidates = (CandidateSet.
size() > 1);
11178 if (
CXXMethodDecl *Method = dyn_cast<CXXMethodDecl>(FnDecl)) {
11192 Best->FoundDecl, Method);
11220 HadMultipleCandidates, OpLoc);
11231 Args, ResultTy, VK, OpLoc,
11240 if (isa<CXXMethodDecl>(FnDecl))
11241 ArgsArray = ArgsArray.slice(1);
11244 if (Op == OO_Equal)
11247 checkCall(FnDecl,
nullptr, ArgsArray, isa<CXXMethodDecl>(FnDecl), OpLoc,
11260 Args[0] = ArgsRes0.
get();
11267 Args[1] = ArgsRes1.
get();
11286 Diag(OpLoc, diag::err_ovl_no_viable_oper)
11288 << Args[0]->getSourceRange() << Args[1]->getSourceRange();
11289 if (Args[0]->getType()->isIncompleteType()) {
11290 Diag(OpLoc, diag::note_assign_lhs_incomplete)
11292 << Args[0]->getSourceRange() << Args[1]->getSourceRange();
11307 "C++ binary operator overloading is missing candidates!");
11315 Diag(OpLoc, diag::err_ovl_ambiguous_oper_binary)
11318 << Args[0]->getSourceRange() << Args[1]->getSourceRange();
11325 CXXMethodDecl *Method = cast<CXXMethodDecl>(Best->Function);
11326 Diag(OpLoc, diag::err_ovl_deleted_special_oper)
11335 Diag(OpLoc, diag::err_ovl_deleted_oper)
11336 << Best->Function->isDeleted()
11339 << Args[0]->getSourceRange() << Args[1]->getSourceRange();
11354 Expr *Args[2] = { Base, Idx };
11360 if (Args[0]->isTypeDependent() || Args[1]->isTypeDependent()) {
11396 bool HadMultipleCandidates = (CandidateSet.
size() > 1);
11415 Best->FoundDecl, Method);
11416 if (Arg0.isInvalid())
11418 Args[0] = Arg0.get();
11434 OpLocInfo.setCXXOperatorNameRange(
SourceRange(LLoc, RLoc));
11437 HadMultipleCandidates,
11438 OpLocInfo.getLoc(),
11439 OpLocInfo.getInfo());
11450 FnExpr.
get(), Args,
11451 ResultTy, VK, RLoc,
11467 Args[0] = ArgsRes0.
get();
11474 Args[1] = ArgsRes1.
get();
11481 if (CandidateSet.
empty())
11482 Diag(LLoc, diag::err_ovl_no_oper)
11484 << Args[0]->getSourceRange() << Args[1]->getSourceRange();
11486 Diag(LLoc, diag::err_ovl_no_viable_subscript)
11488 << Args[0]->getSourceRange() << Args[1]->getSourceRange();
11495 Diag(LLoc, diag::err_ovl_ambiguous_oper_binary)
11498 << Args[0]->getSourceRange() << Args[1]->getSourceRange();
11504 Diag(LLoc, diag::err_ovl_deleted_oper)
11505 << Best->Function->isDeleted() <<
"[]"
11507 << Args[0]->getSourceRange() << Args[1]->getSourceRange();
11537 if (
BinaryOperator *op = dyn_cast<BinaryOperator>(NakedMemExpr)) {
11552 QualType objectType = op->getLHS()->getType();
11555 Qualifiers objectQuals = objectType.getQualifiers();
11557 Qualifiers difference = objectQuals - funcQuals;
11561 std::string qualsString = difference.
getAsString();
11562 Diag(LParenLoc, diag::err_pointer_to_member_call_drops_quals)
11563 << fnType.getUnqualifiedType()
11565 << (qualsString.find(
' ') == std::string::npos ? 1 : 2);
11568 if (resultType->isMemberPointerType())
11574 resultType, valueKind, RParenLoc);
11583 if (CheckOtherCall(call, proto))
11589 if (isa<CXXPseudoDestructorExpr>(NakedMemExpr))
11593 UnbridgedCastsSet UnbridgedCasts;
11601 if (isa<MemberExpr>(NakedMemExpr)) {
11602 MemExpr = cast<MemberExpr>(NakedMemExpr);
11606 UnbridgedCasts.restore();
11624 TemplateArgs = &TemplateArgsBuffer;
11628 E = UnresExpr->
decls_end(); I != E; ++I) {
11632 if (isa<UsingShadowDecl>(Func))
11633 Func = cast<UsingShadowDecl>(Func)->getTargetDecl();
11637 if (
getLangOpts().MicrosoftExt && isa<CXXConstructorDecl>(Func)) {
11639 Args, CandidateSet);
11640 }
else if ((Method = dyn_cast<CXXMethodDecl>(Func))) {
11647 ObjectClassification, Args, CandidateSet,
11651 I.getPair(), ActingDC, TemplateArgs,
11652 ObjectType, ObjectClassification,
11653 Args, CandidateSet,
11660 UnbridgedCasts.restore();
11666 Method = cast<CXXMethodDecl>(Best->Function);
11667 FoundDecl = Best->FoundDecl;
11677 if (Method != FoundDecl.getDecl() &&
11684 diag::err_ovl_no_viable_member_function_in_call)
11685 << DeclName << MemExprE->getSourceRange();
11692 << DeclName << MemExprE->getSourceRange();
11699 << Best->Function->isDeleted()
11702 << MemExprE->getSourceRange();
11724 assert(Method &&
"Member call to something that isn't a method?");
11727 ResultType, VK, RParenLoc);
11752 FoundDecl, Method);
11767 if (CheckFunctionCall(Method, TheCall, Proto))
11777 diag::warn_call_to_pure_virtual_member_function_from_ctor_dtor)
11800 UnbridgedCastsSet UnbridgedCasts;
11805 "Requires object type argument");
11820 diag::err_incomplete_object_call, Object.
get()))
11828 Oper != OperEnd; ++Oper) {
11831 Args, CandidateSet,
11852 const auto &Conversions =
11853 cast<CXXRecordDecl>(Record->getDecl())->getVisibleConversionFunctions();
11854 for (
auto I = Conversions.begin(), E = Conversions.end(); I != E; ++I) {
11857 if (isa<UsingShadowDecl>(D))
11858 D = cast<UsingShadowDecl>(D)->getTargetDecl();
11862 if (isa<FunctionTemplateDecl>(D))
11876 Object.
get(), Args, CandidateSet);
11881 bool HadMultipleCandidates = (CandidateSet.size() > 1);
11885 switch (CandidateSet.BestViableFunction(*
this, Object.
get()->getLocStart(),
11893 if (CandidateSet.empty())
11894 Diag(Object.
get()->getLocStart(), diag::err_ovl_no_oper)
11896 << Object.
get()->getSourceRange();
11898 Diag(Object.
get()->getLocStart(),
11899 diag::err_ovl_no_viable_object_call)
11900 << Object.
get()->
getType() << Object.
get()->getSourceRange();
11905 Diag(Object.
get()->getLocStart(),
11906 diag::err_ovl_ambiguous_object_call)
11907 << Object.
get()->
getType() << Object.
get()->getSourceRange();
11912 Diag(Object.
get()->getLocStart(),
11913 diag::err_ovl_deleted_object_call)
11914 << Best->Function->isDeleted()
11917 << Object.
get()->getSourceRange();
11922 if (Best == CandidateSet.end())
11925 UnbridgedCasts.restore();
11927 if (Best->Function ==
nullptr) {
11931 = cast<CXXConversionDecl>(
11932 Best->Conversions[0].UserDefined.ConversionFunction);
11938 assert(Conv == Best->FoundDecl.getDecl() &&
11939 "Found Decl & conversion-to-functionptr should be same, right?!");
11947 Conv, HadMultipleCandidates);
11948 if (Call.isInvalid())
11955 return ActOnCallExpr(S, Call.get(), LParenLoc, Args, RParenLoc);
11963 CXXMethodDecl *Method = cast<CXXMethodDecl>(Best->Function);
11966 if (Method->isInvalidDecl())
11978 HadMultipleCandidates,
11979 OpLocInfo.getLoc(),
11980 OpLocInfo.getInfo());
11986 std::unique_ptr<Expr * []> MethodArgs(
new Expr *[Args.size() + 1]);
11987 MethodArgs[0] = Object.
get();
11988 std::copy(Args.begin(), Args.end(), &MethodArgs[1]);
11992 QualType ResultTy = Method->getReturnType();
11994 ResultTy = ResultTy.getNonLValueExprType(
Context);
11998 llvm::makeArrayRef(MethodArgs.get(), Args.size() + 1),
11999 ResultTy, VK, RParenLoc,
false);
12000 MethodArgs.reset();
12007 if (Args.size() < NumParams)
12010 bool IsError =
false;
12015 Best->FoundDecl, Method);
12020 TheCall->setArg(0, Object.
get());
12023 for (
unsigned i = 0; i != NumParams; i++) {
12025 if (i < Args.size()) {
12033 Method->getParamDecl(i)),
12049 TheCall->setArg(i + 1, Arg);
12055 for (
unsigned i = NumParams, e = Args.size(); i < e; i++) {
12059 TheCall->setArg(i + 1, Arg.
get());
12063 if (IsError)
return true;
12067 if (CheckFunctionCall(Method, TheCall, Proto))
12078 bool *NoArrowOperatorFound) {
12080 "left-hand side must have class type");
12099 diag::err_typecheck_incomplete_tag, Base))
12107 Oper != OperEnd; ++Oper) {
12109 None, CandidateSet,
false);
12112 bool HadMultipleCandidates = (CandidateSet.
size() > 1);
12122 if (CandidateSet.
empty()) {
12124 if (NoArrowOperatorFound) {
12127 *NoArrowOperatorFound =
true;
12130 Diag(OpLoc, diag::err_typecheck_member_reference_arrow)
12131 << BaseType << Base->getSourceRange();
12133 Diag(OpLoc, diag::note_typecheck_member_reference_suggestion)
12137 Diag(OpLoc, diag::err_ovl_no_viable_oper)
12138 <<
"operator->" << Base->getSourceRange();
12143 Diag(OpLoc, diag::err_ovl_ambiguous_oper_unary)
12144 <<
"->" << Base->
getType() << Base->getSourceRange();
12149 Diag(OpLoc, diag::err_ovl_deleted_oper)
12150 << Best->Function->isDeleted()
12153 << Base->getSourceRange();
12161 CXXMethodDecl *Method = cast<CXXMethodDecl>(Best->Function);
12164 Best->FoundDecl, Method);
12165 if (BaseResult.isInvalid())
12167 Base = BaseResult.get();
12171 HadMultipleCandidates, OpLoc);
12180 Base, ResultTy, VK, OpLoc,
false);
12202 bool HadMultipleCandidates = (CandidateSet.size() > 1);
12207 switch (CandidateSet.BestViableFunction(*
this, UDSuffixLoc, Best)) {
12213 Diag(UDSuffixLoc, diag::err_ovl_no_viable_function_in_call)
12226 HadMultipleCandidates,
12235 for (
unsigned ArgIdx = 0, N = Args.size(); ArgIdx != N; ++ArgIdx) {
12241 ConvArgs[ArgIdx] = InputInit.
get();
12250 llvm::makeArrayRef(ConvArgs, Args.size()),
12251 ResultTy, VK, LitEndLoc, UDSuffixLoc);
12256 if (CheckFunctionCall(FD, UDL,
nullptr))
12277 CandidateSet->
clear();
12278 if (!MemberLookup.
empty()) {
12288 Diag(Range->getLocStart(), diag::note_in_for_range)
12289 << RangeLoc << BEF << Range->
getType();
12295 Diag(Range->getLocStart(), diag::note_in_for_range)
12296 << RangeLoc << BEF << Range->
getType();
12305 FoundNames.
begin(), FoundNames.
end());
12308 CandidateSet, CallExpr);
12309 if (CandidateSet->
empty() || CandidateSetError) {
12322 Loc,
nullptr, CandidateSet, &Best,
12327 Diag(Range->getLocStart(), diag::note_in_for_range)
12328 << RangeLoc << BEF << Range->
getType();
12343 if (
ParenExpr *PE = dyn_cast<ParenExpr>(E)) {
12346 if (SubExpr == PE->getSubExpr())
12349 return new (
Context)
ParenExpr(PE->getLParen(), PE->getRParen(), SubExpr);
12357 "Implicit cast type cannot be determined from overload");
12358 assert(ICE->path_empty() &&
"fixing up hierarchy conversion?");
12359 if (SubExpr == ICE->getSubExpr())
12363 ICE->getCastKind(),
12369 assert(UnOp->getOpcode() ==
UO_AddrOf &&
12370 "Can only take the address of an overloaded function");
12372 if (Method->isStatic()) {
12381 if (SubExpr == UnOp->getSubExpr())
12384 assert(isa<DeclRefExpr>(SubExpr)
12385 &&
"fixed to something other than a decl ref");
12386 assert(cast<DeclRefExpr>(SubExpr)->getQualifier()
12387 &&
"fixed to a member ref with no nested name qualifier");
12399 UnOp->getOperatorLoc());
12404 if (SubExpr == UnOp->getSubExpr())
12410 UnOp->getOperatorLoc());
12416 if (ULE->hasExplicitTemplateArgs()) {
12417 ULE->copyTemplateArgumentsInto(TemplateArgsBuffer);
12418 TemplateArgs = &TemplateArgsBuffer;
12422 ULE->getQualifierLoc(),
12423 ULE->getTemplateKeywordLoc(),
12439 if (MemExpr->hasExplicitTemplateArgs()) {
12440 MemExpr->copyTemplateArgumentsInto(TemplateArgsBuffer);
12441 TemplateArgs = &TemplateArgsBuffer;
12448 if (MemExpr->isImplicitAccess()) {
12449 if (cast<CXXMethodDecl>(Fn)->isStatic()) {
12451 MemExpr->getQualifierLoc(),
12452 MemExpr->getTemplateKeywordLoc(),
12455 MemExpr->getMemberLoc(),
12465 if (MemExpr->getQualifier())
12466 Loc = MemExpr->getQualifierLoc().getBeginLoc();
12469 MemExpr->getBaseType(),
12473 Base = MemExpr->getBase();
12477 if (cast<CXXMethodDecl>(Fn)->isStatic()) {
12486 Context, Base, MemExpr->isArrow(), MemExpr->getOperatorLoc(),
12487 MemExpr->getQualifierLoc(), MemExpr->getTemplateKeywordLoc(), Fn, Found,
12488 MemExpr->getMemberNameInfo(), TemplateArgs,
type, valueKind,
12495 llvm_unreachable(
"Invalid reference to overloaded function");
Abstract class used to diagnose incomplete types.
static bool IsNotEnableIfAttr(Attr *A)
unsigned ExplicitCallArguments
The number of call arguments that were explicitly provided, to be used while performing partial order...
bool hasObjCGCAttr() const
A call to an overloaded operator written using operator syntax.
ValueDecl * getMemberDecl() const
Retrieve the member declaration to which this expression refers.
bool compatiblyIncludesObjCLifetime(Qualifiers other) const
Determines if these qualifiers compatibly include another set of qualifiers from the narrow perspecti...
int getFloatingTypeOrder(QualType LHS, QualType RHS) const
Compare the rank of the two specified floating point types, ignoring the domain of the type (i...
void copyTemplateArgumentsInto(TemplateArgumentListInfo &List) const
Copies the template arguments into the given structure.
bool isObjCObjectOrInterfaceType() const
DeclAccessPair FoundConversionFunction
The declaration that we found via name lookup, which might be the same as ConversionFunction or it mi...
Defines the clang::ASTContext interface.
unsigned getNumInits() const
unsigned DeprecatedStringLiteralToCharPtr
Whether this is the deprecated conversion of a string literal to a pointer to non-const character dat...
Qualifiers getLocalQualifiers() const
Retrieve the set of qualifiers local to this particular QualType instance, not including any qualifie...
SmallVector< TemplateSpecCandidate, 16 >::iterator iterator
bool isMSVCRTEntryPoint() const
Determines whether this function is a MSVCRT user defined entry point.
void setStdInitializerListElement(bool V=true)
static DiagnosticBuilder Diag(DiagnosticsEngine *Diags, const LangOptions &Features, FullSourceLoc TokLoc, const char *TokBegin, const char *TokRangeBegin, const char *TokRangeEnd, unsigned DiagID)
Produce a diagnostic highlighting some portion of a literal.
bool isNullPtrType() const
QualType getToType() const
StringRef getName() const
ExprResult PerformContextuallyConvertToBool(Expr *From)
const TemplateArgument * getSecondArg()
Return the second template argument this deduction failure refers to, if any.
Smart pointer class that efficiently represents Objective-C method names.
static bool isTypeValid(QualType T)
Determine whether the given type is valid, e.g., it is not an invalid C++ class.
bool isAtLeastAsQualifiedAs(QualType Other) const
Determine whether this type is at least as qualified as the other given type, requiring exact equalit...
bool hasExplicitTemplateArgs() const
Determines whether this expression had explicit template arguments.
TemplateDeductionResult
Describes the result of template argument deduction.
void setToType(QualType T)
void setFromType(QualType T)
QualType getConversionType() const
Returns the type that this conversion function is converting to.
specific_attr_iterator< T > specific_attr_begin() const
static bool IsTransparentUnionStandardConversion(Sema &S, Expr *From, QualType &ToType, bool InOverloadResolution, StandardConversionSequence &SCS, bool CStyle)
EnableIfAttr * CheckEnableIf(FunctionDecl *Function, ArrayRef< Expr * > Args, bool MissingImplicitThis=false)
bool isMemberPointerType() const
bool isUnavailable(std::string *Message=nullptr) const
Determine whether this declaration is marked 'unavailable'.
Template argument deduction was successful.
UnresolvedSetIterator getMostSpecialized(UnresolvedSetIterator SBegin, UnresolvedSetIterator SEnd, TemplateSpecCandidateSet &FailedCandidates, SourceLocation Loc, const PartialDiagnostic &NoneDiag, const PartialDiagnostic &AmbigDiag, const PartialDiagnostic &CandidateDiag, bool Complain=true, QualType TargetType=QualType())
Retrieve the most specialized of the given function template specializations.
IdentifierInfo * getIdentifier() const
static void DiagnoseBadDeduction(Sema &S, Decl *Templated, DeductionFailureInfo &DeductionFailure, unsigned NumArgs)
Diagnose a failed template-argument deduction.
bool isInstantiationDependentType() const
Determine whether this type is an instantiation-dependent type, meaning that the type involves a temp...
bool isObjCPointerConversion(QualType FromType, QualType ToType, QualType &ConvertedType, bool &IncompatibleObjC)
QualType getNonLValueExprType(const ASTContext &Context) const
Determine the type of a (typically non-lvalue) expression with the specified result type...
QualType getQualifiedType(SplitQualType split) const
Un-split a SplitQualType.
const LangOptions & getLangOpts() const
static UnresolvedLookupExpr * Create(const ASTContext &C, CXXRecordDecl *NamingClass, NestedNameSpecifierLoc QualifierLoc, const DeclarationNameInfo &NameInfo, bool ADL, bool Overloaded, UnresolvedSetIterator Begin, UnresolvedSetIterator End)
CanQual< T > getUnqualifiedType() const
Retrieve the unqualified form of this type.
SourceLocation getCXXLiteralOperatorNameLoc() const
bool isAnyCharacterType() const
Determine whether this type is any of the built-in character types.
static void AddBuiltinAssignmentOperatorCandidates(Sema &S, QualType T, ArrayRef< Expr * > Args, OverloadCandidateSet &CandidateSet)
Helper function for AddBuiltinOperatorCandidates() that adds the volatile- and non-volatile-qualified...
TemplateDecl * getAsTemplateDecl() const
Retrieve the underlying template declaration that this template name refers to, if known...
bool isMain() const
Determines whether this function is "main", which is the entry point into an executable program...
Provides information about an attempted template argument deduction, whose success or failure was des...
QualType getRValueReferenceType(QualType T) const
Return the uniqued reference to the type for an rvalue reference to the specified type...
unsigned getIntWidth(QualType T) const
void clear()
Clear out all of the candidates. TODO: This may be unnecessary.
ExprResult BuildCXXDefaultArgExpr(SourceLocation CallLoc, FunctionDecl *FD, ParmVarDecl *Param)
Complex conversions (C99 6.3.1.6)
void setObjCLifetime(ObjCLifetime type)
bool hasPlaceholderType() const
Returns whether this expression has a placeholder type.
std::string getTemplateArgumentBindingsText(const TemplateParameterList *Params, const TemplateArgumentList &Args)
Produces a formatted string that describes the binding of template parameters to template arguments...
NestedNameSpecifier * getQualifier() const
If the member name was qualified, retrieves the nested-name-specifier that precedes the member name...
bool isRecordType() const
UserDefinedConversionSequence UserDefined
SemaDiagnosticBuilder Diag(SourceLocation Loc, unsigned DiagID)
Emit a diagnostic.
static ImplicitConversionSequence TryContextuallyConvertToBool(Sema &S, Expr *From)
ExprResult BuildCallToMemberFunction(Scope *S, Expr *MemExpr, SourceLocation LParenLoc, MultiExprArg Args, SourceLocation RParenLoc)
bool isSpecializationCopyingObject() const
Determine whether this is a member template specialization that would copy the object to itself...
static TemplateDecl * getDescribedTemplate(Decl *Templated)
A reference to a name which we were able to look up during parsing but could not resolve to a specifi...
ExprResult PerformContextualImplicitConversion(SourceLocation Loc, Expr *FromE, ContextualImplicitConverter &Converter)
Perform a contextual implicit conversion.
QualType getVolatileType(QualType T) const
Return the uniqued reference to the type for a volatile qualified type.
Not a narrowing conversion.
llvm::iterator_range< conversion_iterator > getVisibleConversionFunctions()
Get all conversion functions visible in current class, including conversion function templates...
bool isEnumeralType() const
Expr * getExpr()
Return the expression this deduction failure refers to, if any.
bool CanPerformCopyInitialization(const InitializedEntity &Entity, ExprResult Init)
bool hasDefinition() const
std::string getAsString() const
ExprResult CreateBuiltinArraySubscriptExpr(Expr *Base, SourceLocation LLoc, Expr *Idx, SourceLocation RLoc)
QualType getLValueReferenceType(QualType T, bool SpelledAsLValue=true) const
Return the uniqued reference to the type for an lvalue reference to the specified type...
RefQualifierKind getRefQualifier() const
Retrieve the ref-qualifier associated with this method.
QualType getPointeeType() const
static void CompleteNonViableCandidate(Sema &S, OverloadCandidate *Cand, ArrayRef< Expr * > Args)
bool isDependentContext() const
Determines whether this context is dependent on a template parameter.
unsigned IncompatibleObjC
unsigned getCVRQualifiers() const
Retrieve the set of CVR (const-volatile-restrict) qualifiers applied to this type.
QualType getRecordType(const RecordDecl *Decl) const
void MarkDeclRefReferenced(DeclRefExpr *E)
Perform reference-marking and odr-use handling for a DeclRefExpr.
NamespaceDecl - Represent a C++ namespace.
Template argument deduction produced inconsistent deduced values for the given template parameter...
SourceLocation getLocForEndOfToken(SourceLocation Loc, unsigned Offset=0)
Calls Lexer::getLocForEndOfToken()
static ExprValueKind getValueKindForType(QualType T)
Ambiguous candidates found.
bool isBooleanType() const
bool compatiblyIncludes(Qualifiers other) const
Determines if these qualifiers compatibly include another set. Generally this answers the question of...
Conversions between compatible types in C99.
bool isBlockPointerType() const
static bool CheckConvertedConstantConversions(Sema &S, StandardConversionSequence &SCS)
bool inferCUDATargetForImplicitSpecialMember(CXXRecordDecl *ClassDecl, CXXSpecialMember CSM, CXXMethodDecl *MemberDecl, bool ConstRHS, bool Diagnose)
bool IgnoreObjectArgument
Partial ordering of function templates for a call to a conversion function.
Represents a C++ constructor within a class.
static unsigned RankDeductionFailure(const DeductionFailureInfo &DFI)
void * getAsOpaquePtr() const
void ArgumentDependentLookup(DeclarationName Name, SourceLocation Loc, ArrayRef< Expr * > Args, ADLResult &Functions)
void Adopt(NestedNameSpecifierLoc Other)
Adopt an existing nested-name-specifier (with source-range information).
RAII object that enters a new expression evaluation context.
QualType getRestrictType(QualType T) const
Return the uniqued reference to the type for a restrict qualified type.
PartialDiagnostic PDiag(unsigned DiagID=0)
Build a partial diagnostic.
ExprResult PerformObjectArgumentInitialization(Expr *From, NestedNameSpecifier *Qualifier, NamedDecl *FoundDecl, CXXMethodDecl *Method)
static bool isAllowableExplicitConversion(Sema &S, QualType ConvType, QualType ToType, bool AllowObjCPointerConversion)
void removeObjCLifetime()
DiagnosticsEngine & Diags
ObjCLifetime getObjCLifetime() const
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)
OverloadKind CheckOverload(Scope *S, FunctionDecl *New, const LookupResult &OldDecls, NamedDecl *&OldDecl, bool IsForUsingDecl)
AccessSpecifier getAccess() const
static ImplicitConversionSequence::CompareKind CompareQualificationConversions(Sema &S, const StandardConversionSequence &SCS1, const StandardConversionSequence &SCS2)
std::string getAsString() const
std::string getDeletedOrUnavailableSuffix(const FunctionDecl *FD)
Retrieve the message suffix that should be added to a diagnostic complaining about the given function...
uint64_t getTypeSize(QualType T) const
Return the size of the specified (complete) type T, in bits.
QualType getThisType(ASTContext &C) const
Returns the type of the this pointer.
NamedDecl * getUnderlyingDecl()
Looks through UsingDecls and ObjCCompatibleAliasDecls for the underlying named decl.
QualType ExtractUnqualifiedFunctionType(QualType PossiblyAFunctionType)
bool HadMultipleCandidates
ExprResult CreateOverloadedUnaryOp(SourceLocation OpLoc, unsigned Opc, const UnresolvedSetImpl &Fns, Expr *input)
Create a unary operation that may resolve to an overloaded operator.
Removal of noreturn from a type (Clang)
Like System, but searched after the system directories.
void getAsStringInternal(std::string &Str, const PrintingPolicy &Policy) const
const BuiltinType * getAsPlaceholderType() const
bool IsIntegralPromotion(Expr *From, QualType FromType, QualType ToType)
unsigned param_size() const
bool FunctionTypesMatchOnNSConsumedAttrs(const FunctionProtoType *FromFunctionType, const FunctionProtoType *ToFunctionType)
std::vector< FixItHint > Hints
The list of Hints generated so far.
ParmVarDecl - Represents a parameter to a function.
QualType getBaseType() const
NullPointerConstantKind isNullPointerConstant(ASTContext &Ctx, NullPointerConstantValueDependence NPC) const
bool isMoveAssignmentOperator() const
Determine whether this is a move assignment operator.
Defines the clang::Expr interface and subclasses for C++ expressions.
TemplateParameter Param
The template parameter to which a template argument deduction failure refers.
bool isEmpty() const
No scope specifier.
static const TemplateDecl * isTemplate(const NamedDecl *ND, const TemplateArgumentList *&TemplateArgs)
FieldDecl * getSourceBitField()
If this expression refers to a bit-field, retrieve the declaration of that bit-field.
ExprResult ActOnCallExpr(Scope *S, Expr *Fn, SourceLocation LParenLoc, MultiExprArg ArgExprs, SourceLocation RParenLoc, Expr *ExecConfig=nullptr, bool IsExecConfig=false)
QualType getArrayDecayedType(QualType T) const
Return the properly qualified result of decaying the specified array type to a pointer.
ExprResult PerformImplicitConversion(Expr *From, QualType ToType, AssignmentAction Action, bool AllowExplicit=false)
unsigned getNumParams() const
Expr * FixOverloadedFunctionReference(Expr *E, DeclAccessPair FoundDecl, FunctionDecl *Fn)
DeclarationName getMemberName() const
Retrieve the name of the member that this expression refers to.
Boolean conversions (C++ 4.12)
QualType apply(const ASTContext &Context, QualType QT) const
Apply the collected qualifiers to the given type.
void AddArgumentDependentLookupCandidates(DeclarationName Name, SourceLocation Loc, ArrayRef< Expr * > Args, TemplateArgumentListInfo *ExplicitTemplateArgs, OverloadCandidateSet &CandidateSet, bool PartialOverloading=false)
Add function candidates found via argument-dependent lookup to the set of overloading candidates...
const TemplateArgumentList * getTemplateSpecializationArgs() const
Retrieve the template arguments used to produce this function template specialization from the primar...
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
A C++ nested-name-specifier augmented with source location information.
The results of name lookup within a DeclContext. This is either a single result (with no stable stora...
OverloadCandidate & addCandidate(unsigned NumConversions=0)
Add a new candidate with NumConversions conversion sequence slots to the overload set...
static bool diagnoseNoViableConversion(Sema &SemaRef, SourceLocation Loc, Expr *&From, Sema::ContextualImplicitConverter &Converter, QualType T, bool HadMultipleCandidates, UnresolvedSetImpl &ExplicitConversions)
ImplicitConversionSequence * Conversions
unsigned BindsToFunctionLvalue
Whether we're binding to a function lvalue.
BadConversionSequence Bad
bool isReferenceType() const
QualType getReturnType() const
FunctionDecl * getTemplatedDecl() const
Get the underlying function declaration of the template.
bool isAnyPointerType() const
Expr * getBase()
Retrieve the base object of this member expressions, e.g., the x in x.m.
Identity conversion (no conversion)
The arguments included an overloaded function name that could not be resolved to a suitable function...
void AddBuiltinOperatorCandidates(OverloadedOperatorKind Op, SourceLocation OpLoc, ArrayRef< Expr * > Args, OverloadCandidateSet &CandidateSet)
void setNumArgs(const ASTContext &C, unsigned NumArgs)
ConversionSet & conversions()
bool buildOverloadedCallSet(Scope *S, Expr *Fn, UnresolvedLookupExpr *ULE, MultiExprArg Args, SourceLocation RParenLoc, OverloadCandidateSet *CandidateSet, ExprResult *Result)
Constructs and populates an OverloadedCandidateSet from the given function.
QualType getToType() const
ExprResult CreateOverloadedBinOp(SourceLocation OpLoc, unsigned Opc, const UnresolvedSetImpl &Fns, Expr *LHS, Expr *RHS)
Create a binary operation that may resolve to an overloaded operator.
Floating point conversions (C++ 4.8)
virtual SemaDiagnosticBuilder diagnoseConversion(Sema &S, SourceLocation Loc, QualType T, QualType ConvTy)=0
Emits a diagnostic when we picked a conversion function (for cases when we are not allowed to pick a ...
unsigned getCVRQualifiers() const
bool hasSameType(QualType T1, QualType T2) const
Determine whether the given types T1 and T2 are equivalent.
static DeclRefExpr * Create(const ASTContext &Context, NestedNameSpecifierLoc QualifierLoc, SourceLocation TemplateKWLoc, ValueDecl *D, bool RefersToEnclosingVariableOrCapture, SourceLocation NameLoc, QualType T, ExprValueKind VK, NamedDecl *FoundD=nullptr, const TemplateArgumentListInfo *TemplateArgs=nullptr)
ExprResult PerformContextuallyConvertToObjCPointer(Expr *From)
bool match(QualType T) override
Match an integral or (possibly scoped) enumeration type.
bool isMoveConstructor(unsigned &TypeQuals) const
Determine whether this constructor is a move constructor (C++0x [class.copy]p3), which can be used to...
const RecordType * getAsUnionType() const
NOTE: getAs*ArrayType are methods on ASTContext.
static bool DiagnoseTwoPhaseOperatorLookup(Sema &SemaRef, OverloadedOperatorKind Op, SourceLocation OpLoc, ArrayRef< Expr * > Args)
Represents a C++ member access expression for which lookup produced a set of overloaded functions...
void AddConversionCandidate(CXXConversionDecl *Conversion, DeclAccessPair FoundDecl, CXXRecordDecl *ActingContext, Expr *From, QualType ToType, OverloadCandidateSet &CandidateSet, bool AllowObjCConversionOnExplicit)
QualType getTypeDeclType(const TypeDecl *Decl, const TypeDecl *PrevDecl=nullptr) const
Return the unique reference to the type for the specified type declaration.
SourceLocation getLocStart() const LLVM_READONLY
OverloadKind
C++ Overloading.
bool hasSameUnqualifiedType(QualType T1, QualType T2) const
Determine whether the given types are equivalent after cvr-qualifiers have been removed.
OverloadCandidateDisplayKind
void NoteDeletedFunction(FunctionDecl *FD)
Emit a note explaining that this function is deleted.
An r-value expression (a pr-value in the C++11 taxonomy) produces a temporary value.
static void NoteFunctionCandidate(Sema &S, OverloadCandidate *Cand, unsigned NumArgs)
Floating point promotions (C++ 4.6)
ASTTemplateArgumentListInfo & getExplicitTemplateArgs()
Describes an C or C++ initializer list.
void AddMethodTemplateCandidate(FunctionTemplateDecl *MethodTmpl, DeclAccessPair FoundDecl, CXXRecordDecl *ActingContext, TemplateArgumentListInfo *ExplicitTemplateArgs, QualType ObjectType, Expr::Classification ObjectClassification, ArrayRef< Expr * > Args, OverloadCandidateSet &CandidateSet, bool SuppressUserConversions=false, bool PartialOverloading=false)
Add a C++ member function template as a candidate to the candidate set, using template argument deduc...
bool isIntegralOrUnscopedEnumerationType() const
Determine whether this type is an integral or unscoped enumeration type.
ImplicitConversionRank getRank() const
QualType getCallResultType(ASTContext &Context) const
Determine the type of an expression that calls a function of this type.
bool isFunctionConsideredUnavailable(FunctionDecl *FD)
Checks availability of the function depending on the current function context.Inside an unavailable f...
static ExprResult CheckConvertedConstantExpression(Sema &S, Expr *From, QualType T, APValue &Value, Sema::CCEKind CCE, bool RequireInt)
SmallVectorImpl< PartialDiagnosticAt > * Diag
Represents the results of name lookup.
const TargetInfo & getTargetInfo() const
An lvalue ref-qualifier was provided (&).
unsigned BindsToRvalue
Whether we're binding to an rvalue.
static ImplicitConversionSequence::CompareKind compareStandardConversionSubsets(ASTContext &Context, const StandardConversionSequence &SCS1, const StandardConversionSequence &SCS2)
bool UnwrapSimilarPointerTypes(QualType &T1, QualType &T2)
bool DiagnoseUseOfDecl(NamedDecl *D, SourceLocation Loc, const ObjCInterfaceDecl *UnknownObjCClass=nullptr, bool ObjCPropertyAccess=false)
Determine whether the use of this declaration is valid, and emit any corresponding diagnostics...
static DeclAccessPair make(NamedDecl *D, AccessSpecifier AS)
const LangOptions & getLangOpts() const
void setCXXOperatorNameRange(SourceRange R)
ReferenceCompareResult CompareReferenceRelationship(SourceLocation Loc, QualType T1, QualType T2, bool &DerivedToBase, bool &ObjCConversion, bool &ObjCLifetimeConversion)
Succeeded, but refers to a deleted function.
APValue Val
Val - This is the value the expression can be folded to.
CanProxy< U > getAs() const
Retrieve a canonical type pointer with a different static type, upcasting or downcasting as needed...
QualType getReturnType() const
unsigned getMinRequiredArguments() const
const CXXRecordDecl * getParent() const
unsigned QualificationIncludesObjCLifetime
Whether the qualification conversion involves a change in the Objective-C lifetime (for automatic ref...
field_range fields() const
bool isObjCLifetimeType() const
const ArrayType * getAsArrayType(QualType T) const
static bool isRecordType(QualType T)
static bool IsAcceptableNonMemberOperatorCandidate(ASTContext &Context, FunctionDecl *Fn, ArrayRef< Expr * > Args)
A builtin binary operation expression such as "x + y" or "x <= y".
Substitution of the deduced template argument values resulted in an error.
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.
bool isValueDependent() const
A set of unresolved declarations.
RecordDecl * getDecl() const
ImplicitConversionKind Second
SourceLocation getTemplateKeywordLoc() const
Retrieve the location of the template keyword preceding this name, if any.
Template argument deduction exceeded the maximum template instantiation depth (which has already been...
static ImplicitConversionSequence TryListConversion(Sema &S, InitListExpr *From, QualType ToType, bool SuppressUserConversions, bool InOverloadResolution, bool AllowObjCWritebackConversion)
bool isUnsignedIntegerType() const
A narrowing conversion, because a constant expression got narrowed.
FunctionDecl * ResolveAddressOfOverloadedFunction(Expr *AddressOfExpr, QualType TargetType, bool Complain, DeclAccessPair &Found, bool *pHadMultipleCandidates=nullptr)
unsigned IsLvalueReference
Whether this is an lvalue reference binding (otherwise, it's an rvalue reference binding).
Expr * IgnoreParenCasts() LLVM_READONLY
void Destroy()
Free any memory associated with this deduction failure.
Qualification conversions (C++ 4.4)
static bool isBooleanType(QualType Ty)
Represents a C++ nested-name-specifier or a global scope specifier.
TypeClass getTypeClass() const
bool isIncompleteType(NamedDecl **Def=nullptr) const
Def If non-NULL, and the type refers to some kind of declaration that can be completed (such as a C s...
void setFromType(QualType T)
static ImplicitConversionSequence::CompareKind CompareDerivedToBaseConversions(Sema &S, const StandardConversionSequence &SCS1, const StandardConversionSequence &SCS2)
NarrowingKind getNarrowingKind(ASTContext &Context, const Expr *Converted, APValue &ConstantValue, QualType &ConstantType) const
static IntegerLiteral * Create(const ASTContext &C, const llvm::APInt &V, QualType type, SourceLocation l)
Returns a new integer literal with value 'V' and type 'type'.
static ImplicitConversionSequence TryContextuallyConvertToObjCPointer(Sema &S, Expr *From)
An ordinary object is located at an address in memory.
virtual SemaDiagnosticBuilder diagnoseIncomplete(Sema &S, SourceLocation Loc, QualType T)=0
Emits a diagnostic when the expression has incomplete class type.
The number of conversion kinds.
TemplateParameter getTemplateParameter()
Retrieve the template parameter this deduction failure refers to, if any.
Represents an ObjC class declaration.
bool isExtVectorType() const
static ExprResult finishContextualImplicitConversion(Sema &SemaRef, SourceLocation Loc, Expr *From, Sema::ContextualImplicitConverter &Converter)
ImplicitConversionKind Third
Third - The third conversion can be a qualification conversion.
static ExprResult BuildRecoveryCallExpr(Sema &SemaRef, Scope *S, Expr *Fn, UnresolvedLookupExpr *ULE, SourceLocation LParenLoc, MutableArrayRef< Expr * > Args, SourceLocation RParenLoc, bool EmptyLookup, bool AllowTypoCorrection)
ExprResult BuildDeclarationNameExpr(const CXXScopeSpec &SS, LookupResult &R, bool NeedsADL, bool AcceptInvalidDecl=false)
Complex <-> Real conversion.
static OverloadingResult IsUserDefinedConversion(Sema &S, Expr *From, QualType ToType, UserDefinedConversionSequence &User, OverloadCandidateSet &Conversions, bool AllowExplicit, bool AllowObjCConversionOnExplicit)
bool Viable
Viable - True to indicate that this overload candidate is viable.
static Classification makeSimpleLValue()
Create a simple, modifiably lvalue.
CanQualType UnsignedCharTy
Integral promotions (C++ 4.5)
bool IsStringLiteralToNonConstPointerConversion(Expr *From, QualType ToType)
bool isCXX11ConstantExpr(const ASTContext &Ctx, APValue *Result=nullptr, SourceLocation *Loc=nullptr) const
const UnresolvedSetImpl & asUnresolvedSet() const
AccessResult CheckUnresolvedMemberAccess(UnresolvedMemberExpr *E, DeclAccessPair FoundDecl)
Represents the this expression in C++.
bool IsOverload(FunctionDecl *New, FunctionDecl *Old, bool IsForUsingDecl)
SourceLocation getLoc() const
getLoc - Returns the main location of the declaration name.
EnumDecl * getDecl() const
bool IsComplexPromotion(QualType FromType, QualType ToType)
Determine if a conversion is a complex promotion.
RAII class used to determine whether SFINAE has trapped any errors that occur during template argumen...
static bool hasDeprecatedStringLiteralToCharPtrConversion(const ImplicitConversionSequence &ICS)
specific_attr_iterator< T > specific_attr_end() const
CXXSpecialMember
Kinds of C++ special members.
QualType getValueType() const
DeductionFailureInfo DeductionFailure
Template argument deduction info.
ExtInfo getExtInfo() const
static void NoteAmbiguousUserConversions(Sema &S, SourceLocation OpLoc, OverloadCandidate *Cand)
Sema - This implements semantic analysis and AST building for C.
bool isBetterOverloadCandidate(Sema &S, const OverloadCandidate &Cand1, const OverloadCandidate &Cand2, SourceLocation Loc, bool UserDefinedConversion=false)
bool CheckCUDATarget(const FunctionDecl *Caller, const FunctionDecl *Callee)
QualType getParamType(unsigned i) const
static ExprResult CreateFunctionRefExpr(Sema &S, FunctionDecl *Fn, NamedDecl *FoundDecl, bool HadMultipleCandidates, SourceLocation Loc=SourceLocation(), const DeclarationNameLoc &LocInfo=DeclarationNameLoc())
A convenience routine for creating a decayed reference to a function.
CXXMethodDecl * getMethodDecl() const
Retrieves the declaration of the called method.
ExprResult CreateBuiltinBinOp(SourceLocation OpLoc, BinaryOperatorKind Opc, Expr *LHSExpr, Expr *RHSExpr)
void erase(NamedDecl *D)
Removes any data associated with a given decl.
Transparent Union Conversions.
bool isStdInitializerList(QualType Ty, QualType *Element)
Tests whether Ty is an instance of std::initializer_list and, if it is and Element is not NULL...
bool EvaluateAsRValue(EvalResult &Result, const ASTContext &Ctx) const
CastKind
CastKind - The kind of operation required for a conversion.
The return type of classify(). Represents the C++11 expression taxonomy.
param_type_iterator param_type_begin() const
static ImplicitCastExpr * Create(const ASTContext &Context, QualType T, CastKind Kind, Expr *Operand, const CXXCastPath *BasePath, ExprValueKind Cat)
void AddMemberOperatorCandidates(OverloadedOperatorKind Op, SourceLocation OpLoc, ArrayRef< Expr * > Args, OverloadCandidateSet &CandidateSet, SourceRange OpRange=SourceRange())
Add overload candidates for overloaded operators that are member functions.
DeclarationNameTable DeclarationNames
Template argument deduction did not deduce a value for every template parameter.
virtual SemaDiagnosticBuilder diagnoseExplicitConv(Sema &S, SourceLocation Loc, QualType T, QualType ConvTy)=0
Emits a diagnostic when the only matching conversion function is explicit.
NamedDecl * getDecl() const
static const char * GetImplicitConversionName(ImplicitConversionKind Kind)
static void NoteBuiltinOperatorCandidate(Sema &S, StringRef Opc, SourceLocation OpLoc, OverloadCandidate *Cand)
bool isNewCandidate(Decl *F)
Determine when this overload candidate will be new to the overload set.
A narrowing conversion by virtue of the source and destination types.
StandardConversionSequence FinalConversion
unsigned Result
A Sema::TemplateDeductionResult.
bool isMoreQualifiedThan(QualType Other) const
Determine whether this type is more qualified than the other given type, requiring exact equality for...
QualType getPointeeType() const
NameKind getNameKind() const
getNameKind - Determine what kind of name this is.
ImplicitConversionSequence TryImplicitConversion(Expr *From, QualType ToType, bool SuppressUserConversions, bool AllowExplicit, bool InOverloadResolution, bool CStyle, bool AllowObjCWritebackConversion)
bool isObjCWritebackConversion(QualType FromType, QualType ToType, QualType &ConvertedType)
Determine whether this is an Objective-C writeback conversion, used for parameter passing when perfor...
bool isRealFloatingType() const
Floating point categories.
static SourceLocation GetLocationForCandidate(const OverloadCandidate *Cand)
bool isSignedIntegerOrEnumerationType() const
Allows QualTypes to be sorted and hence used in maps and sets.
ObjC ARC writeback conversion.
bool isDeleted() const
Whether this function has been deleted.
bool isMicrosoft() const
Is this ABI an MSVC-compatible ABI?
const Type * getTypeForDecl() const
static OverloadingResult IsInitializerListConstructorConversion(Sema &S, Expr *From, QualType ToType, CXXRecordDecl *To, UserDefinedConversionSequence &User, OverloadCandidateSet &CandidateSet, bool AllowExplicit)
unsigned getTypeQualifiers() const
ExprResult BuildResolvedCallExpr(Expr *Fn, NamedDecl *NDecl, SourceLocation LParenLoc, ArrayRef< Expr * > Arg, SourceLocation RParenLoc, Expr *Config=nullptr, bool IsExecConfig=false)
bool DiagnoseEmptyLookup(Scope *S, CXXScopeSpec &SS, LookupResult &R, std::unique_ptr< CorrectionCandidateCallback > CCC, TemplateArgumentListInfo *ExplicitTemplateArgs=nullptr, ArrayRef< Expr * > Args=None, TypoExpr **Out=nullptr)
DeclarationName getLookupName() const
Gets the name to look up.
Show just the "best" overload candidates.
Represents an ambiguous user-defined conversion sequence.
ExprValueKind
The categorization of expression values, currently following the C++11 scheme.
Expr * stripARCUnbridgedCast(Expr *e)
ExprResult BuildPossibleImplicitMemberExpr(const CXXScopeSpec &SS, SourceLocation TemplateKWLoc, LookupResult &R, const TemplateArgumentListInfo *TemplateArgs)
Builds an expression which might be an implicit member expression.
Qualifiers getQualifiers() const
Retrieve all qualifiers.
unsigned getNumArgs() const
bool isAnyComplexType() const
bool isDeletedAsWritten() const
void takeSFINAEDiagnostic(PartialDiagnosticAt &PD)
Take ownership of the SFINAE diagnostic.
bool isBeforeInTranslationUnit(SourceLocation LHS, SourceLocation RHS) const
Determines the order of 2 source locations in the translation unit.
When performing template argument deduction for a function template, there were too many call argumen...
NestedNameSpecifierLoc getQualifierLoc() const
Fetches the nested-name qualifier with source-location information, if one was given.
bool isObjCClassType() const
decls_iterator decls_end() const
bool CollectMultipleMethodsInGlobalPool(Selector Sel, SmallVectorImpl< ObjCMethodDecl * > &Methods, bool instance)
Returns instance or factory methods in global method pool for given selector. If no such method or on...
Declaration of a template type parameter.
SourceLocation getNameLoc() const
Gets the location of the name.
static FindResult find(Expr *E)
Finds the overloaded expression in the given expression E of OverloadTy.
StandardConversionSequence After
SourceLocation getNameLoc() const
bool Encloses(const DeclContext *DC) const
Determine whether this declaration context encloses the declaration context DC.
SourceLocation getMemberLoc() const
static bool isFirstArgumentCompatibleWithType(ASTContext &Context, CXXConstructorDecl *Constructor, QualType Type)
void setTypeDependent(bool TD)
Set whether this expression is type-dependent or not.
SmallVectorImpl< OverloadCandidate >::iterator iterator
void copyFrom(const AmbiguousConversionSequence &)
static bool IsStandardConversion(Sema &S, Expr *From, QualType ToType, bool InOverloadResolution, StandardConversionSequence &SCS, bool CStyle, bool AllowObjCWritebackConversion)
ArgKind getKind() const
Return the kind of stored template argument.
const ParmVarDecl * getParamDecl(unsigned i) const
static Qualifiers CollectVRQualifiers(ASTContext &Context, Expr *ArgExpr)
bool isInitListConstructor(const CXXConstructorDecl *Ctor)
Determine whether Ctor is an initializer-list constructor, as defined in [dcl.init.list]p2.
CXXConstructorDecl * CopyConstructor
void addConversion(FunctionDecl *D)
DeclContext * getDeclContext()
Overload resolution succeeded.
static OverloadedOperatorKind getOverloadedOperator(Opcode Opc)
Retrieve the overloaded operator kind that corresponds to the given unary opcode. ...
static bool IsOverloaded(const UnresolvedSetImpl &Functions)
When performing template argument deduction for a function template, there were too few call argument...
unsigned ReferenceBinding
ExprResult CheckPlaceholderExpr(Expr *E)
QualType getFromType() const
Classification Classify(ASTContext &Ctx) const
Classify - Classify this expression according to the C++11 expression taxonomy.
Represents a C++ template name within the type system.
bool RequireCompleteType(SourceLocation Loc, QualType T, TypeDiagnoser &Diagnoser)
Ensure that the type T is a complete type.
bool isObjCIdType() const
virtual SemaDiagnosticBuilder diagnoseAmbiguous(Sema &S, SourceLocation Loc, QualType T)=0
Emits a diagnostic when there are multiple possible conversion functions.
Floating-integral conversions (C++ 4.9)
ExprResult BuildTemplateIdExpr(const CXXScopeSpec &SS, SourceLocation TemplateKWLoc, LookupResult &R, bool RequiresADL, const TemplateArgumentListInfo *TemplateArgs)
FunctionDecl * ResolveSingleFunctionTemplateSpecialization(OverloadExpr *ovl, bool Complain=false, DeclAccessPair *Found=nullptr)
Given an expression that refers to an overloaded function, try to resolve that overloaded function ex...
bool isSameOrCompatibleFunctionType(CanQualType Param, CanQualType Arg)
Compare types for equality with respect to possibly compatible function types (noreturn adjustment...
CanQualType UnsignedInt128Ty
Specifies that a value-dependent expression of integral or dependent type should be considered a null...
bool TryToFixBadConversion(unsigned Idx, Sema &S)
QualType getFromType() const
static void collectViableConversionCandidates(Sema &SemaRef, Expr *From, QualType ToType, UnresolvedSetImpl &ViableConversions, OverloadCandidateSet &CandidateSet)
CXXConversionDecl * Surrogate
void NoteDeductionFailure(Sema &S)
Diagnose a template argument deduction failure.
bool isScoped() const
Returns true if this is a C++11 scoped enumeration.
void NoteCandidates(Sema &S, OverloadCandidateDisplayKind OCD, ArrayRef< Expr * > Args, StringRef Opc="", SourceLocation Loc=SourceLocation())
static bool TooManyArguments(size_t NumParams, size_t NumArgs, bool PartialOverloading=false)
To be used for checking whether the arguments being passed to function exceeds the number of paramete...
bool isDependentType() const
StandardConversionSequence Standard
llvm::SmallPtrSet< CXXRecordDecl *, 16 > AssociatedClassSet
bool IsDerivedFrom(QualType Derived, QualType Base)
Determine whether the type Derived is a C++ class that is derived from the type Base.
DeclContext * getParent()
getParent - Returns the containing DeclContext.
bool isAtLeastAsQualifiedAs(CanQual< T > Other) const
Determines whether this canonical type is at least as qualified as the Other canonical type...
void AddFunctionCandidates(const UnresolvedSetImpl &Functions, ArrayRef< Expr * > Args, OverloadCandidateSet &CandidateSet, TemplateArgumentListInfo *ExplicitTemplateArgs=nullptr, bool SuppressUserConversions=false, bool PartialOverloading=false)
Add all of the function declarations in the given function set to the overload candidate set...
QualType getObjCIdType() const
Represents the Objective-CC id type.
void AddTemplateOverloadCandidate(FunctionTemplateDecl *FunctionTemplate, DeclAccessPair FoundDecl, TemplateArgumentListInfo *ExplicitTemplateArgs, ArrayRef< Expr * > Args, OverloadCandidateSet &CandidateSet, bool SuppressUserConversions=false, bool PartialOverloading=false)
Add a C++ function template specialization as a candidate in the candidate set, using template argume...
virtual SemaDiagnosticBuilder noteExplicitConv(Sema &S, CXXConversionDecl *Conv, QualType ConvTy)=0
Emits a note for the explicit conversion function.
SmallVector< ActiveTemplateInstantiation, 16 > ActiveTemplateInstantiations
List of active template instantiations.
bool DeduceReturnType(FunctionDecl *FD, SourceLocation Loc, bool Diagnose=true)
DeclarationName getDeclName() const
DiagnosticsEngine & getDiagnostics() const
static bool CheckArityMismatch(Sema &S, OverloadCandidate *Cand, unsigned NumArgs)
Represents a C++ conversion function within a class.
QualType getCVRQualifiedType(QualType T, unsigned CVR) const
Return a type with additional const, volatile, or restrict qualifiers.
The result type of a method or function.
ExprResult DefaultFunctionArrayLvalueConversion(Expr *E)
bool isExplicit() const
Whether this is an explicit conversion operator (C++11 and later).
bool isObjectType() const
Determine whether this type is an object type.
Lvalue-to-rvalue conversion (C++ 4.1)
decls_iterator decls_begin() const
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 ...
ArrayRef< ParmVarDecl * > parameters() const
static ImplicitConversionSequence::CompareKind CompareStandardConversionSequences(Sema &S, const StandardConversionSequence &SCS1, const StandardConversionSequence &SCS2)
unsigned ObjCLifetimeConversionBinding
Whether this binds a reference to an object with a different Objective-C lifetime qualifier...
static bool isNullPointerConstantForConversion(Expr *Expr, bool InOverloadResolution, ASTContext &Context)
unsigned NumConversions
NumConversions - The number of elements in the Conversions array.
bool isIdentityConversion() const
QualType getFromType() const
static std::unique_ptr< CorrectionCandidateCallback > MakeValidator(Sema &SemaRef, MemberExpr *ME, size_t NumArgs, bool HasTemplateArgs, bool AllowTypoCorrection)
Integral conversions (C++ 4.7)
Complex promotions (Clang extension)
ExprResult MaybeBindToTemporary(Expr *E)
A reference to an overloaded function set, either an UnresolvedLookupExpr or an UnresolvedMemberExpr...
bool isIntegralOrEnumerationType() const
Determine whether this type is an integral or enumeration type.
bool isInitialized() const
bool isVolatileQualified() const
OverloadCandidate - A single candidate in an overload set (C++ 13.3).
FunctionDecl * getAsFunction() LLVM_READONLY
Returns the function itself, or the templated function if this is a function template.
Encodes a location in the source. The SourceManager can decode this to get at the full include stack...
unsigned getNumParams() const
FunctionTemplateDecl * getDescribedFunctionTemplate() const
Retrieves the function template that is described by this function declaration.
void NoteAllOverloadCandidates(Expr *E, QualType DestType=QualType())
const Type * getTypePtr() const
TemplateName getAsTemplate() const
Retrieve the template name for a template name argument.
void FindAssociatedClassesAndNamespaces(SourceLocation InstantiationLoc, ArrayRef< Expr * > Args, AssociatedNamespaceSet &AssociatedNamespaces, AssociatedClassSet &AssociatedClasses)
Find the associated classes and namespaces for argument-dependent lookup for a call with the given se...
QualType getElementType() const
virtual SemaDiagnosticBuilder noteAmbiguous(Sema &S, CXXConversionDecl *Conv, QualType ConvTy)=0
Emits a note for one of the candidate conversions.
bool IsNoReturnConversion(QualType FromType, QualType ToType, QualType &ResultTy)
Determine whether the conversion from FromType to ToType is a valid conversion that strips "noreturn"...
bool isValid() const
Return true if this is a valid SourceLocation object.
OverloadedOperatorKind getCXXOverloadedOperator() const
CUDAFunctionTarget IdentifyCUDATarget(const FunctionDecl *D)
IdentifyCUDATarget - Determine the CUDA compilation target for this function.
A call to a literal operator (C++11 [over.literal]) written as a user-defined literal (C++11 [lit...
Template argument deduction failed due to inconsistent cv-qualifiers on a template parameter type tha...
ASTContext & getASTContext() const
A vector splat from an arithmetic type.
llvm::APSInt EvaluateKnownConstInt(const ASTContext &Ctx, SmallVectorImpl< PartialDiagnosticAt > *Diag=nullptr) const
static ImplicitConversionSequence::CompareKind compareConversionFunctions(Sema &S, FunctionDecl *Function1, FunctionDecl *Function2)
Compare the user-defined conversion functions or constructors of two user-defined conversion sequence...
Represents a static or instance method of a struct/union/class.
bool isObjCBuiltinType() const
void AddTemplateConversionCandidate(FunctionTemplateDecl *FunctionTemplate, DeclAccessPair FoundDecl, CXXRecordDecl *ActingContext, Expr *From, QualType ToType, OverloadCandidateSet &CandidateSet, bool AllowObjCConversionOnExplicit)
Adds a conversion function template specialization candidate to the overload set, using template argu...
void AddBuiltinCandidate(QualType ResultTy, QualType *ParamTys, ArrayRef< Expr * > Args, OverloadCandidateSet &CandidateSet, bool IsAssignmentOperator=false, unsigned NumContextualBoolArguments=0)
ExprResult DefaultLvalueConversion(Expr *E)
Represents a C++ nested name specifier, such as "\::std::vector<int>::".
No ref-qualifier was provided.
Objective-C ARC writeback conversion.
bool DiagnoseMultipleUserDefinedConversion(Expr *From, QualType ToType)
ExprResult BuildMemberReferenceExpr(Expr *Base, QualType BaseType, SourceLocation OpLoc, bool IsArrow, CXXScopeSpec &SS, SourceLocation TemplateKWLoc, NamedDecl *FirstQualifierInScope, const DeclarationNameInfo &NameInfo, const TemplateArgumentListInfo *TemplateArgs, ActOnMemberAccessExtraArgs *ExtraArgs=nullptr)
Expr * Expression
The expression which caused a deduction failure.
The declaration was invalid; do nothing.
static bool IsVectorConversion(Sema &S, QualType FromType, QualType ToType, ImplicitConversionKind &ICK)
Determine whether the conversion from FromType to ToType is a valid vector conversion.
bool isIntegerConstantExpr(llvm::APSInt &Result, const ASTContext &Ctx, SourceLocation *Loc=nullptr, bool isEvaluated=true) const
static bool checkArgPlaceholdersForOverload(Sema &S, MultiExprArg Args, UnbridgedCastsSet &unbridged)
Specifies that a value-dependent expression should be considered to never be a null pointer constant...
void addDecl(NamedDecl *D)
TemplateDeductionResult DeduceTemplateArguments(ClassTemplatePartialSpecializationDecl *Partial, const TemplateArgumentList &TemplateArgs, sema::TemplateDeductionInfo &Info)
Perform template argument deduction to determine whether the given template arguments match the given...
bool isStdInitializerListElement() const
Whether the target is really a std::initializer_list, and the sequence only represents the worst elem...
bool CheckMemberPointerConversion(Expr *From, QualType ToType, CastKind &Kind, CXXCastPath &BasePath, bool IgnoreBaseAccess)
void setAsIdentityConversion()
Pointer conversions (C++ 4.10)
std::pair< SourceLocation, PartialDiagnostic > PartialDiagnosticAt
A partial diagnostic along with the source location where this diagnostic occurs. ...
bool canBindObjCObjectType(QualType To, QualType From)
CandidateSetKind getKind() const
QualType getToType(unsigned Idx) const
SourceLocation getBegin() const
llvm::SmallPtrSet< DeclContext *, 16 > AssociatedNamespaceSet
bool isTypeDependent() const
bool isArrow() const
Determine whether this member expression used the '->' operator; otherwise, it used the '...
bool isVectorType() const
unsigned HasDiagnostic
Indicates whether a diagnostic is stored in Diagnostic.
bool IsBuildingRecoveryCallExpr
Flag indicating if Sema is building a recovery call expression.
bool isPromotableIntegerType() const
More type predicates useful for type checking/promotion.
virtual bool match(QualType T)=0
Determine whether the specified type is a valid destination type for this conversion.
Derived-to-base (C++ [over.best.ics])
DeductionFailureInfo MakeDeductionFailureInfo(ASTContext &Context, Sema::TemplateDeductionResult TDK, sema::TemplateDeductionInfo &Info)
Convert from Sema's representation of template deduction information to the form used in overload-can...
Complex-real conversions (C99 6.3.1.7)
An rvalue ref-qualifier was provided (&&).
Assigning into this object requires a lifetime extension.
SourceLocation getLocStart() const LLVM_READONLY
bool isVolatileQualified() const
Determine whether this type is volatile-qualified.
void setBad(BadConversionSequence::FailureKind Failure, Expr *FromExpr, QualType ToType)
Sets this sequence as a bad conversion for an explicit argument.
MutableArrayRef< Expr * > MultiExprArg
ExprResult BuildCallToObjectOfClassType(Scope *S, Expr *Object, SourceLocation LParenLoc, MultiExprArg Args, SourceLocation RParenLoc)
static MemberExpr * Create(const ASTContext &C, Expr *base, bool isarrow, SourceLocation OperatorLoc, NestedNameSpecifierLoc QualifierLoc, SourceLocation TemplateKWLoc, ValueDecl *memberdecl, DeclAccessPair founddecl, DeclarationNameInfo MemberNameInfo, const TemplateArgumentListInfo *targs, QualType ty, ExprValueKind VK, ExprObjectKind OK)
SourceLocation getExprLoc() const LLVM_READONLY
QualType getPointeeType() const
CXXSpecialMember getSpecialMember(const CXXMethodDecl *MD)
getSpecialMember - get the special member enum for a method.
FunctionTemplateDecl * getMoreSpecializedTemplate(FunctionTemplateDecl *FT1, FunctionTemplateDecl *FT2, SourceLocation Loc, TemplatePartialOrderingContext TPOC, unsigned NumCallArguments1, unsigned NumCallArguments2)
Returns the more specialized function template according to the rules of function template partial or...
ExprResult BuildOverloadedArrowExpr(Scope *S, Expr *Base, SourceLocation OpLoc, bool *NoArrowOperatorFound=nullptr)
ExprResult BuildCXXMemberCallExpr(Expr *Exp, NamedDecl *FoundDecl, CXXConversionDecl *Method, bool HadMultipleCandidates)
ImplicitConversionRank GetConversionRank(ImplicitConversionKind Kind)
A class for storing results from argument-dependent lookup.
CanQualType UnsignedShortTy
bool CheckPointerConversion(Expr *From, QualType ToType, CastKind &Kind, CXXCastPath &BasePath, bool IgnoreBaseAccess)
void MarkMemberReferenced(MemberExpr *E)
Perform reference-marking and odr-use handling for a MemberExpr.
static const Expr * IgnoreNarrowingConversion(const Expr *Converted)
const TemplateArgument * getFirstArg()
Return the first template argument this deduction failure refers to, if any.
Represents a template argument.
ExprResult PerformCopyInitialization(const InitializedEntity &Entity, SourceLocation EqualLoc, ExprResult Init, bool TopLevelOfInitList=false, bool AllowExplicit=false)
void DiagnoseAmbiguousConversion(Sema &S, SourceLocation CaretLoc, const PartialDiagnostic &PDiag) const
QualType getMemberPointerType(QualType T, const Type *Cls) const
Return the uniqued reference to the type for a member pointer to the specified type in the specified ...
QualType getAsType() const
Retrieve the type for a type template argument.
DeclContextLookupResult LookupConstructors(CXXRecordDecl *Class)
Look up the constructors for the given class.
FunctionTemplateDecl * getPrimaryTemplate() const
Retrieve the primary template that this function template specialization either specializes or was in...
llvm::PointerUnion3< TemplateTypeParmDecl *, NonTypeTemplateParmDecl *, TemplateTemplateParmDecl * > TemplateParameter
Stores a template parameter of any kind.
static ExprResult diagnoseAmbiguousConversion(Sema &SemaRef, SourceLocation Loc, Expr *From, Sema::ContextualImplicitConverter &Converter, QualType T, UnresolvedSetImpl &ViableConversions)
Abstract base class used to perform a contextual implicit conversion from an expression to any type p...
StringRef getOpcodeStr() const
A qualifier set is used to build a set of qualifiers.
Qualifiers withoutObjCLifetime() const
bool isAggregateType() const
Determines whether the type is a C++ aggregate type or C aggregate or union type. ...
EvalResult is a struct with detailed info about an evaluated expression.
static ImplicitConversionSequence TryImplicitConversion(Sema &S, Expr *From, QualType ToType, bool SuppressUserConversions, bool AllowExplicit, bool InOverloadResolution, bool CStyle, bool AllowObjCWritebackConversion, bool AllowObjCConversionOnExplicit)
The base class of all kinds of template declarations (e.g., class, function, etc.).
Sema::LookupNameKind getLookupKind() const
Gets the kind of lookup to perform.
bool IsFloatingPointPromotion(QualType FromType, QualType ToType)
OverloadedOperatorKind
Enumeration specifying the different kinds of C++ overloaded operators.
const internal::VariadicAllOfMatcher< Type > type
Matches Types in the clang AST.
ExprResult ImpCastExprToType(Expr *E, QualType Type, CastKind CK, ExprValueKind VK=VK_RValue, const CXXCastPath *BasePath=nullptr, CheckedConversionKind CCK=CCK_ImplicitConversion)
ConversionSet::const_iterator const_iterator
static bool hasSimilarType(ASTContext &Context, QualType T1, QualType T2)
bool isInvalidDecl() const
virtual SemaDiagnosticBuilder diagnoseNoMatch(Sema &S, SourceLocation Loc, QualType T)=0
Emits a diagnostic complaining that the expression does not have integral or enumeration type...
void HandleFunctionTypeMismatch(PartialDiagnostic &PDiag, QualType FromType, QualType ToType)
SourceLocation getLocStart() const LLVM_READONLY
CanQualType UnsignedLongLongTy
static void DiagnoseArityMismatch(Sema &S, Decl *D, unsigned NumFormalArgs)
General arity mismatch diagnosis over a candidate in a candidate set.
static bool checkPlaceholderForOverload(Sema &S, Expr *&E, UnbridgedCastsSet *unbridgedCasts=nullptr)
Array-to-pointer conversion (C++ 4.2)
void setConversionChecker(TypeComparisonFuncTy Foo)
Resets the default conversion checker method.
A non-depnedent component of the parameter did not match the corresponding component of the argument...
const ObjCInterfaceType * getInterfaceType() const
PartialDiagnosticAt * getSFINAEDiagnostic()
Retrieve the diagnostic which caused this deduction failure, if any.
QualType getPointerType(QualType T) const
Return the uniqued reference to the type for a pointer to the specified type.
bool hasSFINAEDiagnostic() const
Is a SFINAE diagnostic available?
bool IsBlockPointerConversion(QualType FromType, QualType ToType, QualType &ConvertedType)
StandardConversionSequence Before
Represents the standard conversion that occurs before the actual user-defined conversion.
const Type * strip(QualType type)
QualType getObjCObjectPointerType(QualType OIT) const
Return a ObjCObjectPointerType type for the given ObjCObjectType.
OverloadExpr * Expression
static QualType AdoptQualifiers(ASTContext &Context, QualType T, Qualifiers Qs)
Adopt the given qualifiers for the given type.
Expression is a Null pointer constant built from a zero integer expression that is not a simple...
param_type_iterator param_type_end() const
A set of unresolved declarations.
std::string getAsString(ASTContext &Ctx, QualType Ty) const
SourceLocation getLocStart() const LLVM_READONLY
Requests that only viable candidates be shown.
bool IsMemberPointerConversion(Expr *From, QualType FromType, QualType ToType, bool InOverloadResolution, QualType &ConvertedType)
static void dropPointerConversion(StandardConversionSequence &SCS)
const FunctionType * adjustFunctionType(const FunctionType *Fn, FunctionType::ExtInfo EInfo)
Change the ExtInfo on a function type.
CanQualType getCanonicalType(QualType T) const
Return the canonical (structural) type corresponding to the specified potentially non-canonical type ...
bool isLValueReferenceType() const
ExprResult DefaultFunctionArrayConversion(Expr *E)
DefaultFunctionArrayConversion (C99 6.3.2.1p3, C99 6.3.2.1p4).
unsigned getNumParams() const
bool isLambda() const
Determine whether this class describes a lambda function object.
void * Data
Opaque pointer containing additional data about this deduction failure.
bool isPointerConversionToBool() const
static void DiagnoseBadConversion(Sema &S, OverloadCandidate *Cand, unsigned I)
Defines the Diagnostic-related interfaces.
bool isRValueReferenceType() const
static void NoteSurrogateCandidate(Sema &S, OverloadCandidate *Cand)
QualType getPointeeType() const
QualType getNonReferenceType() const
FunctionDecl * ConversionFunction
SourceLocation getMemberLoc() const
bool empty() const
Return true if no decls were found.
Not an overloaded operator.
QualType getLocalUnqualifiedType() const
Return this type with all of the instance-specific qualifiers removed, but without removing any quali...
ExprResult CreateOverloadedArraySubscriptExpr(SourceLocation LLoc, SourceLocation RLoc, Expr *Base, Expr *Idx)
void setHadMultipleCandidates(bool V=true)
Sets the flag telling whether this expression refers to a method that was resolved from an overloaded...
bool IsPointerConversion(Expr *From, QualType FromType, QualType ToType, bool InOverloadResolution, QualType &ConvertedType, bool &IncompatibleObjC)
void setAllToTypes(QualType T)
QualType getPointerDiffType() const
Return the unique type for "ptrdiff_t" (C99 7.17) defined in <stddef.h>. Pointer - pointer requires t...
ExprResult BuildLiteralOperatorCall(LookupResult &R, DeclarationNameInfo &SuffixInfo, ArrayRef< Expr * > Args, SourceLocation LitEndLoc, TemplateArgumentListInfo *ExplicitTemplateArgs=nullptr)
PrintingPolicy getPrintingPolicy() const
Retrieve a suitable printing policy.
static ImplicitConversionSequence TryObjectArgumentInitialization(Sema &S, QualType FromType, Expr::Classification FromClassification, CXXMethodDecl *Method, CXXRecordDecl *ActingContext)
bool ConvertArgumentsForCall(CallExpr *Call, Expr *Fn, FunctionDecl *FDecl, const FunctionProtoType *Proto, ArrayRef< Expr * > Args, SourceLocation RParenLoc, bool ExecConfig=false)
unsigned getTypeQuals() const
QualType getCanonicalType() const
TemplateArgumentList * take()
Take ownership of the deduced template argument list.
CanQualType UnsignedLongTy
unsigned getKindRank() const
Return a ranking of the implicit conversion sequence kind, where smaller ranks represent better conve...
bool areCompatibleVectorTypes(QualType FirstVec, QualType SecondVec)
Return true if the given vector types are of the same unqualified type or if they are equivalent to t...
unsigned BindsImplicitObjectArgumentWithoutRefQualifier
Whether this binds an implicit object argument to a non-static member function without a ref-qualifie...
unsigned char FailureKind
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 an value reference-compatible with DeclType. Return true if something definite is found.
bool isObjCQualifiedIdType() const
bool isFunctionType() const
bool isImplicitlyDeleted(FunctionDecl *FD)
Determine whether the given function is an implicitly-deleted special member function.
CanQualType BoundMemberTy
const DeclarationNameLoc & getInfo() const
ForRangeStatus BuildForRangeBeginEndCall(Scope *S, SourceLocation Loc, SourceLocation RangeLoc, VarDecl *Decl, BeginEndFunction BEF, const DeclarationNameInfo &NameInfo, LookupResult &MemberLookup, OverloadCandidateSet *CandidateSet, Expr *Range, ExprResult *CallExpr)
CXXRecordDecl * getAsCXXRecordDecl() const
Retrieves the CXXRecordDecl that this type refers to, either because the type is a RecordType or beca...
AccessResult CheckMemberOperatorAccess(SourceLocation Loc, Expr *ObjectExpr, Expr *ArgExpr, DeclAccessPair FoundDecl)
unsigned getAddressSpace() const
FriendObjectKind getFriendObjectKind() const
Determines whether this declaration is the object of a friend declaration and, if so...
ExprResult CreateBuiltinUnaryOp(SourceLocation OpLoc, UnaryOperatorKind Opc, Expr *InputExpr)
bool isRestrictQualified() const
Determine whether this type is restrict-qualified.
Block Pointer conversions.
Deduction failed; that's all we know.
static FixItHint CreateInsertion(SourceLocation InsertionLoc, StringRef Code, bool BeforePreviousInsertions=false)
Create a code modification hint that inserts the given code string at a specific location.
bool canAssignObjCInterfaces(const ObjCObjectPointerType *LHSOPT, const ObjCObjectPointerType *RHSOPT)
ExprResult BuildOverloadedCallExpr(Scope *S, Expr *Fn, UnresolvedLookupExpr *ULE, SourceLocation LParenLoc, MultiExprArg Args, SourceLocation RParenLoc, Expr *ExecConfig, bool AllowTypoCorrection=true)
Implements a partial diagnostic that can be emitted anwyhere in a DiagnosticBuilder stream...
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.
const CXXConstructorDecl * getInheritedConstructor() const
Get the constructor that this inheriting constructor is based on.
static bool isNonTrivialObjCLifetimeConversion(Qualifiers FromQuals, Qualifiers ToQuals)
void DiagnoseSentinelCalls(NamedDecl *D, SourceLocation Loc, ArrayRef< Expr * > Args)
QualType getPointeeType() const
std::string getQualifiedNameAsString() const
bool LookupQualifiedName(LookupResult &R, DeclContext *LookupCtx, bool InUnqualifiedLookup=false)
Perform qualified name lookup into a given context.
TemplateArgumentList * getTemplateArgumentList()
Retrieve the template argument list associated with this deduction failure, if any.
ConversionFixItGenerator Fix
The FixIt hints which can be used to fix the Bad candidate.
AmbiguousConversionSequence Ambiguous
void setHadMultipleCandidates(bool V=true)
Sets the flag telling whether this expression refers to a function that was resolved from an overload...
A template argument list.
const Type * getClass() const
Reading or writing from this object requires a barrier call.
CCEKind
Contexts in which a converted constant expression is required.
ExprResult DefaultVariadicArgumentPromotion(Expr *E, VariadicCallType CT, FunctionDecl *FDecl)
bool typesAreCompatible(QualType T1, QualType T2, bool CompareUnqualified=false)
Compatibility predicates used to check assignment expressions.
bool FunctionParamTypesAreEqual(const FunctionProtoType *OldType, const FunctionProtoType *NewType, unsigned *ArgPos=nullptr)
Function-to-pointer (C++ 4.3)
bool isObjCClassType() const
void AddOverloadCandidate(FunctionDecl *Function, DeclAccessPair FoundDecl, ArrayRef< Expr * > Args, OverloadCandidateSet &CandidateSet, bool SuppressUserConversions=false, bool PartialOverloading=false, bool AllowExplicit=false)
QualType getUnqualifiedType() const
Retrieve the unqualified variant of the given type, removing as little sugar as possible.
Represents a C++ struct/union/class.
static ImplicitConversionSequence TryReferenceInit(Sema &S, Expr *Init, QualType DeclType, SourceLocation DeclLoc, bool SuppressUserConversions, bool AllowExplicit)
Compute an implicit conversion sequence for reference initialization.
TargetCXXABI getCXXABI() const
Get the C++ ABI currently in use.
bool isObjCObjectPointerType() const
Optional< sema::TemplateDeductionInfo * > isSFINAEContext() const
Determines whether we are currently in a context where template argument substitution failures are no...
OverloadsShown
Specifies which overload candidates to display when overload resolution fails.
OverloadsShown getShowOverloads() const
bool isLaxVectorConversion(QualType srcType, QualType destType)
Is this a legal conversion between two known vector types?
void AddSurrogateCandidate(CXXConversionDecl *Conversion, DeclAccessPair FoundDecl, CXXRecordDecl *ActingContext, const FunctionProtoType *Proto, Expr *Object, ArrayRef< Expr * > Args, OverloadCandidateSet &CandidateSet)
AccessResult CheckUnresolvedLookupAccess(UnresolvedLookupExpr *E, DeclAccessPair FoundDecl)
DeclContext * CurContext
CurContext - This is the current declaration context of parsing.
TemplateArgument SecondArg
The second template argument to which the template argument deduction failure refers.
Partial ordering of function templates for a function call.
static FixItHint CreateReplacement(CharSourceRange RemoveRange, StringRef Code)
Create a code modification hint that replaces the given source range with the given code string...
TemplateParameterList * getTemplateParameters() const
Get the list of template parameters.
void NoteOverloadCandidate(FunctionDecl *Fn, QualType DestType=QualType())
void copyInto(TemplateArgumentListInfo &List) const
static void DiagnoseBadTarget(Sema &S, OverloadCandidate *Cand)
CUDA: diagnose an invalid call across targets.
static bool DiagnoseTwoPhaseLookup(Sema &SemaRef, SourceLocation FnLoc, const CXXScopeSpec &SS, LookupResult &R, OverloadCandidateSet::CandidateSetKind CSK, TemplateArgumentListInfo *ExplicitTemplateArgs, ArrayRef< Expr * > Args, bool *DoDiagnoseEmptyLookup=nullptr)
OverloadingResult BestViableFunction(Sema &S, SourceLocation Loc, OverloadCandidateSet::iterator &Best, bool UserDefinedConversion=false)
Find the best viable function on this overload set, if it exists.
static bool canBeDeclaredInNamespace(const DeclarationName &Name)
Defines the clang::TargetInfo interface.
static ImplicitConversionSequence::CompareKind CompareImplicitConversionSequences(Sema &S, const ImplicitConversionSequence &ICS1, const ImplicitConversionSequence &ICS2)
DeclarationName getName() const
Gets the name looked up.
bool isUserDefined() const
static Qualifiers fromCVRMask(unsigned CVR)
ExprResult PerformObjectMemberConversion(Expr *From, NestedNameSpecifier *Qualifier, NamedDecl *FoundDecl, NamedDecl *Member)
Cast a base object to a member's actual type.
ExprResult CheckConvertedConstantExpression(Expr *From, QualType T, llvm::APSInt &Value, CCEKind CCE)
bool IsQualificationConversion(QualType FromType, QualType ToType, bool CStyle, bool &ObjCLifetimeConversion)
void DiagnoseSelfMove(const Expr *LHSExpr, const Expr *RHSExpr, SourceLocation OpLoc)
Warn if a value is moved to itself.
A reference to a declared variable, function, enum, etc. [C99 6.5.1p2].
ExprValueKind getValueKind() const
getValueKind - The value kind that this expression produces.
Represents a type template specialization; the template must be a class template, a type alias templa...
void AddOverloadedCallCandidates(UnresolvedLookupExpr *ULE, ArrayRef< Expr * > Args, OverloadCandidateSet &CandidateSet, bool PartialOverloading=false)
Add the overload candidates named by callee and/or found by argument dependent lookup to the given ov...
The current expression and its subexpressions occur within an unevaluated operand (C++11 [expr]p7)...
QualType getElementType() const
bool hasQualifiers() const
Determine whether this type has any qualifiers.
Zero constant to event (OpenCL1.2 6.12.10)
SourceManager & SourceMgr
static OverloadedOperatorKind getOverloadedOperator(Opcode Opc)
Retrieve the overloaded operator kind that corresponds to the given binary opcode.
void clear()
Clear out all of the candidates.
ImplicitConversionKind First
static ImplicitConversionSequence TryCopyInitialization(Sema &S, Expr *From, QualType ToType, bool SuppressUserConversions, bool InOverloadResolution, bool AllowObjCWritebackConversion, bool AllowExplicit=false)
const Expr * getInit(unsigned Init) const
struct clang::OverloadCandidate::@202 BuiltinTypes
No viable function found.
void NoteCandidates(Sema &S, SourceLocation Loc)
TemplateArgument FirstArg
The first template argument to which the template argument deduction failure refers.
DeductionFailureInfo DeductionFailure
void suppressDiagnostics()
static bool recordConversion(Sema &SemaRef, SourceLocation Loc, Expr *&From, Sema::ContextualImplicitConverter &Converter, QualType T, bool HadMultipleCandidates, DeclAccessPair &Found)
AccessResult CheckAddressOfMemberAccess(Expr *OvlExpr, DeclAccessPair FoundDecl)
An l-value expression is a reference to an object with independent storage.
const llvm::fltSemantics & getFloatTypeSemantics(QualType T) const
Return the APFloat 'semantics' for the specified scalar floating point type.
A trivial tuple used to represent a source range.
SourceLocation getLocation() const
static StringRef getOpcodeStr(Opcode Op)
FunctionDecl * getCanonicalDecl() override
Retrieves the "canonical" declaration of the given declaration.
NestedNameSpecifier * getQualifier() const
Fetches the nested-name qualifier, if one was given.
bool ResolveAndFixSingleFunctionTemplateSpecialization(ExprResult &SrcExpr, bool DoFunctionPointerConverion=false, bool Complain=false, const SourceRange &OpRangeForComplaining=SourceRange(), QualType DestTypeForComplaining=QualType(), unsigned DiagIDForComplaining=0)
bool CheckCallReturnType(QualType ReturnType, SourceLocation Loc, CallExpr *CE, FunctionDecl *FD)
bool isArithmeticType() const
bool CheckCXXThisCapture(SourceLocation Loc, bool Explicit=false, bool BuildAndDiagnose=true, const unsigned *const FunctionScopeIndexToStopAt=nullptr)
Make sure the value of 'this' is actually available in the current context, if it is a potentially ev...
void AddMethodCandidate(DeclAccessPair FoundDecl, QualType ObjectType, Expr::Classification ObjectClassification, ArrayRef< Expr * > Args, OverloadCandidateSet &CandidateSet, bool SuppressUserConversion=false)
bool isSignedIntegerType() const
bool isConstQualified() const
Determine whether this type is const-qualified.
Pointer-to-member conversions (C++ 4.11)
bool EvaluateAsLValue(EvalResult &Result, const ASTContext &Ctx) const
bool isNull() const
isNull - Return true if this QualType doesn't point to a type yet.
Describes an entity that is being initialized.
static InitializedEntity InitializeParameter(ASTContext &Context, ParmVarDecl *Parm)
Create the initialization entity for a parameter.
void setToType(unsigned Idx, QualType T)
bool isObjCIdType() const
NamespaceDecl * getStdNamespace() const
char Diagnostic[sizeof(PartialDiagnosticAt)]
void removeAddressSpace()
bool isPointerConversionToVoidPointer(ASTContext &Context) const
The explicitly-specified template arguments were not valid template arguments for the given template...
bool isIntegralType(ASTContext &Ctx) const
Determine whether this type is an integral type.
Declaration of a template function.
void clear()
Clears out any current state.
static QualType BuildSimilarlyQualifiedPointerType(const Type *FromPtr, QualType ToPointee, QualType ToType, ASTContext &Context, bool StripObjCLifetime=false)
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.
QualType getUnqualifiedArrayType(QualType T, Qualifiers &Quals)
Return this type as a completely-unqualified array type, capturing the qualifiers in Quals...
Attr - This represents one attribute.
A single template declaration.
bool isIntegerType() const
SourceLocation getLocation() const
Expr * IgnoreParens() LLVM_READONLY
CanQualType UnsignedIntTy
DeclAccessPair getFoundDecl() const
Retrieves the declaration found by lookup.
void Profile(llvm::FoldingSetNodeID &ID) const
Qualifiers getQualifiers() const
Retrieve the set of qualifiers applied to this type.
bool isPointerType() const
unsigned NumConversionsFixed
bool isIncompleteOrObjectType() const
SourceLocation getLocStart() const LLVM_READONLY
static void DiagnoseFailedEnableIfAttr(Sema &S, OverloadCandidate *Cand)