clang API Documentation

Public Member Functions | Static Public Member Functions | Friends
clang::NonTypeTemplateParmDecl Class Reference

#include <DeclTemplate.h>

Inheritance diagram for clang::NonTypeTemplateParmDecl:
Inheritance graph
[legend]
Collaboration diagram for clang::NonTypeTemplateParmDecl:
Collaboration graph
[legend]

List of all members.

Public Member Functions

SourceRange getSourceRange () const override LLVM_READONLY
 Source range that this declaration covers.
bool hasDefaultArgument () const
 Determine whether this template parameter has a default argument.
ExprgetDefaultArgument () const
 Retrieve the default argument, if any.
SourceLocation getDefaultArgumentLoc () const
 Retrieve the location of the default argument, if any.
bool defaultArgumentWasInherited () const
 Determines whether the default argument was inherited from a previous declaration of this template.
void setDefaultArgument (Expr *DefArg, bool Inherited)
 Set the default argument for this template parameter, and whether that default argument was inherited from another declaration.
void removeDefaultArgument ()
 Removes the default argument of this template parameter.
bool isParameterPack () const
 Whether this parameter is a non-type template parameter pack.
bool isPackExpansion () const
 Whether this parameter pack is a pack expansion.
bool isExpandedParameterPack () const
 Whether this parameter is a non-type template parameter pack that has a known list of different types at different positions.
unsigned getNumExpansionTypes () const
 Retrieves the number of expansion types in an expanded parameter pack.
QualType getExpansionType (unsigned I) const
 Retrieve a particular expansion type within an expanded parameter pack.
TypeSourceInfogetExpansionTypeSourceInfo (unsigned I) const
 Retrieve a particular expansion type source info within an expanded parameter pack.

Static Public Member Functions

static NonTypeTemplateParmDeclCreate (const ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, unsigned D, unsigned P, IdentifierInfo *Id, QualType T, bool ParameterPack, TypeSourceInfo *TInfo)
static NonTypeTemplateParmDeclCreate (const ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, unsigned D, unsigned P, IdentifierInfo *Id, QualType T, TypeSourceInfo *TInfo, const QualType *ExpandedTypes, unsigned NumExpandedTypes, TypeSourceInfo **ExpandedTInfos)
static NonTypeTemplateParmDeclCreateDeserialized (ASTContext &C, unsigned ID)
static NonTypeTemplateParmDeclCreateDeserialized (ASTContext &C, unsigned ID, unsigned NumExpandedTypes)
static bool classof (const Decl *D)
static bool classofKind (Kind K)

Friends

class ASTDeclReader

Detailed Description

NonTypeTemplateParmDecl - Declares a non-type template parameter, e.g., "Size" in

 template<int Size> class array { };

Definition at line 1032 of file DeclTemplate.h.


Member Function Documentation

static bool clang::NonTypeTemplateParmDecl::classof ( const Decl D) [inline, static]

Reimplemented from clang::DeclaratorDecl.

Definition at line 1203 of file DeclTemplate.h.

References classofKind(), and clang::Decl::getKind().

static bool clang::NonTypeTemplateParmDecl::classofKind ( Kind  K) [inline, static]

Reimplemented from clang::DeclaratorDecl.

Definition at line 1204 of file DeclTemplate.h.

Referenced by classof().

NonTypeTemplateParmDecl * NonTypeTemplateParmDecl::Create ( const ASTContext C,
DeclContext DC,
SourceLocation  StartLoc,
SourceLocation  IdLoc,
unsigned  D,
unsigned  P,
IdentifierInfo Id,
QualType  T,
bool  ParameterPack,
TypeSourceInfo TInfo 
) [static]
NonTypeTemplateParmDecl * NonTypeTemplateParmDecl::Create ( const ASTContext C,
DeclContext DC,
SourceLocation  StartLoc,
SourceLocation  IdLoc,
unsigned  D,
unsigned  P,
IdentifierInfo Id,
QualType  T,
TypeSourceInfo TInfo,
const QualType ExpandedTypes,
unsigned  NumExpandedTypes,
TypeSourceInfo **  ExpandedTInfos 
) [static]

Definition at line 549 of file DeclTemplate.cpp.

References AttributeLangSupport::C.

Definition at line 564 of file DeclTemplate.cpp.

References AttributeLangSupport::C.

Definition at line 571 of file DeclTemplate.cpp.

References AttributeLangSupport::C.

Determines whether the default argument was inherited from a previous declaration of this template.

Definition at line 1115 of file DeclTemplate.h.

Referenced by getSourceRange(), and clang::ASTDeclWriter::VisitNonTypeTemplateParmDecl().

Retrieve the location of the default argument, if any.

Definition at line 586 of file DeclTemplate.cpp.

References clang::SourceRange::getBegin(), getDefaultArgument(), clang::Stmt::getSourceRange(), and hasDefaultArgument().

Referenced by clang::Sema::CheckTemplateParameterList().

Retrieve a particular expansion type within an expanded parameter pack.

Definition at line 1188 of file DeclTemplate.h.

References clang::QualType::getFromOpaquePtr().

Referenced by clang::ASTDeclWriter::VisitNonTypeTemplateParmDecl().

Retrieve a particular expansion type source info within an expanded parameter pack.

Definition at line 1196 of file DeclTemplate.h.

Referenced by clang::ASTDeclWriter::VisitNonTypeTemplateParmDecl().

Retrieves the number of expansion types in an expanded parameter pack.

Definition at line 1181 of file DeclTemplate.h.

Referenced by clang::ASTDeclWriter::VisitNonTypeTemplateParmDecl(), and clang::ASTDeclReader::VisitNonTypeTemplateParmDecl().

Source range that this declaration covers.

Reimplemented from clang::DeclaratorDecl.

Definition at line 579 of file DeclTemplate.cpp.

References defaultArgumentWasInherited(), getDefaultArgument(), clang::DeclaratorDecl::getOuterLocStart(), and hasDefaultArgument().

Determine whether this template parameter has a default argument.

Definition at line 1101 of file DeclTemplate.h.

Referenced by clang::Sema::CheckTemplateParameterList(), getDefaultArgumentLoc(), and getSourceRange().

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:

 template<typename ...Types>
 struct X {
   template<Types ...Values>
   struct Y { /* ... */ };
 };

The parameter pack Values has a PackExpansionType as its type, which expands Types. When Types is supplied with template arguments by instantiating X, the instantiation of Values becomes an expanded parameter pack. For example, instantiating X<int, unsigned int> results in Values being an expanded parameter pack with expansion types int and unsigned int.

The getExpansionType() and getExpansionTypeSourceInfo() functions return the expansion types.

Definition at line 1177 of file DeclTemplate.h.

Referenced by clang::ASTDeclWriter::VisitNonTypeTemplateParmDecl(), and clang::ASTDeclReader::VisitNonTypeTemplateParmDecl().

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.

Definition at line 1149 of file DeclTemplate.h.

References clang::Type::getAs(), and clang::ValueDecl::getType().

Whether this parameter is a non-type template parameter pack.

If the parameter is a parameter pack, the type may be a PackExpansionType. In the following example, the Dims parameter is a parameter pack (whose type is 'unsigned').

 template<typename T, unsigned ...Dims> struct multi_array;

Reimplemented from clang::Decl.

Definition at line 1142 of file DeclTemplate.h.

Referenced by isSameTemplateParameter(), IsStructurallyEquivalent(), clang::ASTDeclWriter::VisitNonTypeTemplateParmDecl(), and clang::ASTNodeImporter::VisitNonTypeTemplateParmDecl().

Removes the default argument of this template parameter.

Definition at line 1128 of file DeclTemplate.h.

void clang::NonTypeTemplateParmDecl::setDefaultArgument ( Expr DefArg,
bool  Inherited 
) [inline]

Set the default argument for this template parameter, and whether that default argument was inherited from another declaration.

Definition at line 1122 of file DeclTemplate.h.

Referenced by clang::Sema::ActOnNonTypeTemplateParameter(), and clang::ASTDeclReader::VisitNonTypeTemplateParmDecl().


Friends And Related Function Documentation

friend class ASTDeclReader [friend]

Reimplemented from clang::DeclaratorDecl.

Definition at line 1070 of file DeclTemplate.h.


The documentation for this class was generated from the following files: