clang 20.0.0git
Public Member Functions | List of all members
clang::DeducedTemplateArgument Class Reference

Captures a template argument whose value has been deduced via c++ template argument deduction. More...

#include "clang/Sema/Template.h"

Inheritance diagram for clang::DeducedTemplateArgument:
Inheritance graph
[legend]

Public Member Functions

 DeducedTemplateArgument ()=default
 
 DeducedTemplateArgument (const TemplateArgument &Arg, bool DeducedFromArrayBound=false)
 
 DeducedTemplateArgument (ASTContext &Ctx, const llvm::APSInt &Value, QualType ValueType, bool DeducedFromArrayBound)
 Construct an integral non-type template argument that has been deduced, possibly from an array bound.
 
bool wasDeducedFromArrayBound () const
 For a non-type template argument, determine whether the template argument was deduced from an array bound.
 
void setDeducedFromArrayBound (bool Deduced)
 Specify whether the given non-type template argument was deduced from an array bound.
 
- Public Member Functions inherited from clang::TemplateArgument
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.
 
ValueDeclgetAsDecl () 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< unsignedgetNumTemplateExpansions () 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 APValuegetAsStructuralValue () 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.
 
ExprgetAsExpr () 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< TemplateArgumentpack_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< TemplateArgumentgetPackAsArray () 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.
 

Additional Inherited Members

- Public Types inherited from clang::TemplateArgument
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.
 
- Static Public Member Functions inherited from clang::TemplateArgument
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.
 

Detailed Description

Captures a template argument whose value has been deduced via c++ template argument deduction.

Definition at line 327 of file Template.h.

Constructor & Destructor Documentation

◆ DeducedTemplateArgument() [1/3]

clang::DeducedTemplateArgument::DeducedTemplateArgument ( )
default

◆ DeducedTemplateArgument() [2/3]

clang::DeducedTemplateArgument::DeducedTemplateArgument ( const TemplateArgument Arg,
bool  DeducedFromArrayBound = false 
)
inline

Definition at line 335 of file Template.h.

◆ DeducedTemplateArgument() [3/3]

clang::DeducedTemplateArgument::DeducedTemplateArgument ( ASTContext Ctx,
const llvm::APSInt &  Value,
QualType  ValueType,
bool  DeducedFromArrayBound 
)
inline

Construct an integral non-type template argument that has been deduced, possibly from an array bound.

Definition at line 341 of file Template.h.

Member Function Documentation

◆ setDeducedFromArrayBound()

void clang::DeducedTemplateArgument::setDeducedFromArrayBound ( bool  Deduced)
inline

Specify whether the given non-type template argument was deduced from an array bound.

Definition at line 354 of file Template.h.

Referenced by ConvertDeducedTemplateArgument().

◆ wasDeducedFromArrayBound()

bool clang::DeducedTemplateArgument::wasDeducedFromArrayBound ( ) const
inline

For a non-type template argument, determine whether the template argument was deduced from an array bound.

Definition at line 350 of file Template.h.

Referenced by checkDeducedTemplateArguments(), ConvertDeducedTemplateArgument(), and DeduceNonTypeTemplateArgument().


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