44#include "llvm/ADT/ArrayRef.h"
45#include "llvm/ADT/STLExtras.h"
46#include "llvm/ADT/SmallVector.h"
47#include "llvm/Support/Casting.h"
48#include "llvm/Support/ErrorHandling.h"
59static bool HaveSameAssociatedConstraints(
62 if (OldACs.size() != NewACs.size())
69 for (
size_t I = 0, E = OldACs.size(); I != E; ++I)
71 Old, OldACs[I].ConstraintExpr, NewInfo, NewACs[I].ConstraintExpr))
79class ExtractTypeForDeductionGuide
81 llvm::SmallVectorImpl<TypedefNameDecl *> &MaterializedTypedefs;
82 ClassTemplateDecl *NestedPattern;
83 const MultiLevelTemplateArgumentList *OuterInstantiationArgs;
84 std::optional<TemplateDeclInstantiator> TypedefNameInstantiator;
87 typedef TreeTransform<ExtractTypeForDeductionGuide> Base;
88 ExtractTypeForDeductionGuide(
90 llvm::SmallVectorImpl<TypedefNameDecl *> &MaterializedTypedefs,
91 ClassTemplateDecl *NestedPattern =
nullptr,
92 const MultiLevelTemplateArgumentList *OuterInstantiationArgs =
nullptr)
93 : Base(SemaRef), MaterializedTypedefs(MaterializedTypedefs),
94 NestedPattern(NestedPattern),
95 OuterInstantiationArgs(OuterInstantiationArgs) {
96 if (OuterInstantiationArgs)
97 TypedefNameInstantiator.emplace(
99 *OuterInstantiationArgs);
102 TypeSourceInfo *transform(TypeSourceInfo *TSI) {
return TransformType(TSI); }
106 bool mightReferToOuterTemplateParameters(TypedefNameDecl *
Typedef) {
110 static auto WalkUp = [](DeclContext *DC, DeclContext *TargetDC) {
121 if (WalkUp(
Typedef->getDeclContext(), NestedPattern->getTemplatedDecl()))
123 if (WalkUp(NestedPattern->getTemplatedDecl(),
Typedef->getDeclContext()))
128 QualType RebuildTemplateSpecializationType(
130 SourceLocation TemplateNameLoc, TemplateArgumentListInfo &TemplateArgs) {
131 if (!OuterInstantiationArgs ||
132 !isa_and_present<TypeAliasTemplateDecl>(
Template.getAsTemplateDecl()))
137 auto *Pattern = TATD;
138 while (Pattern->getInstantiatedFromMemberTemplate())
139 Pattern = Pattern->getInstantiatedFromMemberTemplate();
140 if (!mightReferToOuterTemplateParameters(Pattern->getTemplatedDecl()))
145 TypedefNameInstantiator->InstantiateTypeAliasTemplateDecl(TATD);
150 MaterializedTypedefs.push_back(NewTATD->getTemplatedDecl());
156 QualType TransformTypedefType(TypeLocBuilder &TLB, TypedefTypeLoc TL) {
158 TypedefNameDecl *OrigDecl = TL.
getDecl();
159 TypedefNameDecl *
Decl = OrigDecl;
177 if (OuterInstantiationArgs && InDependentContext &&
179 Decl = cast_if_present<TypedefNameDecl>(
180 TypedefNameInstantiator->InstantiateTypedefNameDecl(
184 MaterializedTypedefs.push_back(Decl);
185 }
else if (InDependentContext) {
186 TypeLocBuilder InnerTLB;
187 QualType Transformed =
200 MaterializedTypedefs.push_back(Decl);
205 QualifierLoc = getDerived().TransformNestedNameSpecifierLoc(QualifierLoc);
232 auto DeductionGuideName =
245 if (IsImplicit && Ctor && SemaRef.
getLangOpts().CUDA) {
250 auto *ExistingFT = dyn_cast<FunctionTemplateDecl>(Existing);
251 auto *ExistingGuide =
253 ? dyn_cast<CXXDeductionGuideDecl>(ExistingFT->getTemplatedDecl())
275 ExistingCtor->getAssociatedConstraints(ExistingACs);
277 if (HaveSameAssociatedConstraints(SemaRef, ExistingCtor, ExistingACs,
279 return ExistingGuide;
284 SemaRef.
Context, DC, LocStart, ES, Name, GuideType, TInfo, LocEnd, Ctor,
286 Guide->setImplicit(IsImplicit);
287 Guide->setParams(Params);
289 for (
auto *Param : Params)
290 Param->setDeclContext(Guide);
291 for (
auto *TD : MaterializedTypedefs)
292 TD->setDeclContext(Guide);
296 if (!TemplateParams) {
302 SemaRef.
Context, DC, Loc, DeductionGuideName, TemplateParams, Guide);
303 GuideTemplate->setImplicit(IsImplicit);
304 Guide->setDescribedFunctionTemplate(GuideTemplate);
318 unsigned NewIndex,
bool EvaluateConstraint) {
334 NewTTP->setDefaultArgument(SemaRef.
Context, InstantiatedDefaultArg);
360 ExpandedTypeSourceInfos[I] = NewTSI;
361 ExpandedTypes[I] = NewT;
383 if (AutoLoc.isConstrained()) {
388 else if (
auto *Constraint = dyn_cast_if_present<CXXFoldExpr>(
390 EllipsisLoc = Constraint->getEllipsisLoc();
397 llvm_unreachable(
"unexpected failure attaching type constraint");
420 unsigned NewDepth,
bool EvaluateConstraint);
426 bool EvaluateConstraint) {
433 ExpandedTPLs[I] = transformTemplateParameters(
435 NewDepth + 1, EvaluateConstraint);
444 Args, NewDepth + 1, EvaluateConstraint);
469 unsigned NewIndex,
unsigned NewDepth,
470 bool EvaluateConstraint =
true) {
471 if (
auto *TTP = dyn_cast<TemplateTypeParmDecl>(
TemplateParam))
472 return transformTemplateParam(SemaRef, DC, TTP, Args, NewDepth, NewIndex,
474 if (
auto *NTTP = dyn_cast<NonTypeTemplateParmDecl>(
TemplateParam))
475 return transformTemplateParam(SemaRef, DC, NTTP, NewDepth, NewIndex, Args);
476 if (
auto *TTP = dyn_cast<TemplateTemplateParmDecl>(
TemplateParam))
477 return transformTemplateParam(SemaRef, DC, TTP, NewDepth, NewIndex, Args,
479 llvm_unreachable(
"Unhandled template parameter types");
486 unsigned NewDepth,
bool EvaluateConstraint) {
488 for (
unsigned I = 0, E = TPL->
size(); I < E; ++I) {
489 Params[I] = transformTemplateParameter(SemaRef, DC, TPL->
getParam(I), Args,
500struct ConvertConstructorToDeductionGuideTransform {
501 ConvertConstructorToDeductionGuideTransform(Sema &S,
502 ClassTemplateDecl *Template)
503 : SemaRef(S), Template(Template) {
506 ClassTemplateDecl *Pattern = Template;
508 if (Pattern->isMemberSpecialization())
510 Pattern = Pattern->getInstantiatedFromMemberTemplate();
511 NestedPattern = Pattern;
515 OuterInstantiationArgs = SemaRef.getTemplateInstantiationArgs(Template);
519 ClassTemplateDecl *Template;
520 ClassTemplateDecl *NestedPattern =
nullptr;
522 DeclContext *DC = Template->getDeclContext();
523 CXXRecordDecl *Primary = Template->getTemplatedDecl();
524 DeclarationName DeductionGuideName =
525 SemaRef.Context.DeclarationNames.getCXXDeductionGuideName(Template);
527 QualType DeducedType = SemaRef.Context.getCanonicalTagType(Primary);
531 unsigned Depth1IndexAdjustment = Template->getTemplateParameters()->size();
535 MultiLevelTemplateArgumentList OuterInstantiationArgs;
538 NamedDecl *transformConstructor(FunctionTemplateDecl *FTD,
539 CXXConstructorDecl *CD) {
540 SmallVector<TemplateArgument, 16> SubstArgs;
542 LocalInstantiationScope Scope(SemaRef);
551 TemplateParameterList *TemplateParams =
552 SemaRef.GetTemplateParameterList(Template);
553 SmallVector<TemplateArgument, 16> Depth1Args;
557 SmallVector<NamedDecl *, 16> AllParams;
558 AllParams.reserve(TemplateParams->
size() + InnerParams->
size());
559 AllParams.insert(AllParams.begin(), TemplateParams->
begin(),
560 TemplateParams->
end());
561 SubstArgs.reserve(InnerParams->
size());
562 Depth1Args.reserve(InnerParams->
size());
566 for (NamedDecl *Param : *InnerParams) {
567 MultiLevelTemplateArgumentList Args;
568 Args.
setKind(TemplateSubstitutionKind::Rewrite);
578 NamedDecl *NewParam = transformTemplateParameter(
579 SemaRef, DC, Param, Args, Index + Depth1IndexAdjustment,
580 Depth ? Depth - 1 : 0);
585 Depth1Args.push_back(SemaRef.Context.getInjectedTemplateArg(NewParam));
589 NewParam = transformTemplateParameter(
590 SemaRef, DC, NewParam, OuterInstantiationArgs, Index,
591 Depth - OuterInstantiationArgs.getNumSubstitutedLevels(),
596 "Unexpected template parameter depth");
598 AllParams.push_back(NewParam);
599 SubstArgs.push_back(SemaRef.Context.getInjectedTemplateArg(NewParam));
603 Expr *RequiresClause =
nullptr;
604 if (Expr *InnerRC = InnerParams->getRequiresClause()) {
605 MultiLevelTemplateArgumentList Args;
606 Args.
setKind(TemplateSubstitutionKind::Rewrite);
612 SemaRef.SubstConstraintExprWithoutSatisfaction(InnerRC, Args);
615 RequiresClause = E.
get();
618 TemplateParams = TemplateParameterList::Create(
619 SemaRef.Context, InnerParams->getTemplateLoc(),
620 InnerParams->getLAngleLoc(), AllParams, InnerParams->getRAngleLoc(),
627 MultiLevelTemplateArgumentList Args;
628 Args.
setKind(TemplateSubstitutionKind::Rewrite);
637 assert(FPTL &&
"no prototype for constructor declaration");
643 SmallVector<ParmVarDecl *, 8> Params;
644 SmallVector<TypedefNameDecl *, 4> MaterializedTypedefs;
645 QualType NewType = transformFunctionProtoType(TLB, FPTL, Params, Args,
646 MaterializedTypedefs);
654 AssociatedConstraint FunctionTrailingRC;
656 MultiLevelTemplateArgumentList Args;
657 Args.
setKind(TemplateSubstitutionKind::Rewrite);
662 ExprResult E = SemaRef.SubstConstraintExprWithoutSatisfaction(
663 const_cast<Expr *
>(RC.ConstraintExpr), Args);
666 FunctionTrailingRC = AssociatedConstraint(E.
get(), RC.ArgPackSubstIndex);
681 if (!FunctionTrailingRC)
682 FunctionTrailingRC = OuterRC;
684 FunctionTrailingRC = AssociatedConstraint(
687 const_cast<Expr *
>(OuterRC.ConstraintExpr),
694 return buildDeductionGuide(
697 true, MaterializedTypedefs, FunctionTrailingRC);
701 CXXDeductionGuideDecl *
702 buildSimpleDeductionGuide(MutableArrayRef<QualType> ParamTypes) {
703 SourceLocation Loc = Template->getLocation();
706 FunctionProtoType::ExtProtoInfo EPI;
708 QualType
Result = SemaRef.BuildFunctionType(DeducedType, ParamTypes, Loc,
709 DeductionGuideName, EPI);
710 TypeSourceInfo *TSI = SemaRef.Context.getTrivialTypeSourceInfo(
Result, Loc);
712 TSI = SemaRef.SubstType(TSI, OuterInstantiationArgs, Loc,
718 FunctionProtoTypeLoc FPTL =
722 SmallVector<ParmVarDecl *, 4> Params;
723 for (
auto T : ParamTypes) {
724 auto *TSI = SemaRef.Context.getTrivialTypeSourceInfo(
T, Loc);
726 TSI = SemaRef.SubstType(TSI, OuterInstantiationArgs, Loc,
731 ParmVarDecl *NewParam =
735 FPTL.
setParam(Params.size(), NewParam);
736 Params.push_back(NewParam);
739 return buildDeductionGuide(
740 SemaRef, Template, SemaRef.GetTemplateParameterList(Template),
nullptr,
741 ExplicitSpecifier(), TSI, Loc, Loc, Loc,
true);
745 QualType transformFunctionProtoType(
746 TypeLocBuilder &TLB, FunctionProtoTypeLoc TL,
747 SmallVectorImpl<ParmVarDecl *> &Params,
748 MultiLevelTemplateArgumentList &Args,
749 SmallVectorImpl<TypedefNameDecl *> &MaterializedTypedefs) {
750 SmallVector<QualType, 4> ParamTypes;
755 ParmVarDecl *NewParam = OldParam;
766 NewParam = transformFunctionTypeParam(
767 NewParam, OuterInstantiationArgs, MaterializedTypedefs,
776 transformFunctionTypeParam(NewParam, Args, MaterializedTypedefs,
780 ParamTypes.push_back(NewParam->
getType());
781 Params.push_back(NewParam);
793 QualType ReturnType = DeducedType;
794 auto TTL = TLB.
push<TagTypeLoc>(ReturnType);
795 TTL.setElaboratedKeywordLoc(SourceLocation());
796 TTL.setQualifierLoc(NestedNameSpecifierLoc());
797 TTL.setNameLoc(Primary->getLocation());
801 FunctionProtoType::ExtProtoInfo EPI;
805 QualType
Result = SemaRef.BuildFunctionType(
806 ReturnType, ParamTypes, TL.
getBeginLoc(), DeductionGuideName, EPI);
810 FunctionProtoTypeLoc NewTL = TLB.
push<FunctionProtoTypeLoc>(
Result);
816 for (
unsigned I = 0, E = NewTL.
getNumParams(); I != E; ++I)
822 ParmVarDecl *transformFunctionTypeParam(
823 ParmVarDecl *OldParam, MultiLevelTemplateArgumentList &Args,
824 llvm::SmallVectorImpl<TypedefNameDecl *> &MaterializedTypedefs,
825 bool TransformingOuterPatterns) {
827 TypeSourceInfo *NewTSI;
828 if (
auto PackTL = OldTSI->
getTypeLoc().
getAs<PackExpansionTypeLoc>()) {
830 Sema::ArgPackSubstIndexRAII SubstIndex(SemaRef, 0u);
832 SemaRef.SubstType(PackTL.getPatternLoc(), Args,
837 SemaRef.CheckPackExpansion(NewTSI, PackTL.getEllipsisLoc(),
838 PackTL.getTypePtr()->getNumExpansions());
840 NewTSI = SemaRef.SubstType(OldTSI, Args, OldParam->
getLocation(),
849 NewTSI = ExtractTypeForDeductionGuide(
850 SemaRef, MaterializedTypedefs, NestedPattern,
851 TransformingOuterPatterns ? &Args :
nullptr)
861 QualType ParamTy = NewTSI->
getType();
862 NewDefArg =
new (SemaRef.Context)
870 auto NewType = NewTSI->
getType();
872 NewType = SemaRef.Context.getDecayedType(NewType);
880 SemaRef.CurrentInstantiationScope->InstantiatedLocal(OldParam, NewParam);
891 llvm::SmallBitVector ReferencedTemplateParams(TemplateParamsList->
size());
894 ReferencedTemplateParams);
896 auto MarkDefaultArgs = [&](
auto *Param) {
897 if (!Param->hasDefaultArgument())
900 Param->getDefaultArgument().getArgument(),
false,
901 TemplateParamsList->
getDepth(), ReferencedTemplateParams);
904 for (
unsigned Index = 0; Index < TemplateParamsList->
size(); ++Index) {
905 if (!ReferencedTemplateParams[Index])
907 auto *Param = TemplateParamsList->
getParam(Index);
908 if (
auto *TTPD = dyn_cast<TemplateTypeParmDecl>(Param))
909 MarkDefaultArgs(TTPD);
910 else if (
auto *NTTPD = dyn_cast<NonTypeTemplateParmDecl>(Param))
911 MarkDefaultArgs(NTTPD);
917 for (
unsigned Index = 0; Index < TemplateParamsList->
size(); ++Index) {
918 if (ReferencedTemplateParams[Index])
919 Results.push_back(Index);
929 "name must be a deduction guide name");
930 auto Existing = DC->
lookup(Name);
931 for (
auto *D : Existing)
939llvm::DenseSet<const NamedDecl *> getSourceDeductionGuides(
DeclarationName Name,
943 "name must be a deduction guide name");
944 llvm::DenseSet<const NamedDecl *>
Result;
945 for (
auto *D : DC->
lookup(Name)) {
946 if (
const auto *FTD = dyn_cast<FunctionTemplateDecl>(D))
949 if (
const auto *GD = dyn_cast<CXXDeductionGuideDecl>(D)) {
950 assert(GD->getSourceDeductionGuide() &&
951 "deduction guide for alias template must have a source deduction "
953 Result.insert(GD->getSourceDeductionGuide());
1010 unsigned AdjustDepth = 0;
1011 if (
auto *PrimaryTemplate =
1013 AdjustDepth = PrimaryTemplate->getTemplateDepth();
1021 for (
unsigned Index : DeducedAliasTemplateParams) {
1022 auto *TP =
AliasTemplate->getTemplateParameters()->getParam(Index);
1028 NamedDecl *NewParam = transformTemplateParameter(
1033 Context.getInjectedTemplateArg(NewParam);
1034 AdjustedAliasTemplateArgs[Index] = NewTemplateArgument;
1046 for (
unsigned Index = 0; Index < DeduceResults.size(); ++Index) {
1047 const auto &D = DeduceResults[Index];
1048 if (IsNonDeducedArgument(D)) {
1054 NamedDecl *NewParam = transformTemplateParameter(
1057 assert(TemplateArgsForBuildingRC[Index].isNull());
1058 TemplateArgsForBuildingRC[Index] =
1059 Context.getInjectedTemplateArg(NewParam);
1066 assert(TemplateArgsForBuildingRC[Index].isNull() &&
1067 "InstantiatedArgs must be null before setting");
1068 TemplateArgsForBuildingRC[Index] = Output.
getArgument();
1108 clang::Decl::ClassTemplateSpecialization) {
1111 false, std::nullopt,
1115 for (
auto It : OuterLevelArgs)
1125 BinaryOperatorKind::BO_LAnd, E.
get(), IsDeducible);
1126 if (Conjunction.isInvalid())
1134Expr *buildIsDeducibleConstraint(
Sema &SemaRef,
1140 if (
auto *PrimaryTemplate =
1142 PrimaryTemplate && TemplateParams.size() > 0) {
1146 unsigned AdjustDepth = PrimaryTemplate->getTemplateDepth();
1148 for (
auto *TP : TemplateParams) {
1154 NamedDecl *NewParam = transformTemplateParameter(
1156 TransformedTemplateArgs.size(),
1160 Context.getInjectedTemplateArg(NewParam);
1161 TransformedTemplateArgs.push_back(NewTemplateArgument);
1169 Context.DeclarationNames.getCXXDeductionGuideName(
AliasTemplate));
1173 Context.getTrivialTypeSourceInfo(
1174 Context.getDeducedTemplateSpecializationType(
1180 Context.getTrivialTypeSourceInfo(
1185 Context, Context.getLogicalOperationType(),
AliasTemplate->getLocation(),
1186 TypeTrait::BTT_IsDeducible, IsDeducibleTypeTraitArgs,
1190std::pair<TemplateDecl *, llvm::ArrayRef<TemplateArgument>>
1192 auto RhsType =
AliasTemplate->getTemplatedDecl()->getUnderlyingType();
1195 if (
const auto *TST = RhsType->getAs<TemplateSpecializationType>()) {
1199 Template = TST->getTemplateName().getAsTemplateDecl();
1200 AliasRhsTemplateArgs =
1201 TST->getAsNonAliasTemplateSpecializationType()->template_arguments();
1202 }
else if (
const auto *RT = RhsType->getAs<RecordType>()) {
1206 if (
const auto *CTSD =
1207 dyn_cast<ClassTemplateSpecializationDecl>(RT->getDecl())) {
1208 Template = CTSD->getSpecializedTemplate();
1209 AliasRhsTemplateArgs = CTSD->getTemplateArgs().asArray();
1212 return {
Template, AliasRhsTemplateArgs};
1222 assert(F &&
"deduction guide for alias template must be a function template");
1229 if (BuildingDeductionGuides.isInvalid())
1232 auto &Context = SemaRef.
Context;
1233 auto [
Template, AliasRhsTemplateArgs] =
1256 const auto *FReturnType = RType->
getAs<TemplateSpecializationType>();
1257 if (
const auto *ICNT = RType->getAsCanonical<InjectedClassNameType>())
1260 ICNT->getDecl()->getCanonicalTemplateSpecializationType(
1265 FReturnTemplateArgs = FReturnType->template_arguments();
1266 }
else if (
const auto *RT = RType->getAs<RecordType>()) {
1269 if (
const auto *CTSD = dyn_cast<ClassTemplateSpecializationDecl>(RT->getDecl()))
1270 FReturnTemplateArgs = CTSD->getTemplateArgs().asArray();
1272 assert(!FReturnTemplateArgs.empty() &&
"expected to see template arguments");
1306 AliasRhsTemplateArgs, TDeduceInfo, DeduceResults,
1313 for (
unsigned Index = 0; Index < DeduceResults.size(); ++Index) {
1314 const auto &D = DeduceResults[Index];
1315 if (!IsNonDeducedArgument(D))
1316 DeducedArgs.push_back(D);
1318 NonDeducedTemplateParamsInFIndex.push_back(Index);
1320 auto DeducedAliasTemplateParams =
1321 TemplateParamsReferencedInTemplateArgumentList(
1322 SemaRef,
AliasTemplate->getTemplateParameters(), DeducedArgs);
1344 for (
unsigned AliasTemplateParamIdx : DeducedAliasTemplateParams) {
1346 AliasTemplate->getTemplateParameters()->getParam(AliasTemplateParamIdx);
1352 NamedDecl *NewParam = transformTemplateParameter(
1355 FPrimeTemplateParams.push_back(NewParam);
1358 Context.getInjectedTemplateArg(NewParam);
1359 TransformedDeducedAliasArgs[AliasTemplateParamIdx] = NewTemplateArgument;
1380 for (
unsigned Index = 0; Index < DeduceResults.size(); ++Index) {
1381 const auto &D = DeduceResults[Index];
1383 if (IsNonDeducedArgument(D)) {
1392 assert(TemplateArgsForBuildingFPrime[Index].isNull() &&
1393 "InstantiatedArgs must be null before setting");
1410 TemplateArgsForBuildingFPrime[Index] =
1421 for (
unsigned FTemplateParamIdx : NonDeducedTemplateParamsInFIndex) {
1428 NamedDecl *NewParam = transformTemplateParameter(
1429 SemaRef, F->
getDeclContext(), TP, Args, FPrimeTemplateParams.size(),
1431 FPrimeTemplateParams.push_back(NewParam);
1433 assert(TemplateArgsForBuildingFPrime[FTemplateParamIdx].isNull() &&
1434 "The argument must be null before setting");
1435 TemplateArgsForBuildingFPrime[FTemplateParamIdx] =
1436 Context.getInjectedTemplateArg(NewParam);
1439 auto *TemplateArgListForBuildingFPrime =
1443 F, TemplateArgListForBuildingFPrime,
AliasTemplate->getLocation(),
1447 Expr *IsDeducible = buildIsDeducibleConstraint(
1448 SemaRef,
AliasTemplate, FPrime->getReturnType(), FPrimeTemplateParams);
1449 Expr *RequiresClause =
1450 buildAssociatedConstraints(SemaRef, F,
AliasTemplate, DeduceResults,
1451 DeducedAliasTemplateParams, IsDeducible);
1454 if (!FPrimeTemplateParams.empty())
1456 Context,
AliasTemplate->getTemplateParameters()->getTemplateLoc(),
1458 FPrimeTemplateParams,
1462 auto *DGuide = buildDeductionGuide(
1464 GG->getCorrespondingConstructor(), GG->getExplicitSpecifier(),
1468 DGuide->setDeductionCandidateKind(GG->getDeductionCandidateKind());
1469 DGuide->setSourceDeductionGuide(SourceDeductionGuide);
1470 DGuide->setSourceDeductionGuideKind(
1477void DeclareImplicitDeductionGuidesForTypeAlias(
1481 auto &Context = SemaRef.
Context;
1482 auto [
Template, AliasRhsTemplateArgs] =
1486 auto SourceDeductionGuides = getSourceDeductionGuides(
1487 Context.DeclarationNames.getCXXDeductionGuideName(
AliasTemplate),
1491 Context.DeclarationNames.getCXXDeductionGuideName(
Template), Loc);
1494 Guides.suppressDiagnostics();
1496 for (
auto *G : Guides) {
1497 if (
auto *DG = dyn_cast<CXXDeductionGuideDecl>(G)) {
1498 if (SourceDeductionGuides.contains(DG))
1507 for (
unsigned I = 0, N = DG->getNumParams(); I != N; ++I) {
1508 const auto *P = DG->getParamDecl(I);
1511 SemaRef.
Context, G->getDeclContext(),
1512 DG->getParamDecl(I)->getBeginLoc(), P->getLocation(),
nullptr,
1517 auto *Transformed = buildDeductionGuide(
1522 Transformed->setSourceDeductionGuide(DG);
1523 Transformed->setSourceDeductionGuideKind(
1534 BinaryOperatorKind::BO_LAnd,
const_cast<Expr *
>(RC.ConstraintExpr),
1535 const_cast<Expr *
>(Constraint.ConstraintExpr));
1536 if (!Conjunction.isInvalid()) {
1537 Constraint.ConstraintExpr = Conjunction.getAs<
Expr>();
1538 Constraint.ArgPackSubstIndex = RC.ArgPackSubstIndex;
1541 Transformed->setTrailingRequiresClause(Constraint);
1554 BuildDeductionGuideForTypeAlias(SemaRef,
AliasTemplate, DGuide, Loc);
1569 ExtractTypeForDeductionGuide TypeAliasTransformer(SemaRef, TypedefDecls);
1574 NewParamTypes.push_back(
Type);
1578 RHSTemplate, NewParamTypes, Loc);
1579 if (!RHSDeductionGuide)
1585 return BuildDeductionGuideForTypeAlias(SemaRef,
AliasTemplate,
1586 RHSDeductionGuide, Loc);
1594 llvm::FoldingSetNodeID ID;
1596 for (
auto &
T : ParamTypes)
1597 T.getCanonicalType().Profile(ID);
1598 unsigned Hash = ID.computeHash();
1602 return Found->getSecond();
1605 if (
auto *GD = DeclareAggregateDeductionGuideForTypeAlias(
1617 DefRecord->getDescribedClassTemplate())
1625 ConvertConstructorToDeductionGuideTransform Transform(
1638 if (BuildingDeductionGuides.isInvalid())
1642 Transform.NestedPattern ? Transform.NestedPattern : Transform.Template;
1655 DeclareImplicitDeductionGuidesForTypeAlias(*
this,
AliasTemplate, Loc);
1659 dyn_cast_or_null<CXXRecordDecl>(
Template->getTemplatedDecl());
1672 ConvertConstructorToDeductionGuideTransform Transform(
1677 if (hasDeclaredDeductionGuides(Transform.DeductionGuideName, DC))
1688 if (BuildingDeductionGuides.isInvalid())
1696 Transform.NestedPattern ? Transform.NestedPattern : Transform.Template;
1699 bool AddedAny =
false;
1701 D = D->getUnderlyingDecl();
1702 if (D->isInvalidDecl() || D->isImplicit())
1710 if (ProcessedCtors.count(D))
1713 auto *FTD = dyn_cast<FunctionTemplateDecl>(D);
1723 return !P || P->hasUnparsedDefaultArg();
1727 ProcessedCtors.insert(D);
1728 Transform.transformConstructor(FTD, CD);
1737 Transform.buildSimpleDeductionGuide({});
1741 Transform.buildSimpleDeductionGuide(Transform.DeducedType)
Defines the clang::ASTContext interface.
Defines enumerations for traits support.
Defines the C++ Decl subclasses, other than those for templates (found in DeclTemplate....
This file defines the classes used to store parsed information about declaration-specifiers and decla...
Defines the C++ template declaration subclasses.
Defines the clang::Expr interface and subclasses for C++ expressions.
Result
Implement __builtin_bit_cast and related operations.
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified.
Defines the clang::SourceLocation class and associated facilities.
Defines various enumerations that describe declaration and type specifiers.
Defines the clang::TypeLoc interface and its subclasses.
C Language Family Type Representation.
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
TranslationUnitDecl * getTranslationUnitDecl() const
DeclarationNameTable DeclarationNames
TypeSourceInfo * getTrivialTypeSourceInfo(QualType T, SourceLocation Loc=SourceLocation()) const
Allocate a TypeSourceInfo where all locations have been initialized to a given location,...
QualType getTypedefType(ElaboratedTypeKeyword Keyword, NestedNameSpecifier Qualifier, const TypedefNameDecl *Decl, QualType UnderlyingType=QualType(), std::optional< bool > TypeMatchesDeclOrNone=std::nullopt) const
Return the unique reference to the type for the specified typedef-name decl.
static BinaryOperator * Create(const ASTContext &C, Expr *lhs, Expr *rhs, Opcode opc, QualType ResTy, ExprValueKind VK, ExprObjectKind OK, SourceLocation opLoc, FPOptionsOverride FPFeatures)
Represents a C++ constructor within a class.
ExplicitSpecifier getExplicitSpecifier() const
Represents a C++ deduction guide declaration.
void setDeductionCandidateKind(DeductionCandidate K)
static CXXDeductionGuideDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StartLoc, ExplicitSpecifier ES, const DeclarationNameInfo &NameInfo, QualType T, TypeSourceInfo *TInfo, SourceLocation EndLocation, CXXConstructorDecl *Ctor=nullptr, DeductionCandidate Kind=DeductionCandidate::Normal, const AssociatedConstraint &TrailingRequiresClause={}, const CXXDeductionGuideDecl *SourceDG=nullptr, SourceDeductionGuideKind SK=SourceDeductionGuideKind::None)
CXXConstructorDecl * getCorrespondingConstructor() const
Get the constructor from which this deduction guide was generated, if this is an implicit deduction g...
Represents a C++ struct/union/class.
CXXRecordDecl * getDefinition() const
Declaration of a class template.
CXXRecordDecl * getTemplatedDecl() const
Get the underlying class declarations of the template.
ClassTemplateDecl * getInstantiatedFromMemberTemplate() const
const TypeClass * getTypePtr() const
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
DeclContext * getParent()
getParent - Returns the containing DeclContext.
bool Equals(const DeclContext *DC) const
Determine whether this declaration context is equivalent to the declaration context DC.
bool isDependentContext() const
Determines whether this context is dependent on a template parameter.
lookup_result lookup(DeclarationName Name) const
lookup - Find the declarations (if any) with the given Name in this context.
void addDecl(Decl *D)
Add the declaration D into this context.
Decl::Kind getDeclKind() const
SourceLocation getEndLoc() const LLVM_READONLY
bool isImplicit() const
isImplicit - Indicates whether the declaration was implicitly generated by the implementation.
void setAccess(AccessSpecifier AS)
SourceLocation getLocation() const
void setImplicit(bool I=true)
DeclContext * getDeclContext()
void setDeclContext(DeclContext *DC)
setDeclContext - Set both the semantic and lexical DeclContext to DC.
DeclContext * getLexicalDeclContext()
getLexicalDeclContext - The declaration context where this Decl was lexically declared (LexicalDC).
The name of a declaration.
NameKind getNameKind() const
Determine what kind of name this is.
SourceLocation getInnerLocStart() const
Return start of source range ignoring outer template declarations.
SourceLocation getBeginLoc() const LLVM_READONLY
const AssociatedConstraint & getTrailingRequiresClause() const
Get the constraint-expression introduced by the trailing requires-clause in the function/member decla...
TypeSourceInfo * getTypeSourceInfo() const
SourceLocation getElaboratedKeywordLoc() const
SourceLocation getNameLoc() const
NestedNameSpecifierLoc getQualifierLoc() const
Store information needed for an explicit specifier.
This represents one expression.
bool isFunctionTemplateSpecialization() const
Determine whether this function is a function template specialization.
FunctionTemplateDecl * getDescribedFunctionTemplate() const
Retrieves the function template that is described by this function declaration.
QualType getReturnType() const
ArrayRef< ParmVarDecl * > parameters() const
void getAssociatedConstraints(SmallVectorImpl< AssociatedConstraint > &ACs) const
Get the associated-constraints of this function declaration.
bool isVariadic() const
Whether this function prototype is variadic.
Declaration of a template function.
FunctionDecl * getTemplatedDecl() const
Get the underlying function declaration of the template.
static FunctionTemplateDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation L, DeclarationName Name, TemplateParameterList *Params, NamedDecl *Decl)
Create a function template node.
unsigned getNumParams() const
SourceLocation getLocalRangeEnd() const
void setLocalRangeBegin(SourceLocation L)
void setLParenLoc(SourceLocation Loc)
void setParam(unsigned i, ParmVarDecl *VD)
ArrayRef< ParmVarDecl * > getParams() const
void setRParenLoc(SourceLocation Loc)
void setLocalRangeEnd(SourceLocation L)
void setExceptionSpecRange(SourceRange R)
SourceLocation getLocalRangeBegin() const
SourceLocation getLParenLoc() const
SourceLocation getRParenLoc() const
FunctionType - C99 6.7.5.3 - Function Declarators.
const TypeClass * getTypePtr() const
A stack-allocated class that identifies which local variable declaration instantiations are present i...
void InstantiatedLocal(const Decl *D, Decl *Inst)
Represents the results of name lookup.
Data structure that captures multiple levels of template argument lists for use in template instantia...
void addOuterRetainedLevel()
Add an outermost level that we are not substituting.
void addOuterTemplateArguments(Decl *AssociatedDecl, ArgList Args, bool Final)
Add a new outmost level to the multi-level template argument list.
void setKind(TemplateSubstitutionKind K)
void addOuterRetainedLevels(unsigned Num)
This represents a decl that may have a name.
IdentifierInfo * getIdentifier() const
Get the identifier that names this declaration, if there is one.
DeclarationName getDeclName() const
Get the actual, stored name of the declaration, which may be a special name.
NestedNameSpecifier getNestedNameSpecifier() const
Retrieve the nested-name-specifier to which this instance refers.
NonTypeTemplateParmDecl - Declares a non-type template parameter, e.g., "Size" in.
SourceLocation getDefaultArgumentLoc() const
Retrieve the location of the default argument, if any.
static NonTypeTemplateParmDecl * Create(const ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, int D, int P, const IdentifierInfo *Id, QualType T, bool ParameterPack, TypeSourceInfo *TInfo)
bool hasDefaultArgument() const
Determine whether this template parameter has a default argument.
TypeSourceInfo * getExpansionTypeSourceInfo(unsigned I) const
Retrieve a particular expansion type source info within an expanded parameter pack.
unsigned getNumExpansionTypes() const
Retrieves the number of expansion types in an expanded parameter pack.
const TemplateArgumentLoc & getDefaultArgument() const
Retrieve the default argument, if any.
bool isExpandedParameterPack() const
Whether this parameter is a non-type template parameter pack that has a known list of different types...
bool isParameterPack() const
Whether this parameter is a non-type template parameter pack.
Expr * getPlaceholderTypeConstraint() const
Return the constraint introduced by the placeholder type of this non-type template parameter (if any)...
void setDefaultArgument(const ASTContext &C, const TemplateArgumentLoc &DefArg)
Set the default argument for this template parameter, and whether that default argument was inherited...
Represents a parameter to a function.
unsigned getFunctionScopeIndex() const
Returns the index of this parameter in its prototype or method scope.
SourceRange getDefaultArgRange() const
Retrieve the source range that covers the entire default argument.
void setScopeInfo(unsigned scopeDepth, unsigned parameterIndex)
static ParmVarDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, const IdentifierInfo *Id, QualType T, TypeSourceInfo *TInfo, StorageClass S, Expr *DefArg)
bool hasDefaultArg() const
Determines whether this parameter has a default argument, either parsed or not.
unsigned getFunctionScopeDepth() const
A (possibly-)qualified type.
QualType getNonLValueExprType(const ASTContext &Context) const
Determine the type of a (typically non-lvalue) expression with the specified result type.
bool isNull() const
Return true if this QualType doesn't point to a type yet.
Scope - A scope is a transient data structure that is used while parsing the program.
RAII object used to change the argument pack substitution index within a Sema object.
Sema - This implements semantic analysis and AST building for C.
bool SubstTypeConstraint(TemplateTypeParmDecl *Inst, const TypeConstraint *TC, const MultiLevelTemplateArgumentList &TemplateArgs, bool EvaluateConstraint)
LocalInstantiationScope * CurrentInstantiationScope
The current instantiation scope used to store local variables.
Scope * getCurScope() const
Retrieve the parser's current scope.
bool IsOverload(FunctionDecl *New, FunctionDecl *Old, bool UseMemberUsingDeclRules, bool ConsiderCudaAttrs=true)
@ LookupOrdinaryName
Ordinary name lookup, which finds ordinary names (functions, variables, typedefs, etc....
FunctionDecl * InstantiateFunctionDeclaration(FunctionTemplateDecl *FTD, const TemplateArgumentList *Args, SourceLocation Loc, CodeSynthesisContext::SynthesisKind CSC=CodeSynthesisContext::ExplicitTemplateArgumentSubstitution)
Instantiate (or find existing instantiation of) a function template with a given set of template argu...
@ CTAK_Specified
The template argument was specified in the code or was instantiated with some deduced template argume...
ExprResult SubstExpr(Expr *E, const MultiLevelTemplateArgumentList &TemplateArgs)
bool AttachTypeConstraint(NestedNameSpecifierLoc NS, DeclarationNameInfo NameInfo, TemplateName NamedConcept, NamedDecl *FoundDecl, const TemplateArgumentListInfo *TemplateArgs, TemplateTypeParmDecl *ConstrainedParameter, SourceLocation EllipsisLoc)
Attach a type-constraint to a template parameter.
ASTContext & getASTContext() const
TypeSourceInfo * SubstType(TypeSourceInfo *T, const MultiLevelTemplateArgumentList &TemplateArgs, SourceLocation Loc, DeclarationName Entity, bool AllowDeducedTST=false)
Perform substitution on the type T with a given set of template arguments.
bool SubstTemplateArguments(ArrayRef< TemplateArgumentLoc > Args, const MultiLevelTemplateArgumentList &TemplateArgs, TemplateArgumentListInfo &Outputs)
bool CheckTemplateArgument(NamedDecl *Param, TemplateArgumentLoc &Arg, NamedDecl *Template, SourceLocation TemplateLoc, SourceLocation RAngleLoc, unsigned ArgumentPackIndex, CheckTemplateArgumentInfo &CTAI, CheckTemplateArgumentKind CTAK)
Check that the given template argument corresponds to the given template parameter.
const LangOptions & getLangOpts() const
llvm::DenseMap< unsigned, CXXDeductionGuideDecl * > AggregateDeductionCandidates
bool AreConstraintExpressionsEqual(const NamedDecl *Old, const Expr *OldConstr, const TemplateCompareNewDeclInfo &New, const Expr *NewConstr)
TemplateArgumentLoc getTrivialTemplateArgumentLoc(const TemplateArgument &Arg, QualType NTTPType, SourceLocation Loc)
Allocate a TemplateArgumentLoc where all locations have been initialized to the given location.
MultiLevelTemplateArgumentList getTemplateInstantiationArgs(const NamedDecl *D, const DeclContext *DC=nullptr, bool Final=false, std::optional< ArrayRef< TemplateArgument > > Innermost=std::nullopt, bool RelativeToPrimary=false, const FunctionDecl *Pattern=nullptr, bool ForConstraintInstantiation=false, bool SkipForSpecialization=false, bool ForDefaultArgumentSubstitution=false)
Retrieve the template argument list(s) that should be used to instantiate the definition of the given...
void DeclareImplicitDeductionGuides(TemplateDecl *Template, SourceLocation Loc)
Declare implicit deduction guides for a class template if we've not already done so.
QualType CheckNonTypeTemplateParameterType(TypeSourceInfo *&TSI, SourceLocation Loc)
Check that the type of a non-type template parameter is well-formed.
bool isCompleteType(SourceLocation Loc, QualType T, CompleteTypeKind Kind=CompleteTypeKind::Default)
bool SubstTemplateArgument(const TemplateArgumentLoc &Input, const MultiLevelTemplateArgumentList &TemplateArgs, TemplateArgumentLoc &Output, SourceLocation Loc={}, const DeclarationName &Entity={})
void MarkUsedTemplateParameters(const Expr *E, bool OnlyDeduced, unsigned Depth, llvm::SmallBitVector &Used)
Mark which template parameters are used in a given expression.
bool LookupQualifiedName(LookupResult &R, DeclContext *LookupCtx, bool InUnqualifiedLookup=false)
Perform qualified name lookup into a given context.
ExprResult BuildBinOp(Scope *S, SourceLocation OpLoc, BinaryOperatorKind Opc, Expr *LHSExpr, Expr *RHSExpr, bool ForFoldExpression=false)
CXXDeductionGuideDecl * DeclareAggregateDeductionGuideFromInitList(TemplateDecl *Template, MutableArrayRef< QualType > ParamTypes, SourceLocation Loc)
TemplateDeductionResult DeduceTemplateArguments(ClassTemplatePartialSpecializationDecl *Partial, ArrayRef< TemplateArgument > TemplateArgs, sema::TemplateDeductionInfo &Info)
DeclContextLookupResult LookupConstructors(CXXRecordDecl *Class)
Look up the constructors for the given class.
Encodes a location in the source.
SourceLocation getBegin() const
A convenient class for passing around template argument information.
ArrayRef< TemplateArgumentLoc > arguments() const
static TemplateArgumentList * CreateCopy(ASTContext &Context, ArrayRef< TemplateArgument > Args)
Create a new template argument list that copies the given set of template arguments.
Location wrapper for a TemplateArgument.
const TemplateArgument & getArgument() const
Represents a template argument.
static TemplateArgument CreatePackCopy(ASTContext &Context, ArrayRef< TemplateArgument > Args)
Create a new template argument pack by copying the given set of template arguments.
bool isNull() const
Determine whether this template argument has no value.
ArrayRef< TemplateArgument > pack_elements() const
Iterator range referencing all of the elements of a template argument pack.
@ Pack
The template argument is actually a parameter pack.
ArgKind getKind() const
Return the kind of stored template argument.
The base class of all kinds of template declarations (e.g., class, function, etc.).
TemplateParameterList * getTemplateParameters() const
Get the list of template parameters.
Stores a list of template parameters for a TemplateDecl and its derived classes.
NamedDecl * getParam(unsigned Idx)
unsigned getDepth() const
Get the depth of this template parameter list in the set of template parameter lists.
static TemplateParameterList * Create(const ASTContext &C, SourceLocation TemplateLoc, SourceLocation LAngleLoc, ArrayRef< NamedDecl * > Params, SourceLocation RAngleLoc, Expr *RequiresClause)
Expr * getRequiresClause()
The constraint-expression of the associated requires-clause.
SourceLocation getRAngleLoc() const
SourceLocation getLAngleLoc() const
SourceLocation getTemplateLoc() const
TemplateTemplateParmDecl - Declares a template template parameter, e.g., "T" in.
bool wasDeclaredWithTypename() const
Whether this template template parameter was declared with the 'typename' keyword.
TemplateParameterList * getExpansionTemplateParameters(unsigned I) const
Retrieve a particular expansion type within an expanded parameter pack.
unsigned getNumExpansionTemplateParameters() const
Retrieves the number of expansion template parameters in an expanded parameter pack.
TemplateNameKind templateParameterKind() const
const TemplateArgumentLoc & getDefaultArgument() const
Retrieve the default argument, if any.
SourceLocation getDefaultArgumentLoc() const
Retrieve the location of the default argument, if any.
bool isParameterPack() const
Whether this template template parameter is a template parameter pack.
static TemplateTemplateParmDecl * Create(const ASTContext &C, DeclContext *DC, SourceLocation L, int D, int P, bool ParameterPack, IdentifierInfo *Id, TemplateNameKind ParameterKind, bool Typename, TemplateParameterList *Params)
void setDefaultArgument(const ASTContext &C, const TemplateArgumentLoc &DefArg)
Set the default argument for this template parameter, and whether that default argument was inherited...
bool isExpandedParameterPack() const
Whether this parameter is a template template parameter pack that has a known list of different templ...
bool hasDefaultArgument() const
Determine whether this template parameter has a default argument.
Declaration of a template type parameter.
bool wasDeclaredWithTypename() const
Whether this template type parameter was declared with the 'typename' keyword.
SourceLocation getDefaultArgumentLoc() const
Retrieves the location of the default argument declaration.
const TemplateArgumentLoc & getDefaultArgument() const
Retrieve the default argument, if any.
bool hasTypeConstraint() const
Determine whether this template parameter has a type-constraint.
static TemplateTypeParmDecl * Create(const ASTContext &C, DeclContext *DC, SourceLocation KeyLoc, SourceLocation NameLoc, int D, int P, IdentifierInfo *Id, bool Typename, bool ParameterPack, bool HasTypeConstraint=false, UnsignedOrNone NumExpanded=std::nullopt)
const TypeConstraint * getTypeConstraint() const
Returns the type constraint associated with this template parameter (if any).
UnsignedOrNone getNumExpansionParameters() const
Whether this parameter is a template type parameter pack that has a known list of different type-cons...
bool hasDefaultArgument() const
Determine whether this template parameter has a default argument.
bool isParameterPack() const
Returns whether this is a parameter pack.
static TypeAliasDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, const IdentifierInfo *Id, TypeSourceInfo *TInfo)
Declaration of an alias template.
SourceLocation getBeginLoc() const LLVM_READONLY
TyLocType push(QualType T)
Pushes space for a new TypeLoc of the given type.
TypeSourceInfo * getTypeSourceInfo(ASTContext &Context, QualType T)
Creates a TypeSourceInfo for the given type.
T getAs() const
Convert to the specified TypeLoc type, returning a null TypeLoc if this TypeLoc is not of the desired...
T castAs() const
Convert to the specified TypeLoc type, asserting that this TypeLoc is of the desired type.
AutoTypeLoc getContainedAutoTypeLoc() const
Get the typeloc of an AutoType whose type will be deduced for a variable with an initializer of this ...
T getAsAdjusted() const
Convert to the specified TypeLoc type, returning a null TypeLoc if this TypeLoc is not of the desired...
SourceLocation getBeginLoc() const
Get the begin source location.
A container of type source information.
TypeLoc getTypeLoc() const
Return the TypeLoc wrapper for the type source info.
QualType getType() const
Return the type wrapped by this type source info.
static TypeTraitExpr * Create(const ASTContext &C, QualType T, SourceLocation Loc, TypeTrait Kind, ArrayRef< TypeSourceInfo * > Args, SourceLocation RParenLoc, bool Value)
Create a new type trait expression.
The base class of the type hierarchy.
bool isRValueReferenceType() const
const T * castAs() const
Member-template castAs<specific type>.
bool isInstantiationDependentType() const
Determine whether this type is an instantiation-dependent type, meaning that the type involves a temp...
bool isLValueReferenceType() const
bool isFunctionType() const
const T * getAs() const
Member-template getAs<specific type>'.
static TypedefDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, const IdentifierInfo *Id, TypeSourceInfo *TInfo)
Base class for declarations which introduce a typedef-name.
TypeSourceInfo * getTypeSourceInfo() const
StorageClass getStorageClass() const
Returns the storage class as written in the source.
Provides information about an attempted template argument deduction, whose success or failure was des...
std::variant< struct RequiresDecl, struct HeaderDecl, struct UmbrellaDirDecl, struct ModuleDecl, struct ExcludeDecl, struct ExportDecl, struct ExportAsDecl, struct ExternModuleDecl, struct UseDecl, struct LinkDecl, struct ConfigMacrosDecl, struct ConflictDecl > Decl
All declarations that can appear in a module declaration.
Top level wrappers for InstallAPI frontend operations.
bool isa(CodeGen::Address addr)
if(T->getSizeExpr()) TRY_TO(TraverseStmt(const_cast< Expr * >(T -> getSizeExpr())))
@ Rewrite
We are substituting template parameters for (typically) other template parameters in order to rewrite...
@ TemplateName
The identifier is a template name. FIXME: Add an annotation for that.
@ OK_Ordinary
An ordinary object is located at an address in memory.
@ Result
The result type of a method or function.
std::pair< unsigned, unsigned > getDepthAndIndex(const NamedDecl *ND)
Retrieve the depth and index of a template parameter.
const FunctionProtoType * T
@ Template
We are parsing a template declaration.
@ Keyword
The name has been typo-corrected to a keyword.
@ DeducedAsDependent
This is a special case where the initializer is dependent, so we can't deduce a type yet.
@ VK_PRValue
A pr-value expression (in the C++11 taxonomy) produces a temporary value.
@ VK_XValue
An x-value expression is a reference to an object with independent storage but which can be "moved",...
@ VK_LValue
An l-value expression is a reference to an object with independent storage.
U cast(CodeGen::Address addr)
ElaboratedTypeKeyword
The elaboration keyword that precedes a qualified type name or introduces an elaborated-type-specifie...
@ None
No keyword precedes the qualified type name.
ActionResult< Expr * > ExprResult
const Expr * ConstraintExpr
UnsignedOrNone ArgPackSubstIndex
DeclarationNameInfo - A collector data type for bundling together a DeclarationName and the correspon...
unsigned HasTrailingReturn
SmallVector< TemplateArgument, 4 > SugaredConverted
The checked, converted argument will be added to the end of these vectors.
@ BuildingDeductionGuides
We are building deduction guides for a class.
A stack object to be created when performing template instantiation.