14 #ifndef LLVM_CLANG_AST_DECLTEMPLATE_H 15 #define LLVM_CLANG_AST_DECLTEMPLATE_H 27 #include "llvm/ADT/ArrayRef.h" 28 #include "llvm/ADT/FoldingSet.h" 29 #include "llvm/ADT/PointerIntPair.h" 30 #include "llvm/ADT/PointerUnion.h" 31 #include "llvm/ADT/iterator.h" 32 #include "llvm/ADT/iterator_range.h" 33 #include "llvm/Support/Casting.h" 34 #include "llvm/Support/Compiler.h" 35 #include "llvm/Support/TrailingObjects.h" 45 class ClassTemplateDecl;
46 class ClassTemplatePartialSpecializationDecl;
48 class FunctionTemplateDecl;
50 class NonTypeTemplateParmDecl;
52 class TemplateTemplateParmDecl;
53 class TemplateTypeParmDecl;
54 class UnresolvedSetImpl;
55 class VarTemplateDecl;
56 class VarTemplatePartialSpecializationDecl;
60 llvm::PointerUnion3<TemplateTypeParmDecl *, NonTypeTemplateParmDecl *,
78 unsigned NumParams : 30;
82 unsigned ContainsUnexpandedParameterPack : 1;
85 unsigned HasRequiresClause : 1;
90 Expr *RequiresClause);
97 return HasRequiresClause;
101 template <
size_t N,
bool HasRequiresClause>
110 Expr *RequiresClause);
123 unsigned size()
const {
return NumParams; }
126 return llvm::makeArrayRef(
begin(),
end());
129 return llvm::makeArrayRef(
begin(),
size());
133 assert(Idx <
size() &&
"Template parameter index out-of-range");
137 assert(Idx <
size() &&
"Template parameter index out-of-range");
158 return ContainsUnexpandedParameterPack;
163 return HasRequiresClause ? *getTrailingObjects<Expr *>() :
nullptr;
168 return HasRequiresClause ? *getTrailingObjects<Expr *>() :
nullptr;
180 bool OmitTemplateKW =
false)
const;
192 template <
size_t N,
bool HasRequiresClause>
195 typename TemplateParameterList::FixedSizeStorage<
197 N, HasRequiresClause ? 1u : 0u
205 Expr *RequiresClause)
207 (assert(N == Params.
size()),
208 assert(HasRequiresClause == static_cast<
bool>(RequiresClause)),
210 TemplateLoc, LAngleLoc, Params, RAngleLoc, RequiresClause))) {}
221 unsigned NumArguments;
247 : Arguments(Args.data()), NumArguments(Args.
size()) {}
256 : Arguments(Other->data()), NumArguments(Other->
size()) {}
260 assert(Idx < NumArguments &&
"Invalid template argument index");
269 return llvm::makeArrayRef(data(),
size());
274 unsigned size()
const {
return NumArguments; }
290 template<
typename ParmDecl,
typename ArgType>
296 ParmDecl *PrevDeclWithDefaultArg;
299 static_assert(
sizeof(Chain) ==
sizeof(
void *) * 2,
300 "non-pointer argument type?");
302 llvm::PointerUnion3<ArgType, ParmDecl*, Chain*> ValueOrInherited;
304 static ParmDecl *getParmOwningDefaultArg(ParmDecl *Parm) {
306 if (
auto *Prev = Storage.ValueOrInherited.template dyn_cast<ParmDecl *>())
308 assert(!Parm->getDefaultArgStorage()
309 .ValueOrInherited.template is<ParmDecl *>() &&
310 "should only be one level of indirection");
318 bool isSet()
const {
return !ValueOrInherited.isNull(); }
322 bool isInherited()
const {
return ValueOrInherited.template is<ParmDecl*>(); }
326 ArgType
get()
const {
328 if (
const auto *Prev = ValueOrInherited.template dyn_cast<ParmDecl *>())
329 Storage = &Prev->getDefaultArgStorage();
330 if (
const auto *C = Storage->ValueOrInherited.template dyn_cast<Chain *>())
332 return Storage->ValueOrInherited.template get<ArgType>();
338 if (
const auto *D = ValueOrInherited.template dyn_cast<ParmDecl *>())
340 if (
const auto *C = ValueOrInherited.template dyn_cast<Chain *>())
341 return C->PrevDeclWithDefaultArg;
346 void set(ArgType Arg) {
347 assert(!isSet() &&
"default argument already set");
348 ValueOrInherited = Arg;
353 assert(!isInherited() &&
"default argument already inherited");
354 InheritedFrom = getParmOwningDefaultArg(InheritedFrom);
356 ValueOrInherited = InheritedFrom;
359 Chain{InheritedFrom, ValueOrInherited.template get<ArgType>()};
364 ValueOrInherited = ArgType();
381 return TemplateParams;
388 TemplateParams = TParams;
394 Expr *AssociatedConstraints =
nullptr;
404 void anchor()
override;
412 :
NamedDecl(DK, DC, L, Name), TemplatedDecl(nullptr),
413 TemplateParams(CTDI) {
414 this->setTemplateParameters(Params);
425 :
NamedDecl(DK, DC, L, Name), TemplatedDecl(Decl),
426 TemplateParams(CTDI) {
427 this->setTemplateParameters(Params);
432 :
TemplateDecl(nullptr, DK, DC, L, Name, Params, Decl) {}
437 const auto *
const CTDI =
451 const auto *
const CTDI =
463 return K >= firstTemplate && K <= lastTemplate;
468 TemplatedDecl->getSourceRange().getEnd());
483 if (
auto *
const CTDI =
485 CTDI->setTemplateParameters(TParams);
487 TemplateParams = TParams;
492 assert(isCanonicalDecl() &&
493 "Attaching associated constraints to non-canonical Decl");
495 ->setAssociatedConstraints(AC);
501 void init(
NamedDecl *templatedDecl, TemplateParameterList* templateParams) {
502 assert(!TemplatedDecl &&
"TemplatedDecl already set!");
503 assert(!TemplateParams &&
"TemplateParams already set!");
504 TemplatedDecl = templatedDecl;
505 TemplateParams = templateParams;
513 :
public llvm::FoldingSetNode,
515 MemberSpecializationInfo *> {
518 llvm::PointerIntPair<FunctionDecl *, 1, bool> Function;
524 llvm::PointerIntPair<FunctionTemplateDecl *, 2> Template;
545 : Function(FD, MSInfo ? 1 : 0), Template(Template, TSK - 1),
546 TemplateArguments(TemplateArgs),
547 TemplateArgumentsAsWritten(TemplateArgsAsWritten),
548 PointOfInstantiation(POI) {
550 getTrailingObjects<MemberSpecializationInfo *>()[0] = MSInfo;
554 return Function.getInt();
593 "Cannot encode TSK_Undeclared for a function template specialization");
594 Template.setInt(TSK - 1);
603 return PointOfInstantiation;
609 PointOfInstantiation = POI;
644 ? getTrailingObjects<MemberSpecializationInfo *>()[0]
649 Profile(ID, TemplateArguments->
asArray(), getFunction()->getASTContext());
655 ID.AddInteger(TemplateArgs.size());
657 TemplateArg.Profile(ID, Context);
667 llvm::PointerIntPair<NamedDecl *, 2> MemberAndTSK;
676 : MemberAndTSK(IF, TSK - 1), PointOfInstantiation(POI) {
678 "Cannot encode undeclared template specializations for members");
697 "Cannot encode undeclared template specializations for members");
698 MemberAndTSK.setInt(TSK - 1);
705 return PointOfInstantiation;
710 PointOfInstantiation = POI;
731 FunctionTemplateDecl *> {
733 unsigned NumTemplates;
765 assert(I < getNumTemplates() &&
"template index out of range");
766 return getTrailingObjects<FunctionTemplateDecl *>()[I];
771 return getTrailingObjects<TemplateArgumentLoc>();
779 assert(I < getNumTemplateArgs() &&
"template arg index out of range");
780 return getTemplateArgs()[I];
788 return AngleLocs.
getEnd();
799 return getNextRedeclaration();
803 return getPreviousDecl();
807 return getMostRecentDecl();
810 void anchor()
override;
820 return D->getTemplateArgs().asArray();
824 template <
typename EntryType,
typename SETraits = SpecEntryTraits<EntryType>,
825 typename DeclType =
typename SETraits::DeclType>
827 : llvm::iterator_adaptor_base<
828 SpecIterator<EntryType, SETraits, DeclType>,
829 typename llvm::FoldingSetVector<EntryType>::iterator,
830 typename std::iterator_traits<typename llvm::FoldingSetVector<
831 EntryType>::iterator>::iterator_category,
832 DeclType *, ptrdiff_t, DeclType *, DeclType *> {
835 typename llvm::FoldingSetVector<EntryType>::iterator SetIter)
839 return SETraits::getDecl(&*this->I)->getMostRecentDecl();
845 template <
typename EntryType>
851 void loadLazySpecializationsImpl()
const;
854 findSpecializationImpl(llvm::FoldingSetVector<EntryType> &Specs,
857 template <
class Derived,
class EntryType>
858 void addSpecializationImpl(llvm::FoldingSetVector<EntryType> &Specs,
859 EntryType *Entry,
void *InsertPos);
869 llvm::PointerIntPair<RedeclarableTemplateDecl*, 1, bool>
877 uint32_t *LazySpecializations =
nullptr;
908 template <
class decl_type>
friend class RedeclarableTemplate;
912 return getFirstDecl();
915 return getFirstDecl();
937 return getCommonPtr()->InstantiatedFromMember.getInt();
942 assert(getCommonPtr()->InstantiatedFromMember.getPointer() &&
943 "Only member templates can be member template specializations");
944 getCommonPtr()->InstantiatedFromMember.setInt(
true);
984 return getCommonPtr()->InstantiatedFromMember.getPointer();
988 assert(!getCommonPtr()->InstantiatedFromMember.getPointer());
989 getCommonPtr()->InstantiatedFromMember.setPointer(TD);
995 using redeclarable_base::redecls_begin;
996 using redeclarable_base::redecls_end;
997 using redeclarable_base::redecls;
998 using redeclarable_base::getPreviousDecl;
999 using redeclarable_base::getMostRecentDecl;
1000 using redeclarable_base::isFirstDecl;
1006 return K >= firstRedeclarableTemplate && K <= lastRedeclarableTemplate;
1062 llvm::FoldingSetVector<FunctionTemplateSpecializationInfo> &
1063 getSpecializations()
const;
1077 void LoadLazySpecializations()
const;
1087 return getTemplatedDecl()->isThisDeclarationADefinition();
1096 return cast<FunctionTemplateDecl>(
1100 return cast<FunctionTemplateDecl>(
1107 return cast_or_null<FunctionTemplateDecl>(
1111 return cast_or_null<FunctionTemplateDecl>(
1116 return cast<FunctionTemplateDecl>(
1118 ->getMostRecentDecl());
1125 return cast_or_null<FunctionTemplateDecl>(
1137 return makeSpecIterator(getSpecializations(),
false);
1141 return makeSpecIterator(getSpecializations(),
true);
1232 :
TypeDecl(TemplateTypeParm, DC, IdLoc, Id, KeyLoc), Typename(Typename) {}
1238 unsigned D,
unsigned P,
1240 bool ParameterPack);
1241 static TemplateTypeParmDecl *CreateDeserialized(
const ASTContext &C,
1258 return DefaultArgument.
get()->getType();
1263 return DefaultArgument.
get();
1277 DefaultArgument.
set(DefArg);
1283 TemplateTypeParmDecl *Prev) {
1289 DefaultArgument.
clear();
1300 unsigned getIndex()
const;
1303 bool isParameterPack()
const;
1317 class NonTypeTemplateParmDecl final
1321 std::pair<QualType, TypeSourceInfo *>> {
1339 bool ExpandedParameterPack =
false;
1342 unsigned NumExpandedTypes = 0;
1345 OverloadToken<std::pair<QualType, TypeSourceInfo *>>)
const {
1346 return NumExpandedTypes;
1353 :
DeclaratorDecl(NonTypeTemplateParm, DC, IdLoc, Id, T, TInfo, StartLoc),
1364 static NonTypeTemplateParmDecl *
1369 static NonTypeTemplateParmDecl *
1375 static NonTypeTemplateParmDecl *CreateDeserialized(
ASTContext &C,
1377 static NonTypeTemplateParmDecl *CreateDeserialized(
ASTContext &C,
1379 unsigned NumExpandedTypes);
1412 NonTypeTemplateParmDecl *Parm) {
1468 assert(ExpandedParameterPack &&
"Not an expansion parameter pack");
1469 return NumExpandedTypes;
1475 assert(I < NumExpandedTypes &&
"Out-of-range expansion type index");
1476 auto TypesAndInfos =
1477 getTrailingObjects<std::pair<QualType, TypeSourceInfo *>>();
1478 return TypesAndInfos[I].first;
1484 assert(I < NumExpandedTypes &&
"Out-of-range expansion type index");
1485 auto TypesAndInfos =
1486 getTrailingObjects<std::pair<QualType, TypeSourceInfo *>>();
1487 return TypesAndInfos[I].second;
1506 TemplateParameterList *> {
1510 DefArgStorage DefaultArgument;
1518 bool ExpandedParameterPack =
false;
1521 unsigned NumExpandedParams = 0;
1524 unsigned D,
unsigned P,
bool ParameterPack,
1526 :
TemplateDecl(TemplateTemplateParm, DC, L, Id, Params),
1530 unsigned D,
unsigned P,
1534 void anchor()
override;
1543 unsigned P,
bool ParameterPack,
1557 unsigned NumExpansions);
1578 return ParameterPack &&
1579 getTemplateParameters()->containsUnexpandedParameterPack();
1605 assert(ExpandedParameterPack &&
"Not an expansion parameter pack");
1606 return NumExpandedParams;
1612 assert(I < NumExpandedParams &&
"Out-of-range expansion type index");
1613 return getTrailingObjects<TemplateParameterList *>()[I];
1625 return DefaultArgument.
isSet() ? *DefaultArgument.
get() :
None;
1652 if (hasDefaultArgument() && !defaultArgumentWasInherited())
1653 End = getDefaultArgument().getSourceRange().getEnd();
1671 void anchor()
override;
1709 struct SpecializedPartialSpecialization {
1720 llvm::PointerUnion<ClassTemplateDecl *, SpecializedPartialSpecialization *>
1721 SpecializedTemplate;
1724 struct ExplicitSpecializationInfo {
1734 ExplicitSpecializationInfo() =
default;
1739 ExplicitSpecializationInfo *ExplicitInfo =
nullptr;
1749 unsigned SpecializationKind : 3;
1774 void getNameForDiagnostic(raw_ostream &OS,
const PrintingPolicy &Policy,
1775 bool Qualified)
const override;
1783 return cast<ClassTemplateSpecializationDecl>(
1784 getMostRecentNonInjectedDecl());
1793 return *TemplateArgs;
1816 return isExplicitSpecialization() &&
1817 isa<CXXRecordDecl>(getLexicalDeclContext());
1829 SpecializationKind = TSK;
1834 return PointOfInstantiation;
1838 assert(Loc.
isValid() &&
"point of instantiation must be valid!");
1839 PointOfInstantiation = Loc;
1850 return llvm::PointerUnion<ClassTemplateDecl *,
1853 return getSpecializedTemplateOrPartial();
1858 llvm::PointerUnion<ClassTemplateDecl *,
1861 if (
const auto *PartialSpec =
1862 SpecializedTemplate.dyn_cast<SpecializedPartialSpecialization *>())
1863 return PartialSpec->PartialSpecialization;
1865 return SpecializedTemplate.get<ClassTemplateDecl*>();
1880 if (
const auto *PartialSpec =
1881 SpecializedTemplate.dyn_cast<SpecializedPartialSpecialization *>())
1882 return *PartialSpec->TemplateArgs;
1884 return getTemplateArgs();
1892 assert(!SpecializedTemplate.is<SpecializedPartialSpecialization*>() &&
1893 "Already set to a class template partial specialization!");
1894 auto *PS =
new (getASTContext()) SpecializedPartialSpecialization();
1895 PS->PartialSpecialization = PartialSpec;
1896 PS->TemplateArgs = TemplateArgs;
1897 SpecializedTemplate = PS;
1903 assert(!SpecializedTemplate.is<SpecializedPartialSpecialization*>() &&
1904 "Previously set to a class template partial specialization!");
1905 SpecializedTemplate = TemplDecl;
1912 ExplicitInfo =
new (getASTContext()) ExplicitSpecializationInfo;
1913 ExplicitInfo->TypeAsWritten = T;
1919 return ExplicitInfo ? ExplicitInfo->TypeAsWritten :
nullptr;
1924 return ExplicitInfo ? ExplicitInfo->ExternLoc :
SourceLocation();
1930 ExplicitInfo =
new (getASTContext()) ExplicitSpecializationInfo;
1931 ExplicitInfo->ExternLoc = Loc;
1937 ExplicitInfo =
new (getASTContext()) ExplicitSpecializationInfo;
1938 ExplicitInfo->TemplateKeywordLoc = Loc;
1943 return ExplicitInfo ? ExplicitInfo->TemplateKeywordLoc :
SourceLocation();
1949 Profile(ID, TemplateArgs->
asArray(), getASTContext());
1955 ID.AddInteger(TemplateArgs.size());
1957 TemplateArg.Profile(ID, Context);
1963 return K >= firstClassTemplateSpecialization &&
1964 K <= lastClassTemplateSpecialization;
1982 llvm::PointerIntPair<ClassTemplatePartialSpecializationDecl *, 1, bool>
1983 InstantiatedFromMember;
1997 InstantiatedFromMember(
nullptr,
false) {}
1999 void anchor()
override;
2019 return cast<ClassTemplatePartialSpecializationDecl>(
2021 this)->getMostRecentDecl());
2026 return TemplateParams;
2031 return ArgsAsWritten;
2056 cast<ClassTemplatePartialSpecializationDecl>(getFirstDecl());
2057 return First->InstantiatedFromMember.getPointer();
2061 return getInstantiatedFromMember();
2066 auto *
First = cast<ClassTemplatePartialSpecializationDecl>(getFirstDecl());
2067 First->InstantiatedFromMember.setPointer(PartialSpec);
2088 cast<ClassTemplatePartialSpecializationDecl>(getFirstDecl());
2089 return First->InstantiatedFromMember.getInt();
2094 auto *
First = cast<ClassTemplatePartialSpecializationDecl>(getFirstDecl());
2095 assert(
First->InstantiatedFromMember.getPointer() &&
2096 "Only member templates can be member template specializations");
2097 return First->InstantiatedFromMember.setInt(
true);
2104 assert(getTypeForDecl() &&
"partial specialization has no type set!");
2105 return cast<InjectedClassNameType>(getTypeForDecl())
2106 ->getInjectedSpecializationType();
2114 return K == ClassTemplatePartialSpecialization;
2130 llvm::FoldingSetVector<ClassTemplatePartialSpecializationDecl>
2140 llvm::FoldingSetVector<ClassTemplateSpecializationDecl> &
2141 getSpecializations()
const;
2145 llvm::FoldingSetVector<ClassTemplatePartialSpecializationDecl> &
2146 getPartialSpecializations();
2170 void LoadLazySpecializations()
const;
2180 return getTemplatedDecl()->isThisDeclarationADefinition();
2190 Expr *AssociatedConstraints =
nullptr);
2205 return cast<ClassTemplateDecl>(
2209 return cast<ClassTemplateDecl>(
2216 return cast_or_null<ClassTemplateDecl>(
2220 return cast_or_null<ClassTemplateDecl>(
2222 this)->getPreviousDecl());
2226 return cast<ClassTemplateDecl>(
2234 return cast_or_null<ClassTemplateDecl>(
2249 void getPartialSpecializations(
2271 findPartialSpecInstantiatedFromMember(
2288 QualType getInjectedClassNameSpecialization();
2298 return makeSpecIterator(getSpecializations(),
false);
2302 return makeSpecIterator(getSpecializations(),
true);
2324 virtual void anchor();
2331 unsigned NumParams = 0;
2345 :
Decl(
Decl::FriendTemplate, DC, Loc), NumParams(Params.
size()),
2346 Params(Params.data()), Friend(Friend), FriendLoc(FriendLoc) {}
2380 assert(i <= NumParams);
2426 return cast<TypeAliasTemplateDecl>(
2430 return cast<TypeAliasTemplateDecl>(
2437 return cast_or_null<TypeAliasTemplateDecl>(
2441 return cast_or_null<TypeAliasTemplateDecl>(
2443 this)->getPreviousDecl());
2447 return cast_or_null<TypeAliasTemplateDecl>(
2490 :
Decl(Decl::ClassScopeFunctionSpecialization, DC, Loc),
2491 Specialization(FD), TemplateArgs(TemplArgs) {}
2494 :
Decl(Decl::ClassScopeFunctionSpecialization, Empty) {}
2496 virtual void anchor();
2505 return TemplateArgs;
2510 bool HasExplicitTemplateArgs,
2514 HasExplicitTemplateArgs
2526 return K == Decl::ClassScopeFunctionSpecialization;
2548 public llvm::FoldingSetNode {
2553 struct SpecializedPartialSpecialization {
2564 llvm::PointerUnion<VarTemplateDecl *, SpecializedPartialSpecialization *>
2565 SpecializedTemplate;
2568 struct ExplicitSpecializationInfo {
2578 ExplicitSpecializationInfo() =
default;
2583 ExplicitSpecializationInfo *ExplicitInfo =
nullptr;
2594 unsigned SpecializationKind : 3;
2600 unsigned IsCompleteDefinition : 1;
2625 void getNameForDiagnostic(raw_ostream &OS,
const PrintingPolicy &Policy,
2626 bool Qualified)
const override;
2629 VarDecl *Recent =
static_cast<VarDecl *
>(
this)->getMostRecentDecl();
2630 return cast<VarTemplateSpecializationDecl>(Recent);
2644 return TemplateArgsInfo;
2658 return isExplicitSpecialization() &&
2659 isa<CXXRecordDecl>(getLexicalDeclContext());
2671 SpecializationKind = TSK;
2676 return PointOfInstantiation;
2680 assert(Loc.
isValid() &&
"point of instantiation must be valid!");
2681 PointOfInstantiation = Loc;
2690 llvm::PointerUnion<VarTemplateDecl *, VarTemplatePartialSpecializationDecl *>
2696 return getSpecializedTemplateOrPartial();
2701 llvm::PointerUnion<VarTemplateDecl *, VarTemplatePartialSpecializationDecl *>
2703 if (
const auto *PartialSpec =
2704 SpecializedTemplate.dyn_cast<SpecializedPartialSpecialization *>())
2705 return PartialSpec->PartialSpecialization;
2722 if (
const auto *PartialSpec =
2723 SpecializedTemplate.dyn_cast<SpecializedPartialSpecialization *>())
2724 return *PartialSpec->TemplateArgs;
2726 return getTemplateArgs();
2734 assert(!SpecializedTemplate.is<SpecializedPartialSpecialization *>() &&
2735 "Already set to a variable template partial specialization!");
2736 auto *PS =
new (getASTContext()) SpecializedPartialSpecialization();
2737 PS->PartialSpecialization = PartialSpec;
2738 PS->TemplateArgs = TemplateArgs;
2739 SpecializedTemplate = PS;
2745 assert(!SpecializedTemplate.is<SpecializedPartialSpecialization *>() &&
2746 "Previously set to a variable template partial specialization!");
2747 SpecializedTemplate = TemplDecl;
2754 ExplicitInfo =
new (getASTContext()) ExplicitSpecializationInfo;
2755 ExplicitInfo->TypeAsWritten = T;
2761 return ExplicitInfo ? ExplicitInfo->TypeAsWritten :
nullptr;
2766 return ExplicitInfo ? ExplicitInfo->ExternLoc :
SourceLocation();
2772 ExplicitInfo =
new (getASTContext()) ExplicitSpecializationInfo;
2773 ExplicitInfo->ExternLoc = Loc;
2779 ExplicitInfo =
new (getASTContext()) ExplicitSpecializationInfo;
2780 ExplicitInfo->TemplateKeywordLoc = Loc;
2785 return ExplicitInfo ? ExplicitInfo->TemplateKeywordLoc :
SourceLocation();
2789 Profile(ID, TemplateArgs->
asArray(), getASTContext());
2795 ID.AddInteger(TemplateArgs.size());
2797 TemplateArg.Profile(ID, Context);
2803 return K >= firstVarTemplateSpecialization &&
2804 K <= lastVarTemplateSpecialization;
2822 llvm::PointerIntPair<VarTemplatePartialSpecializationDecl *, 1, bool>
2823 InstantiatedFromMember;
2835 InstantiatedFromMember(
nullptr,
false) {}
2837 void anchor()
override;
2854 return cast<VarTemplatePartialSpecializationDecl>(
2856 this)->getMostRecentDecl());
2861 return TemplateParams;
2866 return ArgsAsWritten;
2891 cast<VarTemplatePartialSpecializationDecl>(getFirstDecl());
2892 return First->InstantiatedFromMember.getPointer();
2897 auto *
First = cast<VarTemplatePartialSpecializationDecl>(getFirstDecl());
2898 First->InstantiatedFromMember.setPointer(PartialSpec);
2919 cast<VarTemplatePartialSpecializationDecl>(getFirstDecl());
2920 return First->InstantiatedFromMember.getInt();
2925 auto *
First = cast<VarTemplatePartialSpecializationDecl>(getFirstDecl());
2926 assert(
First->InstantiatedFromMember.getPointer() &&
2927 "Only member templates can be member template specializations");
2928 return First->InstantiatedFromMember.setInt(
true);
2934 return K == VarTemplatePartialSpecialization;
2950 llvm::FoldingSetVector<VarTemplatePartialSpecializationDecl>
2957 llvm::FoldingSetVector<VarTemplateSpecializationDecl> &
2958 getSpecializations()
const;
2962 llvm::FoldingSetVector<VarTemplatePartialSpecializationDecl> &
2963 getPartialSpecializations();
2981 void LoadLazySpecializations()
const;
2985 return static_cast<VarDecl *
>(TemplatedDecl);
2991 return getTemplatedDecl()->isThisDeclarationADefinition();
3024 return cast_or_null<VarTemplateDecl>(
3028 return cast_or_null<VarTemplateDecl>(
3030 this)->getPreviousDecl());
3034 return cast<VarTemplateDecl>(
3042 return cast_or_null<VarTemplateDecl>(
3057 void getPartialSpecializations(
3081 return makeSpecIterator(getSpecializations(),
false);
3085 return makeSpecIterator(getSpecializations(),
true);
3101 Expr *ConstraintExpr)
3103 ConstraintExpr(ConstraintExpr) {};
3108 Expr *ConstraintExpr);
3112 return ConstraintExpr;
3116 return SourceRange(getTemplateParameters()->getTemplateLoc(),
3130 if (
auto *PD = P.dyn_cast<TemplateTypeParmDecl *>())
3132 if (
auto *PD = P.dyn_cast<NonTypeTemplateParmDecl *>())
3139 return TD && (isa<ClassTemplateDecl>(TD) ||
3140 isa<ClassTemplatePartialSpecializationDecl>(TD) ||
3141 isa<TypeAliasTemplateDecl>(TD) ||
3142 isa<TemplateTemplateParmDecl>(TD))
3149 #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.
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.
VarTemplateSpecializationDecl * getMostRecentDecl()
ArrayRef< const NamedDecl * > asArray() const
MemberSpecializationInfo * getMemberSpecializationInfo() const
Get the specialization info if this function template specialization is also a member specialization:...
const ASTTemplateArgumentListInfo * getTemplateArgsAsWritten() 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.
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)
static const NamedDecl * getDefinition(const Decl *D)
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. ...
static ClassScopeFunctionSpecializationDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation Loc, CXXMethodDecl *FD, bool HasExplicitTemplateArgs, const TemplateArgumentListInfo &TemplateArgs)
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::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)
SourceLocation getEndLoc() const LLVM_READONLY
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.
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.
FunctionDecl * getFunction() const
Retrieve the declaration of the function template specialization.
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.
ConceptDecl(DeclContext *DC, SourceLocation L, DeclarationName Name, TemplateParameterList *Params, Expr *ConstraintExpr)
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.
void print(raw_ostream &Out, const ASTContext &Context, bool OmitTemplateKW=false) const
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 bool classofKind(Kind K)
static bool classof(const Decl *D)
static void Profile(llvm::FoldingSetNodeID &ID, ArrayRef< TemplateArgument > TemplateArgs, ASTContext &Context)
bool isClassScopeExplicitSpecialization() const
Is this an explicit specialization at class scope (within the class that owns the primary template)...
bool isClassScopeExplicitSpecialization() const
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)
Provides common interface for the Decls that cannot be redeclared, but can be merged if the same 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.
static const ASTTemplateArgumentListInfo * Create(ASTContext &C, const TemplateArgumentListInfo &List)
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...
SourceRange getSourceRange() const override LLVM_READONLY
Source range that this declaration covers.
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...
Expr * getConstraintExpr() const
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.