clang API Documentation

Classes | Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Friends
clang::RedeclarableTemplateDecl Class Reference

Declaration of a redeclarable template. More...

#include <DeclTemplate.h>

Inheritance diagram for clang::RedeclarableTemplateDecl:
Inheritance graph
[legend]
Collaboration diagram for clang::RedeclarableTemplateDecl:
Collaboration graph
[legend]

List of all members.

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

RedeclarableTemplateDeclgetCanonicalDecl () override
 Retrieves the canonical declaration of this template.
const RedeclarableTemplateDeclgetCanonicalDecl () 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.
RedeclarableTemplateDeclgetInstantiatedFromMemberTemplate () 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)
CommonBasegetCommonPtr () 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 CommonBasenewCommon (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

CommonBaseCommon
 Pointer to the common data shared by all declarations of this template.

Friends

class RedeclarableTemplate
class ASTReader
class ASTDeclReader
class ASTDeclWriter

Detailed Description

Declaration of a redeclarable template.

Definition at line 530 of file DeclTemplate.h.


Member Typedef Documentation

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.


Constructor & Destructor Documentation

Definition at line 625 of file DeclTemplate.h.


Member Function Documentation

static bool clang::RedeclarableTemplateDecl::classof ( const Decl D) [inline, static]
static bool clang::RedeclarableTemplateDecl::classofKind ( Kind  K) [inline, static]
template<class EntryType >
RedeclarableTemplateDecl::SpecEntryTraits< EntryType >::DeclType * RedeclarableTemplateDecl::findSpecializationImpl ( llvm::FoldingSetVector< EntryType > &  Specs,
ArrayRef< TemplateArgument Args,
void *&  InsertPos 
) [protected]

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().

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().

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().

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().

template<typename EntryType >
static SpecIterator<EntryType> clang::RedeclarableTemplateDecl::makeSpecIterator ( llvm::FoldingSetVector< EntryType > &  Specs,
bool  isEnd 
) [inline, static, protected]
virtual CommonBase* clang::RedeclarableTemplateDecl::newCommon ( ASTContext C) const [protected, pure virtual]

Friends And Related Function Documentation

friend class ASTDeclReader [friend]
friend class ASTDeclWriter [friend]
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.


Member Data Documentation

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().


The documentation for this class was generated from the following files: