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 | |
| virtual void | getNameForDiagnostic (std::string &S, const PrintingPolicy &Policy, bool Qualified) const |
| 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 |
| 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, 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 |
| 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, const TemplateArgument *TemplateArgs, unsigned NumTemplateArgs, ASTContext &Context) |
| static bool | classof (const Decl *D) |
| static bool | classofKind (Kind K) |
| static bool | classof (const ClassTemplateSpecializationDecl *) |
| static bool | classof (const ClassTemplatePartialSpecializationDecl *) |
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 (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 1213 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 621 of file DeclTemplate.cpp.
Referenced by Create(), and CreateDeserialized().
| ClassTemplateSpecializationDecl::ClassTemplateSpecializationDecl | ( | Kind | DK | ) | [explicit, protected] |
Definition at line 637 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 1454 of file DeclTemplate.h.
References classofKind(), and clang::Decl::getKind().
| static bool clang::ClassTemplateSpecializationDecl::classof | ( | const ClassTemplateSpecializationDecl * | ) | [inline, static] |
Reimplemented from clang::CXXRecordDecl.
Definition at line 1460 of file DeclTemplate.h.
| static bool clang::ClassTemplateSpecializationDecl::classof | ( | const ClassTemplatePartialSpecializationDecl * | ) | [inline, static] |
Reimplemented in clang::ClassTemplatePartialSpecializationDecl.
Definition at line 1464 of file DeclTemplate.h.
| static bool clang::ClassTemplateSpecializationDecl::classofKind | ( | Kind | K | ) | [inline, static] |
Reimplemented from clang::CXXRecordDecl.
Reimplemented in clang::ClassTemplatePartialSpecializationDecl.
Definition at line 1455 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 644 of file DeclTemplate.cpp.
References ClassTemplateSpecializationDecl(), and clang::ASTContext::getTypeDeclType().
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 664 of file DeclTemplate.cpp.
References clang::Decl::AllocateDeserializedDecl(), and ClassTemplateSpecializationDecl().
| SourceLocation clang::ClassTemplateSpecializationDecl::getExternLoc | ( | ) | const [inline] |
Gets the location of the extern keyword, if present.
Definition at line 1419 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 1336 of file DeclTemplate.h.
References getSpecializationKind(), clang::TSK_ExplicitInstantiationDeclaration, clang::TSK_ExplicitInstantiationDefinition, and clang::TSK_ImplicitInstantiation.
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 1286 of file DeclTemplate.h.
References clang::CXXRecordDecl::getPreviousDecl(), and clang::RecordDecl::isInjectedClassName().
| void ClassTemplateSpecializationDecl::getNameForDiagnostic | ( | std::string & | S, |
| const PrintingPolicy & | Policy, | ||
| bool | Qualified | ||
| ) | const [virtual] |
getNameForDiagnostic - Appends a human-readable name for this declaration into the given string.
This is the method invoked by Sema when displaying a NamedDecl in a diagnostic. It does not necessarily produce the same result as getNameAsString(); for example, class template specializations are printed with their template arguments.
TODO: use an API that doesn't require so many temporary strings
Reimplemented from clang::NamedDecl.
Definition at line 672 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 1321 of file DeclTemplate.h.
Referenced by clang::Sema::ActOnClassTemplateSpecialization(), clang::Sema::ActOnExplicitInstantiation(), and clang::ASTDeclWriter::VisitClassTemplateSpecializationDecl().
| SourceRange ClassTemplateSpecializationDecl::getSourceRange | ( | ) | const [virtual] |
Source range that this declaration covers.
Reimplemented from clang::TagDecl.
Definition at line 693 of file DeclTemplate.cpp.
References clang::TypeLoc::getEndLoc(), getExternLoc(), getInstantiatedFrom(), clang::TagDecl::getRBraceLoc(), clang::TemplateDecl::getSourceRange(), getSpecializedTemplate(), getTemplateKeywordLoc(), getTypeAsWritten(), clang::TypeSourceInfo::getTypeLoc(), and clang::SourceLocation::isInvalid().
| TemplateSpecializationKind clang::ClassTemplateSpecializationDecl::getSpecializationKind | ( | ) | const [inline] |
Determine the kind of specialization that this declaration represents.
Definition at line 1308 of file DeclTemplate.h.
Referenced by clang::Sema::ActOnClassTemplateSpecialization(), getInstantiatedFrom(), clang::Sema::InstantiateClassTemplateSpecialization(), isExplicitSpecialization(), clang::ASTDeclWriter::VisitClassTemplateSpecializationDecl(), and clang::ASTNodeImporter::VisitClassTemplateSpecializationDecl().
| ClassTemplateDecl * ClassTemplateSpecializationDecl::getSpecializedTemplate | ( | ) | const |
Retrieve the template that this specialization specializes.
Definition at line 685 of file DeclTemplate.cpp.
Referenced by DeduceTemplateArguments(), FinishTemplateArgumentDeduction(), getSourceRange(), clang::Sema::InstantiateClassTemplateSpecialization(), clang::Sema::isStdInitializerList(), IsStructurallyEquivalent(), clang::TemplateDeclInstantiator::VisitClassTemplatePartialSpecializationDecl(), 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 1355 of file DeclTemplate.h.
Referenced by clang::ASTDeclWriter::VisitClassTemplateSpecializationDecl().
| const TemplateArgumentList& clang::ClassTemplateSpecializationDecl::getTemplateArgs | ( | ) | const [inline] |
Retrieve the template arguments of the class template specialization.
Definition at line 1302 of file DeclTemplate.h.
Referenced by clang::Sema::ActOnClassTemplateSpecialization(), DeduceTemplateArguments(), clang::Sema::DeduceTemplateArguments(), clang::Sema::getMoreSpecializedPartialSpecialization(), getNameForDiagnostic(), getTemplateInstantiationArgs(), clang::Sema::InstantiateClassTemplateSpecialization(), isCharSpecialization(), clang::Sema::isStdInitializerList(), isStreamCharSpecialization(), IsStructurallyEquivalent(), 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 1375 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 1436 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 1414 of file DeclTemplate.h.
Referenced by getSourceRange(), and clang::ASTDeclWriter::VisitClassTemplateSpecializationDecl().
| bool clang::ClassTemplateSpecializationDecl::isExplicitSpecialization | ( | ) | const [inline] |
Definition at line 1312 of file DeclTemplate.h.
References getSpecializationKind(), and clang::TSK_ExplicitSpecialization.
Referenced by shouldConsiderTemplateLV().
| void clang::ClassTemplateSpecializationDecl::Profile | ( | llvm::FoldingSetNodeID & | ID | ) | const [inline] |
Definition at line 1442 of file DeclTemplate.h.
References clang::TemplateArgumentList::data(), clang::Decl::getASTContext(), and clang::TemplateArgumentList::size().
Referenced by Profile().
| static void clang::ClassTemplateSpecializationDecl::Profile | ( | llvm::FoldingSetNodeID & | ID, |
| const TemplateArgument * | TemplateArgs, | ||
| unsigned | NumTemplateArgs, | ||
| ASTContext & | Context | ||
| ) | [inline, static] |
Definition at line 1447 of file DeclTemplate.h.
| void clang::ClassTemplateSpecializationDecl::setExternLoc | ( | SourceLocation | Loc | ) | [inline] |
Sets the location of the extern keyword.
Definition at line 1423 of file DeclTemplate.h.
References clang::Decl::getASTContext().
Referenced by clang::Sema::ActOnExplicitInstantiation().
| void clang::ClassTemplateSpecializationDecl::setInstantiationOf | ( | ClassTemplatePartialSpecializationDecl * | PartialSpec, |
| 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 1386 of file DeclTemplate.h.
References clang::Decl::getASTContext().
Referenced by clang::Sema::InstantiateClassTemplateSpecialization().
| void clang::ClassTemplateSpecializationDecl::setInstantiationOf | ( | ClassTemplateDecl * | TemplDecl | ) | [inline] |
Note that this class template specialization is an instantiation of the given class template.
Definition at line 1399 of file DeclTemplate.h.
| void clang::ClassTemplateSpecializationDecl::setPointOfInstantiation | ( | SourceLocation | Loc | ) | [inline] |
Definition at line 1325 of file DeclTemplate.h.
References clang::SourceLocation::isValid().
Referenced by clang::Sema::ActOnExplicitInstantiation().
| void clang::ClassTemplateSpecializationDecl::setSpecializationKind | ( | TemplateSpecializationKind | TSK | ) | [inline] |
| void clang::ClassTemplateSpecializationDecl::setTemplateKeywordLoc | ( | SourceLocation | Loc | ) | [inline] |
Sets the location of the template keyword.
Definition at line 1430 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 1407 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 1468 of file DeclTemplate.h.
friend class ASTDeclWriter [friend] |
Reimplemented from clang::CXXRecordDecl.
Reimplemented in clang::ClassTemplatePartialSpecializationDecl.
Definition at line 1469 of file DeclTemplate.h.