clang API Documentation
Declaration of a class template. More...
#include <DeclTemplate.h>
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 | |
CXXRecordDecl * | getTemplatedDecl () const |
Get the underlying class declarations of the template. | |
bool | isThisDeclarationADefinition () const |
Returns whether this template declaration defines the primary class pattern. | |
ClassTemplateSpecializationDecl * | findSpecialization (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. InsertPos must be obtained from findSpecialization. | |
ClassTemplateDecl * | getCanonicalDecl () override |
Retrieves the canonical declaration of this template. | |
const ClassTemplateDecl * | getCanonicalDecl () const |
ClassTemplateDecl * | getPreviousDecl () |
Retrieve the previous declaration of this class template, or NULL if no such declaration exists. | |
const ClassTemplateDecl * | getPreviousDecl () const |
Retrieve the previous declaration of this class template, or NULL if no such declaration exists. | |
ClassTemplateDecl * | getMostRecentDecl () |
Returns the most recent (re)declaration of this declaration. | |
const ClassTemplateDecl * | getMostRecentDecl () const |
Returns the most recent (re)declaration of this declaration. | |
ClassTemplateDecl * | getInstantiatedFromMemberTemplate () |
ClassTemplatePartialSpecializationDecl * | findPartialSpecialization (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. InsertPos must be obtained from findPartialSpecialization. | |
void | getPartialSpecializations (SmallVectorImpl< ClassTemplatePartialSpecializationDecl * > &PS) |
Retrieve the partial specializations as an ordered list. | |
ClassTemplatePartialSpecializationDecl * | findPartialSpecialization (QualType T) |
Find a class template partial specialization with the given type T. | |
ClassTemplatePartialSpecializationDecl * | findPartialSpecInstantiatedFromMember (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 ClassTemplateDecl * | Create (ASTContext &C, DeclContext *DC, SourceLocation L, DeclarationName Name, TemplateParameterList *Params, NamedDecl *Decl, ClassTemplateDecl *PrevDecl) |
Create a class template node. | |
static ClassTemplateDecl * | CreateDeserialized (ASTContext &C, unsigned ID) |
Create an empty class template node. | |
static bool | classof (const Decl *D) |
static bool | classofKind (Kind K) |
Protected Member Functions | |
void | LoadLazySpecializations () const |
Load any lazily-loaded specializations from the external source. | |
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) | |
CommonBase * | newCommon (ASTContext &C) const override |
Common * | 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. | |
Friends | |
class | ASTDeclReader |
class | ASTDeclWriter |
Declaration of a class template.
Definition at line 1801 of file DeclTemplate.h.
Definition at line 1974 of file DeclTemplate.h.
typedef llvm::iterator_range<spec_iterator> clang::ClassTemplateDecl::spec_range |
Definition at line 1975 of file DeclTemplate.h.
clang::ClassTemplateDecl::ClassTemplateDecl | ( | ASTContext & | C, |
DeclContext * | DC, | ||
SourceLocation | L, | ||
DeclarationName | Name, | ||
TemplateParameterList * | Params, | ||
NamedDecl * | Decl | ||
) | [inline, protected] |
Definition at line 1842 of file DeclTemplate.h.
Referenced by Create(), and CreateDeserialized().
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 378 of file DeclTemplate.cpp.
References clang::Decl::getASTMutationListener(), getPartialSpecializations(), and clang::Decl::isCanonicalDecl().
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 358 of file DeclTemplate.cpp.
References clang::Decl::getASTMutationListener(), getSpecializations(), and clang::Decl::isCanonicalDecl().
static bool clang::ClassTemplateDecl::classof | ( | const Decl * | D | ) | [inline, static] |
Reimplemented from clang::RedeclarableTemplateDecl.
Definition at line 1990 of file DeclTemplate.h.
References classofKind(), and clang::Decl::getKind().
static bool clang::ClassTemplateDecl::classofKind | ( | Kind | K | ) | [inline, static] |
Reimplemented from clang::RedeclarableTemplateDecl.
Definition at line 1991 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] |
Create a class template node.
Definition at line 302 of file DeclTemplate.cpp.
References AdoptTemplateParameterList(), AttributeLangSupport::C, ClassTemplateDecl(), and clang::Redeclarable< decl_type >::setPreviousDecl().
Referenced by clang::Sema::CheckClassTemplate(), and clang::ASTNodeImporter::VisitClassTemplateDecl().
ClassTemplateDecl * ClassTemplateDecl::CreateDeserialized | ( | ASTContext & | C, |
unsigned | ID | ||
) | [static] |
Create an empty class template node.
Definition at line 316 of file DeclTemplate.cpp.
References AttributeLangSupport::C, and ClassTemplateDecl().
ClassTemplatePartialSpecializationDecl * ClassTemplateDecl::findPartialSpecialization | ( | ArrayRef< TemplateArgument > | Args, |
void *& | InsertPos | ||
) |
Return the partial specialization with the provided arguments if it exists, otherwise return the insertion point.
Definition at line 373 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.
T | a dependent type that names a specialization of this class template. |
T
, or NULL if no such partial specialization exists. Definition at line 407 of file DeclTemplate.cpp.
References Context, 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.
D | a member class template partial specialization. |
Definition at line 423 of file DeclTemplate.cpp.
References clang::CXXRecordDecl::getCanonicalDecl(), getPartialSpecializations(), and P.
ClassTemplateSpecializationDecl * ClassTemplateDecl::findSpecialization | ( | ArrayRef< TemplateArgument > | Args, |
void *& | InsertPos | ||
) |
Return the specialization with the provided arguments if it exists, otherwise return the insertion point.
Definition at line 353 of file DeclTemplate.cpp.
References clang::RedeclarableTemplateDecl::findSpecializationImpl(), and getSpecializations().
Referenced by clang::Sema::ActOnClassTemplateSpecialization(), clang::Sema::ActOnExplicitInstantiation(), and clang::ASTNodeImporter::VisitClassTemplateSpecializationDecl().
ClassTemplateDecl* clang::ClassTemplateDecl::getCanonicalDecl | ( | ) | [inline, override, virtual] |
Retrieves the canonical declaration of this template.
Reimplemented from clang::RedeclarableTemplateDecl.
Definition at line 1885 of file DeclTemplate.h.
Referenced by clang::ASTWriter::AddedCXXTemplateSpecialization(), clang::Sema::FindInstantiatedDecl(), getCanonicalDecl(), isInstantiationOf(), MatchesFriend(), and clang::ASTDeclWriter::VisitClassTemplateSpecializationDecl().
const ClassTemplateDecl* clang::ClassTemplateDecl::getCanonicalDecl | ( | ) | const [inline] |
Reimplemented from clang::RedeclarableTemplateDecl.
Definition at line 1889 of file DeclTemplate.h.
References getCanonicalDecl().
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 1849 of file DeclTemplate.h.
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 438 of file DeclTemplate.cpp.
References Context, GenerateInjectedTemplateArgs(), clang::Decl::getASTContext(), getCommonPtr(), clang::TemplateDecl::getTemplateParameters(), clang::ASTContext::getTemplateSpecializationType(), clang::ClassTemplateDecl::Common::InjectedClassNameType, clang::QualType::isNull(), and clang::TemplateParameterList::size().
Referenced by clang::Sema::ActOnClassTemplateSpecialization(), clang::Sema::CheckClassTemplate(), and clang::ASTDeclReader::VisitClassTemplateDecl().
Definition at line 1917 of file DeclTemplate.h.
Referenced by clang::Sema::CheckClassTemplate(), clang::Sema::InstantiateClassTemplateSpecialization(), and isInstantiationOf().
ClassTemplateDecl* clang::ClassTemplateDecl::getMostRecentDecl | ( | ) | [inline] |
Returns the most recent (re)declaration of this declaration.
Reimplemented from clang::Redeclarable< RedeclarableTemplateDecl >.
Definition at line 1909 of file DeclTemplate.h.
Referenced by getMostRecentDecl().
const ClassTemplateDecl* clang::ClassTemplateDecl::getMostRecentDecl | ( | ) | const [inline] |
Returns the most recent (re)declaration of this declaration.
Reimplemented from clang::Redeclarable< RedeclarableTemplateDecl >.
Definition at line 1913 of file DeclTemplate.h.
References getMostRecentDecl().
llvm::FoldingSetVector< ClassTemplatePartialSpecializationDecl > & ClassTemplateDecl::getPartialSpecializations | ( | ) | [protected] |
Retrieve the set of partial specializations of this class template.
Definition at line 340 of file DeclTemplate.cpp.
References getCommonPtr(), LoadLazySpecializations(), and clang::ClassTemplateDecl::Common::PartialSpecializations.
Referenced by AddPartialSpecialization(), findPartialSpecialization(), findPartialSpecInstantiatedFromMember(), getPartialSpecializations(), clang::Sema::InstantiateClassTemplateSpecialization(), and clang::ASTDeclWriter::VisitClassTemplateDecl().
void ClassTemplateDecl::getPartialSpecializations | ( | SmallVectorImpl< ClassTemplatePartialSpecializationDecl * > & | PS | ) |
Retrieve the partial specializations as an ordered list.
Definition at line 394 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 1896 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 1903 of file DeclTemplate.h.
References getPreviousDecl().
llvm::FoldingSetVector< ClassTemplateSpecializationDecl > & ClassTemplateDecl::getSpecializations | ( | ) | const [protected] |
Retrieve the set of specializations of this class template.
Definition at line 334 of file DeclTemplate.cpp.
References getCommonPtr(), LoadLazySpecializations(), and clang::ClassTemplateDecl::Common::Specializations.
Referenced by AddSpecialization(), findSpecialization(), spec_begin(), spec_end(), and clang::ASTDeclWriter::VisitClassTemplateDecl().
CXXRecordDecl* clang::ClassTemplateDecl::getTemplatedDecl | ( | ) | const [inline] |
Get the underlying class declarations of the template.
Reimplemented from clang::TemplateDecl.
Definition at line 1855 of file DeclTemplate.h.
References clang::TemplateDecl::TemplatedDecl.
Referenced by clang::Sema::ActOnClassTemplateSpecialization(), clang::Sema::ActOnExplicitInstantiation(), clang::Sema::CheckClassTemplate(), getLVForClassMember(), clang::Sema::InstantiateClassTemplateSpecialization(), clang::Sema::isStdInitializerList(), IsStructurallyEquivalent(), isThisDeclarationADefinition(), propagateDLLAttrToBaseClassTemplate(), clang::ASTNodeImporter::VisitClassTemplateDecl(), clang::ASTDeclReader::VisitClassTemplateDecl(), and clang::ASTDeclReader::VisitCXXRecordDeclImpl().
bool clang::ClassTemplateDecl::isThisDeclarationADefinition | ( | ) | const [inline] |
Returns whether this template declaration defines the primary class pattern.
Definition at line 1861 of file DeclTemplate.h.
References getTemplatedDecl(), and clang::TagDecl::isThisDeclarationADefinition().
void ClassTemplateDecl::LoadLazySpecializations | ( | ) | const [protected] |
Load any lazily-loaded specializations from the external source.
Definition at line 322 of file DeclTemplate.cpp.
References Context, clang::Decl::getASTContext(), getCommonPtr(), clang::ExternalASTSource::GetExternalDecl(), clang::ASTContext::getExternalSource(), and clang::ClassTemplateDecl::Common::LazySpecializations.
Referenced by getPartialSpecializations(), and getSpecializations().
RedeclarableTemplateDecl::CommonBase * ClassTemplateDecl::newCommon | ( | ASTContext & | C | ) | const [override, protected, virtual] |
Implements clang::RedeclarableTemplateDecl.
Definition at line 346 of file DeclTemplate.cpp.
References clang::ASTContext::AddDeallocation(), and AttributeLangSupport::C.
spec_iterator clang::ClassTemplateDecl::spec_begin | ( | ) | const [inline] |
Definition at line 1981 of file DeclTemplate.h.
References getSpecializations(), and clang::RedeclarableTemplateDecl::makeSpecIterator().
Referenced by specializations().
spec_iterator clang::ClassTemplateDecl::spec_end | ( | ) | const [inline] |
Definition at line 1985 of file DeclTemplate.h.
References getSpecializations(), and clang::RedeclarableTemplateDecl::makeSpecIterator().
Referenced by specializations().
spec_range clang::ClassTemplateDecl::specializations | ( | ) | const [inline] |
Definition at line 1977 of file DeclTemplate.h.
References spec_begin(), and spec_end().
friend class ASTDeclReader [friend] |
Reimplemented from clang::RedeclarableTemplateDecl.
Definition at line 1993 of file DeclTemplate.h.
friend class ASTDeclWriter [friend] |
Reimplemented from clang::RedeclarableTemplateDecl.
Definition at line 1994 of file DeclTemplate.h.