23 #include "llvm/ADT/STLExtras.h"
25 using namespace clang;
36 : TemplateLoc(TemplateLoc), LAngleLoc(LAngleLoc), RAngleLoc(RAngleLoc),
37 NumParams(Params.size()), ContainsUnexpandedParameterPack(
false),
38 HasRequiresClause(static_cast<
bool>(RequiresClause)) {
39 for (
unsigned Idx = 0; Idx < NumParams; ++Idx) {
45 if (NTTP->getType()->containsUnexpandedParameterPack())
46 ContainsUnexpandedParameterPack =
true;
49 if (TTP->getTemplateParameters()->containsUnexpandedParameterPack())
50 ContainsUnexpandedParameterPack =
true;
57 *getTrailingObjects<Expr *>() = RequiresClause;
66 void *Mem = C.
Allocate(totalSizeToAlloc<NamedDecl *, Expr *>(
67 Params.size(), RequiresClause ? 1u : 0u),
70 RAngleLoc, RequiresClause);
74 unsigned NumRequiredArgs = 0;
76 if (
P->isTemplateParameterPack()) {
77 if (
const auto *NTTP = dyn_cast<NonTypeTemplateParmDecl>(
P))
78 if (NTTP->isExpandedParameterPack()) {
79 NumRequiredArgs += NTTP->getNumExpansionTypes();
86 if (
const auto *TTP = dyn_cast<TemplateTypeParmDecl>(
P)) {
87 if (TTP->hasDefaultArgument())
89 }
else if (
const auto *NTTP = dyn_cast<NonTypeTemplateParmDecl>(
P)) {
90 if (NTTP->hasDefaultArgument())
92 }
else if (cast<TemplateTemplateParmDecl>(
P)->hasDefaultArgument())
98 return NumRequiredArgs;
107 = dyn_cast<TemplateTypeParmDecl>(FirstParm))
108 return TTP->getDepth();
110 = dyn_cast<NonTypeTemplateParmDecl>(FirstParm))
111 return NTTP->getDepth();
113 return cast<TemplateTemplateParmDecl>(FirstParm)->
getDepth();
119 P->setDeclContext(Owner);
121 if (
auto *TTP = dyn_cast<TemplateTemplateParmDecl>(
P))
128 return new (C)
char[
sizeof(
void*) * 2];
150 PrevDecls.push_back(Prev);
168 template<
class EntryType>
174 llvm::FoldingSetNodeID
ID;
176 EntryType *Entry = Specs.FindNodeOrInsertPos(ID, InsertPos);
177 return Entry ? SETraits::getDecl(Entry)->getMostRecentDecl() :
nullptr;
180 template<
class Derived,
class EntryType>
182 llvm::FoldingSetVector<EntryType> &Specializations, EntryType *Entry,
187 void *CorrectInsertPos;
189 SETraits::getTemplateArgs(Entry),
191 InsertPos == CorrectInsertPos &&
192 "given incorrect InsertPos for specialization");
194 Specializations.InsertNode(Entry, InsertPos);
196 EntryType *Existing = Specializations.GetOrInsertNode(Entry);
199 "non-canonical specialization?");
203 L->AddedCXXTemplateSpecialization(cast<Derived>(
this),
204 SETraits::getDecl(Entry));
244 for (uint32_t
I = 0, N = *Specs++;
I != N; ++
I)
249 llvm::FoldingSetVector<FunctionTemplateSpecializationInfo> &
276 std::copy(TemplateArgs.begin(), TemplateArgs.end(),
293 Expr *AssociatedConstraints) {
296 if (!AssociatedConstraints) {
323 for (uint32_t
I = 0, N = *Specs++;
I != N; ++
I)
328 llvm::FoldingSetVector<ClassTemplateSpecializationDecl> &
334 llvm::FoldingSetVector<ClassTemplatePartialSpecializationDecl> &
373 assert(Existing->
isCanonicalDecl() &&
"Non-canonical specialization?");
377 L->AddedCXXTemplateSpecialization(
this, D);
382 llvm::FoldingSetVector<ClassTemplatePartialSpecializationDecl> &
PartialSpecs
385 PS.reserve(PartialSpecs.size());
387 PS.push_back(
P.getMostRecentDecl());
395 if (Context.
hasSameType(
P.getInjectedSpecializationType(), T))
396 return P.getMostRecentDecl();
407 if (
P.getInstantiatedFromMember()->getCanonicalDecl() == DCanon)
408 return P.getMostRecentDecl();
445 bool Typename,
bool ParameterPack) {
489 NonTypeTemplateParmDecl::NonTypeTemplateParmDecl(
493 :
DeclaratorDecl(NonTypeTemplateParm, DC, IdLoc, Id, T, TInfo, StartLoc),
495 ExpandedParameterPack(
true), NumExpandedTypes(ExpandedTypes.size()) {
496 if (!ExpandedTypes.empty() && !ExpandedTInfos.empty()) {
498 getTrailingObjects<std::pair<QualType, TypeSourceInfo *>>();
499 for (
unsigned I = 0;
I != NumExpandedTypes; ++
I) {
500 new (&TypesAndInfos[
I].first)
QualType(ExpandedTypes[
I]);
501 TypesAndInfos[
I].second = ExpandedTInfos[
I];
513 T, ParameterPack, TInfo);
522 additionalSizeToAlloc<std::pair<QualType, TypeSourceInfo *>>(
523 ExpandedTypes.size()))
525 ExpandedTypes, ExpandedTInfos);
537 unsigned NumExpandedTypes) {
539 new (C,
ID, additionalSizeToAlloc<std::pair<QualType, TypeSourceInfo *>>(
544 NTTP->NumExpandedTypes = NumExpandedTypes;
565 void TemplateTemplateParmDecl::anchor() { }
567 TemplateTemplateParmDecl::TemplateTemplateParmDecl(
570 ArrayRef<TemplateParameterList *> Expansions)
571 :
TemplateDecl(TemplateTemplateParm, DC, L, Id, Params),
573 ExpandedParameterPack(
true), NumExpandedParams(Expansions.size()) {
574 if (!Expansions.empty())
575 std::uninitialized_copy(Expansions.begin(), Expansions.end(),
576 getTrailingObjects<TemplateParameterList *>());
595 additionalSizeToAlloc<TemplateParameterList *>(Expansions.size()))
602 false,
nullptr,
nullptr);
607 unsigned NumExpansions) {
609 new (C,
ID, additionalSizeToAlloc<TemplateParameterList *>(NumExpansions))
612 TTP->NumExpandedParams = NumExpansions;
624 DefaultArgument.
set(
nullptr);
634 NumArguments(Args.size()) {
635 std::uninitialized_copy(Args.begin(), Args.end(),
636 getTrailingObjects<TemplateArgument>());
642 void *Mem = Context.
Allocate(totalSizeToAlloc<TemplateArgument>(Args.size()));
654 if (TemplateArgsAsWritten)
656 *TemplateArgsAsWritten);
668 void TemplateDecl::anchor() { }
683 SpecializedTemplate(SpecializedTemplate),
684 ExplicitInfo(nullptr),
705 Context, ClassTemplateSpecialization, TK, DC, StartLoc, IdLoc,
706 SpecializedTemplate, Args, PrevDecl);
723 raw_ostream &OS,
const PrintingPolicy &Policy,
bool Qualified)
const {
728 PS ? PS->getTemplateArgsAsWritten() :
nullptr) {
730 OS, ArgsAsWritten->arguments(), Policy);
734 OS, TemplateArgs.
asArray(), Policy);
740 if (SpecializedPartialSpecialization *PartialSpec
741 = SpecializedTemplate.dyn_cast<SpecializedPartialSpecialization*>())
742 return PartialSpec->PartialSpecialization->getSpecializedTemplate();
766 CTPSDecl *ctpsd =
const_cast<CTPSDecl*
>(cast<CTPSDecl>(
this));
768 assert(inst_from !=
nullptr);
769 return inst_from->getSourceRange();
776 if (inst_from.isNull())
778 if (ClassTemplateDecl *ctd = inst_from.dyn_cast<ClassTemplateDecl*>())
779 return ctd->getSourceRange();
788 void ClassTemplatePartialSpecializationDecl::anchor() { }
790 ClassTemplatePartialSpecializationDecl::
797 ArrayRef<TemplateArgument> Args,
801 ClassTemplatePartialSpecialization,
802 TK, DC, StartLoc, IdLoc,
805 TemplateParams(Params), ArgsAsWritten(ArgInfos),
806 InstantiatedFromMember(nullptr,
false)
826 Params, SpecializedTemplate, Args,
827 ASTArgInfos, PrevDecl);
848 void FriendTemplateDecl::anchor() { }
894 void ClassScopeFunctionSpecializationDecl::anchor() { }
942 for (uint32_t
I = 0, N = *Specs++;
I != N; ++
I)
947 llvm::FoldingSetVector<VarTemplateSpecializationDecl> &
953 llvm::FoldingSetVector<VarTemplatePartialSpecializationDecl> &
991 assert(Existing->
isCanonicalDecl() &&
"Non-canonical specialization?");
995 L->AddedCXXTemplateSpecialization(
this, D);
1000 llvm::FoldingSetVector<VarTemplatePartialSpecializationDecl> &
PartialSpecs =
1003 PS.reserve(PartialSpecs.size());
1005 PS.push_back(P.getMostRecentDecl());
1013 if (P.getInstantiatedFromMember()->getCanonicalDecl() == DCanon)
1014 return P.getMostRecentDecl();
1027 :
VarDecl(DK, Context, DC, StartLoc, IdLoc,
1029 SpecializedTemplate(SpecializedTemplate), ExplicitInfo(nullptr),
1044 VarTemplateSpecialization, Context, DC, StartLoc, IdLoc,
1045 SpecializedTemplate, T, TInfo, S, Args);
1055 raw_ostream &OS,
const PrintingPolicy &Policy,
bool Qualified)
const {
1060 PS ? PS->getTemplateArgsAsWritten() :
nullptr) {
1062 OS, ArgsAsWritten->arguments(), Policy);
1066 OS, TemplateArgs.
asArray(), Policy);
1071 if (SpecializedPartialSpecialization *PartialSpec =
1072 SpecializedTemplate.dyn_cast<SpecializedPartialSpecialization *>())
1073 return PartialSpec->PartialSpecialization->getSpecializedTemplate();
1088 void VarTemplatePartialSpecializationDecl::anchor() {}
1090 VarTemplatePartialSpecializationDecl::VarTemplatePartialSpecializationDecl(
1097 DC, StartLoc, IdLoc, SpecializedTemplate, T,
1099 TemplateParams(Params), ArgsAsWritten(ArgInfos),
1100 InstantiatedFromMember(nullptr,
false) {
1117 Context, DC, StartLoc, IdLoc, Params, SpecializedTemplate, T, TInfo,
1118 S, Args, ASTArgInfos);
1134 nullptr,
true,
false);
1135 T->setImplicit(
true);
1142 nullptr, TI->
getType(),
true, TI);
1153 false,
nullptr, TPL);
1154 TemplateTemplateParm->setImplicit(
true);
1159 nullptr,
true,
false);
1160 TemplateTypeParm->setImplicit(
true);
1164 QualType(TemplateTypeParm->getTypeForDecl(), 0));
1167 nullptr, TInfo->
getType(),
false, TInfo);
1168 NamedDecl *Params[] = {TemplateTemplateParm, TemplateTypeParm,
1169 NonTypeTemplateParm};
1182 nullptr, TInfo->
getType(),
false, TInfo);
1187 nullptr,
true,
true);
1188 Ts->setImplicit(
true);
1193 llvm::makeArrayRef(Params),
1206 llvm_unreachable(
"unhandled BuiltinTemplateKind!");
1209 void BuiltinTemplateDecl::anchor() {}
Defines the clang::ASTContext interface.
SourceLocation getEnd() const
void setImplicit(bool I=true)
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.
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)
Decl - This represents one declaration (or definition), e.g.
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 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...
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
Source range that this declaration covers.
Defines the clang::Expr interface and subclasses for C++ expressions.
SourceRange getSourceRange() const override LLVM_READONLY
Source range that this declaration covers.
ASTMutationListener * getASTMutationListener() const
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)
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.
Stores the template parameter list and associated constraints for TemplateDecl objects that track ass...
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.
TemplateParameterList(SourceLocation TemplateLoc, SourceLocation LAngleLoc, ArrayRef< NamedDecl * > Params, SourceLocation RAngleLoc, Expr *RequiresClause)
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
Source range that this declaration covers.
void setSpecializationKind(TemplateSpecializationKind TSK)
CXXRecordDecl * getCanonicalDecl() override
Retrieves the "canonical" declaration of the given declaration.
SourceLocation getRAngleLoc() const
SourceRange getSourceRange() const override LLVM_READONLY
Source range that this declaration covers.
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...
bool isTemplateParameterPack() const
isTemplateParameter - Determines whether this declaration is a template parameter pack...
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)
A placeholder type used to construct an empty shell of a decl-derived type that will be filled in lat...
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.
void setAssociatedConstraints(Expr *AC)
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.
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...
static TemplateParameterList * Create(const ASTContext &C, SourceLocation TemplateLoc, SourceLocation LAngleLoc, ArrayRef< NamedDecl * > Params, SourceLocation RAngleLoc, Expr *RequiresClause)
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.
void addDestruction(T *Ptr)
If T isn't trivially destructible, calls AddDeallocation to register it for destruction.
static StringRef getIdentifier(const Token &Tok)
VarDecl * getCanonicalDecl() override
Retrieves the "canonical" declaration of the given declaration.
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.
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.
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.
ASTContext & getASTContext() const LLVM_READONLY
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.
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()
SourceLocation getBegin() const
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.
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)
static ClassTemplateDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation L, DeclarationName Name, TemplateParameterList *Params, NamedDecl *Decl, Expr *AssociatedConstraints=nullptr)
Create a class template node.
Represents a template argument.
TagTypeKind
The kind of a tag type.
void getInjectedTemplateArgs(const TemplateParameterList *Params, SmallVectorImpl< TemplateArgument > &Args)
Get a template argument list with one argument per template parameter in a template parameter list...
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.
bool isCanonicalDecl() const
Whether this particular Decl is a canonical one.
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.
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.
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...
ClassTemplateDecl(ConstrainedTemplateDeclInfo *CTDI, ASTContext &C, DeclContext *DC, SourceLocation L, DeclarationName Name, TemplateParameterList *Params, NamedDecl *Decl)
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
Source range that this declaration covers.
llvm::PointerUnion< NamedDecl *, TypeSourceInfo * > FriendUnion
TemplateParameterList * getTemplateParameters() const
Get the list of template parameters.
SourceRange getSourceRange() const LLVM_READONLY
SourceLocation tokens are not useful in isolation - they are low level value objects created/interpre...
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 ...
Kind
Lists the kind of concrete classes of Decl.
llvm::FoldingSetVector< VarTemplateSpecializationDecl > Specializations
The variable template specializations for this variable template, including explicit specializations ...
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 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
Source range that this declaration covers.
Declaration of a friend template.
bool isNull() const
Return true if this QualType doesn't point to a type yet.
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)
std::vector< const ClassTemplatePartialSpecializationDecl * > PartialSpecs
llvm::FoldingSetVector< VarTemplatePartialSpecializationDecl > & getPartialSpecializations()
Retrieve the set of partial specializations of this class template.
FunctionTemplateDecl * getMostRecentDecl()