clang  16.0.0git
Classes | Public Member Functions | List of all members
clang::MultiLevelTemplateArgumentList Class Reference

Data structure that captures multiple levels of template argument lists for use in template instantiation. More...

#include "clang/Sema/Template.h"

Public Member Functions

 MultiLevelTemplateArgumentList ()=default
 Construct an empty set of template argument lists. More...
 
 MultiLevelTemplateArgumentList (Decl *D, ArgList Args, bool Final)
 Construct a single-level template argument list. More...
 
void setKind (TemplateSubstitutionKind K)
 
TemplateSubstitutionKind getKind () const
 Determine the kind of template substitution being performed. More...
 
bool isRewrite () const
 Determine whether we are rewriting template parameters rather than substituting for them. More...
 
unsigned getNumLevels () const
 Determine the number of levels in this template argument list. More...
 
unsigned getNumSubstitutedLevels () const
 Determine the number of substituted levels in this template argument list. More...
 
unsigned getNumSubsitutedArgs (unsigned Depth) const
 
unsigned getNumRetainedOuterLevels () const
 
unsigned getNewDepth (unsigned OldDepth) const
 Determine how many of the OldDepth outermost template parameter lists would be removed by substituting these arguments. More...
 
const TemplateArgumentoperator() (unsigned Depth, unsigned Index) const
 Retrieve the template argument at a given depth and index. More...
 
std::pair< Decl *, boolgetAssociatedDecl (unsigned Depth) const
 A template-like entity which owns the whole pattern being substituted. More...
 
bool hasTemplateArgument (unsigned Depth, unsigned Index) const
 Determine whether there is a non-NULL template argument at the given depth and index. More...
 
bool isAnyArgInstantiationDependent () const
 
void setArgument (unsigned Depth, unsigned Index, TemplateArgument Arg)
 Clear out a specific template argument. More...
 
void addOuterTemplateArguments (Decl *AssociatedDecl, ArgList Args, bool Final)
 Add a new outmost level to the multi-level template argument list. More...
 
void addOuterTemplateArguments (ArgList Args)
 
void addOuterTemplateArguments (std::nullopt_t)
 
void replaceInnermostTemplateArguments (ArgList Args)
 Replaces the current 'innermost' level with the provided argument list. More...
 
void addOuterRetainedLevel ()
 Add an outermost level that we are not substituting. More...
 
void addOuterRetainedLevels (unsigned Num)
 
const ArgListgetInnermost () const
 Retrieve the innermost template argument list. More...
 
const ArgListgetOutermost () const
 Retrieve the outermost template argument list. More...
 
ArgListsIterator begin ()
 
ConstArgListsIterator begin () const
 
ArgListsIterator end ()
 
ConstArgListsIterator end () const
 

Detailed Description

Data structure that captures multiple levels of template argument lists for use in template instantiation.

Multiple levels of template arguments occur when instantiating the definitions of member templates. For example:

template<typename T>
struct X {
template<T Value>
struct Y {
void f();
};
};

When instantiating X<int>::Y<17>::f, the multi-level template argument list will contain a template argument list (int) at depth 0 and a template argument list (17) at depth 1.

Definition at line 75 of file Template.h.

Constructor & Destructor Documentation

◆ MultiLevelTemplateArgumentList() [1/2]

clang::MultiLevelTemplateArgumentList::MultiLevelTemplateArgumentList ( )
default

Construct an empty set of template argument lists.

◆ MultiLevelTemplateArgumentList() [2/2]

clang::MultiLevelTemplateArgumentList::MultiLevelTemplateArgumentList ( Decl D,
ArgList  Args,
bool  Final 
)
inline

Construct a single-level template argument list.

Definition at line 104 of file Template.h.

References addOuterTemplateArguments().

Member Function Documentation

◆ addOuterRetainedLevel()

void clang::MultiLevelTemplateArgumentList::addOuterRetainedLevel ( )
inline

Add an outermost level that we are not substituting.

We have no arguments at this level, and do not remove it from the depth of inner template parameters that we instantiate.

Definition at line 242 of file Template.h.

◆ addOuterRetainedLevels()

void clang::MultiLevelTemplateArgumentList::addOuterRetainedLevels ( unsigned  Num)
inline

Definition at line 245 of file Template.h.

Referenced by clang::Sema::SubstSpaceshipAsEqualEqual().

◆ addOuterTemplateArguments() [1/3]

void clang::MultiLevelTemplateArgumentList::addOuterTemplateArguments ( ArgList  Args)
inline

Definition at line 218 of file Template.h.

References getKind(), and clang::Rewrite.

◆ addOuterTemplateArguments() [2/3]

void clang::MultiLevelTemplateArgumentList::addOuterTemplateArguments ( Decl AssociatedDecl,
ArgList  Args,
bool  Final 
)
inline

Add a new outmost level to the multi-level template argument list.

A 'Final' substitution means that Subst* nodes won't be built for the replacements.

Definition at line 209 of file Template.h.

References clang::Decl::getCanonicalDecl(), getKind(), and clang::Specialization.

Referenced by clang::Sema::BuildVarTemplateInstantiation(), MultiLevelTemplateArgumentList(), and SubstDefaultTemplateArgument().

◆ addOuterTemplateArguments() [3/3]

void clang::MultiLevelTemplateArgumentList::addOuterTemplateArguments ( std::nullopt_t  )
inline

Definition at line 225 of file Template.h.

◆ begin() [1/2]

ArgListsIterator clang::MultiLevelTemplateArgumentList::begin ( )
inline

Definition at line 257 of file Template.h.

◆ begin() [2/2]

ConstArgListsIterator clang::MultiLevelTemplateArgumentList::begin ( ) const
inline

Definition at line 258 of file Template.h.

◆ end() [1/2]

ArgListsIterator clang::MultiLevelTemplateArgumentList::end ( )
inline

Definition at line 261 of file Template.h.

◆ end() [2/2]

ConstArgListsIterator clang::MultiLevelTemplateArgumentList::end ( ) const
inline

Definition at line 262 of file Template.h.

◆ getAssociatedDecl()

std::pair<Decl *, bool> clang::MultiLevelTemplateArgumentList::getAssociatedDecl ( unsigned  Depth) const
inline

A template-like entity which owns the whole pattern being substituted.

This will usually own a set of template parameters, or in some cases might even be a template parameter itself.

Definition at line 163 of file Template.h.

References Depth, and getNumLevels().

◆ getInnermost()

const ArgList& clang::MultiLevelTemplateArgumentList::getInnermost ( ) const
inline

◆ getKind()

TemplateSubstitutionKind clang::MultiLevelTemplateArgumentList::getKind ( ) const
inline

Determine the kind of template substitution being performed.

Definition at line 111 of file Template.h.

Referenced by addOuterTemplateArguments().

◆ getNewDepth()

unsigned clang::MultiLevelTemplateArgumentList::getNewDepth ( unsigned  OldDepth) const
inline

Determine how many of the OldDepth outermost template parameter lists would be removed by substituting these arguments.

Definition at line 144 of file Template.h.

References getNumLevels().

◆ getNumLevels()

unsigned clang::MultiLevelTemplateArgumentList::getNumLevels ( ) const
inline

Determine the number of levels in this template argument list.

Definition at line 122 of file Template.h.

Referenced by clang::Sema::CheckParameterPacksForExpansion(), getAssociatedDecl(), getNewDepth(), and getNumSubsitutedArgs().

◆ getNumRetainedOuterLevels()

unsigned clang::MultiLevelTemplateArgumentList::getNumRetainedOuterLevels ( ) const
inline

Definition at line 138 of file Template.h.

Referenced by clang::Sema::FindInstantiatedDecl().

◆ getNumSubsitutedArgs()

unsigned clang::MultiLevelTemplateArgumentList::getNumSubsitutedArgs ( unsigned  Depth) const
inline

Definition at line 133 of file Template.h.

References Depth, and getNumLevels().

◆ getNumSubstitutedLevels()

unsigned clang::MultiLevelTemplateArgumentList::getNumSubstitutedLevels ( ) const
inline

Determine the number of substituted levels in this template argument list.

Definition at line 128 of file Template.h.

◆ getOutermost()

const ArgList& clang::MultiLevelTemplateArgumentList::getOutermost ( ) const
inline

Retrieve the outermost template argument list.

Definition at line 254 of file Template.h.

◆ hasTemplateArgument()

bool clang::MultiLevelTemplateArgumentList::hasTemplateArgument ( unsigned  Depth,
unsigned  Index 
) const
inline

Determine whether there is a non-NULL template argument at the given depth and index.

There must exist a template argument list at the given depth.

Definition at line 174 of file Template.h.

Referenced by clang::Sema::CheckParameterPacksForExpansion().

◆ isAnyArgInstantiationDependent()

bool clang::MultiLevelTemplateArgumentList::isAnyArgInstantiationDependent ( ) const
inline

Definition at line 187 of file Template.h.

References clang::RISCV::TA.

◆ isRewrite()

bool clang::MultiLevelTemplateArgumentList::isRewrite ( ) const
inline

Determine whether we are rewriting template parameters rather than substituting for them.

If so, we should not leave references to the original template parameters behind.

Definition at line 116 of file Template.h.

References clang::Rewrite.

◆ operator()()

const TemplateArgument& clang::MultiLevelTemplateArgumentList::operator() ( unsigned  Depth,
unsigned  Index 
) const
inline

Retrieve the template argument at a given depth and index.

Definition at line 153 of file Template.h.

◆ replaceInnermostTemplateArguments()

void clang::MultiLevelTemplateArgumentList::replaceInnermostTemplateArguments ( ArgList  Args)
inline

Replaces the current 'innermost' level with the provided argument list.

This is useful for type deduction cases where we need to get the entire list from the AST, but then add the deduced innermost list.

Definition at line 234 of file Template.h.

◆ setArgument()

void clang::MultiLevelTemplateArgumentList::setArgument ( unsigned  Depth,
unsigned  Index,
TemplateArgument  Arg 
)
inline

Clear out a specific template argument.

Definition at line 196 of file Template.h.

◆ setKind()

void clang::MultiLevelTemplateArgumentList::setKind ( TemplateSubstitutionKind  K)
inline

Definition at line 108 of file Template.h.

Referenced by clang::Sema::SubstSpaceshipAsEqualEqual().


The documentation for this class was generated from the following file:
clang::tooling::X
static ToolExecutorPluginRegistry::Add< AllTUsToolExecutorPlugin > X("all-TUs", "Runs FrontendActions on all TUs in the compilation database. " "Tool results are stored in memory.")