23 #include "llvm/ADT/STLExtras.h"
25 using namespace clang;
35 : TemplateLoc(TemplateLoc), LAngleLoc(LAngleLoc), RAngleLoc(RAngleLoc),
36 NumParams(Params.size()), ContainsUnexpandedParameterPack(
false) {
37 assert(this->NumParams == NumParams &&
"Too many template parameters");
38 for (
unsigned Idx = 0; Idx < NumParams; ++Idx) {
42 if (!P->isTemplateParameterPack()) {
44 if (NTTP->getType()->containsUnexpandedParameterPack())
45 ContainsUnexpandedParameterPack =
true;
48 if (TTP->getTemplateParameters()->containsUnexpandedParameterPack())
49 ContainsUnexpandedParameterPack =
true;
60 void *Mem = C.
Allocate(totalSizeToAlloc<NamedDecl *>(Params.size()),
61 llvm::alignOf<TemplateParameterList>());
67 unsigned NumRequiredArgs = 0;
69 if (
P->isTemplateParameterPack()) {
70 if (
const auto *NTTP = dyn_cast<NonTypeTemplateParmDecl>(
P))
71 if (NTTP->isExpandedParameterPack()) {
72 NumRequiredArgs += NTTP->getNumExpansionTypes();
79 if (
const auto *TTP = dyn_cast<TemplateTypeParmDecl>(
P)) {
80 if (TTP->hasDefaultArgument())
82 }
else if (
const auto *NTTP = dyn_cast<NonTypeTemplateParmDecl>(
P)) {
83 if (NTTP->hasDefaultArgument())
85 }
else if (cast<TemplateTemplateParmDecl>(
P)->hasDefaultArgument())
91 return NumRequiredArgs;
100 = dyn_cast<TemplateTypeParmDecl>(FirstParm))
101 return TTP->getDepth();
103 = dyn_cast<NonTypeTemplateParmDecl>(FirstParm))
104 return NTTP->getDepth();
106 return cast<TemplateTemplateParmDecl>(FirstParm)->
getDepth();
112 P->setDeclContext(Owner);
114 if (
auto *TTP = dyn_cast<TemplateTemplateParmDecl>(
P))
121 return new (C)
char[
sizeof(
void*) * 2];
143 PrevDecls.push_back(Prev);
161 template<
class EntryType>
167 llvm::FoldingSetNodeID
ID;
169 EntryType *Entry = Specs.FindNodeOrInsertPos(ID, InsertPos);
170 return Entry ? SETraits::getDecl(Entry)->getMostRecentDecl() :
nullptr;
173 template<
class Derived,
class EntryType>
175 llvm::FoldingSetVector<EntryType> &Specializations, EntryType *Entry,
180 void *CorrectInsertPos;
182 SETraits::getTemplateArgs(Entry),
184 InsertPos == CorrectInsertPos &&
185 "given incorrect InsertPos for specialization");
187 Specializations.InsertNode(Entry, InsertPos);
189 EntryType *Existing = Specializations.GetOrInsertNode(Entry);
191 assert(SETraits::getDecl(Existing)->isCanonicalDecl() &&
192 "non-canonical specialization?");
196 L->AddedCXXTemplateSpecialization(cast<Derived>(
this),
197 SETraits::getDecl(Entry));
207 if (
auto *TTP = dyn_cast<TemplateTypeParmDecl>(Param)) {
209 if (TTP->isParameterPack())
213 }
else if (
auto *NTTP = dyn_cast<NonTypeTemplateParmDecl>(Param)) {
215 NTTP->getType().getNonLValueExprType(Context),
217 NTTP->getLocation());
219 if (NTTP->isParameterPack())
221 NTTP->getLocation(),
None);
224 auto *TTP = cast<TemplateTemplateParmDecl>(Param);
225 if (TTP->isParameterPack())
231 if (Param->isTemplateParameterPack())
242 void FunctionTemplateDecl::DeallocateCommon(
void *Ptr) {
279 for (uint32_t
I = 0, N = *Specs++;
I != N; ++
I)
284 llvm::FoldingSetVector<FunctionTemplateSpecializationInfo> &
319 void ClassTemplateDecl::DeallocateCommon(
void *Ptr) {
353 for (uint32_t
I = 0, N = *Specs++;
I != N; ++
I)
358 llvm::FoldingSetVector<ClassTemplateSpecializationDecl> &
364 llvm::FoldingSetVector<ClassTemplatePartialSpecializationDecl> &
403 assert(Existing->isCanonicalDecl() &&
"Non-canonical specialization?");
407 L->AddedCXXTemplateSpecialization(
this, D);
412 llvm::FoldingSetVector<ClassTemplatePartialSpecializationDecl> &PartialSpecs
415 PS.reserve(PartialSpecs.size());
417 PS.push_back(
P.getMostRecentDecl());
425 if (Context.
hasSameType(
P.getInjectedSpecializationType(), T))
426 return P.getMostRecentDecl();
437 if (
P.getInstantiatedFromMember()->getCanonicalDecl() == DCanon)
438 return P.getMostRecentDecl();
460 TemplateArgs.resize(Params->
size());
476 bool Typename,
bool ParameterPack) {
520 NonTypeTemplateParmDecl::NonTypeTemplateParmDecl(
524 :
DeclaratorDecl(NonTypeTemplateParm, DC, IdLoc, Id, T, TInfo, StartLoc),
526 ExpandedParameterPack(
true), NumExpandedTypes(ExpandedTypes.size()) {
527 if (!ExpandedTypes.empty() && !ExpandedTInfos.empty()) {
529 getTrailingObjects<std::pair<QualType, TypeSourceInfo *>>();
530 for (
unsigned I = 0;
I != NumExpandedTypes; ++
I) {
531 new (&TypesAndInfos[
I].first)
QualType(ExpandedTypes[
I]);
532 TypesAndInfos[
I].second = ExpandedTInfos[
I];
544 T, ParameterPack, TInfo);
553 additionalSizeToAlloc<std::pair<QualType, TypeSourceInfo *>>(
554 ExpandedTypes.size()))
556 ExpandedTypes, ExpandedTInfos);
568 unsigned NumExpandedTypes) {
570 new (C,
ID, additionalSizeToAlloc<std::pair<QualType, TypeSourceInfo *>>(
575 NTTP->NumExpandedTypes = NumExpandedTypes;
596 void TemplateTemplateParmDecl::anchor() { }
598 TemplateTemplateParmDecl::TemplateTemplateParmDecl(
601 ArrayRef<TemplateParameterList *> Expansions)
602 :
TemplateDecl(TemplateTemplateParm, DC, L, Id, Params),
604 ExpandedParameterPack(
true), NumExpandedParams(Expansions.size()) {
605 if (!Expansions.empty())
606 std::uninitialized_copy(Expansions.begin(), Expansions.end(),
607 getTrailingObjects<TemplateParameterList *>());
626 additionalSizeToAlloc<TemplateParameterList *>(Expansions.size()))
633 false,
nullptr,
nullptr);
638 unsigned NumExpansions) {
640 new (C,
ID, additionalSizeToAlloc<TemplateParameterList *>(NumExpansions))
643 TTP->NumExpandedParams = NumExpansions;
655 DefaultArgument.
set(
nullptr);
665 NumArguments(Args.size()) {
666 std::uninitialized_copy(Args.begin(), Args.end(),
667 getTrailingObjects<TemplateArgument>());
673 void *Mem = Context.
Allocate(totalSizeToAlloc<TemplateArgument>(Args.size()));
685 if (TemplateArgsAsWritten)
687 *TemplateArgsAsWritten);
699 void TemplateDecl::anchor() { }
714 SpecializedTemplate(SpecializedTemplate),
715 ExplicitInfo(nullptr),
736 Context, ClassTemplateSpecialization, TK, DC, StartLoc, IdLoc,
737 SpecializedTemplate, Args, PrevDecl);
754 raw_ostream &OS,
const PrintingPolicy &Policy,
bool Qualified)
const {
759 OS, TemplateArgs.
asArray(), Policy);
764 if (SpecializedPartialSpecialization *PartialSpec
765 = SpecializedTemplate.dyn_cast<SpecializedPartialSpecialization*>())
766 return PartialSpec->PartialSpecialization->getSpecializedTemplate();
790 CTPSDecl *ctpsd =
const_cast<CTPSDecl*
>(cast<CTPSDecl>(
this));
792 assert(inst_from !=
nullptr);
793 return inst_from->getSourceRange();
800 if (inst_from.isNull())
802 if (ClassTemplateDecl *ctd = inst_from.dyn_cast<ClassTemplateDecl*>())
803 return ctd->getSourceRange();
812 void ClassTemplatePartialSpecializationDecl::anchor() { }
814 ClassTemplatePartialSpecializationDecl::
821 ArrayRef<TemplateArgument> Args,
825 ClassTemplatePartialSpecialization,
826 TK, DC, StartLoc, IdLoc,
829 TemplateParams(Params), ArgsAsWritten(ArgInfos),
830 InstantiatedFromMember(nullptr,
false)
850 Params, SpecializedTemplate, Args,
851 ASTArgInfos, PrevDecl);
872 void FriendTemplateDecl::anchor() { }
907 void TypeAliasTemplateDecl::DeallocateCommon(
void *Ptr) {
921 void ClassScopeFunctionSpecializationDecl::anchor() { }
934 void VarTemplateDecl::DeallocateCommon(
void *Ptr) {
973 for (uint32_t
I = 0, N = *Specs++;
I != N; ++
I)
978 llvm::FoldingSetVector<VarTemplateSpecializationDecl> &
984 llvm::FoldingSetVector<VarTemplatePartialSpecializationDecl> &
1022 assert(Existing->isCanonicalDecl() &&
"Non-canonical specialization?");
1026 L->AddedCXXTemplateSpecialization(
this, D);
1031 llvm::FoldingSetVector<VarTemplatePartialSpecializationDecl> &PartialSpecs =
1034 PS.reserve(PartialSpecs.size());
1036 PS.push_back(P.getMostRecentDecl());
1044 if (P.getInstantiatedFromMember()->getCanonicalDecl() == DCanon)
1045 return P.getMostRecentDecl();
1058 :
VarDecl(DK, Context, DC, StartLoc, IdLoc,
1060 SpecializedTemplate(SpecializedTemplate), ExplicitInfo(nullptr),
1075 VarTemplateSpecialization, Context, DC, StartLoc, IdLoc,
1076 SpecializedTemplate, T, TInfo, S, Args);
1086 raw_ostream &OS,
const PrintingPolicy &Policy,
bool Qualified)
const {
1091 OS, TemplateArgs.
asArray(), Policy);
1095 if (SpecializedPartialSpecialization *PartialSpec =
1096 SpecializedTemplate.dyn_cast<SpecializedPartialSpecialization *>())
1097 return PartialSpec->PartialSpecialization->getSpecializedTemplate();
1112 void VarTemplatePartialSpecializationDecl::anchor() {}
1114 VarTemplatePartialSpecializationDecl::VarTemplatePartialSpecializationDecl(
1121 DC, StartLoc, IdLoc, SpecializedTemplate, T,
1123 TemplateParams(Params), ArgsAsWritten(ArgInfos),
1124 InstantiatedFromMember(nullptr,
false) {
1141 Context, DC, StartLoc, IdLoc, Params, SpecializedTemplate, T, TInfo,
1142 S, Args, ASTArgInfos);
1158 nullptr,
true,
false);
1159 T->setImplicit(
true);
1166 nullptr, TI->
getType(),
true, TI);
1167 N->setImplicit(
true);
1177 false,
nullptr, TPL);
1178 TemplateTemplateParm->setImplicit(
true);
1183 nullptr,
true,
false);
1184 TemplateTypeParm->setImplicit(
true);
1188 QualType(TemplateTypeParm->getTypeForDecl(), 0));
1191 nullptr, TInfo->
getType(),
false, TInfo);
1192 NamedDecl *Params[] = {TemplateTemplateParm, TemplateTypeParm,
1193 NonTypeTemplateParm};
1206 nullptr, TInfo->
getType(),
false, TInfo);
1211 nullptr,
true,
true);
1212 Ts->setImplicit(
true);
1217 llvm::makeArrayRef(Params),
1230 llvm_unreachable(
"unhandled BuiltinTemplateKind!");
1233 void BuiltinTemplateDecl::anchor() {}
Defines the clang::ASTContext interface.
SourceLocation getEnd() const
FunctionDecl - An instance of this class is created to represent a function declaration or definition...
llvm::PointerUnion< ClassTemplateDecl *, ClassTemplatePartialSpecializationDecl * > getInstantiatedFrom() const
If this class template specialization is an instantiation of a template (rather than an explicit spec...
SourceLocation getDefaultArgumentLoc() const
Retrieves the location of the default argument declaration.
A (possibly-)qualified type.
virtual Decl * GetExternalDecl(uint32_t ID)
Resolve a declaration ID into a declaration, potentially building a new declaration.
SourceLocation getExternLoc() const
Gets the location of the extern keyword, if present.
SourceLocation getTemplateKeywordLoc() const
Gets the location of the template keyword, if present.
static TypeAliasTemplateDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation L, DeclarationName Name, TemplateParameterList *Params, NamedDecl *Decl)
Create a function template node.
FunctionDecl * findSpecialization(ArrayRef< TemplateArgument > Args, void *&InsertPos)
Return the specialization with the provided arguments if it exists, otherwise return the insertion po...
llvm::FoldingSetVector< VarTemplateSpecializationDecl > & getSpecializations() const
Retrieve the set of specializations of this variable template.
bool isParameterPack() const
Returns whether this is a parameter pack.
void setPreviousDecl(decl_type *PrevDecl)
Set the previous declaration.
ArrayRef< TemplateArgument > getInjectedTemplateArgs()
Retrieve the "injected" template arguments that correspond to the template parameters of this functio...
ClassTemplateSpecializationDecl * findSpecialization(ArrayRef< TemplateArgument > Args, void *&InsertPos)
Return the specialization with the provided arguments if it exists, otherwise return the insertion po...
CanQualType getSizeType() const
Return the unique type for "size_t" (C99 7.17), defined in <stddef.h>.
static TemplateTemplateParmDecl * Create(const ASTContext &C, DeclContext *DC, SourceLocation L, unsigned D, unsigned P, bool ParameterPack, IdentifierInfo *Id, TemplateParameterList *Params)
ArrayRef< NamedDecl * > asArray()
void setDefaultArgument(const ASTContext &C, const TemplateArgumentLoc &DefArg)
Set the default argument for this template parameter, and whether that default argument was inherited...
Defines the C++ template declaration subclasses.
Declaration of a variable template.
static ExprValueKind getValueKindForType(QualType T)
getValueKindForType - Given a formal return or parameter type, give its value kind.
void setSpecializationKind(TemplateSpecializationKind TSK)
NamedDecl * getParam(unsigned Idx)
A container of type source information.
void setTemplateArgsInfo(const TemplateArgumentListInfo &ArgsInfo)
VarTemplateDecl * getSpecializedTemplate() const
Retrieve the template that this specialization specializes.
void setRAngleLoc(SourceLocation Loc)
VarDecl - An instance of this class is created to represent a variable declaration or definition...
Declaration of a redeclarable template.
llvm::FoldingSetVector< FunctionTemplateSpecializationInfo > & getSpecializations() const
Retrieve the set of function template specializations of this function template.
Represents a variable template specialization, which refers to a variable template with a given set o...
Represents an explicit template argument list in C++, e.g., the "<int>" in "sort<int>".
Stores a list of template parameters for a TemplateDecl and its derived classes.
Describes how types, statements, expressions, and declarations should be printed. ...
SourceRange getSourceRange() const override LLVM_READONLY
Defines the clang::Expr interface and subclasses for C++ expressions.
SourceRange getSourceRange() const override LLVM_READONLY
One of these records is kept for each identifier that is lexed.
Represents a class template specialization, which refers to a class template with a given set of temp...
VarTemplateSpecializationDecl(Kind DK, ASTContext &Context, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, VarTemplateDecl *SpecializedTemplate, QualType T, TypeSourceInfo *TInfo, StorageClass S, ArrayRef< TemplateArgument > Args)
class LLVM_ALIGNAS(8) DependentTemplateSpecializationType const IdentifierInfo * Name
Represents a template specialization type whose template cannot be resolved, e.g. ...
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Defines the position of a template parameter within a template parameter list.
Common * getCommonPtr() const
VarTemplatePartialSpecializationDecl * findPartialSpecialization(ArrayRef< TemplateArgument > Args, void *&InsertPos)
Return the partial specialization with the provided arguments if it exists, otherwise return the inse...
void * allocateDefaultArgStorageChain(const ASTContext &C)
SourceLocation getLocation() const
Fetches the primary location of the argument.
void LoadLazySpecializations() const
Load any lazily-loaded specializations from the external source.
static TemplateArgumentList * CreateCopy(ASTContext &Context, ArrayRef< TemplateArgument > Args)
Create a new template argument list that copies the given set of template arguments.
bool hasSameType(QualType T1, QualType T2) const
Determine whether the given types T1 and T2 are equivalent.
Declaration of a function specialization at template class scope.
QualType getTypeDeclType(const TypeDecl *Decl, const TypeDecl *PrevDecl=nullptr) const
Return the unique reference to the type for the specified type declaration.
TypeAliasTemplateDecl(ASTContext &C, DeclContext *DC, SourceLocation L, DeclarationName Name, TemplateParameterList *Params, NamedDecl *Decl)
virtual void getNameForDiagnostic(raw_ostream &OS, const PrintingPolicy &Policy, bool Qualified) const
getNameForDiagnostic - Appends a human-readable name for this declaration into the given stream...
Provides information about a function template specialization, which is a FunctionDecl that has been ...
SourceLocation getBeginLoc() const
Get the begin source location.
bool hasDefaultArgument() const
Determine whether this template parameter has a default argument.
void set(ArgType Arg)
Set the default argument.
A convenient class for passing around template argument information.
llvm::FoldingSetVector< ClassTemplateSpecializationDecl > & getSpecializations() const
Retrieve the set of specializations of this class template.
uint32_t * LazySpecializations
If non-null, points to an array of specializations (including partial specializations) known ownly by...
bool hasDefaultArgument() const
Determine whether this template parameter has a default argument.
static TemplateParameterList * createTypePackElementParameterList(const ASTContext &C, DeclContext *DC)
static ClassTemplateSpecializationDecl * CreateDeserialized(ASTContext &C, unsigned ID)
static TemplateTypeParmDecl * Create(const ASTContext &C, DeclContext *DC, SourceLocation KeyLoc, SourceLocation NameLoc, unsigned D, unsigned P, IdentifierInfo *Id, bool Typename, bool ParameterPack)
SourceRange getSourceRange() const override LLVM_READONLY
void setSpecializationKind(TemplateSpecializationKind TSK)
static TemplateArgument CreatePackCopy(ASTContext &Context, ArrayRef< TemplateArgument > Args)
Create a new template argument pack by copying the given set of template arguments.
CXXRecordDecl * getCanonicalDecl() override
SourceLocation getRAngleLoc() const
SourceRange getSourceRange() const override LLVM_READONLY
TemplateSpecializationKind getSpecializationKind() const
Determine the kind of specialization that this declaration represents.
static FunctionTemplateSpecializationInfo * Create(ASTContext &C, FunctionDecl *FD, FunctionTemplateDecl *Template, TemplateSpecializationKind TSK, const TemplateArgumentList *TemplateArgs, const TemplateArgumentListInfo *TemplateArgsAsWritten, SourceLocation POI)
static FunctionTemplateDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation L, DeclarationName Name, TemplateParameterList *Params, NamedDecl *Decl)
Create a function template node.
detail::InMemoryDirectory::const_iterator I
void AddPartialSpecialization(ClassTemplatePartialSpecializationDecl *D, void *InsertPos)
Insert the specified partial specialization knowing that it is not already in.
QualType getInjectedClassNameType(CXXRecordDecl *Decl, QualType TST) const
getInjectedClassNameType - Return the unique reference to the injected class name type for the specif...
ClassTemplateDecl(ASTContext &C, DeclContext *DC, SourceLocation L, DeclarationName Name, TemplateParameterList *Params, NamedDecl *Decl)
TypeSourceInfo * getTypeAsWritten() const
Gets the type of this specialization as it was written by the user, if it was so written.
llvm::FoldingSetVector< FunctionTemplateSpecializationInfo > Specializations
The function template specializations for this function template, including explicit specializations ...
SpecEntryTraits< EntryType >::DeclType * findSpecializationImpl(llvm::FoldingSetVector< EntryType > &Specs, ArrayRef< TemplateArgument > Args, void *&InsertPos)
static TemplateTypeParmDecl * CreateDeserialized(const ASTContext &C, unsigned ID)
void AddSpecialization(VarTemplateSpecializationDecl *D, void *InsertPos)
Insert the specified specialization knowing that it is not already in.
SourceLocation getLocStart() const LLVM_READONLY
Represents a ValueDecl that came out of a declarator.
ArrayRef< TemplateArgument > asArray() const
Produce this as an array ref.
llvm::FoldingSetVector< ClassTemplatePartialSpecializationDecl > PartialSpecializations
The class template partial specializations for this class template.
void AddPartialSpecialization(VarTemplatePartialSpecializationDecl *D, void *InsertPos)
Insert the specified partial specialization knowing that it is not already in.
bool hasDefaultArgument() const
Determine whether this template parameter has a default argument.
const Type * getTypeForDecl() const
Expr - This represents one expression.
static ClassTemplatePartialSpecializationDecl * Create(ASTContext &Context, TagKind TK, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, TemplateParameterList *Params, ClassTemplateDecl *SpecializedTemplate, ArrayRef< TemplateArgument > Args, const TemplateArgumentListInfo &ArgInfos, QualType CanonInjectedType, ClassTemplatePartialSpecializationDecl *PrevDecl)
llvm::FoldingSetVector< VarTemplatePartialSpecializationDecl > PartialSpecializations
The variable template partial specializations for this variable template.
bool defaultArgumentWasInherited() const
Determines whether the default argument was inherited from a previous declaration of this template...
Declaration of a template type parameter.
static ClassTemplateDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation L, DeclarationName Name, TemplateParameterList *Params, NamedDecl *Decl, ClassTemplateDecl *PrevDecl)
Create a class template node.
bool defaultArgumentWasInherited() const
Determines whether the default argument was inherited from a previous declaration of this template...
Data that is common to all of the declarations of a given variable template.
An abstract interface that should be implemented by listeners that want to be notified when an AST en...
CommonBase * getCommonPtr() const
Retrieves the "common" pointer shared by all (re-)declarations of the same template.
NonTypeTemplateParmDecl - Declares a non-type template parameter, e.g., "Size" in.
Represents a C++ template name within the type system.
Defines the clang::TypeLoc interface and its subclasses.
Defines the clang::IdentifierInfo, clang::IdentifierTable, and clang::Selector interfaces.
StorageClass
Storage classes.
Declaration of an alias template.
llvm::FoldingSetVector< ClassTemplatePartialSpecializationDecl > & getPartialSpecializations()
Retrieve the set of partial specializations of this class template.
TemplateTemplateParmDecl - Declares a template template parameter, e.g., "T" in.
ClassTemplateDecl * getSpecializedTemplate() const
Retrieve the template that this specialization specializes.
static TemplateParameterList * createBuiltinTemplateParameterList(const ASTContext &C, DeclContext *DC, BuiltinTemplateKind BTK)
const TemplateArgumentLoc & getDefaultArgument() const
Retrieve the default argument, if any.
Data that is common to all of the declarations of a given class template.
The result type of a method or function.
VarDecl * getCanonicalDecl() override
static FriendTemplateDecl * Create(ASTContext &Context, DeclContext *DC, SourceLocation Loc, MutableArrayRef< TemplateParameterList * > Params, FriendUnion Friend, SourceLocation FriendLoc)
unsigned getDepth() const
Get the depth of this template parameter list in the set of template parameter lists.
static TypeAliasTemplateDecl * CreateDeserialized(ASTContext &C, unsigned ID)
Create an empty alias template node.
SourceLocation getEndLoc() const
Get the end source location.
static TemplateParameterList * Create(const ASTContext &C, SourceLocation TemplateLoc, SourceLocation LAngleLoc, ArrayRef< NamedDecl * > Params, SourceLocation RAngleLoc)
QualType getPackExpansionType(QualType Pattern, Optional< unsigned > NumExpansions)
void setTypeForDecl(const Type *TD)
TypeLoc getTypeLoc() const
Return the TypeLoc wrapper for the type source info.
SourceLocation getDefaultArgumentLoc() const
Retrieve the location of the default argument, if any.
RedeclarableTemplateDecl * getPreviousDecl()
Return the previous declaration of this declaration or NULL if this is the first declaration.
static ClassTemplateSpecializationDecl * Create(ASTContext &Context, TagKind TK, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, ClassTemplateDecl *SpecializedTemplate, ArrayRef< TemplateArgument > Args, ClassTemplateSpecializationDecl *PrevDecl)
TypeSourceInfo * getDefaultArgumentInfo() const
Retrieves the default argument's source information, if any.
CommonBase * newCommon(ASTContext &C) const override
ClassTemplatePartialSpecializationDecl * findPartialSpecInstantiatedFromMember(ClassTemplatePartialSpecializationDecl *D)
Find a class template partial specialization which was instantiated from the given member partial spe...
QualType InjectedClassNameType
The injected-class-name type for this class template.
void AddDeallocation(void(*Callback)(void *), void *Data)
Add a deallocation callback that will be invoked when the ASTContext is destroyed.
SourceLocation getOuterLocStart() const
getOuterLocStart - Return SourceLocation representing start of source range taking into account any o...
Encodes a location in the source.
ExternalASTSource * getExternalSource() const
Retrieve a pointer to the external AST source associated with this AST context, if any...
const Type * getTypePtr() const
Retrieves a pointer to the underlying (unqualified) type.
static TemplateTemplateParmDecl * CreateDeserialized(ASTContext &C, unsigned ID)
void LoadLazySpecializations() const
Load any lazily-loaded specializations from the external source.
This names the __make_integer_seq BuiltinTemplateDecl.
SourceRange getBraceRange() const
bool isValid() const
Return true if this is a valid SourceLocation object.
TypeSourceInfo * getTrivialTypeSourceInfo(QualType T, SourceLocation Loc=SourceLocation()) const
Allocate a TypeSourceInfo where all locations have been initialized to a given location, which defaults to the empty location.
QualType getTemplateSpecializationType(TemplateName T, ArrayRef< TemplateArgument > Args, QualType Canon=QualType()) const
CommonBase * newCommon(ASTContext &C) const override
unsigned getDepth() const
Retrieve the depth of the template parameter.
Expr * getDefaultArgument() const
Retrieve the default argument, if any.
Data that is common to all of the declarations of a given function template.
void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Ctx)
static void AdoptTemplateParameterList(TemplateParameterList *Params, DeclContext *Owner)
QualType getInjectedClassNameSpecialization()
Retrieve the template specialization type of the injected-class-name for this class template...
BuiltinTemplateKind
Kinds of BuiltinTemplateDecl.
FunctionTemplateDecl(ASTContext &C, DeclContext *DC, SourceLocation L, DeclarationName Name, TemplateParameterList *Params, NamedDecl *Decl)
CommonBase * Common
Pointer to the common data shared by all declarations of this template.
SourceLocation getLAngleLoc() const
ClassTemplateDecl * getMostRecentDecl()
This template specialization was instantiated from a template due to an explicit instantiation defini...
This template specialization was formed from a template-id but has not yet been declared, defined, or instantiated.
const IdentifierInfo * getIdentifier() const
static void PrintTemplateArgumentList(raw_ostream &OS, ArrayRef< TemplateArgument > Args, const PrintingPolicy &Policy, bool SkipBrackets=false)
Print a template argument list, including the '<' and '>' enclosing the template arguments...
static VarTemplateDecl * CreateDeserialized(ASTContext &C, unsigned ID)
Create an empty variable template node.
static TemplateParameterList * createMakeIntegerSeqParameterList(const ASTContext &C, DeclContext *DC)
void addSpecialization(FunctionTemplateSpecializationInfo *Info, void *InsertPos)
Add a specialization of this function template.
void setLAngleLoc(SourceLocation Loc)
QualType getType() const
Return the type wrapped by this type source info.
void addArgument(const TemplateArgumentLoc &Loc)
Represents a template argument.
TagTypeKind
The kind of a tag type.
static ClassScopeFunctionSpecializationDecl * CreateDeserialized(ASTContext &Context, unsigned ID)
static NonTypeTemplateParmDecl * Create(const ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, unsigned D, unsigned P, IdentifierInfo *Id, QualType T, bool ParameterPack, TypeSourceInfo *TInfo)
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
static ClassTemplateDecl * CreateDeserialized(ASTContext &C, unsigned ID)
Create an empty class template node.
The base class of all kinds of template declarations (e.g., class, function, etc.).
const TemplateArgumentList & getTemplateArgs() const
Retrieve the template arguments of the variable template specialization.
This template specialization was instantiated from a template due to an explicit instantiation declar...
static VarTemplatePartialSpecializationDecl * CreateDeserialized(ASTContext &C, unsigned ID)
DeclarationName - The name of a declaration.
Represents a C++11 pack expansion that produces a sequence of expressions.
static NonTypeTemplateParmDecl * CreateDeserialized(ASTContext &C, unsigned ID)
QualType getTemplateTypeParmType(unsigned Depth, unsigned Index, bool ParameterPack, TemplateTypeParmDecl *ParmDecl=nullptr) const
Retrieve the template type parameter type for a template parameter or parameter pack with the given d...
bool isNull() const
Determine whether this template argument has no value.
detail::InMemoryDirectory::const_iterator E
This names the __type_pack_element BuiltinTemplateDecl.
TemplateSpecializationKind
Describes the kind of template specialization that a particular template specialization declaration r...
unsigned getMinRequiredArguments() const
Returns the minimum number of arguments needed to form a template specialization. ...
static FriendTemplateDecl * CreateDeserialized(ASTContext &C, unsigned ID)
uint32_t * LazySpecializations
If non-null, points to an array of specializations (including partial specializations) known only by ...
VarTemplateSpecializationDecl * findSpecialization(ArrayRef< TemplateArgument > Args, void *&InsertPos)
Return the specialization with the provided arguments if it exists, otherwise return the insertion po...
void getNameForDiagnostic(raw_ostream &OS, const PrintingPolicy &Policy, bool Qualified) const override
getNameForDiagnostic - Appends a human-readable name for this declaration into the given stream...
void getNameForDiagnostic(raw_ostream &OS, const PrintingPolicy &Policy, bool Qualified) const override
getNameForDiagnostic - Appends a human-readable name for this declaration into the given stream...
unsigned MayHaveOutOfDateDef
Indicates whether it is possible for declarations of this kind to have an out-of-date definition...
Common * getCommonPtr() const
Location wrapper for a TemplateArgument.
const T * getAs() const
Member-template getAs<specific type>'.
bool isThisDeclarationADefinition() const
Returns whether this template declaration defines the primary variable pattern.
static ClassTemplatePartialSpecializationDecl * CreateDeserialized(ASTContext &C, unsigned ID)
This template specialization was declared or defined by an explicit specialization (C++ [temp...
static VarTemplatePartialSpecializationDecl * Create(ASTContext &Context, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, TemplateParameterList *Params, VarTemplateDecl *SpecializedTemplate, QualType T, TypeSourceInfo *TInfo, StorageClass S, ArrayRef< TemplateArgument > Args, const TemplateArgumentListInfo &ArgInfos)
ClassTemplatePartialSpecializationDecl * getInstantiatedFromMember() const
Retrieve the member class template partial specialization from which this particular class template p...
VarTemplateDecl * getPreviousDecl()
Retrieve the previous declaration of this variable template, or NULL if no such declaration exists...
static FunctionTemplateDecl * CreateDeserialized(ASTContext &C, unsigned ID)
Create an empty function template node.
llvm::ArrayRef< TemplateArgumentLoc > arguments() const
static VarTemplateSpecializationDecl * CreateDeserialized(ASTContext &C, unsigned ID)
A template argument list.
const TemplateArgumentList & getTemplateArgs() const
Retrieve the template arguments of the class template specialization.
TemplateArgument * InjectedArgs
The set of "injected" template arguments used within this function template.
Defines the C++ Decl subclasses, other than those for templates (found in DeclTemplate.h) and friends (in DeclFriend.h).
void AddSpecialization(ClassTemplateSpecializationDecl *D, void *InsertPos)
Insert the specified specialization knowing that it is not already in.
VarTemplateDecl * getMostRecentDecl()
Represents a C++ struct/union/class.
static const ASTTemplateArgumentListInfo * Create(ASTContext &C, const TemplateArgumentListInfo &List)
CommonBase * newCommon(ASTContext &C) const override
void addSpecializationImpl(llvm::FoldingSetVector< EntryType > &Specs, EntryType *Entry, void *InsertPos)
CommonBase * newCommon(ASTContext &C) const override
void * Allocate(size_t Size, unsigned Align=8) const
ClassTemplatePartialSpecializationDecl * findPartialSpecialization(ArrayRef< TemplateArgument > Args, void *&InsertPos)
Return the partial specialization with the provided arguments if it exists, otherwise return the inse...
void LoadLazySpecializations() const
Load any lazily-loaded specializations from the external source.
VarTemplateDecl(ASTContext &C, DeclContext *DC, SourceLocation L, DeclarationName Name, TemplateParameterList *Params, NamedDecl *Decl)
static VarTemplateDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation L, DeclarationName Name, TemplateParameterList *Params, VarDecl *Decl)
Create a variable template node.
Declaration of a class template.
SourceRange getSourceRange() const override LLVM_READONLY
llvm::PointerUnion< NamedDecl *, TypeSourceInfo * > FriendUnion
TemplateParameterList * getTemplateParameters() const
Get the list of template parameters.
unsigned getIndex() const
Retrieve the index of the template parameter.
uint32_t * LazySpecializations
If non-null, points to an array of specializations known only by their external declaration IDs...
VarTemplatePartialSpecializationDecl * findPartialSpecInstantiatedFromMember(VarTemplatePartialSpecializationDecl *D)
Find a variable template partial specialization which was instantiated from the given member partial ...
llvm::FoldingSetVector< VarTemplateSpecializationDecl > Specializations
The variable template specializations for this variable template, including explicit specializations ...
static void GenerateInjectedTemplateArgs(ASTContext &Context, TemplateParameterList *Params, TemplateArgument *Args)
Generate the injected template arguments for the given template parameter list, e.g., for the injected-class-name of a class template.
Common * getCommonPtr() const
llvm::FoldingSetVector< ClassTemplateSpecializationDecl > Specializations
The class template specializations for this class template, including explicit specializations and in...
virtual CommonBase * newCommon(ASTContext &C) const =0
A reference to a declared variable, function, enum, etc.
A trivial tuple used to represent a source range.
static VarTemplateSpecializationDecl * Create(ASTContext &Context, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, VarTemplateDecl *SpecializedTemplate, QualType T, TypeSourceInfo *TInfo, StorageClass S, ArrayRef< TemplateArgument > Args)
NamedDecl - This represents a decl with a name.
SourceLocation getDefaultArgumentLoc() const
Retrieve the location of the default argument, if any.
SourceRange getSourceRange() const override LLVM_READONLY
Declaration of a friend template.
bool isNull() const
Return true if this QualType doesn't point to a type yet.
TemplateParameterList(SourceLocation TemplateLoc, SourceLocation LAngleLoc, ArrayRef< NamedDecl * > Params, SourceLocation RAngleLoc)
VarTemplateDecl * getDefinition()
const TemplateArgument & getArgument() const
Defines enum values for all the target-independent builtin functions.
Declaration of a template function.
ClassTemplateSpecializationDecl(ASTContext &Context, Kind DK, TagKind TK, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, ClassTemplateDecl *SpecializedTemplate, ArrayRef< TemplateArgument > Args, ClassTemplateSpecializationDecl *PrevDecl)
llvm::FoldingSetVector< VarTemplatePartialSpecializationDecl > & getPartialSpecializations()
Retrieve the set of partial specializations of this class template.
FunctionTemplateDecl * getMostRecentDecl()