clang API Documentation
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>


Public Types | |
| typedef const TemplateArgument * | iterator |
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 TemplateArgument * | getArgs () const |
| Retrieve the template arguments. | |
| unsigned | getNumArgs () const |
| Retrieve the number of template arguments. | |
| const TemplateArgument & | getArg (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 |
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.
| typedef const TemplateArgument* clang::TemplateSpecializationType::iterator |
| 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] |
| bool TemplateSpecializationType::anyDependentTemplateArguments | ( | const TemplateArgumentListInfo & | Args, |
| bool & | InstantiationDependent | ||
| ) | [static] |
Definition at line 1840 of file Type.cpp.
References anyDependentTemplateArguments(), clang::TemplateArgumentListInfo::getArgumentArray(), and clang::TemplateArgumentListInfo::size().
| iterator clang::TemplateSpecializationType::begin | ( | ) | const [inline] |
| 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] |
| QualType clang::TemplateSpecializationType::desugar | ( | ) | const [inline] |
| 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] |
Retrieve the template arguments.
Definition at line 3605 of file Type.h.
Referenced by DeduceTemplateArguments(), end(), getArg(), clang::Sema::getTemplateInstantiationArgs(), MarkUsedTemplateParameters(), and clang::ASTNodeImporter::VisitTemplateSpecializationType().
| unsigned clang::TemplateSpecializationType::getNumArgs | ( | ) | const [inline] |
Retrieve the number of template arguments.
Definition at line 3610 of file Type.h.
References NumArgs.
Referenced by DeduceTemplateArguments(), end(), getArg(), clang::Sema::getTemplateInstantiationArgs(), IsStructurallyEquivalent(), MarkUsedTemplateParameters(), and clang::ASTNodeImporter::VisitTemplateSpecializationType().
| TemplateName clang::TemplateSpecializationType::getTemplateName | ( | ) | const [inline] |
Retrieve the name of the template that we are specializing.
Definition at line 3602 of file Type.h.
Referenced by DeduceTemplateArguments(), getTemplateKind(), IsSmallVector(), IsStdVector(), IsStructurallyEquivalent(), MarkUsedTemplateParameters(), clang::TreeTransform< Derived >::TransformTemplateSpecializationType(), and clang::ASTNodeImporter::VisitTemplateSpecializationType().
| bool clang::TemplateSpecializationType::isCurrentInstantiation | ( | ) | const [inline] |
| bool clang::TemplateSpecializationType::isSugared | ( | ) | const [inline] |
| 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] |
Print a template argument list, including the '<' and '>' enclosing the template arguments.
Definition at line 1051 of file TypePrinter.cpp.
References Arg, clang::TemplateArgument::Pack, and clang::TemplateArgument::print().
Referenced by clang::ClassTemplateSpecializationDecl::getNameForDiagnostic(), clang::FunctionDecl::getNameForDiagnostic(), clang::NamedDecl::getQualifiedNameAsString(), clang::NestedNameSpecifier::print(), clang::Sema::PrintInstantiationStack(), and PrintTemplateArgumentList().
| std::string TemplateSpecializationType::PrintTemplateArgumentList | ( | const TemplateArgumentLoc * | Args, |
| unsigned | NumArgs, | ||
| const PrintingPolicy & | Policy | ||
| ) | [static] |
Definition at line 1098 of file TypePrinter.cpp.
References Arg, clang::TemplateArgumentLoc::getArgument(), clang::TemplateArgument::Pack, clang::TemplateArgument::print(), and PrintTemplateArgumentList().
| std::string TemplateSpecializationType::PrintTemplateArgumentList | ( | const TemplateArgumentListInfo & | Args, |
| const PrintingPolicy & | Policy | ||
| ) | [static] |
Definition at line 1043 of file TypePrinter.cpp.
References clang::TemplateArgumentListInfo::getArgumentArray(), PrintTemplateArgumentList(), and clang::TemplateArgumentListInfo::size().
| 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().
friend class ASTContext [friend] |
Reimplemented from clang::Type.