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:

Inherited from ValueDecl:

Inherited from NamedDecl:

Inherited from Decl:

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)

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)

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)

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)

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)

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)

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)

Declared at: clang/include/clang/AST/DeclTemplate.h:1616

Parameters

const clang::Decl* D

static bool classofKind(clang::Decl::Kind K)

Declared at: clang/include/clang/AST/DeclTemplate.h:1617

Parameters

clang::Decl::Kind K

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

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

Declared at: clang/include/clang/AST/DeclTemplate.h:1485

clang::Expr* getDefaultArgument() const

Description

Retrieve the default argument, if any.

Declared at: clang/include/clang/AST/DeclTemplate.h:1492

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

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

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

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

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

Description

Source range that this declaration covers.

Declared at: clang/include/clang/AST/DeclTemplate.h:1483

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

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

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

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

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

Declared at: clang/include/clang/AST/DeclTemplate.h:1438

Parameters

OverloadToken< std::pair<QualType, TypeSourceInfo*>>

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)

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)

Declared at: clang/include/clang/AST/DeclTemplate.h:1507

Parameters

const clang::ASTContext& C
clang::NonTypeTemplateParmDecl* Parm

void setPlaceholderTypeConstraint(clang::Expr* E)

Declared at: clang/include/clang/AST/DeclTemplate.h:1593

Parameters

clang::Expr* E