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());
893 DeducedArgs, TemplateParamsList->
getDepth(), ReferencedTemplateParams);
895 auto MarkDefaultArgs = [&](
auto *Param) {
896 if (!Param->hasDefaultArgument())
899 Param->getDefaultArgument().getArgument(),
900 TemplateParamsList->
getDepth(), ReferencedTemplateParams);
903 for (
unsigned Index = 0; Index < TemplateParamsList->
size(); ++Index) {
904 if (!ReferencedTemplateParams[Index])
906 auto *Param = TemplateParamsList->
getParam(Index);
907 if (
auto *TTPD = dyn_cast<TemplateTypeParmDecl>(Param))
908 MarkDefaultArgs(TTPD);
909 else if (
auto *NTTPD = dyn_cast<NonTypeTemplateParmDecl>(Param))
910 MarkDefaultArgs(NTTPD);
916 for (
unsigned Index = 0; Index < TemplateParamsList->
size(); ++Index) {
917 if (ReferencedTemplateParams[Index])
918 Results.push_back(Index);
928 "name must be a deduction guide name");
929 auto Existing = DC->
lookup(Name);
930 for (
auto *D : Existing)
938llvm::DenseSet<const NamedDecl *> getSourceDeductionGuides(
DeclarationName Name,
942 "name must be a deduction guide name");
943 llvm::DenseSet<const NamedDecl *>
Result;
944 for (
auto *D : DC->
lookup(Name)) {
945 if (
const auto *FTD = dyn_cast<FunctionTemplateDecl>(D))
948 if (
const auto *GD = dyn_cast<CXXDeductionGuideDecl>(D)) {
949 assert(GD->getSourceDeductionGuide() &&
950 "deduction guide for alias template must have a source deduction "
952 Result.insert(GD->getSourceDeductionGuide());
970 unsigned FirstUndeducedParamIdx,
Expr *IsDeducible) {
995 unsigned AdjustDepth = 0;
996 if (
auto *PrimaryTemplate =
998 AdjustDepth = PrimaryTemplate->getTemplateDepth();
1010 NamedDecl *NewParam = transformTemplateParameter(
1012 AdjustedAliasTemplateArgs.size(),
1016 Context.getInjectedTemplateArg(NewParam);
1017 AdjustedAliasTemplateArgs.push_back(NewTemplateArgument);
1028 for (
unsigned Index = 0; Index < DeduceResults.size(); ++Index) {
1029 const auto &D = DeduceResults[Index];
1037 transformTemplateParameter(SemaRef, F->
getDeclContext(), TP, Args,
1038 FirstUndeducedParamIdx,
1040 FirstUndeducedParamIdx += 1;
1041 assert(TemplateArgsForBuildingRC[Index].isNull());
1042 TemplateArgsForBuildingRC[Index] =
1043 Context.getInjectedTemplateArg(NewParam);
1050 assert(TemplateArgsForBuildingRC[Index].isNull() &&
1051 "InstantiatedArgs must be null before setting");
1052 TemplateArgsForBuildingRC[Index] = Output.
getArgument();
1092 clang::Decl::ClassTemplateSpecialization) {
1095 false, std::nullopt,
1099 for (
auto It : OuterLevelArgs)
1109 BinaryOperatorKind::BO_LAnd, E.
get(), IsDeducible);
1110 if (Conjunction.isInvalid())
1118Expr *buildIsDeducibleConstraint(
Sema &SemaRef,
1124 if (
auto *PrimaryTemplate =
1126 PrimaryTemplate && TemplateParams.size() > 0) {
1130 unsigned AdjustDepth = PrimaryTemplate->getTemplateDepth();
1132 for (
auto *TP : TemplateParams) {
1138 NamedDecl *NewParam = transformTemplateParameter(
1140 TransformedTemplateArgs.size(),
1144 Context.getInjectedTemplateArg(NewParam);
1145 TransformedTemplateArgs.push_back(NewTemplateArgument);
1153 Context.DeclarationNames.getCXXDeductionGuideName(
AliasTemplate));
1157 Context.getTrivialTypeSourceInfo(
1158 Context.getDeducedTemplateSpecializationType(
1164 Context.getTrivialTypeSourceInfo(
1169 Context, Context.getLogicalOperationType(),
AliasTemplate->getLocation(),
1170 TypeTrait::BTT_IsDeducible, IsDeducibleTypeTraitArgs,
1174std::pair<TemplateDecl *, llvm::ArrayRef<TemplateArgument>>
1176 auto RhsType =
AliasTemplate->getTemplatedDecl()->getUnderlyingType();
1179 if (
const auto *TST = RhsType->getAs<TemplateSpecializationType>()) {
1183 Template = TST->getTemplateName().getAsTemplateDecl();
1184 AliasRhsTemplateArgs =
1185 TST->getAsNonAliasTemplateSpecializationType()->template_arguments();
1186 }
else if (
const auto *RT = RhsType->getAs<RecordType>()) {
1190 if (
const auto *CTSD =
1191 dyn_cast<ClassTemplateSpecializationDecl>(RT->getDecl())) {
1192 Template = CTSD->getSpecializedTemplate();
1193 AliasRhsTemplateArgs = CTSD->getTemplateArgs().asArray();
1196 return {
Template, AliasRhsTemplateArgs};
1219 assert(F &&
"deduction guide for alias template must be a function template");
1226 if (BuildingDeductionGuides.isInvalid())
1229 auto &Context = SemaRef.
Context;
1230 auto [
Template, AliasRhsTemplateArgs] =
1253 const auto *FReturnType = RType->
getAs<TemplateSpecializationType>();
1254 if (
const auto *ICNT = RType->getAsCanonical<InjectedClassNameType>())
1257 ICNT->getDecl()->getCanonicalTemplateSpecializationType(
1262 FReturnTemplateArgs = FReturnType->template_arguments();
1263 }
else if (
const auto *RT = RType->getAs<RecordType>()) {
1266 if (
const auto *CTSD = dyn_cast<ClassTemplateSpecializationDecl>(RT->getDecl()))
1267 FReturnTemplateArgs = CTSD->getTemplateArgs().asArray();
1269 assert(!FReturnTemplateArgs.empty() &&
"expected to see template arguments");
1303 AliasRhsTemplateArgs, TDeduceInfo, DeduceResults,
1310 for (
unsigned Index = 0; Index < DeduceResults.size(); ++Index) {
1311 const auto &D = DeduceResults[Index];
1312 if (!IsNonDeducedArgument(D))
1313 DeducedArgs.push_back(D);
1315 NonDeducedTemplateParamsInFIndex.push_back(Index);
1317 auto DeducedAliasTemplateParams =
1318 TemplateParamsReferencedInTemplateArgumentList(
1319 SemaRef,
AliasTemplate->getTemplateParameters(), DeducedArgs);
1341 for (
unsigned AliasTemplateParamIdx : DeducedAliasTemplateParams) {
1343 AliasTemplate->getTemplateParameters()->getParam(AliasTemplateParamIdx);
1349 NamedDecl *NewParam = transformTemplateParameter(
1352 FPrimeTemplateParams.push_back(NewParam);
1355 Context.getInjectedTemplateArg(NewParam);
1356 TransformedDeducedAliasArgs[AliasTemplateParamIdx] = NewTemplateArgument;
1358 unsigned FirstUndeducedParamIdx = FPrimeTemplateParams.size();
1378 for (
unsigned Index = 0; Index < DeduceResults.size(); ++Index) {
1379 const auto &D = DeduceResults[Index];
1381 if (IsNonDeducedArgument(D)) {
1390 assert(TemplateArgsForBuildingFPrime[Index].isNull() &&
1391 "InstantiatedArgs must be null before setting");
1408 TemplateArgsForBuildingFPrime[Index] =
1419 for (
unsigned FTemplateParamIdx : NonDeducedTemplateParamsInFIndex) {
1426 NamedDecl *NewParam = transformTemplateParameter(
1427 SemaRef, F->
getDeclContext(), TP, Args, FPrimeTemplateParams.size(),
1429 FPrimeTemplateParams.push_back(NewParam);
1431 assert(TemplateArgsForBuildingFPrime[FTemplateParamIdx].isNull() &&
1432 "The argument must be null before setting");
1433 TemplateArgsForBuildingFPrime[FTemplateParamIdx] =
1434 Context.getInjectedTemplateArg(NewParam);
1437 auto *TemplateArgListForBuildingFPrime =
1441 F, TemplateArgListForBuildingFPrime,
AliasTemplate->getLocation(),
1445 Expr *IsDeducible = buildIsDeducibleConstraint(
1446 SemaRef,
AliasTemplate, FPrime->getReturnType(), FPrimeTemplateParams);
1447 Expr *RequiresClause =
1448 buildAssociatedConstraints(SemaRef, F,
AliasTemplate, DeduceResults,
1449 FirstUndeducedParamIdx, IsDeducible);
1452 if (!FPrimeTemplateParams.empty())
1454 Context,
AliasTemplate->getTemplateParameters()->getTemplateLoc(),
1456 FPrimeTemplateParams,
1460 auto *DGuide = buildDeductionGuide(
1462 GG->getCorrespondingConstructor(), GG->getExplicitSpecifier(),
1466 DGuide->setDeductionCandidateKind(GG->getDeductionCandidateKind());
1467 DGuide->setSourceDeductionGuide(SourceDeductionGuide);
1468 DGuide->setSourceDeductionGuideKind(
1475void DeclareImplicitDeductionGuidesForTypeAlias(
1479 auto &Context = SemaRef.
Context;
1480 auto [
Template, AliasRhsTemplateArgs] =
1484 auto SourceDeductionGuides = getSourceDeductionGuides(
1485 Context.DeclarationNames.getCXXDeductionGuideName(
AliasTemplate),
1489 Context.DeclarationNames.getCXXDeductionGuideName(
Template), Loc);
1492 Guides.suppressDiagnostics();
1494 for (
auto *G : Guides) {
1495 if (
auto *DG = dyn_cast<CXXDeductionGuideDecl>(G)) {
1496 if (SourceDeductionGuides.contains(DG))
1505 for (
unsigned I = 0, N = DG->getNumParams(); I != N; ++I) {
1506 const auto *P = DG->getParamDecl(I);
1509 SemaRef.
Context, G->getDeclContext(),
1510 DG->getParamDecl(I)->getBeginLoc(), P->getLocation(),
nullptr,
1520 Transformed->setSourceDeductionGuide(DG);
1521 Transformed->setSourceDeductionGuideKind(
1532 BinaryOperatorKind::BO_LAnd,
const_cast<Expr *
>(RC.ConstraintExpr),
1533 const_cast<Expr *
>(Constraint.ConstraintExpr));
1534 if (!Conjunction.isInvalid()) {
1535 Constraint.ConstraintExpr = Conjunction.getAs<
Expr>();
1536 Constraint.ArgPackSubstIndex = RC.ArgPackSubstIndex;
1539 Transformed->setTrailingRequiresClause(Constraint);
1552 BuildDeductionGuideForTypeAlias(SemaRef,
AliasTemplate, DGuide, Loc);
1567 ExtractTypeForDeductionGuide TypeAliasTransformer(SemaRef, TypedefDecls);
1572 NewParamTypes.push_back(
Type);
1576 RHSTemplate, NewParamTypes, Loc);
1577 if (!RHSDeductionGuide)
1583 return BuildDeductionGuideForTypeAlias(SemaRef,
AliasTemplate,
1584 RHSDeductionGuide, Loc);
1592 llvm::FoldingSetNodeID ID;
1594 for (
auto &T : ParamTypes)
1595 T.getCanonicalType().Profile(ID);
1596 unsigned Hash = ID.ComputeHash();
1600 return Found->getSecond();
1603 if (
auto *GD = DeclareAggregateDeductionGuideForTypeAlias(
1614 DefRecord->getDescribedClassTemplate())
1622 ConvertConstructorToDeductionGuideTransform Transform(
1635 if (BuildingDeductionGuides.isInvalid())
1639 Transform.NestedPattern ? Transform.NestedPattern : Transform.Template;
1652 DeclareImplicitDeductionGuidesForTypeAlias(*
this,
AliasTemplate, Loc);
1656 dyn_cast_or_null<CXXRecordDecl>(
Template->getTemplatedDecl());
1669 ConvertConstructorToDeductionGuideTransform Transform(
1674 if (hasDeclaredDeductionGuides(Transform.DeductionGuideName, DC))
1685 if (BuildingDeductionGuides.isInvalid())
1693 Transform.NestedPattern ? Transform.NestedPattern : Transform.Template;
1696 bool AddedAny =
false;
1698 D = D->getUnderlyingDecl();
1699 if (D->isInvalidDecl() || D->isImplicit())
1707 if (ProcessedCtors.count(D))
1710 auto *FTD = dyn_cast<FunctionTemplateDecl>(D);
1720 return !P || P->hasUnparsedDefaultArg();
1724 ProcessedCtors.insert(D);
1725 Transform.transformConstructor(FTD, CD);
1734 Transform.buildSimpleDeductionGuide({});
1738 Transform.buildSimpleDeductionGuide(Transform.DeducedType)
Defines the clang::ASTContext interface.
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.
Defines enumerations for the type traits support.
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
ElaboratedTypeKeyword getKeyword() 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.
TemplateArgumentLoc getTrivialTemplateArgumentLoc(const TemplateArgument &Arg, QualType NTTPType, SourceLocation Loc, NamedDecl *TemplateParam=nullptr)
Allocate a TemplateArgumentLoc where all locations have been initialized to the given location.
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)
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)
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 AttachTypeConstraint(NestedNameSpecifierLoc NS, DeclarationNameInfo NameInfo, TemplateDecl *NamedConcept, NamedDecl *FoundDecl, const TemplateArgumentListInfo *TemplateArgs, TemplateTypeParmDecl *ConstrainedParameter, SourceLocation EllipsisLoc)
Attach a type-constraint to a template parameter.
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.
The JSON file list parser is used to communicate input to InstallAPI.
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.
@ 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.