25 #include "llvm/ADT/SmallBitVector.h"
63 using namespace clang;
68 if (Y.getBitWidth() > X.getBitWidth())
69 X = X.extend(Y.getBitWidth());
70 else if (Y.getBitWidth() < X.getBitWidth())
71 Y = Y.extend(X.getBitWidth());
74 if (X.isSigned() != Y.isSigned()) {
76 if ((Y.isSigned() && Y.isNegative()) || (X.isSigned() && X.isNegative()))
91 TemplateDeductionInfo &Info,
92 SmallVectorImpl<DeducedTemplateArgument> &Deduced);
99 TemplateDeductionInfo &Info,
100 SmallVectorImpl<DeducedTemplateArgument> &
103 bool PartialOrdering =
false);
110 TemplateDeductionInfo &Info,
111 SmallVectorImpl<DeducedTemplateArgument> &Deduced);
121 E = IC->getSubExpr();
123 dyn_cast<SubstNonTypeTemplateParmExpr>(E))
124 E = Subst->getReplacement();
138 if (
NamedDecl *NX = dyn_cast<NamedDecl>(X))
139 X = NX->getUnderlyingDecl();
140 if (
NamedDecl *NY = dyn_cast<NamedDecl>(Y))
141 Y = NY->getUnderlyingDecl();
162 llvm_unreachable(
"Non-deduced template arguments handled above");
215 llvm::FoldingSetNodeID ID1, ID2;
216 X.
getAsExpr()->Profile(ID1, Context,
true);
217 Y.
getAsExpr()->Profile(ID2, Context,
true);
272 XA != XAEnd; ++XA, ++YA) {
284 llvm_unreachable(
"Invalid TemplateArgument Kind!");
293 bool DeducedFromArrayBound,
294 TemplateDeductionInfo &Info,
295 SmallVectorImpl<DeducedTemplateArgument> &Deduced) {
297 "Cannot deduce non-type template argument with depth > 0");
300 DeducedFromArrayBound);
306 Info.FirstArg = Deduced[NTTP->
getIndex()];
307 Info.SecondArg = NewDeduced;
323 TemplateDeductionInfo &Info,
324 SmallVectorImpl<DeducedTemplateArgument> &Deduced) {
326 "Cannot deduce non-type template argument with depth > 0");
328 "Expression template argument must be type- or value-dependent.");
337 Info.FirstArg = Deduced[NTTP->
getIndex()];
338 Info.SecondArg = NewDeduced;
354 TemplateDeductionInfo &Info,
355 SmallVectorImpl<DeducedTemplateArgument> &Deduced) {
357 "Cannot deduce non-type template argument with depth > 0");
359 D = D ? cast<ValueDecl>(D->getCanonicalDecl()) :
nullptr;
367 Info.FirstArg = Deduced[NTTP->
getIndex()];
368 Info.SecondArg = NewDeduced;
381 TemplateDeductionInfo &Info,
382 SmallVectorImpl<DeducedTemplateArgument> &Deduced) {
391 = dyn_cast<TemplateTemplateParmDecl>(ParamDecl)) {
394 Deduced[TempParam->getIndex()],
396 if (Result.isNull()) {
397 Info.Param = TempParam;
398 Info.FirstArg = Deduced[TempParam->getIndex()];
399 Info.SecondArg = NewDeduced;
403 Deduced[TempParam->getIndex()] = Result;
440 TemplateDeductionInfo &Info,
441 SmallVectorImpl<DeducedTemplateArgument> &Deduced) {
442 assert(Arg.
isCanonical() &&
"Argument type must be canonical");
446 = dyn_cast<TemplateSpecializationType>(Arg)) {
451 SpecArg->getTemplateName(),
461 SpecArg->getArgs(), SpecArg->getNumArgs(),
504 case Type::TypeOfExpr:
506 case Type::DependentName:
508 case Type::UnresolvedUsing:
509 case Type::TemplateTypeParm:
512 case Type::ConstantArray:
513 case Type::IncompleteArray:
514 case Type::VariableArray:
515 case Type::DependentSizedArray:
525 static std::pair<unsigned, unsigned>
528 return std::make_pair(TTP->getDepth(), TTP->getIndex());
531 return std::make_pair(NTTP->getDepth(), NTTP->getIndex());
538 static std::pair<unsigned, unsigned>
542 return std::make_pair(TTP->getDepth(), TTP->getIndex());
581 class PackDeductionScope {
586 :
S(S), TemplateParams(TemplateParams), Deduced(Deduced), Info(Info) {
590 llvm::SmallBitVector SawIndices(TemplateParams->
size());
593 for (
unsigned I = 0, N = Unexpanded.size(); I != N; ++I) {
594 unsigned Depth, Index;
596 if (Depth == 0 && !SawIndices[Index]) {
597 SawIndices[Index] =
true;
602 Pack.
Saved = Deduced[Index];
605 Packs.push_back(Pack);
609 assert(!Packs.empty() &&
"Pack expansion without unexpanded packs?");
611 for (
auto &Pack : Packs) {
622 unsigned NumExplicitArgs;
625 &ExplicitArgs, &NumExplicitArgs);
626 if (PartiallySubstitutedPack &&
628 Pack.New.append(ExplicitArgs, ExplicitArgs + NumExplicitArgs);
633 ~PackDeductionScope() {
634 for (
auto &Pack : Packs)
639 void nextPackElement() {
643 for (
auto &Pack : Packs) {
645 if (!DeducedArg.
isNull()) {
646 Pack.New.push_back(DeducedArg);
658 for (
auto &Pack : Packs) {
660 Deduced[Pack.Index] = Pack.Saved;
664 if (HasAnyArguments && Pack.New.empty()) {
665 if (Pack.DeferredDeduction.isNull()) {
672 NewPack = Pack.DeferredDeduction;
674 }
else if (Pack.New.empty()) {
680 std::copy(Pack.New.begin(), Pack.New.end(), ArgumentPack);
683 Pack.New[0].wasDeducedFromArrayBound());
689 if (Pack.Outer->DeferredDeduction.isNull()) {
692 Pack.Outer->DeferredDeduction = NewPack;
695 Loc = &Pack.Outer->DeferredDeduction;
697 Loc = &Deduced[Pack.Index];
706 if (!Result.
isNull() && !Pack.DeferredDeduction.isNull()) {
708 NewPack = Pack.DeferredDeduction;
769 const QualType *Params,
unsigned NumParams,
770 const QualType *Args,
unsigned NumArgs,
771 TemplateDeductionInfo &Info,
772 SmallVectorImpl<DeducedTemplateArgument> &Deduced,
774 bool PartialOrdering =
false) {
776 if (NumParams != NumArgs &&
777 !(NumParams && isa<PackExpansionType>(Params[NumParams - 1])) &&
778 !(NumArgs && isa<PackExpansionType>(Args[NumArgs - 1])))
786 unsigned ArgIdx = 0, ParamIdx = 0;
787 for (; ParamIdx != NumParams; ++ParamIdx) {
795 if (ArgIdx >= NumArgs)
798 if (isa<PackExpansionType>(Args[ArgIdx])) {
808 Params[ParamIdx], Args[ArgIdx],
821 if (ParamIdx + 1 < NumParams)
832 PackDeductionScope PackScope(S, TemplateParams, Deduced, Info, Pattern);
834 bool HasAnyArguments =
false;
835 for (; ArgIdx < NumArgs; ++ArgIdx) {
836 HasAnyArguments =
true;
841 Args[ArgIdx], Info, Deduced,
842 TDF, PartialOrdering))
845 PackScope.nextPackElement();
850 if (
auto Result = PackScope.finish(HasAnyArguments))
855 if (ArgIdx < NumArgs)
868 if (ParamQs == ArgQs)
905 if (!ParamFunction || !ArgFunction)
946 TemplateDeductionInfo &Info,
947 SmallVectorImpl<DeducedTemplateArgument> &Deduced,
949 bool PartialOrdering) {
958 = dyn_cast<PackExpansionType>(Arg))
959 Arg = ArgExpansion->getPattern();
961 if (PartialOrdering) {
1043 TDF &= ~TDF_TopLevelParameterTypeList;
1047 if (isa<TemplateTypeParmType>(ParamRef->getPointeeType()) &&
1048 !ParamRef->getPointeeType().getQualifiers())
1068 unsigned Index = TemplateTypeParm->getIndex();
1069 bool RecanonicalizeArg =
false;
1073 if (isa<ArrayType>(Arg)) {
1078 RecanonicalizeArg =
true;
1086 Info.Param = cast<TemplateTypeParmDecl>(TemplateParams->
getParam(Index));
1092 assert(TemplateTypeParm->getDepth() == 0 &&
"Can't deduce with depth > 0");
1113 Info.Param = cast<TemplateTypeParmDecl>(TemplateParams->
getParam(Index));
1130 if (RecanonicalizeArg)
1138 Info.Param = cast<TemplateTypeParmDecl>(TemplateParams->
getParam(Index));
1139 Info.FirstArg = Deduced[Index];
1140 Info.SecondArg = NewDeduced;
1144 Deduced[Index] = Result;
1156 if (isa<SubstTemplateTypeParmPackType>(Param))
1189 ParamUnqualType == ArgUnqualType;
1196 #define NON_CANONICAL_TYPE(Class, Base) \
1197 case Type::Class: llvm_unreachable("deducing non-canonical type: " #Class);
1198 #define TYPE(Class, Base)
1199 #include "clang/AST/TypeNodes.def"
1201 case Type::TemplateTypeParm:
1202 case Type::SubstTemplateTypeParmPack:
1203 llvm_unreachable(
"Type nodes handled above");
1208 case Type::VariableArray:
1210 case Type::FunctionNoProto:
1213 case Type::ObjCObject:
1214 case Type::ObjCInterface:
1215 case Type::ObjCObjectPointer: {
1219 if (TDF & TDF_IgnoreQualifiers) {
1232 ComplexArg->getElementType(),
1233 Info, Deduced, TDF);
1241 cast<AtomicType>(Param)->getValueType(),
1242 AtomicArg->getValueType(),
1243 Info, Deduced, TDF);
1248 case Type::Pointer: {
1261 cast<PointerType>(Param)->getPointeeType(),
1263 Info, Deduced, SubTDF);
1267 case Type::LValueReference: {
1274 cast<LValueReferenceType>(Param)->getPointeeType(),
1279 case Type::RValueReference: {
1286 cast<RValueReferenceType>(Param)->getPointeeType(),
1292 case Type::IncompleteArray: {
1295 if (!IncompleteArrayArg)
1302 Info, Deduced, SubTDF);
1306 case Type::ConstantArray: {
1309 if (!ConstantArrayArg)
1315 return Sema::TDK_NonDeducedMismatch;
1321 Info, Deduced, SubTDF);
1325 case Type::DependentSizedArray: {
1339 Info, Deduced, SubTDF))
1351 "Cannot deduce non-type template argument at depth > 0");
1353 = dyn_cast<ConstantArrayType>(ArrayArg)) {
1354 llvm::APSInt Size(ConstantArrayArg->getSize());
1361 = dyn_cast<DependentSizedArrayType>(ArrayArg))
1362 if (DependentArrayArg->getSizeExpr())
1364 DependentArrayArg->getSizeExpr(),
1374 case Type::FunctionProto: {
1378 if (!FunctionProtoArg)
1382 cast<FunctionProtoType>(Param);
1389 return Sema::TDK_NonDeducedMismatch;
1402 FunctionProtoArg->
getNumParams(), Info, Deduced, SubTDF);
1405 case Type::InjectedClassName: {
1408 Param = cast<InjectedClassNameType>(Param)
1409 ->getInjectedSpecializationType();
1410 assert(isa<TemplateSpecializationType>(Param) &&
1411 "injected class name is not a template specialization type");
1420 case Type::TemplateSpecialization: {
1422 = cast<TemplateSpecializationType>(Param);
1449 llvm::SmallPtrSet<const RecordType *, 8> Visited;
1451 ToVisit.push_back(RecordT);
1452 bool Successful =
false;
1455 while (!ToVisit.empty()) {
1457 const RecordType *NextT = ToVisit.pop_back_val();
1460 if (!Visited.insert(NextT).second)
1465 if (NextT != RecordT) {
1466 TemplateDeductionInfo BaseInfo(Info.getLocation());
1477 DeducedOrig.clear();
1478 DeducedOrig.append(Deduced.begin(), Deduced.end());
1479 Info.Param = BaseInfo.Param;
1480 Info.FirstArg = BaseInfo.FirstArg;
1481 Info.SecondArg = BaseInfo.SecondArg;
1484 Deduced = DeducedOrig;
1489 for (
const auto &
Base : Next->
bases()) {
1490 assert(
Base.getType()->isRecordType() &&
1491 "Base class that isn't a record?");
1514 case Type::MemberPointer: {
1530 QualType(MemPtrArg->getClass(), 0),
1532 TDF & TDF_IgnoreQualifiers);
1540 case Type::BlockPointer: {
1556 case Type::ExtVector: {
1557 const ExtVectorType *VectorParam = cast<ExtVectorType>(Param);
1558 if (
const ExtVectorType *VectorArg = dyn_cast<ExtVectorType>(Arg)) {
1560 if (VectorParam->
getNumElements() != VectorArg->getNumElements())
1561 return Sema::TDK_NonDeducedMismatch;
1566 VectorArg->getElementType(),
1567 Info, Deduced, TDF);
1571 = dyn_cast<DependentSizedExtVectorType>(Arg)) {
1579 VectorArg->getElementType(),
1580 Info, Deduced, TDF);
1589 case Type::DependentSizedExtVector: {
1591 = cast<DependentSizedExtVectorType>(Param);
1593 if (
const ExtVectorType *VectorArg = dyn_cast<ExtVectorType>(Arg)) {
1598 VectorArg->getElementType(),
1599 Info, Deduced, TDF))
1609 ArgSize = VectorArg->getNumElements();
1611 false, Info, Deduced);
1615 = dyn_cast<DependentSizedExtVectorType>(Arg)) {
1620 VectorArg->getElementType(),
1621 Info, Deduced, TDF))
1637 case Type::TypeOfExpr:
1639 case Type::DependentName:
1640 case Type::UnresolvedUsing:
1641 case Type::Decltype:
1642 case Type::UnaryTransform:
1644 case Type::DependentTemplateSpecialization:
1645 case Type::PackExpansion:
1650 llvm_unreachable(
"Invalid Type Class!");
1658 TemplateDeductionInfo &Info,
1659 SmallVectorImpl<DeducedTemplateArgument> &Deduced) {
1668 llvm_unreachable(
"Null template argument in parameter list");
1676 Info.FirstArg = Param;
1677 Info.SecondArg = Arg;
1685 Info.FirstArg = Param;
1686 Info.SecondArg = Arg;
1690 llvm_unreachable(
"caller should handle pack expansions");
1697 Info.FirstArg = Param;
1698 Info.SecondArg = Arg;
1706 Info.FirstArg = Param;
1707 Info.SecondArg = Arg;
1715 Info.FirstArg = Param;
1716 Info.SecondArg = Arg;
1721 Info.FirstArg = Param;
1722 Info.SecondArg = Arg;
1726 Info.FirstArg = Param;
1727 Info.SecondArg = Arg;
1746 Info.FirstArg = Param;
1747 Info.SecondArg = Arg;
1755 llvm_unreachable(
"Argument packs should be expanded by the caller!");
1758 llvm_unreachable(
"Invalid TemplateArgument Kind!");
1771 unsigned &NumArgs) {
1772 if (ArgIdx == NumArgs)
1779 assert(ArgIdx == NumArgs - 1 &&
"Pack not at the end of argument list?");
1783 return ArgIdx < NumArgs;
1790 unsigned ArgIdx = 0;
1791 while (ArgIdx < NumArgs) {
1803 if (ArgIdx == NumArgs)
1818 TemplateDeductionInfo &Info,
1819 SmallVectorImpl<DeducedTemplateArgument> &Deduced) {
1831 unsigned ArgIdx = 0, ParamIdx = 0;
1834 if (!Params[ParamIdx].isPackExpansion()) {
1841 if (Args[ArgIdx].isPackExpansion()) {
1850 Params[ParamIdx], Args[ArgIdx],
1873 PackDeductionScope PackScope(S, TemplateParams, Deduced, Info, Pattern);
1878 bool HasAnyArguments =
false;
1880 HasAnyArguments =
true;
1888 PackScope.nextPackElement();
1893 if (
auto Result = PackScope.finish(HasAnyArguments))
1905 TemplateDeductionInfo &Info,
1906 SmallVectorImpl<DeducedTemplateArgument> &Deduced) {
1908 ParamList.
data(), ParamList.
size(),
1922 llvm_unreachable(
"Comparing NULL template argument");
1945 llvm::FoldingSetNodeID XID, YID;
1946 X.
getAsExpr()->Profile(XID, Context,
true);
1947 Y.
getAsExpr()->Profile(YID, Context,
true);
1958 XP != XPEnd; ++XP, ++YP)
1965 llvm_unreachable(
"Invalid TemplateArgument Kind!");
1989 llvm_unreachable(
"Can't get a NULL template argument here");
2043 llvm_unreachable(
"Invalid TemplateArgument Kind!");
2054 unsigned ArgumentPackIndex,
2055 TemplateDeductionInfo &Info,
2056 bool InFunctionTemplate,
2057 SmallVectorImpl<TemplateArgument> &Output) {
2069 NTTPType, PackedArgsBuilder.size(),
2070 Info, InFunctionTemplate, Output))
2074 PackedArgsBuilder.push_back(Output.pop_back_val());
2079 PackedArgsBuilder.data(),
2080 PackedArgsBuilder.size()));
2088 Info.getLocation());
2110 SmallVectorImpl<DeducedTemplateArgument> &Deduced,
2111 TemplateDeductionInfo &Info) {
2123 for (
unsigned I = 0, N = PartialParams->
size(); I != N; ++I) {
2125 if (Deduced[I].isNull()) {
2138 = dyn_cast<NonTypeTemplateParmDecl>(Param)) {
2139 NTTPType = NTTP->getType();
2142 Builder.data(), Builder.size());
2145 NTTP->getLocation(),
2146 NTTP->getDeclName());
2147 if (NTTPType.isNull()) {
2159 Partial, NTTPType, 0, Info,
false,
2174 Info.reset(DeducedArgumentList);
2193 unsigned ArgIdx = InstArgs.
size(), ParamIdx = ArgIdx;
2201 Info.FirstArg = PartialTemplateArgs[ArgIdx].
getArgument();
2207 InstArgs,
false, ConvertedInstArgs))
2212 for (
unsigned I = 0, E = TemplateParams->
size(); I != E; ++I) {
2216 Info.FirstArg = TemplateArgs[I];
2217 Info.SecondArg = InstArg;
2254 TemplateArgs, Info, Deduced))
2260 if (Inst.isInvalid())
2280 SmallVectorImpl<DeducedTemplateArgument> &Deduced,
2281 TemplateDeductionInfo &Info) {
2291 for (
unsigned I = 0, N = PartialParams->
size(); I != N; ++I) {
2293 if (Deduced[I].isNull()) {
2306 dyn_cast<NonTypeTemplateParmDecl>(Param)) {
2307 NTTPType = NTTP->getType();
2310 Builder.data(), Builder.size());
2313 NTTP->getLocation(), NTTP->getDeclName());
2314 if (NTTPType.isNull()) {
2325 0, Info,
false, Builder)) {
2336 S.
Context, Builder.data(), Builder.size());
2338 Info.reset(DeducedArgumentList);
2357 unsigned ArgIdx = InstArgs.
size(), ParamIdx = ArgIdx;
2364 Info.FirstArg = PartialTemplateArgs[ArgIdx].
getArgument();
2369 false, ConvertedInstArgs))
2373 for (
unsigned I = 0, E = TemplateParams->
size(); I != E; ++I) {
2377 Info.FirstArg = TemplateArgs[I];
2378 Info.SecondArg = InstArg;
2418 TemplateArgs, Info, Deduced))
2424 if (Inst.isInvalid())
2438 return Spec->getTemplateName().getAsTemplateDecl() !=
nullptr;
2479 if (ExplicitTemplateArgs.
size() == 0) {
2482 for (
auto P : Function->
params())
2483 ParamTypes.push_back(
P->getType());
2486 *FunctionType = Function->
getType();
2509 if (Inst.isInvalid())
2514 ExplicitTemplateArgs,
2517 unsigned Index = Builder.size();
2518 if (Index >= TemplateParams->
size())
2519 Index = TemplateParams->
size() - 1;
2528 Info.
reset(ExplicitArgumentList);
2540 for (
unsigned I = 0, N = Builder.size(); I != N; ++I) {
2553 assert(Proto &&
"Function template does not have a prototype?");
2579 unsigned ThisTypeQuals = 0;
2581 if (
CXXMethodDecl *Method = dyn_cast<CXXMethodDecl>(Function)) {
2583 ThisTypeQuals = Method->getTypeQualifiers();
2625 Deduced.reserve(TemplateParams->
size());
2626 for (
unsigned I = 0, N = ExplicitArgumentList->
size(); I != N; ++I) {
2631 Deduced.push_back(Arg);
2683 if (AQuals == DeducedAQuals) {
2702 bool ObjCLifetimeConversion =
false;
2706 ObjCLifetimeConversion) ||
2748 unsigned NumExplicitlySpecified,
2752 bool PartialOverloading) {
2767 if (Inst.isInvalid())
2776 for (
unsigned I = 0, N = TemplateParams->
size(); I != N; ++I) {
2779 if (!Deduced[I].isNull()) {
2780 if (I < NumExplicitlySpecified) {
2784 Builder.push_back(Deduced[I]);
2806 = dyn_cast<NonTypeTemplateParmDecl>(Param)) {
2807 NTTPType = NTTP->getType();
2810 Builder.data(), Builder.size());
2813 NTTP->getLocation(),
2814 NTTP->getDeclName());
2815 if (NTTPType.isNull()) {
2827 FunctionTemplate, NTTPType, 0, Info,
2848 unsigned NumExplicitArgs;
2865 bool HasDefaultArg =
false;
2876 const_cast<NamedDecl *>(TemplateParams->
getParam(I)));
2879 if (PartialOverloading)
break;
2892 const_cast<NamedDecl *>(TemplateParams->
getParam(I)));
2905 Info.
reset(DeducedArgumentList);
2912 Specialization = cast_or_null<FunctionDecl>(
2935 if (OriginalCallArgs) {
2940 for (
unsigned I = 0, N = OriginalCallArgs->size(); I != N; ++I) {
2942 unsigned ParamIdx = OriginalArg.
ArgIdx;
2958 SuppressedDiagnosticsMap::iterator
2978 if (Method->isInstance()) {
2998 bool ParamWasReference) {
3006 if (ParamWasReference)
3046 TemplateDeductionInfo Info(Ovl->
getNameLoc());
3048 Specialization, Info))
3056 if (ArgType.isNull())
continue;
3060 ArgType->isFunctionType())
3076 Deduced(TemplateParams->
size());
3077 TemplateDeductionInfo Info(Ovl->
getNameLoc());
3080 ArgType, Info, Deduced, TDF);
3081 if (Result)
continue;
3119 ParamRefType !=
nullptr);
3135 isa<TemplateTypeParmType>(ParamType) &&
3181 (isa<PointerType>(ParamType) &&
3195 Expr *Arg, TemplateDeductionInfo &Info,
3196 SmallVectorImpl<DeducedTemplateArgument> &Deduced,
unsigned TDF);
3203 TemplateDeductionInfo &Info,
3204 SmallVectorImpl<DeducedTemplateArgument> &Deduced,
3218 for (
unsigned i = 0, e = ILE->
getNumInits(); i < e; ++i) {
3220 S, TemplateParams, X, ILE->
getInit(i), Info, Deduced, TDF)))
3235 TemplateDeductionInfo &Info,
3236 SmallVectorImpl<DeducedTemplateArgument> &Deduced,
3244 Deduced, TDF, Result))
3253 ArgType, Arg, TDF)) {
3254 Info.Expression = Arg;
3258 ArgType, Info, Deduced, TDF);
3284 bool PartialOverloading) {
3295 unsigned CheckArgs = Args.size();
3304 CheckArgs = NumParams;
3316 unsigned NumExplicitlySpecified = 0;
3317 if (ExplicitTemplateArgs) {
3320 *ExplicitTemplateArgs,
3328 NumExplicitlySpecified = Deduced.size();
3331 for (
unsigned I = 0; I != NumParams; ++I)
3336 Deduced.resize(TemplateParams->
size());
3337 unsigned ArgIdx = 0;
3339 for (
unsigned ParamIdx = 0, NumParamTypes = ParamTypes.size();
3340 ParamIdx != NumParamTypes; ++ParamIdx) {
3341 QualType OrigParamType = ParamTypes[ParamIdx];
3342 QualType ParamType = OrigParamType;
3346 if (!ParamExpansion) {
3348 if (ArgIdx >= CheckArgs)
3351 Expr *Arg = Args[ArgIdx++];
3356 ParamType, ArgType, Arg,
3369 Info, Deduced, TDF, Result))
3386 Info, Deduced, TDF))
3401 if (ParamIdx + 1 < NumParamTypes)
3405 PackDeductionScope PackScope(*
this, TemplateParams, Deduced, Info,
3408 bool HasAnyArguments =
false;
3409 for (; ArgIdx < Args.size(); ++ArgIdx) {
3410 HasAnyArguments =
true;
3412 QualType OrigParamType = ParamPattern;
3413 ParamType = OrigParamType;
3414 Expr *Arg = Args[ArgIdx];
3419 ParamType, ArgType, Arg,
3431 Info, Deduced, TDF, Result)) {
3448 ParamType, ArgType, Info,
3453 PackScope.nextPackElement();
3458 if (
auto Result = PackScope.finish(HasAnyArguments))
3466 NumExplicitlySpecified, Specialization,
3467 Info, &OriginalCallArgs,
3468 PartialOverloading);
3473 if (ArgFunctionType.
isNull())
3474 return ArgFunctionType;
3484 return ArgFunctionType;
3490 return QualType(ArgFunctionTypeP, 0);
3522 bool InOverloadResolution) {
3530 if (!InOverloadResolution)
3536 unsigned NumExplicitlySpecified = 0;
3538 if (ExplicitTemplateArgs) {
3541 *ExplicitTemplateArgs,
3542 Deduced, ParamTypes,
3543 &FunctionType, Info))
3546 NumExplicitlySpecified = Deduced.size();
3553 Deduced.resize(TemplateParams->
size());
3557 bool HasDeducedReturnType =
false;
3558 if (
getLangOpts().CPlusPlus14 && InOverloadResolution &&
3561 HasDeducedReturnType =
true;
3564 if (!ArgFunctionType.
isNull()) {
3570 FunctionType, ArgFunctionType,
3571 Info, Deduced, TDF))
3577 NumExplicitlySpecified,
3578 Specialization, Info))
3583 if (HasDeducedReturnType &&
3591 if (!ArgFunctionType.
isNull()) {
3596 else if(!InOverloadResolution &&
3614 assert(AutoResultType->getContainedAutoType());
3616 TypeToReplaceAutoWith);
3629 SmallVectorImpl<DeducedTemplateArgument> &DeducedArguments,
3630 QualType ReturnTypeOfDestFunctionPtr,
3631 TemplateDeductionInfo &TDInfo,
3638 QualType CallOpResultType = CallOpGeneric->getReturnType();
3639 const bool GenericLambdaCallOperatorHasDeducedReturnType =
3643 CallOpGeneric->getDescribedFunctionTemplate();
3651 0, CallOpSpecialized, TDInfo))
3655 if (GenericLambdaCallOperatorHasDeducedReturnType &&
3664 ReturnTypeOfDestFunctionPtr))
3673 getLambdaStaticInvoker()->getDescribedFunctionTemplate();
3679 InvokerSpecialized, TDInfo);
3681 "If the call operator succeeded so should the invoker!");
3684 if (GenericLambdaCallOperatorHasDeducedReturnType &&
3698 TypeToReplaceAutoWith, S);
3700 TypeToReplaceAutoWith, S);
3750 assert(!A->
isReferenceType() &&
"Reference types were handled above");
3786 Deduced.resize(TemplateParams->
size());
3810 P, A, Info, Deduced, TDF))
3819 ConversionSpecialized, Info);
3820 Specialization = cast_or_null<CXXConversionDecl>(ConversionSpecialized);
3832 "Can only convert from lambda to ptr-to-function");
3835 const QualType DestFunctionPtrReturnType = ToFunType->getReturnType();
3847 Specialization, Deduced, DestFunctionPtrReturnType,
3875 bool InOverloadResolution) {
3878 InOverloadResolution);
3884 class SubstituteAutoTransform :
3888 SubstituteAutoTransform(
Sema &SemaRef,
QualType Replacement)
3890 Replacement(Replacement) {}
3900 if (!Replacement.isNull() && isa<TemplateTypeParmType>(Replacement)) {
3908 !Replacement.isNull() && Replacement->isDependentType();
3910 SemaRef.Context.getAutoType(Dependent ?
QualType() : Replacement,
3929 return TransformType(TLB, TL);
3951 Init = NonPlaceholder.
get();
3956 assert(!Result.
isNull() &&
"substituting DependentTy can't fail");
3964 if (AT->isDecltypeAuto()) {
3965 if (isa<InitListExpr>(Init)) {
3966 Diag(Init->getLocStart(), diag::err_decltype_auto_initializer_list);
3975 Result = SubstituteAutoTransform(*
this, Deduced).Apply(Type);
3989 nullptr,
false,
false);
3995 QualType FuncParam = SubstituteAutoTransform(*
this, TemplArg).Apply(Type);
3996 assert(!FuncParam.
isNull() &&
3997 "substituting template parameter for 'auto' failed");
4009 for (
unsigned i = 0, e = InitList->
getNumInits(); i < e; ++i) {
4013 Info, Deduced, TDF))
4018 FuncParam, InitType, Init,
4023 InitType, Info, Deduced, TDF))
4030 QualType DeducedType = Deduced[0].getAsType();
4034 if (DeducedType.
isNull())
4038 Result = SubstituteAutoTransform(*
this, DeducedType).Apply(Type);
4044 if (!InitList && !Result.
isNull() &&
4057 return SubstituteAutoTransform(*
this, TypeToReplaceAuto).
4058 TransformType(TypeWithAuto);
4063 return SubstituteAutoTransform(*
this, TypeToReplaceAuto).
4064 TransformType(TypeWithAuto);
4068 if (isa<InitListExpr>(Init))
4071 ? diag::err_init_capture_deduction_failure_from_init_list
4072 : diag::err_auto_var_deduction_failure_from_init_list)
4076 VDecl->
isInitCapture() ? diag::err_init_capture_deduction_failure
4077 : diag::err_auto_var_deduction_failure)
4079 << Init->getSourceRange();
4091 Diag(Loc, diag::err_auto_fn_used_before_defined) << FD;
4095 return StillUndeduced;
4102 llvm::SmallBitVector &Deduced);
4108 SmallVectorImpl<QualType> &ArgTypes) {
4123 ArgTypes.push_back(ArgTy);
4133 unsigned NumCallArguments1) {
4139 assert(Proto1 && Proto2 &&
"Function templates must have prototypes");
4142 Deduced.resize(TemplateParams->
size());
4147 TemplateDeductionInfo Info(Loc);
4173 unsigned NumComparedArguments = NumCallArguments1;
4175 if (!Method2 && Method1 && !Method1->
isStatic()) {
4178 ++NumComparedArguments;
4179 }
else if (!Method1 && Method2 && !Method2->
isStatic()) {
4186 Args2.insert(Args2.end(), Proto2->param_type_begin(),
4187 Proto2->param_type_end());
4192 if (Args1.size() > NumComparedArguments)
4193 Args1.resize(NumComparedArguments);
4194 if (Args2.size() > NumComparedArguments)
4195 Args2.resize(NumComparedArguments);
4197 Args1.data(), Args1.size(), Info, Deduced,
4208 S, TemplateParams, Proto2->getReturnType(), Proto1->
getReturnType(),
4231 unsigned ArgIdx = 0, NumArgs = Deduced.size();
4232 for (; ArgIdx != NumArgs; ++ArgIdx)
4233 if (Deduced[ArgIdx].isNull())
4236 if (ArgIdx == NumArgs) {
4243 llvm::SmallBitVector UsedParameters(TemplateParams->
size());
4246 for (
unsigned I = 0, N = Args2.size(); I != N; ++I)
4254 TemplateParams->
getDepth(), UsedParameters);
4264 for (; ArgIdx != NumArgs; ++ArgIdx)
4267 if (Deduced[ArgIdx].isNull() && UsedParameters[ArgIdx])
4286 while (--NumParams > 0) {
4317 unsigned NumCallArguments1,
4318 unsigned NumCallArguments2) {
4324 if (Better1 != Better2)
4325 return Better1 ? FT1 : FT2;
4327 if (!Better1 && !Better2)
4335 if (Variadic1 != Variadic2)
4336 return Variadic1? FT2 : FT1;
4382 bool Complain,
QualType TargetType) {
4383 if (SpecBegin == SpecEnd) {
4385 Diag(Loc, NoneDiag);
4391 if (SpecBegin + 1 == SpecEnd)
4398 = cast<FunctionDecl>(*Best)->getPrimaryTemplate();
4399 assert(BestTemplate &&
"Not a function template specialization?");
4402 = cast<FunctionDecl>(*I)->getPrimaryTemplate();
4403 assert(Challenger &&
"Not a function template specialization?");
4408 BestTemplate = Challenger;
4414 bool Ambiguous =
false;
4417 = cast<FunctionDecl>(*I)->getPrimaryTemplate();
4434 Diag(Loc, AmbigDiag);
4440 cast<FunctionDecl>(*I)->getPrimaryTemplate()->getTemplateParameters(),
4441 *cast<FunctionDecl>(*I)->getTemplateSpecializationArgs());
4442 if (!TargetType.
isNull())
4445 Diag((*I)->getLocation(), PD);
4524 if (Better1 == Better2)
4527 return Better1 ? PS1 : PS2;
4543 "the partial specializations being compared should specialize"
4544 " the same template.");
4583 if (Better1 == Better2)
4586 return Better1? PS1 : PS2;
4594 llvm::SmallBitVector &
Used);
4603 llvm::SmallBitVector &
Used) {
4606 E = Expansion->getPattern();
4612 E = ICE->getSubExpr();
4614 dyn_cast<SubstNonTypeTemplateParmExpr>(E))
4615 E = Subst->getReplacement();
4642 llvm::SmallBitVector &
Used) {
4649 OnlyDeduced, Depth, Used);
4659 llvm::SmallBitVector &
Used) {
4662 = dyn_cast<TemplateTemplateParmDecl>(Template)) {
4663 if (TTP->getDepth() ==
Depth)
4664 Used[TTP->getIndex()] =
true;
4683 llvm::SmallBitVector &
Used) {
4695 cast<PointerType>(T)->getPointeeType(),
4701 case Type::BlockPointer:
4703 cast<BlockPointerType>(T)->getPointeeType(),
4709 case Type::LValueReference:
4710 case Type::RValueReference:
4712 cast<ReferenceType>(T)->getPointeeType(),
4718 case Type::MemberPointer: {
4723 OnlyDeduced, Depth, Used);
4727 case Type::DependentSizedArray:
4729 cast<DependentSizedArrayType>(T)->getSizeExpr(),
4730 OnlyDeduced, Depth, Used);
4733 case Type::ConstantArray:
4734 case Type::IncompleteArray:
4737 OnlyDeduced, Depth, Used);
4741 case Type::ExtVector:
4744 OnlyDeduced, Depth, Used);
4747 case Type::DependentSizedExtVector: {
4749 = cast<DependentSizedExtVectorType>(T);
4757 case Type::FunctionProto: {
4761 for (
unsigned I = 0, N = Proto->
getNumParams(); I != N; ++I)
4767 case Type::TemplateTypeParm: {
4774 case Type::SubstTemplateTypeParmPack: {
4776 = cast<SubstTemplateTypeParmPackType>(T);
4779 OnlyDeduced, Depth, Used);
4785 case Type::InjectedClassName:
4786 T = cast<InjectedClassNameType>(T)->getInjectedSpecializationType();
4789 case Type::TemplateSpecialization: {
4791 = cast<TemplateSpecializationType>(T);
4803 for (
unsigned I = 0, N = Spec->
getNumArgs(); I != N; ++I)
4813 OnlyDeduced, Depth, Used);
4819 cast<AtomicType>(T)->getValueType(),
4820 OnlyDeduced, Depth, Used);
4823 case Type::DependentName:
4826 cast<DependentNameType>(T)->getQualifier(),
4827 OnlyDeduced, Depth, Used);
4830 case Type::DependentTemplateSpecialization: {
4832 = cast<DependentTemplateSpecializationType>(T);
4845 for (
unsigned I = 0, N = Spec->
getNumArgs(); I != N; ++I)
4855 OnlyDeduced, Depth, Used);
4858 case Type::TypeOfExpr:
4861 cast<TypeOfExprType>(T)->getUnderlyingExpr(),
4862 OnlyDeduced, Depth, Used);
4865 case Type::Decltype:
4868 cast<DecltypeType>(T)->getUnderlyingExpr(),
4869 OnlyDeduced, Depth, Used);
4872 case Type::UnaryTransform:
4876 OnlyDeduced, Depth, Used);
4879 case Type::PackExpansion:
4881 cast<PackExpansionType>(T)->getPattern(),
4882 OnlyDeduced, Depth, Used);
4887 cast<AutoType>(T)->getDeducedType(),
4888 OnlyDeduced, Depth, Used);
4892 case Type::VariableArray:
4893 case Type::FunctionNoProto:
4896 case Type::ObjCInterface:
4897 case Type::ObjCObject:
4898 case Type::ObjCObjectPointer:
4899 case Type::UnresolvedUsing:
4900 #define TYPE(Class, Base)
4901 #define ABSTRACT_TYPE(Class, Base)
4902 #define DEPENDENT_TYPE(Class, Base)
4903 #define NON_CANONICAL_TYPE(Class, Base) case Type::Class:
4904 #include "clang/AST/TypeNodes.def"
4916 llvm::SmallBitVector &
Used) {
4917 switch (TemplateArg.
getKind()) {
4963 bool OnlyDeduced,
unsigned Depth,
4964 llvm::SmallBitVector &
Used) {
4973 for (
unsigned I = 0, N = TemplateArgs.
size(); I != N; ++I)
4982 llvm::SmallBitVector &Deduced) {
4986 Deduced.resize(TemplateParams->
size());
4989 for (
unsigned I = 0, N = Function->
getNumParams(); I != N; ++I)
4991 true, TemplateParams->
getDepth(), Deduced);
5002 llvm::SmallBitVector Deduced(TemplateParams->
size());
5006 return Deduced.any();
QualType BuildStdInitializerList(QualType Element, SourceLocation Loc)
Looks for the std::initializer_list template and instantiates it with Element, or emits an error if i...
unsigned getNumElements() const
bool hasObjCGCAttr() const
ExprResult BuildExpressionFromIntegralTemplateArgument(const TemplateArgument &Arg, SourceLocation Loc)
Construct a new expression that refers to the given integral template argument with the given source-...
Defines the clang::ASTContext interface.
unsigned getNumInits() const
SourceLocation getEnd() const
Expr * getSizeExpr() const
std::pair< llvm::PointerUnion< const TemplateTypeParmType *, NamedDecl * >, SourceLocation > UnexpandedParameterPack
static bool isSameTemplateArg(ASTContext &Context, const TemplateArgument &X, const TemplateArgument &Y)
Determine whether two template arguments are the same.
TemplateArgument getPackExpansionPattern() const
When the template argument is a pack expansion, returns the pattern of the pack expansion.
QualType getInjectedSpecializationType() const
static DeducedTemplateArgument checkDeducedTemplateArguments(ASTContext &Context, const DeducedTemplateArgument &X, const DeducedTemplateArgument &Y)
Verify that the given, deduced template arguments are compatible.
unsigned getDepth() const
SuppressedDiagnosticsMap SuppressedDiagnostics
QualType BuildFunctionType(QualType T, MutableArrayRef< QualType > ParamTypes, SourceLocation Loc, DeclarationName Entity, const FunctionProtoType::ExtProtoInfo &EPI)
Build a function type.
bool isNonOverloadPlaceholderType() const
llvm::iterator_range< pack_iterator > pack_elements() const
Iterator range referencing all of the elements of a template argument pack.
bool hasExplicitTemplateArgs() const
Determines whether this expression had explicit template arguments.
TemplateDeductionResult
Describes the result of template argument deduction.
void MakeTrivial(ASTContext &Context, NestedNameSpecifier *Qualifier, SourceRange R)
Make a new nested-name-specifier from incomplete source-location information.
bool isLambdaConversionOperator(CXXConversionDecl *C)
llvm::APSInt getAsIntegral() const
Retrieve the template argument as an integral value.
ExtInfo withCallingConv(CallingConv cc) const
QualType getConversionType() const
Returns the type that this conversion function is converting to.
A stack-allocated class that identifies which local variable declaration instantiations are present i...
bool isMemberPointerType() const
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.
QualType getQualifiedType(SplitQualType split) const
Un-split a SplitQualType.
const LangOptions & getLangOpts() const
CanQual< T > getUnqualifiedType() const
Retrieve the unqualified form of this type.
TemplateDecl * getAsTemplateDecl() const
Retrieve the underlying template declaration that this template name refers to, if known...
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...
CanQualType getSizeType() const
Return the unique type for "size_t" (C99 7.17), defined in <stddef.h>.
unsigned getNumArgs() const
Retrieve the number of template arguments.
void setObjCLifetime(ObjCLifetime type)
std::string getTemplateArgumentBindingsText(const TemplateParameterList *Params, const TemplateArgumentList &Args)
Produces a formatted string that describes the binding of template parameters to template arguments...
bool isRecordType() const
SemaDiagnosticBuilder Diag(SourceLocation Loc, unsigned DiagID)
Emit a diagnostic.
static bool IsPossiblyOpaquelyQualifiedType(QualType T)
Determines whether the given type is an opaque type that might be more qualified when instantiated...
AutoType * getContainedAutoType() const
Get the AutoType whose type will be deduced for a variable with an initializer of this type...
Defines the C++ template declaration subclasses.
Represents a C++11 auto or C++1y decltype(auto) type.
pack_iterator pack_begin() const
Iterator referencing the first argument of a template argument pack.
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.
bool hasErrorOccurred() const
Determine whether any SFINAE errors have been trapped.
QualType getPointeeType() const
const IncompleteArrayType * getAsIncompleteArrayType(QualType T) const
unsigned getCVRQualifiers() const
Retrieve the set of CVR (const-volatile-restrict) qualifiers applied to this type.
Declaration of a variable template.
Template argument deduction produced inconsistent deduced values for the given template parameter...
NestedNameSpecifier * getPrefix() const
Return the prefix of this nested name specifier.
NamedDecl * getParam(unsigned Idx)
bool isDecltypeAuto() const
bool compatiblyIncludes(Qualifiers other) const
Determines if these qualifiers compatibly include another set. Generally this answers the question of...
A container of type source information.
unsigned getIndex() const
Expr * getAsExpr() const
Retrieve the template argument as an expression.
const TemplateArgument & get(unsigned Idx) const
Retrieve the template argument at a given index.
Partial ordering of function templates for a call to a conversion function.
void SetPartiallySubstitutedPack(NamedDecl *Pack, const TemplateArgument *ExplicitArgs, unsigned NumExplicitArgs)
Note that the given parameter pack has been partially substituted via explicit specification of templ...
const ASTTemplateArgumentListInfo * getTemplateArgsAsWritten() const
Get the template arguments as written.
const llvm::APInt & getSize() const
This file provides some common utility functions for processing Lambda related AST Constructs...
VarTemplateDecl * getSpecializedTemplate() const
Retrieve the template that this specialization specializes.
RAII object that enters a new expression evaluation context.
void removeObjCLifetime()
ObjCLifetime getObjCLifetime() const
static TemplateArgument CreatePackCopy(ASTContext &Context, const TemplateArgument *Args, unsigned NumArgs)
Create a new template argument pack by copying the given set of template arguments.
Represents an empty template argument, e.g., one that has not been deduced.
ExtProtoInfo - Extra information about a function prototype.
TemplateDeductionFlags
Various flags that control template argument deduction.
CallingConv getCallConv() const
Stores a list of template parameters for a TemplateDecl and its derived classes. Suitable for creatin...
uint64_t getTypeSize(QualType T) const
Return the size of the specified (complete) type T, in bits.
NamedDecl * getUnderlyingDecl()
Looks through UsingDecls and ObjCCompatibleAliasDecls for the underlying named decl.
RAII object used to temporarily allow the C++ 'this' expression to be used, with the given qualifiers...
Represents an explicit template argument list in C++, e.g., the "<int>" in "sort<int>". This is safe to be used inside an AST node, in contrast with TemplateArgumentListInfo.
Stores a list of template parameters for a TemplateDecl and its derived classes.
TemplateArgumentLoc SubstDefaultTemplateArgumentIfAvailable(TemplateDecl *Template, SourceLocation TemplateLoc, SourceLocation RAngleLoc, Decl *Param, SmallVectorImpl< TemplateArgument > &Converted, bool &HasDefaultArg)
If the given template parameter has a default template argument, substitute into that default templat...
static TemplateArgumentLoc getTrivialTemplateArgumentLoc(Sema &S, const TemplateArgument &Arg, QualType NTTPType, SourceLocation Loc)
Allocate a TemplateArgumentLoc where all locations have been initialized to the given location...
Whether we are performing template argument deduction for parameters and arguments in a top-level tem...
ParmVarDecl - Represents a parameter to a function.
Defines the clang::Expr interface and subclasses for C++ expressions.
unsigned getNumArgs() const
Retrieve the number of template arguments.
TemplateParameter Param
The template parameter to which a template argument deduction failure refers.
bool isPackExpansion() const
Determine whether this template argument is a pack expansion.
SourceRange getSourceRange() const override LLVM_READONLY
Source range that this declaration covers.
QualType getArrayDecayedType(QualType T) const
Return the properly qualified result of decaying the specified array type to a pointer.
bool isTemplateVariadic() const
Determines whether this function prototype contains a parameter pack at the end.
Base wrapper for a particular "section" of type source info.
unsigned getNumParams() const
QualType getElementType() const
Represents a class template specialization, which refers to a class template with a given set of temp...
LocalInstantiationScope * CurrentInstantiationScope
The current instantiation scope used to store local variables.
void setDeducedFromArrayBound(bool Deduced)
Specify whether the given non-type template argument was deduced from an array bound.
QualType SubstAutoType(QualType TypeWithAuto, QualType Replacement)
Substitute Replacement for auto in TypeWithAuto.
static TemplateArgument getEmptyPack()
bool wasDeducedFromArrayBound() const
For a non-type template argument, determine whether the template argument was deduced from an array b...
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 ...
Represents a dependent template name that cannot be resolved prior to template instantiation.
ArrayRef< QualType > getParamTypes() const
bool isReferenceType() const
QualType getReturnType() const
FunctionDecl * getTemplatedDecl() const
Get the underlying function declaration of the template.
bool isAnyPointerType() const
static bool isVariadicFunctionTemplate(FunctionTemplateDecl *FunTmpl)
Determine whether this a function template whose parameter-type-list ends with a function parameter p...
The arguments included an overloaded function name that could not be resolved to a suitable function...
QualType adjustCCAndNoReturn(QualType ArgFunctionType, QualType FunctionType)
unsigned getCVRQualifiers() const
unsigned size() const
Retrieve the number of template arguments in this template argument list.
bool hasSameType(QualType T1, QualType T2) const
Determine whether the given types T1 and T2 are equivalent.
virtual SourceRange getSourceRange() const LLVM_READONLY
Source range that this declaration covers.
Represents the result of substituting a set of types for a template type parameter pack...
QualType getTypeDeclType(const TypeDecl *Decl, const TypeDecl *PrevDecl=nullptr) const
Return the unique reference to the type for the specified type declaration.
bool hasSameUnqualifiedType(QualType T1, QualType T2) const
Determine whether the given types are equivalent after cvr-qualifiers have been removed.
Within template argument deduction from a function call, we are matching with a parameter type for wh...
ASTTemplateArgumentListInfo & getExplicitTemplateArgs()
Describes an C or C++ initializer list.
FunctionTemplateDecl * getCanonicalDecl() override
Retrieves the canonical declaration of this template.
TemplateArgument getArgumentPack() const
static TemplateArgumentList * CreateCopy(ASTContext &Context, const TemplateArgument *Args, unsigned NumArgs)
Create a new template argument list that copies the given set of template arguments.
void setNameLoc(SourceLocation Loc)
bool HasFormOfMemberPointer
const ASTTemplateArgumentListInfo * getTemplateArgsAsWritten() const
Get the template arguments as written.
CanProxy< U > getAs() const
Retrieve a canonical type pointer with a different static type, upcasting or downcasting as needed...
TemplateName getTemplateName() const
Retrieve the name of the template that we are specializing.
QualType getReturnType() const
unsigned getMinRequiredArguments() const
const CXXRecordDecl * getParent() const
static bool hasPackExpansionBeforeEnd(const TemplateArgument *Args, unsigned NumArgs)
Determine whether the given set of template arguments has a pack expansion that is not the last templ...
bool isObjCLifetimeType() const
const ArrayType * getAsArrayType(QualType T) const
static TemplateTypeParmDecl * Create(const ASTContext &C, DeclContext *DC, SourceLocation KeyLoc, SourceLocation NameLoc, unsigned D, unsigned P, IdentifierInfo *Id, bool Typename, bool ParameterPack)
Substitution of the deduced template argument values resulted in an error.
SourceLocation RAngleLoc
The source location of the right angle bracket ('>').
bool isValueDependent() const
RecordDecl * getDecl() const
FunctionDecl * getTemplateInstantiationPattern() const
Retrieve the function declaration from which this function could be instantiated, if it is an instant...
Template argument deduction exceeded the maximum template instantiation depth (which has already been...
void MarkDeducedTemplateParameters(const FunctionTemplateDecl *FunctionTemplate, llvm::SmallBitVector &Deduced)
static bool ConvertDeducedTemplateArgument(Sema &S, NamedDecl *Param, DeducedTemplateArgument Arg, NamedDecl *Template, QualType NTTPType, unsigned ArgumentPackIndex, TemplateDeductionInfo &Info, bool InFunctionTemplate, SmallVectorImpl< TemplateArgument > &Output)
Convert the given deduced template argument and add it to the set of fully-converted template argumen...
TypeClass getTypeClass() const
DeclContext * getLexicalDeclContext()
SmallVector< DeducedTemplateArgument, 4 > New
NestedNameSpecifierLoc getWithLocInContext(ASTContext &Context) const
Retrieve a nested-name-specifier with location information, copied into the given AST context...
A C++ lambda expression, which produces a function object (of unspecified type) that can be invoked l...
bool CheckTemplateArgumentList(TemplateDecl *Template, SourceLocation TemplateLoc, TemplateArgumentListInfo &TemplateArgs, bool PartialTemplateArgs, SmallVectorImpl< TemplateArgument > &Converted)
Check that the given template arguments can be be provided to the given template, converting the argu...
QualType OriginalParamType
static bool AdjustFunctionParmAndArgTypesForDeduction(Sema &S, TemplateParameterList *TemplateParams, QualType &ParamType, QualType &ArgType, Expr *Arg, unsigned &TDF)
Perform the adjustments to the parameter and argument types described in C++ [temp.deduct.call].
const DependentSizedArrayType * getAsDependentSizedArrayType(QualType T) const
virtual Decl * getCanonicalDecl()
Retrieves the "canonical" declaration of the given declaration.
static Sema::TemplateDeductionResult DeduceTemplateArgumentByListElement(Sema &S, TemplateParameterList *TemplateParams, QualType ParamType, Expr *Arg, TemplateDeductionInfo &Info, SmallVectorImpl< DeducedTemplateArgument > &Deduced, unsigned TDF)
Perform template argument deduction by matching a parameter type against a single expression...
const TemplateTypeParmType * getReplacedParameter() const
Gets the template parameter that was substituted for.
param_iterator param_begin()
static bool hasTemplateArgumentForDeduction(const TemplateArgument *&Args, unsigned &ArgIdx, unsigned &NumArgs)
Determine whether there is a template argument to be used for deduction.
TyLocType push(QualType T)
Class that aids in the construction of nested-name-specifiers along with source-location information ...
QualType getTemplateSpecializationType(TemplateName T, const TemplateArgument *Args, unsigned NumArgs, QualType Canon=QualType()) const
RAII class used to determine whether SFINAE has trapped any errors that occur during template argumen...
DependentTemplateName * getAsDependentTemplateName() const
Retrieve the underlying dependent template name structure, if any.
bool isTemplateParameterPack() const
static Sema::TemplateDeductionResult DeduceTemplateArguments(Sema &S, TemplateParameterList *TemplateParams, const TemplateArgument &Param, TemplateArgument Arg, TemplateDeductionInfo &Info, SmallVectorImpl< DeducedTemplateArgument > &Deduced)
void adjustDeducedFunctionResultType(FunctionDecl *FD, QualType ResultType)
Change the result type of a function type once it is deduced.
diag_iterator diag_end() const
Returns an iterator at the end of the sequence of suppressed diagnostics.
ExtInfo getExtInfo() const
Sema - This implements semantic analysis and AST building for C.
static bool isAtLeastAsSpecializedAs(Sema &S, SourceLocation Loc, FunctionTemplateDecl *FT1, FunctionTemplateDecl *FT2, TemplatePartialOrderingContext TPOC, unsigned NumCallArguments1)
Determine whether the function template FT1 is at least as specialized as FT2.
bool CheckTemplateArgument(NamedDecl *Param, TemplateArgumentLoc &Arg, NamedDecl *Template, SourceLocation TemplateLoc, SourceLocation RAngleLoc, unsigned ArgumentPackIndex, SmallVectorImpl< TemplateArgument > &Converted, CheckTemplateArgumentKind CTAK=CTAK_Specified)
Check that the given template argument corresponds to the given template parameter.
QualType getParamType(unsigned i) const
void reset(TemplateArgumentList *NewDeduced)
Provide a new template argument list that contains the results of template argument deduction...
bool isParameterPack() const
Determine whether this parameter is actually a function parameter pack.
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...
param_type_iterator param_type_begin() const
static bool hasDeducibleTemplateParameters(Sema &S, FunctionTemplateDecl *FunctionTemplate, QualType T)
Template argument deduction did not deduce a value for every template parameter.
bool isGenericLambda() const
Determine whether this class describes a generic lambda function object (i.e. function call operator ...
SourceLocation getTypeSpecStartLoc() const
TemplateParameterList * getTemplateParameters() const
Get the list of template parameters.
QualType getPointeeType() const
bool isFunctionPointerType() const
static bool isSimpleTemplateIdType(QualType T)
Determine whether the given type T is a simple-template-id type.
static std::pair< unsigned, unsigned > getDepthAndIndex(NamedDecl *ND)
Retrieve the depth and index of a template parameter.
const Type * getTypeForDecl() const
unsigned getTypeQualifiers() const
QualType getPointeeType() const
bool isUndeducedType() const
Determine whether this type is an undeduced type, meaning that it somehow involves a C++11 'auto' typ...
TemplateDeductionResult FinishTemplateArgumentDeduction(FunctionTemplateDecl *FunctionTemplate, SmallVectorImpl< DeducedTemplateArgument > &Deduced, unsigned NumExplicitlySpecified, FunctionDecl *&Specialization, sema::TemplateDeductionInfo &Info, SmallVectorImpl< OriginalCallArg > const *OriginalCallArgs=nullptr, bool PartialOverloading=false)
Finish template argument deduction for a function template, checking the deduced template arguments f...
DeducedPack(unsigned Index)
When performing template argument deduction for a function template, there were too many call argumen...
decls_iterator decls_end() const
Declaration of a template type parameter.
SourceLocation getNameLoc() const
Gets the location of the name.
TemplateParameterList * getTemplateParameters() const
Get the list of template parameters.
static FindResult find(Expr *E)
Finds the overloaded expression in the given expression E of OverloadTy.
unsigned NumTemplateArgs
The number of template arguments in TemplateArgs. The actual template arguments (if any) are stored a...
This file defines the classes used to store parsed information about declaration-specifiers and decla...
ExprResult BuildExpressionFromDeclTemplateArgument(const TemplateArgument &Arg, QualType ParamType, SourceLocation Loc)
Given a non-type template argument that refers to a declaration and the type of its corresponding non...
void setInvalidDecl(bool Invalid=true)
diag_iterator diag_begin() const
Returns an iterator at the beginning of the sequence of suppressed diagnostics.
const ParmVarDecl * getParamDecl(unsigned i) const
ArgKind getKind() const
Return the kind of stored template argument.
ExtProtoInfo getExtProtoInfo() const
DeclContext * getDeclContext()
When performing template argument deduction for a function template, there were too few call argument...
ExprResult CheckPlaceholderExpr(Expr *E)
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.
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...
QualType getType() const
Get the type for which this source info wrapper provides information.
TemplateDeductionResult SubstituteExplicitTemplateArguments(FunctionTemplateDecl *FunctionTemplate, TemplateArgumentListInfo &ExplicitTemplateArgs, SmallVectorImpl< DeducedTemplateArgument > &Deduced, SmallVectorImpl< QualType > &ParamTypes, QualType *FunctionType, sema::TemplateDeductionInfo &Info)
Substitute the explicitly-provided template arguments into the given function template according to C...
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
bool hasTrailingReturn() const
Within template argument deduction from overload resolution per C++ [over.over] allow matching functi...
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.
TemplateName getAsTemplateOrTemplatePattern() const
Retrieve the template argument as a template name; if the argument is a pack expansion, return the pattern as a template name.
const TemplateArgument * data() const
Retrieve a pointer to the template argument list.
Data structure that captures multiple levels of template argument lists for use in template instantia...
bool DeduceReturnType(FunctionDecl *FD, SourceLocation Loc, bool Diagnose=true)
CXXMethodDecl * getLambdaCallOperator() const
Retrieve the lambda call operator of the closure type if this is a closure type.
DeclarationName getDeclName() const
ClassTemplateDecl * getSpecializedTemplate() const
Retrieve the template that this specialization specializes.
TemplateArgumentLoc * getTemplateArgs()
Retrieve the template arguments.
Represents a reference to a non-type template parameter that has been substituted with a template arg...
const Type * getAsType() const
Retrieve the type stored in this nested name specifier.
QualType getElementType() const
bool isStrictSupersetOf(Qualifiers Other) const
Determine whether this set of qualifiers is a strict superset of another set of qualifiers, not considering qualifier compatibility.
Represents a C++ conversion function within a class.
The result type of a method or function.
bool RequireCompleteExprType(Expr *E, TypeDiagnoser &Diagnoser)
Ensure that the type of the given expression is complete.
void removeCVRQualifiers(unsigned mask)
CallingConv
CallingConv - Specifies the calling convention that a function uses.
unsigned getDepth() const
Get the depth of this template parameter list in the set of template parameter lists.
const TypeClass * getTypePtr() const
Captures a template argument whose value has been deduced via c++ template argument deduction...
bool hasObjCLifetime() const
static bool hasInconsistentOrSupersetQualifiersOf(QualType ParamType, QualType ArgType)
Determine whether the parameter has qualifiers that are either inconsistent with or a superset of the...
decls_iterator decls_begin() const
bool getNoReturnAttr() const
Determine whether this function type includes the GNU noreturn attribute. The C++11 [[noreturn]] attr...
static void MarkUsedTemplateParameters(ASTContext &Ctx, QualType T, bool OnlyDeduced, unsigned Level, llvm::SmallBitVector &Deduced)
Mark the template parameters that are used by the given type.
SmallVector< DeducedPack *, 8 > PendingDeducedPacks
Information on packs that we're currently expanding.
void ResetPartiallySubstitutedPack()
Reset the partially-substituted pack when it is no longer of interest.
There is no lifetime qualification on this type.
TypeLoc getTypeLoc() const
Return the TypeLoc wrapper for the type source info.
A reference to an overloaded function set, either an UnresolvedLookupExpr or an UnresolvedMemberExpr...
NamedDecl * getPartiallySubstitutedPack(const TemplateArgument **ExplicitArgs=nullptr, unsigned *NumExplicitArgs=nullptr) const
Retrieve the partially-substitued template parameter pack.
A stack object to be created when performing template instantiation.
static Sema::TemplateDeductionResult DeduceTemplateArgumentsByTypeMatch(Sema &S, TemplateParameterList *TemplateParams, QualType Param, QualType Arg, TemplateDeductionInfo &Info, SmallVectorImpl< DeducedTemplateArgument > &Deduced, unsigned TDF, bool PartialOrdering=false)
Deduce the template arguments by comparing the parameter type and the argument type (C++ [temp...
bool Subst(const TemplateArgumentLoc *Args, unsigned NumArgs, TemplateArgumentListInfo &Result, const MultiLevelTemplateArgumentList &TemplateArgs)
The template argument was deduced from an array bound via template argument deduction.
DeduceAutoResult
Result type of DeduceAutoType.
Encodes a location in the source. The SourceManager can decode this to get at the full include stack...
static TemplateParameter makeTemplateParameter(Decl *D)
Helper function to build a TemplateParameter when we don't know its type statically.
unsigned getNumParams() const
const Type * getTypePtr() const
bool hasSameTemplateName(TemplateName X, TemplateName Y)
Determine whether the given template names refer to the same template.
TemplateName getAsTemplate() const
Retrieve the template name for a template name argument.
RefQualifierKind getRefQualifier() const
Retrieve the ref-qualifier associated with this function type.
bool IsNoReturnConversion(QualType FromType, QualType ToType, QualType &ResultTy)
Determine whether the conversion from FromType to ToType is a valid conversion that strips "noreturn"...
static Sema::TemplateDeductionResult FinishTemplateArgumentDeduction(Sema &S, ClassTemplatePartialSpecializationDecl *Partial, const TemplateArgumentList &TemplateArgs, SmallVectorImpl< DeducedTemplateArgument > &Deduced, TemplateDeductionInfo &Info)
Template argument deduction failed due to inconsistent cv-qualifiers on a template parameter type tha...
TypeSourceInfo * getTrivialTypeSourceInfo(QualType T, SourceLocation Loc=SourceLocation()) const
Allocate a TypeSourceInfo where all locations have been initialized to a given location, which defaults to the empty location.
static bool isSameTemplate(TemplateDecl *T1, TemplateDecl *T2)
Determine if the two templates are equivalent.
static QualType getUnderlyingType(const SubRegion *R)
Within template argument deduction from a function call, we are matching in a case where we ignore cv...
Represents a static or instance method of a struct/union/class.
SourceLocation getNameLoc() const
Represents a C++ nested name specifier, such as "\::std::vector<int>::".
ExtInfo withNoReturn(bool noReturn) const
The declaration was invalid; do nothing.
const ConstantArrayType * getAsConstantArrayType(QualType T) const
void DiagnoseAutoDeductionFailure(VarDecl *VDecl, Expr *Init)
void reserve(size_t Requested)
Ensures that this buffer has at least as much capacity as described.
TemplateDeductionResult DeduceTemplateArguments(ClassTemplatePartialSpecializationDecl *Partial, const TemplateArgumentList &TemplateArgs, sema::TemplateDeductionInfo &Info)
Perform template argument deduction to determine whether the given template arguments match the given...
TypeSourceInfo * SubstAutoTypeSourceInfo(TypeSourceInfo *TypeWithAuto, QualType Replacement)
Substitute Replacement for auto in TypeWithAuto.
Within template argument deduction from a function call, we are matching in a case where we can perfo...
bool isTypeDependent() const
static bool isSameDeclaration(Decl *X, Decl *Y)
Determine whether two declaration pointers refer to the same declaration.
static bool CheckOriginalCallArgDeduction(Sema &S, Sema::OriginalCallArg OriginalArg, QualType DeducedA)
Check whether the deduced argument type for a call to a function template matches the actual argument...
bool isMemberFunctionPointerType() const
An rvalue ref-qualifier was provided (&&).
QualifiedTemplateName * getAsQualifiedTemplateName() const
Retrieve the underlying qualified template name structure, if any.
ValueDecl * getAsDecl() const
Retrieve the declaration for a declaration non-type template argument.
SourceLocation getExprLoc() const LLVM_READONLY
QualType getPointeeType() const
QualType getFunctionType(QualType ResultTy, ArrayRef< QualType > Args, const FunctionProtoType::ExtProtoInfo &EPI) const
Return a normal function type with a typed argument list.
Represents a pack expansion of types.
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...
static QualType GetTypeOfFunction(Sema &S, const OverloadExpr::FindResult &R, FunctionDecl *Fn)
Expr * getSizeExpr() const
bool isInitCapture() const
Whether this variable is the implicit variable for a lambda init-capture.
Represents a template argument.
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.
void collectUnexpandedParameterPacks(TemplateArgument Arg, SmallVectorImpl< UnexpandedParameterPack > &Unexpanded)
Collect the set of unexpanded parameter packs within the given template argument. ...
Represents a template name that was expressed as a qualified name.
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 const Type * getElementType(const Expr *BaseExpr)
bool SubstParmTypes(SourceLocation Loc, ParmVarDecl **Params, unsigned NumParams, const MultiLevelTemplateArgumentList &TemplateArgs, SmallVectorImpl< QualType > &ParamTypes, SmallVectorImpl< ParmVarDecl * > *OutParams=nullptr)
Substitute the given template arguments into the given set of parameters, producing the set of parame...
Qualifiers withoutObjCLifetime() const
static QualType ResolveOverloadForDeduction(Sema &S, TemplateParameterList *TemplateParams, Expr *Arg, QualType ParamType, bool ParamWasReference)
The base class of all kinds of template declarations (e.g., class, function, etc.).
const TemplateArgumentList & getTemplateArgs() const
Retrieve the template arguments of the variable template specialization.
static bool DeduceFromInitializerList(Sema &S, TemplateParameterList *TemplateParams, QualType AdjustedParamType, InitListExpr *ILE, TemplateDeductionInfo &Info, SmallVectorImpl< DeducedTemplateArgument > &Deduced, unsigned TDF, Sema::TemplateDeductionResult &Result)
Attempt template argument deduction from an initializer list deemed to be an argument in a function c...
TemplateName getCanonicalTemplateName(TemplateName Name) const
Retrieves the "canonical" template name that refers to a given template.
bool isInvalidDecl() const
bool hasNonTrivialObjCLifetime() const
True if the lifetime is neither None or ExplicitNone.
void HandleFunctionTypeMismatch(PartialDiagnostic &PDiag, QualType FromType, QualType ToType)
A non-depnedent component of the parameter did not match the corresponding component of the argument...
QualType getPointerType(QualType T) const
Return the uniqued reference to the type for a pointer to the specified type.
OverloadExpr * Expression
Represents a C++11 pack expansion that produces a sequence of expressions.
param_type_iterator param_type_end() const
bool isNull() const
Determine whether this template argument has no value.
SourceLocation LAngleLoc
The source location of the left angle bracket ('<').
const FunctionType * adjustFunctionType(const FunctionType *Fn, FunctionType::ExtInfo EInfo)
Change the ExtInfo on a function type.
void setCVRQualifiers(unsigned mask)
CanQualType getCanonicalType(QualType T) const
Return the canonical (structural) type corresponding to the specified potentially non-canonical type ...
bool isLValueReferenceType() const
SourceLocation getPointOfInstantiation() const
Retrieve the (first) point of instantiation of a function template specialization or a member of a cl...
No template argument deduction flags, which indicates the strictest results for template argument ded...
Allow non-dependent types to differ, e.g., when performing template argument deduction from a functio...
void InstantiateFunctionDefinition(SourceLocation PointOfInstantiation, FunctionDecl *Function, bool Recursive=false, bool DefinitionRequired=false)
Instantiate the definition of the given function from its template.
const TemplateArgument & getArg(unsigned Idx) const
unsigned getDepth() const
Get the nesting depth of the template parameter.
bool isRValueReferenceType() const
QualType getNonReferenceType() const
const TemplateArgument * getArgs() const
Retrieve the template arguments.
static Sema::TemplateDeductionResult DeduceNonTypeTemplateArgument(Sema &S, NonTypeTemplateParmDecl *NTTP, llvm::APSInt Value, QualType ValueType, bool DeducedFromArrayBound, TemplateDeductionInfo &Info, SmallVectorImpl< DeducedTemplateArgument > &Deduced)
Deduce the value of the given non-type template parameter from the given constant.
The template argument was specified in the code or was instantiated with some deduced template argume...
unsigned getTypeQuals() const
TemplateArgumentList * take()
Take ownership of the deduced template argument list.
QualType getIntegralType() const
Retrieve the type of the integral value.
bool isFunctionType() const
const TemplateArgument * getArgs() const
Retrieve the template arguments.
QualType BuildDecltypeType(Expr *E, SourceLocation Loc, bool AsUnevaluated=true)
unsigned getAddressSpace() const
FriendObjectKind getFriendObjectKind() const
Determines whether this declaration is the object of a friend declaration and, if so...
The template argument is a type.
Deduction failed; that's all we know.
SourceLocation getLocation() const
Returns the location at which template argument is occurring.
NestedNameSpecifier * getQualifier() const
const TemplateArgument & getArg(unsigned Idx) const
Retrieve a specific template argument as a type.
QualType getPointeeType() const
A template argument list.
const TemplateArgumentList & getTemplateArgs() const
Retrieve the template arguments of the class template specialization.
const Type * getClass() const
static void SubstAutoWithinFunctionReturnType(FunctionDecl *F, QualType TypeToReplaceAutoWith, Sema &S)
Given a function declaration (e.g. a generic lambda conversion function) that contains an 'auto' in i...
QualType getNullPtrType() const
Retrieve the type for null non-type template argument.
unsigned getFullDataSize() const
Returns the size of the type source info data block.
bool hasAddressSpace() const
unsigned pack_size() const
The number of template arguments in the given template argument pack.
QualType getUnqualifiedType() const
Retrieve the unqualified variant of the given type, removing as little sugar as possible.
Represents a C++ struct/union/class.
BoundNodesTreeBuilder *const Builder
bool isObjCObjectPointerType() const
bool isPlaceholderType() const
static Sema::TemplateDeductionResult SpecializeCorrespondingLambdaCallOperatorAndInvoker(CXXConversionDecl *ConversionSpecialized, SmallVectorImpl< DeducedTemplateArgument > &DeducedArguments, QualType ReturnTypeOfDestFunctionPtr, TemplateDeductionInfo &TDInfo, Sema &S)
Given a specialized conversion operator of a generic lambda create the corresponding specializations ...
TPOC
The context in which partial ordering of function templates occurs.
static NonTypeTemplateParmDecl * getDeducedParameterFromExpr(Expr *E)
If the given expression is of a form that permits the deduction of a non-type template parameter...
Location information for a TemplateArgument.
TemplateArgument SecondArg
The second template argument to which the template argument deduction failure refers.
Declaration of a class template.
Partial ordering of function templates for a function call.
TemplateParameterList * getTemplateParameters() const
Get the list of template parameters.
pack_iterator pack_end() const
Iterator referencing one past the last argument of a template argument pack.
A pack that we're currently deducing.
void copyInto(TemplateArgumentListInfo &List) const
DeducedTemplateArgument Saved
QualType getPattern() const
Retrieve the pattern of this pack expansion, which is the type that will be repeatedly instantiated w...
Decl * SubstDecl(Decl *D, DeclContext *Owner, const MultiLevelTemplateArgumentList &TemplateArgs)
ClassTemplatePartialSpecializationDecl * getMoreSpecializedPartialSpecialization(ClassTemplatePartialSpecializationDecl *PS1, ClassTemplatePartialSpecializationDecl *PS2, SourceLocation Loc)
Returns the more specialized class template partial specialization according to the rules of partial ...
static Qualifiers fromCVRMask(unsigned CVR)
bool isIncompleteArrayType() const
static Decl::Kind getKind(const Decl *D)
bool IsQualificationConversion(QualType FromType, QualType ToType, bool CStyle, bool &ObjCLifetimeConversion)
A reference to a declared variable, function, enum, etc. [C99 6.5.1p2].
Represents a type template specialization; the template must be a class template, a type alias templa...
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.
const Expr * getInit(unsigned Init) const
void NoteCandidates(Sema &S, SourceLocation Loc)
TemplateArgument FirstArg
The first template argument to which the template argument deduction failure refers.
DeduceAutoResult DeduceAutoType(TypeSourceInfo *AutoType, Expr *&Initializer, QualType &Result)
static bool hasSameExtendedValue(llvm::APSInt X, llvm::APSInt Y)
Compare two APSInts, extending and switching the sign as necessary to compare their values regardless...
Wrapper for template type parameters.
bool isParameterPack() const
Whether this declaration is a parameter pack.
SourceLocation getLocation() const
FunctionDecl * getCanonicalDecl() override
Retrieves the "canonical" declaration of the given declaration.
Partial ordering of function templates in other contexts, e.g., taking the address of a function temp...
void MarkUsedTemplateParameters(const TemplateArgumentList &TemplateArgs, bool OnlyDeduced, unsigned Depth, llvm::SmallBitVector &Used)
Mark which template parameters can be deduced from a given template argument list.
static void AddImplicitObjectParameterType(ASTContext &Context, CXXMethodDecl *Method, SmallVectorImpl< QualType > &ArgTypes)
If this is a non-static member function,.
The template argument was deduced via template argument deduction.
bool isNull() const
isNull - Return true if this QualType doesn't point to a type yet.
void setType(QualType newType)
void removeAddressSpace()
const TemplateArgument & getArgument() const
brief A function argument from which we performed template argument
The explicitly-specified template arguments were not valid template arguments for the given template...
Declaration of a template function.
QualType getUnqualifiedArrayType(QualType T, Qualifiers &Quals)
Return this type as a completely-unqualified array type, capturing the qualifiers in Quals...
DeducedTemplateArgument DeferredDeduction
unsigned getIndex() const
Get the index of the template parameter within its parameter list.
TypeSourceInfo * SubstType(TypeSourceInfo *T, const MultiLevelTemplateArgumentList &TemplateArgs, SourceLocation Loc, DeclarationName Entity)
Perform substitution on the type T with a given set of template arguments.
Qualifiers getQualifiers() const
Retrieve the set of qualifiers applied to this type.
bool isPointerType() const
QualType getDeducedType() const
Get the type deduced for this auto type, or null if it's either not been deduced or was deduced to a ...