class NonTypeTemplateParmDecl
Declaration
class NonTypeTemplateParmDecl : public DeclaratorDecl,
protected TemplateParmPosition,
private TrailingObjects { /* full declaration omitted */ };
Description
NonTypeTemplateParmDecl - Declares a non-type template parameter, e.g., "Size" in
Declared at: clang/include/clang/AST/DeclTemplate.h:1410
Inherits from: DeclaratorDecl, TemplateParmPosition, TrailingObjects
Member Variables
- private clang::NonTypeTemplateParmDecl::DefArgStorage DefaultArgument
- private bool ParameterPack
- Whether this non-type template parameter is a parameter pack.
- private bool ExpandedParameterPack = false
- 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 NumExpandedTypes = 0
- The number of types in an expanded parameter pack.
Inherited from TemplateParmPosition:
- protected Depth
- protected Position
- protected static MaxDepth = (1U << DepthWidth) - 1
- protected static MaxPosition = (1U << PositionWidth) - 1
Inherited from Decl:
- protected NextInContextAndBits
- protected Access
- protected FromASTFile
- protected IdentifierNamespace
- protected CacheValidAndLinkage
Method Overview
- public static clang::NonTypeTemplateParmDecl * Create(const clang::ASTContext & C, clang::DeclContext * DC, clang::SourceLocation StartLoc, clang::SourceLocation IdLoc, unsigned int D, unsigned int P, clang::IdentifierInfo * Id, clang::QualType T, bool ParameterPack, clang::TypeSourceInfo * TInfo)
- public static clang::NonTypeTemplateParmDecl * Create(const clang::ASTContext & C, clang::DeclContext * DC, clang::SourceLocation StartLoc, clang::SourceLocation IdLoc, unsigned int D, unsigned int P, clang::IdentifierInfo * Id, clang::QualType T, clang::TypeSourceInfo * TInfo, ArrayRef<clang::QualType> ExpandedTypes, ArrayRef<clang::TypeSourceInfo *> ExpandedTInfos)
- public static clang::NonTypeTemplateParmDecl * CreateDeserialized(clang::ASTContext & C, unsigned int ID, bool HasTypeConstraint)
- public static clang::NonTypeTemplateParmDecl * CreateDeserialized(clang::ASTContext & C, unsigned int ID, unsigned int NumExpandedTypes, bool HasTypeConstraint)
- private NonTypeTemplateParmDecl(clang::DeclContext * DC, clang::SourceLocation StartLoc, clang::SourceLocation IdLoc, unsigned int D, unsigned int P, clang::IdentifierInfo * Id, clang::QualType T, bool ParameterPack, clang::TypeSourceInfo * TInfo)
- private NonTypeTemplateParmDecl(clang::DeclContext * DC, clang::SourceLocation StartLoc, clang::SourceLocation IdLoc, unsigned int D, unsigned int P, clang::IdentifierInfo * Id, clang::QualType T, clang::TypeSourceInfo * TInfo, ArrayRef<clang::QualType> ExpandedTypes, ArrayRef<clang::TypeSourceInfo *> ExpandedTInfos)
- 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::NonTypeTemplateParmDecl::DefArgStorage & getDefaultArgStorage() const
- public clang::Expr * getDefaultArgument() const
- public clang::SourceLocation getDefaultArgumentLoc() const
- public clang::QualType getExpansionType(unsigned int I) const
- public clang::TypeSourceInfo * getExpansionTypeSourceInfo(unsigned int I) const
- public unsigned int getNumExpansionTypes() const
- public clang::Expr * getPlaceholderTypeConstraint() const
- public clang::SourceRange getSourceRange() const
- public bool hasDefaultArgument() const
- public bool hasPlaceholderTypeConstraint() const
- public bool isExpandedParameterPack() const
- public bool isPackExpansion() const
- public bool isParameterPack() const
- private size_t numTrailingObjects(OverloadToken<std::pair<QualType, TypeSourceInfo *>>) const
- public void removeDefaultArgument()
- public void setDefaultArgument(clang::Expr * DefArg)
- public void setInheritedDefaultArgument(const clang::ASTContext & C, clang::NonTypeTemplateParmDecl * Parm)
- public void setPlaceholderTypeConstraint(clang::Expr * E)
Inherited from TemplateParmPosition:
Inherited from DeclaratorDecl:
- public classof
- public classofKind
- public getBeginLoc
- public getInnerLocStart
- public getNumTemplateParameterLists
- public getOuterLocStart
- public getQualifier
- public getQualifierLoc
- public getSourceRange
- public getTemplateParameterList
- public getTrailingRequiresClause
- public getTrailingRequiresClause
- public getTypeSourceInfo
- public getTypeSpecEndLoc
- public getTypeSpecStartLoc
- public setInnerLocStart
- public setQualifierInfo
- public setTemplateParameterListsInfo
- public setTrailingRequiresClause
- public setTypeSourceInfo
Inherited from ValueDecl:
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::NonTypeTemplateParmDecl* Create(
const clang::ASTContext& C,
clang::DeclContext* DC,
clang::SourceLocation StartLoc,
clang::SourceLocation IdLoc,
unsigned int D,
unsigned int P,
clang::IdentifierInfo* Id,
clang::QualType T,
bool ParameterPack,
clang::TypeSourceInfo* TInfo)
static clang::NonTypeTemplateParmDecl* Create(
const clang::ASTContext& C,
clang::DeclContext* DC,
clang::SourceLocation StartLoc,
clang::SourceLocation IdLoc,
unsigned int D,
unsigned int P,
clang::IdentifierInfo* Id,
clang::QualType T,
bool ParameterPack,
clang::TypeSourceInfo* TInfo)
Declared at: clang/include/clang/AST/DeclTemplate.h:1459
Parameters
- const clang::ASTContext& C
- clang::DeclContext* DC
- clang::SourceLocation StartLoc
- clang::SourceLocation IdLoc
- unsigned int D
- unsigned int P
- clang::IdentifierInfo* Id
- clang::QualType T
- bool ParameterPack
- clang::TypeSourceInfo* TInfo
¶static clang::NonTypeTemplateParmDecl* Create(
const clang::ASTContext& C,
clang::DeclContext* DC,
clang::SourceLocation StartLoc,
clang::SourceLocation IdLoc,
unsigned int D,
unsigned int P,
clang::IdentifierInfo* Id,
clang::QualType T,
clang::TypeSourceInfo* TInfo,
ArrayRef<clang::QualType> ExpandedTypes,
ArrayRef<clang::TypeSourceInfo*>
ExpandedTInfos)
static clang::NonTypeTemplateParmDecl* Create(
const clang::ASTContext& C,
clang::DeclContext* DC,
clang::SourceLocation StartLoc,
clang::SourceLocation IdLoc,
unsigned int D,
unsigned int P,
clang::IdentifierInfo* Id,
clang::QualType T,
clang::TypeSourceInfo* TInfo,
ArrayRef<clang::QualType> ExpandedTypes,
ArrayRef<clang::TypeSourceInfo*>
ExpandedTInfos)
Declared at: clang/include/clang/AST/DeclTemplate.h:1464
Parameters
- const clang::ASTContext& C
- clang::DeclContext* DC
- clang::SourceLocation StartLoc
- clang::SourceLocation IdLoc
- unsigned int D
- unsigned int P
- clang::IdentifierInfo* Id
- clang::QualType T
- clang::TypeSourceInfo* TInfo
- ArrayRef<clang::QualType> ExpandedTypes
- ArrayRef<clang::TypeSourceInfo*> ExpandedTInfos
¶static clang::NonTypeTemplateParmDecl*
CreateDeserialized(clang::ASTContext& C,
unsigned int ID,
bool HasTypeConstraint)
static clang::NonTypeTemplateParmDecl*
CreateDeserialized(clang::ASTContext& C,
unsigned int ID,
bool HasTypeConstraint)
Declared at: clang/include/clang/AST/DeclTemplate.h:1469
Parameters
- clang::ASTContext& C
- unsigned int ID
- bool HasTypeConstraint
¶static clang::NonTypeTemplateParmDecl*
CreateDeserialized(clang::ASTContext& C,
unsigned int ID,
unsigned int NumExpandedTypes,
bool HasTypeConstraint)
static clang::NonTypeTemplateParmDecl*
CreateDeserialized(clang::ASTContext& C,
unsigned int ID,
unsigned int NumExpandedTypes,
bool HasTypeConstraint)
Declared at: clang/include/clang/AST/DeclTemplate.h:1472
Parameters
- clang::ASTContext& C
- unsigned int ID
- unsigned int NumExpandedTypes
- bool HasTypeConstraint
¶NonTypeTemplateParmDecl(
clang::DeclContext* DC,
clang::SourceLocation StartLoc,
clang::SourceLocation IdLoc,
unsigned int D,
unsigned int P,
clang::IdentifierInfo* Id,
clang::QualType T,
bool ParameterPack,
clang::TypeSourceInfo* TInfo)
NonTypeTemplateParmDecl(
clang::DeclContext* DC,
clang::SourceLocation StartLoc,
clang::SourceLocation IdLoc,
unsigned int D,
unsigned int P,
clang::IdentifierInfo* Id,
clang::QualType T,
bool ParameterPack,
clang::TypeSourceInfo* TInfo)
Declared at: clang/include/clang/AST/DeclTemplate.h:1443
Parameters
- clang::DeclContext* DC
- clang::SourceLocation StartLoc
- clang::SourceLocation IdLoc
- unsigned int D
- unsigned int P
- clang::IdentifierInfo* Id
- clang::QualType T
- bool ParameterPack
- clang::TypeSourceInfo* TInfo
¶NonTypeTemplateParmDecl(
clang::DeclContext* DC,
clang::SourceLocation StartLoc,
clang::SourceLocation IdLoc,
unsigned int D,
unsigned int P,
clang::IdentifierInfo* Id,
clang::QualType T,
clang::TypeSourceInfo* TInfo,
ArrayRef<clang::QualType> ExpandedTypes,
ArrayRef<clang::TypeSourceInfo*>
ExpandedTInfos)
NonTypeTemplateParmDecl(
clang::DeclContext* DC,
clang::SourceLocation StartLoc,
clang::SourceLocation IdLoc,
unsigned int D,
unsigned int P,
clang::IdentifierInfo* Id,
clang::QualType T,
clang::TypeSourceInfo* TInfo,
ArrayRef<clang::QualType> ExpandedTypes,
ArrayRef<clang::TypeSourceInfo*>
ExpandedTInfos)
Declared at: clang/include/clang/AST/DeclTemplate.h:1450
Parameters
- clang::DeclContext* DC
- clang::SourceLocation StartLoc
- clang::SourceLocation IdLoc
- unsigned int D
- unsigned int P
- clang::IdentifierInfo* Id
- clang::QualType T
- clang::TypeSourceInfo* TInfo
- ArrayRef<clang::QualType> ExpandedTypes
- ArrayRef<clang::TypeSourceInfo*> ExpandedTInfos
¶static bool classof(const clang::Decl* D)
static bool classof(const clang::Decl* D)
Declared at: clang/include/clang/AST/DeclTemplate.h:1616
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:1617
Parameters
- clang::Decl::Kind K
¶bool defaultArgumentWasInherited() const
bool defaultArgumentWasInherited() const
Description
Determines whether the default argument was inherited from a previous declaration of this template.
Declared at: clang/include/clang/AST/DeclTemplate.h:1499
¶void getAssociatedConstraints(
llvm::SmallVectorImpl<const Expr*>& AC) const
void getAssociatedConstraints(
llvm::SmallVectorImpl<const Expr*>& AC) const
Description
Get the associated-constraints of this template parameter. This will either be a vector of size 1 containing the immediately-declared constraint introduced by the placeholder type, or an empty vector.
Use this instead of getPlaceholderImmediatelyDeclaredConstraint for concepts APIs that accept an ArrayRef of constraint expressions.
Declared at: clang/include/clang/AST/DeclTemplate.h:1610
Parameters
- llvm::SmallVectorImpl<const Expr*>& AC
¶const clang::NonTypeTemplateParmDecl::
DefArgStorage&
getDefaultArgStorage() const
const clang::NonTypeTemplateParmDecl::
DefArgStorage&
getDefaultArgStorage() const
Declared at: clang/include/clang/AST/DeclTemplate.h:1485
¶clang::Expr* getDefaultArgument() const
clang::Expr* getDefaultArgument() const
Description
Retrieve the default argument, if any.
Declared at: clang/include/clang/AST/DeclTemplate.h:1492
¶clang::SourceLocation getDefaultArgumentLoc()
const
clang::SourceLocation getDefaultArgumentLoc()
const
Description
Retrieve the location of the default argument, if any.
Declared at: clang/include/clang/AST/DeclTemplate.h:1495
¶clang::QualType getExpansionType(
unsigned int I) const
clang::QualType getExpansionType(
unsigned int I) const
Description
Retrieve a particular expansion type within an expanded parameter pack.
Declared at: clang/include/clang/AST/DeclTemplate.h:1570
Parameters
- unsigned int I
¶clang::TypeSourceInfo* getExpansionTypeSourceInfo(
unsigned int I) const
clang::TypeSourceInfo* getExpansionTypeSourceInfo(
unsigned int I) const
Description
Retrieve a particular expansion type source info within an expanded parameter pack.
Declared at: clang/include/clang/AST/DeclTemplate.h:1579
Parameters
- unsigned int I
¶unsigned int getNumExpansionTypes() const
unsigned int getNumExpansionTypes() const
Description
Retrieves the number of expansion types in an expanded parameter pack.
Declared at: clang/include/clang/AST/DeclTemplate.h:1563
¶clang::Expr* getPlaceholderTypeConstraint() const
clang::Expr* getPlaceholderTypeConstraint() const
Description
Return the constraint introduced by the placeholder type of this non-type template parameter (if any).
Declared at: clang/include/clang/AST/DeclTemplate.h:1588
¶clang::SourceRange getSourceRange() const
clang::SourceRange getSourceRange() const
Description
Source range that this declaration covers.
Declared at: clang/include/clang/AST/DeclTemplate.h:1483
¶bool hasDefaultArgument() const
bool hasDefaultArgument() const
Description
Determine whether this template parameter has a default argument.
Declared at: clang/include/clang/AST/DeclTemplate.h:1489
¶bool hasPlaceholderTypeConstraint() const
bool hasPlaceholderTypeConstraint() const
Description
Determine whether this non-type template parameter's type has a placeholder with a type-constraint.
Declared at: clang/include/clang/AST/DeclTemplate.h:1599
¶bool isExpandedParameterPack() const
bool isExpandedParameterPack() const
Description
Whether this parameter is a non-type template parameter pack that has a known list of different types at different positions. A parameter pack is an expanded parameter pack when the original parameter pack's type was itself a pack expansion, and that expansion has already been expanded. For example, given: The parameter pack \c Values has a \c PackExpansionType as its type, which expands \c Types. When \c Types is supplied with template arguments by instantiating \c X, the instantiation of \c Values becomes an expanded parameter pack. For example, instantiating\c X<int, unsigned int> results in \c Values being an expanded parameter pack with expansion types \c int and \c unsigned int. The \c getExpansionType() and \c getExpansionTypeSourceInfo() functions return the expansion types.
Declared at: clang/include/clang/AST/DeclTemplate.h:1559
¶bool isPackExpansion() const
bool isPackExpansion() const
Description
Whether this parameter pack is a pack expansion. A non-type template parameter pack is a pack expansion if its type contains an unexpanded parameter pack. In this case, we will have built a PackExpansionType wrapping the type.
Declared at: clang/include/clang/AST/DeclTemplate.h:1531
¶bool isParameterPack() const
bool isParameterPack() const
Description
Whether this parameter is a non-type template parameter pack. If the parameter is a parameter pack, the type may be a\c PackExpansionType. In the following example, the \c Dims parameter is a parameter pack (whose type is 'unsigned').
Declared at: clang/include/clang/AST/DeclTemplate.h:1524
¶size_t numTrailingObjects(
OverloadToken<
std::pair<QualType, TypeSourceInfo*>>)
const
size_t numTrailingObjects(
OverloadToken<
std::pair<QualType, TypeSourceInfo*>>)
const
Declared at: clang/include/clang/AST/DeclTemplate.h:1438
Parameters
- OverloadToken< std::pair<QualType, TypeSourceInfo*>>
¶void removeDefaultArgument()
void removeDefaultArgument()
Description
Removes the default argument of this template parameter.
Declared at: clang/include/clang/AST/DeclTemplate.h:1513
¶void setDefaultArgument(clang::Expr* DefArg)
void setDefaultArgument(clang::Expr* DefArg)
Description
Set the default argument for this template parameter, and whether that default argument was inherited from another declaration.
Declared at: clang/include/clang/AST/DeclTemplate.h:1506
Parameters
- clang::Expr* DefArg
¶void setInheritedDefaultArgument(
const clang::ASTContext& C,
clang::NonTypeTemplateParmDecl* Parm)
void setInheritedDefaultArgument(
const clang::ASTContext& C,
clang::NonTypeTemplateParmDecl* Parm)
Declared at: clang/include/clang/AST/DeclTemplate.h:1507
Parameters
- const clang::ASTContext& C
- clang::NonTypeTemplateParmDecl* Parm
¶void setPlaceholderTypeConstraint(clang::Expr* E)
void setPlaceholderTypeConstraint(clang::Expr* E)
Declared at: clang/include/clang/AST/DeclTemplate.h:1593
Parameters
- clang::Expr* E