14#ifndef LLVM_CLANG_AST_DECLTEMPLATE_H
15#define LLVM_CLANG_AST_DECLTEMPLATE_H
31#include "llvm/ADT/ArrayRef.h"
32#include "llvm/ADT/FoldingSet.h"
33#include "llvm/ADT/PointerIntPair.h"
34#include "llvm/ADT/PointerUnion.h"
35#include "llvm/ADT/iterator.h"
36#include "llvm/ADT/iterator_range.h"
37#include "llvm/Support/Casting.h"
38#include "llvm/Support/Compiler.h"
39#include "llvm/Support/TrailingObjects.h"
74 :
private llvm::TrailingObjects<TemplateParameterList, NamedDecl *,
87 unsigned NumParams : 29;
91 LLVM_PREFERRED_TYPE(
bool)
92 unsigned ContainsUnexpandedParameterPack : 1;
95 LLVM_PREFERRED_TYPE(
bool)
96 unsigned HasRequiresClause : 1;
100 LLVM_PREFERRED_TYPE(
bool)
101 unsigned HasConstrainedParameters : 1;
113 return HasRequiresClause ? 1 : 0;
117 template <
size_t N,
bool HasRequiresClause>
126 Expr *RequiresClause);
141 unsigned size()
const {
return NumParams; }
142 bool empty()
const {
return NumParams == 0; }
148 assert(Idx <
size() &&
"Template parameter index out-of-range");
152 assert(Idx <
size() &&
"Template parameter index out-of-range");
177 if (P->isParameterPack())
184 return HasRequiresClause ? getTrailingObjects<Expr *>()[0] :
nullptr;
189 return HasRequiresClause ? getTrailingObjects<Expr *>()[0] :
nullptr;
215 bool OmitTemplateKW =
false)
const;
227template <
size_t N,
bool HasRequiresClause>
229 :
public TemplateParameterList::FixedSizeStorageOwner {
230 typename TemplateParameterList::FixedSizeStorage<
232 N, HasRequiresClause ? 1u : 0u
241 Expr *RequiresClause)
242 : FixedSizeStorageOwner(
243 (assert(N == Params.size()),
244 assert(HasRequiresClause == (RequiresClause !=
nullptr)),
246 TemplateLoc, LAngleLoc, Params, RAngleLoc, RequiresClause))) {}
250class TemplateArgumentList final
251 :
private llvm::TrailingObjects<TemplateArgumentList, TemplateArgument> {
254 unsigned NumArguments;
264 TemplateArgumentList &
operator=(
const TemplateArgumentList &) =
delete;
273 assert(Idx < NumArguments &&
"Invalid template argument index");
282 return getTrailingObjects(
size());
287 unsigned size()
const {
return NumArguments; }
303template<
typename ParmDecl,
typename ArgType>
309 ParmDecl *PrevDeclWithDefaultArg;
312 static_assert(
sizeof(Chain) ==
sizeof(
void *) * 2,
313 "non-pointer argument type?");
315 llvm::PointerUnion<ArgType, ParmDecl*, Chain*> ValueOrInherited;
317 static ParmDecl *getParmOwningDefaultArg(ParmDecl *Parm) {
319 if (
auto *Prev = dyn_cast<ParmDecl *>(Storage.ValueOrInherited))
321 assert(!
isa<ParmDecl *>(Parm->getDefaultArgStorage().ValueOrInherited) &&
322 "should only be one level of indirection");
330 bool isSet()
const {
return !ValueOrInherited.isNull(); }
340 if (
const auto *Prev = dyn_cast<ParmDecl *>(ValueOrInherited))
341 Storage = &Prev->getDefaultArgStorage();
342 if (
const auto *
C = dyn_cast<Chain *>(Storage->ValueOrInherited))
350 if (
const auto *D = dyn_cast<ParmDecl *>(ValueOrInherited))
352 if (
const auto *
C = dyn_cast<Chain *>(ValueOrInherited))
353 return C->PrevDeclWithDefaultArg;
359 assert(!
isSet() &&
"default argument already set");
360 ValueOrInherited = Arg;
365 InheritedFrom = getParmOwningDefaultArg(InheritedFrom);
367 ValueOrInherited = InheritedFrom;
368 else if ([[maybe_unused]]
auto *D =
369 dyn_cast<ParmDecl *>(ValueOrInherited)) {
370 assert(
C.isSameDefaultTemplateArgument(D, InheritedFrom));
373 }
else if (
auto *Inherited = dyn_cast<Chain *>(ValueOrInherited)) {
374 assert(
C.isSameDefaultTemplateArgument(Inherited->PrevDeclWithDefaultArg,
376 Inherited->PrevDeclWithDefaultArg = InheritedFrom;
384 ValueOrInherited = ArgType();
398 void anchor()
override;
439 return K >= firstTemplate && K <= lastTemplate;
459 assert(
TemplatedDecl == NewTemplatedDecl &&
"Inconsistent TemplatedDecl");
468class FunctionTemplateSpecializationInfo final
469 :
public llvm::FoldingSetNode,
470 private llvm::TrailingObjects<FunctionTemplateSpecializationInfo,
471 MemberSpecializationInfo *> {
474 llvm::PointerIntPair<FunctionDecl *, 1, bool> Function;
480 llvm::PointerIntPair<FunctionTemplateDecl *, 2> Template;
496 FunctionTemplateSpecializationInfo(
501 : Function(FD, MSInfo ?
true :
false), Template(Template, TSK - 1),
506 getTrailingObjects()[0] = MSInfo;
509 size_t numTrailingObjects()
const {
return Function.getInt(); }
514 static FunctionTemplateSpecializationInfo *
546 "Cannot encode TSK_Undeclared for a function template specialization");
547 Template.setInt(TSK - 1);
596 return numTrailingObjects() ? getTrailingObjects()[0] :
nullptr;
606 ID.AddInteger(TemplateArgs.size());
618 llvm::PointerIntPair<NamedDecl *, 2> MemberAndTSK;
627 : MemberAndTSK(IF, TSK - 1), PointOfInstantiation(POI) {
629 "Cannot encode undeclared template specializations for members");
648 "Cannot encode undeclared template specializations for members");
649 MemberAndTSK.setInt(TSK - 1);
656 return PointOfInstantiation;
661 PointOfInstantiation = POI;
687class DependentFunctionTemplateSpecializationInfo final
688 :
private llvm::TrailingObjects<DependentFunctionTemplateSpecializationInfo,
689 FunctionTemplateDecl *> {
690 friend TrailingObjects;
693 unsigned NumCandidates;
695 DependentFunctionTemplateSpecializationInfo(
703 static DependentFunctionTemplateSpecializationInfo *
709 return getTrailingObjects(NumCandidates);
731 void anchor()
override;
742 return D->getTemplateArgs().asArray();
746 template <
typename EntryType,
typename SETraits = SpecEntryTraits<EntryType>,
747 typename DeclType =
typename SETraits::DeclType>
749 : llvm::iterator_adaptor_base<
750 SpecIterator<EntryType, SETraits, DeclType>,
751 typename llvm::FoldingSetVector<EntryType>::iterator,
752 typename std::iterator_traits<typename llvm::FoldingSetVector<
753 EntryType>::iterator>::iterator_category,
754 DeclType *, ptrdiff_t, DeclType *, DeclType *> {
757 typename llvm::FoldingSetVector<EntryType>::iterator SetIter)
761 return SETraits::getDecl(&*this->I)->getMostRecentDecl();
767 template <
typename EntryType>
768 static SpecIterator<EntryType>
778 template <
class EntryType,
typename... ProfileArguments>
781 llvm::FoldingSetInsertToken &InsertToken,
782 ProfileArguments... ProfileArgs);
784 template <
class EntryType,
typename... ProfileArguments>
787 llvm::FoldingSetInsertToken &InsertToken,
788 ProfileArguments... ProfileArgs);
790 template <
class Derived,
class EntryType>
793 llvm::FoldingSetInsertToken InsertToken);
803 llvm::PointerIntPair<RedeclarableTemplateDecl *, 1, bool>
861 assert(
getCommonPtr()->InstantiatedFromMember.getPointer() &&
862 "Only member templates can be member template specializations");
907 assert(!
getCommonPtr()->InstantiatedFromMember.getPointer());
936 return K >= firstRedeclarableTemplate && K <= lastRedeclarableTemplate;
983 llvm::FoldingSetVector<FunctionTemplateSpecializationInfo> &
991 llvm::FoldingSetInsertToken InsertToken);
1034 llvm::FoldingSetInsertToken &InsertToken);
1048 return cast_or_null<FunctionTemplateDecl>(
1052 return cast_or_null<FunctionTemplateDecl>(
1066 return cast_or_null<FunctionTemplateDecl>(
1145 assert(D >= 0 &&
"The depth cannot be negative");
1146 assert(D < (1 <<
DepthWidth) &&
"The depth is too large");
1153 assert(P >= 0 &&
"The position cannot be negative");
1154 assert(P < (1 <<
PositionWidth) &&
"The position is too large");
1169 private llvm::TrailingObjects<TemplateTypeParmDecl, TypeConstraint> {
1172 friend TrailingObjects;
1182 bool HasTypeConstraint : 1;
1187 bool TypeConstraintInitialized : 1;
1193 using DefArgStorage =
1195 DefArgStorage DefaultArgument;
1200 :
TypeDecl(TemplateTypeParm, DC, IdLoc, Id, KeyLoc), Typename(Typename),
1201 HasTypeConstraint(HasTypeConstraint), TypeConstraintInitialized(
false),
1202 NumExpanded(NumExpanded) {}
1208 bool Typename,
bool ParameterPack,
bool HasTypeConstraint =
false,
1214 bool HasTypeConstraint);
1222 return Typename && !HasTypeConstraint;
1234 return DefaultArgument.isSet() ? *DefaultArgument.get() : NoneLoc;
1243 return DefaultArgument.isInherited();
1253 TemplateTypeParmDecl *Prev) {
1254 DefaultArgument.setInherited(
C, Prev);
1259 DefaultArgument.clear();
1283 if (TC->hasExplicitTemplateArgs())
1284 for (
const auto &ArgLoc : TC->getTemplateArgsAsWritten()->arguments())
1285 if (ArgLoc.getArgument().containsUnexpandedParameterPack())
1317 return TypeConstraintInitialized ? getTrailingObjects() :
nullptr;
1321 Expr *ImmediatelyDeclaredConstraint,
1326 return HasTypeConstraint;
1336 if (HasTypeConstraint)
1353class NonTypeTemplateParmDecl final
1356 private llvm::TrailingObjects<NonTypeTemplateParmDecl,
1357 std::pair<QualType, TypeSourceInfo *>,
1360 friend TrailingObjects;
1364 using DefArgStorage =
1366 DefArgStorage DefaultArgument;
1377 bool ExpandedParameterPack =
false;
1380 unsigned NumExpandedTypes = 0;
1382 size_t numTrailingObjects(
1383 OverloadToken<std::pair<QualType, TypeSourceInfo *>>)
const {
1384 return NumExpandedTypes;
1391 :
DeclaratorDecl(NonTypeTemplateParm, DC, IdLoc, Id,
T, TInfo, StartLoc),
1394 NonTypeTemplateParmDecl(
DeclContext *DC, SourceLocation StartLoc,
1395 SourceLocation IdLoc,
int D,
int P,
1396 const IdentifierInfo *Id, QualType T,
1397 TypeSourceInfo *TInfo,
1402 static NonTypeTemplateParmDecl *
1404 SourceLocation IdLoc,
int D,
int P,
const IdentifierInfo *Id,
1405 QualType T,
bool ParameterPack, TypeSourceInfo *TInfo);
1407 static NonTypeTemplateParmDecl *
1409 SourceLocation IdLoc,
int D,
int P,
const IdentifierInfo *Id,
1413 static NonTypeTemplateParmDecl *
1417 unsigned NumExpandedTypes,
1418 bool HasTypeConstraint);
1437 return DefaultArgument.isSet() ? *DefaultArgument.get() : NoneLoc;
1446 return DefaultArgument.isInherited();
1455 NonTypeTemplateParmDecl *Parm) {
1456 DefaultArgument.setInherited(
C, Parm);
1479 return ParameterPack &&
getType()->
getAs<PackExpansionType>();
1511 assert(ExpandedParameterPack &&
"Not an expansion parameter pack");
1512 return NumExpandedTypes;
1518 assert(I < NumExpandedTypes &&
"Out-of-range expansion type index");
1519 auto TypesAndInfos =
1520 getTrailingObjects<std::pair<QualType, TypeSourceInfo *>>();
1521 return TypesAndInfos[I].first;
1527 assert(I < NumExpandedTypes &&
"Out-of-range expansion type index");
1528 auto TypesAndInfos =
1529 getTrailingObjects<std::pair<QualType, TypeSourceInfo *>>();
1530 return TypesAndInfos[I].second;
1541 *getTrailingObjects<Expr *>() = E;
1548 return AT && AT->isConstrained();
1575class TemplateTemplateParmDecl final
1578 private llvm::TrailingObjects<TemplateTemplateParmDecl,
1579 TemplateParameterList *> {
1581 using DefArgStorage =
1583 DefArgStorage DefaultArgument;
1586 unsigned ParameterKind : 3;
1592 LLVM_PREFERRED_TYPE(
bool)
1593 unsigned Typename : 1;
1596 LLVM_PREFERRED_TYPE(
bool)
1597 unsigned ParameterPack : 1;
1602 LLVM_PREFERRED_TYPE(
bool)
1603 unsigned ExpandedParameterPack : 1;
1606 unsigned NumExpandedParams = 0;
1612 :
TemplateDecl(TemplateTemplateParm, DC, L, Id, Params),
1614 Typename(Typename), ParameterPack(ParameterPack),
1615 ExpandedParameterPack(
false) {}
1622 void anchor()
override;
1629 static TemplateTemplateParmDecl *
1634 static TemplateTemplateParmDecl *
1642 static TemplateTemplateParmDecl *
1672 return ParameterPack &&
1699 assert(ExpandedParameterPack &&
"Not an expansion parameter pack");
1700 return NumExpandedParams;
1706 assert(I < NumExpandedParams &&
"Out-of-range expansion type index");
1707 return getTrailingObjects()[I];
1719 return DefaultArgument.isSet() ? *DefaultArgument.get() : NoneLoc;
1728 return DefaultArgument.isInherited();
1737 TemplateTemplateParmDecl *Prev) {
1738 DefaultArgument.setInherited(
C, Prev);
1775 void anchor()
override;
1785 return new (
C, DC) BuiltinTemplateDecl(
C, DC, Name, BTK);
1831 public llvm::FoldingSetNode {
1835 struct SpecializedPartialSpecialization {
1846 llvm::PointerUnion<ClassTemplateDecl *, SpecializedPartialSpecialization *>
1847 SpecializedTemplate;
1861 unsigned SpecializationKind : 3;
1868 LLVM_PREFERRED_TYPE(
bool)
1869 unsigned StrictPackMatch : 1;
1877 bool StrictPackMatch,
1914 return *TemplateArgs;
1918 TemplateArgs = Args;
1954 SpecializedTemplate = Specialized;
1958 SpecializationKind = TSK;
1967 return PointOfInstantiation;
1971 assert(Loc.isValid() &&
"point of instantiation must be valid!");
1972 PointOfInstantiation = Loc;
1994 if (
const auto *PartialSpec =
1995 dyn_cast<SpecializedPartialSpecialization *>(SpecializedTemplate))
1996 return PartialSpec->PartialSpecialization;
2013 if (
const auto *PartialSpec =
2014 dyn_cast<SpecializedPartialSpecialization *>(SpecializedTemplate))
2015 return *PartialSpec->TemplateArgs;
2026 "Already set to a class template partial specialization!");
2027 auto *PS =
new (
getASTContext()) SpecializedPartialSpecialization();
2028 PS->PartialSpecialization = PartialSpec;
2029 PS->TemplateArgs = TemplateArgs;
2030 SpecializedTemplate = PS;
2037 "Previously set to a class template partial specialization!");
2038 SpecializedTemplate = TemplDecl;
2045 dyn_cast_if_present<ExplicitInstantiationInfo *>(ExplicitInfo))
2046 return Info->TemplateArgsAsWritten;
2054 dyn_cast_if_present<ExplicitInstantiationInfo *>(ExplicitInfo))
2055 Info->TemplateArgsAsWritten = ArgsWritten;
2057 ExplicitInfo = ArgsWritten;
2069 dyn_cast_if_present<ExplicitInstantiationInfo *>(ExplicitInfo))
2070 return Info->ExternKeywordLoc;
2080 dyn_cast_if_present<ExplicitInstantiationInfo *>(ExplicitInfo))
2081 return Info->TemplateKeywordLoc;
2097 ID.AddInteger(TemplateArgs.size());
2105 return K >= firstClassTemplateSpecialization &&
2106 K <= lastClassTemplateSpecialization;
2110class ClassTemplatePartialSpecializationDecl
2120 llvm::PointerIntPair<ClassTemplatePartialSpecializationDecl *, 1, bool>
2121 InstantiatedFromMember;
2125 ClassTemplatePartialSpecializationDecl(
2130 ClassTemplatePartialSpecializationDecl *PrevDecl);
2132 ClassTemplatePartialSpecializationDecl(
ASTContext &
C)
2134 InstantiatedFromMember(
nullptr,
false) {}
2136 void anchor()
override;
2142 static ClassTemplatePartialSpecializationDecl *
2147 ClassTemplatePartialSpecializationDecl *PrevDecl);
2149 static ClassTemplatePartialSpecializationDecl *
2160 return TemplateParams;
2171 TemplateParams->getAssociatedConstraints(AC);
2175 return TemplateParams->hasAssociatedConstraints();
2201 return First->InstantiatedFromMember.getPointer();
2209 ClassTemplatePartialSpecializationDecl *PartialSpec) {
2211 First->InstantiatedFromMember.setPointer(PartialSpec);
2233 return First->InstantiatedFromMember.getInt();
2241 return First->InstantiatedFromMember.setInt(
true);
2263 return K == ClassTemplatePartialSpecialization;
2279 llvm::FoldingSetVector<ClassTemplatePartialSpecializationDecl>
2289 llvm::FoldingSetVector<ClassTemplateSpecializationDecl> &
2294 llvm::FoldingSetVector<ClassTemplatePartialSpecializationDecl> &
2344 llvm::FoldingSetInsertToken &InsertToken);
2349 llvm::FoldingSetInsertToken InsertToken);
2363 return cast_or_null<ClassTemplateDecl>(
2367 return cast_or_null<ClassTemplateDecl>(
2381 return cast_or_null<ClassTemplateDecl>(
2390 llvm::FoldingSetInsertToken &InsertToken);
2395 llvm::FoldingSetInsertToken InsertToken);
2470class FriendTemplateDecl final
2472 private llvm::TrailingObjects<FriendTemplateDecl,
2473 TemplateParameterList *> {
2474 void anchor()
override;
2477 unsigned NumTPLists = 0;
2486 NumTPLists(FriendTPLists.size()),
Template(Template) {
2487 assert(!FriendTPLists.empty());
2488 llvm::copy(FriendTPLists, getTrailingObjects());
2492 :
FriendDecl(Decl::FriendTemplate,
Empty), NumTPLists(NumFriendTPLists) {
2493 assert(NumFriendTPLists != 0);
2509 static FriendTemplateDecl *
2512 ArrayRef<TemplateParameterList *> FriendTPLists,
2513 SourceLocation EllipsisLoc = {});
2516 unsigned NumFriendTPLists);
2525 if (Template.isNull())
2533 return Template.getAsTemplateDecl();
2537 return ArrayRef(getTrailingObjects(), NumTPLists);
2589 return cast_or_null<TypeAliasTemplateDecl>(
2593 return cast_or_null<TypeAliasTemplateDecl>(
2599 return cast_or_null<TypeAliasTemplateDecl>(
2633 public llvm::FoldingSetNode {
2638 struct SpecializedPartialSpecialization {
2649 llvm::PointerUnion<VarTemplateDecl *, SpecializedPartialSpecialization *>
2650 SpecializedTemplate;
2664 unsigned SpecializationKind : 3;
2670 LLVM_PREFERRED_TYPE(
bool)
2671 unsigned IsCompleteDefinition : 1;
2735 SpecializationKind = TSK;
2740 return PointOfInstantiation;
2744 assert(Loc.isValid() &&
"point of instantiation must be valid!");
2745 PointOfInstantiation = Loc;
2754 llvm::PointerUnion<VarTemplateDecl *, VarTemplatePartialSpecializationDecl *>
2765 llvm::PointerUnion<VarTemplateDecl *, VarTemplatePartialSpecializationDecl *>
2767 if (
const auto *PartialSpec =
2768 dyn_cast<SpecializedPartialSpecialization *>(SpecializedTemplate))
2769 return PartialSpec->PartialSpecialization;
2786 if (
const auto *PartialSpec =
2787 dyn_cast<SpecializedPartialSpecialization *>(SpecializedTemplate))
2788 return *PartialSpec->TemplateArgs;
2799 "Already set to a variable template partial specialization!");
2800 auto *PS =
new (
getASTContext()) SpecializedPartialSpecialization();
2801 PS->PartialSpecialization = PartialSpec;
2802 PS->TemplateArgs = TemplateArgs;
2803 SpecializedTemplate = PS;
2810 "Previously set to a variable template partial specialization!");
2811 SpecializedTemplate = TemplDecl;
2818 dyn_cast_if_present<ExplicitInstantiationInfo *>(ExplicitInfo))
2819 return Info->TemplateArgsAsWritten;
2827 dyn_cast_if_present<ExplicitInstantiationInfo *>(ExplicitInfo))
2828 Info->TemplateArgsAsWritten = ArgsWritten;
2830 ExplicitInfo = ArgsWritten;
2842 dyn_cast_if_present<ExplicitInstantiationInfo *>(ExplicitInfo))
2843 return Info->ExternKeywordLoc;
2853 dyn_cast_if_present<ExplicitInstantiationInfo *>(ExplicitInfo))
2854 return Info->TemplateKeywordLoc;
2870 ID.AddInteger(TemplateArgs.size());
2878 return K >= firstVarTemplateSpecialization &&
2879 K <= lastVarTemplateSpecialization;
2883class VarTemplatePartialSpecializationDecl
2893 llvm::PointerIntPair<VarTemplatePartialSpecializationDecl *, 1, bool>
2894 InstantiatedFromMember;
2896 VarTemplatePartialSpecializationDecl(
2902 VarTemplatePartialSpecializationDecl(
ASTContext &Context)
2905 InstantiatedFromMember(
nullptr,
false) {}
2907 void anchor()
override;
2913 static VarTemplatePartialSpecializationDecl *
2920 static VarTemplatePartialSpecializationDecl *
2931 return TemplateParams;
2948 TemplateParams->getAssociatedConstraints(AC);
2952 return TemplateParams->hasAssociatedConstraints();
2978 return First->InstantiatedFromMember.getPointer();
2984 First->InstantiatedFromMember.setPointer(PartialSpec);
3006 return First->InstantiatedFromMember.getInt();
3014 return First->InstantiatedFromMember.setInt(
true);
3031 return K == VarTemplatePartialSpecialization;
3047 llvm::FoldingSetVector<VarTemplatePartialSpecializationDecl>
3054 llvm::FoldingSetVector<VarTemplateSpecializationDecl> &
3059 llvm::FoldingSetVector<VarTemplatePartialSpecializationDecl> &
3106 llvm::FoldingSetInsertToken &InsertToken);
3111 llvm::FoldingSetInsertToken InsertToken);
3123 return cast_or_null<VarTemplateDecl>(
3127 return cast_or_null<VarTemplateDecl>(
3141 return cast_or_null<VarTemplateDecl>(
3150 llvm::FoldingSetInsertToken &InsertToken);
3155 llvm::FoldingSetInsertToken InsertToken);
3247class ImplicitConceptSpecializationDecl final
3249 private llvm::TrailingObjects<ImplicitConceptSpecializationDecl,
3251 unsigned NumTemplateArgs;
3255 ImplicitConceptSpecializationDecl(
EmptyShell Empty,
unsigned NumTemplateArgs);
3258 static ImplicitConceptSpecializationDecl *
3261 static ImplicitConceptSpecializationDecl *
3263 unsigned NumTemplateArgs);
3266 return getTrailingObjects(NumTemplateArgs);
3290 public Mergeable<TemplateParamObjectDecl>,
3291 public llvm::FoldingSetNode {
3303 static TemplateParamObjectDecl *CreateDeserialized(
ASTContext &
C,
3330 ID.AddPointer(
T.getCanonicalType().getAsOpaquePtr());
3453 return Instantiations;
3472 if (
auto *PD = dyn_cast<TemplateTypeParmDecl *>(P))
3474 if (
auto *PD = dyn_cast<NonTypeTemplateParmDecl *>(P))
3480 auto *TD = dyn_cast<TemplateDecl>(D);
3485 if (
const auto *TTP = dyn_cast<TemplateTemplateParmDecl>(TD))
3505 if (
const auto *TTP = dyn_cast<TemplateTypeParmDecl>(Param)) {
3510 if (
const auto *NTTP = dyn_cast<NonTypeTemplateParmDecl>(Param)) {
3511 if (NTTP->isExpandedParameterPack())
3512 return NTTP->getNumExpansionTypes();
3515 if (
const auto *TTP = dyn_cast<TemplateTemplateParmDecl>(Param)) {
3516 if (TTP->isExpandedParameterPack())
3517 return TTP->getNumExpansionTemplateParameters();
3520 return std::nullopt;
3525std::tuple<NamedDecl *, TemplateArgument>
3541class ExplicitInstantiationDecl final
3543 private llvm::TrailingObjects<ExplicitInstantiationDecl,
3544 NestedNameSpecifierLoc,
3545 const ASTTemplateArgumentListInfo *> {
3548 friend TrailingObjects;
3551 llvm::PointerIntPair<NamedDecl *, 3, unsigned> SpecAndTSK;
3559 llvm::PointerIntPair<TypeSourceInfo *, 2, unsigned> TypeAndFlags;
3568 enum TrailingFlags :
unsigned {
3569 HasQualifierFlag = 1,
3570 HasArgsAsWrittenFlag = 2,
3573 size_t numTrailingObjects(OverloadToken<NestedNameSpecifierLoc>)
const {
3581 std::optional<TypeLoc> getClassTypeLoc()
const {
3583 return std::nullopt;
3584 if (
auto *TSI = TypeAndFlags.getPointer())
3585 return TSI->getTypeLoc();
3586 return std::nullopt;
3590 TypeSourceInfo *getRawTypeSourceInfo()
const {
3591 return TypeAndFlags.getPointer();
3595 const ASTTemplateArgumentListInfo *getTrailingArgsInfo()
const {
3598 return *getTrailingObjects<const ASTTemplateArgumentListInfo *>();
3601 ExplicitInstantiationDecl(
3603 SourceLocation TemplateLoc, NestedNameSpecifierLoc QualifierLoc,
3604 const ASTTemplateArgumentListInfo *ArgsAsWritten, SourceLocation NameLoc,
3611 static ExplicitInstantiationDecl *
3613 SourceLocation ExternLoc, SourceLocation TemplateLoc,
3614 NestedNameSpecifierLoc QualifierLoc,
3615 const ASTTemplateArgumentListInfo *ArgsAsWritten,
3616 SourceLocation NameLoc, TypeSourceInfo *TypeAsWritten,
3619 static ExplicitInstantiationDecl *
3636 return TypeAndFlags.getInt() & HasQualifierFlag;
3639 return TypeAndFlags.getInt() & HasArgsAsWrittenFlag;
This file provides AST data structures related to concepts.
Defines the clang::ASTContext interface.
#define BuiltinTemplate(BTName)
Defines the C++ Decl subclasses, other than those for templates (found in DeclTemplate....
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::TemplateNameKind enum.
C Language Family Type Representation.
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
APValue - This class implements a discriminated union of [uninitialized] [APSInt] [APFloat],...
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
SourceRange getSourceRange() const override LLVM_READONLY
Source range that this declaration covers.
BuiltinTemplateKind getBuiltinTemplateKind() const
static BuiltinTemplateDecl * Create(const ASTContext &C, DeclContext *DC, DeclarationName Name, BuiltinTemplateKind BTK)
static bool classof(const Decl *D)
static bool classofKind(Kind K)
bool isPackProducingBuiltinTemplate() const
static bool classofKind(Kind K)
const NonTypeTemplateParmDecl * getIndexTemplateParm() const
SourceRange getSourceRange() const override LLVM_READONLY
Source range that this declaration covers.
CXXExpansionStmtPattern * getExpansionPattern()
static CXXExpansionStmtDecl * CreateDeserialized(ASTContext &C, GlobalDeclID ID)
CXXExpansionStmtInstantiation * getInstantiations()
static bool classof(const Decl *D)
friend class ASTDeclReader
const CXXExpansionStmtInstantiation * getInstantiations() const
void setInstantiations(CXXExpansionStmtInstantiation *S)
const CXXExpansionStmtPattern * getExpansionPattern() const
NonTypeTemplateParmDecl * getIndexTemplateParm()
void setExpansionPattern(CXXExpansionStmtPattern *S)
Represents the code generated for an expanded expansion statement.
CXXExpansionStmtPattern - Represents an unexpanded C++ expansion statement.
Represents a C++ struct/union/class.
CXXRecordDecl * getMostRecentDecl()
TemplateSpecializationKind getTemplateSpecializationKind() const
Determine whether this particular class is a specialization or instantiation of a class template or m...
CXXRecordDecl(Kind K, TagKind TK, const ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, CXXRecordDecl *PrevDecl)
CXXRecordDecl * getDefinitionOrSelf() const
Declaration of a class template.
ClassTemplatePartialSpecializationDecl * findPartialSpecialization(ArrayRef< TemplateArgument > Args, TemplateParameterList *TPL, llvm::FoldingSetInsertToken &InsertToken)
Return the partial specialization with the provided arguments if it exists, otherwise return the inse...
llvm::FoldingSetVector< ClassTemplateSpecializationDecl > & getSpecializations() const
Retrieve the set of specializations of this class template.
ClassTemplateDecl * getMostRecentDecl()
spec_iterator spec_begin() const
spec_iterator spec_end() const
CXXRecordDecl * getTemplatedDecl() const
Get the underlying class declarations of the template.
static bool classofKind(Kind K)
llvm::FoldingSetVector< ClassTemplatePartialSpecializationDecl > & getPartialSpecializations() const
Retrieve the set of partial specializations of this class template.
ClassTemplateDecl(ASTContext &C, DeclContext *DC, SourceLocation L, DeclarationName Name, TemplateParameterList *Params, NamedDecl *Decl)
CommonBase * newCommon(ASTContext &C) const override
friend class ASTDeclReader
llvm::iterator_range< spec_iterator > spec_range
static bool classof(const Decl *D)
ClassTemplateSpecializationDecl * findSpecialization(ArrayRef< TemplateArgument > Args, llvm::FoldingSetInsertToken &InsertToken)
Return the specialization with the provided arguments if it exists, otherwise return the insertion po...
const ClassTemplateDecl * getMostRecentDecl() const
ClassTemplateDecl * getCanonicalDecl() override
Retrieves the "canonical" declaration of the given declaration.
ClassTemplatePartialSpecializationDecl * findPartialSpecInstantiatedFromMember(ClassTemplatePartialSpecializationDecl *D)
Find a class template partial specialization which was instantiated from the given member partial spe...
const ClassTemplateDecl * getCanonicalDecl() const
bool isThisDeclarationADefinition() const
Returns whether this template declaration defines the primary class pattern.
friend class ASTDeclWriter
ClassTemplateDecl * getPreviousDecl()
Retrieve the previous declaration of this class template, or nullptr if no such declaration exists.
SpecIterator< ClassTemplateSpecializationDecl > spec_iterator
void LoadLazySpecializations(bool OnlyPartial=false) const
Load any lazily-loaded specializations from the external source.
void AddSpecialization(ClassTemplateSpecializationDecl *D, llvm::FoldingSetInsertToken InsertToken)
Insert the specified specialization knowing that it is not already in.
const ClassTemplateDecl * getPreviousDecl() const
ClassTemplateDecl * getInstantiatedFromMemberTemplate() const
CanQualType getCanonicalInjectedSpecializationType(const ASTContext &Ctx) const
Retrieve the canonical template specialization type of the injected-class-name for this class templat...
void setCommonPtr(Common *C)
spec_range specializations() const
void AddPartialSpecialization(ClassTemplatePartialSpecializationDecl *D, llvm::FoldingSetInsertToken InsertToken)
Insert the specified partial specialization knowing that it is not already in.
friend class TemplateDeclInstantiator
Common * getCommonPtr() const
static ClassTemplateDecl * CreateDeserialized(ASTContext &C, GlobalDeclID ID)
Create an empty class template node.
ClassTemplatePartialSpecializationDecl * getInstantiatedFromMember() const
Retrieve the member class template partial specialization from which this particular class template p...
ClassTemplatePartialSpecializationDecl * getInstantiatedFromMemberTemplate() const
ClassTemplatePartialSpecializationDecl * getMostRecentDecl()
CanQualType getCanonicalInjectedSpecializationType(const ASTContext &Ctx) const
Retrieves the canonical injected specialization type for this partial specialization.
void setInstantiatedFromMember(ClassTemplatePartialSpecializationDecl *PartialSpec)
void getAssociatedConstraints(llvm::SmallVectorImpl< AssociatedConstraint > &AC) const
All associated constraints of this partial specialization, including the requires clause and any cons...
bool hasAssociatedConstraints() const
void Profile(llvm::FoldingSetNodeID &ID) const
bool isMemberSpecialization() const
Determines whether this class template partial specialization template was a specialization of a memb...
friend class ASTDeclReader
SourceRange getSourceRange() const override LLVM_READONLY
Source range that this declaration covers.
void setMemberSpecialization()
Note that this member template is a specialization.
friend class ASTDeclWriter
static bool classofKind(Kind K)
static ClassTemplatePartialSpecializationDecl * CreateDeserialized(ASTContext &C, GlobalDeclID ID)
TemplateParameterList * getTemplateParameters() const
Get the list of template parameters.
static bool classof(const Decl *D)
Represents a class template specialization, which refers to a class template with a given set of temp...
TemplateSpecializationKind getSpecializationKind() const
Determine the kind of specialization that this declaration represents.
const ASTTemplateArgumentListInfo * getTemplateArgsAsWritten() const
Retrieve the template argument list as written in the sources, if any.
ClassTemplateDecl * getSpecializedTemplate() const
Retrieve the template that this specialization specializes.
bool isClassScopeExplicitSpecialization() const
Is this an explicit specialization at class scope (within the class that owns the primary template)?
static ClassTemplateSpecializationDecl * CreateDeserialized(ASTContext &C, GlobalDeclID ID)
ClassTemplateSpecializationDecl * getMostRecentDecl()
llvm::PointerUnion< ClassTemplateDecl *, ClassTemplatePartialSpecializationDecl * > getSpecializedTemplateOrPartial() const
Retrieve the class template or class template partial specialization which was specialized by this.
void setTemplateArgs(TemplateArgumentList *Args)
void getNameForDiagnostic(raw_ostream &OS, const PrintingPolicy &Policy, bool Qualified) const override
Appends a human-readable name for this declaration into the given stream.
void setPointOfInstantiation(SourceLocation Loc)
SourceLocation getPointOfInstantiation() const
Get the point of instantiation (if any), or null if none.
friend class ASTDeclReader
void setStrictPackMatch(bool Val)
static bool classof(const Decl *D)
void setExternKeywordLoc(SourceLocation Loc)
Sets the location of the extern keyword.
void setSpecializationKind(TemplateSpecializationKind TSK)
const TemplateArgumentList & getTemplateArgs() const
Retrieve the template arguments of the class template specialization.
SourceLocation getExternKeywordLoc() const
Gets the location of the extern keyword, if present.
SourceRange getSourceRange() const override LLVM_READONLY
Source range that this declaration covers.
static void Profile(llvm::FoldingSetNodeID &ID, ArrayRef< TemplateArgument > TemplateArgs, const ASTContext &Context)
void setInstantiationOf(ClassTemplateDecl *TemplDecl)
Note that this class template specialization is an instantiation of the given class template.
friend class ASTDeclWriter
SourceLocation getTemplateKeywordLoc() const
Gets the location of the template keyword, if present.
ClassTemplateSpecializationDecl(ASTContext &Context, Kind DK, TagKind TK, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, ClassTemplateDecl *SpecializedTemplate, ArrayRef< TemplateArgument > Args, bool StrictPackMatch, ClassTemplateSpecializationDecl *PrevDecl)
void setTemplateArgsAsWritten(const TemplateArgumentListInfo &ArgsInfo)
Set the template argument list as written in the sources.
bool isExplicitSpecialization() const
void setTemplateKeywordLoc(SourceLocation Loc)
Sets the location of the template keyword.
const TemplateArgumentList & getTemplateInstantiationArgs() const
Retrieve the set of template arguments that should be used to instantiate members of the class templa...
llvm::PointerUnion< ClassTemplateDecl *, ClassTemplatePartialSpecializationDecl * > getInstantiatedFrom() const
If this class template specialization is an instantiation of a template (rather than an explicit spec...
bool hasStrictPackMatch() const
void setInstantiationOf(ClassTemplatePartialSpecializationDecl *PartialSpec, const TemplateArgumentList *TemplateArgs)
Note that this class template specialization is actually an instantiation of the given class template...
bool isExplicitInstantiationOrSpecialization() const
True if this declaration is an explicit specialization, explicit instantiation declaration,...
void setTemplateArgsAsWritten(const ASTTemplateArgumentListInfo *ArgsWritten)
Set the template argument list as written in the sources.
ClassTemplateSpecializationDecl * getDefinitionOrSelf() const
void Profile(llvm::FoldingSetNodeID &ID) const
void setSpecializedTemplate(ClassTemplateDecl *Specialized)
static bool classofKind(Kind K)
Declaration of a C++20 concept.
void setDefinition(Expr *E)
Expr * getConstraintExpr() const
SourceRange getSourceRange() const override LLVM_READONLY
Source range that this declaration covers.
ConceptDecl(DeclContext *DC, SourceLocation L, DeclarationName Name, TemplateParameterList *Params, Expr *ConstraintExpr)
static ConceptDecl * CreateDeserialized(ASTContext &C, GlobalDeclID ID)
friend class ASTDeclReader
bool isTypeConcept() const
ConceptDecl * getCanonicalDecl() override
Retrieves the "canonical" declaration of the given declaration.
bool hasDefinition() const
static bool classof(const Decl *D)
friend class ASTDeclWriter
const ConceptDecl * getCanonicalDecl() const
static bool classofKind(Kind K)
A reference to a concept and its template args, as it appears in the code.
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
Decl - This represents one declaration (or definition), e.g.
ASTContext & getASTContext() const LLVM_READONLY
bool isImplicit() const
isImplicit - Indicates whether the declaration was implicitly generated by the implementation.
virtual Decl * getPreviousDeclImpl()
Implementation of getPreviousDecl(), to be overridden by any subclass that has a redeclaration chain.
Kind
Lists the kind of concrete classes of Decl.
virtual Decl * getNextRedeclarationImpl()
Returns the next redeclaration or itself if this is the only decl.
SourceLocation getLocation() const
virtual Decl * getMostRecentDeclImpl()
Implementation of getMostRecentDecl(), to be overridden by any subclass that has a redeclaration chai...
DeclContext * getLexicalDeclContext()
getLexicalDeclContext - The declaration context where this Decl was lexically declared (LexicalDC).
The name of a declaration.
Represents a ValueDecl that came out of a declarator.
DeclaratorDecl(Kind DK, DeclContext *DC, SourceLocation L, DeclarationName N, QualType T, TypeSourceInfo *TInfo, SourceLocation StartL)
Storage for a default argument.
void setInherited(const ASTContext &C, ParmDecl *InheritedFrom)
Set that the default argument was inherited from another parameter.
bool isSet() const
Determine whether there is a default argument for this parameter.
ArgType get() const
Get the default argument's value.
void set(ArgType Arg)
Set the default argument.
void clear()
Remove the default argument, even if it was inherited.
const ParmDecl * getInheritedFrom() const
Get the parameter from which we inherit the default argument, if any.
bool isInherited() const
Determine whether the default argument for this parameter was inherited from a previous declaration o...
ArrayRef< FunctionTemplateDecl * > getCandidates() const
Returns the candidates for the primary function template.
const ASTTemplateArgumentListInfo * TemplateArgumentsAsWritten
The template arguments as written in the sources, if provided.
SourceLocation getEndLoc() const LLVM_READONLY
static ExplicitInstantiationDecl * CreateDeserialized(ASTContext &C, GlobalDeclID ID, unsigned TrailingFlags)
static bool classofKind(Kind K)
TypeSourceInfo * getTypeAsWritten() const
The declared type (return type or variable type) for function / variable templates.
TemplateSpecializationKind getTemplateSpecializationKind() const
SourceLocation getExternLoc() const
SourceLocation getTemplateArgsLAngleLoc() const
friend class ASTDeclReader
std::optional< unsigned > getNumTemplateArgs() const
Returns the number of explicit template arguments, or std::nullopt if this entity has no template arg...
TemplateArgumentLoc getTemplateArg(unsigned I) const
bool hasTrailingQualifier() const
SourceLocation getTemplateArgsRAngleLoc() const
bool isExternTemplate() const
friend class ASTDeclWriter
NamedDecl * getSpecialization() const
SourceLocation getTagKWLoc() const
The tag keyword (struct/class/union) location for class templates / nested classes; invalid for funct...
static bool classof(const Decl *D)
NestedNameSpecifierLoc getQualifierLoc() const
Returns the qualifier regardless of where it is stored.
SourceLocation getTemplateLoc() const
SourceRange getSourceRange() const override LLVM_READONLY
Source range that this declaration covers.
SourceLocation getNameLoc() const
bool hasTrailingArgsAsWritten() const
This represents one expression.
FixedSizeTemplateParameterListStorage(const ASTContext &C, SourceLocation TemplateLoc, SourceLocation LAngleLoc, ArrayRef< NamedDecl * > Params, SourceLocation RAngleLoc, Expr *RequiresClause)
FriendDecl(Kind K, DeclContext *DC, SourceLocation L, FriendUnion Friend, SourceLocation FL, SourceLocation EllipsisLoc={})
llvm::PointerUnion< NamedDecl *, TypeSourceInfo * > FriendUnion
TypeSourceInfo * getFriendType() const
If this friend declaration names an (untemplated but possibly dependent) type, return the type; other...
Declaration of a friend template.
SourceRange getSourceRange() const override LLVM_READONLY
Source range that this declaration covers.
static bool classof(const Decl *D)
static FriendTemplateDecl * CreateDeserialized(ASTContext &C, GlobalDeclID ID, unsigned NumFriendTPLists)
friend class ASTDeclReader
NamedDecl * getFriendDecl() const override
If this friend declaration doesn't name a type, return the inner declaration.
TemplateName getFriendTemplateName() const
friend class ASTDeclWriter
static bool classofKind(Kind K)
FriendTemplateEntityKind getFriendKind() const
ArrayRef< TemplateParameterList * > getTemplateParameterLists() const
Represents a function declaration or definition.
bool isThisDeclarationADefinition() const
Returns whether this specific declaration of the function is also a definition that does not contain ...
void setInstantiatedFromMemberTemplate(bool Val=true)
bool isInstantiatedFromMemberTemplate() const
Declaration of a template function.
FunctionTemplateDecl * getCanonicalDecl() override
Retrieves the "canonical" declaration of the given declaration.
spec_iterator spec_end() const
CommonBase * newCommon(ASTContext &C) const override
FunctionDecl * getTemplatedDecl() const
Get the underlying function declaration of the template.
FunctionTemplateDecl * getInstantiatedFromMemberTemplate() const
Common * getCommonPtr() const
bool isThisDeclarationADefinition() const
Returns whether this template declaration defines the primary pattern.
const FunctionTemplateDecl * getPreviousDecl() const
FunctionDecl * findSpecialization(ArrayRef< TemplateArgument > Args, llvm::FoldingSetInsertToken &InsertToken)
Return the specialization with the provided arguments if it exists, otherwise return the insertion po...
bool isAbbreviated() const
Return whether this function template is an abbreviated function template, e.g.
void setInstantiatedFromMemberTemplate(FunctionTemplateDecl *D)
FunctionTemplateDecl * getMostRecentDecl()
friend class ASTDeclReader
FunctionTemplateDecl * getPreviousDecl()
Retrieve the previous declaration of this function template, or nullptr if no such declaration exists...
const FunctionTemplateDecl * getCanonicalDecl() const
static FunctionTemplateDecl * CreateDeserialized(ASTContext &C, GlobalDeclID ID)
Create an empty function template node.
spec_range specializations() const
SpecIterator< FunctionTemplateSpecializationInfo > spec_iterator
friend class FunctionDecl
spec_iterator spec_begin() const
FunctionTemplateDecl(ASTContext &C, DeclContext *DC, SourceLocation L, DeclarationName Name, TemplateParameterList *Params, NamedDecl *Decl)
bool isCompatibleWithDefinition() const
const FunctionTemplateDecl * getMostRecentDecl() const
friend class ASTDeclWriter
llvm::iterator_range< spec_iterator > spec_range
static bool classofKind(Kind K)
void addSpecialization(FunctionTemplateSpecializationInfo *Info, llvm::FoldingSetInsertToken InsertToken)
Add a specialization of this function template.
llvm::FoldingSetVector< FunctionTemplateSpecializationInfo > & getSpecializations() const
Retrieve the set of function template specializations of this function template.
void mergePrevDecl(FunctionTemplateDecl *Prev)
Merge Prev with our RedeclarableTemplateDecl::Common.
void LoadLazySpecializations() const
Load any lazily-loaded specializations from the external source.
static bool classof(const Decl *D)
Provides information about a function template specialization, which is a FunctionDecl that has been ...
bool isExplicitSpecialization() const
TemplateArgumentList * TemplateArguments
The template arguments used to produce the function template specialization from the function templat...
void setTemplateSpecializationKind(TemplateSpecializationKind TSK)
Set the template specialization kind.
static void Profile(llvm::FoldingSetNodeID &ID, ArrayRef< TemplateArgument > TemplateArgs, const ASTContext &Context)
FunctionTemplateDecl * getTemplate() const
Retrieve the template from which this function was specialized.
MemberSpecializationInfo * getMemberSpecializationInfo() const
Get the specialization info if this function template specialization is also a member specialization:
const ASTTemplateArgumentListInfo * TemplateArgumentsAsWritten
The template arguments as written in the sources, if provided.
SourceLocation getPointOfInstantiation() const
Retrieve the first point of instantiation of this function template specialization.
void Profile(llvm::FoldingSetNodeID &ID)
SourceLocation PointOfInstantiation
The point at which this function template specialization was first instantiated.
FunctionDecl * getFunction() const
Retrieve the declaration of the function template specialization.
TemplateSpecializationKind getTemplateSpecializationKind() const
Determine what kind of template specialization this is.
void setPointOfInstantiation(SourceLocation POI)
Set the (first) point of instantiation of this function template specialization.
bool isExplicitInstantiationOrSpecialization() const
True if this declaration is an explicit specialization, explicit instantiation declaration,...
One of these records is kept for each identifier that is lexed.
void setTemplateArguments(ArrayRef< TemplateArgument > Converted)
static bool classofKind(Kind K)
friend class ASTDeclReader
static ImplicitConceptSpecializationDecl * CreateDeserialized(const ASTContext &C, GlobalDeclID ID, unsigned NumTemplateArgs)
ArrayRef< TemplateArgument > getTemplateArguments() const
static bool classof(const Decl *D)
Provides information a specialization of a member of a class template, which may be a member function...
void setTemplateSpecializationKind(TemplateSpecializationKind TSK)
Set the template specialization kind.
TemplateSpecializationKind getTemplateSpecializationKind() const
Determine what kind of template specialization this is.
bool isExplicitSpecialization() const
SourceLocation getPointOfInstantiation() const
Retrieve the first point of instantiation of this member.
MemberSpecializationInfo(NamedDecl *IF, TemplateSpecializationKind TSK, SourceLocation POI=SourceLocation())
void setPointOfInstantiation(SourceLocation POI)
Set the first point of instantiation.
NamedDecl * getInstantiatedFrom() const
Retrieve the member declaration from which this member was instantiated.
TemplateParamObjectDecl * getFirstDecl()
This represents a decl that may have a name.
NamedDecl(Kind DK, DeclContext *DC, SourceLocation L, DeclarationName N)
A C++ nested-name-specifier augmented with source location information.
NonTypeTemplateParmDecl - Declares a non-type template parameter, e.g., "Size" in.
static NonTypeTemplateParmDecl * CreateDeserialized(ASTContext &C, GlobalDeclID ID, bool HasTypeConstraint)
SourceLocation getDefaultArgumentLoc() const
Retrieve the location of the default argument, if any.
bool isPackExpansion() const
Whether this parameter pack is a pack expansion.
const DefArgStorage & getDefaultArgStorage() const
QualType getExpansionType(unsigned I) const
Retrieve a particular expansion type within an expanded parameter pack.
static bool classofKind(Kind K)
void getAssociatedConstraints(llvm::SmallVectorImpl< AssociatedConstraint > &AC) const
Get the associated-constraints of this template parameter.
bool hasDefaultArgument() const
Determine whether this template parameter has a default argument.
SourceRange getSourceRange() const override LLVM_READONLY
Source range that this declaration covers.
bool defaultArgumentWasInherited() const
Determines whether the default argument was inherited from a previous declaration of this template.
TypeSourceInfo * getExpansionTypeSourceInfo(unsigned I) const
Retrieve a particular expansion type source info within an expanded parameter pack.
static bool classof(const Decl *D)
unsigned getNumExpansionTypes() const
Retrieves the number of expansion types in an expanded parameter pack.
friend class ASTDeclReader
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.
bool hasPlaceholderTypeConstraint() const
Determine whether this non-type template parameter's type has a placeholder with a type-constraint.
Expr * getPlaceholderTypeConstraint() const
Return the constraint introduced by the placeholder type of this non-type template parameter (if any)...
void setPlaceholderTypeConstraint(Expr *E)
void removeDefaultArgument()
Removes the default argument of this template parameter.
void setInheritedDefaultArgument(const ASTContext &C, NonTypeTemplateParmDecl *Parm)
void setDefaultArgument(const ASTContext &C, const TemplateArgumentLoc &DefArg)
Set the default argument for this template parameter, and whether that default argument was inherited...
A (possibly-)qualified type.
void addSpecializationImpl(llvm::FoldingSetVector< EntryType > &Specs, EntryType *Entry, llvm::FoldingSetInsertToken InsertToken)
static SpecIterator< EntryType > makeSpecIterator(llvm::FoldingSetVector< EntryType > &Specs, bool isEnd)
SpecEntryTraits< EntryType >::DeclType * findSpecializationLocally(llvm::FoldingSetVector< EntryType > &Specs, llvm::FoldingSetInsertToken &InsertToken, ProfileArguments... ProfileArgs)
RedeclarableTemplateDecl(Kind DK, ASTContext &C, DeclContext *DC, SourceLocation L, DeclarationName Name, TemplateParameterList *Params, NamedDecl *Decl)
redeclarable_base::redecl_iterator redecl_iterator
void loadLazySpecializationsImpl(bool OnlyPartial=false) const
SpecEntryTraits< EntryType >::DeclType * findSpecializationImpl(llvm::FoldingSetVector< EntryType > &Specs, llvm::FoldingSetInsertToken &InsertToken, ProfileArguments... ProfileArgs)
RedeclarableTemplateDecl * getMostRecentDecl()
Returns the most recent (re)declaration of this declaration.
bool isMemberSpecialization() const
Determines whether this template was a specialization of a member template.
CommonBase * getCommonPtr() const
Retrieves the "common" pointer shared by all (re-)declarations of the same template.
friend class ASTDeclReader
const RedeclarableTemplateDecl * getCanonicalDecl() const
RedeclarableTemplateDecl * getPreviousDecl()
Return the previous declaration of this declaration or NULL if this is the first declaration.
redeclarable_base::redecl_range redecl_range
CommonBase * Common
Pointer to the common data shared by all declarations of this template.
static bool classof(const Decl *D)
RedeclarableTemplateDecl * getInstantiatedFromMemberTemplate() const
Retrieve the member template from which this template was instantiated, or nullptr if this template w...
static bool classofKind(Kind K)
virtual CommonBase * newCommon(ASTContext &C) const =0
RedeclarableTemplateDecl * getCanonicalDecl() override
Retrieves the canonical declaration of this template.
friend class ASTDeclWriter
void setMemberSpecialization()
Note that this member template is a specialization.
void setInstantiatedFromMemberTemplate(RedeclarableTemplateDecl *TD)
ArrayRef< TemplateArgument > getInjectedTemplateArgs(const ASTContext &Context) const
Retrieve the "injected" template arguments that correspond to the template parameters of this templat...
RedeclarableTemplateDecl * getFirstDecl()
RedeclarableTemplateDecl * getNextRedeclaration() const
Redeclarable(const ASTContext &Ctx)
RedeclarableTemplateDecl * getPreviousDecl()
redecl_iterator redecls_end() const
llvm::iterator_range< redecl_iterator > redecl_range
RedeclarableTemplateDecl * getMostRecentDecl()
redecl_iterator redecls_begin() const
redecl_range redecls() const
Encodes a location in the source.
A trivial tuple used to represent a source range.
SourceLocation getEnd() const
bool isThisDeclarationADefinition() const
Return true if this declaration is a completion definition of the type.
A convenient class for passing around template argument information.
A template argument list.
TemplateArgumentList(const TemplateArgumentList &)=delete
const TemplateArgument * data() const
Retrieve a pointer to the template argument list.
const TemplateArgument & operator[](unsigned Idx) const
Retrieve the template argument at a given index.
static TemplateArgumentList * CreateCopy(ASTContext &Context, ArrayRef< TemplateArgument > Args)
Create a new template argument list that copies the given set of template arguments.
unsigned size() const
Retrieve the number of template arguments in this template argument list.
const TemplateArgument & get(unsigned Idx) const
Retrieve the template argument at a given index.
TemplateArgumentList & operator=(const TemplateArgumentList &)=delete
ArrayRef< TemplateArgument > asArray() const
Produce this as an array ref.
Location wrapper for a TemplateArgument.
SourceRange getSourceRange() const LLVM_READONLY
Represents a template argument.
The base class of all kinds of template declarations (e.g., class, function, etc.).
NamedDecl * TemplatedDecl
TemplateParameterList * TemplateParams
void getAssociatedConstraints(llvm::SmallVectorImpl< AssociatedConstraint > &AC) const
Get the total constraint-expression associated with this template, including constraint-expressions d...
bool hasAssociatedConstraints() const
void init(NamedDecl *NewTemplatedDecl)
Initialize the underlying templated declaration.
NamedDecl * getTemplatedDecl() const
Get the underlying, templated declaration.
SourceRange getSourceRange() const override LLVM_READONLY
Source range that this declaration covers.
TemplateDecl(Kind DK, DeclContext *DC, SourceLocation L, DeclarationName Name, TemplateParameterList *Params)
friend class ASTDeclReader
void setTemplateParameters(TemplateParameterList *TParams)
TemplateDecl(Kind DK, DeclContext *DC, SourceLocation L, DeclarationName Name, TemplateParameterList *Params, NamedDecl *Decl)
static bool classof(const Decl *D)
friend class ASTDeclWriter
TemplateParameterList * getTemplateParameters() const
Get the list of template parameters.
static bool classofKind(Kind K)
Represents a C++ template name within the type system.
TemplateParamObjectDecl * getCanonicalDecl() override
Retrieves the "canonical" declaration of the given declaration.
void printAsExpr(llvm::raw_ostream &OS) const
Print this object as an equivalent expression.
const TemplateParamObjectDecl * getCanonicalDecl() const
void Profile(llvm::FoldingSetNodeID &ID)
const APValue & getValue() const
friend class ASTDeclReader
static bool classof(const Decl *D)
static void Profile(llvm::FoldingSetNodeID &ID, QualType T, const APValue &V)
friend class ASTContext
Only ASTContext::getTemplateParamObjectDecl and deserialization create these.
void printName(llvm::raw_ostream &OS, const PrintingPolicy &Policy) const override
Print this template parameter object in a human-readable format.
void printAsInit(llvm::raw_ostream &OS) const
Print this object as an initializer suitable for a variable of the object's type.
static bool classofKind(Kind K)
Stores a list of template parameters for a TemplateDecl and its derived classes.
const_iterator end() const
NamedDecl * getParam(unsigned Idx)
SourceRange getSourceRange() const LLVM_READONLY
const_iterator begin() const
ArrayRef< TemplateArgument > getInjectedTemplateArgs(const ASTContext &Context)
Get the template argument list of the template parameter list.
friend class FixedSizeTemplateParameterListStorage
unsigned getDepth() const
Get the depth of this template parameter list in the set of template parameter lists.
const Expr * getRequiresClause() const
The constraint-expression of the associated requires-clause.
NamedDecl ** iterator
Iterates through the template parameters in this list.
bool hasAssociatedConstraints() const
unsigned getMinRequiredArguments() const
Returns the minimum number of arguments needed to form a template specialization.
size_t numTrailingObjects(OverloadToken< Expr * >) const
bool hasParameterPack() const
Determine whether this template parameter list contains a parameter pack.
static TemplateParameterList * Create(const ASTContext &C, SourceLocation TemplateLoc, SourceLocation LAngleLoc, ArrayRef< NamedDecl * > Params, SourceLocation RAngleLoc, Expr *RequiresClause)
NamedDecl *const * const_iterator
Iterates through the template parameters in this list.
Expr * getRequiresClause()
The constraint-expression of the associated requires-clause.
void print(raw_ostream &Out, const ASTContext &Context, const PrintingPolicy &Policy, bool OmitTemplateKW=false) const
SourceLocation getRAngleLoc() const
void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &C) const
const NamedDecl * getParam(unsigned Idx) const
bool containsUnexpandedParameterPack() const
Determine whether this template parameter list contains an unexpanded parameter pack.
SourceLocation getLAngleLoc() const
size_t numTrailingObjects(OverloadToken< NamedDecl * >) const
TemplateParameterList(const ASTContext &C, SourceLocation TemplateLoc, SourceLocation LAngleLoc, ArrayRef< NamedDecl * > Params, SourceLocation RAngleLoc, Expr *RequiresClause)
void print(raw_ostream &Out, const ASTContext &Context, bool OmitTemplateKW=false) const
void getAssociatedConstraints(llvm::SmallVectorImpl< AssociatedConstraint > &AC) const
All associated constraints derived from this template parameter list, including the requires clause a...
ArrayRef< NamedDecl * > asArray()
static bool shouldIncludeTypeForArgument(const PrintingPolicy &Policy, const TemplateParameterList *TPL, unsigned Idx)
SourceLocation getTemplateLoc() const
ArrayRef< const NamedDecl * > asArray() const
Defines the position of a template parameter within a template parameter list.
unsigned getPosition() const
Get the position of the template parameter within its parameter list.
unsigned getIndex() const
Get the index of the template parameter within its parameter list.
unsigned getDepth() const
Get the nesting depth of the template parameter.
TemplateParmPosition(int D, int P)
TemplateParmPosition()=delete
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.
bool isPackExpansion() const
Whether this parameter pack is a pack expansion.
unsigned getNumExpansionTemplateParameters() const
Retrieves the number of expansion template parameters in an expanded parameter pack.
const DefArgStorage & getDefaultArgStorage() const
TemplateNameKind templateParameterKind() const
static bool classof(const Decl *D)
const TemplateArgumentLoc & getDefaultArgument() const
Retrieve the default argument, if any.
void setInheritedDefaultArgument(const ASTContext &C, TemplateTemplateParmDecl *Prev)
static TemplateTemplateParmDecl * CreateDeserialized(ASTContext &C, GlobalDeclID ID)
friend class ASTDeclReader
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 bool classofKind(Kind K)
friend class ASTDeclWriter
bool defaultArgumentWasInherited() const
Determines whether the default argument was inherited from a previous declaration of this template.
bool isTypeConceptTemplateParam() const
SourceRange getSourceRange() const override LLVM_READONLY
Source range that this declaration covers.
void setDeclaredWithTypename(bool withTypename)
Set whether this template template parameter was declared with the 'typename' or 'class' keyword.
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...
void removeDefaultArgument()
Removes the default argument of this template parameter.
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.
unsigned getIndex() const
Retrieve the index of the template parameter.
void setInheritedDefaultArgument(const ASTContext &C, TemplateTypeParmDecl *Prev)
Set that this default argument was inherited from another parameter.
void setTypeConstraint(ConceptReference *CR, Expr *ImmediatelyDeclaredConstraint, UnsignedOrNone ArgPackSubstIndex)
static TemplateTypeParmDecl * CreateDeserialized(const ASTContext &C, GlobalDeclID ID)
bool hasTypeConstraint() const
Determine whether this template parameter has a type-constraint.
friend class Sema
Sema creates these on the stack during auto type deduction.
friend class ASTDeclReader
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 defaultArgumentWasInherited() const
Determines whether the default argument was inherited from a previous declaration of this template.
void removeDefaultArgument()
Removes the default argument of this template parameter.
void getAssociatedConstraints(llvm::SmallVectorImpl< AssociatedConstraint > &AC) const
Get the associated-constraints of this template parameter.
bool isParameterPack() const
Returns whether this is a parameter pack.
unsigned getDepth() const
Retrieve the depth of the template parameter.
SourceRange getSourceRange() const override LLVM_READONLY
Source range that this declaration covers.
const DefArgStorage & getDefaultArgStorage() const
void setDefaultArgument(const ASTContext &C, const TemplateArgumentLoc &DefArg)
Set the default argument for this template parameter.
static bool classofKind(Kind K)
static bool classof(const Decl *D)
void setDeclaredWithTypename(bool withTypename)
Set whether this template type parameter was declared with the 'typename' or 'class' keyword.
bool isPackExpansion() const
Whether this parameter pack is a pack expansion.
Represents the declaration of a typedef-name via a C++11 alias-declaration.
Declaration of an alias template.
static bool classof(const Decl *D)
CommonBase * newCommon(ASTContext &C) const override
static TypeAliasTemplateDecl * CreateDeserialized(ASTContext &C, GlobalDeclID ID)
Create an empty alias template node.
TypeAliasTemplateDecl * getPreviousDecl()
Retrieve the previous declaration of this function template, or nullptr if no such declaration exists...
const TypeAliasTemplateDecl * getPreviousDecl() const
TypeAliasTemplateDecl * getInstantiatedFromMemberTemplate() const
friend class ASTDeclReader
const TypeAliasTemplateDecl * getCanonicalDecl() const
static bool classofKind(Kind K)
TypeAliasTemplateDecl * getCanonicalDecl() override
Retrieves the canonical declaration of this template.
friend class ASTDeclWriter
TypeAliasTemplateDecl(ASTContext &C, DeclContext *DC, SourceLocation L, DeclarationName Name, TemplateParameterList *Params, NamedDecl *Decl)
TypeAliasDecl * getTemplatedDecl() const
Get the underlying function declaration of the template.
Models the abbreviated syntax to constrain a template type parameter: template <convertible_to<string...
TypeDecl(Kind DK, DeclContext *DC, SourceLocation L, const IdentifierInfo *Id, SourceLocation StartL=SourceLocation())
A container of type source information.
AutoType * getContainedAutoType() const
Get the AutoType whose type will be deduced for a variable with an initializer of this type.
const T * getAs() const
Member-template getAs<specific type>'.
A set of unresolved declarations.
ValueDecl(Kind DK, DeclContext *DC, SourceLocation L, DeclarationName N, QualType T)
Represents a variable declaration or definition.
DefinitionKind isThisDeclarationADefinition(ASTContext &) const
Check whether this declaration is a definition.
TemplateSpecializationKind getTemplateSpecializationKind() const
If this variable is an instantiation of a variable template or a static data member of a class templa...
Declaration of a variable template.
VarTemplateDecl * getDefinition()
VarDecl * getTemplatedDecl() const
Get the underlying variable declarations of the template.
VarTemplateDecl * getCanonicalDecl() override
Retrieves the canonical declaration of this template.
void AddPartialSpecialization(VarTemplatePartialSpecializationDecl *D, llvm::FoldingSetInsertToken InsertToken)
Insert the specified partial specialization knowing that it is not already in.
spec_iterator spec_begin() const
Common * getCommonPtr() const
VarTemplateSpecializationDecl * findSpecialization(ArrayRef< TemplateArgument > Args, llvm::FoldingSetInsertToken &InsertToken)
Return the specialization with the provided arguments if it exists, otherwise return the insertion po...
static bool classof(const Decl *D)
const VarTemplateDecl * getPreviousDecl() const
VarTemplateDecl * getInstantiatedFromMemberTemplate() const
VarTemplateDecl * getPreviousDecl()
Retrieve the previous declaration of this variable template, or nullptr if no such declaration exists...
CommonBase * newCommon(ASTContext &C) const override
friend class ASTDeclReader
VarTemplatePartialSpecializationDecl * findPartialSpecialization(ArrayRef< TemplateArgument > Args, TemplateParameterList *TPL, llvm::FoldingSetInsertToken &InsertToken)
Return the partial specialization with the provided arguments if it exists, otherwise return the inse...
void LoadLazySpecializations(bool OnlyPartial=false) const
Load any lazily-loaded specializations from the external source.
VarTemplateDecl(ASTContext &C, DeclContext *DC, SourceLocation L, DeclarationName Name, TemplateParameterList *Params, NamedDecl *Decl)
const VarTemplateDecl * getCanonicalDecl() const
static VarTemplateDecl * CreateDeserialized(ASTContext &C, GlobalDeclID ID)
Create an empty variable template node.
llvm::iterator_range< spec_iterator > spec_range
llvm::FoldingSetVector< VarTemplatePartialSpecializationDecl > & getPartialSpecializations() const
Retrieve the set of partial specializations of this class template.
llvm::FoldingSetVector< VarTemplateSpecializationDecl > & getSpecializations() const
Retrieve the set of specializations of this variable template.
static bool classofKind(Kind K)
void AddSpecialization(VarTemplateSpecializationDecl *D, llvm::FoldingSetInsertToken InsertToken)
Insert the specified specialization knowing that it is not already in.
const VarTemplateDecl * getMostRecentDecl() const
friend class ASTDeclWriter
bool isThisDeclarationADefinition() const
Returns whether this template declaration defines the primary variable pattern.
VarTemplatePartialSpecializationDecl * findPartialSpecInstantiatedFromMember(VarTemplatePartialSpecializationDecl *D)
Find a variable template partial specialization which was instantiated from the given member partial ...
SpecIterator< VarTemplateSpecializationDecl > spec_iterator
spec_iterator spec_end() const
VarTemplateDecl * getMostRecentDecl()
spec_range specializations() const
void setMemberSpecialization()
Note that this member template is a specialization.
SourceRange getSourceRange() const override LLVM_READONLY
Source range that this declaration covers.
TemplateParameterList * getTemplateParameters() const
Get the list of template parameters.
VarTemplatePartialSpecializationDecl * getInstantiatedFromMember() const
Retrieve the member variable template partial specialization from which this particular variable temp...
friend class ASTDeclReader
bool isMemberSpecialization() const
Determines whether this variable template partial specialization was a specialization of a member par...
void getAssociatedConstraints(llvm::SmallVectorImpl< AssociatedConstraint > &AC) const
All associated constraints of this partial specialization, including the requires clause and any cons...
void Profile(llvm::FoldingSetNodeID &ID) const
static bool classof(const Decl *D)
friend class ASTDeclWriter
ArrayRef< TemplateArgument > getInjectedTemplateArgs(const ASTContext &Context) const
Get the template argument list of the template parameter list.
void setInstantiatedFromMember(VarTemplatePartialSpecializationDecl *PartialSpec)
static VarTemplatePartialSpecializationDecl * CreateDeserialized(ASTContext &C, GlobalDeclID ID)
VarTemplatePartialSpecializationDecl * getMostRecentDecl()
static bool classofKind(Kind K)
bool hasAssociatedConstraints() const
Represents a variable template specialization, which refers to a variable template with a given set o...
SourceLocation getPointOfInstantiation() const
Get the point of instantiation (if any), or null if none.
VarTemplateSpecializationDecl(Kind DK, ASTContext &Context, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, VarTemplateDecl *SpecializedTemplate, QualType T, TypeSourceInfo *TInfo, StorageClass S, ArrayRef< TemplateArgument > Args)
void setTemplateArgsAsWritten(const ASTTemplateArgumentListInfo *ArgsWritten)
Set the template argument list as written in the sources.
const ASTTemplateArgumentListInfo * getTemplateArgsAsWritten() const
Retrieve the template argument list as written in the sources, if any.
void setTemplateKeywordLoc(SourceLocation Loc)
Sets the location of the template keyword.
void setSpecializationKind(TemplateSpecializationKind TSK)
static void Profile(llvm::FoldingSetNodeID &ID, ArrayRef< TemplateArgument > TemplateArgs, const ASTContext &Context)
const TemplateArgumentList & getTemplateArgs() const
Retrieve the template arguments of the variable template specialization.
const TemplateArgumentList & getTemplateInstantiationArgs() const
Retrieve the set of template arguments that should be used to instantiate the initializer of the vari...
static bool classof(const Decl *D)
bool isClassScopeExplicitSpecialization() const
SourceLocation getTemplateKeywordLoc() const
Gets the location of the template keyword, if present.
SourceRange getSourceRange() const override LLVM_READONLY
Source range that this declaration covers.
friend class ASTDeclReader
void setInstantiationOf(VarTemplatePartialSpecializationDecl *PartialSpec, const TemplateArgumentList *TemplateArgs)
Note that this variable template specialization is actually an instantiation of the given variable te...
void Profile(llvm::FoldingSetNodeID &ID) const
void setPointOfInstantiation(SourceLocation Loc)
void setTemplateArgsAsWritten(const TemplateArgumentListInfo &ArgsInfo)
Set the template argument list as written in the sources.
llvm::PointerUnion< VarTemplateDecl *, VarTemplatePartialSpecializationDecl * > getSpecializedTemplateOrPartial() const
Retrieve the variable template or variable template partial specialization which was specialized by t...
TemplateSpecializationKind getSpecializationKind() const
Determine the kind of specialization that this declaration represents.
void setInstantiationOf(VarTemplateDecl *TemplDecl)
Note that this variable template specialization is an instantiation of the given variable template.
VarTemplateDecl * getSpecializedTemplate() const
Retrieve the template that this specialization specializes.
bool isExplicitInstantiationOrSpecialization() const
True if this declaration is an explicit specialization, explicit instantiation declaration,...
llvm::PointerUnion< VarTemplateDecl *, VarTemplatePartialSpecializationDecl * > getInstantiatedFrom() const
If this variable template specialization is an instantiation of a template (rather than an explicit s...
friend class ASTDeclWriter
bool isExplicitSpecialization() const
SourceLocation getExternKeywordLoc() const
Gets the location of the extern keyword, if present.
static VarTemplateSpecializationDecl * CreateDeserialized(ASTContext &C, GlobalDeclID ID)
void setExternKeywordLoc(SourceLocation Loc)
Sets the location of the extern keyword.
void setCompleteDefinition()
VarTemplateSpecializationDecl * getMostRecentDecl()
static bool classofKind(Kind K)
void getNameForDiagnostic(raw_ostream &OS, const PrintingPolicy &Policy, bool Qualified) const override
Appends a human-readable name for this declaration into the given stream.
const internal::VariadicAllOfMatcher< Type > type
Matches Types in the clang AST.
Top level wrappers for InstallAPI frontend operations.
CanQual< Type > CanQualType
Represents a canonical, potentially-qualified type.
bool isa(CodeGen::Address addr)
bool isTemplateInstantiation(TemplateSpecializationKind Kind)
Determine whether this template specialization kind refers to an instantiation of an entity (as oppos...
@ Specialization
We are substituting template parameters for template arguments in order to form a template specializa...
Decl * getPrimaryMergedDecl(Decl *D)
Get the primary declaration for a declaration from an AST file.
@ TemplateName
The identifier is a template name. FIXME: Add an annotation for that.
NamedDecl * getAsNamedDecl(TemplateParameter P)
bool isPackProducingBuiltinTemplateName(TemplateName N)
@ Create
'create' clause, allowed on Compute and Combined constructs, plus 'data', 'enter data',...
nullptr
This class represents a compute construct, representing a 'Kind' of ‘parallel’, 'serial',...
StorageClass
Storage classes.
UnsignedOrNone getExpandedPackSize(const NamedDecl *Param)
Check whether the template parameter is a pack expansion, and if so, determine the number of paramete...
void * allocateDefaultArgStorageChain(const ASTContext &C)
TemplateDecl * getAsTypeTemplateDecl(Decl *D)
OptionalUnsigned< unsigned > UnsignedOrNone
const FunctionProtoType * T
@ ExplicitInstantiation
We are parsing an explicit instantiation.
BuiltinTemplateKind
Kinds of BuiltinTemplateDecl.
@ FunctionTemplate
The name was classified as a function template name.
@ Concept
The name was classified as a concept name.
@ VarTemplate
The name was classified as a variable template name.
llvm::PointerUnion< const ASTTemplateArgumentListInfo *, ExplicitInstantiationInfo * > SpecializationOrInstantiationInfo
std::tuple< NamedDecl *, TemplateArgument > getReplacedTemplateParameter(Decl *D, unsigned Index)
Internal helper used by Subst* nodes to retrieve a parameter from the AssociatedDecl,...
TemplateNameKind
Specifies the kind of template name that an identifier refers to.
@ TNK_Type_template
The name refers to a template whose specialization produces a type.
@ TNK_Concept_template
The name refers to a concept.
const Decl & adjustDeclToTemplate(const Decl &D)
If we have a 'templated' declaration for a template, adjust 'D' to refer to the actual template.
llvm::PointerUnion< TemplateTypeParmDecl *, NonTypeTemplateParmDecl *, TemplateTemplateParmDecl * > TemplateParameter
Stores a template parameter of any kind.
TemplateSpecializationKind
Describes the kind of template specialization that a particular template specialization declaration r...
@ TSK_ExplicitSpecialization
This template specialization was declared or defined by an explicit specialization (C++ [temp....
@ TSK_Undeclared
This template specialization was formed from a template-id but has not yet been declared,...
U cast(CodeGen::Address addr)
@ Typename
The "typename" keyword precedes the qualified type name, e.g., typename T::type.
bool isTemplateExplicitInstantiationOrSpecialization(TemplateSpecializationKind Kind)
True if this template specialization kind is an explicit specialization, explicit instantiation decla...
Diagnostic wrappers for TextAPI types for error reporting.
Represents an explicit template argument list in C++, e.g., the "<int>" in "sort<int>".
static const ASTTemplateArgumentListInfo * Create(const ASTContext &C, const TemplateArgumentListInfo &List)
Data that is common to all of the declarations of a given class template.
CanQualType CanonInjectedTST
The Injected Template Specialization Type for this declaration.
llvm::FoldingSetVector< ClassTemplatePartialSpecializationDecl > PartialSpecializations
The class template partial specializations for this class template.
llvm::FoldingSetVector< ClassTemplateSpecializationDecl > Specializations
The class template specializations for this class template, including explicit specializations and in...
A placeholder type used to construct an empty shell of a decl-derived type that will be filled in lat...
Provides information about an explicit instantiation of a variable or class template.
ExplicitInstantiationInfo()=default
SourceLocation ExternKeywordLoc
The location of the extern keyword.
const ASTTemplateArgumentListInfo * TemplateArgsAsWritten
The template arguments as written..
SourceLocation TemplateKeywordLoc
The location of the template keyword.
Data that is common to all of the declarations of a given function template.
llvm::FoldingSetVector< FunctionTemplateSpecializationInfo > Specializations
The function template specializations for this function template, including explicit specializations ...
Describes how types, statements, expressions, and declarations should be printed.
llvm::PointerIntPair< RedeclarableTemplateDecl *, 1, bool > InstantiatedFromMember
The template from which this was most directly instantiated (or null).
static ArrayRef< TemplateArgument > getTemplateArgs(FunctionTemplateSpecializationInfo *I)
static DeclType * getDecl(FunctionTemplateSpecializationInfo *I)
static ArrayRef< TemplateArgument > getTemplateArgs(EntryType *D)
static DeclType * getDecl(EntryType *D)
SpecIterator(typename llvm::FoldingSetVector< EntryType >::iterator SetIter)
DeclType * operator->() const
DeclType * operator*() const
Data that is common to all of the declarations of a given variable template.
llvm::FoldingSetVector< VarTemplatePartialSpecializationDecl > PartialSpecializations
The variable template partial specializations for this variable template.
llvm::FoldingSetVector< VarTemplateSpecializationDecl > Specializations
The variable template specializations for this variable template, including explicit specializations ...