clang 22.0.0git
clang::TemplateParameterList Class Referencefinal

Stores a list of template parameters for a TemplateDecl and its derived classes. More...

#include "clang/AST/DeclTemplate.h"

Inheritance diagram for clang::TemplateParameterList:
[legend]

Public Types

using iterator = NamedDecl **
 Iterates through the template parameters in this list.
using const_iterator = NamedDecl * const *
 Iterates through the template parameters in this list.

Public Member Functions

void Profile (llvm::FoldingSetNodeID &ID, const ASTContext &C) const
iterator begin ()
const_iterator begin () const
iterator end ()
const_iterator end () const
unsigned size () const
bool empty () const
ArrayRef< NamedDecl * > asArray ()
ArrayRef< const NamedDecl * > asArray () const
NamedDeclgetParam (unsigned Idx)
const NamedDeclgetParam (unsigned Idx) const
unsigned getMinRequiredArguments () const
 Returns the minimum number of arguments needed to form a template specialization.
unsigned getDepth () const
 Get the depth of this template parameter list in the set of template parameter lists.
bool containsUnexpandedParameterPack () const
 Determine whether this template parameter list contains an unexpanded parameter pack.
bool hasParameterPack () const
 Determine whether this template parameter list contains a parameter pack.
ExprgetRequiresClause ()
 The constraint-expression of the associated requires-clause.
const ExprgetRequiresClause () const
 The constraint-expression of the associated requires-clause.
void getAssociatedConstraints (llvm::SmallVectorImpl< AssociatedConstraint > &AC) const
 All associated constraints derived from this template parameter list, including the requires clause and any constraints derived from constrained-parameters.
bool hasAssociatedConstraints () const
ArrayRef< TemplateArgumentgetInjectedTemplateArgs (const ASTContext &Context)
 Get the template argument list of the template parameter list.
SourceLocation getTemplateLoc () const
SourceLocation getLAngleLoc () const
SourceLocation getRAngleLoc () const
SourceRange getSourceRange () const LLVM_READONLY
void print (raw_ostream &Out, const ASTContext &Context, bool OmitTemplateKW=false) const
void print (raw_ostream &Out, const ASTContext &Context, const PrintingPolicy &Policy, bool OmitTemplateKW=false) const

Static Public Member Functions

static TemplateParameterListCreate (const ASTContext &C, SourceLocation TemplateLoc, SourceLocation LAngleLoc, ArrayRef< NamedDecl * > Params, SourceLocation RAngleLoc, Expr *RequiresClause)
static bool shouldIncludeTypeForArgument (const PrintingPolicy &Policy, const TemplateParameterList *TPL, unsigned Idx)

Public Attributes

friend TrailingObjects

Protected Member Functions

 TemplateParameterList (const ASTContext &C, SourceLocation TemplateLoc, SourceLocation LAngleLoc, ArrayRef< NamedDecl * > Params, SourceLocation RAngleLoc, Expr *RequiresClause)
size_t numTrailingObjects (OverloadToken< NamedDecl * >) const
size_t numTrailingObjects (OverloadToken< Expr * >) const

Friends

template<size_t N, bool HasRequiresClause>
class FixedSizeTemplateParameterListStorage

Detailed Description

Stores a list of template parameters for a TemplateDecl and its derived classes.

Definition at line 72 of file DeclTemplate.h.

Member Typedef Documentation

◆ const_iterator

Iterates through the template parameters in this list.

Definition at line 133 of file DeclTemplate.h.

◆ iterator

Iterates through the template parameters in this list.

Definition at line 130 of file DeclTemplate.h.

Constructor & Destructor Documentation

◆ TemplateParameterList()

clang::TemplateParameterList::TemplateParameterList ( const ASTContext & C,
SourceLocation TemplateLoc,
SourceLocation LAngleLoc,
ArrayRef< NamedDecl * > Params,
SourceLocation RAngleLoc,
Expr * RequiresClause )
protected

References clang::C.

Referenced by Create(), and shouldIncludeTypeForArgument().

Member Function Documentation

◆ asArray() [1/2]

◆ asArray() [2/2]

ArrayRef< const NamedDecl * > clang::TemplateParameterList::asArray ( ) const
inline

Definition at line 144 of file DeclTemplate.h.

References begin(), and size().

◆ begin() [1/2]

◆ begin() [2/2]

const_iterator clang::TemplateParameterList::begin ( ) const
inline

Definition at line 136 of file DeclTemplate.h.

◆ containsUnexpandedParameterPack()

bool clang::TemplateParameterList::containsUnexpandedParameterPack ( ) const

◆ Create()

◆ empty()

bool clang::TemplateParameterList::empty ( ) const
inline

◆ end() [1/2]

◆ end() [2/2]

const_iterator clang::TemplateParameterList::end ( ) const
inline

Definition at line 138 of file DeclTemplate.h.

References begin().

◆ getAssociatedConstraints()

void clang::TemplateParameterList::getAssociatedConstraints ( llvm::SmallVectorImpl< AssociatedConstraint > & AC) const

All associated constraints derived from this template parameter list, including the requires clause and any constraints derived from constrained-parameters.

The constraints in the resulting list are to be treated as if in a conjunction ("and").

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

◆ getDepth()

unsigned clang::TemplateParameterList::getDepth ( ) const

◆ getInjectedTemplateArgs()

ArrayRef< TemplateArgument > clang::TemplateParameterList::getInjectedTemplateArgs ( const ASTContext & Context)

◆ getLAngleLoc()

◆ getMinRequiredArguments()

unsigned clang::TemplateParameterList::getMinRequiredArguments ( ) const

Returns the minimum number of arguments needed to form a template specialization.

This may be fewer than the number of template parameters, if some of the parameters have default arguments or if there is a parameter pack.

Referenced by isStdClassTemplate(), and LookupStdClassTemplate().

◆ getParam() [1/2]

NamedDecl * clang::TemplateParameterList::getParam ( unsigned Idx)
inline

Definition at line 146 of file DeclTemplate.h.

References begin(), and size().

Referenced by clang::Sema::ActOnClassTemplateSpecialization(), clang::comments::Sema::actOnTParamCommandParamNameArg(), argMatchesTemplateParams(), clang::Sema::BuildExprRequirement(), checkCUDADeviceBuiltinSurfaceClassTemplate(), checkCUDADeviceBuiltinTextureClassTemplate(), checkLiteralOperatorTemplateParameterList(), clang::Sema::CheckTemplateDeclScope(), clang::Sema::CheckTemplatePartialSpecializationArgs(), checkTupleLikeDecomposition(), clang::PredefinedExpr::ComputeName(), clang::hlsl::TemplateParameterListBuilder::constructConceptSpecializationExpr(), ConvertDeducedTemplateArguments(), DeduceTemplateArgumentsByTypeMatch(), clang::ODRDiagsEmitter::diagnoseMismatch(), DiagnoseUnexpandedParameterPacks(), FinishTemplateArgumentDeduction(), FinishTemplateArgumentDeduction(), clang::CodeCompleteConsumer::OverloadCandidate::getParamDecl(), clang::comments::TParamCommandComment::getParamName(), clang::CodeCompleteConsumer::OverloadCandidate::getParamType(), clang::Sema::getTemplateArgumentBindingsText(), clang::SemaSYCL::handleKernelAttr(), clang::FunctionTemplateDecl::isAbbreviated(), isSameAsPrimaryTemplate(), clang::ASTContext::isSameTemplateParameterList(), isStdClassTemplate(), IsStructurallyEquivalent(), clang::Sema::isTemplateTemplateParameterAtLeastAsSpecializedAs(), clang::Sema::LookupLiteralOperator(), LookupStdClassTemplate(), noteNonDeducibleParameters(), clang::Sema::RebuildTemplateParamsInCurrentInstantiation(), clang::concepts::ExprRequirement::ReturnTypeRequirement::ReturnTypeRequirement(), clang::Sema::SubstituteExplicitTemplateArguments(), and clang::ASTNodeImporter::VisitFunctionTemplateDecl().

◆ getParam() [2/2]

const NamedDecl * clang::TemplateParameterList::getParam ( unsigned Idx) const
inline

Definition at line 150 of file DeclTemplate.h.

References begin(), and size().

◆ getRAngleLoc()

◆ getRequiresClause() [1/2]

◆ getRequiresClause() [2/2]

const Expr * clang::TemplateParameterList::getRequiresClause ( ) const
inline

The constraint-expression of the associated requires-clause.

Definition at line 187 of file DeclTemplate.h.

◆ getSourceRange()

◆ getTemplateLoc()

◆ hasAssociatedConstraints()

bool clang::TemplateParameterList::hasAssociatedConstraints ( ) const

◆ hasParameterPack()

bool clang::TemplateParameterList::hasParameterPack ( ) const
inline

Determine whether this template parameter list contains a parameter pack.

Definition at line 174 of file DeclTemplate.h.

References asArray().

Referenced by argMatchesTemplateParams().

◆ numTrailingObjects() [1/2]

size_t clang::TemplateParameterList::numTrailingObjects ( OverloadToken< Expr * > ) const
inlineprotected

Definition at line 111 of file DeclTemplate.h.

◆ numTrailingObjects() [2/2]

size_t clang::TemplateParameterList::numTrailingObjects ( OverloadToken< NamedDecl * > ) const
inlineprotected

Definition at line 107 of file DeclTemplate.h.

◆ print() [1/2]

void clang::TemplateParameterList::print ( raw_ostream & Out,
const ASTContext & Context,
bool OmitTemplateKW = false ) const

◆ print() [2/2]

void clang::TemplateParameterList::print ( raw_ostream & Out,
const ASTContext & Context,
const PrintingPolicy & Policy,
bool OmitTemplateKW = false ) const

◆ Profile()

void clang::TemplateParameterList::Profile ( llvm::FoldingSetNodeID & ID,
const ASTContext & C ) const

◆ shouldIncludeTypeForArgument()

bool clang::TemplateParameterList::shouldIncludeTypeForArgument ( const PrintingPolicy & Policy,
const TemplateParameterList * TPL,
unsigned Idx )
static

◆ size()

unsigned clang::TemplateParameterList::size ( ) const
inline

Definition at line 140 of file DeclTemplate.h.

Referenced by clang::Sema::ActOnClassTemplateSpecialization(), clang::Sema::ActOnFunctionDeclarator(), clang::Sema::ActOnStartConceptDefinition(), clang::Sema::ActOnStartFunctionDeclarationDeclarator(), clang::Sema::ActOnTag(), clang::Sema::ActOnTemplateTemplateParameter(), clang::comments::Sema::actOnTParamCommandParamNameArg(), clang::Sema::ActOnVariableDeclarator(), clang::ASTRecordWriter::AddTemplateParameterList(), clang::ODRHash::AddTemplateParameterList(), argMatchesTemplateParams(), asArray(), clang::Sema::CheckClassTemplate(), checkCUDADeviceBuiltinSurfaceClassTemplate(), checkCUDADeviceBuiltinTextureClassTemplate(), checkLiteralOperatorTemplateParameterList(), clang::Sema::CheckTemplateDeclScope(), clang::Sema::CheckTemplatePartialSpecializationArgs(), checkTupleLikeDecomposition(), clang::PredefinedExpr::ComputeName(), clang::hlsl::TemplateParameterListBuilder::constructConceptSpecializationExpr(), ConvertDeducedTemplateArguments(), clang::FriendTemplateDecl::Create(), clang::Sema::DeduceTemplateArguments(), clang::Sema::DeduceTemplateArguments(), clang::Sema::DeduceTemplateArguments(), clang::Sema::DeduceTemplateArgumentsFromType(), DependsOnTemplateParameters(), clang::ODRDiagsEmitter::diagnoseMismatch(), DiagnoseTemplateParameterListArityMismatch(), DiagnoseUnexpandedParameterPacks(), clang::Sema::FindInstantiatedDecl(), FinishTemplateArgumentDeduction(), clang::ASTContext::getCanonicalTemplateTemplateParmDecl(), getMoreSpecialized(), clang::Sema::getMoreSpecializedTemplate(), getParam(), getParam(), clang::Sema::getTemplateArgumentBindingsText(), clang::TemplateName::getTemplateDeclAndDefaultArgs(), clang::SemaSYCL::handleKernelAttr(), hasDeducibleTemplateParameters(), clang::ASTNodeImporter::import(), clang::FunctionTemplateDecl::isAbbreviated(), isAtLeastAsSpecializedAs(), isSameAsPrimaryTemplate(), clang::ASTContext::isSameTemplateParameterList(), IsStructurallyEquivalent(), clang::Sema::isTemplateTemplateParameterAtLeastAsSpecializedAs(), clang::TemplateTemplateParmDecl::isTypeConceptTemplateParam(), clang::Sema::LookupLiteralOperator(), clang::Sema::MarkDeducedTemplateParameters(), printTo(), clang::Sema::RebuildTemplateParamsInCurrentInstantiation(), ResolveOverloadForDeduction(), clang::concepts::ExprRequirement::ReturnTypeRequirement::ReturnTypeRequirement(), clang::Sema::SubstituteExplicitTemplateArguments(), substituteParameterMappings(), clang::TemplateDeclInstantiator::SubstTemplateParams(), clang::Sema::TemplateParameterListsAreEqual(), clang::TemplateDeclInstantiator::VisitCXXMethodDecl(), clang::TemplateDeclInstantiator::VisitFunctionDecl(), and clang::ASTNodeImporter::VisitFunctionTemplateDecl().

◆ FixedSizeTemplateParameterListStorage

template<size_t N, bool HasRequiresClause>
friend class FixedSizeTemplateParameterListStorage
friend

Member Data Documentation

◆ TrailingObjects

friend clang::TemplateParameterList::TrailingObjects

Definition at line 118 of file DeclTemplate.h.


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