clang 19.0.0git
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Protected Member Functions | Friends | List of all members
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:
Inheritance graph
[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< const Expr * > &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
 
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 71 of file DeclTemplate.h.

Member Typedef Documentation

◆ const_iterator

Iterates through the template parameters in this list.

Definition at line 129 of file DeclTemplate.h.

◆ iterator

Iterates through the template parameters in this list.

Definition at line 126 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

Member Function Documentation

◆ asArray() [1/2]

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

◆ asArray() [2/2]

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

Definition at line 140 of file DeclTemplate.h.

References begin(), and size().

◆ begin() [1/2]

iterator clang::TemplateParameterList::begin ( )
inline

◆ begin() [2/2]

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

Definition at line 132 of file DeclTemplate.h.

◆ containsUnexpandedParameterPack()

bool clang::TemplateParameterList::containsUnexpandedParameterPack ( ) const

Determine whether this template parameter list contains an unexpanded parameter pack.

Referenced by clang::concepts::ExprRequirement::ReturnTypeRequirement::containsUnexpandedParameterPack(), and clang::TemplateTemplateParmDecl::isPackExpansion().

◆ Create()

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

◆ empty()

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

◆ end() [1/2]

iterator clang::TemplateParameterList::end ( )
inline

◆ end() [2/2]

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

Definition at line 134 of file DeclTemplate.h.

References begin().

◆ getAssociatedConstraints()

void clang::TemplateParameterList::getAssociatedConstraints ( llvm::SmallVectorImpl< const Expr * > &  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(), clang::TemplateDecl::getAssociatedConstraints(), clang::ClassTemplatePartialSpecializationDecl::getAssociatedConstraints(), and clang::VarTemplatePartialSpecializationDecl::getAssociatedConstraints().

◆ getDepth()

unsigned clang::TemplateParameterList::getDepth ( ) const

◆ getLAngleLoc()

SourceLocation clang::TemplateParameterList::getLAngleLoc ( ) const
inline

◆ 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 clang::Sema::CheckTypeConstraint(), clang::Sema::isStdInitializerList(), and LookupStdInitializerList().

◆ getParam() [1/2]

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

Definition at line 144 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::CheckTemplatePartialSpecializationArgs(), checkTupleLikeDecomposition(), clang::PredefinedExpr::ComputeName(), ConvertDeducedTemplateArguments(), DeduceTemplateArgumentsByTypeMatch(), clang::ODRDiagsEmitter::diagnoseMismatch(), DiagnoseUnexpandedParameterPacks(), FinishTemplateArgumentDeduction(), CXXNameMangler::TemplateArgManglingInfo::getArgInfo(), clang::CodeCompleteConsumer::OverloadCandidate::getParamDecl(), clang::comments::TParamCommandComment::getParamName(), clang::CodeCompleteConsumer::OverloadCandidate::getParamType(), clang::Sema::getTemplateArgumentBindingsText(), handleSYCLKernelAttr(), clang::FunctionTemplateDecl::isAbbreviated(), isSameAsPrimaryTemplate(), clang::ASTContext::isSameTemplateParameterList(), clang::Sema::isStdInitializerList(), IsStructurallyEquivalent(), clang::Sema::LookupLiteralOperator(), LookupStdInitializerList(), 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 148 of file DeclTemplate.h.

References begin(), and size().

◆ getRAngleLoc()

SourceLocation clang::TemplateParameterList::getRAngleLoc ( ) const
inline

◆ getRequiresClause() [1/2]

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

◆ getRequiresClause() [2/2]

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

The constraint-expression of the associated requires-clause.

Definition at line 185 of file DeclTemplate.h.

◆ getSourceRange()

SourceRange clang::TemplateParameterList::getSourceRange ( ) const
inline

◆ getTemplateLoc()

SourceLocation clang::TemplateParameterList::getTemplateLoc ( ) const
inline

◆ 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 172 of file DeclTemplate.h.

References asArray(), and P.

Referenced by argMatchesTemplateParams().

◆ numTrailingObjects() [1/2]

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

Definition at line 107 of file DeclTemplate.h.

◆ numTrailingObjects() [2/2]

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

Definition at line 103 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()

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

◆ size()

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

Definition at line 136 of file DeclTemplate.h.

Referenced by clang::Sema::ActOnClassTemplateSpecialization(), clang::Sema::ActOnConceptDefinition(), clang::Sema::ActOnCXXMemberDeclarator(), clang::Sema::ActOnFunctionDeclarator(), 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::CheckTemplatePartialSpecializationArgs(), checkTupleLikeDecomposition(), clang::PredefinedExpr::ComputeName(), ConvertDeducedTemplateArguments(), clang::Sema::DeduceTemplateArguments(), DependsOnTemplateParameters(), clang::ODRDiagsEmitter::diagnoseMismatch(), DiagnoseTemplateParameterListArityMismatch(), DiagnoseUnexpandedParameterPacks(), clang::Sema::FindInstantiatedDecl(), FinishTemplateArgumentDeduction(), clang::RedeclarableTemplateDecl::getInjectedTemplateArgs(), clang::ASTContext::getInjectedTemplateArgs(), getMoreSpecialized(), clang::Sema::getMoreSpecializedTemplate(), getParam(), clang::Sema::getTemplateArgumentBindingsText(), handleSYCLKernelAttr(), hasDeducibleTemplateParameters(), clang::ASTNodeImporter::import(), clang::FunctionTemplateDecl::isAbbreviated(), isAtLeastAsSpecializedAs(), isSameAsPrimaryTemplate(), clang::ASTContext::isSameTemplateParameterList(), IsStructurallyEquivalent(), 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().

Friends And Related Function Documentation

◆ FixedSizeTemplateParameterListStorage

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

Definition at line 113 of file DeclTemplate.h.

Member Data Documentation

◆ TrailingObjects

friend clang::TemplateParameterList::TrailingObjects

Definition at line 114 of file DeclTemplate.h.


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