clang API Documentation
Represents a variable template specialization, which refers to a variable 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 variable template specialization that was instantiated from a variable template partial specialization. | |
Public Member Functions | |
void | getNameForDiagnostic (raw_ostream &OS, const PrintingPolicy &Policy, bool Qualified) const override |
VarTemplateSpecializationDecl * | getMostRecentDecl () |
Returns the most recent (re)declaration of this declaration. | |
VarTemplateDecl * | getSpecializedTemplate () const |
Retrieve the template that this specialization specializes. | |
const TemplateArgumentList & | getTemplateArgs () const |
Retrieve the template arguments of the variable template specialization. | |
void | setTemplateArgsInfo (const TemplateArgumentListInfo &ArgsInfo) |
const TemplateArgumentListInfo & | getTemplateArgsInfo () const |
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 < VarTemplateDecl *, VarTemplatePartialSpecializationDecl * > | getInstantiatedFrom () const |
If this variable template specialization is an instantiation of a template (rather than an explicit specialization), return the variable template or variable template partial specialization from which it was instantiated. | |
llvm::PointerUnion < VarTemplateDecl *, VarTemplatePartialSpecializationDecl * > | getSpecializedTemplateOrPartial () const |
Retrieve the variable template or variable template partial specialization which was specialized by this. | |
const TemplateArgumentList & | getTemplateInstantiationArgs () const |
Retrieve the set of template arguments that should be used to instantiate the initializer of the variable template or variable template partial specialization from which this variable template specialization was instantiated. | |
void | setInstantiationOf (VarTemplatePartialSpecializationDecl *PartialSpec, const TemplateArgumentList *TemplateArgs) |
Note that this variable template specialization is actually an instantiation of the given variable template partial specialization whose template arguments have been deduced. | |
void | setInstantiationOf (VarTemplateDecl *TemplDecl) |
Note that this variable template specialization is an instantiation of the given variable template. | |
void | setTypeAsWritten (TypeSourceInfo *T) |
Sets the type of this specialization as it was written by the user. | |
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. | |
void | Profile (llvm::FoldingSetNodeID &ID) const |
Static Public Member Functions | |
static VarTemplateSpecializationDecl * | Create (ASTContext &Context, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, VarTemplateDecl *SpecializedTemplate, QualType T, TypeSourceInfo *TInfo, StorageClass S, const TemplateArgument *Args, unsigned NumArgs) |
static VarTemplateSpecializationDecl * | 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 | |
VarTemplateSpecializationDecl (Kind DK, ASTContext &Context, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, VarTemplateDecl *SpecializedTemplate, QualType T, TypeSourceInfo *TInfo, StorageClass S, const TemplateArgument *Args, unsigned NumArgs) | |
VarTemplateSpecializationDecl (Kind DK, ASTContext &Context) | |
Friends | |
class | ASTDeclReader |
class | ASTDeclWriter |
Represents a variable template specialization, which refers to a variable template with a given set of template arguments.
Variable template specializations represent both explicit specializations of variable templates, as in the example below, and implicit instantiations of variable templates.
template<typename T> constexpr T pi = T(3.1415926535897932385); template<> constexpr float pi<float>; // variable template specialization pi<float>
Definition at line 2249 of file DeclTemplate.h.
VarTemplateSpecializationDecl::VarTemplateSpecializationDecl | ( | Kind | DK, |
ASTContext & | Context, | ||
DeclContext * | DC, | ||
SourceLocation | StartLoc, | ||
SourceLocation | IdLoc, | ||
VarTemplateDecl * | SpecializedTemplate, | ||
QualType | T, | ||
TypeSourceInfo * | TInfo, | ||
StorageClass | S, | ||
const TemplateArgument * | Args, | ||
unsigned | NumArgs | ||
) | [protected] |
Definition at line 1057 of file DeclTemplate.cpp.
Referenced by Create(), and CreateDeserialized().
VarTemplateSpecializationDecl::VarTemplateSpecializationDecl | ( | Kind | DK, |
ASTContext & | Context | ||
) | [explicit, protected] |
Definition at line 1068 of file DeclTemplate.cpp.
static bool clang::VarTemplateSpecializationDecl::classof | ( | const Decl * | D | ) | [inline, static] |
Reimplemented from clang::VarDecl.
Reimplemented in clang::VarTemplatePartialSpecializationDecl.
Definition at line 2497 of file DeclTemplate.h.
References classofKind(), and clang::Decl::getKind().
static bool clang::VarTemplateSpecializationDecl::classofKind | ( | Kind | K | ) | [inline, static] |
Reimplemented from clang::VarDecl.
Reimplemented in clang::VarTemplatePartialSpecializationDecl.
Definition at line 2498 of file DeclTemplate.h.
Referenced by classof().
VarTemplateSpecializationDecl * VarTemplateSpecializationDecl::Create | ( | ASTContext & | Context, |
DeclContext * | DC, | ||
SourceLocation | StartLoc, | ||
SourceLocation | IdLoc, | ||
VarTemplateDecl * | SpecializedTemplate, | ||
QualType | T, | ||
TypeSourceInfo * | TInfo, | ||
StorageClass | S, | ||
const TemplateArgument * | Args, | ||
unsigned | NumArgs | ||
) | [static] |
Definition at line 1074 of file DeclTemplate.cpp.
References Context, and VarTemplateSpecializationDecl().
Referenced by clang::Sema::ActOnVarTemplateSpecialization(), and clang::ASTNodeImporter::VisitVarTemplateSpecializationDecl().
VarTemplateSpecializationDecl * VarTemplateSpecializationDecl::CreateDeserialized | ( | ASTContext & | C, |
unsigned | ID | ||
) | [static] |
Reimplemented from clang::VarDecl.
Reimplemented in clang::VarTemplatePartialSpecializationDecl.
Definition at line 1085 of file DeclTemplate.cpp.
References AttributeLangSupport::C, and VarTemplateSpecializationDecl().
SourceLocation clang::VarTemplateSpecializationDecl::getExternLoc | ( | ) | const [inline] |
Gets the location of the extern keyword, if present.
Definition at line 2464 of file DeclTemplate.h.
Referenced by clang::ASTDeclWriter::VisitVarTemplateSpecializationDecl().
llvm::PointerUnion<VarTemplateDecl *, VarTemplatePartialSpecializationDecl *> clang::VarTemplateSpecializationDecl::getInstantiatedFrom | ( | ) | const [inline] |
If this variable template specialization is an instantiation of a template (rather than an explicit specialization), return the variable template or variable template partial specialization from which it was instantiated.
Definition at line 2384 of file DeclTemplate.h.
References getSpecializationKind(), clang::TSK_ExplicitInstantiationDeclaration, clang::TSK_ExplicitInstantiationDefinition, and clang::TSK_ImplicitInstantiation.
Returns the most recent (re)declaration of this declaration.
Reimplemented from clang::Redeclarable< VarDecl >.
Reimplemented in clang::VarTemplatePartialSpecializationDecl.
Definition at line 2319 of file DeclTemplate.h.
void VarTemplateSpecializationDecl::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 1090 of file DeclTemplate.cpp.
References clang::TemplateArgumentList::data(), getTemplateArgs(), clang::TemplateSpecializationType::PrintTemplateArgumentList(), and clang::TemplateArgumentList::size().
SourceLocation clang::VarTemplateSpecializationDecl::getPointOfInstantiation | ( | ) | const [inline] |
Get the point of instantiation (if any), or null if none.
Reimplemented from clang::VarDecl.
Definition at line 2370 of file DeclTemplate.h.
Referenced by clang::Sema::ActOnVarTemplateSpecialization(), clang::Sema::RequireCompleteExprType(), and clang::ASTDeclWriter::VisitVarTemplateSpecializationDecl().
TemplateSpecializationKind clang::VarTemplateSpecializationDecl::getSpecializationKind | ( | ) | const [inline] |
Determine the kind of specialization that this declaration represents.
Definition at line 2340 of file DeclTemplate.h.
Referenced by clang::Sema::ActOnVarTemplateSpecialization(), getInstantiatedFrom(), isExplicitSpecialization(), clang::ASTDeclWriter::VisitVarTemplateSpecializationDecl(), and clang::ASTNodeImporter::VisitVarTemplateSpecializationDecl().
Retrieve the template that this specialization specializes.
Definition at line 1099 of file DeclTemplate.cpp.
Referenced by FinishTemplateArgumentDeduction(), clang::Sema::getMoreSpecializedPartialSpecialization(), clang::Sema::InstantiateVariableDefinition(), mergeTemplateLV(), clang::ASTDeclWriter::VisitVarTemplateSpecializationDecl(), clang::ASTNodeImporter::VisitVarTemplateSpecializationDecl(), and clang::TemplateDeclInstantiator::VisitVarTemplateSpecializationDecl().
llvm::PointerUnion<VarTemplateDecl *, VarTemplatePartialSpecializationDecl *> clang::VarTemplateSpecializationDecl::getSpecializedTemplateOrPartial | ( | ) | const [inline] |
Retrieve the variable template or variable template partial specialization which was specialized by this.
Definition at line 2401 of file DeclTemplate.h.
Referenced by clang::Sema::getTemplateInstantiationArgs(), clang::Sema::InstantiateVariableDefinition(), and clang::ASTDeclWriter::VisitVarTemplateSpecializationDecl().
const TemplateArgumentList& clang::VarTemplateSpecializationDecl::getTemplateArgs | ( | ) | const [inline] |
Retrieve the template arguments of the variable template specialization.
Definition at line 2329 of file DeclTemplate.h.
Referenced by clang::Sema::DeduceTemplateArguments(), clang::Sema::getMoreSpecializedPartialSpecialization(), getNameForDiagnostic(), getTemplateInstantiationArgs(), clang::Sema::InstantiateVariableDefinition(), mergeTemplateLV(), clang::ASTDeclWriter::VisitVarTemplateSpecializationDecl(), and clang::ASTNodeImporter::VisitVarTemplateSpecializationDecl().
const TemplateArgumentListInfo& clang::VarTemplateSpecializationDecl::getTemplateArgsInfo | ( | ) | const [inline] |
Definition at line 2334 of file DeclTemplate.h.
Referenced by DoMarkVarDeclReferenced(), clang::Sema::InstantiateVariableDefinition(), clang::ASTNodeImporter::VisitVarTemplateSpecializationDecl(), and clang::TemplateDeclInstantiator::VisitVarTemplateSpecializationDecl().
const TemplateArgumentList& clang::VarTemplateSpecializationDecl::getTemplateInstantiationArgs | ( | ) | const [inline] |
Retrieve the set of template arguments that should be used to instantiate the initializer of the variable template or variable template partial specialization from which this variable template specialization was instantiated.
Definition at line 2420 of file DeclTemplate.h.
References getTemplateArgs().
Referenced by clang::Sema::InstantiateVariableDefinition(), and clang::ASTDeclWriter::VisitVarTemplateSpecializationDecl().
SourceLocation clang::VarTemplateSpecializationDecl::getTemplateKeywordLoc | ( | ) | const [inline] |
Gets the location of the template keyword, if present.
Definition at line 2481 of file DeclTemplate.h.
Referenced by clang::Sema::BuildDeclRefExpr(), and clang::ASTDeclWriter::VisitVarTemplateSpecializationDecl().
TypeSourceInfo* clang::VarTemplateSpecializationDecl::getTypeAsWritten | ( | ) | const [inline] |
Gets the type of this specialization as it was written by the user, if it was so written.
Definition at line 2459 of file DeclTemplate.h.
Referenced by clang::ASTDeclWriter::VisitVarTemplateSpecializationDecl().
bool clang::VarTemplateSpecializationDecl::isExplicitInstantiationOrSpecialization | ( | ) | const [inline] |
True if this declaration is an explicit specialization, explicit instantiation declaration, or explicit instantiation definition.
Definition at line 2351 of file DeclTemplate.h.
References clang::VarDecl::getTemplateSpecializationKind(), clang::TSK_ExplicitInstantiationDeclaration, clang::TSK_ExplicitInstantiationDefinition, clang::TSK_ExplicitSpecialization, clang::TSK_ImplicitInstantiation, and clang::TSK_Undeclared.
Referenced by shouldConsiderTemplateVisibility().
bool clang::VarTemplateSpecializationDecl::isExplicitSpecialization | ( | ) | const [inline] |
Definition at line 2344 of file DeclTemplate.h.
References getSpecializationKind(), and clang::TSK_ExplicitSpecialization.
Referenced by shouldConsiderTemplateVisibility().
void clang::VarTemplateSpecializationDecl::Profile | ( | llvm::FoldingSetNodeID & | ID | ) | const [inline] |
Definition at line 2485 of file DeclTemplate.h.
References clang::TemplateArgumentList::asArray(), and clang::Decl::getASTContext().
Referenced by Profile().
static void clang::VarTemplateSpecializationDecl::Profile | ( | llvm::FoldingSetNodeID & | ID, |
ArrayRef< TemplateArgument > | TemplateArgs, | ||
ASTContext & | Context | ||
) | [inline, static] |
Definition at line 2489 of file DeclTemplate.h.
References Profile().
void clang::VarTemplateSpecializationDecl::setExternLoc | ( | SourceLocation | Loc | ) | [inline] |
Sets the location of the extern keyword.
Definition at line 2468 of file DeclTemplate.h.
References clang::Decl::getASTContext().
void clang::VarTemplateSpecializationDecl::setInstantiationOf | ( | VarTemplatePartialSpecializationDecl * | PartialSpec, |
const TemplateArgumentList * | TemplateArgs | ||
) | [inline] |
Note that this variable template specialization is actually an instantiation of the given variable template partial specialization whose template arguments have been deduced.
Definition at line 2431 of file DeclTemplate.h.
References clang::Decl::getASTContext().
Referenced by clang::Sema::CheckVarTemplateId().
void clang::VarTemplateSpecializationDecl::setInstantiationOf | ( | VarTemplateDecl * | TemplDecl | ) | [inline] |
Note that this variable template specialization is an instantiation of the given variable template.
Definition at line 2444 of file DeclTemplate.h.
void clang::VarTemplateSpecializationDecl::setPointOfInstantiation | ( | SourceLocation | Loc | ) | [inline] |
Definition at line 2374 of file DeclTemplate.h.
References clang::SourceLocation::isValid().
Referenced by clang::Sema::RequireCompleteExprType().
void clang::VarTemplateSpecializationDecl::setSpecializationKind | ( | TemplateSpecializationKind | TSK | ) | [inline] |
Definition at line 2365 of file DeclTemplate.h.
Referenced by clang::Sema::ActOnVarTemplateSpecialization(), clang::VarTemplatePartialSpecializationDecl::Create(), and clang::ASTNodeImporter::VisitVarTemplateSpecializationDecl().
void VarTemplateSpecializationDecl::setTemplateArgsInfo | ( | const TemplateArgumentListInfo & | ArgsInfo | ) |
Definition at line 1106 of file DeclTemplate.cpp.
References clang::TemplateArgumentListInfo::addArgument(), clang::TemplateArgumentListInfo::getLAngleLoc(), clang::TemplateArgumentListInfo::getRAngleLoc(), clang::TemplateArgumentListInfo::setLAngleLoc(), clang::TemplateArgumentListInfo::setRAngleLoc(), and clang::TemplateArgumentListInfo::size().
Referenced by clang::Sema::ActOnVarTemplateSpecialization(), and clang::ASTNodeImporter::VisitVarTemplateSpecializationDecl().
void clang::VarTemplateSpecializationDecl::setTemplateKeywordLoc | ( | SourceLocation | Loc | ) | [inline] |
Sets the location of the template keyword.
Definition at line 2475 of file DeclTemplate.h.
References clang::Decl::getASTContext().
Referenced by clang::Sema::ActOnVarTemplateSpecialization().
void clang::VarTemplateSpecializationDecl::setTypeAsWritten | ( | TypeSourceInfo * | T | ) | [inline] |
Sets the type of this specialization as it was written by the user.
Definition at line 2452 of file DeclTemplate.h.
References clang::Decl::getASTContext().
Referenced by clang::TemplateDeclInstantiator::InstantiateVarTemplatePartialSpecialization().
friend class ASTDeclReader [friend] |
Reimplemented from clang::VarDecl.
Reimplemented in clang::VarTemplatePartialSpecializationDecl.
Definition at line 2503 of file DeclTemplate.h.
friend class ASTDeclWriter [friend] |
Reimplemented from clang::DeclaratorDecl.
Reimplemented in clang::VarTemplatePartialSpecializationDecl.
Definition at line 2504 of file DeclTemplate.h.