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"
27 class TemplateParameterList;
29 class RedeclarableTemplateDecl;
30 class FunctionTemplateDecl;
31 class ClassTemplateDecl;
32 class ClassTemplatePartialSpecializationDecl;
33 class TemplateTypeParmDecl;
34 class NonTypeTemplateParmDecl;
35 class TemplateTemplateParmDecl;
36 class TypeAliasTemplateDecl;
37 class VarTemplateDecl;
55 unsigned NumParams : 31;
59 unsigned ContainsUnexpandedParameterPack : 1;
82 return reinterpret_cast<NamedDecl *
const *
>(
this + 1);
87 unsigned size()
const {
return NumParams; }
90 return llvm::makeArrayRef(
begin(),
end());
93 return llvm::makeArrayRef(
begin(),
size());
97 assert(Idx <
size() &&
"Template parameter index out-of-range");
102 assert(Idx <
size() &&
"Template parameter index out-of-range");
123 return ContainsUnexpandedParameterPack;
155 llvm::PointerIntPair<const TemplateArgument *, 1> Arguments;
159 unsigned NumArguments;
166 : Arguments(Args, Owned), NumArguments(NumArgs) { }
185 : Arguments(Args,
false), NumArguments(NumArgs) { }
194 : Arguments(Other->
data(),
false), NumArguments(Other->
size()) { }
198 assert(Idx < NumArguments &&
"Invalid template argument index");
207 return llvm::makeArrayRef(
data(),
size());
212 unsigned size()
const {
return NumArguments; }
216 return Arguments.getPointer();
230 template<
typename ParmDecl,
typename ArgType>
236 ParmDecl *PrevDeclWithDefaultArg;
239 static_assert(
sizeof(Chain) ==
sizeof(
void *) * 2,
240 "non-pointer argument type?");
242 llvm::PointerUnion3<ArgType, ParmDecl*, Chain*> ValueOrInherited;
244 static ParmDecl *getParmOwningDefaultArg(ParmDecl *Parm) {
246 if (
auto *Prev = Storage.ValueOrInherited.template dyn_cast<ParmDecl*>())
248 assert(!Parm->getDefaultArgStorage()
249 .ValueOrInherited.template is<ParmDecl *>() &&
250 "should only be one level of indirection");
258 bool isSet()
const {
return !ValueOrInherited.isNull(); }
261 bool isInherited()
const {
return ValueOrInherited.template is<ParmDecl*>(); }
264 ArgType
get()
const {
266 if (
auto *Prev = ValueOrInherited.template dyn_cast<ParmDecl*>())
267 Storage = &Prev->getDefaultArgStorage();
268 if (
auto *
C = Storage->ValueOrInherited.template dyn_cast<Chain*>())
270 return Storage->ValueOrInherited.template get<ArgType>();
275 if (
auto *D = ValueOrInherited.template dyn_cast<ParmDecl*>())
277 if (
auto *
C = ValueOrInherited.template dyn_cast<Chain*>())
278 return C->PrevDeclWithDefaultArg;
283 assert(!
isSet() &&
"default argument already set");
284 ValueOrInherited = Arg;
288 assert(!
isInherited() &&
"default argument already inherited");
289 InheritedFrom = getParmOwningDefaultArg(InheritedFrom);
291 ValueOrInherited = InheritedFrom;
294 Chain{InheritedFrom, ValueOrInherited.template get<ArgType>()};
298 ValueOrInherited = ArgType();
312 void anchor()
override;
317 :
NamedDecl(DK, DC, L, Name), TemplatedDecl(nullptr),
318 TemplateParams(nullptr) {}
324 :
NamedDecl(DK, DC, L, Name), TemplatedDecl(nullptr),
325 TemplateParams(Params) {}
331 :
NamedDecl(DK, DC, L, Name), TemplatedDecl(Decl),
332 TemplateParams(Params) { }
336 return TemplateParams;
345 return K >= firstTemplate && K <= lastTemplate;
349 return SourceRange(TemplateParams->getTemplateLoc(),
350 TemplatedDecl->getSourceRange().getEnd());
361 assert(!TemplatedDecl &&
"TemplatedDecl already set!");
362 assert(!TemplateParams &&
"TemplateParams already set!");
363 TemplatedDecl = templatedDecl;
364 TemplateParams = templateParams;
379 Template(Template, TSK - 1),
380 TemplateArguments(TemplateArgs),
381 TemplateArgumentsAsWritten(TemplateArgsAsWritten),
382 PointOfInstantiation(POI) { }
400 llvm::PointerIntPair<FunctionTemplateDecl *, 2>
Template;
439 llvm_unreachable(
"bad template specialization kind");
445 "Cannot encode TSK_Undeclared for a function template specialization");
446 Template.setInt(TSK - 1);
455 return PointOfInstantiation;
461 PointOfInstantiation = POI;
465 Profile(ID, TemplateArguments->asArray(),
466 Function->getASTContext());
472 ID.AddInteger(TemplateArgs.size());
473 for (
unsigned Arg = 0; Arg != TemplateArgs.size(); ++Arg)
474 TemplateArgs[Arg].Profile(ID, Context);
484 llvm::PointerIntPair<NamedDecl *, 2> MemberAndTSK;
493 : MemberAndTSK(IF, TSK - 1), PointOfInstantiation(POI) {
495 "Cannot encode undeclared template specializations for members");
514 "Cannot encode undeclared template specializations for members");
515 MemberAndTSK.setInt(TSK - 1);
522 return PointOfInstantiation;
527 PointOfInstantiation = POI;
548 unsigned NumTemplates;
569 DependentFunctionTemplateSpecializationInfo(
570 const UnresolvedSetImpl &Templates,
571 const TemplateArgumentListInfo &TemplateArgs);
576 return d.NumTemplates;
581 assert(I < getNumTemplates() &&
"template index out of range");
582 return getTemplates()[I];
588 &getTemplates()[getNumTemplates()]);
598 assert(I < getNumTemplateArgs() &&
"template arg index out of range");
599 return getTemplateArgs()[I];
603 return AngleLocs.getBegin();
607 return AngleLocs.getEnd();
617 return getNextRedeclaration();
620 return getPreviousDecl();
623 return getMostRecentDecl();
634 return D->getTemplateArgs().asArray();
638 template <
typename EntryType,
typename SETraits = SpecEntryTraits<EntryType>,
639 typename DeclType =
typename SETraits::DeclType>
641 : llvm::iterator_adaptor_base<
642 SpecIterator<EntryType, SETraits, DeclType>,
643 typename llvm::FoldingSetVector<EntryType>::iterator,
644 typename std::iterator_traits<typename llvm::FoldingSetVector<
645 EntryType>::iterator>::iterator_category,
646 DeclType *, ptrdiff_t, DeclType *, DeclType *> {
649 typename llvm::FoldingSetVector<EntryType>::iterator SetIter)
650 :
SpecIterator::iterator_adaptor_base(std::move(SetIter)) {}
653 return SETraits::getDecl(&*this->I)->getMostRecentDecl();
658 template <
typename EntryType>
659 static SpecIterator<EntryType>
664 template <
class EntryType>
typename SpecEntryTraits<EntryType>::DeclType*
665 findSpecializationImpl(llvm::FoldingSetVector<EntryType> &Specs,
668 template <
class Derived,
class EntryType>
669 void addSpecializationImpl(llvm::FoldingSetVector<EntryType> &Specs,
670 EntryType *Entry,
void *InsertPos);
680 llvm::PointerIntPair<RedeclarableTemplateDecl*, 1, bool>
703 template <
class decl_type>
friend class RedeclarableTemplate;
707 return getFirstDecl();
710 return getFirstDecl();
732 return getCommonPtr()->InstantiatedFromMember.getInt();
737 assert(getCommonPtr()->InstantiatedFromMember.getPointer() &&
738 "Only member templates can be member template specializations");
739 getCommonPtr()->InstantiatedFromMember.setInt(
true);
779 return getCommonPtr()->InstantiatedFromMember.getPointer();
783 assert(!getCommonPtr()->InstantiatedFromMember.getPointer());
784 getCommonPtr()->InstantiatedFromMember.setPointer(TD);
789 using redeclarable_base::redecls_begin;
790 using redeclarable_base::redecls_end;
791 using redeclarable_base::redecls;
792 using redeclarable_base::getPreviousDecl;
793 using redeclarable_base::getMostRecentDecl;
794 using redeclarable_base::isFirstDecl;
799 return K >= firstRedeclarableTemplate && K <= lastRedeclarableTemplate;
822 static void DeallocateCommon(
void *Ptr);
828 Common() : InjectedArgs(), LazySpecializations() { }
867 llvm::FoldingSetVector<FunctionTemplateSpecializationInfo> &
868 getSpecializations()
const;
879 void LoadLazySpecializations()
const;
889 return getTemplatedDecl()->isThisDeclarationADefinition();
898 return cast<FunctionTemplateDecl>(
902 return cast<FunctionTemplateDecl>(
909 return cast_or_null<FunctionTemplateDecl>(
916 return cast_or_null<FunctionTemplateDecl>(
921 return cast<FunctionTemplateDecl>(
923 ->getMostRecentDecl());
930 return cast_or_null<FunctionTemplateDecl>(
941 return makeSpecIterator(getSpecializations(),
false);
945 return makeSpecIterator(getSpecializations(),
true);
1035 :
TypeDecl(TemplateTypeParm, DC, IdLoc, Id, KeyLoc), Typename(Typename),
1036 DefaultArgument() { }
1045 unsigned D,
unsigned P,
1047 bool ParameterPack);
1065 return DefaultArgument.get()->getType();
1070 return DefaultArgument.get();
1079 return DefaultArgument.isInherited();
1084 DefaultArgument.set(DefArg);
1090 DefaultArgument.setInherited(C, Prev);
1095 DefaultArgument.clear();
1103 unsigned getDepth()
const;
1106 unsigned getIndex()
const;
1109 bool isParameterPack()
const;
1111 SourceRange getSourceRange() const override LLVM_READONLY;
1114 static
bool classof(const
Decl *D) {
return classofKind(D->getKind()); }
1139 bool ExpandedParameterPack;
1142 unsigned NumExpandedTypes;
1148 :
DeclaratorDecl(NonTypeTemplateParm, DC, IdLoc, Id, T, TInfo, StartLoc),
1150 ExpandedParameterPack(
false), NumExpandedTypes(0)
1158 unsigned NumExpandedTypes,
1173 const QualType *ExpandedTypes,
unsigned NumExpandedTypes,
1180 unsigned NumExpandedTypes);
1188 SourceRange getSourceRange() const override LLVM_READONLY;
1205 return DefaultArgument.isInherited();
1214 DefaultArgument.setInherited(C, Parm);
1269 assert(ExpandedParameterPack &&
"Not an expansion parameter pack");
1270 return NumExpandedTypes;
1276 assert(I < NumExpandedTypes &&
"Out-of-range expansion type index");
1277 void *
const *TypesAndInfos =
reinterpret_cast<void * const*
>(
this + 1);
1284 assert(I < NumExpandedTypes &&
"Out-of-range expansion type index");
1285 void *
const *TypesAndInfos =
reinterpret_cast<void * const*
>(
this + 1);
1304 void anchor()
override;
1317 bool ExpandedParameterPack;
1320 unsigned NumExpandedParams;
1323 unsigned D,
unsigned P,
bool ParameterPack,
1325 :
TemplateDecl(TemplateTemplateParm, DC, L, Id, Params),
1327 ExpandedParameterPack(
false), NumExpandedParams(0)
1331 unsigned D,
unsigned P,
1333 unsigned NumExpansions,
1339 unsigned P,
bool ParameterPack,
1353 unsigned NumExpansions);
1372 return ParameterPack &&
1373 getTemplateParameters()->containsUnexpandedParameterPack();
1399 assert(ExpandedParameterPack &&
"Not an expansion parameter pack");
1400 return NumExpandedParams;
1406 assert(I < NumExpandedParams &&
"Out-of-range expansion type index");
1419 return DefaultArgument.isSet() ? *DefaultArgument.get() :
None;
1428 return DefaultArgument.isInherited();
1438 DefaultArgument.setInherited(C, Prev);
1446 if (hasDefaultArgument() && !defaultArgumentWasInherited())
1447 End = getDefaultArgument().getSourceRange().getEnd();
1448 return SourceRange(getTemplateParameters()->getTemplateLoc(), End);
1478 struct SpecializedPartialSpecialization {
1489 llvm::PointerUnion<ClassTemplateDecl *, SpecializedPartialSpecialization *>
1490 SpecializedTemplate;
1493 struct ExplicitSpecializationInfo {
1501 ExplicitSpecializationInfo()
1502 : TypeAsWritten(
nullptr), ExternLoc(), TemplateKeywordLoc() {}
1507 ExplicitSpecializationInfo *ExplicitInfo;
1517 unsigned SpecializationKind : 3;
1541 void getNameForDiagnostic(raw_ostream &OS,
const PrintingPolicy &Policy,
1542 bool Qualified)
const override;
1551 this)->getMostRecentDecl();
1552 while (!isa<ClassTemplateSpecializationDecl>(Recent)) {
1557 return cast<ClassTemplateSpecializationDecl>(Recent);
1566 return *TemplateArgs;
1593 llvm_unreachable(
"bad template specialization kind");
1597 SpecializationKind = TSK;
1602 return PointOfInstantiation;
1606 assert(Loc.
isValid() &&
"point of instantiation must be valid!");
1607 PointOfInstantiation = Loc;
1621 return getSpecializedTemplateOrPartial();
1629 if (SpecializedPartialSpecialization *PartialSpec
1630 = SpecializedTemplate.dyn_cast<SpecializedPartialSpecialization*>())
1631 return PartialSpec->PartialSpecialization;
1648 if (SpecializedPartialSpecialization *PartialSpec
1649 = SpecializedTemplate.dyn_cast<SpecializedPartialSpecialization*>())
1650 return *PartialSpec->TemplateArgs;
1652 return getTemplateArgs();
1660 assert(!SpecializedTemplate.is<SpecializedPartialSpecialization*>() &&
1661 "Already set to a class template partial specialization!");
1662 SpecializedPartialSpecialization *PS
1663 =
new (getASTContext()) SpecializedPartialSpecialization();
1664 PS->PartialSpecialization = PartialSpec;
1665 PS->TemplateArgs = TemplateArgs;
1666 SpecializedTemplate = PS;
1672 assert(!SpecializedTemplate.is<SpecializedPartialSpecialization*>() &&
1673 "Previously set to a class template partial specialization!");
1674 SpecializedTemplate = TemplDecl;
1681 ExplicitInfo =
new (getASTContext()) ExplicitSpecializationInfo;
1682 ExplicitInfo->TypeAsWritten = T;
1687 return ExplicitInfo ? ExplicitInfo->TypeAsWritten :
nullptr;
1692 return ExplicitInfo ? ExplicitInfo->ExternLoc :
SourceLocation();
1697 ExplicitInfo =
new (getASTContext()) ExplicitSpecializationInfo;
1698 ExplicitInfo->ExternLoc = Loc;
1704 ExplicitInfo =
new (getASTContext()) ExplicitSpecializationInfo;
1705 ExplicitInfo->TemplateKeywordLoc = Loc;
1709 return ExplicitInfo ? ExplicitInfo->TemplateKeywordLoc :
SourceLocation();
1712 SourceRange getSourceRange() const override LLVM_READONLY;
1714 void Profile(llvm::FoldingSetNodeID &ID)
const {
1715 Profile(ID, TemplateArgs->asArray(), getASTContext());
1721 ID.AddInteger(TemplateArgs.size());
1722 for (
unsigned Arg = 0; Arg != TemplateArgs.size(); ++Arg)
1723 TemplateArgs[Arg].Profile(ID, Context);
1728 return K >= firstClassTemplateSpecialization &&
1729 K <= lastClassTemplateSpecialization;
1738 void anchor()
override;
1752 llvm::PointerIntPair<ClassTemplatePartialSpecializationDecl *, 1, bool>
1753 InstantiatedFromMember;
1768 TemplateParams(
nullptr), ArgsAsWritten(
nullptr),
1769 InstantiatedFromMember(
nullptr,
false) {}
1787 return cast<ClassTemplatePartialSpecializationDecl>(
1789 this)->getMostRecentDecl());
1794 return TemplateParams;
1799 return ArgsAsWritten;
1824 cast<ClassTemplatePartialSpecializationDecl>(getFirstDecl());
1825 return First->InstantiatedFromMember.getPointer();
1831 cast<ClassTemplatePartialSpecializationDecl>(getFirstDecl());
1832 First->InstantiatedFromMember.setPointer(PartialSpec);
1853 cast<ClassTemplatePartialSpecializationDecl>(getFirstDecl());
1854 return First->InstantiatedFromMember.getInt();
1860 cast<ClassTemplatePartialSpecializationDecl>(getFirstDecl());
1861 assert(First->InstantiatedFromMember.getPointer() &&
1862 "Only member templates can be member template specializations");
1863 return First->InstantiatedFromMember.setInt(
true);
1870 assert(getTypeForDecl() &&
"partial specialization has no type set!");
1871 return cast<InjectedClassNameType>(getTypeForDecl())
1872 ->getInjectedSpecializationType();
1879 return K == ClassTemplatePartialSpecialization;
1888 static void DeallocateCommon(
void *Ptr);
1902 llvm::FoldingSetVector<ClassTemplatePartialSpecializationDecl>
1917 llvm::FoldingSetVector<ClassTemplateSpecializationDecl> &
1918 getSpecializations()
const;
1922 llvm::FoldingSetVector<ClassTemplatePartialSpecializationDecl> &
1923 getPartialSpecializations();
1938 void LoadLazySpecializations()
const;
1948 return getTemplatedDecl()->isThisDeclarationADefinition();
1972 return cast<ClassTemplateDecl>(
1976 return cast<ClassTemplateDecl>(
1983 return cast_or_null<ClassTemplateDecl>(
1990 return cast_or_null<ClassTemplateDecl>(
1992 this)->getPreviousDecl());
1996 return cast<ClassTemplateDecl>(
2004 return cast_or_null<ClassTemplateDecl>(
2019 void getPartialSpecializations(
2041 findPartialSpecInstantiatedFromMember(
2058 QualType getInjectedClassNameSpecialization();
2068 return makeSpecIterator(getSpecializations(),
false);
2072 return makeSpecIterator(getSpecializations(),
true);
2097 virtual void anchor();
2120 :
Decl(
Decl::FriendTemplate, DC, Loc),
2124 FriendLoc(FriendLoc)
2128 :
Decl(
Decl::FriendTemplate, Empty),
2135 DeclContext *DC, SourceLocation Loc,
2137 TemplateParameterList **Params,
2139 SourceLocation FriendLoc);
2141 static FriendTemplateDecl *CreateDeserialized(ASTContext &
C,
unsigned ID);
2163 assert(i <= NumParams);
2185 static void DeallocateCommon(
void *Ptr);
2210 return cast<TypeAliasTemplateDecl>(
2214 return cast<TypeAliasTemplateDecl>(
2221 return cast_or_null<TypeAliasTemplateDecl>(
2228 return cast_or_null<TypeAliasTemplateDecl>(
2230 this)->getPreviousDecl());
2234 return cast_or_null<TypeAliasTemplateDecl>(
2274 virtual void anchor();
2279 :
Decl(Decl::ClassScopeFunctionSpecialization, DC, Loc),
2280 Specialization(FD), HasExplicitTemplateArgs(Args),
2281 TemplateArgs(TemplArgs) {}
2284 :
Decl(Decl::ClassScopeFunctionSpecialization, Empty) {}
2287 bool HasExplicitTemplateArgs;
2299 bool HasExplicitTemplateArgs,
2302 DC, Loc, FD, HasExplicitTemplateArgs, TemplateArgs);
2311 return K == Decl::ClassScopeFunctionSpecialization;
2336 public llvm::FoldingSetNode {
2341 struct SpecializedPartialSpecialization {
2352 llvm::PointerUnion<VarTemplateDecl *, SpecializedPartialSpecialization *>
2353 SpecializedTemplate;
2356 struct ExplicitSpecializationInfo {
2364 ExplicitSpecializationInfo()
2365 : TypeAsWritten(
nullptr), ExternLoc(), TemplateKeywordLoc() {}
2370 ExplicitSpecializationInfo *ExplicitInfo;
2381 unsigned SpecializationKind : 3;
2403 bool Qualified)
const override;
2407 return cast<VarTemplateSpecializationDecl>(Recent);
2421 return TemplateArgsInfo;
2448 llvm_unreachable(
"bad template specialization kind");
2452 SpecializationKind = TSK;
2457 return PointOfInstantiation;
2461 assert(Loc.
isValid() &&
"point of instantiation must be valid!");
2462 PointOfInstantiation = Loc;
2469 llvm::PointerUnion<VarTemplateDecl *, VarTemplatePartialSpecializationDecl *>
2477 if (SpecializedPartialSpecialization *PartialSpec =
2478 SpecializedTemplate.dyn_cast<SpecializedPartialSpecialization *>())
2479 return PartialSpec->PartialSpecialization;
2481 return SpecializedTemplate.get<VarTemplateDecl *>();
2486 llvm::PointerUnion<VarTemplateDecl *, VarTemplatePartialSpecializationDecl *>
2488 if (SpecializedPartialSpecialization *PartialSpec =
2489 SpecializedTemplate.dyn_cast<SpecializedPartialSpecialization *>())
2490 return PartialSpec->PartialSpecialization;
2507 if (SpecializedPartialSpecialization *PartialSpec =
2508 SpecializedTemplate.dyn_cast<SpecializedPartialSpecialization *>())
2509 return *PartialSpec->TemplateArgs;
2519 assert(!SpecializedTemplate.is<SpecializedPartialSpecialization *>() &&
2520 "Already set to a variable template partial specialization!");
2521 SpecializedPartialSpecialization *PS =
2523 PS->PartialSpecialization = PartialSpec;
2524 PS->TemplateArgs = TemplateArgs;
2525 SpecializedTemplate = PS;
2531 assert(!SpecializedTemplate.is<SpecializedPartialSpecialization *>() &&
2532 "Previously set to a variable template partial specialization!");
2533 SpecializedTemplate = TemplDecl;
2540 ExplicitInfo =
new (
getASTContext()) ExplicitSpecializationInfo;
2541 ExplicitInfo->TypeAsWritten = T;
2546 return ExplicitInfo ? ExplicitInfo->TypeAsWritten :
nullptr;
2551 return ExplicitInfo ? ExplicitInfo->ExternLoc :
SourceLocation();
2556 ExplicitInfo =
new (
getASTContext()) ExplicitSpecializationInfo;
2557 ExplicitInfo->ExternLoc = Loc;
2563 ExplicitInfo =
new (
getASTContext()) ExplicitSpecializationInfo;
2564 ExplicitInfo->TemplateKeywordLoc = Loc;
2568 return ExplicitInfo ? ExplicitInfo->TemplateKeywordLoc :
SourceLocation();
2578 ID.AddInteger(TemplateArgs.size());
2579 for (
unsigned Arg = 0; Arg != TemplateArgs.size(); ++Arg)
2580 TemplateArgs[Arg].
Profile(ID, Context);
2585 return K >= firstVarTemplateSpecialization &&
2586 K <= lastVarTemplateSpecialization;
2595 void anchor()
override;
2609 llvm::PointerIntPair<VarTemplatePartialSpecializationDecl *, 1, bool>
2610 InstantiatedFromMember;
2621 TemplateParams(
nullptr), ArgsAsWritten(
nullptr),
2622 InstantiatedFromMember(
nullptr,
false) {}
2636 return cast<VarTemplatePartialSpecializationDecl>(
2643 return TemplateParams;
2648 return ArgsAsWritten;
2673 cast<VarTemplatePartialSpecializationDecl>(
getFirstDecl());
2674 return First->InstantiatedFromMember.getPointer();
2680 cast<VarTemplatePartialSpecializationDecl>(
getFirstDecl());
2681 First->InstantiatedFromMember.setPointer(PartialSpec);
2702 cast<VarTemplatePartialSpecializationDecl>(
getFirstDecl());
2703 return First->InstantiatedFromMember.getInt();
2709 cast<VarTemplatePartialSpecializationDecl>(
getFirstDecl());
2710 assert(First->InstantiatedFromMember.getPointer() &&
2711 "Only member templates can be member template specializations");
2712 return First->InstantiatedFromMember.setInt(
true);
2717 return K == VarTemplatePartialSpecialization;
2726 static void DeallocateCommon(
void *Ptr);
2740 llvm::FoldingSetVector<VarTemplatePartialSpecializationDecl>
2752 llvm::FoldingSetVector<VarTemplateSpecializationDecl> &
2757 llvm::FoldingSetVector<VarTemplatePartialSpecializationDecl> &
2816 return cast_or_null<VarTemplateDecl>(
2823 return cast_or_null<VarTemplateDecl>(
2829 return cast<VarTemplateDecl>(
2837 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...
void setTemplateSpecializationKind(TemplateSpecializationKind TSK)
Set the template specialization kind.
QualType getInjectedSpecializationType() const
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
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...
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.
static TemplateParameterList * Create(const ASTContext &C, SourceLocation TemplateLoc, SourceLocation LAngleLoc, NamedDecl **Params, unsigned NumParams, SourceLocation RAngleLoc)
DeclType * operator*() const
TypeAliasTemplateDecl * getPreviousDecl()
Retrieve the previous declaration of this function template, or NULL if no such declaration exists...
ArrayRef< NamedDecl * > asArray()
bool isThisDeclarationADefinition() const
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)
Declaration of a redeclarable template.
llvm::iterator_range< spec_iterator > spec_range
Stores a list of template parameters for a TemplateDecl and its derived classes. Suitable for creatin...
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>". This is safe to be used inside an AST node, in contrast with TemplateArgumentListInfo.
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.
bool isExplicitInstantiationOrSpecialization() const
True if this declaration is an explicit specialization, explicit instantiation declaration, or explicit instantiation definition.
static bool classof(const Decl *D)
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...
spec_iterator spec_begin() const
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
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.
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.
void set(ArgType Arg)
Set the default argument.
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)
VarTemplateDecl * getInstantiatedFromMemberTemplate()
static void Profile(llvm::FoldingSetNodeID &ID, ArrayRef< TemplateArgument > TemplateArgs, ASTContext &Context)
unsigned getNumTemplateParameters() const
static OMPLinearClause * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ColonLoc, SourceLocation EndLoc, ArrayRef< Expr * > VL, ArrayRef< Expr * > IL, Expr *Step, Expr *CalcStep)
Creates clause with a list of variables VL and a linear step Step.
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.
FunctionTemplateDecl * getInstantiatedFromMemberTemplate()
void setSpecializationKind(TemplateSpecializationKind TSK)
static bool classofKind(Kind K)
SourceLocation PointOfInstantiation
The point at which this function template specialization was first instantiated.
ClassTemplatePartialSpecializationDecl * getInstantiatedFromMember()
Retrieve the member class template partial specialization from which this particular class template p...
TemplateSpecializationKind getSpecializationKind() const
Determine the kind of specialization that this declaration represents.
redeclarable_base::redecl_iterator redecl_iterator
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...
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. InsertPos must be obtained fro...
unsigned getPosition() const
Get the position of the template parameter within its parameter list.
Represents a ValueDecl that came out of a declarator. Contains type source information through TypeSo...
bool isExplicitInstantiationOrSpecialization() const
True if this declaration is an explicit specialization, explicit instantiation declaration, or explicit instantiation definition.
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. InsertPos must be obta...
bool hasDefaultArgument() const
Determine whether this template parameter has a default argument.
static bool classof(const Decl *D)
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
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. Calling this routine may implicitly allocate memory for the common pointer.
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.
ClassTemplateDecl * getInstantiatedFromMemberTemplate()
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.
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...
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
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. It does not own its t...
NamedDecl * getInstantiatedFrom() const
Retrieve the member declaration from which this member was instantiated.
static bool classofKind(Kind K)
spec_iterator spec_begin() const
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. The SourceManager can decode this to get at the full include stack...
ClassTemplateDecl * getPreviousDecl()
Retrieve the previous declaration of this class template, or NULL if no such declaration exists...
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.
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.
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()
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)
static QualType getFromOpaquePtr(const void *Ptr)
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.
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)
const TemplateArgumentList & getTemplateArgs() const
Retrieve the template arguments of the variable template specialization.
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)
DefinitionKind isThisDeclarationADefinition(ASTContext &) const
Check whether this declaration is a definition. If this could be a tentative definition (in C)...
static void Profile(llvm::FoldingSetNodeID &ID, ArrayRef< TemplateArgument > TemplateArgs, ASTContext &Context)
TemplateParameterList * TemplateParams
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()
FixedSizeTemplateParameterList(SourceLocation TemplateLoc, SourceLocation LAngleLoc, NamedDecl **Params, SourceLocation RAngleLoc)
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
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)
VarTemplatePartialSpecializationDecl * getInstantiatedFromMember()
Retrieve the member variable template partial specialization from which this particular variable temp...
Common * getCommonPtr() const
const_iterator end() const
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. If the point of instantiation is an invalid...
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.
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. This will be a class template spe...
void setPointOfInstantiation(SourceLocation POI)
Set the first point of instantiation.
VarTemplateDecl * getDefinition()
bool isExplicitSpecialization() const
SourceRange getSourceRange() const LLVM_READONLY
TypeAliasTemplateDecl * getInstantiatedFromMemberTemplate()
const ParmDecl * getInheritedFrom() const
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
TemplateParameterList(SourceLocation TemplateLoc, SourceLocation LAngleLoc, NamedDecl **Params, unsigned NumParams, SourceLocation RAngleLoc)
SourceLocation getTemplateLoc() const
FunctionTemplateDecl * getMostRecentDecl()