15 #ifndef LLVM_CLANG_AST_DECLTEMPLATE_H 16 #define LLVM_CLANG_AST_DECLTEMPLATE_H 28 #include "llvm/ADT/ArrayRef.h" 29 #include "llvm/ADT/FoldingSet.h" 30 #include "llvm/ADT/PointerIntPair.h" 31 #include "llvm/ADT/PointerUnion.h" 32 #include "llvm/ADT/iterator.h" 33 #include "llvm/ADT/iterator_range.h" 34 #include "llvm/Support/Casting.h" 35 #include "llvm/Support/Compiler.h" 36 #include "llvm/Support/TrailingObjects.h" 46 class ClassTemplateDecl;
47 class ClassTemplatePartialSpecializationDecl;
49 class FunctionTemplateDecl;
51 class NonTypeTemplateParmDecl;
53 class TemplateTemplateParmDecl;
54 class TemplateTypeParmDecl;
55 class UnresolvedSetImpl;
56 class VarTemplateDecl;
57 class VarTemplatePartialSpecializationDecl;
61 llvm::PointerUnion3<TemplateTypeParmDecl *, NonTypeTemplateParmDecl *,
79 unsigned NumParams : 30;
83 unsigned ContainsUnexpandedParameterPack : 1;
86 unsigned HasRequiresClause : 1;
91 Expr *RequiresClause);
98 return HasRequiresClause;
102 template <
size_t N,
bool HasRequiresClause>
111 Expr *RequiresClause);
124 unsigned size()
const {
return NumParams; }
127 return llvm::makeArrayRef(
begin(),
end());
130 return llvm::makeArrayRef(
begin(),
size());
134 assert(Idx <
size() &&
"Template parameter index out-of-range");
138 assert(Idx <
size() &&
"Template parameter index out-of-range");
159 return ContainsUnexpandedParameterPack;
164 return HasRequiresClause ? *getTrailingObjects<Expr *>() :
nullptr;
169 return HasRequiresClause ? *getTrailingObjects<Expr *>() :
nullptr;
188 template <
size_t N,
bool HasRequiresClause>
191 typename TemplateParameterList::FixedSizeStorage<
193 N, HasRequiresClause ? 1u : 0u
201 Expr *RequiresClause)
203 (assert(N == Params.
size()),
204 assert(HasRequiresClause == static_cast<
bool>(RequiresClause)),
206 TemplateLoc, LAngleLoc, Params, RAngleLoc, RequiresClause))) {}
217 unsigned NumArguments;
243 : Arguments(Args.data()), NumArguments(Args.
size()) {}
252 : Arguments(Other->data()), NumArguments(Other->
size()) {}
256 assert(Idx < NumArguments &&
"Invalid template argument index");
265 return llvm::makeArrayRef(data(),
size());
270 unsigned size()
const {
return NumArguments; }
286 template<
typename ParmDecl,
typename ArgType>
292 ParmDecl *PrevDeclWithDefaultArg;
295 static_assert(
sizeof(Chain) ==
sizeof(
void *) * 2,
296 "non-pointer argument type?");
298 llvm::PointerUnion3<ArgType, ParmDecl*, Chain*> ValueOrInherited;
300 static ParmDecl *getParmOwningDefaultArg(ParmDecl *Parm) {
302 if (
auto *Prev = Storage.ValueOrInherited.template dyn_cast<ParmDecl *>())
304 assert(!Parm->getDefaultArgStorage()
305 .ValueOrInherited.template is<ParmDecl *>() &&
306 "should only be one level of indirection");
314 bool isSet()
const {
return !ValueOrInherited.isNull(); }
318 bool isInherited()
const {
return ValueOrInherited.template is<ParmDecl*>(); }
322 ArgType
get()
const {
324 if (
const auto *Prev = ValueOrInherited.template dyn_cast<ParmDecl *>())
325 Storage = &Prev->getDefaultArgStorage();
326 if (
const auto *C = Storage->ValueOrInherited.template dyn_cast<Chain *>())
328 return Storage->ValueOrInherited.template get<ArgType>();
334 if (
const auto *D = ValueOrInherited.template dyn_cast<ParmDecl *>())
336 if (
const auto *C = ValueOrInherited.template dyn_cast<Chain *>())
337 return C->PrevDeclWithDefaultArg;
342 void set(ArgType Arg) {
343 assert(!isSet() &&
"default argument already set");
344 ValueOrInherited = Arg;
349 assert(!isInherited() &&
"default argument already inherited");
350 InheritedFrom = getParmOwningDefaultArg(InheritedFrom);
352 ValueOrInherited = InheritedFrom;
355 Chain{InheritedFrom, ValueOrInherited.template get<ArgType>()};
360 ValueOrInherited = ArgType();
377 return TemplateParams;
384 TemplateParams = TParams;
390 Expr *AssociatedConstraints =
nullptr;
400 void anchor()
override;
408 :
NamedDecl(DK, DC, L, Name), TemplatedDecl(nullptr),
409 TemplateParams(CTDI) {
410 this->setTemplateParameters(Params);
421 :
NamedDecl(DK, DC, L, Name), TemplatedDecl(Decl),
422 TemplateParams(CTDI) {
423 this->setTemplateParameters(Params);
428 :
TemplateDecl(nullptr, DK, DC, L, Name, Params, Decl) {}
433 const auto *
const CTDI =
447 const auto *
const CTDI =
459 return K >= firstTemplate && K <= lastTemplate;
464 TemplatedDecl->getSourceRange().getEnd());
479 if (
auto *
const CTDI =
481 CTDI->setTemplateParameters(TParams);
483 TemplateParams = TParams;
488 assert(isCanonicalDecl() &&
489 "Attaching associated constraints to non-canonical Decl");
491 ->setAssociatedConstraints(AC);
497 void init(
NamedDecl *templatedDecl, TemplateParameterList* templateParams) {
498 assert(!TemplatedDecl &&
"TemplatedDecl already set!");
499 assert(!TemplateParams &&
"TemplateParams already set!");
500 TemplatedDecl = templatedDecl;
501 TemplateParams = templateParams;
515 : Function(FD), Template(Template, TSK - 1),
516 TemplateArguments(TemplateArgs),
517 TemplateArgumentsAsWritten(TemplateArgsAsWritten),
518 PointOfInstantiation(POI) {}
536 llvm::PointerIntPair<FunctionTemplateDecl *, 2>
Template;
572 "Cannot encode TSK_Undeclared for a function template specialization");
573 Template.setInt(TSK - 1);
582 return PointOfInstantiation;
588 PointOfInstantiation = POI;
592 Profile(ID, TemplateArguments->
asArray(),
599 ID.AddInteger(TemplateArgs.size());
601 TemplateArg.Profile(ID, Context);
611 llvm::PointerIntPair<NamedDecl *, 2> MemberAndTSK;
620 : MemberAndTSK(IF, TSK - 1), PointOfInstantiation(POI) {
622 "Cannot encode undeclared template specializations for members");
641 "Cannot encode undeclared template specializations for members");
642 MemberAndTSK.setInt(TSK - 1);
649 return PointOfInstantiation;
654 PointOfInstantiation = POI;
675 FunctionTemplateDecl *> {
677 unsigned NumTemplates;
709 assert(I < getNumTemplates() &&
"template index out of range");
710 return getTrailingObjects<FunctionTemplateDecl *>()[I];
715 return getTrailingObjects<TemplateArgumentLoc>();
723 assert(I < getNumTemplateArgs() &&
"template arg index out of range");
724 return getTemplateArgs()[I];
732 return AngleLocs.
getEnd();
743 return getNextRedeclaration();
747 return getPreviousDecl();
751 return getMostRecentDecl();
754 void anchor()
override;
764 return D->getTemplateArgs().asArray();
768 template <
typename EntryType,
typename SETraits = SpecEntryTraits<EntryType>,
769 typename DeclType =
typename SETraits::DeclType>
771 : llvm::iterator_adaptor_base<
772 SpecIterator<EntryType, SETraits, DeclType>,
773 typename llvm::FoldingSetVector<EntryType>::iterator,
774 typename std::iterator_traits<typename llvm::FoldingSetVector<
775 EntryType>::iterator>::iterator_category,
776 DeclType *, ptrdiff_t, DeclType *, DeclType *> {
779 typename llvm::FoldingSetVector<EntryType>::iterator SetIter)
783 return SETraits::getDecl(&*this->I)->getMostRecentDecl();
789 template <
typename EntryType>
795 void loadLazySpecializationsImpl()
const;
798 findSpecializationImpl(llvm::FoldingSetVector<EntryType> &Specs,
801 template <
class Derived,
class EntryType>
802 void addSpecializationImpl(llvm::FoldingSetVector<EntryType> &Specs,
803 EntryType *Entry,
void *InsertPos);
813 llvm::PointerIntPair<RedeclarableTemplateDecl*, 1, bool>
821 uint32_t *LazySpecializations =
nullptr;
852 template <
class decl_type>
friend class RedeclarableTemplate;
856 return getFirstDecl();
859 return getFirstDecl();
881 return getCommonPtr()->InstantiatedFromMember.getInt();
886 assert(getCommonPtr()->InstantiatedFromMember.getPointer() &&
887 "Only member templates can be member template specializations");
888 getCommonPtr()->InstantiatedFromMember.setInt(
true);
928 return getCommonPtr()->InstantiatedFromMember.getPointer();
932 assert(!getCommonPtr()->InstantiatedFromMember.getPointer());
933 getCommonPtr()->InstantiatedFromMember.setPointer(TD);
939 using redeclarable_base::redecls_begin;
940 using redeclarable_base::redecls_end;
941 using redeclarable_base::redecls;
942 using redeclarable_base::getPreviousDecl;
943 using redeclarable_base::getMostRecentDecl;
944 using redeclarable_base::isFirstDecl;
950 return K >= firstRedeclarableTemplate && K <= lastRedeclarableTemplate;
1006 llvm::FoldingSetVector<FunctionTemplateSpecializationInfo> &
1007 getSpecializations()
const;
1021 void LoadLazySpecializations()
const;
1031 return getTemplatedDecl()->isThisDeclarationADefinition();
1040 return cast<FunctionTemplateDecl>(
1044 return cast<FunctionTemplateDecl>(
1051 return cast_or_null<FunctionTemplateDecl>(
1055 return cast_or_null<FunctionTemplateDecl>(
1060 return cast<FunctionTemplateDecl>(
1062 ->getMostRecentDecl());
1069 return cast_or_null<FunctionTemplateDecl>(
1081 return makeSpecIterator(getSpecializations(),
false);
1085 return makeSpecIterator(getSpecializations(),
true);
1176 :
TypeDecl(TemplateTypeParm, DC, IdLoc, Id, KeyLoc), Typename(Typename) {}
1182 unsigned D,
unsigned P,
1184 bool ParameterPack);
1185 static TemplateTypeParmDecl *CreateDeserialized(
const ASTContext &C,
1202 return DefaultArgument.
get()->getType();
1207 return DefaultArgument.
get();
1221 DefaultArgument.
set(DefArg);
1227 TemplateTypeParmDecl *Prev) {
1233 DefaultArgument.
clear();
1244 unsigned getIndex()
const;
1247 bool isParameterPack()
const;
1261 class NonTypeTemplateParmDecl final
1265 std::pair<QualType, TypeSourceInfo *>> {
1283 bool ExpandedParameterPack =
false;
1286 unsigned NumExpandedTypes = 0;
1289 OverloadToken<std::pair<QualType, TypeSourceInfo *>>)
const {
1290 return NumExpandedTypes;
1297 :
DeclaratorDecl(NonTypeTemplateParm, DC, IdLoc, Id, T, TInfo, StartLoc),
1308 static NonTypeTemplateParmDecl *
1313 static NonTypeTemplateParmDecl *
1319 static NonTypeTemplateParmDecl *CreateDeserialized(
ASTContext &C,
1321 static NonTypeTemplateParmDecl *CreateDeserialized(
ASTContext &C,
1323 unsigned NumExpandedTypes);
1356 NonTypeTemplateParmDecl *Parm) {
1412 assert(ExpandedParameterPack &&
"Not an expansion parameter pack");
1413 return NumExpandedTypes;
1419 assert(I < NumExpandedTypes &&
"Out-of-range expansion type index");
1420 auto TypesAndInfos =
1421 getTrailingObjects<std::pair<QualType, TypeSourceInfo *>>();
1422 return TypesAndInfos[I].first;
1428 assert(I < NumExpandedTypes &&
"Out-of-range expansion type index");
1429 auto TypesAndInfos =
1430 getTrailingObjects<std::pair<QualType, TypeSourceInfo *>>();
1431 return TypesAndInfos[I].second;
1450 TemplateParameterList *> {
1454 DefArgStorage DefaultArgument;
1462 bool ExpandedParameterPack =
false;
1465 unsigned NumExpandedParams = 0;
1468 unsigned D,
unsigned P,
bool ParameterPack,
1470 :
TemplateDecl(TemplateTemplateParm, DC, L, Id, Params),
1474 unsigned D,
unsigned P,
1478 void anchor()
override;
1487 unsigned P,
bool ParameterPack,
1501 unsigned NumExpansions);
1522 return ParameterPack &&
1523 getTemplateParameters()->containsUnexpandedParameterPack();
1549 assert(ExpandedParameterPack &&
"Not an expansion parameter pack");
1550 return NumExpandedParams;
1556 assert(I < NumExpandedParams &&
"Out-of-range expansion type index");
1557 return getTrailingObjects<TemplateParameterList *>()[I];
1569 return DefaultArgument.
isSet() ? *DefaultArgument.
get() :
None;
1596 if (hasDefaultArgument() && !defaultArgumentWasInherited())
1597 End = getDefaultArgument().getSourceRange().getEnd();
1615 void anchor()
override;
1653 struct SpecializedPartialSpecialization {
1664 llvm::PointerUnion<ClassTemplateDecl *, SpecializedPartialSpecialization *>
1665 SpecializedTemplate;
1668 struct ExplicitSpecializationInfo {
1678 ExplicitSpecializationInfo() =
default;
1683 ExplicitSpecializationInfo *ExplicitInfo =
nullptr;
1693 unsigned SpecializationKind : 3;
1718 void getNameForDiagnostic(raw_ostream &OS,
const PrintingPolicy &Policy,
1719 bool Qualified)
const override;
1727 return cast<ClassTemplateSpecializationDecl>(
1728 getMostRecentNonInjectedDecl());
1737 return *TemplateArgs;
1759 SpecializationKind = TSK;
1764 return PointOfInstantiation;
1768 assert(Loc.
isValid() &&
"point of instantiation must be valid!");
1769 PointOfInstantiation = Loc;
1780 return llvm::PointerUnion<ClassTemplateDecl *,
1783 return getSpecializedTemplateOrPartial();
1788 llvm::PointerUnion<ClassTemplateDecl *,
1791 if (
const auto *PartialSpec =
1792 SpecializedTemplate.dyn_cast<SpecializedPartialSpecialization *>())
1793 return PartialSpec->PartialSpecialization;
1795 return SpecializedTemplate.get<ClassTemplateDecl*>();
1810 if (
const auto *PartialSpec =
1811 SpecializedTemplate.dyn_cast<SpecializedPartialSpecialization *>())
1812 return *PartialSpec->TemplateArgs;
1814 return getTemplateArgs();
1822 assert(!SpecializedTemplate.is<SpecializedPartialSpecialization*>() &&
1823 "Already set to a class template partial specialization!");
1824 auto *PS =
new (getASTContext()) SpecializedPartialSpecialization();
1825 PS->PartialSpecialization = PartialSpec;
1826 PS->TemplateArgs = TemplateArgs;
1827 SpecializedTemplate = PS;
1833 assert(!SpecializedTemplate.is<SpecializedPartialSpecialization*>() &&
1834 "Previously set to a class template partial specialization!");
1835 SpecializedTemplate = TemplDecl;
1842 ExplicitInfo =
new (getASTContext()) ExplicitSpecializationInfo;
1843 ExplicitInfo->TypeAsWritten = T;
1849 return ExplicitInfo ? ExplicitInfo->TypeAsWritten :
nullptr;
1854 return ExplicitInfo ? ExplicitInfo->ExternLoc :
SourceLocation();
1860 ExplicitInfo =
new (getASTContext()) ExplicitSpecializationInfo;
1861 ExplicitInfo->ExternLoc = Loc;
1867 ExplicitInfo =
new (getASTContext()) ExplicitSpecializationInfo;
1868 ExplicitInfo->TemplateKeywordLoc = Loc;
1873 return ExplicitInfo ? ExplicitInfo->TemplateKeywordLoc :
SourceLocation();
1879 Profile(ID, TemplateArgs->
asArray(), getASTContext());
1885 ID.AddInteger(TemplateArgs.size());
1887 TemplateArg.Profile(ID, Context);
1893 return K >= firstClassTemplateSpecialization &&
1894 K <= lastClassTemplateSpecialization;
1912 llvm::PointerIntPair<ClassTemplatePartialSpecializationDecl *, 1, bool>
1913 InstantiatedFromMember;
1927 InstantiatedFromMember(
nullptr,
false) {}
1929 void anchor()
override;
1949 return cast<ClassTemplatePartialSpecializationDecl>(
1951 this)->getMostRecentDecl());
1956 return TemplateParams;
1961 return ArgsAsWritten;
1986 cast<ClassTemplatePartialSpecializationDecl>(getFirstDecl());
1987 return First->InstantiatedFromMember.getPointer();
1991 return getInstantiatedFromMember();
1996 auto *
First = cast<ClassTemplatePartialSpecializationDecl>(getFirstDecl());
1997 First->InstantiatedFromMember.setPointer(PartialSpec);
2018 cast<ClassTemplatePartialSpecializationDecl>(getFirstDecl());
2019 return First->InstantiatedFromMember.getInt();
2024 auto *
First = cast<ClassTemplatePartialSpecializationDecl>(getFirstDecl());
2025 assert(
First->InstantiatedFromMember.getPointer() &&
2026 "Only member templates can be member template specializations");
2027 return First->InstantiatedFromMember.setInt(
true);
2034 assert(getTypeForDecl() &&
"partial specialization has no type set!");
2035 return cast<InjectedClassNameType>(getTypeForDecl())
2036 ->getInjectedSpecializationType();
2044 return K == ClassTemplatePartialSpecialization;
2060 llvm::FoldingSetVector<ClassTemplatePartialSpecializationDecl>
2070 llvm::FoldingSetVector<ClassTemplateSpecializationDecl> &
2071 getSpecializations()
const;
2075 llvm::FoldingSetVector<ClassTemplatePartialSpecializationDecl> &
2076 getPartialSpecializations();
2100 void LoadLazySpecializations()
const;
2110 return getTemplatedDecl()->isThisDeclarationADefinition();
2120 Expr *AssociatedConstraints =
nullptr);
2135 return cast<ClassTemplateDecl>(
2139 return cast<ClassTemplateDecl>(
2146 return cast_or_null<ClassTemplateDecl>(
2150 return cast_or_null<ClassTemplateDecl>(
2152 this)->getPreviousDecl());
2156 return cast<ClassTemplateDecl>(
2164 return cast_or_null<ClassTemplateDecl>(
2179 void getPartialSpecializations(
2201 findPartialSpecInstantiatedFromMember(
2218 QualType getInjectedClassNameSpecialization();
2228 return makeSpecIterator(getSpecializations(),
false);
2232 return makeSpecIterator(getSpecializations(),
true);
2254 virtual void anchor();
2261 unsigned NumParams = 0;
2275 :
Decl(
Decl::FriendTemplate, DC, Loc), NumParams(Params.
size()),
2276 Params(Params.data()), Friend(Friend), FriendLoc(FriendLoc) {}
2310 assert(i <= NumParams);
2356 return cast<TypeAliasTemplateDecl>(
2360 return cast<TypeAliasTemplateDecl>(
2367 return cast_or_null<TypeAliasTemplateDecl>(
2371 return cast_or_null<TypeAliasTemplateDecl>(
2373 this)->getPreviousDecl());
2377 return cast_or_null<TypeAliasTemplateDecl>(
2414 bool HasExplicitTemplateArgs;
2420 :
Decl(Decl::ClassScopeFunctionSpecialization, DC, Loc),
2421 Specialization(FD), HasExplicitTemplateArgs(Args),
2422 TemplateArgs(std::move(TemplArgs)) {}
2425 :
Decl(Decl::ClassScopeFunctionSpecialization, Empty) {}
2427 virtual void anchor();
2441 bool HasExplicitTemplateArgs,
2444 DC, Loc, FD, HasExplicitTemplateArgs, std::move(TemplateArgs));
2454 return K == Decl::ClassScopeFunctionSpecialization;
2476 public llvm::FoldingSetNode {
2481 struct SpecializedPartialSpecialization {
2492 llvm::PointerUnion<VarTemplateDecl *, SpecializedPartialSpecialization *>
2493 SpecializedTemplate;
2496 struct ExplicitSpecializationInfo {
2506 ExplicitSpecializationInfo() =
default;
2511 ExplicitSpecializationInfo *ExplicitInfo =
nullptr;
2522 unsigned SpecializationKind : 3;
2528 unsigned IsCompleteDefinition : 1;
2553 void getNameForDiagnostic(raw_ostream &OS,
const PrintingPolicy &Policy,
2554 bool Qualified)
const override;
2557 VarDecl *Recent =
static_cast<VarDecl *
>(
this)->getMostRecentDecl();
2558 return cast<VarTemplateSpecializationDecl>(Recent);
2572 return TemplateArgsInfo;
2594 SpecializationKind = TSK;
2599 return PointOfInstantiation;
2603 assert(Loc.
isValid() &&
"point of instantiation must be valid!");
2604 PointOfInstantiation = Loc;
2613 llvm::PointerUnion<VarTemplateDecl *, VarTemplatePartialSpecializationDecl *>
2619 return getSpecializedTemplateOrPartial();
2624 llvm::PointerUnion<VarTemplateDecl *, VarTemplatePartialSpecializationDecl *>
2626 if (
const auto *PartialSpec =
2627 SpecializedTemplate.dyn_cast<SpecializedPartialSpecialization *>())
2628 return PartialSpec->PartialSpecialization;
2645 if (
const auto *PartialSpec =
2646 SpecializedTemplate.dyn_cast<SpecializedPartialSpecialization *>())
2647 return *PartialSpec->TemplateArgs;
2649 return getTemplateArgs();
2657 assert(!SpecializedTemplate.is<SpecializedPartialSpecialization *>() &&
2658 "Already set to a variable template partial specialization!");
2659 auto *PS =
new (getASTContext()) SpecializedPartialSpecialization();
2660 PS->PartialSpecialization = PartialSpec;
2661 PS->TemplateArgs = TemplateArgs;
2662 SpecializedTemplate = PS;
2668 assert(!SpecializedTemplate.is<SpecializedPartialSpecialization *>() &&
2669 "Previously set to a variable template partial specialization!");
2670 SpecializedTemplate = TemplDecl;
2677 ExplicitInfo =
new (getASTContext()) ExplicitSpecializationInfo;
2678 ExplicitInfo->TypeAsWritten = T;
2684 return ExplicitInfo ? ExplicitInfo->TypeAsWritten :
nullptr;
2689 return ExplicitInfo ? ExplicitInfo->ExternLoc :
SourceLocation();
2695 ExplicitInfo =
new (getASTContext()) ExplicitSpecializationInfo;
2696 ExplicitInfo->ExternLoc = Loc;
2702 ExplicitInfo =
new (getASTContext()) ExplicitSpecializationInfo;
2703 ExplicitInfo->TemplateKeywordLoc = Loc;
2708 return ExplicitInfo ? ExplicitInfo->TemplateKeywordLoc :
SourceLocation();
2712 Profile(ID, TemplateArgs->
asArray(), getASTContext());
2718 ID.AddInteger(TemplateArgs.size());
2720 TemplateArg.Profile(ID, Context);
2726 return K >= firstVarTemplateSpecialization &&
2727 K <= lastVarTemplateSpecialization;
2745 llvm::PointerIntPair<VarTemplatePartialSpecializationDecl *, 1, bool>
2746 InstantiatedFromMember;
2758 InstantiatedFromMember(
nullptr,
false) {}
2760 void anchor()
override;
2777 return cast<VarTemplatePartialSpecializationDecl>(
2779 this)->getMostRecentDecl());
2784 return TemplateParams;
2789 return ArgsAsWritten;
2814 cast<VarTemplatePartialSpecializationDecl>(getFirstDecl());
2815 return First->InstantiatedFromMember.getPointer();
2820 auto *
First = cast<VarTemplatePartialSpecializationDecl>(getFirstDecl());
2821 First->InstantiatedFromMember.setPointer(PartialSpec);
2842 cast<VarTemplatePartialSpecializationDecl>(getFirstDecl());
2843 return First->InstantiatedFromMember.getInt();
2848 auto *
First = cast<VarTemplatePartialSpecializationDecl>(getFirstDecl());
2849 assert(
First->InstantiatedFromMember.getPointer() &&
2850 "Only member templates can be member template specializations");
2851 return First->InstantiatedFromMember.setInt(
true);
2857 return K == VarTemplatePartialSpecialization;
2873 llvm::FoldingSetVector<VarTemplatePartialSpecializationDecl>
2880 llvm::FoldingSetVector<VarTemplateSpecializationDecl> &
2881 getSpecializations()
const;
2885 llvm::FoldingSetVector<VarTemplatePartialSpecializationDecl> &
2886 getPartialSpecializations();
2904 void LoadLazySpecializations()
const;
2908 return static_cast<VarDecl *
>(TemplatedDecl);
2914 return getTemplatedDecl()->isThisDeclarationADefinition();
2947 return cast_or_null<VarTemplateDecl>(
2951 return cast_or_null<VarTemplateDecl>(
2953 this)->getPreviousDecl());
2957 return cast<VarTemplateDecl>(
2965 return cast_or_null<VarTemplateDecl>(
2980 void getPartialSpecializations(
3004 return makeSpecIterator(getSpecializations(),
false);
3008 return makeSpecIterator(getSpecializations(),
true);
3017 if (
auto *PD = P.dyn_cast<TemplateTypeParmDecl *>())
3019 if (
auto *PD = P.dyn_cast<NonTypeTemplateParmDecl *>())
3026 return TD && (isa<ClassTemplateDecl>(TD) ||
3027 isa<ClassTemplatePartialSpecializationDecl>(TD) ||
3028 isa<TypeAliasTemplateDecl>(TD) ||
3029 isa<TemplateTemplateParmDecl>(TD))
3036 #endif // LLVM_CLANG_AST_DECLTEMPLATE_H bool isPackExpansion() const
Whether this parameter pack is a pack expansion.
const internal::VariadicAllOfMatcher< Type > type
Matches Types in the clang AST.
const TemplateArgumentLoc & getTemplateArg(unsigned I) const
Returns the nth template argument.
void setInstantiationOf(ClassTemplateDecl *TemplDecl)
Note that this class template specialization is an instantiation of the given class template...
static const Decl * getCanonicalDecl(const Decl *D)
spec_iterator spec_begin() const
Represents a function declaration or definition.
void setTemplateSpecializationKind(TemplateSpecializationKind TSK)
Set the template specialization kind.
FunctionTemplateDecl * getTemplate() const
Retrieve the template from which this function was specialized.
unsigned getNumTemplateArgs() const
Returns the number of explicit template arguments that were given.
RedeclarableTemplateDecl(ConstrainedTemplateDeclInfo *CTDI, Kind DK, ASTContext &C, DeclContext *DC, SourceLocation L, DeclarationName Name, TemplateParameterList *Params, NamedDecl *Decl)
SourceLocation getPointOfInstantiation() const
Retrieve the first point of instantiation of this function template specialization.
llvm::iterator_range< redecl_iterator > redecl_range
TemplateDecl(Kind DK, DeclContext *DC, SourceLocation L, DeclarationName Name, TemplateParameterList *Params)
bool isExplicitInstantiationOrSpecialization() const
True if this declaration is an explicit specialization, explicit instantiation declaration, or explicit instantiation definition.
A (possibly-)qualified type.
FunctionDecl * Function
The function template specialization that this structure describes.
RedeclarableTemplateDecl(Kind DK, ASTContext &C, DeclContext *DC, SourceLocation L, DeclarationName Name, TemplateParameterList *Params, NamedDecl *Decl)
bool isThisDeclarationADefinition() const
Returns whether this template declaration defines the primary class pattern.
void setDefaultArgument(TypeSourceInfo *DefArg)
Set the default argument for this template parameter.
void setTemplateKeywordLoc(SourceLocation Loc)
Sets the location of the template keyword.
llvm::PointerUnion3< TemplateTypeParmDecl *, NonTypeTemplateParmDecl *, TemplateTemplateParmDecl * > TemplateParameter
Stores a template parameter of any kind.
static ClassTemplateDecl * getDefinition(ClassTemplateDecl *D)
VarTemplateSpecializationDecl * getMostRecentDecl()
ArrayRef< const NamedDecl * > asArray() const
bool isMemberSpecialization()
Determines whether this class template partial specialization template was a specialization of a memb...
VarDecl * getTemplatedDecl() const
Get the underlying variable declarations of the template.
FixedSizeTemplateParameterListStorage(SourceLocation TemplateLoc, SourceLocation LAngleLoc, ArrayRef< NamedDecl *> Params, SourceLocation RAngleLoc, Expr *RequiresClause)
C Language Family Type Representation.
static ClassScopeFunctionSpecializationDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation Loc, CXXMethodDecl *FD, bool HasExplicitTemplateArgs, TemplateArgumentListInfo TemplateArgs)
spec_range specializations() const
unsigned size() const
Retrieve the number of template arguments in this template argument list.
unsigned getNumExpansionTypes() const
Retrieves the number of expansion types in an expanded parameter pack.
static TemplateSpecializationKind getTemplateSpecializationKind(Decl *D)
Determine what kind of template specialization the given declaration is.
spec_iterator spec_end() const
Decl - This represents one declaration (or definition), e.g.
TypeAliasTemplateDecl * getPreviousDecl()
Retrieve the previous declaration of this function template, or nullptr if no such declaration exists...
ArrayRef< NamedDecl * > asArray()
void setInheritedDefaultArgument(const ASTContext &C, NonTypeTemplateParmDecl *Parm)
NamedDecl * getTemplatedDecl() const
Get the underlying, templated declaration.
VarTemplatePartialSpecializationDecl * getMostRecentDecl()
bool isExplicitSpecialization() const
const TypeAliasTemplateDecl * getPreviousDecl() const
bool isExpandedParameterPack() const
Whether this parameter is a template template parameter pack that has a known list of different templ...
void removeDefaultArgument()
Removes the default argument of this template parameter.
Declaration of a variable template.
size_t numTrailingObjects(OverloadToken< Expr *>) const
void setSpecializationKind(TemplateSpecializationKind TSK)
NamedDecl * getParam(unsigned Idx)
static bool classofKind(Kind K)
A container of type source information.
TemplateParameterList * getTemplateParameters() const
Get the list of template parameters.
constexpr XRayInstrMask Function
TypeSourceInfo * getDefaultArgumentInfo() const
Retrieves the default argument's source information, if any.
const Expr * getRequiresClause() const
Get the constraint-expression from the associated requires-clause (if any)
static bool classofKind(Kind K)
const ClassTemplateDecl * getCanonicalDecl() const
bool defaultArgumentWasInherited() const
Determines whether the default argument was inherited from a previous declaration of this template...
TemplateParameterList * getTemplateParameters() const
Get the list of template parameters.
bool isPackExpansion() const
Whether this parameter pack is a pack expansion.
unsigned getDepth() const
Get the nesting depth of the template parameter.
static void Profile(llvm::FoldingSetNodeID &ID, ArrayRef< TemplateArgument > TemplateArgs, ASTContext &Context)
TemplateParameterList * getExpansionTemplateParameters(unsigned I) const
Retrieve a particular expansion type within an expanded parameter pack.
Represents a variable declaration or definition.
Declaration of a redeclarable template.
TemplateParameterList * getTemplateParameters() const
NamedDecl *const * const_iterator
Iterates through the template parameters in this list.
bool hasDefaultArgument() const
Determine whether this template parameter has a default argument.
TemplateSpecializationKind getTemplateSpecializationKind() const
Determine what kind of template specialization this is.
SourceLocation getExternLoc() const
Gets the location of the extern keyword, if present.
llvm::PointerUnion< TemplateParameterList *, ConstrainedTemplateDeclInfo * > TemplateParams
The template parameter list and optional requires-clause associated with this declaration; alternativ...
static bool classofKind(Kind K)
const TemplateArgumentLoc * getTemplateArgs() const
Returns the explicit template arguments that were given.
Represents a variable template specialization, which refers to a variable template with a given set o...
SourceLocation getPointOfInstantiation() const
Get the point of instantiation (if any), or null if none.
SourceLocation getLAngleLoc() const
TemplateParmPosition(unsigned D, unsigned P)
Represents an explicit template argument list in C++, e.g., the "<int>" in "sort<int>".
Stores a list of template parameters for a TemplateDecl and its derived classes.
Describes how types, statements, expressions, and declarations should be printed. ...
static bool classofKind(Kind K)
TemplateSpecializationKind getTemplateSpecializationKind() const
Determine what kind of template specialization this is.
TypeSourceInfo * getTypeAsWritten() const
Gets the type of this specialization as it was written by the user, if it was so written.
SourceRange getSourceRange() const override LLVM_READONLY
Source range that this declaration covers.
Provides information about a dependent function-template specialization declaration.
Represents the builtin template declaration which is used to implement __make_integer_seq and other b...
static bool classof(const Decl *D)
const VarTemplateDecl * getCanonicalDecl() const
static bool classof(const Decl *D)
llvm::iterator_range< spec_iterator > spec_range
llvm::PointerUnion< VarTemplateDecl *, VarTemplatePartialSpecializationDecl * > getSpecializedTemplateOrPartial() const
Retrieve the variable template or variable template partial specialization which was specialized by t...
const TemplateArgumentList & getTemplateArgs() const
Retrieve the template arguments of the class template specialization.
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.
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.
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
TemplateSpecializationKind getSpecializationKind() const
Determine the kind of specialization that this declaration represents.
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.
const DefArgStorage & getDefaultArgStorage() const
void * allocateDefaultArgStorageChain(const ASTContext &C)
ClassTemplateSpecializationDecl * getMostRecentDecl()
unsigned getPosition() const
Get the position of the template parameter within its parameter list.
static bool classofKind(Kind K)
void Profile(llvm::FoldingSetNodeID &ID)
Stores the template parameter list and associated constraints for TemplateDecl objects that track ass...
Declaration of a function specialization at template class scope.
SourceLocation getTemplateLoc() const
TypeSourceInfo * getFriendType() const
If this friend declaration names a templated type (or a dependent member type of a templated type)...
llvm::iterator_range< spec_iterator > spec_range
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...
static bool classof(const Decl *D)
Provides information about a function template specialization, which is a FunctionDecl that has been ...
TypeAliasDecl * getTemplatedDecl() const
Get the underlying function declaration of the template.
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.
Common * getCommonPtr() const
unsigned getMinRequiredArguments() const
Returns the minimum number of arguments needed to form a template specialization. ...
const RedeclarableTemplateDecl * getCanonicalDecl() const
SourceRange getSourceRange() const override LLVM_READONLY
Source range that this declaration covers.
void set(ArgType Arg)
Set the default argument.
bool isInherited() const
Determine whether the default argument for this parameter was inherited from a previous declaration o...
A convenient class for passing around template argument information.
void setDepth(unsigned D)
const TemplateArgumentList & getTemplateArgs() const
Retrieve the template arguments of the variable template specialization.
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified...
SourceLocation getTemplateKeywordLoc() const
Gets the location of the template keyword, if present.
static bool classof(const Decl *D)
bool isMemberSpecialization() const
Determines whether this template was a specialization of a member template.
static bool classofKind(Kind K)
static void Profile(llvm::FoldingSetNodeID &ID, ArrayRef< TemplateArgument > TemplateArgs, ASTContext &Context)
TemplateDecl * getAsTypeTemplateDecl(Decl *D)
Represents a declaration of a type.
A set of unresolved declarations.
RedeclarableTemplateDecl * getInstantiatedFromMemberTemplate() const
Retrieve the member template from which this template was instantiated, or nullptr if this template w...
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...
const TemplateArgument & operator[](unsigned Idx) const
Retrieve the template argument at a given index.
void setSpecializationKind(TemplateSpecializationKind TSK)
spec_range specializations() const
ArgType get() const
Get the default argument's value.
ClassTemplatePartialSpecializationDecl * getInstantiatedFromMemberTemplate() const
TemplateParameterList * getTemplateParameterList(unsigned i) const
unsigned getIndex() const
Get the index of the template parameter within its parameter list.
static bool classofKind(Kind K)
bool hasDefaultArgument() const
Determine whether this template parameter has a default argument.
QualType getExpansionType(unsigned I) const
Retrieve a particular expansion type within an expanded parameter pack.
SourceLocation PointOfInstantiation
The point at which this function template specialization was first instantiated.
const TemplateArgument * data() const
Retrieve a pointer to the template argument list.
const TypeAliasTemplateDecl * getCanonicalDecl() const
CXXRecordDecl * getTemplatedDecl() const
Get the underlying class declarations of the template.
bool isExplicitSpecialization() const
bool isParameterPack() const
Whether this template template parameter is a template parameter pack.
ClassTemplateDecl(ASTContext &C, DeclContext *DC, SourceLocation L, DeclarationName Name, TemplateParameterList *Params, NamedDecl *Decl)
bool isExpandedParameterPack() const
Whether this parameter is a non-type template parameter pack that has a known list of different types...
bool isExplicitSpecialization() const
llvm::FoldingSetVector< FunctionTemplateSpecializationInfo > Specializations
The function template specializations for this function template, including explicit specializations ...
const VarTemplateDecl * getMostRecentDecl() const
static bool classof(const Decl *D)
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...
Represents the declaration of a typedef-name via a C++11 alias-declaration.
bool isExplicitSpecialization() const
Represents a ValueDecl that came out of a declarator.
bool isParameterPack() const
Whether this parameter is a non-type template parameter pack.
void clear()
Remove the default argument, even if it was inherited.
llvm::FoldingSetVector< ClassTemplatePartialSpecializationDecl > PartialSpecializations
The class template partial specializations for this class template.
spec_range specializations() const
const NamedDecl * getParam(unsigned Idx) const
const FunctionTemplateDecl * getMostRecentDecl() const
TemplateParameterList * getTemplateParameters() const
Get the list of template parameters.
static bool classof(const Decl *D)
QualType getInjectedSpecializationType() const
Retrieves the injected specialization type for this partial specialization.
llvm::iterator_range< spec_iterator > spec_range
This represents one expression.
void setCompleteDefinition()
CommonBase * getCommonPtr() const
Retrieves the "common" pointer shared by all (re-)declarations of the same template.
void setAssociatedConstraints(Expr *AC)
const VarTemplateDecl * getPreviousDecl() const
llvm::FoldingSetVector< VarTemplatePartialSpecializationDecl > PartialSpecializations
The variable template partial specializations for this variable template.
Expr * getAssociatedConstraints() const
void setInherited(const ASTContext &C, ParmDecl *InheritedFrom)
Set that the default argument was inherited from another parameter.
static bool classof(const Decl *D)
void setAssociatedConstraints(Expr *AC)
MemberSpecializationInfo(NamedDecl *IF, TemplateSpecializationKind TSK, SourceLocation POI=SourceLocation())
llvm::PointerIntPair< FunctionTemplateDecl *, 2 > Template
The function template from which this function template specialization was generated.
llvm::PointerUnion< NamedDecl *, TypeSourceInfo * > FriendUnion
static bool classof(const Decl *D)
spec_iterator spec_end() const
Data that is common to all of the declarations of a given variable template.
spec_iterator spec_end() const
void setMemberSpecialization()
Note that this member template is a specialization.
ArrayRef< TemplateArgument > asArray() const
Produce this as an array ref.
llvm::PointerUnion< ClassTemplateDecl *, ClassTemplatePartialSpecializationDecl * > getSpecializedTemplateOrPartial() const
Retrieve the class template or class template partial specialization which was specialized by this...
spec_iterator spec_begin() const
const ASTTemplateArgumentListInfo * getTemplateArgsAsWritten() const
Get the template arguments as written.
static bool classof(const Decl *D)
StorageClass
Storage classes.
Declaration of an alias template.
FunctionTemplateDecl * getTemplate(unsigned I) const
Returns the i'th template candidate.
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.
SourceLocation getEnd() const
unsigned getNumExpansionTemplateParameters() const
Retrieves the number of expansion template parameters in an expanded parameter pack.
TemplateTemplateParmDecl - Declares a template template parameter, e.g., "T" in.
ClassTemplatePartialSpecializationDecl * getInstantiatedFromMember() const
Retrieve the member class template partial specialization from which this particular class template p...
BuiltinTemplateKind getBuiltinTemplateKind() const
Data that is common to all of the declarations of a given class template.
bool isTemplateInstantiation(TemplateSpecializationKind Kind)
Determine whether this template specialization kind refers to an instantiation of an entity (as oppos...
static bool classofKind(Kind K)
static TemplateParameterList * Create(const ASTContext &C, SourceLocation TemplateLoc, SourceLocation LAngleLoc, ArrayRef< NamedDecl *> Params, SourceLocation RAngleLoc, Expr *RequiresClause)
bool defaultArgumentWasInherited() const
Determines whether the default argument was inherited from a previous declaration of this template...
static DeclType * getDecl(EntryType *D)
ClassTemplateDecl * getInstantiatedFromMemberTemplate() const
TypeSourceInfo * getExpansionTypeSourceInfo(unsigned I) const
Retrieve a particular expansion type source info within an expanded parameter pack.
void setPointOfInstantiation(SourceLocation POI)
Set the (first) point of instantiation of this function template specialization.
NamedDecl * getInstantiatedFrom() const
Retrieve the member declaration from which this member was instantiated.
OnStackType
Type used to indicate that the template argument list itself is a stack object.
bool isExplicitInstantiationOrSpecialization() const
True if this declaration is an explicit specialization, explicit instantiation declaration, or explicit instantiation definition.
static bool classofKind(Kind K)
Stores a list of template parameters and the associated requires-clause (if any) for a TemplateDecl a...
spec_iterator spec_begin() const
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.
FunctionDecl * getTemplatedDecl() const
Get the underlying function declaration of the template.
Encodes a location in the source.
ClassTemplateDecl * getPreviousDecl()
Retrieve the previous declaration of this class template, or nullptr if no such declaration exists...
DeclType * operator->() const
llvm::PointerUnion< ClassTemplateDecl *, ClassTemplatePartialSpecializationDecl * > getInstantiatedFrom() const
If this class template specialization is an instantiation of a template (rather than an explicit spec...
static bool classof(const Decl *D)
const FunctionTemplateDecl * getPreviousDecl() const
void setExternLoc(SourceLocation Loc)
Sets the location of the extern keyword.
bool wasDeclaredWithTypename() const
Whether this template type parameter was declared with the 'typename' keyword.
const TemplateArgumentListInfo & templateArgs() const
ASTContext & getASTContext() const LLVM_READONLY
void setPosition(unsigned P)
const Expr * getRequiresClause() const
The constraint-expression of the associated requires-clause.
Represents a static or instance method of a struct/union/class.
Expr * getRequiresClause()
The constraint-expression of the associated requires-clause.
bool isMemberSpecialization()
Determines whether this variable template partial specialization was a specialization of a member par...
Data that is common to all of the declarations of a given function template.
void Profile(llvm::FoldingSetNodeID &ID) const
BuiltinTemplateKind
Kinds of BuiltinTemplateDecl.
TemplateSpecializationKind getSpecializationKind() const
Determine the kind of specialization that this declaration represents.
unsigned getNumTemplates() const
Returns the number of function templates that this might be a specialization of.
static bool classof(const Decl *D)
Common * getCommonPtr() const
const TemplateArgumentListInfo & getTemplateArgsInfo() const
FunctionTemplateDecl(ASTContext &C, DeclContext *DC, SourceLocation L, DeclarationName Name, TemplateParameterList *Params, NamedDecl *Decl)
bool hasDefaultArgument() const
Determine whether this template parameter has a default argument.
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 nullptr if no such declaration exists...
ClassTemplateDecl * getMostRecentDecl()
This template specialization was formed from a template-id but has not yet been declared, defined, or instantiated.
FunctionTemplateDecl * getInstantiatedFromMemberTemplate() const
const ParmDecl * getInheritedFrom() const
Get the parameter from which we inherit the default argument, if any.
TypeSourceInfo * getTypeAsWritten() const
Gets the type of this specialization as it was written by the user, if it was so written.
SourceLocation getRAngleLoc() const
size_t numTrailingObjects(OverloadToken< NamedDecl *>) const
void setInstantiatedFromMember(VarTemplatePartialSpecializationDecl *PartialSpec)
static bool classofKind(Kind K)
static bool classofKind(Kind K)
SourceRange getSourceRange() const override LLVM_READONLY
Source range that this declaration covers.
TemplateDecl(ConstrainedTemplateDeclInfo *CTDI, Kind DK, DeclContext *DC, SourceLocation L, DeclarationName Name, TemplateParameterList *Params, NamedDecl *Decl)
const TemplateArgumentList & getTemplateInstantiationArgs() const
Retrieve the set of template arguments that should be used to instantiate the initializer of the vari...
SourceLocation getRAngleLoc() const
static bool classofKind(Kind K)
llvm::PointerUnion< VarTemplateDecl *, VarTemplatePartialSpecializationDecl * > getInstantiatedFrom() const
If this variable template specialization is an instantiation of a template (rather than an explicit s...
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.
TemplateDecl(ConstrainedTemplateDeclInfo *CTDI, Kind DK, DeclContext *DC, SourceLocation L, DeclarationName Name, TemplateParameterList *Params)
Defines various enumerations that describe declaration and type specifiers.
Represents a template argument.
SourceLocation getTemplateKeywordLoc() const
Gets the location of the template keyword, if present.
TagTypeKind
The kind of a tag type.
void setMemberSpecialization()
Note that this member template is a specialization.
const ClassTemplateDecl * getPreviousDecl() const
void removeDefaultArgument()
Removes the default argument of this template parameter.
Dataflow Directional Tag Classes.
bool isValid() const
Return true if this is a valid SourceLocation object.
bool containsUnexpandedParameterPack() const
Determine whether this template parameter list contains an unexpanded parameter pack.
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
bool hasExplicitTemplateArgs() const
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)
static BuiltinTemplateDecl * Create(const ASTContext &C, DeclContext *DC, DeclarationName Name, BuiltinTemplateKind BTK)
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.
bool isExplicitInstantiationOrSpecialization() const
True if this declaration is an explicit specialization, explicit instantiation declaration, or explicit instantiation definition.
unsigned getNumTemplateParameters() const
The name of a declaration.
static void Profile(llvm::FoldingSetNodeID &ID, ArrayRef< TemplateArgument > TemplateArgs, ASTContext &Context)
void setTemplateParameters(TemplateParameterList *TParams)
llvm::iterator_range< redecl_iterator > redecl_range
Storage for a default argument.
TemplateSpecializationKind
Describes the kind of template specialization that a particular template specialization declaration r...
Expr * getDefaultArgument() const
Retrieve the default argument, if any.
bool defaultArgumentWasInherited() const
Determines whether the default argument was inherited from a previous declaration of this template...
bool isThisDeclarationADefinition() const
Returns whether this template declaration defines the primary variable pattern.
ClassTemplatePartialSpecializationDecl * getMostRecentDecl()
static bool classofKind(Kind K)
DeclType * operator*() const
unsigned getDepth() const
Get the depth of this template parameter list in the set of template parameter lists.
const DefArgStorage & getDefaultArgStorage() const
void setTemplateKeywordLoc(SourceLocation Loc)
Sets the location of the template keyword.
static bool classofKind(Kind K)
ClassTemplateDecl(ConstrainedTemplateDeclInfo *CTDI, ASTContext &C, DeclContext *DC, SourceLocation L, DeclarationName Name, TemplateParameterList *Params, NamedDecl *Decl)
Location wrapper for a TemplateArgument.
const_iterator end() const
void setInstantiatedFromMemberTemplate(RedeclarableTemplateDecl *TD)
This template specialization was declared or defined by an explicit specialization (C++ [temp...
static DeclType * getDecl(FunctionTemplateSpecializationInfo *I)
VarTemplateDecl * getPreviousDecl()
Retrieve the previous declaration of this variable template, or nullptr 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.
TypeAliasTemplateDecl * getCanonicalDecl() override
Retrieves the canonical declaration of this template.
static bool classof(const Decl *D)
const TemplateArgumentLoc & getDefaultArgument() const
Retrieve the default argument, if any.
const ClassTemplateDecl * 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)
TemplateDecl(Kind DK, DeclContext *DC, SourceLocation L, DeclarationName Name, TemplateParameterList *Params, NamedDecl *Decl)
A template argument list.
redeclarable_base::redecl_iterator redecl_iterator
Defines the C++ Decl subclasses, other than those for templates (found in DeclTemplate.h) and friends (in DeclFriend.h).
Defines the clang::SourceLocation class and associated facilities.
VarTemplateDecl * getMostRecentDecl()
static bool classof(const Decl *D)
Represents a C++ struct/union/class.
TemplateParameterList(SourceLocation TemplateLoc, SourceLocation LAngleLoc, ArrayRef< NamedDecl *> Params, SourceLocation RAngleLoc, Expr *RequiresClause)
TypeAliasTemplateDecl * getInstantiatedFromMemberTemplate() const
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)
SourceLocation getFriendLoc() const
Retrieves the location of the 'friend' keyword.
Declaration of a class template.
VarTemplateDecl * getCanonicalDecl() override
Retrieves the canonical declaration of this template.
CXXMethodDecl * getSpecialization() const
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.
const_iterator begin() const
VarTemplateDecl * getInstantiatedFromMemberTemplate() const
Kind
Lists the kind of concrete classes of Decl.
llvm::FoldingSetVector< VarTemplateSpecializationDecl > Specializations
The variable template specializations for this variable template, including explicit specializations ...
llvm::FoldingSetVector< ClassTemplateSpecializationDecl > Specializations
The class template specializations for this class template, including explicit specializations and in...
Expr * getAssociatedConstraints() const
Common * getCommonPtr() const
SourceLocation getExternLoc() const
Gets the location of the extern keyword, if present.
bool isSet() const
Determine whether there is a default argument for this parameter.
void setMemberSpecialization()
Note that this member template is a specialization.
void setInheritedDefaultArgument(const ASTContext &C, TemplateTemplateParmDecl *Prev)
QualType getDefaultArgument() const
Retrieve the default argument, if any.
void Profile(llvm::FoldingSetNodeID &ID) const
void setTemplateParameters(TemplateParameterList *TParams)
const FunctionTemplateDecl * getCanonicalDecl() const
A trivial tuple used to represent a source range.
This represents a decl that may have a name.
SourceLocation getLAngleLoc() const
NamedDecl * getAsNamedDecl(TemplateParameter P)
const TemplateArgumentList & getTemplateInstantiationArgs() const
Retrieve the set of template arguments that should be used to instantiate members of the class templa...
Declaration of a friend template.
VarTemplatePartialSpecializationDecl * getInstantiatedFromMember() const
Retrieve the member variable template partial specialization from which this particular variable temp...
SourceLocation getPointOfInstantiation() const
Retrieve the first point of instantiation of this member.
NamedDecl * getFriendDecl() const
If this friend declaration names a templated function (or a member function of a templated type)...
void setTypeAsWritten(TypeSourceInfo *T)
Sets the type of this specialization as it was written by the user.
SourceLocation getPointOfInstantiation() const
Get the point of instantiation (if any), or null if none.
void setPointOfInstantiation(SourceLocation POI)
Set the first point of instantiation.
SourceLocation getBegin() const
const ASTTemplateArgumentListInfo * getTemplateArgsAsWritten() const
Get the template arguments as written.
SourceRange getSourceRange() const LLVM_READONLY
TrailingObjects::FixedSizeStorageOwner FixedSizeStorageOwner
Declaration of a template function.
bool isThisDeclarationADefinition() const
Returns whether this template declaration defines the primary pattern.
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.
FunctionTemplateDecl * getMostRecentDecl()
TemplateArgumentList(OnStackType, ArrayRef< TemplateArgument > Args)
Construct a new, temporary template argument list on the stack.