clang 19.0.0git
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
clang::FunctionTemplateSpecializationInfo Class Referencefinal

Provides information about a function template specialization, which is a FunctionDecl that has been explicitly specialization or instantiated from a function template. More...

#include "clang/AST/DeclTemplate.h"

Inheritance diagram for clang::FunctionTemplateSpecializationInfo:
Inheritance graph
[legend]

Public Member Functions

FunctionDeclgetFunction () const
 Retrieve the declaration of the function template specialization.
 
FunctionTemplateDeclgetTemplate () const
 Retrieve the template from which this function was specialized.
 
TemplateSpecializationKind getTemplateSpecializationKind () const
 Determine what kind of template specialization this is.
 
bool isExplicitSpecialization () const
 
bool isExplicitInstantiationOrSpecialization () const
 True if this declaration is an explicit specialization, explicit instantiation declaration, or explicit instantiation definition.
 
void setTemplateSpecializationKind (TemplateSpecializationKind TSK)
 Set the template specialization kind.
 
SourceLocation getPointOfInstantiation () const
 Retrieve the first point of instantiation of this function template specialization.
 
void setPointOfInstantiation (SourceLocation POI)
 Set the (first) point of instantiation of this function template specialization.
 
MemberSpecializationInfogetMemberSpecializationInfo () const
 Get the specialization info if this function template specialization is also a member specialization:
 
void Profile (llvm::FoldingSetNodeID &ID)
 

Static Public Member Functions

static FunctionTemplateSpecializationInfoCreate (ASTContext &C, FunctionDecl *FD, FunctionTemplateDecl *Template, TemplateSpecializationKind TSK, const TemplateArgumentList *TemplateArgs, const TemplateArgumentListInfo *TemplateArgsAsWritten, SourceLocation POI, MemberSpecializationInfo *MSInfo)
 
static void Profile (llvm::FoldingSetNodeID &ID, ArrayRef< TemplateArgument > TemplateArgs, const ASTContext &Context)
 

Public Attributes

const TemplateArgumentListTemplateArguments
 The template arguments used to produce the function template specialization from the function template.
 
const ASTTemplateArgumentListInfoTemplateArgumentsAsWritten
 The template arguments as written in the sources, if provided.
 
SourceLocation PointOfInstantiation
 The point at which this function template specialization was first instantiated.
 
friend TrailingObjects
 

Detailed Description

Provides information about a function template specialization, which is a FunctionDecl that has been explicitly specialization or instantiated from a function template.

Definition at line 464 of file DeclTemplate.h.

Member Function Documentation

◆ Create()

FunctionTemplateSpecializationInfo * FunctionTemplateSpecializationInfo::Create ( ASTContext C,
FunctionDecl FD,
FunctionTemplateDecl Template,
TemplateSpecializationKind  TSK,
const TemplateArgumentList TemplateArgs,
const TemplateArgumentListInfo TemplateArgsAsWritten,
SourceLocation  POI,
MemberSpecializationInfo MSInfo 
)
static

◆ getFunction()

FunctionDecl * clang::FunctionTemplateSpecializationInfo::getFunction ( ) const
inline

Retrieve the declaration of the function template specialization.

Definition at line 520 of file DeclTemplate.h.

References clang::Function.

Referenced by clang::RedeclarableTemplateDecl::SpecEntryTraits< FunctionTemplateSpecializationInfo >::getDecl(), Profile(), and clang::ASTDeclReader::VisitFunctionDecl().

◆ getMemberSpecializationInfo()

MemberSpecializationInfo * clang::FunctionTemplateSpecializationInfo::getMemberSpecializationInfo ( ) const
inline

Get the specialization info if this function template specialization is also a member specialization:

template<typename> struct A {
template<typename> void f();
template<> void f<int>();
};

Here, A<int>::f<int> is a function template specialization that is an explicit specialization of A<int>::f, but it's also a member specialization (an implicit instantiation in this case) of A::f<int>. Further:

template<> template<> void A<int>::f<int>() {}

... declares a function template specialization that is an explicit specialization of A<int>::f, and is also an explicit member specialization of A::f<int>.

Note that the TemplateSpecializationKind of the MemberSpecializationInfo need not be the same as that returned by getTemplateSpecializationKind(), and represents the relationship between the function and the class-scope explicit specialization in the original templated class – whereas our TemplateSpecializationKind represents the relationship between the function and the function template, and should always be TSK_ExplicitSpecialization whenever we have MemberSpecializationInfo.

Definition at line 594 of file DeclTemplate.h.

Referenced by clang::ASTDeclWriter::VisitCXXMethodDecl(), and clang::ASTDeclWriter::VisitFunctionDecl().

◆ getPointOfInstantiation()

SourceLocation clang::FunctionTemplateSpecializationInfo::getPointOfInstantiation ( ) const
inline

Retrieve the first point of instantiation of this function template specialization.

The point of instantiation may be an invalid source location if this function has yet to be instantiated.

Definition at line 554 of file DeclTemplate.h.

References PointOfInstantiation.

Referenced by clang::Sema::CheckFunctionTemplateSpecialization(), and clang::ASTDeclWriter::VisitFunctionDecl().

◆ getTemplate()

FunctionTemplateDecl * clang::FunctionTemplateSpecializationInfo::getTemplate ( ) const
inline

Retrieve the template from which this function was specialized.

Definition at line 523 of file DeclTemplate.h.

Referenced by clang::Sema::ActOnFunctionDeclarator(), clang::PredefinedExpr::ComputeName(), and clang::ASTDeclWriter::VisitFunctionDecl().

◆ getTemplateSpecializationKind()

TemplateSpecializationKind clang::FunctionTemplateSpecializationInfo::getTemplateSpecializationKind ( ) const
inline

◆ isExplicitInstantiationOrSpecialization()

bool clang::FunctionTemplateSpecializationInfo::isExplicitInstantiationOrSpecialization ( ) const
inline

True if this declaration is an explicit specialization, explicit instantiation declaration, or explicit instantiation definition.

Definition at line 537 of file DeclTemplate.h.

References getTemplateSpecializationKind(), and clang::isTemplateExplicitInstantiationOrSpecialization().

Referenced by clang::Sema::ActOnStartOfFunctionDef(), and shouldConsiderTemplateVisibility().

◆ isExplicitSpecialization()

bool clang::FunctionTemplateSpecializationInfo::isExplicitSpecialization ( ) const
inline

◆ Profile() [1/2]

void clang::FunctionTemplateSpecializationInfo::Profile ( llvm::FoldingSetNodeID &  ID)
inline

◆ Profile() [2/2]

static void clang::FunctionTemplateSpecializationInfo::Profile ( llvm::FoldingSetNodeID &  ID,
ArrayRef< TemplateArgument TemplateArgs,
const ASTContext Context 
)
inlinestatic

Definition at line 605 of file DeclTemplate.h.

References ID, and clang::TemplateArg.

◆ setPointOfInstantiation()

void clang::FunctionTemplateSpecializationInfo::setPointOfInstantiation ( SourceLocation  POI)
inline

Set the (first) point of instantiation of this function template specialization.

Definition at line 560 of file DeclTemplate.h.

References PointOfInstantiation.

◆ setTemplateSpecializationKind()

void clang::FunctionTemplateSpecializationInfo::setTemplateSpecializationKind ( TemplateSpecializationKind  TSK)
inline

Set the template specialization kind.

Definition at line 543 of file DeclTemplate.h.

References clang::TSK_Undeclared.

Referenced by clang::Sema::CheckFunctionTemplateSpecialization().

Member Data Documentation

◆ PointOfInstantiation

SourceLocation clang::FunctionTemplateSpecializationInfo::PointOfInstantiation

The point at which this function template specialization was first instantiated.

Definition at line 489 of file DeclTemplate.h.

Referenced by getPointOfInstantiation(), and setPointOfInstantiation().

◆ TemplateArguments

const TemplateArgumentList* clang::FunctionTemplateSpecializationInfo::TemplateArguments

◆ TemplateArgumentsAsWritten

const ASTTemplateArgumentListInfo* clang::FunctionTemplateSpecializationInfo::TemplateArgumentsAsWritten

The template arguments as written in the sources, if provided.

FIXME: Normally null; tail-allocate this.

Definition at line 485 of file DeclTemplate.h.

Referenced by clang::ASTDeclWriter::VisitCXXMethodDecl(), and clang::ASTDeclWriter::VisitFunctionDecl().

◆ TrailingObjects

friend clang::FunctionTemplateSpecializationInfo::TrailingObjects

Definition at line 510 of file DeclTemplate.h.


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