clang API Documentation
Represents a class template specialization, which refers to a class template with a given set of template arguments. More...
#include <DeclTemplate.h>
Classes | |
struct | ExplicitSpecializationInfo |
Further info for explicit template specialization/instantiation. | |
struct | SpecializedPartialSpecialization |
Structure that stores information about a class template specialization that was instantiated from a class template partial specialization. | |
Public Member Functions | |
void | getNameForDiagnostic (raw_ostream &OS, const PrintingPolicy &Policy, bool Qualified) const override |
ClassTemplateSpecializationDecl * | getMostRecentDecl () |
Returns the most recent (re)declaration of this declaration. | |
ClassTemplateDecl * | getSpecializedTemplate () const |
Retrieve the template that this specialization specializes. | |
const TemplateArgumentList & | getTemplateArgs () const |
Retrieve the template arguments of the class template specialization. | |
TemplateSpecializationKind | getSpecializationKind () const |
Determine the kind of specialization that this declaration represents. | |
bool | isExplicitSpecialization () const |
bool | isExplicitInstantiationOrSpecialization () const |
True if this declaration is an explicit specialization, explicit instantiation declaration, or explicit instantiation definition. | |
void | setSpecializationKind (TemplateSpecializationKind TSK) |
SourceLocation | getPointOfInstantiation () const |
Get the point of instantiation (if any), or null if none. | |
void | setPointOfInstantiation (SourceLocation Loc) |
llvm::PointerUnion < ClassTemplateDecl *, ClassTemplatePartialSpecializationDecl * > | getInstantiatedFrom () const |
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. | |
llvm::PointerUnion < ClassTemplateDecl *, ClassTemplatePartialSpecializationDecl * > | getSpecializedTemplateOrPartial () const |
Retrieve the class template or class template partial specialization which was specialized by this. | |
const TemplateArgumentList & | getTemplateInstantiationArgs () const |
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. | |
void | setInstantiationOf (ClassTemplatePartialSpecializationDecl *PartialSpec, const TemplateArgumentList *TemplateArgs) |
Note that this class template specialization is actually an instantiation of the given class template partial specialization whose template arguments have been deduced. | |
void | setInstantiationOf (ClassTemplateDecl *TemplDecl) |
Note that this class template specialization is an instantiation of the given class template. | |
void | setTypeAsWritten (TypeSourceInfo *T) |
Sets the type of this specialization as it was written by the user. This will be a class template specialization type. | |
TypeSourceInfo * | getTypeAsWritten () const |
Gets the type of this specialization as it was written by the user, if it was so written. | |
SourceLocation | getExternLoc () const |
Gets the location of the extern keyword, if present. | |
void | setExternLoc (SourceLocation Loc) |
Sets the location of the extern keyword. | |
void | setTemplateKeywordLoc (SourceLocation Loc) |
Sets the location of the template keyword. | |
SourceLocation | getTemplateKeywordLoc () const |
Gets the location of the template keyword, if present. | |
SourceRange | getSourceRange () const override LLVM_READONLY |
Source range that this declaration covers. | |
void | Profile (llvm::FoldingSetNodeID &ID) const |
Static Public Member Functions | |
static ClassTemplateSpecializationDecl * | Create (ASTContext &Context, TagKind TK, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, ClassTemplateDecl *SpecializedTemplate, const TemplateArgument *Args, unsigned NumArgs, ClassTemplateSpecializationDecl *PrevDecl) |
static ClassTemplateSpecializationDecl * | CreateDeserialized (ASTContext &C, unsigned ID) |
static void | Profile (llvm::FoldingSetNodeID &ID, ArrayRef< TemplateArgument > TemplateArgs, ASTContext &Context) |
static bool | classof (const Decl *D) |
static bool | classofKind (Kind K) |
Protected Member Functions | |
ClassTemplateSpecializationDecl (ASTContext &Context, Kind DK, TagKind TK, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, ClassTemplateDecl *SpecializedTemplate, const TemplateArgument *Args, unsigned NumArgs, ClassTemplateSpecializationDecl *PrevDecl) | |
ClassTemplateSpecializationDecl (ASTContext &C, Kind DK) | |
Friends | |
class | ASTDeclReader |
class | ASTDeclWriter |
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.
template<typename T> class array; template<> class array<bool> { }; // class template specialization array<bool>
Definition at line 1386 of file DeclTemplate.h.
ClassTemplateSpecializationDecl::ClassTemplateSpecializationDecl | ( | ASTContext & | Context, |
Kind | DK, | ||
TagKind | TK, | ||
DeclContext * | DC, | ||
SourceLocation | StartLoc, | ||
SourceLocation | IdLoc, | ||
ClassTemplateDecl * | SpecializedTemplate, | ||
const TemplateArgument * | Args, | ||
unsigned | NumArgs, | ||
ClassTemplateSpecializationDecl * | PrevDecl | ||
) | [protected] |
Definition at line 690 of file DeclTemplate.cpp.
Referenced by Create(), and CreateDeserialized().
ClassTemplateSpecializationDecl::ClassTemplateSpecializationDecl | ( | ASTContext & | C, |
Kind | DK | ||
) | [explicit, protected] |
Definition at line 706 of file DeclTemplate.cpp.
static bool clang::ClassTemplateSpecializationDecl::classof | ( | const Decl * | D | ) | [inline, static] |
Reimplemented from clang::CXXRecordDecl.
Reimplemented in clang::ClassTemplatePartialSpecializationDecl.
Definition at line 1640 of file DeclTemplate.h.
References classofKind(), and clang::Decl::getKind().
static bool clang::ClassTemplateSpecializationDecl::classofKind | ( | Kind | K | ) | [inline, static] |
Reimplemented from clang::CXXRecordDecl.
Reimplemented in clang::ClassTemplatePartialSpecializationDecl.
Definition at line 1641 of file DeclTemplate.h.
Referenced by classof().
ClassTemplateSpecializationDecl * ClassTemplateSpecializationDecl::Create | ( | ASTContext & | Context, |
TagKind | TK, | ||
DeclContext * | DC, | ||
SourceLocation | StartLoc, | ||
SourceLocation | IdLoc, | ||
ClassTemplateDecl * | SpecializedTemplate, | ||
const TemplateArgument * | Args, | ||
unsigned | NumArgs, | ||
ClassTemplateSpecializationDecl * | PrevDecl | ||
) | [static] |
Definition at line 713 of file DeclTemplate.cpp.
References ClassTemplateSpecializationDecl(), Context, clang::ASTContext::getTypeDeclType(), and clang::TagDecl::MayHaveOutOfDateDef.
Referenced by clang::Sema::ActOnClassTemplateSpecialization(), clang::Sema::ActOnExplicitInstantiation(), clang::Sema::CheckTemplateIdType(), and clang::ASTNodeImporter::VisitClassTemplateSpecializationDecl().
ClassTemplateSpecializationDecl * ClassTemplateSpecializationDecl::CreateDeserialized | ( | ASTContext & | C, |
unsigned | ID | ||
) | [static] |
Reimplemented in clang::ClassTemplatePartialSpecializationDecl.
Definition at line 732 of file DeclTemplate.cpp.
References AttributeLangSupport::C, ClassTemplateSpecializationDecl(), and clang::TagDecl::MayHaveOutOfDateDef.
SourceLocation clang::ClassTemplateSpecializationDecl::getExternLoc | ( | ) | const [inline] |
Gets the location of the extern keyword, if present.
Definition at line 1605 of file DeclTemplate.h.
Referenced by getSourceRange(), and clang::ASTDeclWriter::VisitClassTemplateSpecializationDecl().
llvm::PointerUnion<ClassTemplateDecl *, ClassTemplatePartialSpecializationDecl *> clang::ClassTemplateSpecializationDecl::getInstantiatedFrom | ( | ) | const [inline] |
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.
Definition at line 1530 of file DeclTemplate.h.
References getSpecializationKind(), getSpecializedTemplateOrPartial(), and clang::isTemplateInstantiation().
Referenced by getSourceRange().
ClassTemplateSpecializationDecl* clang::ClassTemplateSpecializationDecl::getMostRecentDecl | ( | ) | [inline] |
Returns the most recent (re)declaration of this declaration.
Reimplemented from clang::CXXRecordDecl.
Reimplemented in clang::ClassTemplatePartialSpecializationDecl.
Definition at line 1463 of file DeclTemplate.h.
References clang::CXXRecordDecl::getPreviousDecl(), and clang::RecordDecl::isInjectedClassName().
void ClassTemplateSpecializationDecl::getNameForDiagnostic | ( | raw_ostream & | OS, |
const PrintingPolicy & | Policy, | ||
bool | Qualified | ||
) | const [override, virtual] |
getNameForDiagnostic - 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.
Reimplemented from clang::NamedDecl.
Definition at line 740 of file DeclTemplate.cpp.
References clang::TemplateArgumentList::data(), getTemplateArgs(), clang::TemplateSpecializationType::PrintTemplateArgumentList(), and clang::TemplateArgumentList::size().
SourceLocation clang::ClassTemplateSpecializationDecl::getPointOfInstantiation | ( | ) | const [inline] |
Get the point of instantiation (if any), or null if none.
Definition at line 1515 of file DeclTemplate.h.
Referenced by clang::Sema::ActOnClassTemplateSpecialization(), clang::Sema::ActOnExplicitInstantiation(), propagateDLLAttrToBaseClassTemplate(), and clang::ASTDeclWriter::VisitClassTemplateSpecializationDecl().
SourceRange ClassTemplateSpecializationDecl::getSourceRange | ( | ) | const [override, virtual] |
Source range that this declaration covers.
Reimplemented from clang::TagDecl.
Definition at line 758 of file DeclTemplate.cpp.
References clang::TypeLoc::getEndLoc(), getExternLoc(), getInstantiatedFrom(), clang::ClassTemplatePartialSpecializationDecl::getInstantiatedFromMember(), clang::TagDecl::getRBraceLoc(), clang::TemplateDecl::getSourceRange(), getSpecializationKind(), getSpecializedTemplate(), getTemplateKeywordLoc(), getTypeAsWritten(), clang::TypeSourceInfo::getTypeLoc(), clang::SourceLocation::isInvalid(), clang::SourceLocation::isValid(), clang::TSK_ExplicitInstantiationDeclaration, clang::TSK_ExplicitInstantiationDefinition, and clang::TSK_ExplicitSpecialization.
TemplateSpecializationKind clang::ClassTemplateSpecializationDecl::getSpecializationKind | ( | ) | const [inline] |
Determine the kind of specialization that this declaration represents.
Definition at line 1485 of file DeclTemplate.h.
Referenced by getInstantiatedFrom(), getSourceRange(), clang::Sema::InstantiateClassTemplateSpecialization(), isExplicitSpecialization(), propagateDLLAttrToBaseClassTemplate(), clang::ASTDeclWriter::VisitClassTemplateSpecializationDecl(), and clang::ASTNodeImporter::VisitClassTemplateSpecializationDecl().
Retrieve the template that this specialization specializes.
Definition at line 750 of file DeclTemplate.cpp.
Referenced by DeduceTemplateArguments(), FinishTemplateArgumentDeduction(), getSourceRange(), clang::Sema::InstantiateClassTemplateSpecialization(), clang::Sema::isStdInitializerList(), IsStructurallyEquivalent(), mergeTemplateLV(), propagateDLLAttrToBaseClassTemplate(), clang::ASTDeclWriter::VisitClassTemplateSpecializationDecl(), and clang::ASTNodeImporter::VisitClassTemplateSpecializationDecl().
llvm::PointerUnion<ClassTemplateDecl *, ClassTemplatePartialSpecializationDecl *> clang::ClassTemplateSpecializationDecl::getSpecializedTemplateOrPartial | ( | ) | const [inline] |
Retrieve the class template or class template partial specialization which was specialized by this.
Definition at line 1542 of file DeclTemplate.h.
Referenced by getInstantiatedFrom(), clang::ASTDeclReader::UpdateDecl(), and clang::ASTDeclWriter::VisitClassTemplateSpecializationDecl().
const TemplateArgumentList& clang::ClassTemplateSpecializationDecl::getTemplateArgs | ( | ) | const [inline] |
Retrieve the template arguments of the class template specialization.
Definition at line 1479 of file DeclTemplate.h.
Referenced by DeduceTemplateArguments(), clang::Sema::DeduceTemplateArguments(), clang::Sema::getMoreSpecializedPartialSpecialization(), getNameForDiagnostic(), getTemplateInstantiationArgs(), clang::Sema::InstantiateClassTemplateSpecialization(), isCharSpecialization(), clang::Sema::isStdInitializerList(), isStreamCharSpecialization(), IsStructurallyEquivalent(), mergeTemplateLV(), clang::ASTDeclWriter::VisitClassTemplateSpecializationDecl(), and clang::ASTNodeImporter::VisitClassTemplateSpecializationDecl().
const TemplateArgumentList& clang::ClassTemplateSpecializationDecl::getTemplateInstantiationArgs | ( | ) | const [inline] |
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.
Definition at line 1561 of file DeclTemplate.h.
References getTemplateArgs().
Referenced by clang::ASTDeclWriter::VisitClassTemplateSpecializationDecl().
SourceLocation clang::ClassTemplateSpecializationDecl::getTemplateKeywordLoc | ( | ) | const [inline] |
Gets the location of the template keyword, if present.
Definition at line 1622 of file DeclTemplate.h.
Referenced by getSourceRange(), and clang::ASTDeclWriter::VisitClassTemplateSpecializationDecl().
TypeSourceInfo* clang::ClassTemplateSpecializationDecl::getTypeAsWritten | ( | ) | const [inline] |
Gets the type of this specialization as it was written by the user, if it was so written.
Definition at line 1600 of file DeclTemplate.h.
Referenced by getSourceRange(), and clang::ASTDeclWriter::VisitClassTemplateSpecializationDecl().
bool clang::ClassTemplateSpecializationDecl::isExplicitInstantiationOrSpecialization | ( | ) | const [inline] |
True if this declaration is an explicit specialization, explicit instantiation declaration, or explicit instantiation definition.
Definition at line 1496 of file DeclTemplate.h.
References clang::CXXRecordDecl::getTemplateSpecializationKind(), clang::TSK_ExplicitInstantiationDeclaration, clang::TSK_ExplicitInstantiationDefinition, clang::TSK_ExplicitSpecialization, clang::TSK_ImplicitInstantiation, and clang::TSK_Undeclared.
Referenced by shouldConsiderTemplateVisibility().
bool clang::ClassTemplateSpecializationDecl::isExplicitSpecialization | ( | ) | const [inline] |
Definition at line 1489 of file DeclTemplate.h.
References getSpecializationKind(), and clang::TSK_ExplicitSpecialization.
Referenced by clang::PredefinedExpr::ComputeName(), propagateDLLAttrToBaseClassTemplate(), and shouldConsiderTemplateVisibility().
void clang::ClassTemplateSpecializationDecl::Profile | ( | llvm::FoldingSetNodeID & | ID | ) | const [inline] |
Definition at line 1628 of file DeclTemplate.h.
References clang::TemplateArgumentList::asArray(), and clang::Decl::getASTContext().
Referenced by Profile().
static void clang::ClassTemplateSpecializationDecl::Profile | ( | llvm::FoldingSetNodeID & | ID, |
ArrayRef< TemplateArgument > | TemplateArgs, | ||
ASTContext & | Context | ||
) | [inline, static] |
Definition at line 1633 of file DeclTemplate.h.
References Profile().
void clang::ClassTemplateSpecializationDecl::setExternLoc | ( | SourceLocation | Loc | ) | [inline] |
Sets the location of the extern keyword.
Definition at line 1609 of file DeclTemplate.h.
References clang::Decl::getASTContext().
Referenced by clang::Sema::ActOnExplicitInstantiation().
void clang::ClassTemplateSpecializationDecl::setInstantiationOf | ( | ClassTemplatePartialSpecializationDecl * | PartialSpec, |
const TemplateArgumentList * | TemplateArgs | ||
) | [inline] |
Note that this class template specialization is actually an instantiation of the given class template partial specialization whose template arguments have been deduced.
Definition at line 1572 of file DeclTemplate.h.
References clang::Decl::getASTContext().
Referenced by clang::Sema::InstantiateClassTemplateSpecialization(), and clang::ASTDeclReader::UpdateDecl().
void clang::ClassTemplateSpecializationDecl::setInstantiationOf | ( | ClassTemplateDecl * | TemplDecl | ) | [inline] |
Note that this class template specialization is an instantiation of the given class template.
Definition at line 1585 of file DeclTemplate.h.
void clang::ClassTemplateSpecializationDecl::setPointOfInstantiation | ( | SourceLocation | Loc | ) | [inline] |
Definition at line 1519 of file DeclTemplate.h.
References clang::SourceLocation::isValid().
Referenced by clang::Sema::ActOnExplicitInstantiation(), and clang::ASTDeclReader::UpdateDecl().
void clang::ClassTemplateSpecializationDecl::setSpecializationKind | ( | TemplateSpecializationKind | TSK | ) | [inline] |
void clang::ClassTemplateSpecializationDecl::setTemplateKeywordLoc | ( | SourceLocation | Loc | ) | [inline] |
Sets the location of the template keyword.
Definition at line 1616 of file DeclTemplate.h.
References clang::Decl::getASTContext().
Referenced by clang::Sema::ActOnClassTemplateSpecialization(), and clang::Sema::ActOnExplicitInstantiation().
void clang::ClassTemplateSpecializationDecl::setTypeAsWritten | ( | TypeSourceInfo * | T | ) | [inline] |
Sets the type of this specialization as it was written by the user. This will be a class template specialization type.
Definition at line 1593 of file DeclTemplate.h.
References clang::Decl::getASTContext().
Referenced by clang::Sema::ActOnClassTemplateSpecialization(), clang::Sema::ActOnExplicitInstantiation(), and clang::TemplateDeclInstantiator::InstantiateClassTemplatePartialSpecialization().
friend class ASTDeclReader [friend] |
Reimplemented from clang::CXXRecordDecl.
Reimplemented in clang::ClassTemplatePartialSpecializationDecl.
Definition at line 1646 of file DeclTemplate.h.
friend class ASTDeclWriter [friend] |
Reimplemented from clang::CXXRecordDecl.
Reimplemented in clang::ClassTemplatePartialSpecializationDecl.
Definition at line 1647 of file DeclTemplate.h.