Lines Matching +full:dc +full:- +full:id

1 //===- DeclTemplate.h - Classes for representing C++ templates --*- C++ -*-===//
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
12 //===----------------------------------------------------------------------===//
93 /// Whether any of the template parameters has constrained-parameter
94 /// constraint-expression.
123 void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &C) const;
145 assert(Idx < size() && "Template parameter index out-of-range"); in getParam()
149 assert(Idx < size() && "Template parameter index out-of-range"); in getParam()
174 if (P->isParameterPack()) in hasParameterPack()
179 /// The constraint-expression of the associated requires-clause.
184 /// The constraint-expression of the associated requires-clause.
191 /// constrained-parameters.
218 /// requires-clause (if any) for a TemplateDecl and its derived classes.
308 "non-pointer argument type?");
313 const DefaultArgStorage &Storage = Parm->getDefaultArgStorage(); in getParmOwningDefaultArg()
316 assert(!Parm->getDefaultArgStorage() in getParmOwningDefaultArg()
337 Storage = &Prev->getDefaultArgStorage(); in get()
338 if (const auto *C = Storage->ValueOrInherited.template dyn_cast<Chain *>()) in get()
339 return C->Value; in get()
340 return Storage->ValueOrInherited.template get<ArgType>(); in get()
349 return C->PrevDeclWithDefaultArg; in getInheritedFrom()
371 assert(C.isSameDefaultTemplateArgument(Inherited->PrevDeclWithDefaultArg, in setInherited()
373 Inherited->PrevDeclWithDefaultArg = InheritedFrom; in setInherited()
385 //===----------------------------------------------------------------------===//
387 //===----------------------------------------------------------------------===//
399 TemplateDecl(Kind DK, DeclContext *DC, SourceLocation L, DeclarationName Name,
403 // Used when there is no templated element (e.g., for tt-params).
404 TemplateDecl(Kind DK, DeclContext *DC, SourceLocation L, DeclarationName Name, in TemplateDecl() argument
406 : TemplateDecl(DK, DC, L, Name, Params, nullptr) {} in TemplateDecl()
417 /// \brief Get the total constraint-expression associated with this template,
418 /// including constraint-expressions derived from the requires-clause,
419 /// trailing requires-clause (for functions and methods) and constrained
432 static bool classof(const Decl *D) { return classofKind(D->getKind()); } in classof()
439 return SourceRange(getTemplateParameters()->getTemplateLoc(), in getSourceRange()
440 TemplatedDecl->getSourceRange().getEnd()); in getSourceRange()
484 /// FIXME: Normally null; tail-allocate this.
497 : Function(FD, MSInfo ? true : false), Template(Template, TSK - 1), in FunctionTemplateSpecializationInfo()
545 Template.setInt(TSK - 1); in setTemplateSpecializationKind()
588 /// and represents the relationship between the function and the class-scope
589 /// explicit specialization in the original templated class -- whereas our
599 void Profile(llvm::FoldingSetNodeID &ID) { in Profile() argument
600 Profile(ID, TemplateArguments->asArray(), getFunction()->getASTContext()); in Profile()
604 Profile(llvm::FoldingSetNodeID &ID, ArrayRef<TemplateArgument> TemplateArgs, in Profile() argument
606 ID.AddInteger(TemplateArgs.size()); in Profile()
608 TemplateArg.Profile(ID, Context); in Profile()
627 : MemberAndTSK(IF, TSK - 1), PointOfInstantiation(POI) {
649 MemberAndTSK.setInt(TSK - 1); in setTemplateSpecializationKind()
665 /// Provides information about a dependent function-template
741 return D->getTemplateArgs().asArray(); in getTemplateArgs()
760 return SETraits::getDecl(&*this->I)->getMostRecentDecl();
763 DeclType *operator->() const { return **this; }
794 /// If non-null, points to an array of specializations (including
815 /// Retrieves the "common" pointer shared by all (re-)declarations of
823 RedeclarableTemplateDecl(Kind DK, ASTContext &C, DeclContext *DC, in RedeclarableTemplateDecl() argument
826 : TemplateDecl(DK, DC, L, Name, Params, Decl), redeclarable_base(C) {} in RedeclarableTemplateDecl()
861 return getCommonPtr()->InstantiatedFromMember.getInt(); in isMemberSpecialization()
866 assert(getCommonPtr()->InstantiatedFromMember.getPointer() && in setMemberSpecialization()
868 getCommonPtr()->InstantiatedFromMember.setInt(true); in setMemberSpecialization()
908 return getCommonPtr()->InstantiatedFromMember.getPointer(); in getInstantiatedFromMemberTemplate()
912 assert(!getCommonPtr()->InstantiatedFromMember.getPointer()); in setInstantiatedFromMemberTemplate()
913 getCommonPtr()->InstantiatedFromMember.setPointer(TD); in setInstantiatedFromMemberTemplate()
935 static bool classof(const Decl *D) { return classofKind(D->getKind()); } in classof()
947 return I->getFunction();
952 return I->TemplateArguments->asArray();
971 FunctionTemplateDecl(ASTContext &C, DeclContext *DC, SourceLocation L,
974 : RedeclarableTemplateDecl(FunctionTemplate, C, DC, L, Name, Params,
999 /// Load any lazily-loaded specializations from the external source.
1010 return getTemplatedDecl()->isThisDeclarationADefinition();
1031 static_cast<RedeclarableTemplateDecl *>(this)->getPreviousDecl());
1035 static_cast<const RedeclarableTemplateDecl *>(this)->getPreviousDecl());
1041 ->getMostRecentDecl());
1044 return const_cast<FunctionTemplateDecl*>(this)->getMostRecentDecl();
1075 return TPL->getParam(TPL->size() - 1)->isImplicit();
1082 static FunctionTemplateDecl *Create(ASTContext &C, DeclContext *DC,
1090 GlobalDeclID ID);
1093 static bool classof(const Decl *D) { return classofKind(D->getKind()); }
1097 //===----------------------------------------------------------------------===//
1099 //===----------------------------------------------------------------------===//
1105 /// sequentially for out-of-line template members, each template parameter is
1106 /// given a Depth - the nesting of template parameter scopes - and a Position -
1116 static constexpr unsigned MaxDepth = (1U << DepthWidth) - 1;
1117 static constexpr unsigned MaxPosition = (1U << PositionWidth) - 1;
1170 /// Whether this template type parameter has a type-constraint construct.
1191 TemplateTypeParmDecl(DeclContext *DC, SourceLocation KeyLoc,
1192 SourceLocation IdLoc, IdentifierInfo *Id, bool Typename,
1195 : TypeDecl(TemplateTypeParm, DC, IdLoc, Id, KeyLoc), Typename(Typename),
1202 Create(const ASTContext &C, DeclContext *DC, SourceLocation KeyLoc,
1203 SourceLocation NameLoc, unsigned D, unsigned P, IdentifierInfo *Id,
1207 GlobalDeclID ID);
1209 GlobalDeclID ID,
1216 /// type-constraint (see hasTypeConstraint()).
1274 /// type-constraint contains an unexpanded parameter pack.
1279 if (TC->hasExplicitTemplateArgs())
1280 for (const auto &ArgLoc : TC->getTemplateArgsAsWritten()->arguments())
1287 /// list of different type-constraints at different positions.
1290 /// parameter pack's type-constraint was itself a pack expansion, and that
1302 /// its type-constraint. When \c Types is supplied with template arguments by
1325 /// Determine whether this template parameter has a type-constraint.
1330 /// \brief Get the associated-constraints of this template parameter.
1331 /// This will either be the immediately-introduced constraint or empty.
1337 AC.push_back(getTypeConstraint()->getImmediatelyDeclaredConstraint());
1343 static bool classof(const Decl *D) { return classofKind(D->getKind()); }
1347 /// NonTypeTemplateParmDecl - Declares a non-type template parameter,
1370 /// Whether this non-type template parameter is a parameter pack.
1373 /// Whether this non-type template parameter is an "expanded"
1386 NonTypeTemplateParmDecl(DeclContext *DC, SourceLocation StartLoc,
1388 const IdentifierInfo *Id, QualType T,
1390 : DeclaratorDecl(NonTypeTemplateParm, DC, IdLoc, Id, T, TInfo, StartLoc),
1393 NonTypeTemplateParmDecl(DeclContext *DC, SourceLocation StartLoc,
1395 const IdentifierInfo *Id, QualType T,
1402 Create(const ASTContext &C, DeclContext *DC, SourceLocation StartLoc,
1403 SourceLocation IdLoc, unsigned D, unsigned P, const IdentifierInfo *Id,
1407 Create(const ASTContext &C, DeclContext *DC, SourceLocation StartLoc,
1408 SourceLocation IdLoc, unsigned D, unsigned P, const IdentifierInfo *Id,
1413 CreateDeserialized(ASTContext &C, GlobalDeclID ID, bool HasTypeConstraint);
1415 GlobalDeclID ID,
1461 /// Whether this parameter is a non-type template parameter pack.
1474 /// A non-type template parameter pack is a pack expansion if its type
1478 return ParameterPack && getType()->getAs<PackExpansionType>();
1481 /// Whether this parameter is a non-type template parameter pack
1517 assert(I < NumExpandedTypes && "Out-of-range expansion type index");
1526 assert(I < NumExpandedTypes && "Out-of-range expansion type index");
1532 /// Return the constraint introduced by the placeholder type of this non-type
1543 /// Determine whether this non-type template parameter's type has a
1544 /// placeholder with a type-constraint.
1546 auto *AT = getType()->getContainedAutoType();
1547 return AT && AT->isConstrained();
1550 /// \brief Get the associated-constraints of this template parameter.
1551 /// This will either be a vector of size 1 containing the immediately-declared
1562 static bool classof(const Decl *D) { return classofKind(D->getKind()); }
1566 /// TemplateTemplateParmDecl - Declares a template template parameter,
1603 TemplateTemplateParmDecl(DeclContext *DC, SourceLocation L, unsigned D,
1604 unsigned P, bool ParameterPack, IdentifierInfo *Id,
1606 : TemplateDecl(TemplateTemplateParm, DC, L, Id, Params),
1610 TemplateTemplateParmDecl(DeclContext *DC, SourceLocation L, unsigned D,
1611 unsigned P, IdentifierInfo *Id, bool Typename,
1622 static TemplateTemplateParmDecl *Create(const ASTContext &C, DeclContext *DC,
1625 IdentifierInfo *Id, bool Typename,
1628 Create(const ASTContext &C, DeclContext *DC, SourceLocation L, unsigned D,
1629 unsigned P, IdentifierInfo *Id, bool Typename,
1634 GlobalDeclID ID);
1636 CreateDeserialized(ASTContext &C, GlobalDeclID ID, unsigned NumExpansions);
1666 getTemplateParameters()->containsUnexpandedParameterPack();
1699 assert(I < NumExpandedParams && "Out-of-range expansion type index");
1741 return SourceRange(getTemplateParameters()->getTemplateLoc(), End);
1745 static bool classof(const Decl *D) { return classofKind(D->getKind()); }
1755 BuiltinTemplateDecl(const ASTContext &C, DeclContext *DC,
1762 static bool classof(const Decl *D) { return classofKind(D->getKind()); }
1765 static BuiltinTemplateDecl *Create(const ASTContext &C, DeclContext *DC,
1768 return new (C, DC) BuiltinTemplateDecl(C, DC, Name, BTK);
1845 DeclContext *DC, SourceLocation StartLoc,
1858 Create(ASTContext &Context, TagKind TK, DeclContext *DC,
1864 GlobalDeclID ID);
1873 // declaration as a CXXRecordDecl sometimes is the injected-class-name.
1908 /// template<> struct Inner; // class-scope explicit specialization
1963 return PartialSpec->PartialSpecialization;
1982 return *PartialSpec->TemplateArgs;
1995 PS->PartialSpecialization = PartialSpec;
1996 PS->TemplateArgs = TemplateArgs;
2012 return Info->TemplateArgsAsWritten;
2020 Info->TemplateArgsAsWritten = ArgsWritten;
2034 return Info->ExternKeywordLoc;
2044 return Info->TemplateKeywordLoc;
2053 void Profile(llvm::FoldingSetNodeID &ID) const {
2054 Profile(ID, TemplateArgs->asArray(), getASTContext());
2058 Profile(llvm::FoldingSetNodeID &ID, ArrayRef<TemplateArgument> TemplateArgs,
2060 ID.AddInteger(TemplateArgs.size());
2062 TemplateArg.Profile(ID, Context);
2065 static bool classof(const Decl *D) { return classofKind(D->getKind()); }
2087 ASTContext &Context, TagKind TK, DeclContext *DC, SourceLocation StartLoc,
2103 Create(ASTContext &Context, TagKind TK, DeclContext *DC,
2110 CreateDeserialized(ASTContext &C, GlobalDeclID ID);
2115 this)->getMostRecentDecl());
2125 /// constrained-parameters.
2130 TemplateParams->getAssociatedConstraints(AC);
2134 return TemplateParams->hasAssociatedConstraints();
2160 return First->InstantiatedFromMember.getPointer();
2170 First->InstantiatedFromMember.setPointer(PartialSpec);
2192 return First->InstantiatedFromMember.getInt();
2198 assert(First->InstantiatedFromMember.getPointer() &&
2200 return First->InstantiatedFromMember.setInt(true);
2204 /// specialization. This is not the same as the type-decl-type for
2209 ->getInjectedSpecializationType();
2214 void Profile(llvm::FoldingSetNodeID &ID) const {
2215 Profile(ID, getTemplateArgs().asArray(), getTemplateParameters(),
2220 Profile(llvm::FoldingSetNodeID &ID, ArrayRef<TemplateArgument> TemplateArgs,
2223 static bool classof(const Decl *D) { return classofKind(D->getKind()); }
2245 /// The injected-class-name type for this class template.
2260 ClassTemplateDecl(ASTContext &C, DeclContext *DC, SourceLocation L,
2263 : RedeclarableTemplateDecl(ClassTemplate, C, DC, L, Name, Params, Decl) {}
2281 /// Load any lazily-loaded specializations from the external source.
2292 return getTemplatedDecl()->isThisDeclarationADefinition();
2296 static ClassTemplateDecl *Create(ASTContext &C, DeclContext *DC,
2303 static ClassTemplateDecl *CreateDeserialized(ASTContext &C, GlobalDeclID ID);
2327 static_cast<RedeclarableTemplateDecl *>(this)->getPreviousDecl());
2332 this)->getPreviousDecl());
2337 static_cast<RedeclarableTemplateDecl *>(this)->getMostRecentDecl());
2340 return const_cast<ClassTemplateDecl*>(this)->getMostRecentDecl();
2386 /// injected-class-name for this class template.
2388 /// The injected-class-name for a class template \c X is \c
2389 /// X<template-args>, where \c template-args is formed from the
2417 static bool classof(const Decl *D) { return classofKind(D->getKind()); }
2441 // The number of template parameters; always non-zero.
2453 FriendTemplateDecl(DeclContext *DC, SourceLocation Loc,
2456 : Decl(Decl::FriendTemplate, DC, Loc), NumParams(NumParams),
2465 Create(ASTContext &Context, DeclContext *DC, SourceLocation Loc,
2469 static FriendTemplateDecl *CreateDeserialized(ASTContext &C, GlobalDeclID ID);
2500 static bool classof(const Decl *D) { return classofKind(D->getKind()); }
2514 TypeAliasTemplateDecl(ASTContext &C, DeclContext *DC, SourceLocation L,
2517 : RedeclarableTemplateDecl(TypeAliasTemplate, C, DC, L, Name, Params,
2549 static_cast<RedeclarableTemplateDecl *>(this)->getPreviousDecl());
2554 this)->getPreviousDecl());
2563 static TypeAliasTemplateDecl *Create(ASTContext &C, DeclContext *DC,
2571 GlobalDeclID ID);
2574 static bool classof(const Decl *D) { return classofKind(D->getKind()); }
2633 VarTemplateSpecializationDecl(Kind DK, ASTContext &Context, DeclContext *DC,
2648 Create(ASTContext &Context, DeclContext *DC, SourceLocation StartLoc,
2653 GlobalDeclID ID);
2659 VarDecl *Recent = static_cast<VarDecl *>(this)->getMostRecentDecl();
2728 return PartialSpec->PartialSpecialization;
2747 return *PartialSpec->TemplateArgs;
2760 PS->PartialSpecialization = PartialSpec;
2761 PS->TemplateArgs = TemplateArgs;
2777 return Info->TemplateArgsAsWritten;
2785 Info->TemplateArgsAsWritten = ArgsWritten;
2799 return Info->ExternKeywordLoc;
2809 return Info->TemplateKeywordLoc;
2818 void Profile(llvm::FoldingSetNodeID &ID) const {
2819 Profile(ID, TemplateArgs->asArray(), getASTContext());
2822 static void Profile(llvm::FoldingSetNodeID &ID,
2825 ID.AddInteger(TemplateArgs.size());
2827 TemplateArg.Profile(ID, Context);
2830 static bool classof(const Decl *D) { return classofKind(D->getKind()); }
2852 ASTContext &Context, DeclContext *DC, SourceLocation StartLoc,
2869 Create(ASTContext &Context, DeclContext *DC, SourceLocation StartLoc,
2876 CreateDeserialized(ASTContext &C, GlobalDeclID ID);
2881 this)->getMostRecentDecl());
2891 /// constrained-parameters.
2896 TemplateParams->getAssociatedConstraints(AC);
2900 return TemplateParams->hasAssociatedConstraints();
2926 return First->InstantiatedFromMember.getPointer();
2932 First->InstantiatedFromMember.setPointer(PartialSpec);
2954 return First->InstantiatedFromMember.getInt();
2960 assert(First->InstantiatedFromMember.getPointer() &&
2962 return First->InstantiatedFromMember.setInt(true);
2967 void Profile(llvm::FoldingSetNodeID &ID) const {
2968 Profile(ID, getTemplateArgs().asArray(), getTemplateParameters(),
2973 Profile(llvm::FoldingSetNodeID &ID, ArrayRef<TemplateArgument> TemplateArgs,
2976 static bool classof(const Decl *D) { return classofKind(D->getKind()); }
3010 VarTemplateDecl(ASTContext &C, DeclContext *DC, SourceLocation L,
3013 : RedeclarableTemplateDecl(VarTemplate, C, DC, L, Name, Params, Decl) {}
3025 /// Load any lazily-loaded specializations from the external source.
3036 return getTemplatedDecl()->isThisDeclarationADefinition();
3042 static VarTemplateDecl *Create(ASTContext &C, DeclContext *DC,
3048 static VarTemplateDecl *CreateDeserialized(ASTContext &C, GlobalDeclID ID);
3070 static_cast<RedeclarableTemplateDecl *>(this)->getPreviousDecl());
3075 this)->getPreviousDecl());
3080 static_cast<RedeclarableTemplateDecl *>(this)->getMostRecentDecl());
3083 return const_cast<VarTemplateDecl *>(this)->getMostRecentDecl();
3135 static bool classof(const Decl *D) { return classofKind(D->getKind()); }
3144 ConceptDecl(DeclContext *DC, SourceLocation L, DeclarationName Name,
3146 : TemplateDecl(Concept, DC, L, Name, Params),
3149 static ConceptDecl *Create(ASTContext &C, DeclContext *DC,
3153 static ConceptDecl *CreateDeserialized(ASTContext &C, GlobalDeclID ID);
3160 return SourceRange(getTemplateParameters()->getTemplateLoc(),
3161 ConstraintExpr->getEndLoc());
3165 return isa<TemplateTypeParmDecl>(getTemplateParameters()->getParam(0));
3172 return const_cast<ConceptDecl *>(this)->getCanonicalDecl();
3176 static bool classof(const Decl *D) { return classofKind(D->getKind()); }
3193 ImplicitConceptSpecializationDecl(DeclContext *DC, SourceLocation SL,
3199 Create(const ASTContext &C, DeclContext *DC, SourceLocation SL,
3202 CreateDeserialized(const ASTContext &C, GlobalDeclID ID,
3212 static bool classof(const Decl *D) { return classofKind(D->getKind()); }
3237 TemplateParamObjectDecl(DeclContext *DC, QualType T, const APValue &V)
3238 : ValueDecl(TemplateParamObject, DC, SourceLocation(), DeclarationName(),
3245 GlobalDeclID ID);
3254 /// Print this template parameter object in a human-readable format.
3269 static void Profile(llvm::FoldingSetNodeID &ID, QualType T,
3271 ID.AddPointer(T.getCanonicalType().getAsOpaquePtr());
3272 V.Profile(ID);
3274 void Profile(llvm::FoldingSetNodeID &ID) {
3275 Profile(ID, getType(), getValue());
3285 static bool classof(const Decl *D) { return classofKind(D->getKind()); }
3320 if (TTP->isExpandedParameterPack())
3321 return TTP->getNumExpansionParameters();
3325 if (NTTP->isExpandedParameterPack())
3326 return NTTP->getNumExpansionTypes();
3330 if (TTP->isExpandedParameterPack())
3331 return TTP->getNumExpansionTemplateParameters();