clang API Documentation
Declaration of a template type parameter. More...
#include <DeclTemplate.h>
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. | |
TypeSourceInfo * | getDefaultArgumentInfo () 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 TemplateTypeParmDecl * | Create (const ASTContext &C, DeclContext *DC, SourceLocation KeyLoc, SourceLocation NameLoc, unsigned D, unsigned P, IdentifierInfo *Id, bool Typename, bool ParameterPack) |
static TemplateTypeParmDecl * | CreateDeserialized (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. |
Declaration of a template type parameter.
For example, "T" in
template<typename T> class vector;
Definition at line 937 of file DeclTemplate.h.
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 467 of file DeclTemplate.cpp.
References AttributeLangSupport::C, clang::ASTContext::getTemplateTypeParmType(), clang::QualType::getTypePtr(), and clang::TypeDecl::setTypeForDecl().
Referenced by clang::Sema::ActOnTypeParameter(), ConvertDeclSpecToType(), clang::Sema::DeduceAutoType(), and clang::ASTNodeImporter::VisitTemplateTypeParmDecl().
TemplateTypeParmDecl * TemplateTypeParmDecl::CreateDeserialized | ( | const ASTContext & | C, |
unsigned | ID | ||
) | [static] |
Definition at line 479 of file DeclTemplate.cpp.
References AttributeLangSupport::C.
bool clang::TemplateTypeParmDecl::defaultArgumentWasInherited | ( | ) | const [inline] |
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().
QualType clang::TemplateTypeParmDecl::getDefaultArgument | ( | ) | const [inline] |
Retrieve the default argument, if any.
Definition at line 981 of file DeclTemplate.h.
References clang::TypeSourceInfo::getType().
TypeSourceInfo* clang::TemplateTypeParmDecl::getDefaultArgumentInfo | ( | ) | const [inline] |
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().
unsigned TemplateTypeParmDecl::getDepth | ( | ) | const |
Retrieve the depth of the template parameter.
Definition at line 498 of file DeclTemplate.cpp.
References clang::Type::getAs(), and clang::TypeDecl::getTypeForDecl().
Referenced by clang::Sema::CheckLiteralOperatorDeclaration(), SubstDefaultTemplateArgument(), and clang::ASTNodeImporter::VisitTemplateTypeParmDecl().
unsigned TemplateTypeParmDecl::getIndex | ( | ) | const |
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().
bool clang::TemplateTypeParmDecl::hasDefaultArgument | ( | ) | const [inline] |
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().
bool TemplateTypeParmDecl::isParameterPack | ( | ) | const |
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().
void clang::TemplateTypeParmDecl::removeDefaultArgument | ( | ) | [inline] |
Removes the default argument of this template parameter.
Definition at line 1002 of file DeclTemplate.h.
void clang::TemplateTypeParmDecl::setDeclaredWithTypename | ( | bool | withTypename | ) | [inline] |
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().
bool clang::TemplateTypeParmDecl::wasDeclaredWithTypename | ( | ) | const [inline] |
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().
friend class Sema [friend] |
Sema creates these on the stack during auto type deduction.
Definition at line 958 of file DeclTemplate.h.