29#include "llvm/ADT/ArrayRef.h"
30#include "llvm/ADT/FoldingSet.h"
31#include "llvm/ADT/PointerUnion.h"
32#include "llvm/ADT/STLExtras.h"
33#include "llvm/ADT/SmallVector.h"
34#include "llvm/Support/ErrorHandling.h"
45template <
class TemplateParam>
48 return P.hasDefaultArgument() &&
49 P.getDefaultArgument().getArgument().containsUnexpandedParameterPack();
52TemplateParameterList::TemplateParameterList(
const ASTContext &
C,
58 : TemplateLoc(TemplateLoc), LAngleLoc(LAngleLoc), RAngleLoc(RAngleLoc),
59 NumParams(Params.size()), ContainsUnexpandedParameterPack(
false),
60 HasRequiresClause(RequiresClause != nullptr),
61 HasConstrainedParameters(
false) {
62 for (
unsigned Idx = 0; Idx < NumParams; ++Idx) {
66 bool IsPack =
P->isTemplateParameterPack();
67 if (
const auto *NTTP = dyn_cast<NonTypeTemplateParmDecl>(
P)) {
68 if (!IsPack && (NTTP->getType()->containsUnexpandedParameterPack() ||
70 ContainsUnexpandedParameterPack =
true;
71 if (NTTP->hasPlaceholderTypeConstraint())
72 HasConstrainedParameters =
true;
73 }
else if (
const auto *TTP = dyn_cast<TemplateTemplateParmDecl>(
P)) {
75 (TTP->getTemplateParameters()->containsUnexpandedParameterPack() ||
77 ContainsUnexpandedParameterPack =
true;
79 }
else if (
const auto *TTP = dyn_cast<TemplateTypeParmDecl>(
P)) {
81 ContainsUnexpandedParameterPack =
true;
85 ContainsUnexpandedParameterPack =
true;
87 if (TTP->hasTypeConstraint())
88 HasConstrainedParameters =
true;
90 llvm_unreachable(
"unexpected template parameter type");
94 if (HasRequiresClause) {
96 ContainsUnexpandedParameterPack =
true;
97 *getTrailingObjects<Expr *>() = RequiresClause;
101bool TemplateParameterList::containsUnexpandedParameterPack()
const {
102 if (ContainsUnexpandedParameterPack)
104 if (!HasConstrainedParameters)
111 if (!Param->isImplicit())
114 if (
const auto *TTP = dyn_cast<TemplateTypeParmDecl>(Param)) {
115 const auto *TC = TTP->getTypeConstraint();
116 if (TC && TC->getImmediatelyDeclaredConstraint()
117 ->containsUnexpandedParameterPack())
130 void *Mem =
C.Allocate(totalSizeToAlloc<NamedDecl *, Expr *>(
131 Params.size(), RequiresClause ? 1u : 0u),
134 RAngleLoc, RequiresClause);
140 ID.AddBoolean(RC !=
nullptr);
145 if (
const auto *NTTP = dyn_cast<NonTypeTemplateParmDecl>(
D)) {
147 ID.AddBoolean(NTTP->isParameterPack());
148 NTTP->getType().getCanonicalType().Profile(ID);
149 ID.AddBoolean(NTTP->hasPlaceholderTypeConstraint());
150 if (
const Expr *
E = NTTP->getPlaceholderTypeConstraint())
154 if (
const auto *TTP = dyn_cast<TemplateTypeParmDecl>(
D)) {
156 ID.AddBoolean(TTP->isParameterPack());
157 ID.AddBoolean(TTP->hasTypeConstraint());
159 TC->getImmediatelyDeclaredConstraint()->Profile(ID,
C,
163 const auto *TTP = cast<TemplateTemplateParmDecl>(
D);
165 ID.AddInteger(TTP->templateParameterKind());
166 ID.AddBoolean(TTP->isParameterPack());
167 TTP->getTemplateParameters()->Profile(ID,
C);
172 unsigned NumRequiredArgs = 0;
174 if (
P->isTemplateParameterPack()) {
176 NumRequiredArgs += *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 (
const auto *TTP = dyn_cast<TemplateTemplateParmDecl>(
P);
189 TTP && TTP->hasDefaultArgument())
195 return NumRequiredArgs;
203 if (
const auto *TTP = dyn_cast<TemplateTypeParmDecl>(FirstParm))
204 return TTP->getDepth();
205 else if (
const auto *NTTP = dyn_cast<NonTypeTemplateParmDecl>(FirstParm))
206 return NTTP->getDepth();
208 return cast<TemplateTemplateParmDecl>(FirstParm)->getDepth();
215 P->setDeclContext(Owner);
217 if (
const auto *TTP = dyn_cast<TemplateTemplateParmDecl>(
P))
221 if (
P->isInvalidDecl())
229 if (HasConstrainedParameters)
231 if (
const auto *TTP = dyn_cast<TemplateTypeParmDecl>(Param)) {
232 if (
const auto *TC = TTP->getTypeConstraint())
233 ACs.emplace_back(TC->getImmediatelyDeclaredConstraint(),
234 TC->getArgPackSubstIndex());
235 }
else if (
const auto *NTTP = dyn_cast<NonTypeTemplateParmDecl>(Param)) {
236 if (
const Expr *
E = NTTP->getPlaceholderTypeConstraint())
240 if (HasRequiresClause)
245 return HasRequiresClause || HasConstrainedParameters;
252 llvm::transform(*
this, InjectedArgs, [&](
NamedDecl *ND) {
256 return {InjectedArgs, NumParams};
265 if (
const auto *ParamValueDecl =
266 dyn_cast<NonTypeTemplateParmDecl>(TemplParam))
267 if (ParamValueDecl->getType()->getContainedDeducedType())
275 return new (
C)
char[
sizeof(
void*) * 2];
287 :
NamedDecl(DK, DC, L, Name), TemplatedDecl(
Decl), TemplateParams(Params) {}
289void TemplateDecl::anchor() {}
296 ACs.emplace_back(TRC);
303 return static_cast<bool>(FD->getTrailingRequiresClause());
309 case TemplateDecl::TypeAliasTemplate:
311 case TemplateDecl::BuiltinTemplate:
312 return !cast<BuiltinTemplateDecl>(
this)->isPackProducingBuiltinTemplate();
322void RedeclarableTemplateDecl::anchor() {}
338 PrevDecls.push_back(Prev);
357 bool OnlyPartial )
const {
382template <
class EntryType,
typename... ProfileArguments>
385 llvm::FoldingSetVector<EntryType> &Specs,
void *&InsertPos,
386 ProfileArguments... ProfileArgs) {
389 llvm::FoldingSetNodeID ID;
391 EntryType *Entry = Specs.FindNodeOrInsertPos(ID, InsertPos);
392 return Entry ? SETraits::getDecl(Entry)->getMostRecentDecl() :
nullptr;
395template <
class EntryType,
typename... ProfileArguments>
398 llvm::FoldingSetVector<EntryType> &Specs,
void *&InsertPos,
399 ProfileArguments... ProfileArgs) {
410template<
class Derived,
class EntryType>
412 llvm::FoldingSetVector<EntryType> &Specializations, EntryType *Entry,
418 auto Args = SETraits::getTemplateArgs(Entry);
424 void *CorrectInsertPos;
426 InsertPos == CorrectInsertPos &&
427 "given incorrect InsertPos for specialization");
429 Specializations.InsertNode(Entry, InsertPos);
431 EntryType *Existing = Specializations.GetOrInsertNode(Entry);
434 "non-canonical specialization?");
438 L->AddedCXXTemplateSpecialization(cast<Derived>(
this),
439 SETraits::getDecl(Entry));
465 auto *CommonPtr =
new (
C)
Common;
466 C.addDestruction(CommonPtr);
474llvm::FoldingSetVector<FunctionTemplateSpecializationInfo> &
502 Common *ThisCommon =
static_cast<Common *
>(Base::Common);
503 Common *PrevCommon =
nullptr;
506 if (Prev->Base::Common) {
507 PrevCommon =
static_cast<Common *
>(Prev->Base::Common);
510 PreviousDecls.push_back(Prev);
516 for (
auto *
D : PreviousDecls)
517 D->Base::Common = ThisCommon;
523 "Can't merge incompatible declarations!");
525 Base::Common = PrevCommon;
551 bool OnlyPartial )
const {
555llvm::FoldingSetVector<ClassTemplateSpecializationDecl> &
561llvm::FoldingSetVector<ClassTemplatePartialSpecializationDecl> &
569 auto *CommonPtr =
new (
C)
Common;
570 C.addDestruction(CommonPtr);
599 ID.AddInteger(TemplateArgs.size());
614 assert(Existing->
isCanonicalDecl() &&
"Non-canonical specialization?");
618 L->AddedCXXTemplateSpecialization(
this,
D);
623 llvm::FoldingSetVector<ClassTemplatePartialSpecializationDecl> &PartialSpecs
626 PS.reserve(PartialSpecs.size());
628 PS.push_back(
P.getMostRecentDecl());
636 if (Context.
hasSameType(
P.getCanonicalInjectedSpecializationType(Context),
638 return P.getMostRecentDecl();
649 if (
P.getInstantiatedFromMember()->getCanonicalDecl() == DCanon)
650 return P.getMostRecentDecl();
679 bool Typename,
bool ParameterPack,
bool HasTypeConstraint,
683 additionalSizeToAlloc<TypeConstraint>(HasTypeConstraint ? 1 : 0))
685 HasTypeConstraint, NumExpanded);
686 QualType TTPType =
C.getTemplateTypeParmType(
D,
P, ParameterPack, TTPDecl);
687 TTPDecl->setTypeForDecl(TTPType.
getTypePtr());
695 false,
false, std::nullopt);
700 bool HasTypeConstraint) {
702 additionalSizeToAlloc<TypeConstraint>(HasTypeConstraint ? 1 : 0))
704 false, HasTypeConstraint, std::nullopt);
727 DefaultArgument.
set(
nullptr);
733 return dyn_cast<TemplateTypeParmType>(
getTypeForDecl())->getDepth();
737 return dyn_cast<TemplateTypeParmType>(
getTypeForDecl())->getIndex();
741 return dyn_cast<TemplateTypeParmType>(
getTypeForDecl())->isParameterPack();
747 assert(HasTypeConstraint &&
748 "HasTypeConstraint=true must be passed at construction in order to "
749 "call setTypeConstraint");
750 assert(!TypeConstraintInitialized &&
751 "TypeConstraint was already initialized!");
752 new (getTrailingObjects())
754 TypeConstraintInitialized =
true;
761NonTypeTemplateParmDecl::NonTypeTemplateParmDecl(
767 ExpandedParameterPack(
true), NumExpandedTypes(ExpandedTypes.size()) {
768 if (!ExpandedTypes.empty() && !ExpandedTInfos.empty()) {
770 getTrailingObjects<std::pair<QualType, TypeSourceInfo *>>();
771 for (
unsigned I = 0; I != NumExpandedTypes; ++I) {
772 new (&TypesAndInfos[I].first)
QualType(ExpandedTypes[I]);
773 TypesAndInfos[I].second = ExpandedTInfos[I];
787 additionalSizeToAlloc<std::pair<QualType, TypeSourceInfo *>,
Expr *>(
788 0, HasConstraint ? 1 : 0))
790 ParameterPack, TInfo);
792 NTTP->setPlaceholderTypeConstraint(
nullptr);
805 additionalSizeToAlloc<std::pair<QualType, TypeSourceInfo *>,
Expr *>(
806 ExpandedTypes.size(), HasConstraint ? 1 : 0))
808 ExpandedTypes, ExpandedTInfos);
810 NTTP->setPlaceholderTypeConstraint(
nullptr);
816 bool HasTypeConstraint) {
819 additionalSizeToAlloc<std::pair<QualType, TypeSourceInfo *>,
Expr *>(
820 0, HasTypeConstraint ? 1 : 0))
822 0, 0,
nullptr,
QualType(),
false,
nullptr);
823 if (HasTypeConstraint)
824 NTTP->setPlaceholderTypeConstraint(
nullptr);
830 unsigned NumExpandedTypes,
831 bool HasTypeConstraint) {
834 additionalSizeToAlloc<std::pair<QualType, TypeSourceInfo *>,
Expr *>(
835 NumExpandedTypes, HasTypeConstraint ? 1 : 0))
837 0, 0,
nullptr,
QualType(),
nullptr, {}, {});
838 NTTP->NumExpandedTypes = NumExpandedTypes;
839 if (HasTypeConstraint)
840 NTTP->setPlaceholderTypeConstraint(
nullptr);
859 DefaultArgument.
set(
nullptr);
868void TemplateTemplateParmDecl::anchor() {}
870TemplateTemplateParmDecl::TemplateTemplateParmDecl(
876 ParameterPack(
true), ExpandedParameterPack(
true),
877 NumExpandedParams(Expansions.size()) {
878 llvm::uninitialized_copy(Expansions, getTrailingObjects());
896 additionalSizeToAlloc<TemplateParameterList *>(Expansions.size()))
910 unsigned NumExpansions) {
912 new (
C, ID, additionalSizeToAlloc<TemplateParameterList *>(NumExpansions))
916 TTP->NumExpandedParams = NumExpansions;
928 DefaultArgument.
set(
nullptr);
937 : NumArguments(Args.size()) {
938 llvm::uninitialized_copy(Args, getTrailingObjects());
944 void *Mem = Context.
Allocate(totalSizeToAlloc<TemplateArgument>(Args.size()));
954 if (TemplateArgsAsWritten)
956 *TemplateArgsAsWritten);
959 C.Allocate(totalSizeToAlloc<MemberSpecializationInfo *>(MSInfo ? 1 : 0));
961 FD,
Template, TSK, TemplateArgs, ArgsAsWritten, POI, MSInfo);
975 SpecializedTemplate(SpecializedTemplate),
977 SpecializationKind(
TSK_Undeclared), StrictPackMatch(StrictPackMatch) {
978 assert(DK == Kind::ClassTemplateSpecialization || StrictPackMatch ==
false);
993 Context, ClassTemplateSpecialization, TK, DC, StartLoc, IdLoc,
994 SpecializedTemplate, Args, StrictPackMatch, PrevDecl);
1001 Result->setHasExternalLexicalStorage(
1018 const auto *PS = dyn_cast<ClassTemplatePartialSpecializationDecl>(
this);
1020 PS ? PS->getTemplateArgsAsWritten() :
nullptr) {
1022 OS, ArgsAsWritten->arguments(), Policy,
1027 OS, TemplateArgs.
asArray(), Policy,
1034 if (
const auto *PartialSpec =
1035 SpecializedTemplate.dyn_cast<SpecializedPartialSpecialization*>())
1036 return PartialSpec->PartialSpecialization->getSpecializedTemplate();
1037 return cast<ClassTemplateDecl *>(SpecializedTemplate);
1048 assert(!Pattern.isNull() &&
1049 "Class template specialization without pattern?");
1050 if (
const auto *CTPSD =
1051 dyn_cast<ClassTemplatePartialSpecializationDecl *>(Pattern))
1052 return CTPSD->getSourceRange();
1053 return cast<ClassTemplateDecl *>(Pattern)->getSourceRange();
1075 llvm_unreachable(
"unhandled template specialization kind");
1079 auto *Info = dyn_cast_if_present<ExplicitInstantiationInfo *>(ExplicitInfo);
1086 ExplicitInfo = Info;
1088 Info->ExternKeywordLoc =
Loc;
1093 auto *Info = dyn_cast_if_present<ExplicitInstantiationInfo *>(ExplicitInfo);
1100 ExplicitInfo = Info;
1102 Info->TemplateKeywordLoc =
Loc;
1111 Expr *ConstraintExpr) {
1130ImplicitConceptSpecializationDecl::ImplicitConceptSpecializationDecl(
1133 :
Decl(ImplicitConceptSpecialization, DC, SL),
1134 NumTemplateArgs(ConvertedArgs.size()) {
1135 setTemplateArguments(ConvertedArgs);
1138ImplicitConceptSpecializationDecl::ImplicitConceptSpecializationDecl(
1139 EmptyShell
Empty,
unsigned NumTemplateArgs)
1140 :
Decl(ImplicitConceptSpecialization,
Empty),
1141 NumTemplateArgs(NumTemplateArgs) {}
1147 additionalSizeToAlloc<TemplateArgument>(ConvertedArgs.size()))
1154 return new (
C, ID, additionalSizeToAlloc<TemplateArgument>(NumTemplateArgs))
1160 assert(Converted.size() == NumTemplateArgs);
1161 llvm::uninitialized_copy(Converted, getTrailingObjects());
1167void ClassTemplatePartialSpecializationDecl::anchor() {}
1169ClassTemplatePartialSpecializationDecl::ClassTemplatePartialSpecializationDecl(
1176 Context, ClassTemplatePartialSpecialization, TK, DC, StartLoc, IdLoc,
1179 SpecializedTemplate, Args,
false, PrevDecl),
1180 TemplateParams(Params), InstantiatedFromMember(nullptr,
false),
1181 CanonInjectedTST(CanonInjectedTST) {
1194 Context, TK, DC, StartLoc, IdLoc, Params, SpecializedTemplate, Args,
1195 CanonInjectedTST, PrevDecl);
1209 if (CanonInjectedTST.
isNull()) {
1215 return CanonInjectedTST;
1222 return MT->getSourceRange();
1234void FriendTemplateDecl::anchor() {}
1242 if (!Params.empty()) {
1244 llvm::copy(Params, TPL);
1246 return new (Context, DC)
1278 auto *CommonPtr =
new (
C)
Common;
1279 C.addDestruction(CommonPtr);
1315 bool OnlyPartial )
const {
1319llvm::FoldingSetVector<VarTemplateSpecializationDecl> &
1325llvm::FoldingSetVector<VarTemplatePartialSpecializationDecl> &
1333 auto *CommonPtr =
new (
C)
Common;
1334 C.addDestruction(CommonPtr);
1361 ID.AddInteger(TemplateArgs.size());
1375 assert(Existing->
isCanonicalDecl() &&
"Non-canonical specialization?");
1379 L->AddedCXXTemplateSpecialization(
this,
D);
1384 llvm::FoldingSetVector<VarTemplatePartialSpecializationDecl> &PartialSpecs =
1387 PS.reserve(PartialSpecs.size());
1389 PS.push_back(
P.getMostRecentDecl());
1397 if (
P.getInstantiatedFromMember()->getCanonicalDecl() == DCanon)
1398 return P.getMostRecentDecl();
1412 :
VarDecl(DK, Context, DC, StartLoc, IdLoc,
1414 SpecializedTemplate(SpecializedTemplate),
1429 VarTemplateSpecialization, Context, DC, StartLoc, IdLoc,
1430 SpecializedTemplate,
T, TInfo, S, Args);
1444 const auto *PS = dyn_cast<VarTemplatePartialSpecializationDecl>(
this);
1446 PS ? PS->getTemplateArgsAsWritten() :
nullptr) {
1448 OS, ArgsAsWritten->arguments(), Policy,
1453 OS, TemplateArgs.
asArray(), Policy,
1459 if (
const auto *PartialSpec =
1460 SpecializedTemplate.dyn_cast<SpecializedPartialSpecialization *>())
1461 return PartialSpec->PartialSpecialization->getSpecializedTemplate();
1462 return cast<VarTemplateDecl *>(SpecializedTemplate);
1472 assert(!Pattern.isNull() &&
1473 "Variable template specialization without pattern?");
1474 if (
const auto *VTPSD =
1475 dyn_cast<VarTemplatePartialSpecializationDecl *>(Pattern))
1476 return VTPSD->getSourceRange();
1504 llvm_unreachable(
"unhandled template specialization kind");
1508 auto *Info = dyn_cast_if_present<ExplicitInstantiationInfo *>(ExplicitInfo);
1515 ExplicitInfo = Info;
1517 Info->ExternKeywordLoc =
Loc;
1521 auto *Info = dyn_cast_if_present<ExplicitInstantiationInfo *>(ExplicitInfo);
1528 ExplicitInfo = Info;
1530 Info->TemplateKeywordLoc =
Loc;
1537void VarTemplatePartialSpecializationDecl::anchor() {}
1539VarTemplatePartialSpecializationDecl::VarTemplatePartialSpecializationDecl(
1545 DC, StartLoc, IdLoc, SpecializedTemplate,
T,
1547 TemplateParams(Params), InstantiatedFromMember(nullptr,
false) {
1559 Context, DC, StartLoc, IdLoc, Params, SpecializedTemplate,
T, TInfo, S,
1575 return MT->getSourceRange();
1586#define CREATE_BUILTIN_TEMPLATE_PARAMETER_LIST
1587#include "clang/Basic/BuiltinTemplates.inc"
1590 llvm_unreachable(
"unhandled BuiltinTemplateKind!");
1593void BuiltinTemplateDecl::anchor() {}
1607 auto *
T = dyn_cast_or_null<BuiltinTemplateDecl>(
1609 return T &&
T->isPackProducingBuiltinTemplate();
1617 C.addDestruction(&TPOD->Value);
1624 C.addDestruction(&TPOD->Value);
1630 OS <<
"<template param ";
1656 case Decl::Kind::CXXRecord:
1657 return cast<CXXRecordDecl>(
D)
1658 ->getDescribedTemplate()
1659 ->getTemplateParameters();
1660 case Decl::Kind::ClassTemplate:
1661 return cast<ClassTemplateDecl>(
D)->getTemplateParameters();
1662 case Decl::Kind::ClassTemplateSpecialization: {
1663 const auto *CTSD = cast<ClassTemplateSpecializationDecl>(
D);
1664 auto P = CTSD->getSpecializedTemplateOrPartial();
1665 if (
const auto *CTPSD =
1666 dyn_cast<ClassTemplatePartialSpecializationDecl *>(
P))
1667 return CTPSD->getTemplateParameters();
1668 return cast<ClassTemplateDecl *>(
P)->getTemplateParameters();
1670 case Decl::Kind::ClassTemplatePartialSpecialization:
1671 return cast<ClassTemplatePartialSpecializationDecl>(
D)
1672 ->getTemplateParameters();
1673 case Decl::Kind::TypeAliasTemplate:
1674 return cast<TypeAliasTemplateDecl>(
D)->getTemplateParameters();
1675 case Decl::Kind::BuiltinTemplate:
1676 return cast<BuiltinTemplateDecl>(
D)->getTemplateParameters();
1677 case Decl::Kind::CXXDeductionGuide:
1678 case Decl::Kind::CXXConversion:
1679 case Decl::Kind::CXXConstructor:
1680 case Decl::Kind::CXXDestructor:
1681 case Decl::Kind::CXXMethod:
1682 case Decl::Kind::Function:
1683 return cast<FunctionDecl>(
D)
1684 ->getTemplateSpecializationInfo()
1686 ->getTemplateParameters();
1687 case Decl::Kind::FunctionTemplate:
1688 return cast<FunctionTemplateDecl>(
D)->getTemplateParameters();
1689 case Decl::Kind::VarTemplate:
1690 return cast<VarTemplateDecl>(
D)->getTemplateParameters();
1691 case Decl::Kind::VarTemplateSpecialization: {
1692 const auto *VTSD = cast<VarTemplateSpecializationDecl>(
D);
1693 auto P = VTSD->getSpecializedTemplateOrPartial();
1694 if (
const auto *VTPSD = dyn_cast<VarTemplatePartialSpecializationDecl *>(
P))
1695 return VTPSD->getTemplateParameters();
1696 return cast<VarTemplateDecl *>(
P)->getTemplateParameters();
1698 case Decl::Kind::VarTemplatePartialSpecialization:
1699 return cast<VarTemplatePartialSpecializationDecl>(
D)
1700 ->getTemplateParameters();
1701 case Decl::Kind::TemplateTemplateParm:
1702 return cast<TemplateTemplateParmDecl>(
D)->getTemplateParameters();
1703 case Decl::Kind::Concept:
1704 return cast<ConceptDecl>(
D)->getTemplateParameters();
1706 llvm_unreachable(
"Unhandled templated declaration kind");
Defines the clang::ASTContext interface.
#define BuiltinTemplate(BTName)
Defines enum values for all the target-independent builtin functions.
Defines the C++ Decl subclasses, other than those for templates (found in DeclTemplate....
static bool DefaultTemplateArgumentContainsUnexpandedPack(const TemplateParam &P)
static bool AdoptTemplateParameterList(TemplateParameterList *Params, DeclContext *Owner)
static TemplateParameterList * createBuiltinTemplateParameterList(const ASTContext &C, DeclContext *DC, BuiltinTemplateKind BTK)
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 ...
bool hasSameType(QualType T1, QualType T2) const
Determine whether the given types T1 and T2 are equivalent.
QualType getCanonicalTemplateSpecializationType(TemplateName T, ArrayRef< TemplateArgument > CanonicalArgs) const
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.
bool canonicalizeTemplateArguments(MutableArrayRef< TemplateArgument > Args) const
Canonicalize the given template argument list.
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
BuiltinTemplateKind getBuiltinTemplateKind() const
bool isPackProducingBuiltinTemplate() const
Represents a C++ struct/union/class.
CXXRecordDecl * getCanonicalDecl() override
Retrieves the "canonical" declaration of the given declaration.
static CanQual< Type > CreateUnsafe(QualType Other)
Builds a canonical type from a QualType.
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.
ClassTemplateDecl * getCanonicalDecl() override
Retrieves the canonical declaration of this template.
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.
CanQualType getCanonicalInjectedSpecializationType(const ASTContext &Ctx) const
Retrieve the canonical template specialization type of the injected-class-name for this class templat...
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...
CanQualType getCanonicalInjectedSpecializationType(const ASTContext &Ctx) const
Retrieves the canonical injected specialization type for this partial specialization.
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 * Create(ASTContext &Context, TagKind TK, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, TemplateParameterList *Params, ClassTemplateDecl *SpecializedTemplate, ArrayRef< TemplateArgument > Args, CanQualType CanonInjectedTST, ClassTemplatePartialSpecializationDecl *PrevDecl)
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.
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.
static ClassTemplateSpecializationDecl * Create(ASTContext &Context, TagKind TK, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, ClassTemplateDecl *SpecializedTemplate, ArrayRef< TemplateArgument > Args, bool StrictPackMatch, ClassTemplateSpecializationDecl *PrevDecl)
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.
ClassTemplateSpecializationDecl(ASTContext &Context, Kind DK, TagKind TK, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, ClassTemplateDecl *SpecializedTemplate, ArrayRef< TemplateArgument > Args, bool StrictPackMatch, ClassTemplateSpecializationDecl *PrevDecl)
void setTemplateKeywordLoc(SourceLocation Loc)
Sets the location of the template keyword.
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.
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.
void loadLazySpecializationsImpl(bool OnlyPartial=false) const
CommonBase * getCommonPtr() const
Retrieves the "common" pointer shared by all (re-)declarations of the same template.
CommonBase * Common
Pointer to the common data shared by all declarations of this template.
SpecEntryTraits< EntryType >::DeclType * findSpecializationImpl(llvm::FoldingSetVector< EntryType > &Specs, void *&InsertPos, ProfileArguments... ProfileArgs)
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)
SpecEntryTraits< EntryType >::DeclType * findSpecializationLocally(llvm::FoldingSetVector< EntryType > &Specs, void *&InsertPos, ProfileArguments... ProfileArgs)
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
void getAssociatedConstraints(llvm::SmallVectorImpl< AssociatedConstraint > &AC) const
Get the total constraint-expression associated with this template, including constraint-expressions d...
bool hasAssociatedConstraints() const
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, NamedDecl *Decl)
TemplateParameterList * getTemplateParameters() const
Get the list of template parameters.
Represents a C++ template name within the type system.
TemplateDecl * getAsTemplateDecl(bool IgnoreDeduced=false) const
Retrieve the underlying template declaration that this template name refers to, if known.
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< 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
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)
static TemplateTemplateParmDecl * Create(const ASTContext &C, DeclContext *DC, SourceLocation L, unsigned D, unsigned P, bool ParameterPack, IdentifierInfo *Id, TemplateNameKind ParameterKind, bool Typename, TemplateParameterList *Params)
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...
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.
void setTypeConstraint(ConceptReference *CR, Expr *ImmediatelyDeclaredConstraint, UnsignedOrNone ArgPackSubstIndex)
static TemplateTypeParmDecl * CreateDeserialized(const ASTContext &C, GlobalDeclID ID)
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.
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, UnsignedOrNone NumExpanded=std::nullopt)
unsigned getDepth() const
Retrieve the depth of the template parameter.
SourceRange getSourceRange() const override LLVM_READONLY
Source range that this declaration covers.
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.
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.
bool isPackProducingBuiltinTemplateName(TemplateName N)
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)
@ Result
The result type of a method or function.
@ Template
We are parsing a template declaration.
TagTypeKind
The kind of a tag type.
BuiltinTemplateKind
Kinds of BuiltinTemplateDecl.
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.
TemplateParameterList * getReplacedTemplateParameterList(const Decl *D)
Internal helper used by Subst* nodes to retrieve the parameter list for their AssociatedDecl.
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.
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.
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 ...