clang
17.0.0git
|
Stores a list of template parameters for a TemplateDecl and its derived classes. More...
#include "clang/AST/DeclTemplate.h"
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 |
NamedDecl * | getParam (unsigned Idx) |
const NamedDecl * | getParam (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... | |
Expr * | getRequiresClause () |
The constraint-expression of the associated requires-clause. More... | |
const Expr * | getRequiresClause () 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 TemplateParameterList * | Create (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 |
Stores a list of template parameters for a TemplateDecl and its derived classes.
Definition at line 71 of file DeclTemplate.h.
using clang::TemplateParameterList::const_iterator = NamedDecl * const * |
Iterates through the template parameters in this list.
Definition at line 124 of file DeclTemplate.h.
using clang::TemplateParameterList::iterator = NamedDecl ** |
Iterates through the template parameters in this list.
Definition at line 121 of file DeclTemplate.h.
|
protected |
Definition at line 48 of file DeclTemplate.cpp.
References begin(), clang::Expr::containsUnexpandedParameterPack(), and P.
Referenced by Create().
Definition at line 133 of file DeclTemplate.h.
References begin(), and end().
Referenced by clang::ODRHash::AddTemplateParameterList(), containsUnexpandedParameterPack(), clang::ODRDiagsEmitter::diagnoseMismatch(), getMinRequiredArguments(), hasParameterPack(), clang::TemplateDeclInstantiator::VisitCXXMethodDecl(), and clang::TemplateDeclInstantiator::VisitFunctionDecl().
Definition at line 134 of file DeclTemplate.h.
|
inline |
Definition at line 126 of file DeclTemplate.h.
Referenced by AddTemplateParameterChunks(), asArray(), clang::Sema::CheckTemplateArgumentList(), clang::Sema::CheckTemplateParameterList(), end(), getParam(), TemplateParameterList(), and clang::Sema::TemplateParameterListsAreEqual().
|
inline |
Definition at line 127 of file DeclTemplate.h.
bool TemplateParameterList::containsUnexpandedParameterPack | ( | ) | const |
Determine whether this template parameter list contains an unexpanded parameter pack.
Definition at line 94 of file DeclTemplate.cpp.
References asArray().
Referenced by clang::concepts::ExprRequirement::ReturnTypeRequirement::containsUnexpandedParameterPack(), and clang::TemplateTemplateParmDecl::isPackExpansion().
|
static |
Definition at line 119 of file DeclTemplate.cpp.
References TemplateParameterList().
Referenced by clang::Sema::ActOnCompoundRequirement(), clang::Sema::ActOnFinishFunctionDeclarationDeclarator(), clang::Sema::ActOnTemplateParameterList(), createMakeIntegerSeqParameterList(), getGenericLambdaTemplateParameterList(), clang::ASTNodeImporter::import(), clang::Sema::MatchTemplateParametersToScopeSpecifier(), clang::ASTRecordReader::readTemplateParameterList(), clang::TemplateDeclInstantiator::SubstTemplateParams(), clang::TemplateDeclInstantiator::VisitCXXMethodDecl(), and clang::TemplateDeclInstantiator::VisitFunctionDecl().
|
inline |
Definition at line 128 of file DeclTemplate.h.
References begin().
Referenced by AddTemplateParameterChunks(), asArray(), clang::Sema::CheckTemplateArgumentList(), clang::Sema::CheckTemplateParameterList(), and clang::Sema::TemplateParameterListsAreEqual().
|
inline |
Definition at line 129 of file DeclTemplate.h.
References begin().
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 186 of file DeclTemplate.cpp.
References getRequiresClause().
Referenced by clang::TemplateDecl::getAssociatedConstraints(), clang::ClassTemplatePartialSpecializationDecl::getAssociatedConstraints(), and clang::VarTemplatePartialSpecializationDecl::getAssociatedConstraints().
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 156 of file DeclTemplate.cpp.
References getParam(), and size().
Referenced by clang::Sema::ActOnStartFunctionDeclarationDeclarator(), clang::Sema::CheckTemplateArgumentList(), isSameAsPrimaryTemplate(), clang::Sema::isTemplateTemplateParameterAtLeastAsSpecializedAs(), and clang::Sema::MarkDeducedTemplateParameters().
|
inline |
Definition at line 194 of file DeclTemplate.h.
Referenced by clang::Sema::ActOnFinishFunctionDeclarationDeclarator(), clang::ASTRecordWriter::AddTemplateParameterList(), clang::ASTNodeImporter::import(), clang::TemplateDeclInstantiator::VisitCXXMethodDecl(), and clang::TemplateDeclInstantiator::VisitFunctionDecl().
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 130 of file DeclTemplate.cpp.
References asArray(), clang::getExpandedPackSize(), and P.
Referenced by clang::Sema::BuildTypeConstraint(), and clang::Sema::isStdInitializerList().
Definition at line 138 of file DeclTemplate.h.
References begin(), and size().
Referenced by clang::Sema::CheckDeductionGuideTemplate(), checkLiteralOperatorTemplateParameterList(), clang::Sema::CheckTemplatePartialSpecializationArgs(), clang::ODRDiagsEmitter::diagnoseMismatch(), getDepth(), clang::CodeCompleteConsumer::OverloadCandidate::getParamDecl(), clang::comments::TParamCommandComment::getParamName(), clang::CodeCompleteConsumer::OverloadCandidate::getParamType(), clang::FunctionTemplateDecl::isAbbreviated(), isSameAsPrimaryTemplate(), clang::ASTContext::isSameTemplateParameterList(), clang::Sema::isStdInitializerList(), IsStructurallyEquivalent(), clang::Sema::RebuildTemplateParamsInCurrentInstantiation(), clang::concepts::ExprRequirement::ReturnTypeRequirement::ReturnTypeRequirement(), and shouldIncludeTypeForArgument().
Definition at line 142 of file DeclTemplate.h.
|
inline |
Definition at line 195 of file DeclTemplate.h.
Referenced by clang::Sema::ActOnFinishFunctionDeclarationDeclarator(), clang::ASTRecordWriter::AddTemplateParameterList(), clang::ASTNodeImporter::import(), clang::TemplateDeclInstantiator::VisitCXXMethodDecl(), and clang::TemplateDeclInstantiator::VisitFunctionDecl().
|
inline |
The constraint-expression of the associated requires-clause.
Definition at line 174 of file DeclTemplate.h.
Referenced by clang::Sema::ActOnFinishFunctionDeclarationDeclarator(), getAssociatedConstraints(), clang::ASTNodeImporter::import(), clang::ASTContext::isSameTemplateParameterList(), ProfileTemplateParameterList(), clang::Sema::TemplateParameterListsAreEqual(), clang::TemplateDeclInstantiator::VisitCXXMethodDecl(), and clang::TemplateDeclInstantiator::VisitFunctionDecl().
|
inline |
The constraint-expression of the associated requires-clause.
Definition at line 179 of file DeclTemplate.h.
|
inline |
Definition at line 197 of file DeclTemplate.h.
Referenced by checkLiteralOperatorTemplateParameterList(), and clang::Sema::CheckTemplateArgumentList().
|
inline |
Definition at line 193 of file DeclTemplate.h.
Referenced by clang::Sema::ActOnFinishFunctionDeclarationDeclarator(), clang::ASTRecordWriter::AddTemplateParameterList(), clang::ASTNodeImporter::import(), IsStructurallyEquivalent(), clang::Sema::TemplateParameterListsAreEqual(), clang::TemplateDeclInstantiator::VisitCXXMethodDecl(), and clang::TemplateDeclInstantiator::VisitFunctionDecl().
bool TemplateParameterList::hasAssociatedConstraints | ( | ) | const |
|
inline |
Determine whether this template parameter list contains a parameter pack.
Definition at line 166 of file DeclTemplate.h.
|
inlineprotected |
Definition at line 104 of file DeclTemplate.h.
|
inlineprotected |
Definition at line 100 of file DeclTemplate.h.
void TemplateParameterList::print | ( | raw_ostream & | Out, |
const ASTContext & | Context, | ||
bool | OmitTemplateKW = false |
||
) | const |
Definition at line 138 of file DeclPrinter.cpp.
void TemplateParameterList::print | ( | raw_ostream & | Out, |
const ASTContext & | Context, | ||
const PrintingPolicy & | Policy, | ||
bool | OmitTemplateKW = false |
||
) | const |
Definition at line 143 of file DeclPrinter.cpp.
|
static |
Definition at line 205 of file DeclTemplate.cpp.
References clang::PrintingPolicy::AlwaysIncludeTypeForTemplateArgument, getParam(), and size().
Referenced by printTemplateArgs(), and printTo().
|
inline |
Definition at line 131 of file DeclTemplate.h.
Referenced by clang::Sema::ActOnStartFunctionDeclarationDeclarator(), clang::ODRHash::AddTemplateParameterList(), clang::ASTRecordWriter::AddTemplateParameterList(), asArray(), clang::Sema::CheckDeductionGuideTemplate(), checkLiteralOperatorTemplateParameterList(), clang::Sema::CheckTemplatePartialSpecializationArgs(), clang::Sema::DeduceTemplateArguments(), DependsOnTemplateParameters(), clang::ODRDiagsEmitter::diagnoseMismatch(), clang::Sema::FindInstantiatedDecl(), clang::Sema::FinishTemplateArgumentDeduction(), getDepth(), clang::RedeclarableTemplateDecl::getInjectedTemplateArgs(), clang::ASTContext::getInjectedTemplateArgs(), clang::Sema::getMoreSpecializedTemplate(), getParam(), clang::ASTNodeImporter::import(), clang::FunctionTemplateDecl::isAbbreviated(), isSameAsPrimaryTemplate(), clang::ASTContext::isSameTemplateParameterList(), IsStructurallyEquivalent(), clang::Sema::MarkDeducedTemplateParameters(), printTo(), ProfileTemplateParameterList(), clang::Sema::RebuildTemplateParamsInCurrentInstantiation(), clang::concepts::ExprRequirement::ReturnTypeRequirement::ReturnTypeRequirement(), shouldIncludeTypeForArgument(), clang::TemplateDeclInstantiator::SubstTemplateParams(), clang::Sema::TemplateParameterListsAreEqual(), clang::TemplateDeclInstantiator::VisitCXXMethodDecl(), and clang::TemplateDeclInstantiator::VisitFunctionDecl().
|
friend |
Definition at line 110 of file DeclTemplate.h.
friend clang::TemplateParameterList::TrailingObjects |
Definition at line 111 of file DeclTemplate.h.