15 #ifndef LLVM_CLANG_AST_DECLTEMPLATE_H
16 #define LLVM_CLANG_AST_DECLTEMPLATE_H
21 #include "llvm/ADT/PointerUnion.h"
22 #include "llvm/Support/Compiler.h"
23 #include "llvm/Support/TrailingObjects.h"
29 class TemplateParameterList;
31 class RedeclarableTemplateDecl;
32 class FunctionTemplateDecl;
33 class ClassTemplateDecl;
34 class ClassTemplatePartialSpecializationDecl;
35 class TemplateTypeParmDecl;
36 class NonTypeTemplateParmDecl;
37 class TemplateTemplateParmDecl;
38 class TypeAliasTemplateDecl;
39 class VarTemplateDecl;
59 unsigned NumParams : 31;
63 unsigned ContainsUnexpandedParameterPack : 1;
91 unsigned size()
const {
return NumParams; }
94 return llvm::makeArrayRef(
begin(),
end());
97 return llvm::makeArrayRef(
begin(),
size());
101 assert(Idx <
size() &&
"Template parameter index out-of-range");
106 assert(Idx <
size() &&
"Template parameter index out-of-range");
127 return ContainsUnexpandedParameterPack;
158 : List(TemplateLoc, LAngleLoc, Params, RAngleLoc) {
162 assert(
sizeof(*
this) ==
163 TemplateParameterList::totalSizeToAlloc<NamedDecl *>(N) &&
164 "Object layout not as expected");
165 assert(this->Params == List.getTrailingObjects<
NamedDecl *>() &&
166 "Object layout not as expected");
179 unsigned NumArguments;
205 : Arguments(Args), NumArguments(NumArgs) {}
214 : Arguments(Other->
data()), NumArguments(Other->
size()) {}
218 assert(Idx < NumArguments &&
"Invalid template argument index");
227 return llvm::makeArrayRef(
data(),
size());
232 unsigned size()
const {
return NumArguments; }
250 template<
typename ParmDecl,
typename ArgType>
256 ParmDecl *PrevDeclWithDefaultArg;
259 static_assert(
sizeof(Chain) ==
sizeof(
void *) * 2,
260 "non-pointer argument type?");
262 llvm::PointerUnion3<ArgType, ParmDecl*, Chain*> ValueOrInherited;
264 static ParmDecl *getParmOwningDefaultArg(ParmDecl *Parm) {
266 if (
auto *Prev = Storage.ValueOrInherited.template dyn_cast<ParmDecl*>())
268 assert(!Parm->getDefaultArgStorage()
269 .ValueOrInherited.template is<ParmDecl *>() &&
270 "should only be one level of indirection");
278 bool isSet()
const {
return !ValueOrInherited.isNull(); }
281 bool isInherited()
const {
return ValueOrInherited.template is<ParmDecl*>(); }
284 ArgType
get()
const {
286 if (
auto *Prev = ValueOrInherited.template dyn_cast<ParmDecl*>())
287 Storage = &Prev->getDefaultArgStorage();
288 if (
auto *
C = Storage->ValueOrInherited.template dyn_cast<Chain*>())
290 return Storage->ValueOrInherited.template get<ArgType>();
295 if (
auto *D = ValueOrInherited.template dyn_cast<ParmDecl*>())
297 if (
auto *
C = ValueOrInherited.template dyn_cast<Chain*>())
298 return C->PrevDeclWithDefaultArg;
303 assert(!
isSet() &&
"default argument already set");
304 ValueOrInherited = Arg;
308 assert(!
isInherited() &&
"default argument already inherited");
309 InheritedFrom = getParmOwningDefaultArg(InheritedFrom);
311 ValueOrInherited = InheritedFrom;
314 Chain{InheritedFrom, ValueOrInherited.template get<ArgType>()};
318 ValueOrInherited = ArgType();
332 void anchor()
override;
337 :
NamedDecl(DK, DC, L, Name), TemplatedDecl(nullptr),
338 TemplateParams(nullptr) {}
344 :
NamedDecl(DK, DC, L, Name), TemplatedDecl(nullptr),
345 TemplateParams(Params) {}
351 :
NamedDecl(DK, DC, L, Name), TemplatedDecl(Decl),
352 TemplateParams(Params) { }
356 return TemplateParams;
365 return K >= firstTemplate && K <= lastTemplate;
369 return SourceRange(TemplateParams->getTemplateLoc(),
370 TemplatedDecl->getSourceRange().getEnd());
381 assert(!TemplatedDecl &&
"TemplatedDecl already set!");
382 assert(!TemplateParams &&
"TemplateParams already set!");
383 TemplatedDecl = templatedDecl;
384 TemplateParams = templateParams;
399 Template(Template, TSK - 1),
400 TemplateArguments(TemplateArgs),
401 TemplateArgumentsAsWritten(TemplateArgsAsWritten),
402 PointOfInstantiation(POI) { }
420 llvm::PointerIntPair<FunctionTemplateDecl *, 2>
Template;
456 "Cannot encode TSK_Undeclared for a function template specialization");
457 Template.setInt(TSK - 1);
466 return PointOfInstantiation;
472 PointOfInstantiation = POI;
476 Profile(ID, TemplateArguments->asArray(),
477 Function->getASTContext());
483 ID.AddInteger(TemplateArgs.size());
484 for (
unsigned Arg = 0; Arg != TemplateArgs.size(); ++Arg)
485 TemplateArgs[Arg].
Profile(ID, Context);
495 llvm::PointerIntPair<NamedDecl *, 2> MemberAndTSK;
504 : MemberAndTSK(IF, TSK - 1), PointOfInstantiation(POI) {
506 "Cannot encode undeclared template specializations for members");
525 "Cannot encode undeclared template specializations for members");
526 MemberAndTSK.setInt(TSK - 1);
533 return PointOfInstantiation;
538 PointOfInstantiation = POI;
559 FunctionTemplateDecl *> {
561 unsigned NumTemplates;
569 size_t numTrailingObjects(OverloadToken<TemplateArgumentLoc>)
const {
572 size_t numTrailingObjects(OverloadToken<FunctionTemplateDecl *>)
const {
591 assert(I < getNumTemplates() &&
"template index out of range");
592 return getTrailingObjects<FunctionTemplateDecl *>()[I];
597 return getTrailingObjects<TemplateArgumentLoc>();
605 assert(I < getNumTemplateArgs() &&
"template arg index out of range");
606 return getTemplateArgs()[
I];
610 return AngleLocs.getBegin();
614 return AngleLocs.getEnd();
626 return getNextRedeclaration();
629 return getPreviousDecl();
632 return getMostRecentDecl();
643 return D->getTemplateArgs().asArray();
647 template <
typename EntryType,
typename SETraits = SpecEntryTraits<EntryType>,
648 typename DeclType =
typename SETraits::DeclType>
650 : llvm::iterator_adaptor_base<
651 SpecIterator<EntryType, SETraits, DeclType>,
652 typename llvm::FoldingSetVector<EntryType>::iterator,
653 typename std::iterator_traits<typename llvm::FoldingSetVector<
654 EntryType>::iterator>::iterator_category,
655 DeclType *, ptrdiff_t, DeclType *, DeclType *> {
659 :
SpecIterator::iterator_adaptor_base(std::move(SetIter)) {}
662 return SETraits::getDecl(&*this->
I)->getMostRecentDecl();
667 template <
typename EntryType>
668 static SpecIterator<EntryType>
673 template <
class EntryType>
typename SpecEntryTraits<EntryType>::DeclType*
674 findSpecializationImpl(llvm::FoldingSetVector<EntryType> &Specs,
677 template <
class Derived,
class EntryType>
678 void addSpecializationImpl(llvm::FoldingSetVector<EntryType> &Specs,
679 EntryType *Entry,
void *InsertPos);
689 llvm::PointerIntPair<RedeclarableTemplateDecl*, 1, bool>
712 template <
class decl_type>
friend class RedeclarableTemplate;
716 return getFirstDecl();
719 return getFirstDecl();
741 return getCommonPtr()->InstantiatedFromMember.getInt();
746 assert(getCommonPtr()->InstantiatedFromMember.getPointer() &&
747 "Only member templates can be member template specializations");
748 getCommonPtr()->InstantiatedFromMember.setInt(
true);
788 return getCommonPtr()->InstantiatedFromMember.getPointer();
792 assert(!getCommonPtr()->InstantiatedFromMember.getPointer());
793 getCommonPtr()->InstantiatedFromMember.setPointer(TD);
798 using redeclarable_base::redecls_begin;
799 using redeclarable_base::redecls_end;
800 using redeclarable_base::redecls;
801 using redeclarable_base::getPreviousDecl;
802 using redeclarable_base::getMostRecentDecl;
803 using redeclarable_base::isFirstDecl;
808 return K >= firstRedeclarableTemplate && K <= lastRedeclarableTemplate;
831 static void DeallocateCommon(
void *Ptr);
837 Common() : InjectedArgs(), LazySpecializations() { }
876 llvm::FoldingSetVector<FunctionTemplateSpecializationInfo> &
877 getSpecializations()
const;
888 void LoadLazySpecializations()
const;
898 return getTemplatedDecl()->isThisDeclarationADefinition();
907 return cast<FunctionTemplateDecl>(
911 return cast<FunctionTemplateDecl>(
918 return cast_or_null<FunctionTemplateDecl>(
925 return cast_or_null<FunctionTemplateDecl>(
930 return cast<FunctionTemplateDecl>(
932 ->getMostRecentDecl());
939 return cast_or_null<FunctionTemplateDecl>(
950 return makeSpecIterator(getSpecializations(),
false);
954 return makeSpecIterator(getSpecializations(),
true);
1044 :
TypeDecl(TemplateTypeParm, DC, IdLoc, Id, KeyLoc), Typename(Typename),
1045 DefaultArgument() { }
1054 unsigned D,
unsigned P,
1056 bool ParameterPack);
1074 return DefaultArgument.get()->getType();
1079 return DefaultArgument.get();
1088 return DefaultArgument.isInherited();
1093 DefaultArgument.set(DefArg);
1099 DefaultArgument.setInherited(C, Prev);
1104 DefaultArgument.clear();
1112 unsigned getDepth()
const;
1115 unsigned getIndex()
const;
1118 bool isParameterPack()
const;
1120 SourceRange getSourceRange() const override LLVM_READONLY;
1123 static
bool classof(const
Decl *D) {
return classofKind(D->getKind()); }
1136 std::pair<QualType, TypeSourceInfo *>> {
1151 bool ExpandedParameterPack;
1154 unsigned NumExpandedTypes;
1156 size_t numTrailingObjects(
1157 OverloadToken<std::pair<QualType, TypeSourceInfo *>>)
const {
1158 return NumExpandedTypes;
1165 :
DeclaratorDecl(NonTypeTemplateParm, DC, IdLoc, Id, T, TInfo, StartLoc),
1167 ExpandedParameterPack(
false), NumExpandedTypes(0)
1175 unsigned NumExpandedTypes,
1191 const QualType *ExpandedTypes,
unsigned NumExpandedTypes,
1198 unsigned NumExpandedTypes);
1206 SourceRange getSourceRange() const override LLVM_READONLY;
1223 return DefaultArgument.isInherited();
1232 DefaultArgument.setInherited(C, Parm);
1287 assert(ExpandedParameterPack &&
"Not an expansion parameter pack");
1288 return NumExpandedTypes;
1294 assert(I < NumExpandedTypes &&
"Out-of-range expansion type index");
1295 auto TypesAndInfos =
1296 getTrailingObjects<std::pair<QualType, TypeSourceInfo *>>();
1297 return TypesAndInfos[
I].first;
1303 assert(I < NumExpandedTypes &&
"Out-of-range expansion type index");
1304 auto TypesAndInfos =
1305 getTrailingObjects<std::pair<QualType, TypeSourceInfo *>>();
1306 return TypesAndInfos[
I].second;
1325 TemplateParameterList *> {
1326 void anchor()
override;
1339 bool ExpandedParameterPack;
1342 unsigned NumExpandedParams;
1345 unsigned D,
unsigned P,
bool ParameterPack,
1347 :
TemplateDecl(TemplateTemplateParm, DC, L, Id, Params),
1349 ExpandedParameterPack(
false), NumExpandedParams(0)
1353 unsigned D,
unsigned P,
1355 unsigned NumExpansions,
1361 unsigned P,
bool ParameterPack,
1375 unsigned NumExpansions);
1394 return ParameterPack &&
1395 getTemplateParameters()->containsUnexpandedParameterPack();
1421 assert(ExpandedParameterPack &&
"Not an expansion parameter pack");
1422 return NumExpandedParams;
1428 assert(I < NumExpandedParams &&
"Out-of-range expansion type index");
1429 return getTrailingObjects<TemplateParameterList *>()[I];
1441 return DefaultArgument.isSet() ? *DefaultArgument.get() :
None;
1450 return DefaultArgument.isInherited();
1460 DefaultArgument.setInherited(C, Prev);
1468 if (hasDefaultArgument() && !defaultArgumentWasInherited())
1469 End = getDefaultArgument().getSourceRange().getEnd();
1470 return SourceRange(getTemplateParameters()->getTemplateLoc(), End);
1486 void anchor()
override;
1530 struct SpecializedPartialSpecialization {
1541 llvm::PointerUnion<ClassTemplateDecl *, SpecializedPartialSpecialization *>
1542 SpecializedTemplate;
1545 struct ExplicitSpecializationInfo {
1553 ExplicitSpecializationInfo()
1554 : TypeAsWritten(
nullptr), ExternLoc(), TemplateKeywordLoc() {}
1559 ExplicitSpecializationInfo *ExplicitInfo;
1569 unsigned SpecializationKind : 3;
1593 void getNameForDiagnostic(raw_ostream &OS,
const PrintingPolicy &Policy,
1594 bool Qualified)
const override;
1603 this)->getMostRecentDecl();
1604 while (!isa<ClassTemplateSpecializationDecl>(Recent)) {
1609 return cast<ClassTemplateSpecializationDecl>(Recent);
1618 return *TemplateArgs;
1640 SpecializationKind = TSK;
1645 return PointOfInstantiation;
1649 assert(Loc.
isValid() &&
"point of instantiation must be valid!");
1650 PointOfInstantiation = Loc;
1664 return getSpecializedTemplateOrPartial();
1672 if (SpecializedPartialSpecialization *PartialSpec
1673 = SpecializedTemplate.dyn_cast<SpecializedPartialSpecialization*>())
1674 return PartialSpec->PartialSpecialization;
1691 if (SpecializedPartialSpecialization *PartialSpec
1692 = SpecializedTemplate.dyn_cast<SpecializedPartialSpecialization*>())
1693 return *PartialSpec->TemplateArgs;
1695 return getTemplateArgs();
1703 assert(!SpecializedTemplate.is<SpecializedPartialSpecialization*>() &&
1704 "Already set to a class template partial specialization!");
1705 SpecializedPartialSpecialization *PS
1706 =
new (getASTContext()) SpecializedPartialSpecialization();
1707 PS->PartialSpecialization = PartialSpec;
1708 PS->TemplateArgs = TemplateArgs;
1709 SpecializedTemplate = PS;
1715 assert(!SpecializedTemplate.is<SpecializedPartialSpecialization*>() &&
1716 "Previously set to a class template partial specialization!");
1717 SpecializedTemplate = TemplDecl;
1724 ExplicitInfo =
new (getASTContext()) ExplicitSpecializationInfo;
1725 ExplicitInfo->TypeAsWritten = T;
1730 return ExplicitInfo ? ExplicitInfo->TypeAsWritten :
nullptr;
1735 return ExplicitInfo ? ExplicitInfo->ExternLoc :
SourceLocation();
1740 ExplicitInfo =
new (getASTContext()) ExplicitSpecializationInfo;
1741 ExplicitInfo->ExternLoc = Loc;
1747 ExplicitInfo =
new (getASTContext()) ExplicitSpecializationInfo;
1748 ExplicitInfo->TemplateKeywordLoc = Loc;
1752 return ExplicitInfo ? ExplicitInfo->TemplateKeywordLoc :
SourceLocation();
1755 SourceRange getSourceRange() const override LLVM_READONLY;
1758 Profile(ID, TemplateArgs->asArray(), getASTContext());
1764 ID.AddInteger(TemplateArgs.size());
1765 for (
unsigned Arg = 0; Arg != TemplateArgs.size(); ++Arg)
1766 TemplateArgs[Arg].
Profile(ID, Context);
1771 return K >= firstClassTemplateSpecialization &&
1772 K <= lastClassTemplateSpecialization;
1781 void anchor()
override;
1795 llvm::PointerIntPair<ClassTemplatePartialSpecializationDecl *, 1, bool>
1796 InstantiatedFromMember;
1811 TemplateParams(
nullptr), ArgsAsWritten(
nullptr),
1812 InstantiatedFromMember(
nullptr,
false) {}
1830 return cast<ClassTemplatePartialSpecializationDecl>(
1832 this)->getMostRecentDecl());
1837 return TemplateParams;
1842 return ArgsAsWritten;
1867 cast<ClassTemplatePartialSpecializationDecl>(getFirstDecl());
1868 return First->InstantiatedFromMember.getPointer();
1874 cast<ClassTemplatePartialSpecializationDecl>(getFirstDecl());
1875 First->InstantiatedFromMember.setPointer(PartialSpec);
1896 cast<ClassTemplatePartialSpecializationDecl>(getFirstDecl());
1897 return First->InstantiatedFromMember.getInt();
1903 cast<ClassTemplatePartialSpecializationDecl>(getFirstDecl());
1904 assert(First->InstantiatedFromMember.getPointer() &&
1905 "Only member templates can be member template specializations");
1906 return First->InstantiatedFromMember.setInt(
true);
1913 assert(getTypeForDecl() &&
"partial specialization has no type set!");
1914 return cast<InjectedClassNameType>(getTypeForDecl())
1915 ->getInjectedSpecializationType();
1922 return K == ClassTemplatePartialSpecialization;
1931 static void DeallocateCommon(
void *Ptr);
1945 llvm::FoldingSetVector<ClassTemplatePartialSpecializationDecl>
1960 llvm::FoldingSetVector<ClassTemplateSpecializationDecl> &
1961 getSpecializations()
const;
1965 llvm::FoldingSetVector<ClassTemplatePartialSpecializationDecl> &
1966 getPartialSpecializations();
1981 void LoadLazySpecializations()
const;
1991 return getTemplatedDecl()->isThisDeclarationADefinition();
2015 return cast<ClassTemplateDecl>(
2019 return cast<ClassTemplateDecl>(
2026 return cast_or_null<ClassTemplateDecl>(
2033 return cast_or_null<ClassTemplateDecl>(
2035 this)->getPreviousDecl());
2039 return cast<ClassTemplateDecl>(
2047 return cast_or_null<ClassTemplateDecl>(
2062 void getPartialSpecializations(
2084 findPartialSpecInstantiatedFromMember(
2101 QualType getInjectedClassNameSpecialization();
2111 return makeSpecIterator(getSpecializations(),
false);
2115 return makeSpecIterator(getSpecializations(),
true);
2140 virtual void anchor();
2163 :
Decl(
Decl::FriendTemplate, DC, Loc),
2167 FriendLoc(FriendLoc)
2171 :
Decl(
Decl::FriendTemplate, Empty),
2178 DeclContext *DC, SourceLocation Loc,
2180 TemplateParameterList **Params,
2182 SourceLocation FriendLoc);
2184 static FriendTemplateDecl *CreateDeserialized(
ASTContext &
C,
unsigned ID);
2206 assert(i <= NumParams);
2228 static void DeallocateCommon(
void *Ptr);
2253 return cast<TypeAliasTemplateDecl>(
2257 return cast<TypeAliasTemplateDecl>(
2264 return cast_or_null<TypeAliasTemplateDecl>(
2271 return cast_or_null<TypeAliasTemplateDecl>(
2273 this)->getPreviousDecl());
2277 return cast_or_null<TypeAliasTemplateDecl>(
2317 virtual void anchor();
2322 :
Decl(Decl::ClassScopeFunctionSpecialization, DC, Loc),
2323 Specialization(FD), HasExplicitTemplateArgs(Args),
2324 TemplateArgs(TemplArgs) {}
2327 :
Decl(Decl::ClassScopeFunctionSpecialization, Empty) {}
2330 bool HasExplicitTemplateArgs;
2342 bool HasExplicitTemplateArgs,
2345 DC, Loc, FD, HasExplicitTemplateArgs, TemplateArgs);
2354 return K == Decl::ClassScopeFunctionSpecialization;
2379 public llvm::FoldingSetNode {
2384 struct SpecializedPartialSpecialization {
2395 llvm::PointerUnion<VarTemplateDecl *, SpecializedPartialSpecialization *>
2396 SpecializedTemplate;
2399 struct ExplicitSpecializationInfo {
2407 ExplicitSpecializationInfo()
2408 : TypeAsWritten(
nullptr), ExternLoc(), TemplateKeywordLoc() {}
2413 ExplicitSpecializationInfo *ExplicitInfo;
2424 unsigned SpecializationKind : 3;
2446 bool Qualified)
const override;
2450 return cast<VarTemplateSpecializationDecl>(Recent);
2464 return TemplateArgsInfo;
2486 SpecializationKind = TSK;
2491 return PointOfInstantiation;
2495 assert(Loc.
isValid() &&
"point of instantiation must be valid!");
2496 PointOfInstantiation = Loc;
2503 llvm::PointerUnion<VarTemplateDecl *, VarTemplatePartialSpecializationDecl *>
2511 if (SpecializedPartialSpecialization *PartialSpec =
2512 SpecializedTemplate.dyn_cast<SpecializedPartialSpecialization *>())
2513 return PartialSpec->PartialSpecialization;
2515 return SpecializedTemplate.get<VarTemplateDecl *>();
2520 llvm::PointerUnion<VarTemplateDecl *, VarTemplatePartialSpecializationDecl *>
2522 if (SpecializedPartialSpecialization *PartialSpec =
2523 SpecializedTemplate.dyn_cast<SpecializedPartialSpecialization *>())
2524 return PartialSpec->PartialSpecialization;
2541 if (SpecializedPartialSpecialization *PartialSpec =
2542 SpecializedTemplate.dyn_cast<SpecializedPartialSpecialization *>())
2543 return *PartialSpec->TemplateArgs;
2553 assert(!SpecializedTemplate.is<SpecializedPartialSpecialization *>() &&
2554 "Already set to a variable template partial specialization!");
2555 SpecializedPartialSpecialization *PS =
2557 PS->PartialSpecialization = PartialSpec;
2558 PS->TemplateArgs = TemplateArgs;
2559 SpecializedTemplate = PS;
2565 assert(!SpecializedTemplate.is<SpecializedPartialSpecialization *>() &&
2566 "Previously set to a variable template partial specialization!");
2567 SpecializedTemplate = TemplDecl;
2574 ExplicitInfo =
new (
getASTContext()) ExplicitSpecializationInfo;
2575 ExplicitInfo->TypeAsWritten = T;
2580 return ExplicitInfo ? ExplicitInfo->TypeAsWritten :
nullptr;
2585 return ExplicitInfo ? ExplicitInfo->ExternLoc :
SourceLocation();
2590 ExplicitInfo =
new (
getASTContext()) ExplicitSpecializationInfo;
2591 ExplicitInfo->ExternLoc = Loc;
2597 ExplicitInfo =
new (
getASTContext()) ExplicitSpecializationInfo;
2598 ExplicitInfo->TemplateKeywordLoc = Loc;
2602 return ExplicitInfo ? ExplicitInfo->TemplateKeywordLoc :
SourceLocation();
2612 ID.AddInteger(TemplateArgs.size());
2613 for (
unsigned Arg = 0; Arg != TemplateArgs.size(); ++Arg)
2614 TemplateArgs[Arg].
Profile(ID, Context);
2619 return K >= firstVarTemplateSpecialization &&
2620 K <= lastVarTemplateSpecialization;
2629 void anchor()
override;
2643 llvm::PointerIntPair<VarTemplatePartialSpecializationDecl *, 1, bool>
2644 InstantiatedFromMember;
2655 TemplateParams(
nullptr), ArgsAsWritten(
nullptr),
2656 InstantiatedFromMember(
nullptr,
false) {}
2670 return cast<VarTemplatePartialSpecializationDecl>(
2677 return TemplateParams;
2682 return ArgsAsWritten;
2707 cast<VarTemplatePartialSpecializationDecl>(
getFirstDecl());
2708 return First->InstantiatedFromMember.getPointer();
2714 cast<VarTemplatePartialSpecializationDecl>(
getFirstDecl());
2715 First->InstantiatedFromMember.setPointer(PartialSpec);
2736 cast<VarTemplatePartialSpecializationDecl>(
getFirstDecl());
2737 return First->InstantiatedFromMember.getInt();
2743 cast<VarTemplatePartialSpecializationDecl>(
getFirstDecl());
2744 assert(First->InstantiatedFromMember.getPointer() &&
2745 "Only member templates can be member template specializations");
2746 return First->InstantiatedFromMember.setInt(
true);
2751 return K == VarTemplatePartialSpecialization;
2760 static void DeallocateCommon(
void *Ptr);
2774 llvm::FoldingSetVector<VarTemplatePartialSpecializationDecl>
2786 llvm::FoldingSetVector<VarTemplateSpecializationDecl> &
2791 llvm::FoldingSetVector<VarTemplatePartialSpecializationDecl> &
2850 return cast_or_null<VarTemplateDecl>(
2857 return cast_or_null<VarTemplateDecl>(
2863 return cast<VarTemplateDecl>(
2871 return cast_or_null<VarTemplateDecl>(
SourceLocation getPointOfInstantiation() const
Retrieve the first point of instantiation of this function template specialization.
void setInstantiationOf(ClassTemplateDecl *TemplDecl)
Note that this class template specialization is an instantiation of the given class template...
FunctionDecl - An instance of this class is created to represent a function declaration or definition...
void setTemplateSpecializationKind(TemplateSpecializationKind TSK)
Set the template specialization kind.
BuiltinTemplateKind getBuiltinTemplateKind() const
QualType getInjectedSpecializationType() const
Retrieves the injected specialization type for this partial specialization.
llvm::PointerUnion< ClassTemplateDecl *, ClassTemplatePartialSpecializationDecl * > getInstantiatedFrom() const
If this class template specialization is an instantiation of a template (rather than an explicit spec...
TemplateParameterList * getExpansionTemplateParameters(unsigned I) const
Retrieve a particular expansion type within an expanded parameter pack.
const ClassTemplateDecl * getCanonicalDecl() const
FunctionTemplateDecl * getInstantiatedFromMemberTemplate() const
TemplateDecl(Kind DK, DeclContext *DC, SourceLocation L, DeclarationName Name, TemplateParameterList *Params)
TemplateSpecializationKind getTemplateSpecializationKind() const
If this variable is an instantiation of a variable template or a static data member of a class templa...
A (possibly-)qualified type.
FunctionDecl * Function
The function template specialization that this structure describes.
unsigned getNumTemplates() const
Returns the number of function templates that this might be a specialization of.
RedeclarableTemplateDecl(Kind DK, ASTContext &C, DeclContext *DC, SourceLocation L, DeclarationName Name, TemplateParameterList *Params, NamedDecl *Decl)
void setDefaultArgument(TypeSourceInfo *DefArg)
Set the default argument for this template parameter.
void setTemplateKeywordLoc(SourceLocation Loc)
Sets the location of the template keyword.
SourceLocation getExternLoc() const
Gets the location of the extern keyword, if present.
redeclarable_base::redecl_range redecl_range
SourceLocation getTemplateKeywordLoc() const
Gets the location of the template keyword, if present.
spec_range specializations() const
SpecIterator< FunctionTemplateSpecializationInfo > spec_iterator
VarTemplateSpecializationDecl * getMostRecentDecl()
CXXMethodDecl * getSpecialization() const
bool isPackExpansion() const
Whether this parameter pack is a pack expansion.
llvm::FoldingSetVector< VarTemplateSpecializationDecl > & getSpecializations() const
Retrieve the set of specializations of this variable template.
bool isMemberSpecialization()
Determines whether this class template partial specialization template was a specialization of a memb...
static ClassScopeFunctionSpecializationDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation Loc, CXXMethodDecl *FD, bool HasExplicitTemplateArgs, TemplateArgumentListInfo TemplateArgs)
SourceLocation getTemplateKeywordLoc() const
Gets the location of the template keyword, if present.
CXXRecordDecl * getTemplatedDecl() const
Get the underlying class declarations of the template.
static TemplateSpecializationKind getTemplateSpecializationKind(Decl *D)
Determine what kind of template specialization the given declaration is.
Decl - This represents one declaration (or definition), e.g.
DeclType * operator*() const
TypeAliasTemplateDecl * getPreviousDecl()
Retrieve the previous declaration of this function template, or NULL if no such declaration exists...
FixedSizeTemplateParameterListStorage(SourceLocation TemplateLoc, SourceLocation LAngleLoc, ArrayRef< NamedDecl * > Params, SourceLocation RAngleLoc)
ArrayRef< NamedDecl * > asArray()
bool isThisDeclarationADefinition() const
Returns whether this template declaration defines the primary pattern.
void setInheritedDefaultArgument(const ASTContext &C, NonTypeTemplateParmDecl *Parm)
VarTemplatePartialSpecializationDecl * getMostRecentDecl()
void removeDefaultArgument()
Removes the default argument of this template parameter.
Declaration of a variable template.
void setSpecializationKind(TemplateSpecializationKind TSK)
NamedDecl * getParam(unsigned Idx)
static bool classofKind(Kind K)
A container of type source information.
void setTemplateArgsInfo(const TemplateArgumentListInfo &ArgsInfo)
static bool classofKind(Kind K)
const ASTTemplateArgumentListInfo * getTemplateArgsAsWritten() const
Get the template arguments as written.
NamedDecl *const * const_iterator
Iterates through the template parameters in this list.
FunctionTemplateDecl * getTemplate(unsigned I) const
Returns the i'th template candidate.
const TemplateArgumentList & getTemplateInstantiationArgs() const
Retrieve the set of template arguments that should be used to instantiate members of the class templa...
bool hasExplicitTemplateArgs() const
const TemplateArgumentListInfo & templateArgs() const
VarTemplateDecl * getSpecializedTemplate() const
Retrieve the template that this specialization specializes.
static void Profile(llvm::FoldingSetNodeID &ID, ArrayRef< TemplateArgument > TemplateArgs, ASTContext &Context)
VarDecl - An instance of this class is created to represent a variable declaration or definition...
Declaration of a redeclarable template.
llvm::iterator_range< spec_iterator > spec_range
static bool classofKind(Kind K)
Represents a variable template specialization, which refers to a variable template with a given set o...
TemplateParmPosition(unsigned D, unsigned P)
Represents an explicit template argument list in C++, e.g., the "<int>" in "sort<int>".
VarTemplatePartialSpecializationDecl * getInstantiatedFromMember() const
Retrieve the member variable template partial specialization from which this particular variable temp...
Stores a list of template parameters for a TemplateDecl and its derived classes.
Describes how types, statements, expressions, and declarations should be printed. ...
SourceLocation getRAngleLoc() const
static bool classofKind(Kind K)
SourceRange getSourceRange() const override LLVM_READONLY
Source range that this declaration covers.
Provides information about a dependent function-template specialization declaration.
Represents the builtin template declaration which is used to implement __make_integer_seq.
bool isExplicitInstantiationOrSpecialization() const
True if this declaration is an explicit specialization, explicit instantiation declaration, or explicit instantiation definition.
static bool classof(const Decl *D)
static bool classof(const Decl *D)
bool isTemplateExplicitInstantiationOrSpecialization(TemplateSpecializationKind Kind)
True if this template specialization kind is an explicit specialization, explicit instantiation decla...
Provides common interface for the Decls that can be redeclared.
TemplateArgumentList(const TemplateArgumentList *Other)
Produces a shallow copy of the given template argument list.
llvm::iterator_range< spec_iterator > spec_range
Represents a class template specialization, which refers to a class template with a given set of temp...
One of these records is kept for each identifier that is lexed.
spec_iterator spec_begin() const
class LLVM_ALIGNAS(8) DependentTemplateSpecializationType const IdentifierInfo * Name
Represents a template specialization type whose template cannot be resolved, e.g. ...
CXXRecordDecl * getPreviousDecl()
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
void setInstantiationOf(VarTemplateDecl *TemplDecl)
Note that this variable template specialization is an instantiation of the given variable template...
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)
FunctionDecl * getTemplatedDecl() const
Get the underlying function declaration of the template.
SourceLocation getFriendLoc() const
Retrieves the location of the 'friend' keyword.
unsigned size() const
Retrieve the number of template arguments in this template argument list.
ClassTemplateSpecializationDecl * getMostRecentDecl()
static bool classofKind(Kind K)
void Profile(llvm::FoldingSetNodeID &ID)
TypeSourceInfo * getFriendType() const
If this friend declaration names a templated type (or a dependent member type of a templated type)...
const TemplateArgumentList & getTemplateInstantiationArgs() const
Retrieve the set of template arguments that should be used to instantiate the initializer of the vari...
Declaration of a function specialization at template class scope.
bool isExplicitSpecialization() const
SpecIterator< VarTemplateSpecializationDecl > spec_iterator
TypeAliasTemplateDecl(ASTContext &C, DeclContext *DC, SourceLocation L, DeclarationName Name, TemplateParameterList *Params, NamedDecl *Decl)
void setDefaultArgument(Expr *DefArg)
Set the default argument for this template parameter, and whether that default argument was inherited...
llvm::PointerUnion< VarTemplateDecl *, VarTemplatePartialSpecializationDecl * > getSpecializedTemplateOrPartial() const
Retrieve the variable template or variable template partial specialization which was specialized by t...
static bool classof(const Decl *D)
Provides information about a function template specialization, which is a FunctionDecl that has been ...
const DefArgStorage & getDefaultArgStorage() const
bool hasDefaultArgument() const
Determine whether this template parameter has a default argument.
const TemplateArgumentList * TemplateArguments
The template arguments used to produce the function template specialization from the function templat...
FunctionTemplateDecl * getCanonicalDecl() override
Retrieves the canonical declaration of this template.
VarTemplateDecl * getInstantiatedFromMemberTemplate() const
SourceLocation getExternLoc() const
Gets the location of the extern keyword, if present.
SourceLocation getLAngleLoc() const
static TemplateArgumentList * CreateCopy(ASTContext &Context, const TemplateArgument *Args, unsigned NumArgs)
Create a new template argument list that copies the given set of template arguments.
bool isParameterPack() const
Whether this parameter is a non-type template parameter pack.
SourceRange getSourceRange() const override LLVM_READONLY
Source range that this declaration covers.
void set(ArgType Arg)
Set the default argument.
A convenient class for passing around template argument information.
void setDepth(unsigned D)
const ASTTemplateArgumentListInfo * getTemplateArgsAsWritten() const
Get the template arguments as written.
NamedDecl ** iterator
Iterates through the template parameters in this list.
uint32_t * LazySpecializations
If non-null, points to an array of specializations (including partial specializations) known ownly by...
static bool classof(const Decl *D)
bool hasDefaultArgument() const
Determine whether this template parameter has a default argument.
static bool classofKind(Kind K)
static void Profile(llvm::FoldingSetNodeID &ID, ArrayRef< TemplateArgument > TemplateArgs, ASTContext &Context)
TypeDecl - Represents a declaration of a type.
A set of unresolved declarations.
unsigned getNumTemplateParameters() const
void setInstantiatedFromMember(ClassTemplatePartialSpecializationDecl *PartialSpec)
void setInstantiationOf(ClassTemplatePartialSpecializationDecl *PartialSpec, const TemplateArgumentList *TemplateArgs)
Note that this class template specialization is actually an instantiation of the given class template...
QualType getDefaultArgument() const
Retrieve the default argument, if any.
void setSpecializationKind(TemplateSpecializationKind TSK)
static bool classofKind(Kind K)
SourceLocation PointOfInstantiation
The point at which this function template specialization was first instantiated.
TemplateSpecializationKind getSpecializationKind() const
Determine the kind of specialization that this declaration represents.
detail::InMemoryDirectory::const_iterator I
redeclarable_base::redecl_iterator redecl_iterator
bool isInherited() const
Determine whether the default argument for this parameter was inherited from a previous declaration o...
ClassTemplateDecl(ASTContext &C, DeclContext *DC, SourceLocation L, DeclarationName Name, TemplateParameterList *Params, NamedDecl *Decl)
const VarTemplateDecl * getCanonicalDecl() const
TypeSourceInfo * getExpansionTypeSourceInfo(unsigned I) const
Retrieve a particular expansion type source info within an expanded parameter pack.
SpecIterator< ClassTemplateSpecializationDecl > spec_iterator
unsigned getNumExpansionTemplateParameters() const
Retrieves the number of expansion template parameters in an expanded 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 ...
llvm::iterator_range< redecl_iterator > redecl_range
static bool classof(const Decl *D)
const NamedDecl * getParam(unsigned Idx) const
Sema - This implements semantic analysis and AST building for C.
A placeholder type used to construct an empty shell of a decl-derived type that will be filled in lat...
TypeAliasDecl - Represents the declaration of a typedef-name via a C++0x alias-declaration.
llvm::PointerUnion< ClassTemplateDecl *, ClassTemplatePartialSpecializationDecl * > getSpecializedTemplateOrPartial() const
Retrieve the class template or class template partial specialization which was specialized by this...
void AddSpecialization(VarTemplateSpecializationDecl *D, void *InsertPos)
Insert the specified specialization knowing that it is not already in.
unsigned getPosition() const
Get the position of the template parameter within its parameter list.
Represents a ValueDecl that came out of a declarator.
bool isExplicitInstantiationOrSpecialization() const
True if this declaration is an explicit specialization, explicit instantiation declaration, or explicit instantiation definition.
size_t numTrailingObjects(OverloadToken< NamedDecl * >) const
void Profile(llvm::FoldingSetNodeID &ID) const
void clear()
Remove the default argument, even if it was inherited.
TemplateParameterList * getTemplateParameters() const
Get the list of template parameters.
ArrayRef< TemplateArgument > asArray() const
Produce this as an array ref.
llvm::FoldingSetVector< ClassTemplatePartialSpecializationDecl > PartialSpecializations
The class template partial specializations for this class template.
ID
Defines the set of possible language-specific address spaces.
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.
static bool classof(const Decl *D)
Expr - This represents one expression.
bool isExplicitSpecialization() const
llvm::FoldingSetVector< VarTemplatePartialSpecializationDecl > PartialSpecializations
The variable template partial specializations for this variable template.
void setInherited(const ASTContext &C, ParmDecl *InheritedFrom)
Set that the default argument was inherited from another parameter.
bool defaultArgumentWasInherited() const
Determines whether the default argument was inherited from a previous declaration of this template...
const VarTemplateDecl * getPreviousDecl() const
Retrieve the previous declaration of this variable template, or NULL if no such declaration exists...
static bool classof(const Decl *D)
llvm::iterator_range< spec_iterator > spec_range
Declaration of a template type parameter.
const TypeAliasTemplateDecl * getCanonicalDecl() const
TemplateParameterList * getTemplateParameters() const
Get the list of template parameters.
bool wasDeclaredWithTypename() const
Whether this template type parameter was declared with the 'typename' keyword.
NamedDecl * getFriendDecl() const
If this friend declaration names a templated function (or a member function of a templated type)...
MemberSpecializationInfo(NamedDecl *IF, TemplateSpecializationKind TSK, SourceLocation POI=SourceLocation())
const FunctionTemplateDecl * getCanonicalDecl() const
llvm::PointerIntPair< FunctionTemplateDecl *, 2 > Template
The function template from which this function template specialization was generated.
static bool classof(const Decl *D)
const RedeclarableTemplateDecl * getCanonicalDecl() const
bool defaultArgumentWasInherited() const
Determines whether the default argument was inherited from a previous declaration of this template...
TemplateArgumentList(OnStackType, const TemplateArgument *Args, unsigned NumArgs)
Construct a new, temporary template argument list on the stack.
Data that is common to all of the declarations of a given variable template.
void setMemberSpecialization()
Note that this member template is a specialization.
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.
spec_iterator spec_end() const
bool isParameterPack() const
Whether this template template parameter is a template parameter pack.
static bool classof(const Decl *D)
bool isMemberSpecialization() const
Determines whether this template was a specialization of a member template.
StorageClass
Storage classes.
Declaration of an alias template.
const TemplateArgument * data() const
Retrieve a pointer to the template argument list.
static ArrayRef< TemplateArgument > getTemplateArgs(EntryType *D)
void setPointOfInstantiation(SourceLocation Loc)
void setTypeAsWritten(TypeSourceInfo *T)
Sets the type of this specialization as it was written by the user.
static OMPLinearClause * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc, OpenMPLinearClauseKind Modifier, SourceLocation ModifierLoc, SourceLocation ColonLoc, SourceLocation EndLoc, ArrayRef< Expr * > VL, ArrayRef< Expr * > PL, ArrayRef< Expr * > IL, Expr *Step, Expr *CalcStep)
Creates clause with a list of variables VL and a linear step Step.
const TemplateArgumentLoc * getTemplateArgs() const
Returns the explicit template arguments that were given.
TemplateTemplateParmDecl - Declares a template template parameter, e.g., "T" in.
class LLVM_ALIGNAS(8) TemplateSpecializationType unsigned NumArgs
Represents a type template specialization; the template must be a class template, a type alias templa...
const TemplateArgumentLoc & getDefaultArgument() const
Retrieve the default argument, if any.
Data that is common to all of the declarations of a given class template.
This template specialization was implicitly instantiated from a template.
FunctionTemplateDecl * getTemplate() const
Retrieve the template from which this function was specialized.
bool isTemplateInstantiation(TemplateSpecializationKind Kind)
Determine whether this template specialization kind refers to an instantiation of an entity (as oppos...
static bool classofKind(Kind K)
SourceLocation getPointOfInstantiation() const
Get the point of instantiation (if any), or null if none.
static DeclType * getDecl(EntryType *D)
VarDecl * getFirstDecl()
Return the first declaration of this declaration or itself if this is the only declaration.
unsigned getNumExpansionTypes() const
Retrieves the number of expansion types in an expanded parameter pack.
unsigned getDepth() const
Get the depth of this template parameter list in the set of template parameter lists.
spec_iterator spec_end() const
static TemplateParameterList * Create(const ASTContext &C, SourceLocation TemplateLoc, SourceLocation LAngleLoc, ArrayRef< NamedDecl * > Params, SourceLocation RAngleLoc)
void setPointOfInstantiation(SourceLocation POI)
Set the (first) point of instantiation of this function template specialization.
OnStackType
Type used to indicate that the template argument list itself is a stack object.
NamedDecl * getInstantiatedFrom() const
Retrieve the member declaration from which this member was instantiated.
static bool classofKind(Kind K)
spec_iterator spec_begin() const
Stores a list of template parameters for a TemplateDecl and its derived classes.
bool isInjectedClassName() const
Determines whether this declaration represents the injected class name.
TypeSourceInfo * getDefaultArgumentInfo() const
Retrieves the default argument's source information, if any.
QualType InjectedClassNameType
The injected-class-name type for this class template.
static bool classofKind(Kind K)
const ASTTemplateArgumentListInfo * TemplateArgumentsAsWritten
The template arguments as written in the sources, if provided.
Encodes a location in the source.
ClassTemplateDecl * getPreviousDecl()
Retrieve the previous declaration of this class template, or NULL if no such declaration exists...
const TemplateArgument * iterator
void LoadLazySpecializations() const
Load any lazily-loaded specializations from the external source.
const TemplateArgumentListInfo & getTemplateArgsInfo() const
const TemplateArgument & operator[](unsigned Idx) const
Retrieve the template argument at a given index.
QualType getExpansionType(unsigned I) const
Retrieve a particular expansion type within an expanded parameter pack.
bool isValid() const
Return true if this is a valid SourceLocation object.
static bool classof(const Decl *D)
void setExternLoc(SourceLocation Loc)
Sets the location of the extern keyword.
ASTContext & getASTContext() const LLVM_READONLY
void setPosition(unsigned P)
TypeAliasDecl * getTemplatedDecl() const
Get the underlying function declaration of the template.
RedeclarableTemplateDecl * getInstantiatedFromMemberTemplate() const
Retrieve the member template from which this template was instantiated, or NULL if this template was ...
Represents a static or instance method of a struct/union/class.
TypeAliasTemplateDecl * getInstantiatedFromMemberTemplate() const
bool isMemberSpecialization()
Determines whether this variable template partial specialization was a specialization of a member par...
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)
BuiltinTemplateKind
Kinds of BuiltinTemplateDecl.
const ClassTemplateDecl * getMostRecentDecl() const
static bool classof(const Decl *D)
FunctionTemplateDecl(ASTContext &C, DeclContext *DC, SourceLocation L, DeclarationName Name, TemplateParameterList *Params, NamedDecl *Decl)
void init(NamedDecl *templatedDecl, TemplateParameterList *templateParams)
Initialize the underlying templated declaration and template parameters.
void setPointOfInstantiation(SourceLocation Loc)
FunctionTemplateDecl * getPreviousDecl()
Retrieve the previous declaration of this function template, or NULL if no such declaration exists...
CommonBase * Common
Pointer to the common data shared by all declarations of this template.
SourceLocation getPointOfInstantiation() const
Get the point of instantiation (if any), or null if none.
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.
static VarTemplateDecl * CreateDeserialized(ASTContext &C, unsigned ID)
Create an empty variable template node.
void setInstantiatedFromMember(VarTemplatePartialSpecializationDecl *PartialSpec)
static bool classofKind(Kind K)
static bool classofKind(Kind K)
SourceRange getSourceRange() const override LLVM_READONLY
Source range that this declaration covers.
const TemplateArgumentLoc & getTemplateArg(unsigned I) const
Returns the nth template argument.
static bool classofKind(Kind K)
void setDeclaredWithTypename(bool withTypename)
Set whether this template type parameter was declared with the 'typename' or 'class' keyword...
Represents a pack expansion of types.
NamedDecl * TemplatedDecl
void setTemplateSpecializationKind(TemplateSpecializationKind TSK)
Set the template specialization kind.
Represents a template argument.
TagTypeKind
The kind of a tag type.
llvm::PointerUnion3< TemplateTypeParmDecl *, NonTypeTemplateParmDecl *, TemplateTemplateParmDecl * > TemplateParameter
Stores a template parameter of any kind.
void setMemberSpecialization()
Note that this member template is a specialization.
void removeDefaultArgument()
Removes the default argument of this template parameter.
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
TemplateSpecializationKind getSpecializationKind() const
Determine the kind of specialization that this declaration represents.
llvm::PointerIntPair< RedeclarableTemplateDecl *, 1, bool > InstantiatedFromMember
The template from which this was most directly instantiated (or null).
static bool classof(const Decl *D)
The base class of all kinds of template declarations (e.g., class, function, etc.).
static ArrayRef< TemplateArgument > getTemplateArgs(FunctionTemplateSpecializationInfo *I)
ClassTemplateDecl * getInstantiatedFromMemberTemplate() const
const TemplateArgumentList & getTemplateArgs() const
Retrieve the template arguments of the variable template specialization.
static BuiltinTemplateDecl * Create(const ASTContext &C, DeclContext *DC, DeclarationName Name, BuiltinTemplateKind BTK)
bool isThisDeclarationADefinition() const
Returns whether this template declaration defines the primary class pattern.
bool isExplicitSpecialization() const
spec_iterator spec_begin() const
Reads an AST files chain containing the contents of a translation unit.
static bool classof(const Decl *D)
static bool classofKind(Kind K)
void setInheritedDefaultArgument(const ASTContext &C, TemplateTypeParmDecl *Prev)
Set that this default argument was inherited from another parameter.
const DefArgStorage & getDefaultArgStorage() const
TypeSourceInfo * getTypeAsWritten() const
Gets the type of this specialization as it was written by the user, if it was so written.
This template specialization was instantiated from a template due to an explicit instantiation declar...
TemplateSpecializationKind getTemplateSpecializationKind() const
Determine what kind of template specialization this is.
static VarTemplatePartialSpecializationDecl * CreateDeserialized(ASTContext &C, unsigned ID)
DeclarationName - The name of a declaration.
DefinitionKind isThisDeclarationADefinition(ASTContext &) const
Check whether this declaration is a definition.
static void Profile(llvm::FoldingSetNodeID &ID, ArrayRef< TemplateArgument > TemplateArgs, ASTContext &Context)
TemplateParameterList * TemplateParams
Storage for a default argument.
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. ...
bool defaultArgumentWasInherited() const
Determines whether the default argument was inherited from a previous declaration of this template...
uint32_t * LazySpecializations
If non-null, points to an array of specializations (including partial specializations) known only by ...
bool containsUnexpandedParameterPack() const
Determine whether this template parameter list contains an unexpanded parameter pack.
ClassTemplatePartialSpecializationDecl * getMostRecentDecl()
static bool classofKind(Kind K)
VarTemplateSpecializationDecl * findSpecialization(ArrayRef< TemplateArgument > Args, void *&InsertPos)
Return the specialization with the provided arguments if it exists, otherwise return the insertion po...
llvm::PointerUnion< VarTemplateDecl *, VarTemplatePartialSpecializationDecl * > getInstantiatedFrom() const
If this variable template specialization is an instantiation of a template (rather than an explicit s...
unsigned getDepth() const
Get the nesting depth of the template parameter.
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...
spec_range specializations() const
spec_range specializations() const
static VarTemplatePartialSpecializationDecl * Create(ASTContext &Context, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, TemplateParameterList *Params, VarTemplateDecl *SpecializedTemplate, QualType T, TypeSourceInfo *TInfo, StorageClass S, const TemplateArgument *Args, unsigned NumArgs, const TemplateArgumentListInfo &ArgInfos)
void setTemplateKeywordLoc(SourceLocation Loc)
Sets the location of the template keyword.
static bool classofKind(Kind K)
Common * getCommonPtr() const
const_iterator end() const
Location wrapper for a TemplateArgument.
VarDecl * getTemplatedDecl() const
Get the underlying variable declarations of the template.
static VarTemplateSpecializationDecl * Create(ASTContext &Context, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, VarTemplateDecl *SpecializedTemplate, QualType T, TypeSourceInfo *TInfo, StorageClass S, const TemplateArgument *Args, unsigned NumArgs)
static bool classof(const OMPClause *T)
void setInstantiatedFromMemberTemplate(RedeclarableTemplateDecl *TD)
bool isThisDeclarationADefinition() const
Returns whether this template declaration defines the primary variable pattern.
SourceLocation getPointOfInstantiation() const
Retrieve the first point of instantiation of this member.
This template specialization was declared or defined by an explicit specialization (C++ [temp...
ClassTemplatePartialSpecializationDecl * getInstantiatedFromMember() const
Retrieve the member class template partial specialization from which this particular class template p...
DeclType * operator->() const
static DeclType * getDecl(FunctionTemplateSpecializationInfo *I)
VarTemplateDecl * getPreviousDecl()
Retrieve the previous declaration of this variable template, or NULL if no such declaration exists...
RedeclarableTemplateDecl * getCanonicalDecl() override
Retrieves the canonical declaration of this template.
ClassTemplateDecl * getCanonicalDecl() override
Retrieves the canonical declaration of this template.
unsigned getNumTemplateArgs() const
Returns the number of explicit template arguments that were given.
bool isExplicitInstantiationOrSpecialization() const
True if this declaration is an explicit specialization, explicit instantiation declaration, or explicit instantiation definition.
TypeAliasTemplateDecl * getCanonicalDecl() override
Retrieves the canonical declaration of this template.
const VarTemplateDecl * getMostRecentDecl() const
void setInstantiationOf(VarTemplatePartialSpecializationDecl *PartialSpec, const TemplateArgumentList *TemplateArgs)
Note that this variable template specialization is actually an instantiation of the given variable te...
SpecIterator(typename llvm::FoldingSetVector< EntryType >::iterator SetIter)
static VarTemplateSpecializationDecl * CreateDeserialized(ASTContext &C, unsigned ID)
const FunctionTemplateDecl * getPreviousDecl() const
Retrieve the previous declaration of this function template, or NULL if no such declaration exists...
TemplateDecl(Kind DK, DeclContext *DC, SourceLocation L, DeclarationName Name, TemplateParameterList *Params, NamedDecl *Decl)
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).
NamedDecl * getTemplatedDecl() const
Get the underlying, templated declaration.
bool isSet() const
Determine whether there is a default argument for this parameter.
VarTemplateDecl * getMostRecentDecl()
static bool classof(const Decl *D)
Represents a C++ struct/union/class.
ArrayRef< const NamedDecl * > asArray() const
TemplateSpecializationKind getTemplateSpecializationKind() const
Determine what kind of template specialization this is.
CommonBase * newCommon(ASTContext &C) const override
bool isExpandedParameterPack() const
Whether this parameter is a template template parameter pack that has a known list of different templ...
Provides information a specialization of a member of a class template, which may be a member function...
static bool classof(const Decl *D)
VarTemplateDecl(ASTContext &C, DeclContext *DC, SourceLocation L, DeclarationName Name, TemplateParameterList *Params, NamedDecl *Decl)
VarTemplateSpecializationDecl(Kind DK, ASTContext &Context, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, VarTemplateDecl *SpecializedTemplate, QualType T, TypeSourceInfo *TInfo, StorageClass S, const TemplateArgument *Args, unsigned NumArgs)
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.
llvm::PointerUnion< NamedDecl *, TypeSourceInfo * > FriendUnion
TemplateParameterList * getTemplateParameters() const
Get the list of template parameters.
bool isExpandedParameterPack() const
Whether this parameter is a non-type template parameter pack that has a known list of different types...
VarTemplateDecl * getCanonicalDecl() override
Retrieves the canonical declaration of this template.
void removeDefaultArgument()
Removes the default argument of this template parameter.
static SpecIterator< EntryType > makeSpecIterator(llvm::FoldingSetVector< EntryType > &Specs, bool isEnd)
void setExternLoc(SourceLocation Loc)
Sets the location of the extern keyword.
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 ...
const ClassTemplateDecl * getPreviousDecl() const
Retrieve the previous declaration of this class template, or NULL if no such declaration exists...
Kind
Lists the kind of concrete classes of Decl.
llvm::FoldingSetVector< VarTemplateSpecializationDecl > Specializations
The variable template specializations for this variable template, including explicit specializations ...
TemplateParameterList * getTemplateParameterList(unsigned i) const
TemplateDecl(Kind DK, DeclContext *DC, SourceLocation L, DeclarationName Name)
Common * getCommonPtr() const
llvm::FoldingSetVector< ClassTemplateSpecializationDecl > Specializations
The class template specializations for this class template, including explicit specializations and in...
SourceLocation getRAngleLoc() const
bool isPackExpansion() const
Whether this parameter pack is a pack expansion.
void setMemberSpecialization()
Note that this member template is a specialization.
void setInheritedDefaultArgument(const ASTContext &C, TemplateTemplateParmDecl *Prev)
const_iterator begin() const
const FunctionTemplateDecl * getMostRecentDecl() const
SourceLocation getLAngleLoc() const
A trivial tuple used to represent a source range.
NamedDecl - This represents a decl with a name.
Declaration of a friend template.
const TypeAliasTemplateDecl * getPreviousDecl() const
Retrieve the previous declaration of this function template, or NULL if no such declaration exists...
void setTypeAsWritten(TypeSourceInfo *T)
Sets the type of this specialization as it was written by the user.
void setPointOfInstantiation(SourceLocation POI)
Set the first point of instantiation.
TemplateParameterList(SourceLocation TemplateLoc, SourceLocation LAngleLoc, ArrayRef< NamedDecl * > Params, SourceLocation RAngleLoc)
VarTemplateDecl * getDefinition()
bool isExplicitSpecialization() const
SourceRange getSourceRange() const LLVM_READONLY
const ParmDecl * getInheritedFrom() const
Get the parameter from which we inherit the default argument, if any.
Declaration of a template function.
llvm::FoldingSetVector< VarTemplatePartialSpecializationDecl > & getPartialSpecializations()
Retrieve the set of partial specializations of this class template.
unsigned getIndex() const
Get the index of the template parameter within its parameter list.
spec_iterator spec_end() const
SourceLocation getTemplateLoc() const
FunctionTemplateDecl * getMostRecentDecl()