;
46template<
classTemplateParam>
49 return P.hasDefaultArgument() &&
50 P.getDefaultArgument().getArgument().containsUnexpandedParameterPack();
53TemplateParameterList::TemplateParameterList(
const ASTContext&
C,
59: TemplateLoc(TemplateLoc), LAngleLoc(LAngleLoc), RAngleLoc(RAngleLoc),
60NumParams(Params.size()), ContainsUnexpandedParameterPack(
false),
61HasRequiresClause(RequiresClause != nullptr),
62HasConstrainedParameters(
false) {
63 for(
unsignedIdx = 0; Idx < NumParams; ++Idx) {
67 boolIsPack =
P->isTemplateParameterPack();
68 if(
const auto*NTTP = dyn_cast<NonTypeTemplateParmDecl>(
P)) {
69 if(!IsPack && (NTTP->getType()->containsUnexpandedParameterPack() ||
71ContainsUnexpandedParameterPack =
true;
72 if(NTTP->hasPlaceholderTypeConstraint())
73HasConstrainedParameters =
true;
74}
else if(
const auto*TTP = dyn_cast<TemplateTemplateParmDecl>(
P)) {
76(TTP->getTemplateParameters()->containsUnexpandedParameterPack() ||
78ContainsUnexpandedParameterPack =
true;
80}
else if(
const auto*TTP = dyn_cast<TemplateTypeParmDecl>(
P)) {
82ContainsUnexpandedParameterPack =
true;
86ContainsUnexpandedParameterPack =
true;
88 if(TTP->hasTypeConstraint())
89HasConstrainedParameters =
true;
91llvm_unreachable(
"unexpected template parameter type");
95 if(HasRequiresClause) {
97ContainsUnexpandedParameterPack =
true;
98*getTrailingObjects<Expr *>() = RequiresClause;
102boolTemplateParameterList::containsUnexpandedParameterPack()
const{
103 if(ContainsUnexpandedParameterPack)
105 if(!HasConstrainedParameters)
112 if(!Param->isImplicit())
115 if(
const auto*TTP = dyn_cast<TemplateTypeParmDecl>(Param)) {
116 const auto*TC = TTP->getTypeConstraint();
117 if(TC && TC->getImmediatelyDeclaredConstraint()
118->containsUnexpandedParameterPack())
131 void*Mem =
C.Allocate(totalSizeToAlloc<NamedDecl *, Expr *>(
132Params.size(), RequiresClause ? 1u : 0u),
135RAngleLoc, RequiresClause);
141 ID.AddBoolean(RC !=
nullptr);
146 if(
const auto*NTTP = dyn_cast<NonTypeTemplateParmDecl>(
D)) {
148 ID.AddBoolean(NTTP->isParameterPack());
149NTTP->getType().getCanonicalType().Profile(ID);
150 ID.AddBoolean(NTTP->hasPlaceholderTypeConstraint());
151 if(
const Expr*
E= NTTP->getPlaceholderTypeConstraint())
155 if(
const auto*TTP = dyn_cast<TemplateTypeParmDecl>(
D)) {
157 ID.AddBoolean(TTP->isParameterPack());
158 ID.AddBoolean(TTP->hasTypeConstraint());
160TC->getImmediatelyDeclaredConstraint()->Profile(ID,
C,
164 const auto*TTP = cast<TemplateTemplateParmDecl>(
D);
166 ID.AddBoolean(TTP->isParameterPack());
167TTP->getTemplateParameters()->Profile(ID,
C);
172 unsignedNumRequiredArgs = 0;
174 if(
P->isTemplateParameterPack()) {
176NumRequiredArgs += *Expansions;
182 if(
const auto*TTP = dyn_cast<TemplateTypeParmDecl>(
P)) {
183 if(TTP->hasDefaultArgument())
185}
else if(
const auto*NTTP = dyn_cast<NonTypeTemplateParmDecl>(
P)) {
186 if(NTTP->hasDefaultArgument())
188}
else if(cast<TemplateTemplateParmDecl>(
P)->hasDefaultArgument())
194 returnNumRequiredArgs;
202 if(
const auto*TTP = dyn_cast<TemplateTypeParmDecl>(FirstParm))
203 returnTTP->getDepth();
204 else if(
const auto*NTTP = dyn_cast<NonTypeTemplateParmDecl>(FirstParm))
205 returnNTTP->getDepth();
207 returncast<TemplateTemplateParmDecl>(FirstParm)->getDepth();
214 P->setDeclContext(Owner);
216 if(
const auto*TTP = dyn_cast<TemplateTemplateParmDecl>(
P))
220 if(
P->isInvalidDecl())
228 if(HasConstrainedParameters)
229 for(
const NamedDecl*Param : *
this) {
230 if(
const auto*TTP = dyn_cast<TemplateTypeParmDecl>(Param)) {
231 if(
const auto*TC = TTP->getTypeConstraint())
232AC.push_back(TC->getImmediatelyDeclaredConstraint());
233}
else if(
const auto*NTTP = dyn_cast<NonTypeTemplateParmDecl>(Param)) {
234 if(
const Expr*
E= NTTP->getPlaceholderTypeConstraint())
238 if(HasRequiresClause)
243 returnHasRequiresClause || HasConstrainedParameters;
250llvm::transform(*
this, InjectedArgs, [&](
NamedDecl*ND) {
254 return{InjectedArgs, NumParams};
263 if(
const auto*ParamValueDecl =
264dyn_cast<NonTypeTemplateParmDecl>(TemplParam))
265 if(ParamValueDecl->getType()->getContainedDeducedType())
273 return new(
C)
char[
sizeof(
void*) * 2];
285:
NamedDecl(DK, DC, L, Name), TemplatedDecl(
Decl), TemplateParams(Params) {}
287voidTemplateDecl::anchor() {}
293 if(
const Expr*TRC = FD->getTrailingRequiresClause())
301 returnFD->getTrailingRequiresClause();
307 caseTemplateDecl::TypeAliasTemplate:
308 caseTemplateDecl::BuiltinTemplate:
319voidRedeclarableTemplateDecl::anchor() {}
335PrevDecls.push_back(Prev);
354 boolOnlyPartial
)
const{
380template<
classEntryType,
typename... ProfileArguments>
383llvm::FoldingSetVector<EntryType> &Specs,
void*&InsertPos,
384ProfileArguments &&...ProfileArgs) {
387llvm::FoldingSetNodeID ID;
388EntryType::Profile(ID, std::forward<ProfileArguments>(ProfileArgs)...,
390EntryType *Entry = Specs.FindNodeOrInsertPos(ID, InsertPos);
391 returnEntry ? SETraits::getDecl(Entry)->getMostRecentDecl() :
nullptr;
394template<
classEntryType,
typename... ProfileArguments>
397llvm::FoldingSetVector<EntryType> &Specs,
void*&InsertPos,
398ProfileArguments &&...ProfileArgs) {
401Specs, InsertPos, std::forward<ProfileArguments>(ProfileArgs)...))
405std::forward<ProfileArguments>(ProfileArgs)...))
409Specs, InsertPos, std::forward<ProfileArguments>(ProfileArgs)...);
412template<
classDerived,
classEntryType>
414llvm::FoldingSetVector<EntryType> &Specializations, EntryType *Entry,
420 autoArgs = SETraits::getTemplateArgs(Entry);
426 void*CorrectInsertPos;
428InsertPos == CorrectInsertPos &&
429 "given incorrect InsertPos for specialization");
431Specializations.InsertNode(Entry, InsertPos);
433EntryType *Existing = Specializations.GetOrInsertNode(Entry);
436 "non-canonical specialization?");
440L->AddedCXXTemplateSpecialization(cast<Derived>(
this),
441SETraits::getDecl(Entry));
467 auto*CommonPtr =
new(
C)
Common;
468 C.addDestruction(CommonPtr);
476llvm::FoldingSetVector<FunctionTemplateSpecializationInfo> &
504 Common*ThisCommon =
static_cast<Common*
>(Base::Common);
505 Common*PrevCommon =
nullptr;
508 if(Prev->Base::Common) {
509PrevCommon =
static_cast<Common*
>(Prev->Base::Common);
512PreviousDecls.push_back(Prev);
518 for(
auto*
D: PreviousDecls)
519 D->Base::Common = ThisCommon;
525 "Can't merge incompatible declarations!");
527Base::Common = PrevCommon;
553 boolOnlyPartial
)
const{
557llvm::FoldingSetVector<ClassTemplateSpecializationDecl> &
563llvm::FoldingSetVector<ClassTemplatePartialSpecializationDecl> &
571 auto*CommonPtr =
new(
C)
Common;
572 C.addDestruction(CommonPtr);
601ID.AddInteger(TemplateArgs.size());
616assert(Existing->
isCanonicalDecl() &&
"Non-canonical specialization?");
620L->AddedCXXTemplateSpecialization(
this,
D);
625llvm::FoldingSetVector<ClassTemplatePartialSpecializationDecl> &PartialSpecs
628PS.reserve(PartialSpecs.size());
630PS.push_back(
P.getMostRecentDecl());
638 if(Context.
hasSameType(
P.getInjectedSpecializationType(),
T))
639 return P.getMostRecentDecl();
650 if(
P.getInstantiatedFromMember()->getCanonicalDecl() == DCanon)
651 return P.getMostRecentDecl();
685 bool Typename,
boolParameterPack,
boolHasTypeConstraint,
686std::optional<unsigned> NumExpanded) {
689additionalSizeToAlloc<TypeConstraint>(HasTypeConstraint ? 1 : 0))
691HasTypeConstraint, NumExpanded);
692 QualTypeTTPType =
C.getTemplateTypeParmType(
D,
P, ParameterPack, TTPDecl);
693TTPDecl->setTypeForDecl(TTPType.
getTypePtr());
701 false,
false, std::nullopt);
706 boolHasTypeConstraint) {
708additionalSizeToAlloc<TypeConstraint>(HasTypeConstraint ? 1 : 0))
710 false, HasTypeConstraint, std::nullopt);
733DefaultArgument.
set(
nullptr);
752assert(HasTypeConstraint &&
753 "HasTypeConstraint=true must be passed at construction in order to " 754 "call setTypeConstraint");
755assert(!TypeConstraintInitialized &&
756 "TypeConstraint was already initialized!");
757 new(getTrailingObjects<TypeConstraint>())
759TypeConstraintInitialized =
true;
766NonTypeTemplateParmDecl::NonTypeTemplateParmDecl(
772ExpandedParameterPack(
true), NumExpandedTypes(ExpandedTypes.size()) {
773 if(!ExpandedTypes.empty() && !ExpandedTInfos.empty()) {
775getTrailingObjects<std::pair<QualType, TypeSourceInfo *>>();
776 for(
unsignedI = 0; I != NumExpandedTypes; ++I) {
777 new(&TypesAndInfos[I].first)
QualType(ExpandedTypes[I]);
778TypesAndInfos[I].second = ExpandedTInfos[I];
790additionalSizeToAlloc<std::pair<QualType, TypeSourceInfo *>,
804additionalSizeToAlloc<std::pair<QualType, TypeSourceInfo *>,
808ExpandedTypes, ExpandedTInfos);
813 boolHasTypeConstraint) {
814 return new(
C, ID, additionalSizeToAlloc<std::pair<
QualType,
817HasTypeConstraint ? 1 : 0))
8190, 0,
nullptr,
QualType(),
false,
nullptr);
824 unsignedNumExpandedTypes,
825 boolHasTypeConstraint) {
828additionalSizeToAlloc<std::pair<QualType, TypeSourceInfo *>,
Expr*>(
829NumExpandedTypes, HasTypeConstraint ? 1 : 0))
8310, 0,
nullptr,
QualType(),
nullptr, {}, {});
832NTTP->NumExpandedTypes = NumExpandedTypes;
851DefaultArgument.
set(
nullptr);
860voidTemplateTemplateParmDecl::anchor() {}
862TemplateTemplateParmDecl::TemplateTemplateParmDecl(
868ExpandedParameterPack(
true), NumExpandedParams(Expansions.size()) {
869 if(!Expansions.empty())
870std::uninitialized_copy(Expansions.begin(), Expansions.end(),
871getTrailingObjects<TemplateParameterList *>());
890additionalSizeToAlloc<TemplateParameterList *>(Expansions.size()))
897 false,
nullptr,
false,
nullptr);
902 unsignedNumExpansions) {
904 new(
C, ID, additionalSizeToAlloc<TemplateParameterList *>(NumExpansions))
906 false,
nullptr, {});
907TTP->NumExpandedParams = NumExpansions;
919DefaultArgument.
set(
nullptr);
928: NumArguments(Args.size()) {
929std::uninitialized_copy(Args.begin(), Args.end(),
930getTrailingObjects<TemplateArgument>());
936 void*Mem = Context.
Allocate(totalSizeToAlloc<TemplateArgument>(Args.size()));
946 if(TemplateArgsAsWritten)
948*TemplateArgsAsWritten);
951 C.Allocate(totalSizeToAlloc<MemberSpecializationInfo *>(MSInfo ? 1 : 0));
953FD, Template, TSK, TemplateArgs, ArgsAsWritten, POI, MSInfo);
969SpecializedTemplate(SpecializedTemplate),
990Context, ClassTemplateSpecialization, TK, DC, StartLoc, IdLoc,
991SpecializedTemplate, Args, PrevDecl);
992 Result->setMayHaveOutOfDateDef(
false);
999 Result->setHasExternalLexicalStorage(
1011 Result->setMayHaveOutOfDateDef(
false);
1019 const auto*PS = dyn_cast<ClassTemplatePartialSpecializationDecl>(
this);
1021PS ? PS->getTemplateArgsAsWritten() :
nullptr) {
1023OS, ArgsAsWritten->arguments(), Policy,
1028OS, TemplateArgs.
asArray(), Policy,
1035 if(
const auto*PartialSpec =
1036SpecializedTemplate.dyn_cast<SpecializedPartialSpecialization*>())
1037 returnPartialSpec->PartialSpecialization->getSpecializedTemplate();
1038 returncast<ClassTemplateDecl *>(SpecializedTemplate);
1049assert(!Pattern.isNull() &&
1050 "Class template specialization without pattern?");
1051 if(
const auto*CTPSD =
1052dyn_cast<ClassTemplatePartialSpecializationDecl *>(Pattern))
1053 returnCTPSD->getSourceRange();
1054 returncast<ClassTemplateDecl *>(Pattern)->getSourceRange();
1076llvm_unreachable(
"unhandled template specialization kind");
1080 auto*Info = dyn_cast_if_present<ExplicitInstantiationInfo *>(ExplicitInfo);
1087ExplicitInfo = Info;
1089Info->ExternKeywordLoc =
Loc;
1094 auto*Info = dyn_cast_if_present<ExplicitInstantiationInfo *>(ExplicitInfo);
1101ExplicitInfo = Info;
1103Info->TemplateKeywordLoc =
Loc;
1112 Expr*ConstraintExpr) {
1123 nullptr,
nullptr);
1131ImplicitConceptSpecializationDecl::ImplicitConceptSpecializationDecl(
1134:
Decl(ImplicitConceptSpecialization, DC, SL),
1135NumTemplateArgs(ConvertedArgs.size()) {
1136setTemplateArguments(ConvertedArgs);
1139ImplicitConceptSpecializationDecl::ImplicitConceptSpecializationDecl(
1140EmptyShell
Empty,
unsignedNumTemplateArgs)
1141:
Decl(ImplicitConceptSpecialization,
Empty),
1142NumTemplateArgs(NumTemplateArgs) {}
1147 return new(
C, DC,
1148additionalSizeToAlloc<TemplateArgument>(ConvertedArgs.size()))
1155 return new(
C, ID, additionalSizeToAlloc<TemplateArgument>(NumTemplateArgs))
1161assert(Converted.size() == NumTemplateArgs);
1162std::uninitialized_copy(Converted.begin(), Converted.end(),
1163getTrailingObjects<TemplateArgument>());
1169voidClassTemplatePartialSpecializationDecl::anchor() {}
1171ClassTemplatePartialSpecializationDecl::ClassTemplatePartialSpecializationDecl(
1177Context, ClassTemplatePartialSpecialization, TK, DC, StartLoc, IdLoc,
1178SpecializedTemplate, Args, PrevDecl),
1179TemplateParams(Params), InstantiatedFromMember(nullptr,
false) {
1192Context, TK, DC, StartLoc, IdLoc, Params, SpecializedTemplate, Args,
1195 Result->setMayHaveOutOfDateDef(
false);
1205 Result->setMayHaveOutOfDateDef(
false);
1213 returnMT->getSourceRange();
1225voidFriendTemplateDecl::anchor() {}
1233 if(!Params.empty()) {
1235llvm::copy(Params, TPL);
1237 return new(Context, DC)
1269 auto*CommonPtr =
new(
C)
Common;
1270 C.addDestruction(CommonPtr);
1306 boolOnlyPartial
)
const{
1310llvm::FoldingSetVector<VarTemplateSpecializationDecl> &
1316llvm::FoldingSetVector<VarTemplatePartialSpecializationDecl> &
1324 auto*CommonPtr =
new(
C)
Common;
1325 C.addDestruction(CommonPtr);
1352ID.AddInteger(TemplateArgs.size());
1366assert(Existing->
isCanonicalDecl() &&
"Non-canonical specialization?");
1370L->AddedCXXTemplateSpecialization(
this,
D);
1375llvm::FoldingSetVector<VarTemplatePartialSpecializationDecl> &PartialSpecs =
1378PS.reserve(PartialSpecs.size());
1380PS.push_back(
P.getMostRecentDecl());
1388 if(
P.getInstantiatedFromMember()->getCanonicalDecl() == DCanon)
1389 return P.getMostRecentDecl();
1403:
VarDecl(DK, Context, DC, StartLoc, IdLoc,
1405SpecializedTemplate(SpecializedTemplate),
1420VarTemplateSpecialization, Context, DC, StartLoc, IdLoc,
1421SpecializedTemplate,
T, TInfo, S, Args);
1427 return new(
C, ID)
1435 const auto*PS = dyn_cast<VarTemplatePartialSpecializationDecl>(
this);
1437PS ? PS->getTemplateArgsAsWritten() :
nullptr) {
1439OS, ArgsAsWritten->arguments(), Policy,
1444OS, TemplateArgs.
asArray(), Policy,
1450 if(
const auto*PartialSpec =
1451SpecializedTemplate.dyn_cast<SpecializedPartialSpecialization *>())
1452 returnPartialSpec->PartialSpecialization->getSpecializedTemplate();
1453 returncast<VarTemplateDecl *>(SpecializedTemplate);
1463assert(!Pattern.isNull() &&
1464 "Variable template specialization without pattern?");
1465 if(
const auto*VTPSD =
1466dyn_cast<VarTemplatePartialSpecializationDecl *>(Pattern))
1467 returnVTPSD->getSourceRange();
1495llvm_unreachable(
"unhandled template specialization kind");
1499 auto*Info = dyn_cast_if_present<ExplicitInstantiationInfo *>(ExplicitInfo);
1506ExplicitInfo = Info;
1508Info->ExternKeywordLoc =
Loc;
1512 auto*Info = dyn_cast_if_present<ExplicitInstantiationInfo *>(ExplicitInfo);
1519ExplicitInfo = Info;
1521Info->TemplateKeywordLoc =
Loc;
1528voidVarTemplatePartialSpecializationDecl::anchor() {}
1530VarTemplatePartialSpecializationDecl::VarTemplatePartialSpecializationDecl(
1536DC, StartLoc, IdLoc, SpecializedTemplate,
T,
1538TemplateParams(Params), InstantiatedFromMember(nullptr,
false) {
1550Context, DC, StartLoc, IdLoc, Params, SpecializedTemplate,
T, TInfo, S,
1566 returnMT->getSourceRange();
1579 nullptr,
true,
false,
1581 T->setImplicit(
true);
1585 C.getTrivialTypeSourceInfo(
QualType(
T->getTypeForDecl(), 0));
1588 nullptr, TI->
getType(),
true, TI);
1589N->setImplicit(
true);
1599 false,
nullptr,
false, TPL);
1600TemplateTemplateParm->setImplicit(
true);
1605 nullptr,
true,
false,
1607TemplateTypeParm->setImplicit(
true);
1611 QualType(TemplateTypeParm->getTypeForDecl(), 0));
1614 nullptr, TInfo->
getType(),
false, TInfo);
1615 NamedDecl*Params[] = {TemplateTemplateParm, TemplateTypeParm,
1616NonTypeTemplateParm};
1629 nullptr, TInfo->
getType(),
false, TInfo);
1634 nullptr,
true,
true,
1636Ts->setImplicit(
true);
1661 false, BaseTemplateList);
1670 auto*HasTypeMemberList =
1678 false, HasTypeMemberList);
1682 C, DC, {}, {},
0,
2,
nullptr,
1688 nullptr,
false,
true);
1695{BaseTemplate, HasTypeMember, HasNoTypeMember, Ts},
SourceLocation(),
1710llvm_unreachable(
"unhandled BuiltinTemplateKind!");
1713voidBuiltinTemplateDecl::anchor() {}
1727 C.addDestruction(&TPOD->Value);
1734 C.addDestruction(&TPOD->Value);
1740OS <<
"<template param ";
1766 caseDecl::Kind::CXXRecord:
1767 returncast<CXXRecordDecl>(
D)
1768->getDescribedTemplate()
1769->getTemplateParameters();
1770 caseDecl::Kind::ClassTemplate:
1771 returncast<ClassTemplateDecl>(
D)->getTemplateParameters();
1772 caseDecl::Kind::ClassTemplateSpecialization: {
1773 const auto*CTSD = cast<ClassTemplateSpecializationDecl>(
D);
1774 auto P= CTSD->getSpecializedTemplateOrPartial();
1775 if(
const auto*CTPSD =
1776dyn_cast<ClassTemplatePartialSpecializationDecl *>(
P))
1777 returnCTPSD->getTemplateParameters();
1778 returncast<ClassTemplateDecl *>(
P)->getTemplateParameters();
1780 caseDecl::Kind::ClassTemplatePartialSpecialization:
1781 returncast<ClassTemplatePartialSpecializationDecl>(
D)
1782->getTemplateParameters();
1783 caseDecl::Kind::TypeAliasTemplate:
1784 returncast<TypeAliasTemplateDecl>(
D)->getTemplateParameters();
1785 caseDecl::Kind::BuiltinTemplate:
1786 returncast<BuiltinTemplateDecl>(
D)->getTemplateParameters();
1787 caseDecl::Kind::CXXDeductionGuide:
1788 caseDecl::Kind::CXXConversion:
1789 caseDecl::Kind::CXXConstructor:
1790 caseDecl::Kind::CXXDestructor:
1791 caseDecl::Kind::CXXMethod:
1792 caseDecl::Kind::Function:
1793 returncast<FunctionDecl>(
D)
1794->getTemplateSpecializationInfo()
1796->getTemplateParameters();
1797 caseDecl::Kind::FunctionTemplate:
1798 returncast<FunctionTemplateDecl>(
D)->getTemplateParameters();
1799 caseDecl::Kind::VarTemplate:
1800 returncast<VarTemplateDecl>(
D)->getTemplateParameters();
1801 caseDecl::Kind::VarTemplateSpecialization: {
1802 const auto*VTSD = cast<VarTemplateSpecializationDecl>(
D);
1803 auto P= VTSD->getSpecializedTemplateOrPartial();
1804 if(
const auto*VTPSD = dyn_cast<VarTemplatePartialSpecializationDecl *>(
P))
1805 returnVTPSD->getTemplateParameters();
1806 returncast<VarTemplateDecl *>(
P)->getTemplateParameters();
1808 caseDecl::Kind::VarTemplatePartialSpecialization:
1809 returncast<VarTemplatePartialSpecializationDecl>(
D)
1810->getTemplateParameters();
1811 caseDecl::Kind::TemplateTemplateParm:
1812 returncast<TemplateTemplateParmDecl>(
D)->getTemplateParameters();
1813 caseDecl::Kind::Concept:
1814 returncast<ConceptDecl>(
D)->getTemplateParameters();
1816llvm_unreachable(
"Unhandled templated declaration kind");
Defines the clang::ASTContext interface.
Defines enum values for all the target-independent builtin functions.
Defines the C++ Decl subclasses, other than those for templates (found in DeclTemplate....
static TemplateParameterList * createTypePackElementParameterList(const ASTContext &C, DeclContext *DC)
static bool DefaultTemplateArgumentContainsUnexpandedPack(const TemplateParam &P)
static TemplateParameterList * createMakeIntegerSeqParameterList(const ASTContext &C, DeclContext *DC)
static bool AdoptTemplateParameterList(TemplateParameterList *Params, DeclContext *Owner)
static TemplateParameterList * createBuiltinTemplateParameterList(const ASTContext &C, DeclContext *DC, BuiltinTemplateKind BTK)
static TemplateParameterList * createBuiltinCommonTypeList(const ASTContext &C, DeclContext *DC)
Defines the C++ template declaration subclasses.
Defines the clang::Expr interface and subclasses for C++ expressions.
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified.
This file contains the declaration of the ODRHash class, which calculates a hash based on AST nodes,...
static StringRef getIdentifier(const Token &Tok)
Defines the clang::SourceLocation class and associated facilities.
Defines the clang::TypeLoc interface and its subclasses.
C Language Family Type Representation.
APValue - This class implements a discriminated union of [uninitialized] [APSInt] [APFloat],...
void printPretty(raw_ostream &OS, const ASTContext &Ctx, QualType Ty) const
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
QualType getTemplateSpecializationType(TemplateName T, ArrayRef< TemplateArgument > Args, QualType Canon=QualType()) const
QualType getInjectedClassNameType(CXXRecordDecl *Decl, QualType TST) const
getInjectedClassNameType - Return the unique reference to the injected class name type for the specif...
bool hasSameType(QualType T1, QualType T2) const
Determine whether the given types T1 and T2 are equivalent.
TemplateName getQualifiedTemplateName(NestedNameSpecifier *NNS, bool TemplateKeyword, TemplateName Template) const
Retrieve the template name that represents a qualified template name such as std::vector.
QualType getTypeDeclType(const TypeDecl *Decl, const TypeDecl *PrevDecl=nullptr) const
Return the unique reference to the type for the specified type declaration.
TemplateArgument getInjectedTemplateArg(NamedDecl *ParamDecl) const
void * Allocate(size_t Size, unsigned Align=8) const
ExternalASTSource * getExternalSource() const
Retrieve a pointer to the external AST source associated with this AST context, if any.
An abstract interface that should be implemented by listeners that want to be notified when an AST en...
Represents a C++11 auto or C++14 decltype(auto) type, possibly constrained by a type-constraint.
bool isConstrained() const
Represents a C++ struct/union/class.
Declaration of a class template.
void AddPartialSpecialization(ClassTemplatePartialSpecializationDecl *D, void *InsertPos)
Insert the specified partial specialization knowing that it is not already in.
llvm::FoldingSetVector< ClassTemplateSpecializationDecl > & getSpecializations() const
Retrieve the set of specializations of this class template.
CXXRecordDecl * getTemplatedDecl() const
Get the underlying class declarations of the template.
llvm::FoldingSetVector< ClassTemplatePartialSpecializationDecl > & getPartialSpecializations() const
Retrieve the set of partial specializations of this class template.
ClassTemplatePartialSpecializationDecl * findPartialSpecialization(ArrayRef< TemplateArgument > Args, TemplateParameterList *TPL, void *&InsertPos)
Return the partial specialization with the provided arguments if it exists, otherwise return the inse...
CommonBase * newCommon(ASTContext &C) const override
static ClassTemplateDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation L, DeclarationName Name, TemplateParameterList *Params, NamedDecl *Decl)
Create a class template node.
ClassTemplatePartialSpecializationDecl * findPartialSpecInstantiatedFromMember(ClassTemplatePartialSpecializationDecl *D)
Find a class template partial specialization which was instantiated from the given member partial spe...
void LoadLazySpecializations(bool OnlyPartial=false) const
Load any lazily-loaded specializations from the external source.
void AddSpecialization(ClassTemplateSpecializationDecl *D, void *InsertPos)
Insert the specified specialization knowing that it is not already in.
QualType getInjectedClassNameSpecialization()
Retrieve the template specialization type of the injected-class-name for this class template.
Common * getCommonPtr() const
ClassTemplateSpecializationDecl * findSpecialization(ArrayRef< TemplateArgument > Args, void *&InsertPos)
Return the specialization with the provided arguments if it exists, otherwise return the insertion po...
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...
static ClassTemplatePartialSpecializationDecl * Create(ASTContext &Context, TagKind TK, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, TemplateParameterList *Params, ClassTemplateDecl *SpecializedTemplate, ArrayRef< TemplateArgument > Args, QualType CanonInjectedType, ClassTemplatePartialSpecializationDecl *PrevDecl)
void Profile(llvm::FoldingSetNodeID &ID) const
bool isMemberSpecialization() const
Determines whether this class template partial specialization template was a specialization of a memb...
SourceRange getSourceRange() const override LLVM_READONLY
Source range that this declaration covers.
static ClassTemplatePartialSpecializationDecl * CreateDeserialized(ASTContext &C, GlobalDeclID ID)
TemplateParameterList * getTemplateParameters() const
Get the list of template parameters.
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.
ClassTemplateSpecializationDecl(ASTContext &Context, Kind DK, TagKind TK, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, ClassTemplateDecl *SpecializedTemplate, ArrayRef< TemplateArgument > Args, ClassTemplateSpecializationDecl *PrevDecl)
static ClassTemplateSpecializationDecl * CreateDeserialized(ASTContext &C, GlobalDeclID ID)
llvm::PointerUnion< ClassTemplateDecl *, ClassTemplatePartialSpecializationDecl * > getSpecializedTemplateOrPartial() const
Retrieve the class template or class template partial specialization which was specialized by this.
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 setExternKeywordLoc(SourceLocation Loc)
Sets the location of the extern keyword.
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.
SourceLocation getTemplateKeywordLoc() const
Gets the location of the template keyword, if present.
void setTemplateKeywordLoc(SourceLocation Loc)
Sets the location of the template keyword.
static ClassTemplateSpecializationDecl * Create(ASTContext &Context, TagKind TK, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, ClassTemplateDecl *SpecializedTemplate, ArrayRef< TemplateArgument > Args, ClassTemplateSpecializationDecl *PrevDecl)
Declaration of a C++20 concept.
static ConceptDecl * CreateDeserialized(ASTContext &C, GlobalDeclID ID)
static ConceptDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation L, DeclarationName Name, TemplateParameterList *Params, Expr *ConstraintExpr=nullptr)
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...
bool hasExternalLexicalStorage() const
Whether this DeclContext has external storage containing additional declarations that are lexically i...
Decl - This represents one declaration (or definition), e.g.
ASTContext & getASTContext() const LLVM_READONLY
ASTMutationListener * getASTMutationListener() const
void setInvalidDecl(bool Invalid=true)
setInvalidDecl - Indicates the Decl had a semantic error.
Kind
Lists the kind of concrete classes of Decl.
bool isCanonicalDecl() const
Whether this particular Decl is a canonical one.
virtual Decl * getCanonicalDecl()
Retrieves the "canonical" declaration of the given declaration.
The name of a declaration.
Represents a ValueDecl that came out of a declarator.
SourceLocation getOuterLocStart() const
Return start of source range taking into account any outer template declarations.
SourceRange getSourceRange() const override LLVM_READONLY
Source range that this declaration covers.
unsigned getNumTemplateParameterLists() const
void set(ArgType Arg)
Set the default argument.
This represents one expression.
bool containsUnexpandedParameterPack() const
Whether this expression contains an unexpanded parameter pack (for C++11 variadic templates).
virtual bool LoadExternalSpecializations(const Decl *D, bool OnlyPartial)
Load all the external specializations for the Decl.
Declaration of a friend template.
static FriendTemplateDecl * Create(ASTContext &Context, DeclContext *DC, SourceLocation Loc, MutableArrayRef< TemplateParameterList * > Params, FriendUnion Friend, SourceLocation FriendLoc)
llvm::PointerUnion< NamedDecl *, TypeSourceInfo * > FriendUnion
static FriendTemplateDecl * CreateDeserialized(ASTContext &C, GlobalDeclID ID)
Represents a function declaration or definition.
Declaration of a template function.
FunctionDecl * findSpecialization(ArrayRef< TemplateArgument > Args, void *&InsertPos)
Return the specialization with the provided arguments if it exists, otherwise return the insertion po...
void addSpecialization(FunctionTemplateSpecializationInfo *Info, void *InsertPos)
Add a specialization of this function template.
CommonBase * newCommon(ASTContext &C) const override
Common * getCommonPtr() const
FunctionTemplateDecl * getPreviousDecl()
Retrieve the previous declaration of this function template, or nullptr if no such declaration exists...
static FunctionTemplateDecl * CreateDeserialized(ASTContext &C, GlobalDeclID ID)
Create an empty function template node.
static FunctionTemplateDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation L, DeclarationName Name, TemplateParameterList *Params, NamedDecl *Decl)
Create a function template node.
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.
Provides information about a function template specialization, which is a FunctionDecl that has been ...
static FunctionTemplateSpecializationInfo * Create(ASTContext &C, FunctionDecl *FD, FunctionTemplateDecl *Template, TemplateSpecializationKind TSK, TemplateArgumentList *TemplateArgs, const TemplateArgumentListInfo *TemplateArgsAsWritten, SourceLocation POI, MemberSpecializationInfo *MSInfo)
One of these records is kept for each identifier that is lexed.
void setTemplateArguments(ArrayRef< TemplateArgument > Converted)
static ImplicitConceptSpecializationDecl * Create(const ASTContext &C, DeclContext *DC, SourceLocation SL, ArrayRef< TemplateArgument > ConvertedArgs)
static ImplicitConceptSpecializationDecl * CreateDeserialized(const ASTContext &C, GlobalDeclID ID, unsigned NumTemplateArgs)
Provides information a specialization of a member of a class template, which may be a member function...
This represents a decl that may have a name.
DeclarationName getDeclName() const
Get the actual, stored name of the declaration, which may be a special name.
virtual void getNameForDiagnostic(raw_ostream &OS, const PrintingPolicy &Policy, bool Qualified) const
Appends a human-readable name for this declaration into the given stream.
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 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.
const TemplateArgumentLoc & getDefaultArgument() const
Retrieve the default argument, if any.
static NonTypeTemplateParmDecl * Create(const ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, unsigned D, unsigned P, const IdentifierInfo *Id, QualType T, bool ParameterPack, TypeSourceInfo *TInfo)
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.
bool isNull() const
Return true if this QualType doesn't point to a type yet.
const Type * getTypePtr() const
Retrieves a pointer to the underlying (unqualified) type.
void print(raw_ostream &OS, const PrintingPolicy &Policy, const Twine &PlaceHolder=Twine(), unsigned Indentation=0) const
QualType getUnqualifiedType() const
Retrieve the unqualified variant of the given type, removing as little sugar as possible.
Declaration of a redeclarable template.
SpecEntryTraits< EntryType >::DeclType * findSpecializationLocally(llvm::FoldingSetVector< EntryType > &Specs, void *&InsertPos, ProfileArguments &&...ProfileArgs)
void loadLazySpecializationsImpl(bool OnlyPartial=false) const
CommonBase * getCommonPtr() const
Retrieves the "common" pointer shared by all (re-)declarations of the same template.
SpecEntryTraits< EntryType >::DeclType * findSpecializationImpl(llvm::FoldingSetVector< EntryType > &Specs, void *&InsertPos, ProfileArguments &&...ProfileArgs)
CommonBase * Common
Pointer to the common data shared by all declarations of this template.
virtual CommonBase * newCommon(ASTContext &C) const =0
RedeclarableTemplateDecl * getCanonicalDecl() override
Retrieves the canonical declaration of this template.
void addSpecializationImpl(llvm::FoldingSetVector< EntryType > &Specs, EntryType *Entry, void *InsertPos)
ArrayRef< TemplateArgument > getInjectedTemplateArgs(const ASTContext &Context) const
Retrieve the "injected" template arguments that correspond to the template parameters of this templat...
RedeclarableTemplateDecl * getPreviousDecl()
Return the previous declaration of this declaration or NULL if this is the first declaration.
Encodes a location in the source.
bool isValid() const
Return true if this is a valid SourceLocation object.
A trivial tuple used to represent a source range.
void setBegin(SourceLocation b)
SourceLocation getBegin() const
void setEnd(SourceLocation e)
void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Context, bool Canonical, bool ProfileLambdaExpr=false) const
Produce a unique representation of the given statement.
bool isThisDeclarationADefinition() const
Return true if this declaration is a completion definition of the type.
bool isCompleteDefinition() const
Return true if this decl has its body fully specified.
unsigned getNumTemplateParameterLists() const
A convenient class for passing around template argument information.
A template argument list.
static TemplateArgumentList * CreateCopy(ASTContext &Context, ArrayRef< TemplateArgument > Args)
Create a new template argument list that copies the given set of template arguments.
ArrayRef< TemplateArgument > asArray() const
Produce this as an array ref.
Location wrapper for a TemplateArgument.
SourceLocation getLocation() const
const TemplateArgument & getArgument() const
SourceRange getSourceRange() const LLVM_READONLY
Represents a template argument.
bool isNull() const
Determine whether this template argument has no value.
The base class of all kinds of template declarations (e.g., class, function, etc.).
TemplateParameterList * TemplateParams
bool hasAssociatedConstraints() const
NamedDecl * getTemplatedDecl() const
Get the underlying, templated declaration.
SourceRange getSourceRange() const override LLVM_READONLY
Source range that this declaration covers.
void getAssociatedConstraints(llvm::SmallVectorImpl< const Expr * > &AC) const
Get the total constraint-expression associated with this template, including constraint-expressions d...
TemplateDecl(Kind DK, DeclContext *DC, SourceLocation L, DeclarationName Name, TemplateParameterList *Params, NamedDecl *Decl)
TemplateParameterList * getTemplateParameters() const
Get the list of template parameters.
Represents a C++ template name within the type system.
A template parameter object.
void printAsExpr(llvm::raw_ostream &OS) const
Print this object as an equivalent expression.
const APValue & getValue() const
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.
Stores a list of template parameters for a TemplateDecl and its derived classes.
NamedDecl * getParam(unsigned Idx)
ArrayRef< TemplateArgument > getInjectedTemplateArgs(const ASTContext &Context)
Get the template argument list of the template parameter list.
unsigned getDepth() const
Get the depth of this template parameter list in the set of template parameter lists.
bool hasAssociatedConstraints() const
unsigned getMinRequiredArguments() const
Returns the minimum number of arguments needed to form a template specialization.
static TemplateParameterList * Create(const ASTContext &C, SourceLocation TemplateLoc, SourceLocation LAngleLoc, ArrayRef< NamedDecl * > Params, SourceLocation RAngleLoc, Expr *RequiresClause)
Expr * getRequiresClause()
The constraint-expression of the associated requires-clause.
void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &C) const
void getAssociatedConstraints(llvm::SmallVectorImpl< const Expr * > &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
Defines the position of a template parameter within a template parameter list.
TemplateTemplateParmDecl - Declares a template template parameter, e.g., "T" in.
const TemplateArgumentLoc & getDefaultArgument() const
Retrieve the default argument, if any.
static TemplateTemplateParmDecl * CreateDeserialized(ASTContext &C, GlobalDeclID ID)
SourceLocation getDefaultArgumentLoc() const
Retrieve the location of the default argument, if any.
void setDefaultArgument(const ASTContext &C, const TemplateArgumentLoc &DefArg)
Set the default argument for this template parameter, and whether that default argument was inherited...
static TemplateTemplateParmDecl * Create(const ASTContext &C, DeclContext *DC, SourceLocation L, unsigned D, unsigned P, bool ParameterPack, IdentifierInfo *Id, bool Typename, TemplateParameterList *Params)
bool hasDefaultArgument() const
Determine whether this template parameter has a default argument.
Declaration of a template type parameter.
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.
static TemplateTypeParmDecl * CreateDeserialized(const ASTContext &C, GlobalDeclID ID)
static TemplateTypeParmDecl * Create(const ASTContext &C, DeclContext *DC, SourceLocation KeyLoc, SourceLocation NameLoc, unsigned D, unsigned P, IdentifierInfo *Id, bool Typename, bool ParameterPack, bool HasTypeConstraint=false, std::optional< unsigned > NumExpanded=std::nullopt)
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.
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.
void setTypeConstraint(ConceptReference *CR, Expr *ImmediatelyDeclaredConstraint)
void setDefaultArgument(const ASTContext &C, const TemplateArgumentLoc &DefArg)
Set the default argument for this template parameter.
Declaration of an alias template.
CommonBase * newCommon(ASTContext &C) const override
static TypeAliasTemplateDecl * CreateDeserialized(ASTContext &C, GlobalDeclID ID)
Create an empty alias template node.
static TypeAliasTemplateDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation L, DeclarationName Name, TemplateParameterList *Params, NamedDecl *Decl)
Create a function template node.
Models the abbreviated syntax to constrain a template type parameter: template <convertible_to<string...
Expr * getImmediatelyDeclaredConstraint() const
Get the immediately-declared constraint expression introduced by this type-constraint,...
const Type * getTypeForDecl() const
SourceRange getSourceRange() const override LLVM_READONLY
Source range that this declaration covers.
SourceLocation getBeginLoc() const LLVM_READONLY
A container of type source information.
QualType getType() const
Return the type wrapped by this type source info.
const T * castAs() const
Member-template castAs<specific type>.
AutoType * getContainedAutoType() const
Get the AutoType whose type will be deduced for a variable with an initializer of this type.
Represents a variable declaration or definition.
SourceRange getSourceRange() const override LLVM_READONLY
Source range that this declaration covers.
@ Definition
This declaration is definitely a definition.
Declaration of a variable template.
VarTemplateDecl * getDefinition()
VarTemplateDecl * getCanonicalDecl() override
Retrieves the canonical declaration of this template.
void AddPartialSpecialization(VarTemplatePartialSpecializationDecl *D, void *InsertPos)
Insert the specified partial specialization knowing that it is not already in.
Common * getCommonPtr() const
VarTemplatePartialSpecializationDecl * findPartialSpecialization(ArrayRef< TemplateArgument > Args, TemplateParameterList *TPL, void *&InsertPos)
Return the partial specialization with the provided arguments if it exists, otherwise return the inse...
void AddSpecialization(VarTemplateSpecializationDecl *D, void *InsertPos)
Insert the specified specialization knowing that it is not already in.
VarTemplateDecl * getPreviousDecl()
Retrieve the previous declaration of this variable template, or nullptr if no such declaration exists...
CommonBase * newCommon(ASTContext &C) const override
void LoadLazySpecializations(bool OnlyPartial=false) const
Load any lazily-loaded specializations from the external source.
static VarTemplateDecl * CreateDeserialized(ASTContext &C, GlobalDeclID ID)
Create an empty variable template node.
static VarTemplateDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation L, DeclarationName Name, TemplateParameterList *Params, VarDecl *Decl)
Create a variable template node.
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.
bool isThisDeclarationADefinition() const
Returns whether this template declaration defines the primary variable pattern.
VarTemplateSpecializationDecl * findSpecialization(ArrayRef< TemplateArgument > Args, void *&InsertPos)
Return the specialization with the provided arguments if it exists, otherwise return the insertion po...
VarTemplatePartialSpecializationDecl * findPartialSpecInstantiatedFromMember(VarTemplatePartialSpecializationDecl *D)
Find a variable template partial specialization which was instantiated from the given member partial ...
static VarTemplatePartialSpecializationDecl * Create(ASTContext &Context, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, TemplateParameterList *Params, VarTemplateDecl *SpecializedTemplate, QualType T, TypeSourceInfo *TInfo, StorageClass S, ArrayRef< TemplateArgument > Args)
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...
bool isMemberSpecialization() const
Determines whether this variable template partial specialization was a specialization of a member par...
void Profile(llvm::FoldingSetNodeID &ID) const
static VarTemplatePartialSpecializationDecl * CreateDeserialized(ASTContext &C, GlobalDeclID ID)
Represents a variable template specialization, which refers to a variable template with a given set o...
VarTemplateSpecializationDecl(Kind DK, ASTContext &Context, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, VarTemplateDecl *SpecializedTemplate, QualType T, TypeSourceInfo *TInfo, StorageClass S, ArrayRef< TemplateArgument > Args)
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.
const TemplateArgumentList & getTemplateArgs() const
Retrieve the template arguments of the variable template specialization.
SourceLocation getTemplateKeywordLoc() const
Gets the location of the template keyword, if present.
SourceRange getSourceRange() const override LLVM_READONLY
Source range that this declaration covers.
static VarTemplateSpecializationDecl * Create(ASTContext &Context, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, VarTemplateDecl *SpecializedTemplate, QualType T, TypeSourceInfo *TInfo, StorageClass S, ArrayRef< TemplateArgument > Args)
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.
VarTemplateDecl * getSpecializedTemplate() const
Retrieve the template that this specialization specializes.
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 getNameForDiagnostic(raw_ostream &OS, const PrintingPolicy &Policy, bool Qualified) const override
Appends a human-readable name for this declaration into the given stream.
The JSON file list parser is used to communicate input to InstallAPI.
StorageClass
Storage classes.
void * allocateDefaultArgStorageChain(const ASTContext &C)
@ Result
The result type of a method or function.
TemplateParameterList * getReplacedTemplateParameterList(Decl *D)
Internal helper used by Subst* nodes to retrieve the parameter list for their AssociatedDecl.
TagTypeKind
The kind of a tag type.
BuiltinTemplateKind
Kinds of BuiltinTemplateDecl.
@ BTK__type_pack_element
This names the __type_pack_element BuiltinTemplateDecl.
@ BTK__builtin_common_type
This names the __builtin_common_type BuiltinTemplateDecl.
@ BTK__make_integer_seq
This names the __make_integer_seq BuiltinTemplateDecl.
std::optional< unsigned > getExpandedPackSize(const NamedDecl *Param)
Check whether the template parameter is a pack expansion, and if so, determine the number of paramete...
const FunctionProtoType * T
void printTemplateArgumentList(raw_ostream &OS, ArrayRef< TemplateArgument > Args, const PrintingPolicy &Policy, const TemplateParameterList *TPL=nullptr)
Print a template argument list, including the '<' and '>' enclosing the template arguments.
TemplateSpecializationKind
Describes the kind of template specialization that a particular template specialization declaration r...
@ TSK_ExplicitInstantiationDefinition
This template specialization was instantiated from a template due to an explicit instantiation defini...
@ TSK_ExplicitInstantiationDeclaration
This template specialization was instantiated from a template due to an explicit instantiation declar...
@ TSK_ExplicitSpecialization
This template specialization was declared or defined by an explicit specialization (C++ [temp....
@ TSK_ImplicitInstantiation
This template specialization was implicitly instantiated from a template.
@ TSK_Undeclared
This template specialization was formed from a template-id but has not yet been declared,...
@ Struct
The "struct" keyword introduces the elaborated-type-specifier.
@ Typename
The "typename" keyword precedes the qualified type name, e.g., typename T::type.
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.
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...
QualType InjectedClassNameType
The injected-class-name type for this class template.
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.
const ASTTemplateArgumentListInfo * TemplateArgsAsWritten
The template arguments as written..
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.
unsigned AlwaysIncludeTypeForTemplateArgument
Whether to use type suffixes (eg: 1U) on integral non-type template parameters.
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 ...
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4