clang API Documentation

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

Declaration of a class template. More...

#include <DeclTemplate.h>

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

List of all members.

Classes

struct  Common
 Data that is common to all of the declarations of a given class template. More...

Public Types

typedef SpecIterator
< ClassTemplateSpecializationDecl
spec_iterator
typedef SpecIterator
< ClassTemplatePartialSpecializationDecl
partial_spec_iterator

Public Member Functions

CXXRecordDeclgetTemplatedDecl () const
 Get the underlying class declarations of the template.
bool isThisDeclarationADefinition () const
ClassTemplateSpecializationDeclfindSpecialization (const TemplateArgument *Args, unsigned NumArgs, void *&InsertPos)
 Return the specialization with the provided arguments if it exists, otherwise return the insertion point.
void AddSpecialization (ClassTemplateSpecializationDecl *D, void *InsertPos)
 Insert the specified specialization knowing that it is not already in. InsertPos must be obtained from findSpecialization.
ClassTemplateDeclgetCanonicalDecl ()
 Retrieves the canonical declaration of this template.
const ClassTemplateDeclgetCanonicalDecl () const
ClassTemplateDeclgetPreviousDecl ()
 Retrieve the previous declaration of this class template, or NULL if no such declaration exists.
const ClassTemplateDeclgetPreviousDecl () const
 Retrieve the previous declaration of this class template, or NULL if no such declaration exists.
ClassTemplateDeclgetInstantiatedFromMemberTemplate ()
 Retrieve the previous declaration of this template, or NULL if no such declaration exists.
ClassTemplatePartialSpecializationDeclfindPartialSpecialization (const TemplateArgument *Args, unsigned NumArgs, void *&InsertPos)
 Return the partial specialization with the provided arguments if it exists, otherwise return the insertion point.
void AddPartialSpecialization (ClassTemplatePartialSpecializationDecl *D, void *InsertPos)
 Insert the specified partial specialization knowing that it is not already in. InsertPos must be obtained from findPartialSpecialization.
unsigned getNextPartialSpecSequenceNumber ()
 Return the next partial specialization sequence number.
void getPartialSpecializations (SmallVectorImpl< ClassTemplatePartialSpecializationDecl * > &PS)
 Retrieve the partial specializations as an ordered list.
ClassTemplatePartialSpecializationDeclfindPartialSpecialization (QualType T)
 Find a class template partial specialization with the given type T.
ClassTemplatePartialSpecializationDeclfindPartialSpecInstantiatedFromMember (ClassTemplatePartialSpecializationDecl *D)
 Find a class template partial specialization which was instantiated from the given member partial specialization.
QualType getInjectedClassNameSpecialization ()
 Retrieve the template specialization type of the injected-class-name for this class template.
spec_iterator spec_begin ()
spec_iterator spec_end ()
partial_spec_iterator partial_spec_begin ()
partial_spec_iterator partial_spec_end ()

Static Public Member Functions

static ClassTemplateDeclCreate (ASTContext &C, DeclContext *DC, SourceLocation L, DeclarationName Name, TemplateParameterList *Params, NamedDecl *Decl, ClassTemplateDecl *PrevDecl)
 Create a class template node.
static ClassTemplateDeclCreateDeserialized (ASTContext &C, unsigned ID)
 Create an empty class template node.
static bool classof (const Decl *D)
static bool classof (const ClassTemplateDecl *D)
static bool classofKind (Kind K)

Protected Member Functions

void LoadLazySpecializations ()
 Load any lazily-loaded specializations from the external source.
llvm::FoldingSet
< ClassTemplateSpecializationDecl > & 
getSpecializations ()
 Retrieve the set of specializations of this class template.
llvm::FoldingSet
< ClassTemplatePartialSpecializationDecl > & 
getPartialSpecializations ()
 Retrieve the set of partial specializations of this class template.
 ClassTemplateDecl (DeclContext *DC, SourceLocation L, DeclarationName Name, TemplateParameterList *Params, NamedDecl *Decl)
 ClassTemplateDecl (EmptyShell Empty)
CommonBasenewCommon (ASTContext &C)
CommongetCommonPtr ()
 Retrieves the "common" pointer shared by all (re-)declarations of the same template. Calling this routine may implicitly allocate memory for the common pointer.

Friends

class ASTDeclReader
class ASTDeclWriter

Detailed Description

Declaration of a class template.

Definition at line 1645 of file DeclTemplate.h.


Member Typedef Documentation

Definition at line 1829 of file DeclTemplate.h.

Definition at line 1818 of file DeclTemplate.h.


Constructor & Destructor Documentation

clang::ClassTemplateDecl::ClassTemplateDecl ( DeclContext DC,
SourceLocation  L,
DeclarationName  Name,
TemplateParameterList Params,
NamedDecl Decl 
) [inline, protected]

Definition at line 1685 of file DeclTemplate.h.

Referenced by Create(), and CreateDeserialized().

clang::ClassTemplateDecl::ClassTemplateDecl ( EmptyShell  Empty) [inline, protected]

Definition at line 1689 of file DeclTemplate.h.


Member Function Documentation

void ClassTemplateDecl::AddPartialSpecialization ( ClassTemplatePartialSpecializationDecl D,
void *  InsertPos 
)

Insert the specified partial specialization knowing that it is not already in. InsertPos must be obtained from findPartialSpecialization.

Definition at line 338 of file DeclTemplate.cpp.

References clang::Decl::getASTMutationListener(), and getPartialSpecializations().

void ClassTemplateDecl::AddSpecialization ( ClassTemplateSpecializationDecl D,
void *  InsertPos 
)

Insert the specified specialization knowing that it is not already in. InsertPos must be obtained from findSpecialization.

Definition at line 323 of file DeclTemplate.cpp.

References clang::Decl::getASTMutationListener(), and getSpecializations().

static bool clang::ClassTemplateDecl::classof ( const Decl D) [inline, static]

Reimplemented from clang::RedeclarableTemplateDecl.

Definition at line 1840 of file DeclTemplate.h.

References classofKind(), and clang::Decl::getKind().

static bool clang::ClassTemplateDecl::classof ( const ClassTemplateDecl D) [inline, static]

Reimplemented from clang::RedeclarableTemplateDecl.

Definition at line 1841 of file DeclTemplate.h.

static bool clang::ClassTemplateDecl::classofKind ( Kind  K) [inline, static]

Reimplemented from clang::RedeclarableTemplateDecl.

Definition at line 1842 of file DeclTemplate.h.

Referenced by classof().

ClassTemplateDecl * ClassTemplateDecl::Create ( ASTContext C,
DeclContext DC,
SourceLocation  L,
DeclarationName  Name,
TemplateParameterList Params,
NamedDecl Decl,
ClassTemplateDecl PrevDecl 
) [static]
ClassTemplateDecl * ClassTemplateDecl::CreateDeserialized ( ASTContext C,
unsigned  ID 
) [static]

Create an empty class template node.

Definition at line 281 of file DeclTemplate.cpp.

References clang::Decl::AllocateDeserializedDecl(), and ClassTemplateDecl().

ClassTemplatePartialSpecializationDecl * ClassTemplateDecl::findPartialSpecialization ( const TemplateArgument Args,
unsigned  NumArgs,
void *&  InsertPos 
)

Return the partial specialization with the provided arguments if it exists, otherwise return the insertion point.

Definition at line 331 of file DeclTemplate.cpp.

References clang::RedeclarableTemplateDecl::findSpecializationImpl(), and getPartialSpecializations().

Referenced by clang::TemplateDeclInstantiator::InstantiateClassTemplatePartialSpecialization().

ClassTemplatePartialSpecializationDecl * ClassTemplateDecl::findPartialSpecialization ( QualType  T)

Find a class template partial specialization with the given type T.

Parameters:
Ta dependent type that names a specialization of this class template.
Returns:
the class template partial specialization that exactly matches the type T, or NULL if no such partial specialization exists.

Definition at line 361 of file DeclTemplate.cpp.

References clang::Decl::getASTContext(), getPartialSpecializations(), clang::ASTContext::hasSameType(), and P.

ClassTemplatePartialSpecializationDecl * ClassTemplateDecl::findPartialSpecInstantiatedFromMember ( ClassTemplatePartialSpecializationDecl D)

Find a class template partial specialization which was instantiated from the given member partial specialization.

Parameters:
Da member class template partial specialization.
Returns:
the class template partial specialization which was instantiated from the given member partial specialization, or NULL if no such partial specialization exists.

Definition at line 376 of file DeclTemplate.cpp.

References clang::CXXRecordDecl::getCanonicalDecl(), getPartialSpecializations(), and P.

Referenced by clang::TemplateDeclInstantiator::VisitClassTemplatePartialSpecializationDecl().

ClassTemplateSpecializationDecl * ClassTemplateDecl::findSpecialization ( const TemplateArgument Args,
unsigned  NumArgs,
void *&  InsertPos 
)

Return the specialization with the provided arguments if it exists, otherwise return the insertion point.

Definition at line 318 of file DeclTemplate.cpp.

References clang::RedeclarableTemplateDecl::findSpecializationImpl(), and getSpecializations().

Referenced by clang::ASTNodeImporter::VisitClassTemplateSpecializationDecl().

ClassTemplateDecl* clang::ClassTemplateDecl::getCanonicalDecl ( ) [inline, virtual]
const ClassTemplateDecl* clang::ClassTemplateDecl::getCanonicalDecl ( ) const [inline]

Reimplemented from clang::RedeclarableTemplateDecl.

Definition at line 1736 of file DeclTemplate.h.

References getCanonicalDecl().

Common* clang::ClassTemplateDecl::getCommonPtr ( ) [inline, 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 from clang::RedeclarableTemplateDecl.

Definition at line 1695 of file DeclTemplate.h.

Referenced by getInjectedClassNameSpecialization(), getPartialSpecializations(), getSpecializations(), LoadLazySpecializations(), clang::ASTDeclReader::VisitClassTemplateDecl(), and clang::ASTDeclReader::VisitClassTemplateSpecializationDecl().

QualType ClassTemplateDecl::getInjectedClassNameSpecialization ( )

Retrieve the template specialization type of the injected-class-name for this class template.

The injected-class-name for a class template X is X<template-args>, where template-args is formed from the template arguments that correspond to the template parameters of X. For example:

 template<typename T, int N>
 struct array {
   typedef array this_type; // "array" is equivalent to "array<T, N>"
 };

Definition at line 391 of file DeclTemplate.cpp.

References GenerateInjectedTemplateArgs(), clang::Decl::getASTContext(), getCommonPtr(), clang::TemplateDecl::getTemplateParameters(), clang::ClassTemplateDecl::Common::InjectedClassNameType, clang::QualType::isNull(), and clang::TemplateParameterList::size().

Referenced by clang::Sema::CheckClassTemplate(), and clang::TemplateDeclInstantiator::VisitClassTemplateDecl().

ClassTemplateDecl* clang::ClassTemplateDecl::getInstantiatedFromMemberTemplate ( ) [inline]

Retrieve the previous declaration of this template, or NULL if no such declaration exists.

Reimplemented from clang::RedeclarableTemplateDecl.

Definition at line 1755 of file DeclTemplate.h.

Referenced by clang::Sema::CheckClassTemplate(), clang::Sema::InstantiateClassTemplateSpecialization(), and isInstantiationOf().

unsigned clang::ClassTemplateDecl::getNextPartialSpecSequenceNumber ( ) [inline]

Return the next partial specialization sequence number.

Definition at line 1772 of file DeclTemplate.h.

References getPartialSpecializations().

llvm::FoldingSet< ClassTemplatePartialSpecializationDecl > & ClassTemplateDecl::getPartialSpecializations ( ) [protected]
void ClassTemplateDecl::getPartialSpecializations ( SmallVectorImpl< ClassTemplatePartialSpecializationDecl * > &  PS)

Retrieve the partial specializations as an ordered list.

Definition at line 346 of file DeclTemplate.cpp.

References getPartialSpecializations(), and P.

ClassTemplateDecl* clang::ClassTemplateDecl::getPreviousDecl ( ) [inline]

Retrieve the previous declaration of this class template, or NULL if no such declaration exists.

Reimplemented from clang::Redeclarable< RedeclarableTemplateDecl >.

Definition at line 1743 of file DeclTemplate.h.

Referenced by getPreviousDecl().

const ClassTemplateDecl* clang::ClassTemplateDecl::getPreviousDecl ( ) const [inline]

Retrieve the previous declaration of this class template, or NULL if no such declaration exists.

Reimplemented from clang::Redeclarable< RedeclarableTemplateDecl >.

Definition at line 1750 of file DeclTemplate.h.

References getPreviousDecl().

llvm::FoldingSet< ClassTemplateSpecializationDecl > & ClassTemplateDecl::getSpecializations ( ) [protected]
CXXRecordDecl* clang::ClassTemplateDecl::getTemplatedDecl ( ) const [inline]
bool clang::ClassTemplateDecl::isThisDeclarationADefinition ( ) const [inline]

Returns whether this template declaration defines the primary class pattern.

Definition at line 1707 of file DeclTemplate.h.

References getTemplatedDecl(), and clang::TagDecl::isThisDeclarationADefinition().

void ClassTemplateDecl::LoadLazySpecializations ( ) [protected]
RedeclarableTemplateDecl::CommonBase * ClassTemplateDecl::newCommon ( ASTContext C) [protected, virtual]
partial_spec_iterator clang::ClassTemplateDecl::partial_spec_begin ( ) [inline]
partial_spec_iterator clang::ClassTemplateDecl::partial_spec_end ( ) [inline]
spec_iterator clang::ClassTemplateDecl::spec_begin ( ) [inline]
spec_iterator clang::ClassTemplateDecl::spec_end ( ) [inline]

Friends And Related Function Documentation

friend class ASTDeclReader [friend]

Reimplemented from clang::RedeclarableTemplateDecl.

Definition at line 1844 of file DeclTemplate.h.

friend class ASTDeclWriter [friend]

Reimplemented from clang::RedeclarableTemplateDecl.

Definition at line 1845 of file DeclTemplate.h.


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