Lines Matching +full:class +full:- +full:dg

1 //===- SemaTemplateDeductionGude.cpp - Template Argument Deduction---------===//
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 // This file implements deduction guides for C++ class template argument
12 //===----------------------------------------------------------------------===//
58 /// Tree transform to "extract" a transformed type from a class template's
60 class ExtractTypeForDeductionGuide
92 if (DC->Equals(TargetDC)) in mightReferToOuterTemplateParameters()
94 while (DC->isRecord()) { in mightReferToOuterTemplateParameters()
95 if (DC->Equals(TargetDC)) in mightReferToOuterTemplateParameters()
97 DC = DC->getParent(); in mightReferToOuterTemplateParameters()
102 if (WalkUp(Typedef->getDeclContext(), NestedPattern->getTemplatedDecl())) in mightReferToOuterTemplateParameters()
104 if (WalkUp(NestedPattern->getTemplatedDecl(), Typedef->getDeclContext())) in mightReferToOuterTemplateParameters()
120 while (Pattern->getInstantiatedFromMemberTemplate()) in RebuildTemplateSpecializationType()
121 Pattern = Pattern->getInstantiatedFromMemberTemplate(); in RebuildTemplateSpecializationType()
122 if (!mightReferToOuterTemplateParameters(Pattern->getTemplatedDecl())) in RebuildTemplateSpecializationType()
127 TypedefNameInstantiator->InstantiateTypeAliasTemplateDecl(TATD); in RebuildTemplateSpecializationType()
132 MaterializedTypedefs.push_back(NewTATD->getTemplatedDecl()); in RebuildTemplateSpecializationType()
144 bool InDependentContext = OrigDecl->getDeclContext()->isDependentContext(); in TransformTypedefType()
152 // template <class T> struct Outer { in TransformTypedefType()
154 // template <class U> struct Inner { in TransformTypedefType()
159 TL.getTypePtr()->isInstantiationDependentType()) { in TransformTypedefType()
161 TypedefNameInstantiator->InstantiateTypedefNameDecl( in TransformTypedefType()
169 TransformType(InnerTLB, OrigDecl->getTypeSourceInfo()->getTypeLoc()); in TransformTypedefType()
173 Context, Context.getTranslationUnitDecl(), OrigDecl->getBeginLoc(), in TransformTypedefType()
174 OrigDecl->getLocation(), OrigDecl->getIdentifier(), TSI); in TransformTypedefType()
178 Context, Context.getTranslationUnitDecl(), OrigDecl->getBeginLoc(), in TransformTypedefType()
179 OrigDecl->getLocation(), OrigDecl->getIdentifier(), TSI); in TransformTypedefType()
194 // A deduction guide can be either a template or a non-template function
195 // declaration. If \p TemplateParams is null, a non-template function
203 DeclContext *DC = OriginalTemplate->getDeclContext();
210 TInfo->getTypeLoc().castAs<FunctionProtoTypeLoc>().getParams();
215 TInfo->getType(), TInfo, LocEnd, Ctor);
216 Guide->setImplicit(IsImplicit);
217 Guide->setParams(Params);
220 Param->setDeclContext(Guide);
222 TD->setDeclContext(Guide);
224 Guide->setAccess(AS_public);
227 DC->addDecl(Guide);
233 GuideTemplate->setImplicit(IsImplicit);
234 Guide->setDescribedFunctionTemplate(GuideTemplate);
237 GuideTemplate->setAccess(AS_public);
239 DC->addDecl(GuideTemplate);
252 SemaRef.Context, DC, TTP->getBeginLoc(), TTP->getLocation(), NewDepth, in transformTemplateTypeParam()
253 NewIndex, TTP->getIdentifier(), TTP->wasDeclaredWithTypename(), in transformTemplateTypeParam()
254 TTP->isParameterPack(), TTP->hasTypeConstraint(), in transformTemplateTypeParam()
255 TTP->isExpandedParameterPack() in transformTemplateTypeParam()
256 ? std::optional<unsigned>(TTP->getNumExpansionParameters()) in transformTemplateTypeParam()
258 if (const auto *TC = TTP->getTypeConstraint()) in transformTemplateTypeParam()
261 if (TTP->hasDefaultArgument()) { in transformTemplateTypeParam()
264 TTP->getDefaultArgument(), Args, InstantiatedDefaultArg, in transformTemplateTypeParam()
265 TTP->getDefaultArgumentLoc(), TTP->getDeclName())) in transformTemplateTypeParam()
266 NewTTP->setDefaultArgument(SemaRef.Context, InstantiatedDefaultArg); in transformTemplateTypeParam()
268 SemaRef.CurrentInstantiationScope->InstantiatedLocal(TTP, NewTTP); in transformTemplateTypeParam()
271 // Similar to above, but for non-type template or template template parameters.
282 NewParam->setPosition(NewIndex); in transformTemplateParam()
283 NewParam->setDepth(NewDepth); in transformTemplateParam()
288 /// corresponding deduction guide, per C++1z [over.match.class.deduct]p1.
296 while (Pattern->getInstantiatedFromMemberTemplate()) { in ConvertConstructorToDeductionGuideTransform()
297 if (Pattern->isMemberSpecialization()) in ConvertConstructorToDeductionGuideTransform()
299 Pattern = Pattern->getInstantiatedFromMemberTemplate(); in ConvertConstructorToDeductionGuideTransform()
311 DeclContext *DC = Template->getDeclContext();
312 CXXRecordDecl *Primary = Template->getTemplatedDecl();
318 // Index adjustment to apply to convert depth-1 template parameters into
319 // depth-0 template parameters.
320 unsigned Depth1IndexAdjustment = Template->getTemplateParameters()->size();
322 // Instantiation arguments for the outermost depth-1 templates
333 // C++ [over.match.class.deduct]p1: in transformConstructor()
334 // -- For each constructor of the class template designated by the in transformConstructor()
335 // template-name, a function template with the following properties: in transformConstructor()
337 // -- The template parameters are the template parameters of the class in transformConstructor()
343 TemplateParameterList *InnerParams = FTD->getTemplateParameters(); in transformConstructor()
346 AllParams.reserve(TemplateParams->size() + InnerParams->size()); in transformConstructor()
347 AllParams.insert(AllParams.begin(), TemplateParams->begin(), in transformConstructor()
348 TemplateParams->end()); in transformConstructor()
349 SubstArgs.reserve(InnerParams->size()); in transformConstructor()
350 Depth1Args.reserve(InnerParams->size()); in transformConstructor()
360 Args.addOuterRetainedLevels(NestedPattern->getTemplateDepth()); in transformConstructor()
364 // Constraints require that we substitute depth-1 arguments in transformConstructor()
372 SemaRef.runWithSufficientStackSpace(NewParam->getLocation(), [&] { in transformConstructor()
377 assert(NewParam->getTemplateDepth() == 0 && in transformConstructor()
384 // Substitute new template parameters into requires-clause if present. in transformConstructor()
386 if (Expr *InnerRC = InnerParams->getRequiresClause()) { in transformConstructor()
392 Args.addOuterRetainedLevels(NestedPattern->getTemplateDepth()); in transformConstructor()
400 SemaRef.Context, InnerParams->getTemplateLoc(), in transformConstructor()
401 InnerParams->getLAngleLoc(), AllParams, InnerParams->getRAngleLoc(), in transformConstructor()
405 // If we built a new template-parameter-list, track that we need to in transformConstructor()
415 FunctionProtoTypeLoc FPTL = CD->getTypeSourceInfo() in transformConstructor()
416 ->getTypeLoc() in transformConstructor()
433 SemaRef, Template, TemplateParams, CD, CD->getExplicitSpecifier(), in transformConstructor()
434 NewTInfo, CD->getBeginLoc(), CD->getLocation(), CD->getEndLoc(), in transformConstructor()
440 SourceLocation Loc = Template->getLocation(); in buildSimpleDeductionGuide()
456 TSI->getTypeLoc().castAs<FunctionProtoTypeLoc>(); in buildSimpleDeductionGuide()
470 TSI->getType(), TSI, SC_None, nullptr); in buildSimpleDeductionGuide()
471 NewParam->setScopeInfo(0, Params.size()); in buildSimpleDeductionGuide()
489 SemaRef, DC, TTP, Args, TTP->getDepth() - 1, in transformTemplateParameter()
490 Depth1IndexAdjustment + TTP->getIndex()); in transformTemplateParameter()
493 Depth1IndexAdjustment + TTP->getIndex(), in transformTemplateParameter()
494 TTP->getDepth() - 1); in transformTemplateParameter()
497 Depth1IndexAdjustment + NTTP->getIndex(), in transformTemplateParameter()
498 NTTP->getDepth() - 1); in transformTemplateParameter()
509 // -- The types of the function parameters are those of the constructor. in transformFunctionProtoType()
513 // template <class T> struct C { in transformFunctionProtoType()
514 // template <class U> struct D { in transformFunctionProtoType()
515 // template <class V> D(U, V); in transformFunctionProtoType()
519 // defined outside of the surrounding class template. That is T in the in transformFunctionProtoType()
529 // defined at the class template and the constructor. In this example, in transformFunctionProtoType()
536 ParamTypes.push_back(NewParam->getType()); in transformFunctionProtoType()
540 // -- The return type is the class template specialization designated by in transformFunctionProtoType()
541 // the template-name and template arguments corresponding to the in transformFunctionProtoType()
542 // template parameters obtained from the class template. in transformFunctionProtoType()
544 // We use the injected-class-name type of the primary template instead. in transformFunctionProtoType()
546 // the user can write in a deduction-guide (because they cannot enter the in transformFunctionProtoType()
550 TLB.pushTypeSpec(ReturnType).setNameLoc(Primary->getLocation()); in transformFunctionProtoType()
555 EPI.Variadic = T->isVariadic(); in transformFunctionProtoType()
579 TypeSourceInfo *OldDI = OldParam->getTypeSourceInfo(); in transformFunctionTypeParam()
581 if (auto PackTL = OldDI->getTypeLoc().getAs<PackExpansionTypeLoc>()) { in transformFunctionTypeParam()
586 OldParam->getLocation(), OldParam->getDeclName()); in transformFunctionTypeParam()
591 PackTL.getTypePtr()->getNumExpansions()); in transformFunctionTypeParam()
593 NewDI = SemaRef.SubstType(OldDI, Args, OldParam->getLocation(), in transformFunctionTypeParam()
594 OldParam->getDeclName()); in transformFunctionTypeParam()
610 if (OldParam->hasDefaultArg()) { in transformFunctionTypeParam()
613 QualType ParamTy = NewDI->getType(); in transformFunctionTypeParam()
615 OpaqueValueExpr(OldParam->getDefaultArgRange().getBegin(), in transformFunctionTypeParam()
617 ParamTy->isLValueReferenceType() ? VK_LValue in transformFunctionTypeParam()
618 : ParamTy->isRValueReferenceType() ? VK_XValue in transformFunctionTypeParam()
622 auto NewType = NewDI->getType(); in transformFunctionTypeParam()
623 if (NewType->isArrayType() || NewType->isFunctionType()) in transformFunctionTypeParam()
627 SemaRef.Context, DC, OldParam->getInnerLocStart(), in transformFunctionTypeParam()
628 OldParam->getLocation(), OldParam->getIdentifier(), NewType, NewDI, in transformFunctionTypeParam()
629 OldParam->getStorageClass(), NewDefArg.get()); in transformFunctionTypeParam()
630 NewParam->setScopeInfo(OldParam->getFunctionScopeDepth(), in transformFunctionTypeParam()
631 OldParam->getFunctionScopeIndex()); in transformFunctionTypeParam()
632 SemaRef.CurrentInstantiationScope->InstantiatedLocal(OldParam, NewParam); in transformFunctionTypeParam()
639 return TTP->getDepth(); in getTemplateParameterDepth()
641 return TTP->getDepth(); in getTemplateParameterDepth()
643 return NTTP->getDepth(); in getTemplateParameterDepth()
649 return TTP->getIndex(); in getTemplateParameterIndex()
651 return TTP->getIndex(); in getTemplateParameterIndex()
653 return NTTP->getIndex(); in getTemplateParameterIndex()
670 ReferencedTemplateParams(TemplateParamList->size()) {} in TemplateParamsReferencedInTemplateArgumentList()
675 Mark(TTP->getDepth(), TTP->getIndex()); in TemplateParamsReferencedInTemplateArgumentList()
680 MarkAppeared(DRE->getFoundDecl()); in TemplateParamsReferencedInTemplateArgumentList()
696 if (Index < TemplateParamList->size() && in TemplateParamsReferencedInTemplateArgumentList()
697 TemplateParamList->getParam(Index)->getTemplateDepth() == Depth) in TemplateParamsReferencedInTemplateArgumentList()
705 for (unsigned Index = 0; Index < TemplateParamsList->size(); ++Index) { in TemplateParamsReferencedInTemplateArgumentList()
718 auto Existing = DC->lookup(Name); in hasDeclaredDeductionGuides()
720 if (D->isImplicit()) in hasDeclaredDeductionGuides()
740 // C++ [over.match.class.deduct]p3.3:
745 // The return result is expected to be the require-clause for the synthesized
752 Expr *RC = F->getTemplateParameters()->getRequiresClause(); in buildAssociatedConstraints()
761 // parameters in the require-clause expression have a subtle "depth" in buildAssociatedConstraints()
763 // parameters. When transforming the require-clause, we must take this in buildAssociatedConstraints()
766 // 1) In the transformed require-clause, occurrences of template parameters in buildAssociatedConstraints()
768 // 2) When substituting on the require-clause expr of the underlying in buildAssociatedConstraints()
774 // For 1), if the alias template is nested within a class template, we in buildAssociatedConstraints()
778 AliasTemplate->getInstantiatedFromMemberTemplate()) in buildAssociatedConstraints()
779 AdjustDepth = PrimaryTemplate->getTemplateDepth(); in buildAssociatedConstraints()
785 for (auto *TP : *AliasTemplate->getTemplateParameters()) { in buildAssociatedConstraints()
792 SemaRef, AliasTemplate->getDeclContext(), TP, Args, in buildAssociatedConstraints()
803 F->getTemplateParameters()->size()); in buildAssociatedConstraints()
811 if (D.isNull()) { // non-deduced template parameters of f in buildAssociatedConstraints()
812 NamedDecl *TP = F->getTemplateParameters()->getParam(Index); in buildAssociatedConstraints()
818 SemaRef, F->getDeclContext(), TP, Args, in buildAssociatedConstraints()
837 // A list of template arguments for transforming the require-clause of F. in buildAssociatedConstraints()
842 // For 2), if the underlying deduction guide F is nested in a class template, in buildAssociatedConstraints()
844 // require-clause of F remains completely uninstantiated. in buildAssociatedConstraints()
854 // Foo(U) -> Foo<int>; in buildAssociatedConstraints()
860 // - The occurrence of U in the require-expression is [depth:1, index:0] in buildAssociatedConstraints()
861 // - The occurrence of U in the function parameter is [depth:0, index:0] in buildAssociatedConstraints()
862 // - The template parameter of U is [depth:0, index:0] in buildAssociatedConstraints()
864 // We add the outer template arguments which is [int] to the multi-level arg in buildAssociatedConstraints()
868 // NOTE: The underlying deduction guide F is instantiated -- either from an in buildAssociatedConstraints()
869 // explicitly-written deduction guide member, or from a constructor. in buildAssociatedConstraints()
872 if (F->getLexicalDeclContext()->getDeclKind() == in buildAssociatedConstraints()
875 F, F->getLexicalDeclContext(), in buildAssociatedConstraints()
896 // [over.match.class.deduct]p3.3:
906 AliasTemplate->getInstantiatedFromMemberTemplate(); in buildIsDeducibleConstraint()
911 unsigned AdjustDepth = PrimaryTemplate->getTemplateDepth(); in buildIsDeducibleConstraint()
920 SemaRef, AliasTemplate->getDeclContext(), TP, Args, in buildIsDeducibleConstraint()
933 ReturnType, Args, AliasTemplate->getLocation(), in buildIsDeducibleConstraint()
947 Context, Context.getLogicalOperationType(), AliasTemplate->getLocation(), in buildIsDeducibleConstraint()
949 AliasTemplate->getLocation(), /*Value*/ false); in buildIsDeducibleConstraint()
955 auto RhsType = AliasTemplate->getTemplatedDecl() in getRHSTemplateDeclAndArgs()
956 ->getUnderlyingType() in getRHSTemplateDeclAndArgs()
960 if (const auto *TST = RhsType->getAs<TemplateSpecializationType>()) { in getRHSTemplateDeclAndArgs()
963 // using AliasFoo1 = Foo<T>; // a class/type alias template specialization in getRHSTemplateDeclAndArgs()
964 Template = TST->getTemplateName().getAsTemplateDecl(); in getRHSTemplateDeclAndArgs()
965 AliasRhsTemplateArgs = TST->template_arguments(); in getRHSTemplateDeclAndArgs()
966 } else if (const auto *RT = RhsType->getAs<RecordType>()) { in getRHSTemplateDeclAndArgs()
971 RT->getAsCXXRecordDecl())) { in getRHSTemplateDeclAndArgs()
972 Template = CTSD->getSpecializedTemplate(); in getRHSTemplateDeclAndArgs()
973 AliasRhsTemplateArgs = CTSD->getTemplateArgs().asArray(); in getRHSTemplateDeclAndArgs()
989 SemaRef, AliasTemplate->getLocation(), F, in BuildDeductionGuideForTypeAlias()
998 auto RType = F->getTemplatedDecl()->getReturnType(); in BuildDeductionGuideForTypeAlias()
1001 RType->getAs<TemplateSpecializationType>(); in BuildDeductionGuideForTypeAlias()
1002 if (const auto *InjectedCNT = RType->getAs<InjectedClassNameType>()) in BuildDeductionGuideForTypeAlias()
1003 // implicitly-generated deduction guide. in BuildDeductionGuideForTypeAlias()
1004 FReturnType = InjectedCNT->getInjectedTST(); in BuildDeductionGuideForTypeAlias()
1005 else if (const auto *ET = RType->getAs<ElaboratedType>()) in BuildDeductionGuideForTypeAlias()
1007 FReturnType = ET->getNamedType()->getAs<TemplateSpecializationType>(); in BuildDeductionGuideForTypeAlias()
1012 // C++ [over.match.class.deduct]p3: ...For each function or function in BuildDeductionGuideForTypeAlias()
1014 // simple-template-id of the defining-type-id, the template arguments in BuildDeductionGuideForTypeAlias()
1015 // of the return type of f are deduced from the defining-type-id of A in BuildDeductionGuideForTypeAlias()
1022 // f(X, Y) -> f<Y, X>; in BuildDeductionGuideForTypeAlias()
1028 // the return type of the deduction guide from it: Y->int, X->U in BuildDeductionGuideForTypeAlias()
1032 F->getTemplateParameters()->size()); in BuildDeductionGuideForTypeAlias()
1035 // non-deducible template argument. However, this doesn't seem to casue in BuildDeductionGuideForTypeAlias()
1040 F->getTemplateParameters(), FReturnType->template_arguments(), in BuildDeductionGuideForTypeAlias()
1056 AliasTemplate->getTemplateParameters(), DeducedArgs); in BuildDeductionGuideForTypeAlias()
1059 F->getTemplateParameters()->size()); in BuildDeductionGuideForTypeAlias()
1063 // C++ [over.match.class.deduct]p3.2: in BuildDeductionGuideForTypeAlias()
1069 // Store template arguments that refer to the newly-created template in BuildDeductionGuideForTypeAlias()
1072 AliasTemplate->getTemplateParameters()->size()); in BuildDeductionGuideForTypeAlias()
1076 AliasTemplate->getTemplateParameters()->getParam(AliasTemplateParamIdx); in BuildDeductionGuideForTypeAlias()
1083 SemaRef, AliasTemplate->getDeclContext(), TP, Args, in BuildDeductionGuideForTypeAlias()
1096 auto *TP = F->getTemplateParameters()->getParam(FTemplateParamIdx); in BuildDeductionGuideForTypeAlias()
1103 SemaRef, F->getDeclContext(), TP, Args, FPrimeTemplateParams.size(), in BuildDeductionGuideForTypeAlias()
1115 // arguments refer to the newly-created template parameters of f', and in BuildDeductionGuideForTypeAlias()
1123 // 2) non-deduced template parameters of f: rebuild a in BuildDeductionGuideForTypeAlias()
1134 // 2): Non-deduced template parameter has been built already. in BuildDeductionGuideForTypeAlias()
1136 "template arguments for non-deduced template parameters should " in BuildDeductionGuideForTypeAlias()
1154 F, TemplateArgListForBuildingFPrime, AliasTemplate->getLocation(), in BuildDeductionGuideForTypeAlias()
1159 SemaRef, AliasTemplate, FPrime->getReturnType(), FPrimeTemplateParams); in BuildDeductionGuideForTypeAlias()
1165 Context, AliasTemplate->getTemplateParameters()->getTemplateLoc(), in BuildDeductionGuideForTypeAlias()
1166 AliasTemplate->getTemplateParameters()->getLAngleLoc(), in BuildDeductionGuideForTypeAlias()
1168 AliasTemplate->getTemplateParameters()->getRAngleLoc(), in BuildDeductionGuideForTypeAlias()
1172 GG->getCorrespondingConstructor(), GG->getExplicitSpecifier(), in BuildDeductionGuideForTypeAlias()
1173 GG->getTypeSourceInfo(), AliasTemplate->getBeginLoc(), in BuildDeductionGuideForTypeAlias()
1174 AliasTemplate->getLocation(), AliasTemplate->getEndLoc(), in BuildDeductionGuideForTypeAlias()
1175 F->isImplicit())); in BuildDeductionGuideForTypeAlias()
1176 cast<CXXDeductionGuideDecl>(Result->getTemplatedDecl()) in BuildDeductionGuideForTypeAlias()
1177 ->setDeductionCandidateKind(GG->getDeductionCandidateKind()); in BuildDeductionGuideForTypeAlias()
1185 if (AliasTemplate->isInvalidDecl()) in DeclareImplicitDeductionGuidesForTypeAlias()
1193 AliasTemplate->getDeclContext())) in DeclareImplicitDeductionGuidesForTypeAlias()
1202 SemaRef.LookupQualifiedName(Guides, Template->getDeclContext()); in DeclareImplicitDeductionGuidesForTypeAlias()
1206 if (auto *DG = dyn_cast<CXXDeductionGuideDecl>(G)) { in DeclareImplicitDeductionGuidesForTypeAlias() local
1207 // The deduction guide is a non-template function decl, we just clone it. in DeclareImplicitDeductionGuidesForTypeAlias()
1209 SemaRef.Context.getTrivialTypeSourceInfo(DG->getType()); in DeclareImplicitDeductionGuidesForTypeAlias()
1211 FunctionType->getTypeLoc().castAs<FunctionProtoTypeLoc>(); in DeclareImplicitDeductionGuidesForTypeAlias()
1214 for (unsigned I = 0, N = DG->getNumParams(); I != N; ++I) { in DeclareImplicitDeductionGuidesForTypeAlias()
1215 const auto *P = DG->getParamDecl(I); in DeclareImplicitDeductionGuidesForTypeAlias()
1216 auto *TSI = SemaRef.Context.getTrivialTypeSourceInfo(P->getType()); in DeclareImplicitDeductionGuidesForTypeAlias()
1218 SemaRef.Context, G->getDeclContext(), in DeclareImplicitDeductionGuidesForTypeAlias()
1219 DG->getParamDecl(I)->getBeginLoc(), P->getLocation(), nullptr, in DeclareImplicitDeductionGuidesForTypeAlias()
1220 TSI->getType(), TSI, SC_None, nullptr); in DeclareImplicitDeductionGuidesForTypeAlias()
1221 NewParam->setScopeInfo(0, I); in DeclareImplicitDeductionGuidesForTypeAlias()
1226 /*Constructor=*/nullptr, DG->getExplicitSpecifier(), FunctionType, in DeclareImplicitDeductionGuidesForTypeAlias()
1227 AliasTemplate->getBeginLoc(), AliasTemplate->getLocation(), in DeclareImplicitDeductionGuidesForTypeAlias()
1228 AliasTemplate->getEndLoc(), DG->isImplicit())); in DeclareImplicitDeductionGuidesForTypeAlias()
1231 // function. Per [dcl.decl]p4, the requires-clause shall be present only in DeclareImplicitDeductionGuidesForTypeAlias()
1234 SemaRef, AliasTemplate, Transformed->getReturnType(), {}); in DeclareImplicitDeductionGuidesForTypeAlias()
1235 if (auto *RC = DG->getTrailingRequiresClause()) { in DeclareImplicitDeductionGuidesForTypeAlias()
1242 Transformed->setTrailingRequiresClause(Constraint); in DeclareImplicitDeductionGuidesForTypeAlias()
1250 if (cast<CXXDeductionGuideDecl>(F->getTemplatedDecl()) in DeclareImplicitDeductionGuidesForTypeAlias()
1251 ->getDeductionCandidateKind() == DeductionCandidate::Aggregate) in DeclareImplicitDeductionGuidesForTypeAlias()
1283 TD->setDeclContext(RHSDeductionGuide->getTemplatedDecl()); in DeclareAggregateDeductionGuideForTypeAlias()
1302 CXXDeductionGuideDecl *GD = Found->getSecond(); in DeclareAggregateDeductionGuideFromInitList()
1303 return GD->getDescribedFunctionTemplate(); in DeclareAggregateDeductionGuideFromInitList()
1309 auto *GD = cast<CXXDeductionGuideDecl>(FTD->getTemplatedDecl()); in DeclareAggregateDeductionGuideFromInitList()
1310 GD->setDeductionCandidateKind(DeductionCandidate::Aggregate); in DeclareAggregateDeductionGuideFromInitList()
1317 cast<CXXRecordDecl>(Template->getTemplatedDecl())->getDefinition()) { in DeclareAggregateDeductionGuideFromInitList()
1319 DefRecord->getDescribedClassTemplate()) in DeclareAggregateDeductionGuideFromInitList()
1323 DeclContext *DC = Template->getDeclContext(); in DeclareAggregateDeductionGuideFromInitList()
1324 if (DC->isDependentContext()) in DeclareAggregateDeductionGuideFromInitList()
1335 /*NewSubstitutionIndex=*/-1); in DeclareAggregateDeductionGuideFromInitList()
1346 ContextRAII SavedContext(*this, Pattern->getTemplatedDecl()); in DeclareAggregateDeductionGuideFromInitList()
1351 auto *GD = cast<CXXDeductionGuideDecl>(FTD->getTemplatedDecl()); in DeclareAggregateDeductionGuideFromInitList()
1352 GD->setDeductionCandidateKind(DeductionCandidate::Aggregate); in DeclareAggregateDeductionGuideFromInitList()
1364 cast<CXXRecordDecl>(Template->getTemplatedDecl())->getDefinition()) { in DeclareImplicitDeductionGuides()
1366 DefRecord->getDescribedClassTemplate()) in DeclareImplicitDeductionGuides()
1370 DeclContext *DC = Template->getDeclContext(); in DeclareImplicitDeductionGuides()
1371 if (DC->isDependentContext()) in DeclareImplicitDeductionGuides()
1384 ArgumentPackSubstitutionIndexRAII SubstIndex(*this, -1); in DeclareImplicitDeductionGuides()
1395 // for which some class template parameter without a default argument never in DeclareImplicitDeductionGuides()
1399 ContextRAII SavedContext(*this, Pattern->getTemplatedDecl()); in DeclareImplicitDeductionGuides()
1402 for (NamedDecl *D : LookupConstructors(Pattern->getTemplatedDecl())) { in DeclareImplicitDeductionGuides()
1403 D = D->getUnderlyingDecl(); in DeclareImplicitDeductionGuides()
1404 if (D->isInvalidDecl() || D->isImplicit()) in DeclareImplicitDeductionGuides()
1407 D = cast<NamedDecl>(D->getCanonicalDecl()); in DeclareImplicitDeductionGuides()
1417 dyn_cast_or_null<CXXConstructorDecl>(FTD ? FTD->getTemplatedDecl() : D); in DeclareImplicitDeductionGuides()
1418 // Class-scope explicit specializations (MS extension) do not result in in DeclareImplicitDeductionGuides()
1420 if (!CD || (!FTD && CD->isFunctionTemplateSpecialization())) in DeclareImplicitDeductionGuides()
1424 if (llvm::any_of(CD->parameters(), [](ParmVarDecl *P) { in DeclareImplicitDeductionGuides()
1425 return !P || P->hasUnparsedDefaultArg(); in DeclareImplicitDeductionGuides()
1434 // C++17 [over.match.class.deduct] in DeclareImplicitDeductionGuides()
1435 // -- If C is not defined or does not declare any constructors, an in DeclareImplicitDeductionGuides()
1441 // -- An additional function template derived as above from a hypothetical in DeclareImplicitDeductionGuides()
1446 ->getTemplatedDecl()) in DeclareImplicitDeductionGuides()
1447 ->setDeductionCandidateKind(DeductionCandidate::Copy); in DeclareImplicitDeductionGuides()