clang API Documentation

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

Declaration of a template type parameter. More...

#include <DeclTemplate.h>

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

List of all members.

Public Member Functions

bool wasDeclaredWithTypename () const
 Whether this template type parameter was declared with the 'typename' keyword.
bool hasDefaultArgument () const
 Determine whether this template parameter has a default argument.
QualType getDefaultArgument () const
 Retrieve the default argument, if any.
TypeSourceInfogetDefaultArgumentInfo () const
 Retrieves the default argument's source information, if any.
SourceLocation getDefaultArgumentLoc () const
 Retrieves the location of the default argument declaration.
bool defaultArgumentWasInherited () const
 Determines whether the default argument was inherited from a previous declaration of this template.
void setDefaultArgument (TypeSourceInfo *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.
void setDeclaredWithTypename (bool withTypename)
 Set whether this template type parameter was declared with the 'typename' or 'class' keyword.
unsigned getDepth () const
 Retrieve the depth of the template parameter.
unsigned getIndex () const
 Retrieve the index of the template parameter.
bool isParameterPack () const
 Returns whether this is a parameter pack.
SourceRange getSourceRange () const override LLVM_READONLY
 Source range that this declaration covers.

Static Public Member Functions

static TemplateTypeParmDeclCreate (const ASTContext &C, DeclContext *DC, SourceLocation KeyLoc, SourceLocation NameLoc, unsigned D, unsigned P, IdentifierInfo *Id, bool Typename, bool ParameterPack)
static TemplateTypeParmDeclCreateDeserialized (const ASTContext &C, unsigned ID)
static bool classof (const Decl *D)
static bool classofKind (Kind K)

Friends

class Sema
 Sema creates these on the stack during auto type deduction.

Detailed Description

Declaration of a template type parameter.

For example, "T" in

 template<typename T> class vector;

Definition at line 937 of file DeclTemplate.h.


Member Function Documentation

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

Reimplemented from clang::TypeDecl.

Definition at line 1023 of file DeclTemplate.h.

References classofKind().

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

Reimplemented from clang::TypeDecl.

Definition at line 1024 of file DeclTemplate.h.

Referenced by classof().

TemplateTypeParmDecl * TemplateTypeParmDecl::Create ( const ASTContext C,
DeclContext DC,
SourceLocation  KeyLoc,
SourceLocation  NameLoc,
unsigned  D,
unsigned  P,
IdentifierInfo Id,
bool  Typename,
bool  ParameterPack 
) [static]

Definition at line 479 of file DeclTemplate.cpp.

References AttributeLangSupport::C.

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

Definition at line 991 of file DeclTemplate.h.

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

Retrieve the default argument, if any.

Definition at line 981 of file DeclTemplate.h.

References clang::TypeSourceInfo::getType().

Retrieves the default argument's source information, if any.

Definition at line 984 of file DeclTemplate.h.

Referenced by clang::Sema::CheckTemplateParameterList(), SubstDefaultTemplateArgument(), and clang::ASTDeclWriter::VisitTemplateTypeParmDecl().

Retrieves the location of the default argument declaration.

Definition at line 484 of file DeclTemplate.cpp.

References clang::TypeLoc::getBeginLoc(), clang::TypeSourceInfo::getTypeLoc(), and hasDefaultArgument().

Referenced by clang::Sema::CheckTemplateParameterList(), and SubstDefaultTemplateArgument().

Retrieve the index of the template parameter.

Definition at line 502 of file DeclTemplate.cpp.

References clang::Type::getAs(), and clang::TypeDecl::getTypeForDecl().

Referenced by clang::Sema::CheckLiteralOperatorDeclaration(), and clang::ASTNodeImporter::VisitTemplateTypeParmDecl().

SourceRange TemplateTypeParmDecl::getSourceRange ( ) const [override, virtual]

Source range that this declaration covers.

Reimplemented from clang::TypeDecl.

Definition at line 490 of file DeclTemplate.cpp.

References defaultArgumentWasInherited(), clang::TypeLoc::getEndLoc(), clang::TypeDecl::getLocStart(), clang::TypeSourceInfo::getTypeLoc(), and hasDefaultArgument().

Determine whether this template parameter has a default argument.

Definition at line 978 of file DeclTemplate.h.

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

Returns whether this is a parameter pack.

Reimplemented from clang::Decl.

Definition at line 506 of file DeclTemplate.cpp.

References clang::Type::getAs(), and clang::TypeDecl::getTypeForDecl().

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

Removes the default argument of this template parameter.

Definition at line 1002 of file DeclTemplate.h.

Set whether this template type parameter was declared with the 'typename' or 'class' keyword.

Definition at line 1009 of file DeclTemplate.h.

Referenced by clang::ASTDeclReader::VisitTemplateTypeParmDecl().

void clang::TemplateTypeParmDecl::setDefaultArgument ( TypeSourceInfo 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 996 of file DeclTemplate.h.

Referenced by clang::Sema::ActOnTypeParameter(), and clang::ASTDeclReader::VisitTemplateTypeParmDecl().

Whether this template type parameter was declared with the 'typename' keyword.

If not, it was declared with the 'class' keyword.

Definition at line 974 of file DeclTemplate.h.

Referenced by clang::ASTDeclWriter::VisitTemplateTypeParmDecl(), and clang::ASTNodeImporter::VisitTemplateTypeParmDecl().


Friends And Related Function Documentation

friend class Sema [friend]

Sema creates these on the stack during auto type deduction.

Definition at line 958 of file DeclTemplate.h.


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