clang API Documentation

Public Types | Public Member Functions | Static Public Member Functions | Friends
clang::TemplateSpecializationType Class Reference

Represents a type template specialization; the template must be a class template, a type alias template, or a template template parameter. A template which cannot be resolved to one of these, e.g. because it is written with a dependent scope specifier, is instead represented as a DependentTemplateSpecializationType. More...

#include <Type.h>

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

List of all members.

Public Types

typedef const TemplateArgumentiterator

Public Member Functions

bool isCurrentInstantiation () const
bool isTypeAlias () const
 Determine if this template specialization type is for a type alias template that has been substituted.
QualType getAliasedType () const
iterator begin () const
iterator end () const
TemplateName getTemplateName () const
 Retrieve the name of the template that we are specializing.
const TemplateArgumentgetArgs () const
 Retrieve the template arguments.
unsigned getNumArgs () const
 Retrieve the number of template arguments.
const TemplateArgumentgetArg (unsigned Idx) const
 Retrieve a specific template argument as a type. isArgType(Arg)
bool isSugared () const
QualType desugar () const
void Profile (llvm::FoldingSetNodeID &ID, const ASTContext &Ctx)

Static Public Member Functions

static bool anyDependentTemplateArguments (const TemplateArgument *Args, unsigned NumArgs, bool &InstantiationDependent)
 Determine whether any of the given template arguments are dependent.
static bool anyDependentTemplateArguments (const TemplateArgumentLoc *Args, unsigned NumArgs, bool &InstantiationDependent)
static bool anyDependentTemplateArguments (const TemplateArgumentListInfo &, bool &InstantiationDependent)
static std::string PrintTemplateArgumentList (const TemplateArgument *Args, unsigned NumArgs, const PrintingPolicy &Policy, bool SkipBrackets=false)
 Print a template argument list, including the '<' and '>' enclosing the template arguments.
static std::string PrintTemplateArgumentList (const TemplateArgumentLoc *Args, unsigned NumArgs, const PrintingPolicy &Policy)
static std::string PrintTemplateArgumentList (const TemplateArgumentListInfo &, const PrintingPolicy &Policy)
static void Profile (llvm::FoldingSetNodeID &ID, TemplateName T, const TemplateArgument *Args, unsigned NumArgs, const ASTContext &Context)
static bool classof (const Type *T)
static bool classof (const TemplateSpecializationType *T)

Friends

class ASTContext

Detailed Description

Represents a type template specialization; the template must be a class template, a type alias template, or a template template parameter. A template which cannot be resolved to one of these, e.g. because it is written with a dependent scope specifier, is instead represented as a DependentTemplateSpecializationType.

A non-dependent template specialization type is always "sugar", typically for a RecordType. For example, a class template specialization type of vector<int> will refer to a tag type for the instantiation std::vector<int, std::allocator<int>>

Template specializations are dependent if either the template or any of the template arguments are dependent, in which case the type may also be canonical.

Instances of this type are allocated with a trailing array of TemplateArguments, followed by a QualType representing the non-canonical aliased type when the template is a type alias template.

Definition at line 3512 of file Type.h.


Member Typedef Documentation

Definition at line 3596 of file Type.h.


Member Function Documentation

bool TemplateSpecializationType::anyDependentTemplateArguments ( const TemplateArgument Args,
unsigned  NumArgs,
bool &  InstantiationDependent 
) [static]

Determine whether any of the given template arguments are dependent.

Definition at line 1862 of file Type.cpp.

Referenced by clang::Sema::ActOnClassTemplateSpecialization(), clang::Sema::ActOnFunctionDeclarator(), anyDependentTemplateArguments(), and clang::Sema::CheckTemplateIdType().

bool TemplateSpecializationType::anyDependentTemplateArguments ( const TemplateArgumentLoc Args,
unsigned  NumArgs,
bool &  InstantiationDependent 
) [static]

Definition at line 1847 of file Type.cpp.

bool TemplateSpecializationType::anyDependentTemplateArguments ( const TemplateArgumentListInfo Args,
bool &  InstantiationDependent 
) [static]
iterator clang::TemplateSpecializationType::begin ( ) const [inline]

Definition at line 3598 of file Type.h.

static bool clang::TemplateSpecializationType::classof ( const Type T) [inline, static]

Reimplemented from clang::Type.

Definition at line 3632 of file Type.h.

References clang::Type::getTypeClass().

static bool clang::TemplateSpecializationType::classof ( const TemplateSpecializationType T) [inline, static]

Definition at line 3635 of file Type.h.

QualType clang::TemplateSpecializationType::desugar ( ) const [inline]

Definition at line 3619 of file Type.h.

TemplateSpecializationType::iterator clang::TemplateSpecializationType::end ( ) const [inline]

Definition at line 634 of file TemplateBase.h.

References getArgs(), and getNumArgs().

QualType clang::TemplateSpecializationType::getAliasedType ( ) const [inline]

Get the aliased type, if this is a specialization of a type alias template.

Definition at line 3591 of file Type.h.

Referenced by clang::ASTContext::getTypeInfo().

const TemplateArgument & clang::TemplateSpecializationType::getArg ( unsigned  Idx) const [inline]

Retrieve a specific template argument as a type. isArgType(Arg)

Definition at line 644 of file TemplateBase.h.

References getArgs(), and getNumArgs().

Referenced by IsStructurallyEquivalent(), and MarkUsedTemplateParameters().

const TemplateArgument* clang::TemplateSpecializationType::getArgs ( ) const [inline]
unsigned clang::TemplateSpecializationType::getNumArgs ( ) const [inline]
TemplateName clang::TemplateSpecializationType::getTemplateName ( ) const [inline]
bool clang::TemplateSpecializationType::isCurrentInstantiation ( ) const [inline]

True if this template specialization type matches a current instantiation in the context in which it is found.

Definition at line 3568 of file Type.h.

bool clang::TemplateSpecializationType::isSugared ( ) const [inline]

Definition at line 3616 of file Type.h.

bool clang::TemplateSpecializationType::isTypeAlias ( ) const [inline]

Determine if this template specialization type is for a type alias template that has been substituted.

Nearly every template specialization type whose template is an alias template will be substituted. However, this is not the case when the specialization contains a pack expansion but the template alias does not have a corresponding parameter pack, e.g.,

 template<typename T, typename U, typename V> struct S;
 template<typename T, typename U> using A = S<T, int, U>;
 template<typename... Ts> struct X {
   typedef A<Ts...> type; // not a type alias
 };

Definition at line 3587 of file Type.h.

Referenced by clang::ASTContext::getTypeInfo().

std::string TemplateSpecializationType::PrintTemplateArgumentList ( const TemplateArgument Args,
unsigned  NumArgs,
const PrintingPolicy Policy,
bool  SkipBrackets = false 
) [static]
std::string TemplateSpecializationType::PrintTemplateArgumentList ( const TemplateArgumentLoc Args,
unsigned  NumArgs,
const PrintingPolicy Policy 
) [static]
std::string TemplateSpecializationType::PrintTemplateArgumentList ( const TemplateArgumentListInfo Args,
const PrintingPolicy Policy 
) [static]
void clang::TemplateSpecializationType::Profile ( llvm::FoldingSetNodeID &  ID,
const ASTContext Ctx 
) [inline]

Definition at line 3621 of file Type.h.

Referenced by clang::ASTContext::getCanonicalTemplateSpecializationType(), and Profile().

void TemplateSpecializationType::Profile ( llvm::FoldingSetNodeID &  ID,
TemplateName  T,
const TemplateArgument Args,
unsigned  NumArgs,
const ASTContext Context 
) [static]

Definition at line 1934 of file Type.cpp.

References clang::TemplateName::Profile(), and Profile().


Friends And Related Function Documentation

friend class ASTContext [friend]

Reimplemented from clang::Type.

Definition at line 3536 of file Type.h.


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