class TemplateTypeParmDecl
Declaration
class TemplateTypeParmDecl : public TypeDecl, private TrailingObjects { /* full declaration omitted */ };Description
Declaration of a template type parameter. For example, "T" in
Declared at: clang/include/clang/AST/DeclTemplate.h:1205
Inherits from: TypeDecl, TrailingObjects
Member Variables
- private bool Typename
- If false, it was declared with the 'class' keyword.
- private bool HasTypeConstraint
- Whether this template type parameter has a type-constraint construct.
- private bool TypeConstraintInitialized
- Whether the type constraint has been initialized. This can be false if the constraint was not initialized yet or if there was an error forming the type constraint.
- private bool ExpandedParameterPack
- Whether this non-type template parameter is an "expanded" parameter pack, meaning that its type is a pack expansion and we already know the set of types that expansion expands to.
- private unsigned int NumExpanded = 0
- The number of type parameters in an expanded parameter pack.
- private clang::TemplateTypeParmDecl::DefArgStorage DefaultArgument
Inherited from Decl:
- protected NextInContextAndBits
- protected Access
- protected FromASTFile
- protected IdentifierNamespace
- protected CacheValidAndLinkage
Method Overview
- public static clang::TemplateTypeParmDecl * Create(const clang::ASTContext & C, clang::DeclContext * DC, clang::SourceLocation KeyLoc, clang::SourceLocation NameLoc, unsigned int D, unsigned int P, clang::IdentifierInfo * Id, bool Typename, bool ParameterPack, bool HasTypeConstraint = false, Optional<unsigned int> NumExpanded = None)
- public static clang::TemplateTypeParmDecl * CreateDeserialized(const clang::ASTContext & C, unsigned int ID)
- public static clang::TemplateTypeParmDecl * CreateDeserialized(const clang::ASTContext & C, unsigned int ID, bool HasTypeConstraint)
- private TemplateTypeParmDecl(clang::DeclContext * DC, clang::SourceLocation KeyLoc, clang::SourceLocation IdLoc, clang::IdentifierInfo * Id, bool Typename, bool HasTypeConstraint, Optional<unsigned int> NumExpanded)
- public static bool classof(const clang::Decl * D)
- public static bool classofKind(clang::Decl::Kind K)
- public bool defaultArgumentWasInherited() const
- public void getAssociatedConstraints(llvm::SmallVectorImpl<const Expr *> & AC) const
- public const clang::TemplateTypeParmDecl::DefArgStorage & getDefaultArgStorage() const
- public clang::QualType getDefaultArgument() const
- public clang::TypeSourceInfo * getDefaultArgumentInfo() const
- public clang::SourceLocation getDefaultArgumentLoc() const
- public unsigned int getDepth() const
- public unsigned int getIndex() const
- public unsigned int getNumExpansionParameters() const
- public clang::SourceRange getSourceRange() const
- public const clang::TypeConstraint * getTypeConstraint() const
- public bool hasDefaultArgument() const
- public bool hasTypeConstraint() const
- public bool isExpandedParameterPack() const
- public bool isPackExpansion() const
- public bool isParameterPack() const
- public void removeDefaultArgument()
- public void setDeclaredWithTypename(bool withTypename)
- public void setDefaultArgument(clang::TypeSourceInfo * DefArg)
- public void setInheritedDefaultArgument(const clang::ASTContext & C, clang::TemplateTypeParmDecl * Prev)
- public void setTypeConstraint(clang::NestedNameSpecifierLoc NNS, clang::DeclarationNameInfo NameInfo, clang::NamedDecl * FoundDecl, clang::ConceptDecl * CD, const clang::ASTTemplateArgumentListInfo * ArgsAsWritten, clang::Expr * ImmediatelyDeclaredConstraint)
- public bool wasDeclaredWithTypename() const
Inherited from TypeDecl:
- public classof
- public classofKind
- public getBeginLoc
- public getSourceRange
- public getTypeForDecl
- public setLocStart
- public setTypeForDecl
Inherited from NamedDecl:
- public classof
- public classofKind
- public declarationReplaces
- public getDeclName
- public getExplicitVisibility
- public getFormalLinkage
- public getIdentifier
- public getLinkageAndVisibility
- public getLinkageInternal
- public getMostRecentDecl
- public getMostRecentDecl
- public getName
- public getNameAsString
- public getNameForDiagnostic
- public getObjCFStringFormattingFamily
- public getQualifiedNameAsString
- public getUnderlyingDecl
- public getUnderlyingDecl
- public getVisibility
- public hasExternalFormalLinkage
- public hasLinkage
- public hasLinkageBeenComputed
- public isCXXClassMember
- public isCXXInstanceMember
- public isExternallyDeclarable
- public isExternallyVisible
- public isLinkageValid
- public isReserved
- public printName
- public printNestedNameSpecifier
- public printNestedNameSpecifier
- public printQualifiedName
- public printQualifiedName
- public setDeclName
Inherited from Decl:
- public EnableStatistics
- public PrintStats
- public add
- public addAttr
- public attr_begin
- public attr_end
- public attrs
- public canBeWeakImported
- public castFromDeclContext
- public castToDeclContext
- public classofKind
- public dropAttr
- public dropAttrs
- public dump
- public dump
- public dumpColor
- public getASTContext
- protected getASTMutationListener
- public getAccess
- public getAccessUnsafe
- public getAsFunction
- public getAsFunction
- public getAttr
- public getAttrs
- public getAttrs
- public getAvailability
- public getBeginLoc
- public getBody
- public getBodyRBrace
- protected getCachedLinkage
- public getCanonicalDecl
- public getCanonicalDecl
- public getDeclContext
- public getDeclContext
- public getDeclKindName
- public getDefiningAttr
- public getDescribedTemplate
- public getDescribedTemplateParams
- public getEndLoc
- public getExternalSourceSymbolAttr
- public getFriendObjectKind
- public getFunctionType
- public getGlobalID
- public getID
- public getIdentifierNamespace
- public getIdentifierNamespaceForKind
- public getImportedOwningModule
- public getKind
- public getLangOpts
- public getLexicalDeclContext
- public getLexicalDeclContext
- public getLocalOwningModule
- public getLocation
- public getMaxAlignment
- public getModuleOwnershipKind
- public getMostRecentDecl
- public getMostRecentDecl
- protected getMostRecentDeclImpl
- public getNextDeclInContext
- public getNextDeclInContext
- protected getNextRedeclarationImpl
- public getNonClosureContext
- public getNonClosureContext
- public getOwningModule
- public getOwningModuleForLinkage
- public getOwningModuleID
- public getParentFunctionOrMethod
- public getParentFunctionOrMethod
- public getPreviousDecl
- public getPreviousDecl
- protected getPreviousDeclImpl
- public getSourceRange
- public getTemplateDepth
- public getTranslationUnitDecl
- public getTranslationUnitDecl
- public getVersionIntroduced
- public hasAttr
- public hasAttrs
- public hasBody
- protected hasCachedLinkage
- public hasDefiningAttr
- protected hasLocalOwningModuleStorage
- public hasOwningModule
- public hasTagIdentifierNamespace
- public isCanonicalDecl
- public isDefinedOutsideFunctionOrMethod
- public isDeprecated
- public isDiscardedInGlobalModuleFragment
- public isFirstDecl
- public isFromASTFile
- public isFunctionOrFunctionTemplate
- public isImplicit
- public isInAnonymousNamespace
- public isInExportDeclContext
- public isInIdentifierNamespace
- public isInLocalScopeForInstantiation
- public isInStdNamespace
- public isInvalidDecl
- public isInvisibleOutsideTheOwningModule
- public isLocalExternDecl
- public isModulePrivate
- public isOutOfLine
- public isParameterPack
- public isReachable
- public isReferenced
- public isTagIdentifierNamespace
- public isTemplateDecl
- public isTemplateParameter
- public isTemplateParameterPack
- public isTemplated
- public isThisDeclarationReferenced
- public isTopLevelDeclInObjCContainer
- public isUnavailable
- public isUnconditionallyVisible
- public isUsed
- public isWeakImported
- public markUsed
- public print
- public print
- public printGroup
- public redecls
- public redecls_begin
- public redecls_end
- public setAccess
- public setAttrs
- protected setCachedLinkage
- public setDeclContext
- public setFromASTFile
- public setImplicit
- public setInvalidDecl
- public setIsUsed
- public setLexicalDeclContext
- public setLocalExternDecl
- public setLocalOwningModule
- public setLocation
- public setModuleOwnershipKind
- protected setModulePrivate
- public setNonMemberOperator
- public setObjectOfFriendDecl
- public setOwningModuleID
- public setReferenced
- public setTopLevelDeclInObjCContainer
- public setVisibleDespiteOwningModule
- public specific_attr_begin
- public specific_attr_end
- public specific_attrs
- protected updateOutOfDate
Methods
¶static clang::TemplateTypeParmDecl* Create(
const clang::ASTContext& C,
clang::DeclContext* DC,
clang::SourceLocation KeyLoc,
clang::SourceLocation NameLoc,
unsigned int D,
unsigned int P,
clang::IdentifierInfo* Id,
bool Typename,
bool ParameterPack,
bool HasTypeConstraint = false,
Optional<unsigned int> NumExpanded = None)
static clang::TemplateTypeParmDecl* Create(
const clang::ASTContext& C,
clang::DeclContext* DC,
clang::SourceLocation KeyLoc,
clang::SourceLocation NameLoc,
unsigned int D,
unsigned int P,
clang::IdentifierInfo* Id,
bool Typename,
bool ParameterPack,
bool HasTypeConstraint = false,
Optional<unsigned int> NumExpanded = None)Declared at: clang/include/clang/AST/DeclTemplate.h:1248
Parameters
- const clang::ASTContext& C
- clang::DeclContext* DC
- clang::SourceLocation KeyLoc
- clang::SourceLocation NameLoc
- unsigned int D
- unsigned int P
- clang::IdentifierInfo* Id
- bool Typename
- bool ParameterPack
- bool HasTypeConstraint = false
- Optional<unsigned int> NumExpanded = None
¶static clang::TemplateTypeParmDecl*
CreateDeserialized(const clang::ASTContext& C,
unsigned int ID)
static clang::TemplateTypeParmDecl*
CreateDeserialized(const clang::ASTContext& C,
unsigned int ID)Declared at: clang/include/clang/AST/DeclTemplate.h:1256
Parameters
- const clang::ASTContext& C
- unsigned int ID
¶static clang::TemplateTypeParmDecl*
CreateDeserialized(const clang::ASTContext& C,
unsigned int ID,
bool HasTypeConstraint)
static clang::TemplateTypeParmDecl*
CreateDeserialized(const clang::ASTContext& C,
unsigned int ID,
bool HasTypeConstraint)Declared at: clang/include/clang/AST/DeclTemplate.h:1258
Parameters
- const clang::ASTContext& C
- unsigned int ID
- bool HasTypeConstraint
¶TemplateTypeParmDecl(
clang::DeclContext* DC,
clang::SourceLocation KeyLoc,
clang::SourceLocation IdLoc,
clang::IdentifierInfo* Id,
bool Typename,
bool HasTypeConstraint,
Optional<unsigned int> NumExpanded)
TemplateTypeParmDecl(
clang::DeclContext* DC,
clang::SourceLocation KeyLoc,
clang::SourceLocation IdLoc,
clang::IdentifierInfo* Id,
bool Typename,
bool HasTypeConstraint,
Optional<unsigned int> NumExpanded)Declared at: clang/include/clang/AST/DeclTemplate.h:1239
Parameters
- clang::DeclContext* DC
- clang::SourceLocation KeyLoc
- clang::SourceLocation IdLoc
- clang::IdentifierInfo* Id
- bool Typename
- bool HasTypeConstraint
- Optional<unsigned int> NumExpanded
¶static bool classof(const clang::Decl* D)
static bool classof(const clang::Decl* D)Declared at: clang/include/clang/AST/DeclTemplate.h:1401
Parameters
- const clang::Decl* D
¶static bool classofKind(clang::Decl::Kind K)
static bool classofKind(clang::Decl::Kind K)Declared at: clang/include/clang/AST/DeclTemplate.h:1402
Parameters
- clang::Decl::Kind K
¶bool defaultArgumentWasInherited() const
bool defaultArgumentWasInherited() constDescription
Determines whether the default argument was inherited from a previous declaration of this template.
Declared at: clang/include/clang/AST/DeclTemplate.h:1292
¶void getAssociatedConstraints(
llvm::SmallVectorImpl<const Expr*>& AC) const
void getAssociatedConstraints(
llvm::SmallVectorImpl<const Expr*>& AC) constDescription
Get the associated-constraints of this template parameter. This will either be the immediately-introduced constraint or empty.
Use this instead of getConstraintExpression for concepts APIs that accept an ArrayRef of constraint expressions.
Declared at: clang/include/clang/AST/DeclTemplate.h:1393
Parameters
- llvm::SmallVectorImpl<const Expr*>& AC
¶const clang::TemplateTypeParmDecl::DefArgStorage&
getDefaultArgStorage() const
const clang::TemplateTypeParmDecl::DefArgStorage&
getDefaultArgStorage() constDeclared at: clang/include/clang/AST/DeclTemplate.h:1271
¶clang::QualType getDefaultArgument() const
clang::QualType getDefaultArgument() constDescription
Retrieve the default argument, if any.
Declared at: clang/include/clang/AST/DeclTemplate.h:1278
¶clang::TypeSourceInfo* getDefaultArgumentInfo()
const
clang::TypeSourceInfo* getDefaultArgumentInfo()
constDescription
Retrieves the default argument's source information, if any.
Declared at: clang/include/clang/AST/DeclTemplate.h:1283
¶clang::SourceLocation getDefaultArgumentLoc()
const
clang::SourceLocation getDefaultArgumentLoc()
constDescription
Retrieves the location of the default argument declaration.
Declared at: clang/include/clang/AST/DeclTemplate.h:1288
¶unsigned int getDepth() const
unsigned int getDepth() constDescription
Retrieve the depth of the template parameter.
Declared at: clang/include/clang/AST/DeclTemplate.h:1318
¶unsigned int getIndex() const
unsigned int getIndex() constDescription
Retrieve the index of the template parameter.
Declared at: clang/include/clang/AST/DeclTemplate.h:1321
¶unsigned int getNumExpansionParameters() const
unsigned int getNumExpansionParameters() constDescription
Retrieves the number of parameters in an expanded parameter pack.
Declared at: clang/include/clang/AST/DeclTemplate.h:1365
¶clang::SourceRange getSourceRange() const
clang::SourceRange getSourceRange() constDescription
Source range that this declaration covers.
Declared at: clang/include/clang/AST/DeclTemplate.h:1398
¶const clang::TypeConstraint* getTypeConstraint()
const
const clang::TypeConstraint* getTypeConstraint()
constDescription
Returns the type constraint associated with this template parameter (if any).
Declared at: clang/include/clang/AST/DeclTemplate.h:1372
¶bool hasDefaultArgument() const
bool hasDefaultArgument() constDescription
Determine whether this template parameter has a default argument.
Declared at: clang/include/clang/AST/DeclTemplate.h:1275
¶bool hasTypeConstraint() const
bool hasTypeConstraint() constDescription
Determine whether this template parameter has a type-constraint.
Declared at: clang/include/clang/AST/DeclTemplate.h:1384
¶bool isExpandedParameterPack() const
bool isExpandedParameterPack() constDescription
Whether this parameter is a template type parameter pack that has a known list of different type-constraints at different positions. A parameter pack is an expanded parameter pack when the original parameter pack's type-constraint was itself a pack expansion, and that expansion has already been expanded. For example, given: The parameter pack \c Convertibles has (convertible_to <Types > & & ...) as its type-constraint. When \c Types is supplied with template arguments by instantiating \c X, the instantiation of \c Convertibles becomes an expanded parameter pack. For example, instantiating\c X<int, unsigned int> results in \c Convertibles being an expanded parameter pack of size 2 (use getNumExpansionTypes() to get this number).
Declared at: clang/include/clang/AST/DeclTemplate.h:1362
¶bool isPackExpansion() const
bool isPackExpansion() constDescription
Whether this parameter pack is a pack expansion. A template type template parameter pack can be a pack expansion if its type-constraint contains an unexpanded parameter pack.
Declared at: clang/include/clang/AST/DeclTemplate.h:1330
¶bool isParameterPack() const
bool isParameterPack() constDescription
Returns whether this is a parameter pack.
Declared at: clang/include/clang/AST/DeclTemplate.h:1324
¶void removeDefaultArgument()
void removeDefaultArgument()Description
Removes the default argument of this template parameter.
Declared at: clang/include/clang/AST/DeclTemplate.h:1309
¶void setDeclaredWithTypename(bool withTypename)
void setDeclaredWithTypename(bool withTypename)Description
Set whether this template type parameter was declared with the 'typename' or 'class' keyword.
Declared at: clang/include/clang/AST/DeclTemplate.h:1315
Parameters
- bool withTypename
¶void setDefaultArgument(
clang::TypeSourceInfo* DefArg)
void setDefaultArgument(
clang::TypeSourceInfo* DefArg)Description
Set the default argument for this template parameter.
Declared at: clang/include/clang/AST/DeclTemplate.h:1297
Parameters
- clang::TypeSourceInfo* DefArg
¶void setInheritedDefaultArgument(
const clang::ASTContext& C,
clang::TemplateTypeParmDecl* Prev)
void setInheritedDefaultArgument(
const clang::ASTContext& C,
clang::TemplateTypeParmDecl* Prev)Description
Set that this default argument was inherited from another parameter.
Declared at: clang/include/clang/AST/DeclTemplate.h:1303
Parameters
- const clang::ASTContext& C
- clang::TemplateTypeParmDecl* Prev
¶void setTypeConstraint(
clang::NestedNameSpecifierLoc NNS,
clang::DeclarationNameInfo NameInfo,
clang::NamedDecl* FoundDecl,
clang::ConceptDecl* CD,
const clang::ASTTemplateArgumentListInfo*
ArgsAsWritten,
clang::Expr* ImmediatelyDeclaredConstraint)
void setTypeConstraint(
clang::NestedNameSpecifierLoc NNS,
clang::DeclarationNameInfo NameInfo,
clang::NamedDecl* FoundDecl,
clang::ConceptDecl* CD,
const clang::ASTTemplateArgumentListInfo*
ArgsAsWritten,
clang::Expr* ImmediatelyDeclaredConstraint)Declared at: clang/include/clang/AST/DeclTemplate.h:1377
Parameters
- clang::NestedNameSpecifierLoc NNS
- clang::DeclarationNameInfo NameInfo
- clang::NamedDecl* FoundDecl
- clang::ConceptDecl* CD
- const clang::ASTTemplateArgumentListInfo* ArgsAsWritten
- clang::Expr* ImmediatelyDeclaredConstraint
¶bool wasDeclaredWithTypename() const
bool wasDeclaredWithTypename() constDescription
Whether this template type parameter was declared with the 'typename' keyword. If not, it was either declared with the 'class' keyword or with a type-constraint (see hasTypeConstraint()).
Declared at: clang/include/clang/AST/DeclTemplate.h:1267