clang API Documentation

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

Declaration of a template function. More...

#include <DeclTemplate.h>

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

List of all members.

Classes

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

Public Types

typedef SpecIterator
< FunctionTemplateSpecializationInfo
spec_iterator
typedef llvm::iterator_range
< spec_iterator
spec_range

Public Member Functions

FunctionDeclgetTemplatedDecl () const
 Get the underlying function declaration of the template.
bool isThisDeclarationADefinition () const
FunctionDeclfindSpecialization (ArrayRef< TemplateArgument > Args, void *&InsertPos)
 Return the specialization with the provided arguments if it exists, otherwise return the insertion point.
FunctionTemplateDeclgetCanonicalDecl () override
 Retrieves the canonical declaration of this template.
const FunctionTemplateDeclgetCanonicalDecl () const
FunctionTemplateDeclgetPreviousDecl ()
 Retrieve the previous declaration of this function template, or NULL if no such declaration exists.
const FunctionTemplateDeclgetPreviousDecl () const
 Retrieve the previous declaration of this function template, or NULL if no such declaration exists.
FunctionTemplateDeclgetInstantiatedFromMemberTemplate ()
spec_range specializations () const
spec_iterator spec_begin () const
spec_iterator spec_end () const
ArrayRef< TemplateArgumentgetInjectedTemplateArgs ()
 Retrieve the "injected" template arguments that correspond to the template parameters of this function template.

Static Public Member Functions

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

Protected Member Functions

 FunctionTemplateDecl (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. Calling this routine may implicitly allocate memory for the common pointer.
void LoadLazySpecializations () const
 Load any lazily-loaded specializations from the external source.
llvm::FoldingSetVector
< FunctionTemplateSpecializationInfo > & 
getSpecializations () const
 Retrieve the set of function template specializations of this function template.
void addSpecialization (FunctionTemplateSpecializationInfo *Info, void *InsertPos)
 Add a specialization of this function template.

Friends

class FunctionDecl
class ASTDeclReader
class ASTDeclWriter

Detailed Description

Declaration of a template function.

Definition at line 747 of file DeclTemplate.h.


Member Typedef Documentation

Definition at line 851 of file DeclTemplate.h.

Definition at line 852 of file DeclTemplate.h.


Constructor & Destructor Documentation

Definition at line 777 of file DeclTemplate.h.

Referenced by Create(), and CreateDeserialized().


Member Function Documentation

void FunctionTemplateDecl::addSpecialization ( FunctionTemplateSpecializationInfo Info,
void *  InsertPos 
) [protected]

Add a specialization of this function template.

Parameters:
InsertPosInsert position in the FoldingSetVector, must have been retrieved by an earlier call to findSpecialization().

Definition at line 271 of file DeclTemplate.cpp.

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

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

Reimplemented from clang::RedeclarableTemplateDecl.

Definition at line 885 of file DeclTemplate.h.

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

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

Reimplemented from clang::RedeclarableTemplateDecl.

Definition at line 886 of file DeclTemplate.h.

Referenced by classof().

Create an empty function template node.

Definition at line 235 of file DeclTemplate.cpp.

References AttributeLangSupport::C, and FunctionTemplateDecl().

FunctionDecl * FunctionTemplateDecl::findSpecialization ( ArrayRef< TemplateArgument Args,
void *&  InsertPos 
)

Reimplemented from clang::RedeclarableTemplateDecl.

Definition at line 827 of file DeclTemplate.h.

References getCanonicalDecl().

Common* clang::FunctionTemplateDecl::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 785 of file DeclTemplate.h.

Referenced by getInjectedTemplateArgs(), getSpecializations(), LoadLazySpecializations(), clang::ASTDeclReader::VisitFunctionDecl(), and clang::ASTDeclReader::VisitFunctionTemplateDecl().

Retrieve the "injected" template arguments that correspond to the template parameters of this function template.

Although the C++ standard has no notion of the "injected" template arguments for a function template, the notion is convenient when we need to perform substitutions inside the definition of a function template.

Definition at line 281 of file DeclTemplate.cpp.

References GenerateInjectedTemplateArgs(), clang::Decl::getASTContext(), getCommonPtr(), clang::TemplateDecl::getTemplateParameters(), clang::FunctionTemplateDecl::Common::InjectedArgs, and clang::TemplateParameterList::size().

Definition at line 846 of file DeclTemplate.h.

Referenced by clang::Sema::CheckFunctionDeclaration(), and isInstantiationOf().

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

Reimplemented from clang::Redeclarable< RedeclarableTemplateDecl >.

Definition at line 834 of file DeclTemplate.h.

Referenced by clang::Sema::ActOnFunctionDeclarator(), and getPreviousDecl().

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

Reimplemented from clang::Redeclarable< RedeclarableTemplateDecl >.

Definition at line 841 of file DeclTemplate.h.

References getPreviousDecl().

llvm::FoldingSetVector< FunctionTemplateSpecializationInfo > & FunctionTemplateDecl::getSpecializations ( ) const [protected]

Retrieve the set of function template specializations of this function template.

Definition at line 260 of file DeclTemplate.cpp.

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

Referenced by addSpecialization(), findSpecialization(), spec_begin(), spec_end(), and clang::ASTDeclWriter::VisitFunctionTemplateDecl().

Returns whether this template declaration defines the primary pattern.

Definition at line 814 of file DeclTemplate.h.

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

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

Definition at line 854 of file DeclTemplate.h.

References spec_begin(), and spec_end().


Friends And Related Function Documentation

friend class ASTDeclReader [friend]

Reimplemented from clang::RedeclarableTemplateDecl.

Definition at line 888 of file DeclTemplate.h.

friend class ASTDeclWriter [friend]

Reimplemented from clang::RedeclarableTemplateDecl.

Definition at line 889 of file DeclTemplate.h.

friend class FunctionDecl [friend]

Definition at line 789 of file DeclTemplate.h.


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