class TemplateSpecializationType

Declaration

class TemplateSpecializationType : public Type, public Node { /* full declaration omitted */ };

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@c DependentTemplateSpecializationType. A non-dependent template specialization type is always "sugar", typically for a \c RecordType. For example, a class template specialization type of \c vector<int> will refer to a tag type for the instantiation \c 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.

Declared at: clang/include/clang/AST/Type.h:5238

Inherits from: Type, FoldingSetBase::Node

Member Variables

private clang::TemplateName Template
The name of the template being specialized. This is either a TemplateName::Template (in which case it is a ClassTemplateDecl*, a TemplateTemplateParmDecl*, or a TypeAliasTemplateDecl*), a TemplateName::SubstTemplateTemplateParmPack, or a TemplateName::SubstTemplateTemplateParm (in which case the replacement must, recursively, be one of these).

Inherited from Type:

protected

Method Overview

  • public static void Profile(llvm::FoldingSetNodeID & ID, clang::TemplateName T, ArrayRef<clang::TemplateArgument> Args, const clang::ASTContext & Context)
  • public void Profile(llvm::FoldingSetNodeID & ID, const clang::ASTContext & Ctx)
  • private TemplateSpecializationType(clang::TemplateName T, ArrayRef<clang::TemplateArgument> Args, clang::QualType Canon, clang::QualType Aliased)
  • public static bool anyDependentTemplateArguments(ArrayRef<clang::TemplateArgumentLoc> Args, ArrayRef<clang::TemplateArgument> Converted)
  • public static bool anyDependentTemplateArguments(const clang::TemplateArgumentListInfo &, ArrayRef<clang::TemplateArgument> Converted)
  • public static bool anyInstantiationDependentTemplateArguments(ArrayRef<clang::TemplateArgumentLoc> Args)
  • public clang::TemplateSpecializationType::iterator begin() const
  • public static bool classof(const clang::Type * T)
  • public clang::QualType desugar() const
  • public clang::TemplateSpecializationType::iterator end() const
  • public clang::QualType getAliasedType() const
  • public const clang::TemplateArgument & getArg(unsigned int Idx) const
  • public const clang::TemplateArgument * getArgs() const
  • public unsigned int getNumArgs() const
  • public clang::TemplateName getTemplateName() const
  • public bool isCurrentInstantiation() const
  • public bool isSugared() const
  • public bool isTypeAlias() const
  • public ArrayRef<clang::TemplateArgument> template_arguments() const

Inherited from FoldingSetBase::Node:

Inherited from Type:

Inherited from ExtQualsTypeCommonBase:

    Methods

    static void Profile(
        llvm::FoldingSetNodeID& ID,
        clang::TemplateName T,
        ArrayRef<clang::TemplateArgument> Args,
        const clang::ASTContext& Context)

    Declared at: clang/include/clang/AST/Type.h:5348

    Parameters

    llvm::FoldingSetNodeID& ID
    clang::TemplateName T
    ArrayRef<clang::TemplateArgument> Args
    const clang::ASTContext& Context

    void Profile(llvm::FoldingSetNodeID& ID,
                 const clang::ASTContext& Ctx)

    Declared at: clang/include/clang/AST/Type.h:5342

    Parameters

    llvm::FoldingSetNodeID& ID
    const clang::ASTContext& Ctx

    TemplateSpecializationType(
        clang::TemplateName T,
        ArrayRef<clang::TemplateArgument> Args,
        clang::QualType Canon,
        clang::QualType Aliased)

    Declared at: clang/include/clang/AST/Type.h:5252

    Parameters

    clang::TemplateName T
    ArrayRef<clang::TemplateArgument> Args
    clang::QualType Canon
    clang::QualType Aliased

    static bool anyDependentTemplateArguments(
        ArrayRef<clang::TemplateArgumentLoc> Args,
        ArrayRef<clang::TemplateArgument> Converted)

    Description

    Determine whether any of the given template arguments are dependent. The converted arguments should be supplied when known; whether an argument is dependent can depend on the conversions performed on it (for example, a 'const int' passed as a template argument might be dependent if the parameter is a reference but non-dependent if the parameter is an int). Note that the \p Args parameter is unused: this is intentional, to remind the caller that they need to pass in the converted arguments, not the specified arguments.

    Declared at: clang/include/clang/AST/Type.h:5270

    Parameters

    ArrayRef<clang::TemplateArgumentLoc> Args
    ArrayRef<clang::TemplateArgument> Converted

    static bool anyDependentTemplateArguments(
        const clang::TemplateArgumentListInfo&,
        ArrayRef<clang::TemplateArgument> Converted)

    Declared at: clang/include/clang/AST/Type.h:5273

    Parameters

    const clang::TemplateArgumentListInfo&
    ArrayRef<clang::TemplateArgument> Converted

    static bool
    anyInstantiationDependentTemplateArguments(
        ArrayRef<clang::TemplateArgumentLoc> Args)

    Declared at: clang/include/clang/AST/Type.h:5275

    Parameters

    ArrayRef<clang::TemplateArgumentLoc> Args

    clang::TemplateSpecializationType::iterator
    begin() const

    Declared at: clang/include/clang/AST/Type.h:5310

    static bool classof(const clang::Type* T)

    Declared at: clang/include/clang/AST/Type.h:5352

    Parameters

    const clang::Type* T

    clang::QualType desugar() const

    Declared at: clang/include/clang/AST/Type.h:5338

    clang::TemplateSpecializationType::iterator end()
        const

    Declared at: clang/include/clang/AST/Type.h:5311

    clang::QualType getAliasedType() const

    Description

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

    Declared at: clang/include/clang/AST/Type.h:5303

    const clang::TemplateArgument& getArg(
        unsigned int Idx) const

    Description

    Retrieve a specific template argument as a type.

    Declared at: clang/include/clang/AST/Type.h:5328

    Parameters

    unsigned int Idx

    const clang::TemplateArgument* getArgs() const

    Description

    Retrieve the template arguments.

    Declared at: clang/include/clang/AST/Type.h:5317

    unsigned int getNumArgs() const

    Description

    Retrieve the number of template arguments.

    Declared at: clang/include/clang/AST/Type.h:5322

    clang::TemplateName getTemplateName() const

    Description

    Retrieve the name of the template that we are specializing.

    Declared at: clang/include/clang/AST/Type.h:5314

    bool isCurrentInstantiation() const

    Description

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

    Declared at: clang/include/clang/AST/Type.h:5280

    bool isSugared() const

    Declared at: clang/include/clang/AST/Type.h:5334

    bool isTypeAlias() const

    Description

    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.,

    Declared at: clang/include/clang/AST/Type.h:5299

    ArrayRef<clang::TemplateArgument>
    template_arguments() const

    Declared at: clang/include/clang/AST/Type.h:5330