clang API Documentation
Declaration of a template function. More...
#include <DeclTemplate.h>
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 | |
FunctionDecl * | getTemplatedDecl () const |
Get the underlying function declaration of the template. | |
bool | isThisDeclarationADefinition () const |
FunctionDecl * | findSpecialization (ArrayRef< TemplateArgument > Args, void *&InsertPos) |
Return the specialization with the provided arguments if it exists, otherwise return the insertion point. | |
FunctionTemplateDecl * | getCanonicalDecl () override |
Retrieves the canonical declaration of this template. | |
const FunctionTemplateDecl * | getCanonicalDecl () const |
FunctionTemplateDecl * | getPreviousDecl () |
Retrieve the previous declaration of this function template, or NULL if no such declaration exists. | |
const FunctionTemplateDecl * | getPreviousDecl () const |
Retrieve the previous declaration of this function template, or NULL if no such declaration exists. | |
FunctionTemplateDecl * | getInstantiatedFromMemberTemplate () |
spec_range | specializations () const |
spec_iterator | spec_begin () const |
spec_iterator | spec_end () const |
ArrayRef< TemplateArgument > | getInjectedTemplateArgs () |
Retrieve the "injected" template arguments that correspond to the template parameters of this function template. | |
Static Public Member Functions | |
static FunctionTemplateDecl * | Create (ASTContext &C, DeclContext *DC, SourceLocation L, DeclarationName Name, TemplateParameterList *Params, NamedDecl *Decl) |
Create a function template node. | |
static FunctionTemplateDecl * | CreateDeserialized (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) | |
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. | |
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 |
Declaration of a template function.
Definition at line 747 of file DeclTemplate.h.
Definition at line 851 of file DeclTemplate.h.
typedef llvm::iterator_range<spec_iterator> clang::FunctionTemplateDecl::spec_range |
Definition at line 852 of file DeclTemplate.h.
clang::FunctionTemplateDecl::FunctionTemplateDecl | ( | ASTContext & | C, |
DeclContext * | DC, | ||
SourceLocation | L, | ||
DeclarationName | Name, | ||
TemplateParameterList * | Params, | ||
NamedDecl * | Decl | ||
) | [inline, protected] |
Definition at line 777 of file DeclTemplate.h.
Referenced by Create(), and CreateDeserialized().
void FunctionTemplateDecl::addSpecialization | ( | FunctionTemplateSpecializationInfo * | Info, |
void * | InsertPos | ||
) | [protected] |
Add a specialization of this function template.
InsertPos | Insert 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().
FunctionTemplateDecl * FunctionTemplateDecl::Create | ( | ASTContext & | C, |
DeclContext * | DC, | ||
SourceLocation | L, | ||
DeclarationName | Name, | ||
TemplateParameterList * | Params, | ||
NamedDecl * | Decl | ||
) | [static] |
Create a function template node.
Definition at line 225 of file DeclTemplate.cpp.
References AdoptTemplateParameterList(), AttributeLangSupport::C, and FunctionTemplateDecl().
Referenced by clang::Sema::ActOnFunctionDeclarator(), addFunctionPointerConversion(), clang::Sema::startLambdaDefinition(), clang::TemplateDeclInstantiator::VisitCXXMethodDecl(), and clang::TemplateDeclInstantiator::VisitFunctionDecl().
FunctionTemplateDecl * FunctionTemplateDecl::CreateDeserialized | ( | ASTContext & | C, |
unsigned | ID | ||
) | [static] |
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 | ||
) |
Return the specialization with the provided arguments if it exists, otherwise return the insertion point.
Definition at line 266 of file DeclTemplate.cpp.
References clang::RedeclarableTemplateDecl::findSpecializationImpl(), and getSpecializations().
Referenced by clang::Sema::DefineImplicitLambdaToFunctionPointerConversion(), clang::CodeGen::CodeGenFunction::EmitLambdaDelegatingInvokeBody(), clang::TemplateDeclInstantiator::VisitCXXMethodDecl(), and clang::TemplateDeclInstantiator::VisitFunctionDecl().
FunctionTemplateDecl* clang::FunctionTemplateDecl::getCanonicalDecl | ( | ) | [inline, override, virtual] |
Retrieves the canonical declaration of this template.
Reimplemented from clang::RedeclarableTemplateDecl.
Definition at line 823 of file DeclTemplate.h.
Referenced by clang::ASTWriter::AddedCXXTemplateSpecialization(), clang::Sema::FinishTemplateArgumentDeduction(), getCanonicalDecl(), isInstantiationOf(), MatchesFriend(), and clang::ASTDeclWriter::VisitFunctionDecl().
const FunctionTemplateDecl* clang::FunctionTemplateDecl::getCanonicalDecl | ( | ) | const [inline] |
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().
ArrayRef< TemplateArgument > FunctionTemplateDecl::getInjectedTemplateArgs | ( | ) |
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().
const FunctionTemplateDecl* clang::FunctionTemplateDecl::getPreviousDecl | ( | ) | const [inline] |
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().
FunctionDecl* clang::FunctionTemplateDecl::getTemplatedDecl | ( | ) | const [inline] |
Get the underlying function declaration of the template.
Reimplemented from clang::TemplateDecl.
Definition at line 808 of file DeclTemplate.h.
References clang::TemplateDecl::TemplatedDecl.
Referenced by clang::Sema::ActOnExplicitInstantiation(), clang::Sema::ActOnFunctionDeclarator(), clang::Sema::AddFunctionCandidates(), clang::Sema::AddMethodTemplateCandidate(), clang::Sema::AddTemplateConversionCandidate(), clang::Sema::AddTemplateOverloadCandidate(), clang::Sema::CheckFunctionDeclaration(), collectViableConversionCandidates(), clang::Sema::DeduceTemplateArguments(), clang::Sema::DiagnoseEmptyLookup(), clang::comments::DeclInfo::fill(), FindConversionForRefInit(), clang::Sema::FinishTemplateArgumentDeduction(), clang::FunctionDecl::getTemplateInstantiationPattern(), isAtLeastAsSpecializedAs(), IsInitializerListConstructorConversion(), clang::CXXMethodDecl::isLambdaStaticInvoker(), isThisDeclarationADefinition(), IsUserDefinedConversion(), isVariadicFunctionTemplate(), LookupCopyAndMoveConstructors(), LookupDirect(), clang::Sema::MarkDeducedTemplateParameters(), MightInstantiateTo(), clang::Sema::PerformContextualImplicitConversion(), ResolveConstructorOverload(), clang::Sema::ResolveSingleFunctionTemplateSpecialization(), clang::Sema::SubstituteExplicitTemplateArguments(), TryRefInitWithConversionFunction(), and TryUserDefinedConversion().
bool clang::FunctionTemplateDecl::isThisDeclarationADefinition | ( | ) | const [inline] |
Returns whether this template declaration defines the primary pattern.
Definition at line 814 of file DeclTemplate.h.
References getTemplatedDecl(), and clang::FunctionDecl::isThisDeclarationADefinition().
void FunctionTemplateDecl::LoadLazySpecializations | ( | ) | const [protected] |
Load any lazily-loaded specializations from the external source.
Definition at line 248 of file DeclTemplate.cpp.
References Context, clang::Decl::getASTContext(), getCommonPtr(), clang::ExternalASTSource::GetExternalDecl(), clang::ASTContext::getExternalSource(), and clang::FunctionTemplateDecl::Common::LazySpecializations.
Referenced by getSpecializations().
RedeclarableTemplateDecl::CommonBase * FunctionTemplateDecl::newCommon | ( | ASTContext & | C | ) | const [override, protected, virtual] |
Implements clang::RedeclarableTemplateDecl.
Definition at line 242 of file DeclTemplate.cpp.
References clang::ASTContext::AddDeallocation(), and AttributeLangSupport::C.
spec_iterator clang::FunctionTemplateDecl::spec_begin | ( | ) | const [inline] |
Definition at line 857 of file DeclTemplate.h.
References getSpecializations(), and clang::RedeclarableTemplateDecl::makeSpecIterator().
Referenced by specializations().
spec_iterator clang::FunctionTemplateDecl::spec_end | ( | ) | const [inline] |
Definition at line 861 of file DeclTemplate.h.
References getSpecializations(), and clang::RedeclarableTemplateDecl::makeSpecIterator().
Referenced by specializations().
spec_range clang::FunctionTemplateDecl::specializations | ( | ) | const [inline] |
Definition at line 854 of file DeclTemplate.h.
References spec_begin(), and spec_end().
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.