clang API Documentation
Declaration of a redeclarable template. More...
#include <DeclTemplate.h>
Classes | |
struct | CommonBase |
struct | SpecEntryTraits |
struct | SpecEntryTraits< FunctionTemplateSpecializationInfo > |
class | SpecIterator |
Public Types | |
typedef redeclarable_base::redecl_range | redecl_range |
typedef redeclarable_base::redecl_iterator | redecl_iterator |
Public Member Functions | |
RedeclarableTemplateDecl * | getCanonicalDecl () override |
Retrieves the canonical declaration of this template. | |
const RedeclarableTemplateDecl * | getCanonicalDecl () const |
bool | isMemberSpecialization () const |
Determines whether this template was a specialization of a member template. | |
void | setMemberSpecialization () |
Note that this member template is a specialization. | |
RedeclarableTemplateDecl * | getInstantiatedFromMemberTemplate () const |
Retrieve the member template from which this template was instantiated, or NULL if this template was not instantiated from a member template. | |
void | setInstantiatedFromMemberTemplate (RedeclarableTemplateDecl *TD) |
Static Public Member Functions | |
static bool | classof (const Decl *D) |
static bool | classofKind (Kind K) |
Protected Member Functions | |
template<class EntryType > | |
SpecEntryTraits< EntryType > ::DeclType * | findSpecializationImpl (llvm::FoldingSetVector< EntryType > &Specs, ArrayRef< TemplateArgument > Args, void *&InsertPos) |
CommonBase * | getCommonPtr () const |
Retrieves the "common" pointer shared by all (re-)declarations of the same template. Calling this routine may implicitly allocate memory for the common pointer. | |
virtual CommonBase * | newCommon (ASTContext &C) const =0 |
RedeclarableTemplateDecl (Kind DK, ASTContext &C, DeclContext *DC, SourceLocation L, DeclarationName Name, TemplateParameterList *Params, NamedDecl *Decl) | |
Static Protected Member Functions | |
template<typename EntryType > | |
static SpecIterator< EntryType > | makeSpecIterator (llvm::FoldingSetVector< EntryType > &Specs, bool isEnd) |
Protected Attributes | |
CommonBase * | Common |
Pointer to the common data shared by all declarations of this template. | |
Friends | |
class | RedeclarableTemplate |
class | ASTReader |
class | ASTDeclReader |
class | ASTDeclWriter |
Declaration of a redeclarable template.
Definition at line 530 of file DeclTemplate.h.
typedef redeclarable_base::redecl_iterator clang::RedeclarableTemplateDecl::redecl_iterator |
Definition at line 717 of file DeclTemplate.h.
Reimplemented from clang::Redeclarable< RedeclarableTemplateDecl >.
Definition at line 716 of file DeclTemplate.h.
clang::RedeclarableTemplateDecl::RedeclarableTemplateDecl | ( | Kind | DK, |
ASTContext & | C, | ||
DeclContext * | DC, | ||
SourceLocation | L, | ||
DeclarationName | Name, | ||
TemplateParameterList * | Params, | ||
NamedDecl * | Decl | ||
) | [inline, protected] |
Definition at line 625 of file DeclTemplate.h.
static bool clang::RedeclarableTemplateDecl::classof | ( | const Decl * | D | ) | [inline, static] |
Reimplemented from clang::TemplateDecl.
Reimplemented in clang::VarTemplateDecl, clang::TypeAliasTemplateDecl, clang::ClassTemplateDecl, and clang::FunctionTemplateDecl.
Definition at line 726 of file DeclTemplate.h.
References classofKind(), and clang::Decl::getKind().
static bool clang::RedeclarableTemplateDecl::classofKind | ( | Kind | K | ) | [inline, static] |
Reimplemented from clang::TemplateDecl.
Reimplemented in clang::VarTemplateDecl, clang::TypeAliasTemplateDecl, clang::ClassTemplateDecl, and clang::FunctionTemplateDecl.
Definition at line 727 of file DeclTemplate.h.
Referenced by classof().
RedeclarableTemplateDecl::SpecEntryTraits< EntryType >::DeclType * RedeclarableTemplateDecl::findSpecializationImpl | ( | llvm::FoldingSetVector< EntryType > & | Specs, |
ArrayRef< TemplateArgument > | Args, | ||
void *& | InsertPos | ||
) | [protected] |
Definition at line 165 of file DeclTemplate.cpp.
References clang::Decl::getASTContext(), and clang::Redeclarable< RedeclarableTemplateDecl >::getMostRecentDecl().
Referenced by clang::ClassTemplateDecl::findPartialSpecialization(), clang::VarTemplateDecl::findPartialSpecialization(), clang::FunctionTemplateDecl::findSpecialization(), clang::ClassTemplateDecl::findSpecialization(), and clang::VarTemplateDecl::findSpecialization().
RedeclarableTemplateDecl* clang::RedeclarableTemplateDecl::getCanonicalDecl | ( | ) | [inline, override, virtual] |
Retrieves the canonical declaration of this template.
Reimplemented from clang::Decl.
Reimplemented in clang::VarTemplateDecl, clang::TypeAliasTemplateDecl, clang::ClassTemplateDecl, and clang::FunctionTemplateDecl.
Definition at line 635 of file DeclTemplate.h.
References clang::Redeclarable< RedeclarableTemplateDecl >::getFirstDecl().
Referenced by clang::ASTDeclReader::VisitRedeclarableTemplateDecl().
const RedeclarableTemplateDecl* clang::RedeclarableTemplateDecl::getCanonicalDecl | ( | ) | const [inline] |
Reimplemented from clang::Decl.
Reimplemented in clang::VarTemplateDecl, clang::TypeAliasTemplateDecl, clang::ClassTemplateDecl, and clang::FunctionTemplateDecl.
Definition at line 638 of file DeclTemplate.h.
References clang::Redeclarable< RedeclarableTemplateDecl >::getFirstDecl().
RedeclarableTemplateDecl::CommonBase * RedeclarableTemplateDecl::getCommonPtr | ( | ) | const [protected] |
Retrieves the "common" pointer shared by all (re-)declarations of the same template. Calling this routine may implicitly allocate memory for the common pointer.
Reimplemented in clang::VarTemplateDecl, clang::ClassTemplateDecl, and clang::FunctionTemplateDecl.
Definition at line 131 of file DeclTemplate.cpp.
References Common, clang::Decl::getASTContext(), clang::Redeclarable< RedeclarableTemplateDecl >::getPreviousDecl(), clang::Redeclarable< decl_type >::getPreviousDecl(), and newCommon().
Referenced by getInstantiatedFromMemberTemplate(), isMemberSpecialization(), setInstantiatedFromMemberTemplate(), and setMemberSpecialization().
RedeclarableTemplateDecl* clang::RedeclarableTemplateDecl::getInstantiatedFromMemberTemplate | ( | ) | const [inline] |
Retrieve the member template from which this template was instantiated, or NULL if this template was not instantiated from a member template.
A template is instantiated from a member template when the member template itself is part of a class template (or member thereof). For example, given
template<typename T> struct X { template<typename U> void f(T, U); }; void test(X<int> x) { x.f(1, 'a'); };
X<int>::f
is a FunctionTemplateDecl that describes the function template
template<typename U> void X<int>::f(int, U);
which was itself created during the instantiation of X<int>
. Calling getInstantiatedFromMemberTemplate() on this FunctionTemplateDecl will retrieve the FunctionTemplateDecl for the original template f
within the class template X<T>
, i.e.,
template<typename T> template<typename U> void X<T>::f(T, U);
Definition at line 707 of file DeclTemplate.h.
References getCommonPtr(), and clang::RedeclarableTemplateDecl::CommonBase::InstantiatedFromMember.
Referenced by clang::ASTDeclWriter::VisitRedeclarableTemplateDecl().
bool clang::RedeclarableTemplateDecl::isMemberSpecialization | ( | ) | const [inline] |
Determines whether this template was a specialization of a member template.
In the following example, the function template X<int>::f
and the member template X<int>::Inner
are member specializations.
template<typename T> struct X { template<typename U> void f(T, U); template<typename U> struct Inner; }; template<> template<typename T> void X<int>::f(int, T); template<> template<typename T> struct X<int>::Inner { /* ... */ };
Definition at line 660 of file DeclTemplate.h.
References getCommonPtr(), and clang::RedeclarableTemplateDecl::CommonBase::InstantiatedFromMember.
Referenced by clang::Sema::getTemplateInstantiationArgs(), clang::Sema::InstantiateClassTemplateSpecialization(), clang::Sema::InstantiateVariableDefinition(), isExplicitMemberSpecialization(), and clang::ASTDeclWriter::VisitRedeclarableTemplateDecl().
static SpecIterator<EntryType> clang::RedeclarableTemplateDecl::makeSpecIterator | ( | llvm::FoldingSetVector< EntryType > & | Specs, |
bool | isEnd | ||
) | [inline, static, protected] |
Definition at line 593 of file DeclTemplate.h.
Referenced by clang::FunctionTemplateDecl::spec_begin(), clang::ClassTemplateDecl::spec_begin(), clang::VarTemplateDecl::spec_begin(), clang::FunctionTemplateDecl::spec_end(), clang::ClassTemplateDecl::spec_end(), and clang::VarTemplateDecl::spec_end().
virtual CommonBase* clang::RedeclarableTemplateDecl::newCommon | ( | ASTContext & | C | ) | const [protected, pure virtual] |
Implemented in clang::VarTemplateDecl, clang::TypeAliasTemplateDecl, clang::ClassTemplateDecl, and clang::FunctionTemplateDecl.
Referenced by getCommonPtr(), and clang::ASTDeclReader::VisitRedeclarableTemplateDecl().
void clang::RedeclarableTemplateDecl::setInstantiatedFromMemberTemplate | ( | RedeclarableTemplateDecl * | TD | ) | [inline] |
Definition at line 711 of file DeclTemplate.h.
References getCommonPtr(), and clang::RedeclarableTemplateDecl::CommonBase::InstantiatedFromMember.
Referenced by clang::TemplateDeclInstantiator::VisitFunctionDecl(), and clang::ASTDeclReader::VisitRedeclarableTemplateDecl().
void clang::RedeclarableTemplateDecl::setMemberSpecialization | ( | ) | [inline] |
Note that this member template is a specialization.
Definition at line 665 of file DeclTemplate.h.
References getCommonPtr(), and clang::RedeclarableTemplateDecl::CommonBase::InstantiatedFromMember.
Referenced by clang::Sema::ActOnVariableDeclarator(), clang::Sema::CheckClassTemplate(), clang::Sema::CheckFunctionDeclaration(), and clang::ASTDeclReader::VisitRedeclarableTemplateDecl().
friend class ASTDeclReader [friend] |
Reimplemented from clang::Redeclarable< RedeclarableTemplateDecl >.
Reimplemented in clang::VarTemplateDecl, clang::TypeAliasTemplateDecl, clang::ClassTemplateDecl, and clang::FunctionTemplateDecl.
Definition at line 732 of file DeclTemplate.h.
friend class ASTDeclWriter [friend] |
Reimplemented from clang::Redeclarable< RedeclarableTemplateDecl >.
Reimplemented in clang::VarTemplateDecl, clang::TypeAliasTemplateDecl, clang::ClassTemplateDecl, and clang::FunctionTemplateDecl.
Definition at line 733 of file DeclTemplate.h.
friend class ASTReader [friend] |
Reimplemented from clang::Decl.
Definition at line 731 of file DeclTemplate.h.
friend class RedeclarableTemplate [friend] |
Definition at line 632 of file DeclTemplate.h.
CommonBase* clang::RedeclarableTemplateDecl::Common [mutable, protected] |
Pointer to the common data shared by all declarations of this template.
Reimplemented in clang::TypeAliasTemplateDecl.
Definition at line 615 of file DeclTemplate.h.
Referenced by getCommonPtr(), and clang::ASTDeclReader::VisitRedeclarableTemplateDecl().