clang  mainline
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 llvm::iterator_range
< spec_iterator
spec_range

Public Member Functions

void LoadLazySpecializations () const
 Load any lazily-loaded specializations from the external source.
CXXRecordDeclgetTemplatedDecl () const
 Get the underlying class declarations of the template.
bool isThisDeclarationADefinition () const
 Returns whether this template declaration defines the primary class pattern.
ClassTemplateSpecializationDeclfindSpecialization (ArrayRef< TemplateArgument > Args, 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.
ClassTemplateDeclgetCanonicalDecl () override
 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.
ClassTemplateDeclgetMostRecentDecl ()
 Returns the most recent (re)declaration of this declaration.
const ClassTemplateDeclgetMostRecentDecl () const
 Returns the most recent (re)declaration of this declaration.
ClassTemplateDeclgetInstantiatedFromMemberTemplate ()
ClassTemplatePartialSpecializationDeclfindPartialSpecialization (ArrayRef< TemplateArgument > Args, 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.
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_range specializations () const
spec_iterator spec_begin () const
spec_iterator spec_end () const

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 classofKind (Kind K)

Protected Member Functions

llvm::FoldingSetVector
< ClassTemplateSpecializationDecl > & 
getSpecializations () const
 Retrieve the set of specializations of this class template.
llvm::FoldingSetVector
< ClassTemplatePartialSpecializationDecl > & 
getPartialSpecializations ()
 Retrieve the set of partial specializations of this class template.
 ClassTemplateDecl (ASTContext &C, DeclContext *DC, SourceLocation L, DeclarationName Name, TemplateParameterList *Params, NamedDecl *Decl)
CommonBasenewCommon (ASTContext &C) const override
CommongetCommonPtr () const
 Retrieves the "common" pointer shared by all (re-)declarations of the same template.

Friends

class ASTDeclReader
class ASTDeclWriter

Detailed Description

Declaration of a class template.

Definition at line 1921 of file DeclTemplate.h.


Member Typedef Documentation

Definition at line 2094 of file DeclTemplate.h.

typedef llvm::iterator_range<spec_iterator> clang::ClassTemplateDecl::spec_range

Definition at line 2095 of file DeclTemplate.h.


Constructor & Destructor Documentation

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

Definition at line 1959 of file DeclTemplate.h.

Referenced by Create(), and CreateDeserialized().


Member Function Documentation

Insert the specified partial specialization knowing that it is not already in.

InsertPos must be obtained from findPartialSpecialization.

Definition at line 402 of file DeclTemplate.cpp.

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

Insert the specified specialization knowing that it is not already in.

InsertPos must be obtained from findSpecialization.

Definition at line 391 of file DeclTemplate.cpp.

References getSpecializations().

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

Reimplemented from clang::RedeclarableTemplateDecl.

Definition at line 2110 of file DeclTemplate.h.

References clang::Decl::getKind().

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

Reimplemented from clang::RedeclarableTemplateDecl.

Definition at line 2111 of file DeclTemplate.h.

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

Create an empty class template node.

Definition at line 345 of file DeclTemplate.cpp.

References AttributeLangSupport::C, and ClassTemplateDecl().

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

Definition at line 397 of file DeclTemplate.cpp.

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

Referenced by clang::Sema::ActOnClassTemplateSpecialization(), and clang::TemplateDeclInstantiator::InstantiateClassTemplatePartialSpecialization().

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 431 of file DeclTemplate.cpp.

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

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 447 of file DeclTemplate.cpp.

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

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

Definition at line 386 of file DeclTemplate.cpp.

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

Referenced by clang::Sema::ActOnClassTemplateSpecialization(), clang::Sema::ActOnExplicitInstantiation(), and clang::ASTNodeImporter::VisitClassTemplateSpecializationDecl().

Common* clang::ClassTemplateDecl::getCommonPtr ( ) const [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 1966 of file DeclTemplate.h.

References clang::RedeclarableTemplateDecl::getCommonPtr().

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

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 462 of file DeclTemplate.cpp.

References Context, GenerateInjectedTemplateArgs(), clang::Decl::getASTContext(), getCommonPtr(), clang::TemplateDecl::getTemplateParameters(), clang::ASTContext::getTemplateSpecializationType(), clang::ClassTemplateDecl::Common::InjectedClassNameType, and clang::QualType::isNull().

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

Returns the most recent (re)declaration of this declaration.

Reimplemented from clang::Redeclarable< RedeclarableTemplateDecl >.

Definition at line 2029 of file DeclTemplate.h.

Referenced by LoadLazySpecializations().

Returns the most recent (re)declaration of this declaration.

Reimplemented from clang::Redeclarable< RedeclarableTemplateDecl >.

Definition at line 2033 of file DeclTemplate.h.

Retrieve the partial specializations as an ordered list.

Definition at line 418 of file DeclTemplate.cpp.

References clang::NamedDecl::getMostRecentDecl(), getPartialSpecializations(), and P.

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

Reimplemented from clang::Redeclarable< RedeclarableTemplateDecl >.

Definition at line 2016 of file DeclTemplate.h.

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

Reimplemented from clang::Redeclarable< RedeclarableTemplateDecl >.

Definition at line 2023 of file DeclTemplate.h.

llvm::FoldingSetVector< ClassTemplateSpecializationDecl > & ClassTemplateDecl::getSpecializations ( ) const [protected]

Retrieve the set of specializations of this class template.

Definition at line 367 of file DeclTemplate.cpp.

References getCommonPtr(), LoadLazySpecializations(), and clang::ClassTemplateDecl::Common::Specializations.

Referenced by AddSpecialization(), and findSpecialization().

Returns whether this template declaration defines the primary class pattern.

Definition at line 1981 of file DeclTemplate.h.

RedeclarableTemplateDecl::CommonBase * ClassTemplateDecl::newCommon ( ASTContext C) const [override, protected, virtual]

Definition at line 2101 of file DeclTemplate.h.

Definition at line 2105 of file DeclTemplate.h.

Definition at line 2097 of file DeclTemplate.h.


Friends And Related Function Documentation

friend class ASTDeclReader [friend]

Reimplemented from clang::RedeclarableTemplateDecl.

Definition at line 2113 of file DeclTemplate.h.

friend class ASTDeclWriter [friend]

Reimplemented from clang::RedeclarableTemplateDecl.

Definition at line 2114 of file DeclTemplate.h.


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