clang 20.0.0git
|
Represents a template argument. More...
#include "clang/AST/TemplateBase.h"
Public Types | |
enum | ArgKind { Null = 0 , Type , Declaration , NullPtr , Integral , StructuralValue , Template , TemplateExpansion , Expression , Pack } |
The kind of template argument we're storing. More... | |
using | pack_iterator = const TemplateArgument * |
Iterator that traverses the elements of a template argument pack. | |
Public Member Functions | |
constexpr | TemplateArgument () |
Construct an empty, invalid template argument. | |
TemplateArgument (QualType T, bool isNullPtr=false, bool IsDefaulted=false) | |
Construct a template type argument. | |
TemplateArgument (ValueDecl *D, QualType QT, bool IsDefaulted=false) | |
Construct a template argument that refers to a (non-dependent) declaration. | |
TemplateArgument (const ASTContext &Ctx, const llvm::APSInt &Value, QualType Type, bool IsDefaulted=false) | |
Construct an integral constant template argument. | |
TemplateArgument (const ASTContext &Ctx, QualType Type, const APValue &Value, bool IsDefaulted=false) | |
Construct a template argument from an arbitrary constant value. | |
TemplateArgument (const TemplateArgument &Other, QualType Type) | |
Construct an integral constant template argument with the same value as Other but a different type. | |
TemplateArgument (TemplateName Name, bool IsDefaulted=false) | |
Construct a template argument that is a template. | |
TemplateArgument (TemplateName Name, std::optional< unsigned > NumExpansions, bool IsDefaulted=false) | |
Construct a template argument that is a template pack expansion. | |
TemplateArgument (Expr *E, bool IsDefaulted=false) | |
Construct a template argument that is an expression. | |
TemplateArgument (ArrayRef< TemplateArgument > Args) | |
Construct a template argument that is a template argument pack. | |
ArgKind | getKind () const |
Return the kind of stored template argument. | |
bool | isNull () const |
Determine whether this template argument has no value. | |
TemplateArgumentDependence | getDependence () const |
bool | isDependent () const |
Whether this template argument is dependent on a template parameter such that its result can change from one instantiation to another. | |
bool | isInstantiationDependent () const |
Whether this template argument is dependent on a template parameter. | |
bool | containsUnexpandedParameterPack () const |
Whether this template argument contains an unexpanded parameter pack. | |
bool | isPackExpansion () const |
Determine whether this template argument is a pack expansion. | |
QualType | getAsType () const |
Retrieve the type for a type template argument. | |
ValueDecl * | getAsDecl () const |
Retrieve the declaration for a declaration non-type template argument. | |
QualType | getParamTypeForDecl () const |
QualType | getNullPtrType () const |
Retrieve the type for null non-type template argument. | |
TemplateName | getAsTemplate () const |
Retrieve the template name for a template name argument. | |
TemplateName | getAsTemplateOrTemplatePattern () const |
Retrieve the template argument as a template name; if the argument is a pack expansion, return the pattern as a template name. | |
std::optional< unsigned > | getNumTemplateExpansions () const |
Retrieve the number of expansions that a template template argument expansion will produce, if known. | |
llvm::APSInt | getAsIntegral () const |
Retrieve the template argument as an integral value. | |
QualType | getIntegralType () const |
Retrieve the type of the integral value. | |
void | setIntegralType (QualType T) |
void | setIsDefaulted (bool v) |
Set to 'true' if this TemplateArgument corresponds to a default template parameter. | |
bool | getIsDefaulted () const |
If returns 'true', this TemplateArgument corresponds to a default template parameter. | |
const APValue & | getAsStructuralValue () const |
Get the value of a StructuralValue. | |
QualType | getStructuralValueType () const |
Get the type of a StructuralValue. | |
QualType | getNonTypeTemplateArgumentType () const |
If this is a non-type template argument, get its type. | |
Expr * | getAsExpr () const |
Retrieve the template argument as an expression. | |
pack_iterator | pack_begin () const |
Iterator referencing the first argument of a template argument pack. | |
pack_iterator | pack_end () const |
Iterator referencing one past the last argument of a template argument pack. | |
ArrayRef< TemplateArgument > | pack_elements () const |
Iterator range referencing all of the elements of a template argument pack. | |
unsigned | pack_size () const |
The number of template arguments in the given template argument pack. | |
ArrayRef< TemplateArgument > | getPackAsArray () const |
Return the array of arguments in this template argument pack. | |
bool | structurallyEquals (const TemplateArgument &Other) const |
Determines whether two template arguments are superficially the same. | |
TemplateArgument | getPackExpansionPattern () const |
When the template argument is a pack expansion, returns the pattern of the pack expansion. | |
void | print (const PrintingPolicy &Policy, raw_ostream &Out, bool IncludeType) const |
Print this template argument to the given output stream. | |
void | dump (raw_ostream &Out, const ASTContext &Context) const |
Debugging aid that dumps the template argument. | |
void | dump () const |
Debugging aid that dumps the template argument to standard error. | |
void | Profile (llvm::FoldingSetNodeID &ID, const ASTContext &Context) const |
Used to insert TemplateArguments into FoldingSets. | |
Static Public Member Functions | |
static TemplateArgument | getEmptyPack () |
static TemplateArgument | CreatePackCopy (ASTContext &Context, ArrayRef< TemplateArgument > Args) |
Create a new template argument pack by copying the given set of template arguments. | |
Represents a template argument.
Definition at line 61 of file TemplateBase.h.
using clang::TemplateArgument::pack_iterator = const TemplateArgument * |
Iterator that traverses the elements of a template argument pack.
Definition at line 414 of file TemplateBase.h.
The kind of template argument we're storing.
Enumerator | |
---|---|
Null | Represents an empty template argument, e.g., one that has not been deduced. |
Type | The template argument is a type. |
Declaration | The template argument is a declaration that was provided for a pointer, reference, or pointer to member non-type template parameter. |
NullPtr | The template argument is a null pointer or null pointer to member that was provided for a non-type template parameter. |
Integral | The template argument is an integral value stored in an llvm::APSInt that was provided for an integral non-type template parameter. |
StructuralValue | The template argument is a non-type template argument that can't be represented by the special-case Declaration, NullPtr, or Integral forms. These values are only ever produced by constant evaluation, so cannot be dependent. TODO: merge Declaration, NullPtr and Integral into this? |
Template | The template argument is a template name that was provided for a template template parameter. |
TemplateExpansion | The template argument is a pack expansion of a template name that was provided for a template template parameter. |
Expression | The template argument is an expression, and we've not resolved it to one of the other forms yet, either because it's dependent or because we're representing a non-canonical template argument (for instance, in a TemplateSpecializationType). |
Pack | The template argument is actually a parameter pack. Arguments are stored in the Args struct. |
Definition at line 64 of file TemplateBase.h.
|
inlineconstexpr |
Construct an empty, invalid template argument.
Definition at line 190 of file TemplateBase.h.
References Null.
Referenced by CreatePackCopy(), getEmptyPack(), and getPackExpansionPattern().
|
inline |
Construct a template type argument.
Definition at line 193 of file TemplateBase.h.
References clang::T.
|
inline |
Construct a template argument that refers to a (non-dependent) declaration.
Definition at line 200 of file TemplateBase.h.
References D.
TemplateArgument::TemplateArgument | ( | const ASTContext & | Ctx, |
const llvm::APSInt & | Value, | ||
QualType | Type, | ||
bool | IsDefaulted = false |
||
) |
Construct an integral constant template argument.
The memory to store the value is allocated with Ctx.
Definition at line 210 of file TemplateBase.cpp.
TemplateArgument::TemplateArgument | ( | const ASTContext & | Ctx, |
QualType | Type, | ||
const APValue & | Value, | ||
bool | IsDefaulted = false |
||
) |
Construct a template argument from an arbitrary constant value.
Definition at line 242 of file TemplateBase.cpp.
References getAsSimpleValueDeclRef(), clang::Type::isIntegralOrEnumerationType(), and V.
|
inline |
Construct an integral constant template argument with the same value as Other but a different type.
Definition at line 215 of file TemplateBase.h.
References Integer, and clang::Other.
|
inline |
Construct a template argument that is a template.
This form of template argument is generally used for template template parameters. However, the template name could be a dependent template name that ends up being instantiated to a function template whose address is taken.
Name | The template name. |
IsDefaulted | If 'true', implies that this TemplateArgument corresponds to a default template parameter |
Definition at line 231 of file TemplateBase.h.
References Template, and TemplateArg.
|
inline |
Construct a template argument that is a template pack expansion.
This form of template argument is generally used for template template parameters. However, the template name could be a dependent template name that ends up being instantiated to a function template whose address is taken.
Name | The template name. |
NumExpansions | The number of expansions that will be generated by instantiating |
IsDefaulted | If 'true', implies that this TemplateArgument corresponds to a default template parameter |
Definition at line 252 of file TemplateBase.h.
References TemplateArg, and TemplateExpansion.
Construct a template argument that is an expression.
This form of template argument only occurs in template argument lists used for dependent types and for expression; it will not occur in a non-dependent, canonical template argument list.
Definition at line 268 of file TemplateBase.h.
References E, Expression, and TypeOrValue.
|
inlineexplicit |
Construct a template argument that is a template argument pack.
We assume that storage for the template arguments provided outlives the TemplateArgument itself.
Definition at line 278 of file TemplateBase.h.
bool TemplateArgument::containsUnexpandedParameterPack | ( | ) | const |
Whether this template argument contains an unexpanded parameter pack.
Definition at line 346 of file TemplateBase.cpp.
References getDependence().
Referenced by clang::Sema::DiagnoseUnexpandedParameterPack(), and clang::Sema::getFullyPackExpandedSize().
|
static |
Create a new template argument pack by copying the given set of template arguments.
Definition at line 257 of file TemplateBase.cpp.
References Args, getEmptyPack(), and TemplateArgument().
Referenced by checkDeducedTemplateArguments(), clang::Sema::CheckTemplateArgumentList(), ConvertDeducedTemplateArgument(), clang::ASTContext::getCanonicalTemplateArgument(), and clang::ASTContext::getInjectedTemplateArg().
LLVM_DUMP_METHOD void TemplateArgument::dump | ( | ) | const |
Debugging aid that dumps the template argument to standard error.
Definition at line 386 of file ASTDumper.cpp.
References clang::ASTNodeTraverser< Derived, NodeDelegateType >::Visit().
void clang::TemplateArgument::dump | ( | raw_ostream & | Out, |
const ASTContext & | Context | ||
) | const |
Debugging aid that dumps the template argument.
|
inline |
Retrieve the declaration for a declaration non-type template argument.
Definition at line 326 of file TemplateBase.h.
References Declaration, DeclArg, and getKind().
Referenced by clang::ODRHash::AddTemplateArgument(), clang::Sema::BuildExpressionFromDeclTemplateArgument(), checkDeducedTemplateArguments(), DeduceTemplateArguments(), DiagTemplateArg(), clang::ASTContext::getCanonicalTemplateArgument(), getDependence(), clang::ASTNodeImporter::import(), isSameTemplateArg(), IsStructurallyEquivalent(), print(), Profile(), structurallyEquals(), clang::TreeTransform< Derived >::TransformTemplateArgument(), clang::JSONNodeDumper::VisitDeclarationTemplateArgument(), and clang::TextNodeDumper::VisitDeclarationTemplateArgument().
|
inline |
Retrieve the template argument as an expression.
Definition at line 408 of file TemplateBase.h.
References getKind(), and TypeOrValue.
Referenced by clang::ODRHash::AddTemplateArgument(), clang::ASTRecordWriter::AddTemplateArgumentLoc(), clang::Sema::BuildExpressionFromNonTypeTemplateArgument(), checkDeducedTemplateArguments(), CheckNonTypeTemplatePartialSpecializationArgs(), clang::Sema::CheckTemplateArgument(), clang::Sema::CheckTemplateTypeArgument(), DiagTemplateArg(), getCommonTemplateArgument(), getDependence(), clang::Sema::getFullyPackExpandedSize(), getNonTypeTemplateArgumentType(), getPackExpansionPattern(), clang::Sema::getTemplateArgumentPackExpansionPattern(), clang::Sema::getTrivialTemplateArgumentLoc(), clang::ASTNodeImporter::import(), isPackExpansion(), isSameTemplateArg(), IsStructurallyEquivalent(), isSubstitutedTemplateArgument(), isTemplateArgumentTemplateParameter(), print(), Profile(), clang::ASTRecordReader::readTemplateArgumentLoc(), templateArgumentExpressionsEqual(), clang::TreeTransform< Derived >::TransformTemplateArgument(), clang::RecursiveASTVisitor< Derived >::TraverseTemplateArgument(), and clang::ASTNodeTraverser< Derived, NodeDelegateType >::VisitExpressionTemplateArgument().
|
inline |
Retrieve the template argument as an integral value.
Definition at line 363 of file TemplateBase.h.
References getKind(), Integer, and Integral.
Referenced by clang::ODRHash::AddTemplateArgument(), clang::Sema::BuildExpressionFromNonTypeTemplateArgument(), checkBuiltinTemplateIdType(), checkDeducedTemplateArguments(), DeduceTemplateArguments(), DiagTemplateArg(), isSameTemplateArg(), IsStructurallyEquivalent(), printIntegral(), Profile(), structurallyEquals(), templateArgumentExpressionsEqual(), clang::TreeTransform< Derived >::TransformTemplateArgument(), and clang::JSONNodeDumper::VisitIntegralTemplateArgument().
|
inline |
Get the value of a StructuralValue.
Definition at line 396 of file TemplateBase.h.
References clang::Value::Value().
Referenced by clang::ODRHash::AddTemplateArgument(), clang::Sema::BuildExpressionFromNonTypeTemplateArgument(), DiagTemplateArg(), clang::ASTContext::getCanonicalTemplateArgument(), clang::ASTNodeImporter::import(), print(), Profile(), structurallyEquals(), and clang::TreeTransform< Derived >::TransformTemplateArgument().
|
inline |
Retrieve the template name for a template name argument.
Definition at line 343 of file TemplateBase.h.
References clang::TemplateName::getFromVoidPointer(), getKind(), Template, and TemplateArg.
Referenced by clang::Sema::ActOnTemplateTemplateParameter(), checkDeducedTemplateArguments(), DeduceTemplateArguments(), DiagnoseBadDeduction(), DiagTemplateArg(), clang::ASTContext::getCanonicalTemplateArgument(), getCommonTemplateArgument(), getDependence(), clang::Sema::getFullyPackExpandedSize(), clang::TypeName::getFullyQualifiedTemplateArgument(), clang::ASTNodeImporter::import(), clang::ASTContext::isSameDefaultTemplateArgument(), IsStructurallyEquivalent(), isSubstitutedTemplateArgument(), print(), clang::TreeTransform< Derived >::RebuildPackExpansion(), SubstDefaultTemplateArgument(), clang::TreeTransform< Derived >::TransformTemplateArgument(), and clang::TextNodeDumper::VisitTemplateTemplateArgument().
|
inline |
Retrieve the template argument as a template name; if the argument is a pack expansion, return the pattern as a template name.
Definition at line 350 of file TemplateBase.h.
References clang::TemplateName::getFromVoidPointer(), getKind(), Template, TemplateArg, and TemplateExpansion.
Referenced by addAssociatedClassesAndNamespaces(), clang::ODRHash::AddTemplateArgument(), checkDeducedTemplateArguments(), clang::Sema::CheckTemplateArgument(), clang::Sema::CheckTemplateTemplateArgument(), clang::Sema::CheckTemplateTypeArgument(), DiagTemplateArg(), clang::ASTContext::getCanonicalTemplateArgument(), getCommonTemplateArgument(), getPackExpansionPattern(), clang::Sema::getTrivialTemplateArgumentLoc(), clang::ASTNodeImporter::import(), isSameTemplateArg(), IsStructurallyEquivalent(), isTemplateArgumentTemplateParameter(), CXXNameMangler::TemplateArgManglingInfo::needToMangleTemplateParam(), print(), clang::RecursiveASTVisitor< Derived >::TraverseTemplateArgument(), clang::RecursiveASTVisitor< Derived >::TraverseTemplateArgumentLoc(), and clang::TextNodeDumper::VisitTemplateExpansionTemplateArgument().
|
inline |
Retrieve the type for a type template argument.
Definition at line 319 of file TemplateBase.h.
References clang::QualType::getFromOpaquePtr(), getKind(), and TypeOrValue.
Referenced by addAssociatedClassesAndNamespaces(), addInstanceOfTransition(), clang::ODRHash::AddTemplateArgument(), checkDeducedTemplateArguments(), clang::Sema::CheckTemplateArgument(), clang::Sema::CheckTemplateTypeArgument(), DeduceTemplateArguments(), DiagnoseBadDeduction(), DiagTemplateArg(), clang::ASTContext::getCanonicalTemplateArgument(), getCommonTemplateArgument(), getDependence(), clang::Sema::getFullyPackExpandedSize(), clang::TypeName::getFullyQualifiedTemplateArgument(), getPackExpansionPattern(), clang::Sema::getTemplateArgumentPackExpansionPattern(), clang::Sema::getTrivialTemplateArgumentLoc(), clang::ASTNodeImporter::import(), isPackExpansion(), isSameTemplateArg(), IsStructurallyEquivalent(), isSubstitutedTemplateArgument(), isTemplateArgumentTemplateParameter(), print(), Profile(), clang::TreeTransform< Derived >::TransformTemplateArgument(), clang::RecursiveASTVisitor< Derived >::TraverseTemplateArgument(), clang::RecursiveASTVisitor< Derived >::TraverseTemplateArgumentLoc(), TryDeconstructFunctionLike(), clang::ASTNodeTraverser< Derived, NodeDelegateType >::VisitTypeTemplateArgument(), and clang::JSONNodeDumper::VisitTypeTemplateArgument().
TemplateArgumentDependence TemplateArgument::getDependence | ( | ) | const |
Definition at line 265 of file TemplateBase.cpp.
References Declaration, Expression, getAsDecl(), getAsExpr(), getAsTemplate(), getAsType(), clang::Decl::getDeclContext(), getDependence(), getKind(), Integral, Null, NullPtr, P, Pack, pack_elements(), StructuralValue, Template, TemplateExpansion, clang::toTemplateArgumentDependence(), and Type.
Referenced by containsUnexpandedParameterPack(), getDependence(), isDependent(), and isInstantiationDependent().
|
inlinestatic |
Definition at line 285 of file TemplateBase.h.
References TemplateArgument().
Referenced by CreatePackCopy().
|
inline |
Retrieve the type of the integral value.
Definition at line 377 of file TemplateBase.h.
References clang::QualType::getFromOpaquePtr(), getKind(), Integer, and Integral.
Referenced by clang::Sema::BuildExpressionFromNonTypeTemplateArgument(), clang::ASTContext::getCanonicalTemplateArgument(), getNonTypeTemplateArgumentType(), clang::ASTNodeImporter::import(), IsStructurallyEquivalent(), printIntegral(), Profile(), and structurallyEquals().
|
inline |
If returns 'true', this TemplateArgument corresponds to a default template parameter.
Definition at line 393 of file TemplateBase.h.
References TypeOrValue.
Referenced by clang::ASTContext::getCanonicalTemplateArgument(), clang::ASTNodeImporter::import(), and printTo().
|
inline |
Return the kind of stored template argument.
Definition at line 295 of file TemplateBase.h.
References TypeOrValue.
Referenced by addAssociatedClassesAndNamespaces(), addInstanceOfTransition(), clang::ODRHash::AddTemplateArgument(), clang::ASTRecordWriter::AddTemplateArgumentLoc(), clang::Sema::BuildExpressionFromDeclTemplateArgument(), clang::Sema::BuildExpressionFromNonTypeTemplateArgument(), checkDeducedTemplateArguments(), clang::Sema::CheckTemplateArgument(), clang::Sema::CheckTemplateTypeArgument(), ConvertDeducedTemplateArgument(), DeduceTemplateArguments(), describeTemplateParameter(), DiagnoseBadDeduction(), DiagTemplateArg(), CXXNameMangler::TemplateArgManglingInfo::getArgInfo(), getAsDecl(), getAsExpr(), getAsIntegral(), getAsTemplate(), getAsTemplateOrTemplatePattern(), getAsType(), clang::ASTContext::getCanonicalTemplateArgument(), getCommonTemplateArgument(), getDependence(), clang::Sema::getFullyPackExpandedSize(), clang::TypeName::getFullyQualifiedTemplateArgument(), clang::comments::getFunctionTypeLoc(), getIntegralType(), clang::TemplateArgumentLoc::getLocation(), getMoreSpecialized(), clang::Sema::getMoreSpecializedTemplate(), getNonTypeTemplateArgumentType(), getNullPtrType(), getNumTemplateExpansions(), getPackAsArray(), getPackExpansionPattern(), getParamTypeForDecl(), clang::TemplateArgumentLoc::getSourceDeclExpression(), clang::TemplateArgumentLoc::getSourceExpression(), clang::TemplateArgumentLoc::getSourceIntegralExpression(), clang::TemplateArgumentLoc::getSourceNullPtrExpression(), clang::TemplateArgumentLoc::getSourceRange(), clang::TemplateArgumentLoc::getSourceStructuralValueExpression(), clang::Sema::getTemplateArgumentPackExpansionPattern(), clang::TemplateArgumentLoc::getTemplateEllipsisLoc(), clang::TemplateArgumentLoc::getTemplateNameLoc(), clang::TemplateArgumentLoc::getTemplateQualifierLoc(), clang::Sema::getTrivialTemplateArgumentLoc(), clang::TemplateArgumentLoc::getTypeSourceInfo(), hasTemplateArgumentForDeduction(), clang::ASTNodeImporter::import(), isEnableIf(), isNull(), isPackExpansion(), isSameAsPrimaryTemplate(), isSameTemplateArg(), IsStructurallyEquivalent(), clang::isSubstitutedDefaultArgument(), isSubstitutedTemplateArgument(), isTemplateArgumentTemplateParameter(), clang::Sema::isTemplateTemplateParameterAtLeastAsSpecializedAs(), CXXNameMangler::TemplateArgManglingInfo::needToMangleTemplateParam(), pack_begin(), pack_end(), pack_size(), print(), printArgument(), printTo(), Profile(), clang::ASTRecordReader::readTemplateArgumentLoc(), clang::TreeTransform< Derived >::RebuildPackExpansion(), ReferencesAnonymousEntity(), setIntegralType(), structurallyEquals(), clang::Sema::SubstituteExplicitTemplateArguments(), templateArgumentExpressionsEqual(), clang::TemplateArgumentLoc::TemplateArgumentLoc(), clang::TreeTransform< Derived >::TransformTemplateArgument(), clang::RecursiveASTVisitor< Derived >::TraverseTemplateArgument(), clang::RecursiveASTVisitor< Derived >::TraverseTemplateArgumentLoc(), TryDeconstructFunctionLike(), clang::templateargumentvisitor::Base< Ref, ImplClass, RetTy, ParamTys >::Visit(), and clang::ASTDeclWriter::VisitCXXMethodDecl().
QualType TemplateArgument::getNonTypeTemplateArgumentType | ( | ) | const |
If this is a non-type template argument, get its type.
Otherwise, returns a null QualType.
Definition at line 358 of file TemplateBase.cpp.
References Declaration, Expression, getAsExpr(), getIntegralType(), getKind(), getNullPtrType(), getParamTypeForDecl(), getStructuralValueType(), clang::Expr::getType(), Integral, Null, NullPtr, Pack, StructuralValue, Template, TemplateExpansion, and Type.
Referenced by clang::Sema::BuildExpressionFromNonTypeTemplateArgument(), checkDeducedTemplateArguments(), DeduceTemplateArguments(), DiagnoseBadDeduction(), and clang::TreeTransform< Derived >::TransformTemplateArgument().
|
inline |
Retrieve the type for null non-type template argument.
Definition at line 337 of file TemplateBase.h.
References clang::QualType::getFromOpaquePtr(), getKind(), NullPtr, and TypeOrValue.
Referenced by checkDeducedTemplateArguments(), DeduceTemplateArguments(), clang::ASTContext::getCanonicalTemplateArgument(), getCommonTemplateArgument(), getNonTypeTemplateArgumentType(), clang::Sema::getTrivialTemplateArgumentLoc(), clang::ASTNodeImporter::import(), isSameTemplateArg(), and Profile().
std::optional< unsigned > TemplateArgument::getNumTemplateExpansions | ( | ) | const |
Retrieve the number of expansions that a template template argument expansion will produce, if known.
Definition at line 350 of file TemplateBase.cpp.
References getKind(), TemplateArg, and TemplateExpansion.
Referenced by clang::ASTContext::getCanonicalTemplateArgument(), getCommonTemplateArgument(), clang::Sema::getTemplateArgumentPackExpansionPattern(), and clang::ASTNodeImporter::import().
|
inline |
Return the array of arguments in this template argument pack.
Definition at line 444 of file TemplateBase.h.
References Args, getKind(), and Pack.
Referenced by describeTemplateParameter(), and printTo().
TemplateArgument TemplateArgument::getPackExpansionPattern | ( | ) | const |
When the template argument is a pack expansion, returns the pattern of the pack expansion.
Definition at line 479 of file TemplateBase.cpp.
References clang::Type::castAs(), Declaration, Expression, getAsExpr(), getAsTemplateOrTemplatePattern(), getAsType(), getKind(), Integral, isPackExpansion(), Null, NullPtr, Pack, StructuralValue, Template, TemplateArgument(), TemplateExpansion, and Type.
Referenced by DeduceTemplateArguments(), getPackSubstitutedTemplateArgument(), clang::Sema::getTemplateArgumentPackExpansionPattern(), and isSameAsPrimaryTemplate().
|
inline |
Definition at line 331 of file TemplateBase.h.
References Declaration, DeclArg, clang::QualType::getFromOpaquePtr(), and getKind().
Referenced by DeduceTemplateArguments(), clang::ASTContext::getCanonicalTemplateArgument(), getNonTypeTemplateArgumentType(), clang::Sema::getTrivialTemplateArgumentLoc(), clang::ASTNodeImporter::import(), print(), Profile(), and structurallyEquals().
|
inline |
Get the type of a StructuralValue.
Definition at line 399 of file TemplateBase.h.
References clang::QualType::getFromOpaquePtr().
Referenced by clang::ODRHash::AddTemplateArgument(), clang::Sema::BuildExpressionFromNonTypeTemplateArgument(), DiagTemplateArg(), clang::ASTContext::getCanonicalTemplateArgument(), getNonTypeTemplateArgumentType(), clang::ASTNodeImporter::import(), print(), Profile(), and structurallyEquals().
bool TemplateArgument::isDependent | ( | ) | const |
Whether this template argument is dependent on a template parameter such that its result can change from one instantiation to another.
Definition at line 314 of file TemplateBase.cpp.
References getDependence().
Referenced by checkBuiltinTemplateIdType().
bool TemplateArgument::isInstantiationDependent | ( | ) | const |
Whether this template argument is dependent on a template parameter.
Definition at line 318 of file TemplateBase.cpp.
References getDependence().
Referenced by clang::MultiLevelTemplateArgumentList::isAnyArgInstantiationDependent(), and SubstDefaultTemplateArgument().
|
inline |
Determine whether this template argument has no value.
Definition at line 298 of file TemplateBase.h.
References getKind(), and Null.
Referenced by checkDeducedTemplateArguments(), clang::Sema::CheckTemplateArgument(), ConvertDeducedTemplateArguments(), clang::Sema::DiagnoseUnexpandedParameterPack(), clang::TemplateTypeParmDecl::setDefaultArgument(), clang::NonTypeTemplateParmDecl::setDefaultArgument(), and clang::TemplateTemplateParmDecl::setDefaultArgument().
bool TemplateArgument::isPackExpansion | ( | ) | const |
Determine whether this template argument is a pack expansion.
Definition at line 322 of file TemplateBase.cpp.
References Declaration, Expression, getAsExpr(), getAsType(), getKind(), Integral, Null, NullPtr, Pack, StructuralValue, Template, TemplateExpansion, and Type.
Referenced by DeduceTemplateArguments(), CXXNameMangler::TemplateArgManglingInfo::getArgInfo(), getPackExpansionPattern(), getPackSubstitutedTemplateArgument(), clang::Sema::getTemplateArgumentPackExpansionPattern(), isSameAsPrimaryTemplate(), isSameTemplateArg(), and clang::Sema::isTemplateTemplateParameterAtLeastAsSpecializedAs().
|
inline |
Iterator referencing the first argument of a template argument pack.
Definition at line 418 of file TemplateBase.h.
References Args, getKind(), and Pack.
Referenced by checkDeducedTemplateArguments(), getPackSubstitutedTemplateArgument(), isSameAsPrimaryTemplate(), clang::Sema::isTemplateTemplateParameterAtLeastAsSpecializedAs(), CXXNameMangler::TemplateArgManglingInfo::needToMangleTemplateParam(), pack_elements(), and clang::Sema::SubstituteExplicitTemplateArguments().
|
inline |
Iterator range referencing all of the elements of a template argument pack.
Definition at line 432 of file TemplateBase.h.
References pack_begin(), and pack_end().
Referenced by addAssociatedClassesAndNamespaces(), addInstanceOfTransition(), clang::ODRHash::AddTemplateArgument(), ConvertDeducedTemplateArgument(), clang::ASTContext::getCanonicalTemplateArgument(), getDependence(), clang::Sema::getFullyPackExpandedSize(), getMoreSpecialized(), clang::Sema::getMoreSpecializedTemplate(), clang::ASTContext::getSubstTemplateTemplateParmPack(), clang::ASTContext::getSubstTemplateTypeParmPackType(), hasTemplateArgumentForDeduction(), clang::ASTNodeImporter::import(), isSameTemplateArg(), IsStructurallyEquivalent(), print(), clang::SubstTemplateTypeParmPackType::Profile(), clang::RecursiveASTVisitor< Derived >::TraverseTemplateArgument(), clang::RecursiveASTVisitor< Derived >::TraverseTemplateArgumentLoc(), and clang::ASTNodeTraverser< Derived, NodeDelegateType >::VisitPackTemplateArgument().
|
inline |
Iterator referencing one past the last argument of a template argument pack.
Definition at line 425 of file TemplateBase.h.
References Args, getKind(), and Pack.
Referenced by checkDeducedTemplateArguments(), and pack_elements().
|
inline |
The number of template arguments in the given template argument pack.
Definition at line 438 of file TemplateBase.h.
References Args, getKind(), and Pack.
Referenced by clang::ODRHash::AddTemplateArgument(), checkDeducedTemplateArguments(), DiagnoseBadDeduction(), clang::Sema::getFullyPackExpandedSize(), getMoreSpecialized(), clang::Sema::getMoreSpecializedTemplate(), getPackSubstitutedTemplateArgument(), clang::ASTNodeImporter::import(), isSameAsPrimaryTemplate(), isSameTemplateArg(), clang::isSubstitutedDefaultArgument(), clang::Sema::isTemplateTemplateParameterAtLeastAsSpecializedAs(), CXXNameMangler::TemplateArgManglingInfo::needToMangleTemplateParam(), printTo(), clang::SubstTemplateTypeParmPackType::Profile(), and clang::Sema::SubstituteExplicitTemplateArguments().
void TemplateArgument::print | ( | const PrintingPolicy & | Policy, |
raw_ostream & | Out, | ||
bool | IncludeType | ||
) | const |
Print this template argument to the given output stream.
Definition at line 505 of file TemplateBase.cpp.
References Declaration, Expression, clang::First, getAsDecl(), getAsExpr(), getAsStructuralValue(), getAsTemplate(), getAsTemplateOrTemplatePattern(), getAsType(), getKind(), getParamTypeForDecl(), getStructuralValueType(), Integral, isRecordType(), needsAmpersandOnTemplateArg(), Null, NullPtr, P, Pack, pack_elements(), clang::QualType::print(), clang::TemplateName::print(), printIntegral(), clang::APValue::printPretty(), clang::Stmt::printPretty(), clang::NamedDecl::printQualifiedName(), StructuralValue, clang::PrintingPolicy::SuppressStrongLifetime, Template, TemplateExpansion, and Type.
Referenced by clang::PredefinedExpr::ComputeName(), describeTemplateParameter(), DiagTemplateArg(), clang::TextNodeDumper::dumpTemplateArgument(), clang::Sema::getTemplateArgumentBindingsText(), and printArgument().
void TemplateArgument::Profile | ( | llvm::FoldingSetNodeID & | ID, |
const ASTContext & | Context | ||
) | const |
Used to insert TemplateArguments into FoldingSets.
Definition at line 386 of file TemplateBase.cpp.
References Args, Declaration, Expression, getAsDecl(), getAsExpr(), getAsIntegral(), getAsStructuralValue(), getAsType(), getIntegralType(), getKind(), getNullPtrType(), getParamTypeForDecl(), getStructuralValueType(), Integral, Null, NullPtr, Pack, clang::APValue::Profile(), clang::QualType::Profile(), clang::Stmt::Profile(), StructuralValue, Template, TemplateArg, TemplateExpansion, and Type.
Referenced by clang::SubstTemplateTemplateParmPackStorage::Profile().
|
inline |
|
inline |
Set to 'true' if this TemplateArgument corresponds to a default template parameter.
Definition at line 389 of file TemplateBase.h.
References TypeOrValue, and v.
bool TemplateArgument::structurallyEquals | ( | const TemplateArgument & | Other | ) | const |
Determines whether two template arguments are superficially the same.
Definition at line 434 of file TemplateBase.cpp.
References Args, Declaration, E, Expression, getAsDecl(), getAsIntegral(), getAsStructuralValue(), getIntegralType(), getKind(), getParamTypeForDecl(), getStructuralValueType(), Integral, Null, NullPtr, clang::Other, Pack, clang::APValue::Profile(), StructuralValue, Template, TemplateArg, TemplateExpansion, Type, and TypeOrValue.
Referenced by DeduceTemplateArguments(), clang::TextNodeDumper::dumpTemplateArgument(), clang::ASTContext::getSubstTemplateTypeParmPackType(), IsStructurallyEquivalent(), and isSubstitutedTemplateArgument().
struct A clang::TemplateArgument::Args |
Definition at line 176 of file TemplateBase.h.
Referenced by CreatePackCopy(), getPackAsArray(), clang::MultiLevelTemplateArgumentList::isAnyArgInstantiationDependent(), pack_begin(), pack_end(), pack_size(), Profile(), structurallyEquals(), and TemplateArgument().
struct DA clang::TemplateArgument::DeclArg |
Definition at line 173 of file TemplateBase.h.
Referenced by getAsDecl(), and getParamTypeForDecl().
struct I clang::TemplateArgument::Integer |
Definition at line 174 of file TemplateBase.h.
Referenced by getAsIntegral(), getIntegralType(), setIntegralType(), and TemplateArgument().
struct TA clang::TemplateArgument::TemplateArg |
Definition at line 177 of file TemplateBase.h.
Referenced by getAsTemplate(), getAsTemplateOrTemplatePattern(), getNumTemplateExpansions(), Profile(), structurallyEquals(), and TemplateArgument().
struct TV clang::TemplateArgument::TypeOrValue |
Definition at line 178 of file TemplateBase.h.
Referenced by getAsExpr(), getAsType(), getIsDefaulted(), getKind(), getNullPtrType(), setIsDefaulted(), structurallyEquals(), and TemplateArgument().
struct V clang::TemplateArgument::Value |
Definition at line 175 of file TemplateBase.h.