class ClassTemplateSpecializationDecl

Declaration

class ClassTemplateSpecializationDecl : public CXXRecordDecl,
                                        public Node { /* full declaration omitted */ };

Description

Represents a class template specialization, which refers to a class template with a given set of template arguments. Class template specializations represent both explicit specialization of class templates, as in the example below, and implicit instantiations of class templates.

Declared at: clang/include/clang/AST/DeclTemplate.h:1829

Inherits from: CXXRecordDecl, FoldingSetBase::Node

Member Variables

private llvm::PointerUnion< ClassTemplateDecl*, SpecializedPartialSpecialization*> SpecializedTemplate
The template that this specialization specializes
private clang::ClassTemplateSpecializationDecl:: ExplicitSpecializationInfo* ExplicitInfo = nullptr
Further info for explicit template specialization/instantiation. Does not apply to implicit specializations.
private const clang::TemplateArgumentList* TemplateArgs
The template arguments used to describe this specialization.
private clang::SourceLocation PointOfInstantiation
The point where this template was instantiated (if any)
private unsigned int SpecializationKind
The kind of specialization this declaration refers to. Really a value of type TemplateSpecializationKind.

Inherited from DeclContext:

protected
protected FirstDecl = nullptr
protected LastDecl = nullptr

Inherited from Decl:

protected NextInContextAndBits
protected Access
protected FromASTFile
protected IdentifierNamespace
protected CacheValidAndLinkage

Method Overview

Inherited from FoldingSetBase::Node:

Inherited from CXXRecordDecl:

Inherited from RecordDecl:

Inherited from TagDecl:

Inherited from DeclContext:

Inherited from TypeDecl:

Inherited from NamedDecl:

Inherited from Decl:

Methods

ClassTemplateSpecializationDecl(
    clang::ASTContext& C,
    clang::Decl::Kind DK)

Declared at: clang/include/clang/AST/DeclTemplate.h:1884

Parameters

clang::ASTContext& C
clang::Decl::Kind DK

ClassTemplateSpecializationDecl(
    clang::ASTContext& Context,
    clang::Decl::Kind DK,
    clang::TagDecl::TagKind TK,
    clang::DeclContext* DC,
    clang::SourceLocation StartLoc,
    clang::SourceLocation IdLoc,
    clang::ClassTemplateDecl* SpecializedTemplate,
    ArrayRef<clang::TemplateArgument> Args,
    clang::ClassTemplateSpecializationDecl*
        PrevDecl)

Declared at: clang/include/clang/AST/DeclTemplate.h:1877

Parameters

clang::ASTContext& Context
clang::Decl::Kind DK
clang::TagDecl::TagKind TK
clang::DeclContext* DC
clang::SourceLocation StartLoc
clang::SourceLocation IdLoc
clang::ClassTemplateDecl* SpecializedTemplate
ArrayRef<clang::TemplateArgument> Args
clang::ClassTemplateSpecializationDecl* PrevDecl

static clang::ClassTemplateSpecializationDecl*
Create(
    clang::ASTContext& Context,
    clang::TagDecl::TagKind TK,
    clang::DeclContext* DC,
    clang::SourceLocation StartLoc,
    clang::SourceLocation IdLoc,
    clang::ClassTemplateDecl* SpecializedTemplate,
    ArrayRef<clang::TemplateArgument> Args,
    clang::ClassTemplateSpecializationDecl*
        PrevDecl)

Declared at: clang/include/clang/AST/DeclTemplate.h:1891

Parameters

clang::ASTContext& Context
clang::TagDecl::TagKind TK
clang::DeclContext* DC
clang::SourceLocation StartLoc
clang::SourceLocation IdLoc
clang::ClassTemplateDecl* SpecializedTemplate
ArrayRef<clang::TemplateArgument> Args
clang::ClassTemplateSpecializationDecl* PrevDecl

static clang::ClassTemplateSpecializationDecl*
CreateDeserialized(clang::ASTContext& C,
                   unsigned int ID)

Declared at: clang/include/clang/AST/DeclTemplate.h:1897

Parameters

clang::ASTContext& C
unsigned int ID

static void Profile(
    llvm::FoldingSetNodeID& ID,
    ArrayRef<clang::TemplateArgument>
        TemplateArgs,
    clang::ASTContext& Context)

Declared at: clang/include/clang/AST/DeclTemplate.h:2086

Parameters

llvm::FoldingSetNodeID& ID
ArrayRef<clang::TemplateArgument> TemplateArgs
clang::ASTContext& Context

void Profile(llvm::FoldingSetNodeID& ID) const

Declared at: clang/include/clang/AST/DeclTemplate.h:2081

Parameters

llvm::FoldingSetNodeID& ID

static bool classof(const clang::Decl* D)

Declared at: clang/include/clang/AST/DeclTemplate.h:2093

Parameters

const clang::Decl* D

static bool classofKind(clang::Decl::Kind K)

Declared at: clang/include/clang/AST/DeclTemplate.h:2095

Parameters

clang::Decl::Kind K

clang::SourceLocation getExternLoc() const

Description

Gets the location of the extern keyword, if present.

Declared at: clang/include/clang/AST/DeclTemplate.h:2056

llvm::PointerUnion<
    ClassTemplateDecl*,
    ClassTemplatePartialSpecializationDecl*>
getInstantiatedFrom() const

Description

If this class template specialization is an instantiation of a template (rather than an explicit specialization), return the class template or class template partial specialization from which it was instantiated.

Declared at: clang/include/clang/AST/DeclTemplate.h:1981

clang::ClassTemplateSpecializationDecl*
getMostRecentDecl()

Declared at: clang/include/clang/AST/DeclTemplate.h:1907

void getNameForDiagnostic(
    llvm::raw_ostream& OS,
    const clang::PrintingPolicy& Policy,
    bool Qualified) const

Description

Appends a human-readable name for this declaration into the given stream. This is the method invoked by Sema when displaying a NamedDecl in a diagnostic. It does not necessarily produce the same result as printName(); for example, class template specializations are printed with their template arguments.

Declared at: clang/include/clang/AST/DeclTemplate.h:1899

Parameters

llvm::raw_ostream& OS
const clang::PrintingPolicy& Policy
bool Qualified

clang::SourceLocation getPointOfInstantiation()
    const

Description

Get the point of instantiation (if any), or null if none.

Declared at: clang/include/clang/AST/DeclTemplate.h:1966

clang::SourceRange getSourceRange() const

Description

Source range that this declaration covers.

Declared at: clang/include/clang/AST/DeclTemplate.h:2079

clang::TemplateSpecializationKind
getSpecializationKind() const

Description

Determine the kind of specialization that this declaration represents.

Declared at: clang/include/clang/AST/DeclTemplate.h:1927

clang::ClassTemplateDecl* getSpecializedTemplate()
    const

Description

Retrieve the template that this specialization specializes.

Declared at: clang/include/clang/AST/DeclTemplate.h:1913

llvm::PointerUnion<
    ClassTemplateDecl*,
    ClassTemplatePartialSpecializationDecl*>
getSpecializedTemplateOrPartial() const

Description

Retrieve the class template or class template partial specialization which was specialized by this.

Declared at: clang/include/clang/AST/DeclTemplate.h:1993

const clang::TemplateArgumentList&
getTemplateArgs() const

Description

Retrieve the template arguments of the class template specialization.

Declared at: clang/include/clang/AST/DeclTemplate.h:1917

const clang::TemplateArgumentList&
getTemplateInstantiationArgs() const

Description

Retrieve the set of template arguments that should be used to instantiate members of the class template or class template partial specialization from which this class template specialization was instantiated.

Declared at: clang/include/clang/AST/DeclTemplate.h:2012

Returns

For a class template specialization instantiated from the primary template, this function will return the same template arguments as getTemplateArgs(). For a class template specialization instantiated from a class template partial specialization, this function will return the deduced template arguments for the class template partial specialization itself.

clang::SourceLocation getTemplateKeywordLoc()
    const

Description

Gets the location of the template keyword, if present.

Declared at: clang/include/clang/AST/DeclTemplate.h:2075

clang::TypeSourceInfo* getTypeAsWritten() const

Description

Gets the type of this specialization as it was written by the user, if it was so written.

Declared at: clang/include/clang/AST/DeclTemplate.h:2051

bool isClassScopeExplicitSpecialization() const

Description

Is this an explicit specialization at class scope (within the class that owns the primary template)? For example:

Declared at: clang/include/clang/AST/DeclTemplate.h:1944

bool isExplicitInstantiationOrSpecialization()
    const

Description

True if this declaration is an explicit specialization, explicit instantiation declaration, or explicit instantiation definition.

Declared at: clang/include/clang/AST/DeclTemplate.h:1952

bool isExplicitSpecialization() const

Declared at: clang/include/clang/AST/DeclTemplate.h:1931

void setExternLoc(clang::SourceLocation Loc)

Description

Sets the location of the extern keyword.

Declared at: clang/include/clang/AST/DeclTemplate.h:2061

Parameters

clang::SourceLocation Loc

void setInstantiationOf(
    clang::ClassTemplatePartialSpecializationDecl*
        PartialSpec,
    const clang::TemplateArgumentList*
        TemplateArgs)

Description

Note that this class template specialization is actually an instantiation of the given class template partial specialization whose template arguments have been deduced.

Declared at: clang/include/clang/AST/DeclTemplate.h:2023

Parameters

clang::ClassTemplatePartialSpecializationDecl* PartialSpec
const clang::TemplateArgumentList* TemplateArgs

void setInstantiationOf(
    clang::ClassTemplateDecl* TemplDecl)

Description

Note that this class template specialization is an instantiation of the given class template.

Declared at: clang/include/clang/AST/DeclTemplate.h:2035

Parameters

clang::ClassTemplateDecl* TemplDecl

void setPointOfInstantiation(
    clang::SourceLocation Loc)

Declared at: clang/include/clang/AST/DeclTemplate.h:1970

Parameters

clang::SourceLocation Loc

void setSpecializationKind(
    clang::TemplateSpecializationKind TSK)

Declared at: clang/include/clang/AST/DeclTemplate.h:1961

Parameters

clang::TemplateSpecializationKind TSK

void setSpecializedTemplate(
    clang::ClassTemplateDecl* Specialized)

Declared at: clang/include/clang/AST/DeclTemplate.h:1957

Parameters

clang::ClassTemplateDecl* Specialized

void setTemplateArgs(
    clang::TemplateArgumentList* Args)

Declared at: clang/include/clang/AST/DeclTemplate.h:1921

Parameters

clang::TemplateArgumentList* Args

void setTemplateKeywordLoc(
    clang::SourceLocation Loc)

Description

Sets the location of the template keyword.

Declared at: clang/include/clang/AST/DeclTemplate.h:2068

Parameters

clang::SourceLocation Loc

void setTypeAsWritten(clang::TypeSourceInfo* T)

Description

Sets the type of this specialization as it was written by the user. This will be a class template specialization type.

Declared at: clang/include/clang/AST/DeclTemplate.h:2043

Parameters

clang::TypeSourceInfo* T