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"
30 class TemplateParameterList;
32 class RedeclarableTemplateDecl;
33 class FunctionTemplateDecl;
34 class ClassTemplateDecl;
35 class ClassTemplatePartialSpecializationDecl;
36 class TemplateTypeParmDecl;
37 class NonTypeTemplateParmDecl;
38 class TemplateTemplateParmDecl;
39 class TypeAliasTemplateDecl;
40 class VarTemplateDecl;
60 unsigned NumParams : 31;
64 unsigned ContainsUnexpandedParameterPack : 1;
92 unsigned size()
const {
return NumParams; }
95 return llvm::makeArrayRef(
begin(),
end());
98 return llvm::makeArrayRef(
begin(),
size());
102 assert(Idx <
size() &&
"Template parameter index out-of-range");
107 assert(Idx <
size() &&
"Template parameter index out-of-range");
128 return ContainsUnexpandedParameterPack;
159 : List(TemplateLoc, LAngleLoc, Params, RAngleLoc) {
163 assert(
sizeof(*
this) ==
164 TemplateParameterList::totalSizeToAlloc<NamedDecl *>(N) &&
165 "Object layout not as expected");
166 assert(this->Params == List.getTrailingObjects<
NamedDecl *>() &&
167 "Object layout not as expected");
180 unsigned NumArguments;
204 : Arguments(Args.
data()), NumArguments(Args.
size()) {}
213 : Arguments(Other->
data()), NumArguments(Other->
size()) {}
217 assert(Idx < NumArguments &&
"Invalid template argument index");
226 return llvm::makeArrayRef(
data(),
size());
231 unsigned size()
const {
return NumArguments; }
249 template<
typename ParmDecl,
typename ArgType>
255 ParmDecl *PrevDeclWithDefaultArg;
258 static_assert(
sizeof(Chain) ==
sizeof(
void *) * 2,
259 "non-pointer argument type?");
261 llvm::PointerUnion3<ArgType, ParmDecl*, Chain*> ValueOrInherited;
263 static ParmDecl *getParmOwningDefaultArg(ParmDecl *Parm) {
265 if (
auto *Prev = Storage.ValueOrInherited.template dyn_cast<ParmDecl*>())
267 assert(!Parm->getDefaultArgStorage()
268 .ValueOrInherited.template is<ParmDecl *>() &&
269 "should only be one level of indirection");
277 bool isSet()
const {
return !ValueOrInherited.isNull(); }
280 bool isInherited()
const {
return ValueOrInherited.template is<ParmDecl*>(); }
283 ArgType
get()
const {
285 if (
auto *Prev = ValueOrInherited.template dyn_cast<ParmDecl*>())
286 Storage = &Prev->getDefaultArgStorage();
287 if (
auto *C = Storage->ValueOrInherited.template dyn_cast<Chain*>())
289 return Storage->ValueOrInherited.template get<ArgType>();
294 if (
auto *D = ValueOrInherited.template dyn_cast<ParmDecl*>())
296 if (
auto *C = ValueOrInherited.template dyn_cast<Chain*>())
297 return C->PrevDeclWithDefaultArg;
302 assert(!
isSet() &&
"default argument already set");
303 ValueOrInherited = Arg;
307 assert(!
isInherited() &&
"default argument already inherited");
308 InheritedFrom = getParmOwningDefaultArg(InheritedFrom);
310 ValueOrInherited = InheritedFrom;
313 Chain{InheritedFrom, ValueOrInherited.template get<ArgType>()};
317 ValueOrInherited = ArgType();
331 void anchor()
override;
336 TemplateParams(nullptr) {}
343 TemplateParams(Params) {}
349 TemplateParams(Params) {}
354 return TemplateParams;
361 static bool classof(
const Decl *D) {
return classofKind(D->getKind()); }
363 return K >= firstTemplate && K <= lastTemplate;
367 return SourceRange(TemplateParams->getTemplateLoc(),
368 TemplatedDecl.getPointer()->getSourceRange().getEnd());
372 bool isConcept()
const {
return TemplatedDecl.getInt(); }
389 assert(!TemplatedDecl.getPointer() &&
"TemplatedDecl already set!");
390 assert(!TemplateParams &&
"TemplateParams already set!");
391 TemplatedDecl.setPointer(templatedDecl);
392 TemplateParams = templateParams;
407 Template(Template, TSK - 1),
408 TemplateArguments(TemplateArgs),
409 TemplateArgumentsAsWritten(TemplateArgsAsWritten),
410 PointOfInstantiation(POI) { }
428 llvm::PointerIntPair<FunctionTemplateDecl *, 2>
Template;
464 "Cannot encode TSK_Undeclared for a function template specialization");
465 Template.setInt(TSK - 1);
474 return PointOfInstantiation;
480 PointOfInstantiation = POI;
484 Profile(ID, TemplateArguments->asArray(),
485 Function->getASTContext());
491 ID.AddInteger(TemplateArgs.size());
493 TemplateArg.Profile(ID, Context);
503 llvm::PointerIntPair<NamedDecl *, 2> MemberAndTSK;
512 : MemberAndTSK(IF, TSK - 1), PointOfInstantiation(POI) {
514 "Cannot encode undeclared template specializations for members");
533 "Cannot encode undeclared template specializations for members");
534 MemberAndTSK.setInt(TSK - 1);
541 return PointOfInstantiation;
546 PointOfInstantiation = POI;
567 FunctionTemplateDecl *> {
569 unsigned NumTemplates;
577 size_t numTrailingObjects(OverloadToken<TemplateArgumentLoc>)
const {
580 size_t numTrailingObjects(OverloadToken<FunctionTemplateDecl *>)
const {
599 assert(I < getNumTemplates() &&
"template index out of range");
600 return getTrailingObjects<FunctionTemplateDecl *>()[I];
605 return getTrailingObjects<TemplateArgumentLoc>();
613 assert(I < getNumTemplateArgs() &&
"template arg index out of range");
614 return getTemplateArgs()[
I];
618 return AngleLocs.getBegin();
622 return AngleLocs.getEnd();
634 return getNextRedeclaration();
637 return getPreviousDecl();
640 return getMostRecentDecl();
651 return D->getTemplateArgs().asArray();
655 template <
typename EntryType,
typename SETraits = SpecEntryTraits<EntryType>,
656 typename DeclType =
typename SETraits::DeclType>
658 : llvm::iterator_adaptor_base<
659 SpecIterator<EntryType, SETraits, DeclType>,
660 typename llvm::FoldingSetVector<EntryType>::iterator,
661 typename std::iterator_traits<typename llvm::FoldingSetVector<
662 EntryType>::iterator>::iterator_category,
663 DeclType *, ptrdiff_t, DeclType *, DeclType *> {
667 :
SpecIterator::iterator_adaptor_base(std::move(SetIter)) {}
670 return SETraits::getDecl(&*this->
I)->getMostRecentDecl();
675 template <
typename EntryType>
676 static SpecIterator<EntryType>
681 template <
class EntryType>
typename SpecEntryTraits<EntryType>::DeclType*
682 findSpecializationImpl(llvm::FoldingSetVector<EntryType> &Specs,
685 template <
class Derived,
class EntryType>
686 void addSpecializationImpl(llvm::FoldingSetVector<EntryType> &Specs,
687 EntryType *Entry,
void *InsertPos);
697 llvm::PointerIntPair<RedeclarableTemplateDecl*, 1, bool>
720 template <
class decl_type>
friend class RedeclarableTemplate;
724 return getFirstDecl();
727 return getFirstDecl();
749 return getCommonPtr()->InstantiatedFromMember.getInt();
754 assert(getCommonPtr()->InstantiatedFromMember.getPointer() &&
755 "Only member templates can be member template specializations");
756 getCommonPtr()->InstantiatedFromMember.setInt(
true);
796 return getCommonPtr()->InstantiatedFromMember.getPointer();
800 assert(!getCommonPtr()->InstantiatedFromMember.getPointer());
801 getCommonPtr()->InstantiatedFromMember.setPointer(TD);
806 using redeclarable_base::redecls_begin;
807 using redeclarable_base::redecls_end;
808 using redeclarable_base::redecls;
809 using redeclarable_base::getPreviousDecl;
810 using redeclarable_base::getMostRecentDecl;
811 using redeclarable_base::isFirstDecl;
814 static bool classof(
const Decl *D) {
return classofKind(D->getKind()); }
816 return K >= firstRedeclarableTemplate && K <= lastRedeclarableTemplate;
839 static void DeallocateCommon(
void *Ptr);
845 Common() : InjectedArgs(), LazySpecializations() { }
884 llvm::FoldingSetVector<FunctionTemplateSpecializationInfo> &
885 getSpecializations()
const;
896 void LoadLazySpecializations()
const;
900 return static_cast<FunctionDecl *
>(TemplatedDecl.getPointer());
906 return getTemplatedDecl()->isThisDeclarationADefinition();
915 return cast<FunctionTemplateDecl>(
919 return cast<FunctionTemplateDecl>(
926 return cast_or_null<FunctionTemplateDecl>(
933 return cast_or_null<FunctionTemplateDecl>(
938 return cast<FunctionTemplateDecl>(
940 ->getMostRecentDecl());
947 return cast_or_null<FunctionTemplateDecl>(
958 return makeSpecIterator(getSpecializations(),
false);
962 return makeSpecIterator(getSpecializations(),
true);
985 static bool classof(
const Decl *D) {
return classofKind(D->getKind()); }
1052 :
TypeDecl(TemplateTypeParm, DC, IdLoc, Id, KeyLoc), Typename(Typename),
1053 DefaultArgument() { }
1062 unsigned D,
unsigned P,
1064 bool ParameterPack);
1082 return DefaultArgument.get()->getType();
1087 return DefaultArgument.get();
1096 return DefaultArgument.isInherited();
1101 DefaultArgument.set(DefArg);
1107 DefaultArgument.setInherited(C, Prev);
1112 DefaultArgument.clear();
1120 unsigned getDepth()
const;
1123 unsigned getIndex()
const;
1126 bool isParameterPack()
const;
1131 static
bool classof(const
Decl *D) {
return classofKind(D->getKind()); }
1144 std::pair<QualType, TypeSourceInfo *>> {
1159 bool ExpandedParameterPack;
1162 unsigned NumExpandedTypes;
1164 size_t numTrailingObjects(
1165 OverloadToken<std::pair<QualType, TypeSourceInfo *>>)
const {
1166 return NumExpandedTypes;
1173 :
DeclaratorDecl(NonTypeTemplateParm, DC, IdLoc, Id, T, TInfo, StartLoc),
1175 ExpandedParameterPack(
false), NumExpandedTypes(0)
1204 unsigned NumExpandedTypes);
1229 return DefaultArgument.isInherited();
1238 DefaultArgument.setInherited(C, Parm);
1293 assert(ExpandedParameterPack &&
"Not an expansion parameter pack");
1294 return NumExpandedTypes;
1300 assert(I < NumExpandedTypes &&
"Out-of-range expansion type index");
1301 auto TypesAndInfos =
1302 getTrailingObjects<std::pair<QualType, TypeSourceInfo *>>();
1303 return TypesAndInfos[
I].first;
1309 assert(I < NumExpandedTypes &&
"Out-of-range expansion type index");
1310 auto TypesAndInfos =
1311 getTrailingObjects<std::pair<QualType, TypeSourceInfo *>>();
1312 return TypesAndInfos[
I].second;
1316 static bool classof(
const Decl *D) {
return classofKind(D->getKind()); }
1331 TemplateParameterList *> {
1332 void anchor()
override;
1345 bool ExpandedParameterPack;
1348 unsigned NumExpandedParams;
1351 unsigned D,
unsigned P,
bool ParameterPack,
1353 :
TemplateDecl(TemplateTemplateParm, DC, L, Id, Params),
1355 ExpandedParameterPack(
false), NumExpandedParams(0)
1359 unsigned D,
unsigned P,
1366 unsigned P,
bool ParameterPack,
1380 unsigned NumExpansions);
1399 return ParameterPack &&
1400 getTemplateParameters()->containsUnexpandedParameterPack();
1426 assert(ExpandedParameterPack &&
"Not an expansion parameter pack");
1427 return NumExpandedParams;
1433 assert(I < NumExpandedParams &&
"Out-of-range expansion type index");
1434 return getTrailingObjects<TemplateParameterList *>()[I];
1446 return DefaultArgument.isSet() ? *DefaultArgument.get() :
None;
1455 return DefaultArgument.isInherited();
1465 DefaultArgument.setInherited(C, Prev);
1473 if (hasDefaultArgument() && !defaultArgumentWasInherited())
1474 End = getDefaultArgument().getSourceRange().getEnd();
1475 return SourceRange(getTemplateParameters()->getTemplateLoc(), End);
1479 static bool classof(
const Decl *D) {
return classofKind(D->getKind()); }
1491 void anchor()
override;
1500 static bool classof(
const Decl *D) {
return classofKind(D->getKind()); }
1535 struct SpecializedPartialSpecialization {
1546 llvm::PointerUnion<ClassTemplateDecl *, SpecializedPartialSpecialization *>
1547 SpecializedTemplate;
1550 struct ExplicitSpecializationInfo {
1558 ExplicitSpecializationInfo()
1559 : TypeAsWritten(
nullptr), ExternLoc(), TemplateKeywordLoc() {}
1564 ExplicitSpecializationInfo *ExplicitInfo;
1574 unsigned SpecializationKind : 3;
1596 void getNameForDiagnostic(raw_ostream &OS,
const PrintingPolicy &Policy,
1597 bool Qualified)
const override;
1606 this)->getMostRecentDecl();
1607 while (!isa<ClassTemplateSpecializationDecl>(Recent)) {
1612 return cast<ClassTemplateSpecializationDecl>(Recent);
1621 return *TemplateArgs;
1643 SpecializationKind = TSK;
1648 return PointOfInstantiation;
1652 assert(Loc.
isValid() &&
"point of instantiation must be valid!");
1653 PointOfInstantiation = Loc;
1667 return getSpecializedTemplateOrPartial();
1675 if (SpecializedPartialSpecialization *PartialSpec
1676 = SpecializedTemplate.dyn_cast<SpecializedPartialSpecialization*>())
1677 return PartialSpec->PartialSpecialization;
1694 if (SpecializedPartialSpecialization *PartialSpec
1695 = SpecializedTemplate.dyn_cast<SpecializedPartialSpecialization*>())
1696 return *PartialSpec->TemplateArgs;
1698 return getTemplateArgs();
1706 assert(!SpecializedTemplate.is<SpecializedPartialSpecialization*>() &&
1707 "Already set to a class template partial specialization!");
1708 SpecializedPartialSpecialization *PS
1709 =
new (getASTContext()) SpecializedPartialSpecialization();
1710 PS->PartialSpecialization = PartialSpec;
1711 PS->TemplateArgs = TemplateArgs;
1712 SpecializedTemplate = PS;
1718 assert(!SpecializedTemplate.is<SpecializedPartialSpecialization*>() &&
1719 "Previously set to a class template partial specialization!");
1720 SpecializedTemplate = TemplDecl;
1727 ExplicitInfo =
new (getASTContext()) ExplicitSpecializationInfo;
1728 ExplicitInfo->TypeAsWritten = T;
1733 return ExplicitInfo ? ExplicitInfo->TypeAsWritten :
nullptr;
1738 return ExplicitInfo ? ExplicitInfo->ExternLoc :
SourceLocation();
1743 ExplicitInfo =
new (getASTContext()) ExplicitSpecializationInfo;
1744 ExplicitInfo->ExternLoc = Loc;
1750 ExplicitInfo =
new (getASTContext()) ExplicitSpecializationInfo;
1751 ExplicitInfo->TemplateKeywordLoc = Loc;
1755 return ExplicitInfo ? ExplicitInfo->TemplateKeywordLoc :
SourceLocation();
1761 Profile(ID, TemplateArgs->asArray(), getASTContext());
1767 ID.AddInteger(TemplateArgs.size());
1769 TemplateArg.Profile(ID, Context);
1772 static bool classof(
const Decl *D) {
return classofKind(D->getKind()); }
1774 return K >= firstClassTemplateSpecialization &&
1775 K <= lastClassTemplateSpecialization;
1784 void anchor()
override;
1798 llvm::PointerIntPair<ClassTemplatePartialSpecializationDecl *, 1, bool>
1799 InstantiatedFromMember;
1813 TemplateParams(
nullptr), ArgsAsWritten(
nullptr),
1814 InstantiatedFromMember(
nullptr,
false) {}
1831 return cast<ClassTemplatePartialSpecializationDecl>(
1833 this)->getMostRecentDecl());
1838 return TemplateParams;
1843 return ArgsAsWritten;
1868 cast<ClassTemplatePartialSpecializationDecl>(getFirstDecl());
1869 return First->InstantiatedFromMember.getPointer();
1873 return getInstantiatedFromMember();
1879 cast<ClassTemplatePartialSpecializationDecl>(getFirstDecl());
1880 First->InstantiatedFromMember.setPointer(PartialSpec);
1901 cast<ClassTemplatePartialSpecializationDecl>(getFirstDecl());
1902 return First->InstantiatedFromMember.getInt();
1908 cast<ClassTemplatePartialSpecializationDecl>(getFirstDecl());
1909 assert(First->InstantiatedFromMember.getPointer() &&
1910 "Only member templates can be member template specializations");
1911 return First->InstantiatedFromMember.setInt(
true);
1918 assert(getTypeForDecl() &&
"partial specialization has no type set!");
1919 return cast<InjectedClassNameType>(getTypeForDecl())
1920 ->getInjectedSpecializationType();
1925 static bool classof(
const Decl *D) {
return classofKind(D->getKind()); }
1927 return K == ClassTemplatePartialSpecialization;
1936 static void DeallocateCommon(
void *Ptr);
1950 llvm::FoldingSetVector<ClassTemplatePartialSpecializationDecl>
1965 llvm::FoldingSetVector<ClassTemplateSpecializationDecl> &
1966 getSpecializations()
const;
1970 llvm::FoldingSetVector<ClassTemplatePartialSpecializationDecl> &
1971 getPartialSpecializations();
1986 void LoadLazySpecializations()
const;
1990 return static_cast<CXXRecordDecl *
>(TemplatedDecl.getPointer());
1996 return getTemplatedDecl()->isThisDeclarationADefinition();
2020 return cast<ClassTemplateDecl>(
2024 return cast<ClassTemplateDecl>(
2031 return cast_or_null<ClassTemplateDecl>(
2038 return cast_or_null<ClassTemplateDecl>(
2040 this)->getPreviousDecl());
2044 return cast<ClassTemplateDecl>(
2052 return cast_or_null<ClassTemplateDecl>(
2067 void getPartialSpecializations(
2089 findPartialSpecInstantiatedFromMember(
2106 QualType getInjectedClassNameSpecialization();
2116 return makeSpecIterator(getSpecializations(),
false);
2120 return makeSpecIterator(getSpecializations(),
true);
2124 static bool classof(
const Decl *D) {
return classofKind(D->getKind()); }
2145 virtual void anchor();
2165 :
Decl(
Decl::FriendTemplate, DC, Loc), NumParams(Params.size()),
2166 Params(Params.data()), Friend(Friend), FriendLoc(FriendLoc) {}
2169 :
Decl(
Decl::FriendTemplate, Empty),
2175 static FriendTemplateDecl *
2177 MutableArrayRef<TemplateParameterList *> Params, FriendUnion Friend,
2178 SourceLocation FriendLoc);
2180 static FriendTemplateDecl *CreateDeserialized(
ASTContext &C,
unsigned ID);
2202 assert(i <= NumParams);
2211 static bool classof(
const Decl *D) {
return classofKind(D->getKind()); }
2224 static void DeallocateCommon(
void *Ptr);
2244 return static_cast<TypeAliasDecl *
>(TemplatedDecl.getPointer());
2249 return cast<TypeAliasTemplateDecl>(
2253 return cast<TypeAliasTemplateDecl>(
2260 return cast_or_null<TypeAliasTemplateDecl>(
2267 return cast_or_null<TypeAliasTemplateDecl>(
2269 this)->getPreviousDecl());
2273 return cast_or_null<TypeAliasTemplateDecl>(
2289 static bool classof(
const Decl *D) {
return classofKind(D->getKind()); }
2313 virtual void anchor();
2318 :
Decl(Decl::ClassScopeFunctionSpecialization, DC, Loc),
2319 Specialization(FD), HasExplicitTemplateArgs(Args),
2320 TemplateArgs(std::move(TemplArgs)) {}
2323 :
Decl(Decl::ClassScopeFunctionSpecialization, Empty) {}
2326 bool HasExplicitTemplateArgs;
2338 bool HasExplicitTemplateArgs,
2341 DC, Loc, FD, HasExplicitTemplateArgs, std::move(TemplateArgs));
2348 static bool classof(
const Decl *D) {
return classofKind(D->getKind()); }
2350 return K == Decl::ClassScopeFunctionSpecialization;
2375 public llvm::FoldingSetNode {
2380 struct SpecializedPartialSpecialization {
2391 llvm::PointerUnion<VarTemplateDecl *, SpecializedPartialSpecialization *>
2392 SpecializedTemplate;
2395 struct ExplicitSpecializationInfo {
2403 ExplicitSpecializationInfo()
2404 : TypeAsWritten(
nullptr), ExternLoc(), TemplateKeywordLoc() {}
2409 ExplicitSpecializationInfo *ExplicitInfo;
2420 unsigned SpecializationKind : 3;
2442 bool Qualified)
const override;
2446 return cast<VarTemplateSpecializationDecl>(Recent);
2460 return TemplateArgsInfo;
2482 SpecializationKind = TSK;
2487 return PointOfInstantiation;
2491 assert(Loc.
isValid() &&
"point of instantiation must be valid!");
2492 PointOfInstantiation = Loc;
2499 llvm::PointerUnion<VarTemplateDecl *, VarTemplatePartialSpecializationDecl *>
2510 llvm::PointerUnion<VarTemplateDecl *, VarTemplatePartialSpecializationDecl *>
2512 if (SpecializedPartialSpecialization *PartialSpec =
2513 SpecializedTemplate.dyn_cast<SpecializedPartialSpecialization *>())
2514 return PartialSpec->PartialSpecialization;
2531 if (SpecializedPartialSpecialization *PartialSpec =
2532 SpecializedTemplate.dyn_cast<SpecializedPartialSpecialization *>())
2533 return *PartialSpec->TemplateArgs;
2543 assert(!SpecializedTemplate.is<SpecializedPartialSpecialization *>() &&
2544 "Already set to a variable template partial specialization!");
2545 SpecializedPartialSpecialization *PS =
2546 new (getASTContext()) SpecializedPartialSpecialization();
2547 PS->PartialSpecialization = PartialSpec;
2548 PS->TemplateArgs = TemplateArgs;
2549 SpecializedTemplate = PS;
2555 assert(!SpecializedTemplate.is<SpecializedPartialSpecialization *>() &&
2556 "Previously set to a variable template partial specialization!");
2557 SpecializedTemplate = TemplDecl;
2564 ExplicitInfo =
new (getASTContext()) ExplicitSpecializationInfo;
2565 ExplicitInfo->TypeAsWritten = T;
2570 return ExplicitInfo ? ExplicitInfo->TypeAsWritten :
nullptr;
2575 return ExplicitInfo ? ExplicitInfo->ExternLoc :
SourceLocation();
2580 ExplicitInfo =
new (getASTContext()) ExplicitSpecializationInfo;
2581 ExplicitInfo->ExternLoc = Loc;
2587 ExplicitInfo =
new (getASTContext()) ExplicitSpecializationInfo;
2588 ExplicitInfo->TemplateKeywordLoc = Loc;
2592 return ExplicitInfo ? ExplicitInfo->TemplateKeywordLoc :
SourceLocation();
2602 ID.AddInteger(TemplateArgs.size());
2604 TemplateArg.Profile(ID, Context);
2609 return K >= firstVarTemplateSpecialization &&
2610 K <= lastVarTemplateSpecialization;
2619 void anchor()
override;
2633 llvm::PointerIntPair<VarTemplatePartialSpecializationDecl *, 1, bool>
2634 InstantiatedFromMember;
2645 TemplateParams(
nullptr), ArgsAsWritten(
nullptr),
2646 InstantiatedFromMember(
nullptr,
false) {}
2660 return cast<VarTemplatePartialSpecializationDecl>(
2667 return TemplateParams;
2672 return ArgsAsWritten;
2697 cast<VarTemplatePartialSpecializationDecl>(
getFirstDecl());
2698 return First->InstantiatedFromMember.getPointer();
2704 cast<VarTemplatePartialSpecializationDecl>(
getFirstDecl());
2705 First->InstantiatedFromMember.setPointer(PartialSpec);
2726 cast<VarTemplatePartialSpecializationDecl>(
getFirstDecl());
2727 return First->InstantiatedFromMember.getInt();
2733 cast<VarTemplatePartialSpecializationDecl>(
getFirstDecl());
2734 assert(First->InstantiatedFromMember.getPointer() &&
2735 "Only member templates can be member template specializations");
2736 return First->InstantiatedFromMember.setInt(
true);
2741 return K == VarTemplatePartialSpecialization;
2750 static void DeallocateCommon(
void *Ptr);
2764 llvm::FoldingSetVector<VarTemplatePartialSpecializationDecl>
2776 llvm::FoldingSetVector<VarTemplateSpecializationDecl> &
2781 llvm::FoldingSetVector<VarTemplatePartialSpecializationDecl> &
2840 return cast_or_null<VarTemplateDecl>(
2847 return cast_or_null<VarTemplateDecl>(
2853 return cast<VarTemplateDecl>(
2861 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.
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
Provides information about a dependent function-template specialization declaration.
Represents the builtin template declaration which is used to implement __make_integer_seq and other b...
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
VarTemplateSpecializationDecl(Kind DK, ASTContext &Context, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, VarTemplateDecl *SpecializedTemplate, QualType T, TypeSourceInfo *TInfo, StorageClass S, ArrayRef< TemplateArgument > Args)
class LLVM_ALIGNAS(8) DependentTemplateSpecializationType const IdentifierInfo * Name
Represents a template specialization type whose template cannot be resolved, e.g. ...
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.
static TemplateArgumentList * CreateCopy(ASTContext &Context, ArrayRef< TemplateArgument > Args)
Create a new template argument list that copies the given set of template arguments.
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
VarTemplateDecl * getInstantiatedFromMemberTemplate() const
SourceLocation getExternLoc() const
Gets the location of the extern keyword, if present.
SourceLocation getLAngleLoc() const
bool isParameterPack() const
Whether this parameter is a non-type template parameter pack.
SourceRange getSourceRange() const override LLVM_READONLY
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.
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.
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)
llvm::PointerIntPair< NamedDecl *, 1, bool > TemplatedDecl
The named declaration from which this template was instantiated.
ClassTemplatePartialSpecializationDecl * getInstantiatedFromMemberTemplate() const
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...
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.
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.
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.
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, Stmt *PreInit, Expr *PostUpdate)
Creates clause with a list of variables VL and a linear step Step.
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 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
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.
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.
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
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 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...
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...
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
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
const VarTemplateDecl * getMostRecentDecl() const
bool isConcept() const
Whether this is a (C++ Concepts TS) function or variable concept.
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)
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
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...
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.
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.
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()
TemplateArgumentList(OnStackType, ArrayRef< TemplateArgument > Args)
Construct a new, temporary template argument list on the stack.