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.
bool isSugared () const
QualType desugar () const
void Profile (llvm::FoldingSetNodeID &ID, const ASTContext &Ctx)

Static Public Member Functions

static bool anyDependentTemplateArguments (const TemplateArgumentLoc *Args, unsigned NumArgs, bool &InstantiationDependent)
 Determine whether any of the given template arguments are dependent.
static bool anyDependentTemplateArguments (const TemplateArgumentListInfo &, bool &InstantiationDependent)
static void PrintTemplateArgumentList (raw_ostream &OS, const TemplateArgument *Args, unsigned NumArgs, const PrintingPolicy &Policy, bool SkipBrackets=false)
 Print a template argument list, including the '<' and '>' enclosing the template arguments.
static void PrintTemplateArgumentList (raw_ostream &OS, const TemplateArgumentLoc *Args, unsigned NumArgs, const PrintingPolicy &Policy)
static void PrintTemplateArgumentList (raw_ostream &OS, 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)

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 3743 of file Type.h.


Member Typedef Documentation

Definition at line 3826 of file Type.h.


Member Function Documentation

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

Definition at line 3828 of file Type.h.

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

Definition at line 3862 of file Type.h.

References clang::Type::getTypeClass().

Definition at line 3849 of file Type.h.

Definition at line 648 of file TemplateBase.h.

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

Definition at line 3821 of file Type.h.

Retrieve a specific template argument as a type.

Precondition:
isArgType(Arg)

Definition at line 658 of file TemplateBase.h.

Referenced by IsStructurallyEquivalent(), and MarkUsedTemplateParameters().

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

Definition at line 3798 of file Type.h.

Definition at line 3846 of file Type.h.

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 3817 of file Type.h.

void TemplateSpecializationType::PrintTemplateArgumentList ( raw_ostream &  OS,
const TemplateArgument Args,
unsigned  NumArgs,
const PrintingPolicy Policy,
bool  SkipBrackets = false 
) [static]
void TemplateSpecializationType::PrintTemplateArgumentList ( raw_ostream &  OS,
const TemplateArgumentLoc Args,
unsigned  NumArgs,
const PrintingPolicy Policy 
) [static]

Definition at line 1392 of file TypePrinter.cpp.

void TemplateSpecializationType::PrintTemplateArgumentList ( raw_ostream &  OS,
const TemplateArgumentListInfo Args,
const PrintingPolicy Policy 
) [static]
void clang::TemplateSpecializationType::Profile ( llvm::FoldingSetNodeID &  ID,
const ASTContext Ctx 
) [inline]

Definition at line 3851 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 2047 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 3767 of file Type.h.


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