clang  14.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]
Collaboration diagram for clang::TemplateParameterList:
Collaboration graph
[legend]

Public Types

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

Public Member Functions

iterator begin ()
 
const_iterator begin () const
 
iterator end ()
 
const_iterator end () const
 
unsigned size () 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. More...
 
unsigned getDepth () const
 Get the depth of this template parameter list in the set of template parameter lists. More...
 
bool containsUnexpandedParameterPack () const
 Determine whether this template parameter list contains an unexpanded parameter pack. More...
 
bool hasParameterPack () const
 Determine whether this template parameter list contains a parameter pack. More...
 
ExprgetRequiresClause ()
 The constraint-expression of the associated requires-clause. More...
 
const ExprgetRequiresClause () const
 The constraint-expression of the associated requires-clause. More...
 
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. More...
 
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 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 69 of file DeclTemplate.h.

Member Typedef Documentation

◆ const_iterator

Iterates through the template parameters in this list.

Definition at line 122 of file DeclTemplate.h.

◆ iterator

Iterates through the template parameters in this list.

Definition at line 119 of file DeclTemplate.h.

Constructor & Destructor Documentation

◆ TemplateParameterList()

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

Definition at line 47 of file DeclTemplate.cpp.

References begin(), clang::Expr::containsUnexpandedParameterPack(), and P.

Referenced by Create().

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 134 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 125 of file DeclTemplate.h.

◆ containsUnexpandedParameterPack()

bool TemplateParameterList::containsUnexpandedParameterPack ( ) const

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

Definition at line 93 of file DeclTemplate.cpp.

References asArray().

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

◆ Create()

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

◆ end() [1/2]

iterator clang::TemplateParameterList::end ( )
inline

◆ end() [2/2]

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

Definition at line 127 of file DeclTemplate.h.

References begin().

◆ getAssociatedConstraints()

void 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").

Definition at line 185 of file DeclTemplate.cpp.

References getRequiresClause().

Referenced by clang::TemplateDecl::getAssociatedConstraints(), clang::ClassTemplatePartialSpecializationDecl::getAssociatedConstraints(), and clang::VarTemplatePartialSpecializationDecl::getAssociatedConstraints().

◆ getDepth()

unsigned TemplateParameterList::getDepth ( ) const

Get the depth of this template parameter list in the set of template parameter lists.

The first template parameter list in a declaration will have depth 0, the second template parameter list will have depth 1, etc.

Definition at line 155 of file DeclTemplate.cpp.

References getParam(), and size().

Referenced by clang::Sema::ActOnStartFunctionDeclarationDeclarator(), isSameAsPrimaryTemplate(), clang::Sema::isTemplateTemplateParameterAtLeastAsSpecializedAs(), and clang::Sema::MarkDeducedTemplateParameters().

◆ getLAngleLoc()

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

◆ getMinRequiredArguments()

unsigned 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.

Definition at line 129 of file DeclTemplate.cpp.

References asArray(), clang::getExpandedPackSize(), and P.

Referenced by clang::Sema::BuildTypeConstraint(), and clang::Sema::isStdInitializerList().

◆ getParam() [1/2]

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

◆ getParam() [2/2]

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

Definition at line 142 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 179 of file DeclTemplate.h.

◆ getSourceRange()

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

◆ getTemplateLoc()

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

◆ hasAssociatedConstraints()

bool TemplateParameterList::hasAssociatedConstraints ( ) const

◆ hasParameterPack()

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

Determine whether this template parameter list contains a parameter pack.

Definition at line 166 of file DeclTemplate.h.

References asArray(), and P.

◆ numTrailingObjects() [1/2]

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

Definition at line 102 of file DeclTemplate.h.

◆ numTrailingObjects() [2/2]

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

Definition at line 98 of file DeclTemplate.h.

◆ print() [1/2]

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

Definition at line 138 of file DeclPrinter.cpp.

References clang::ASTContext::getPrintingPolicy().

◆ print() [2/2]

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

Definition at line 143 of file DeclPrinter.cpp.

◆ shouldIncludeTypeForArgument()

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

Definition at line 204 of file DeclTemplate.cpp.

References getParam(), and size().

Referenced by clang::Sema::getTemplateArgumentBindingsText(), and printTemplateArgs().

◆ size()

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

Friends And Related Function Documentation

◆ FixedSizeTemplateParameterListStorage

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

Definition at line 108 of file DeclTemplate.h.

Member Data Documentation

◆ TrailingObjects

friend clang::TemplateParameterList::TrailingObjects

Definition at line 109 of file DeclTemplate.h.


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