clang
7.0.0
|
Represents a C++ template name within the type system. More...
#include "clang/AST/TemplateName.h"
Public Types | |
enum | NameKind { Template, OverloadedTemplate, QualifiedTemplate, DependentTemplate, SubstTemplateTemplateParm, SubstTemplateTemplateParmPack } |
Public Member Functions | |
TemplateName ()=default | |
TemplateName (TemplateDecl *Template) | |
TemplateName (OverloadedTemplateStorage *Storage) | |
TemplateName (SubstTemplateTemplateParmStorage *Storage) | |
TemplateName (SubstTemplateTemplateParmPackStorage *Storage) | |
TemplateName (QualifiedTemplateName *Qual) | |
TemplateName (DependentTemplateName *Dep) | |
bool | isNull () const |
Determine whether this template name is NULL. More... | |
NameKind | getKind () const |
TemplateDecl * | getAsTemplateDecl () const |
Retrieve the underlying template declaration that this template name refers to, if known. More... | |
OverloadedTemplateStorage * | getAsOverloadedTemplate () const |
Retrieve the underlying, overloaded function template. More... | |
SubstTemplateTemplateParmStorage * | getAsSubstTemplateTemplateParm () const |
Retrieve the substituted template template parameter, if known. More... | |
SubstTemplateTemplateParmPackStorage * | getAsSubstTemplateTemplateParmPack () const |
Retrieve the substituted template template parameter pack, if known. More... | |
QualifiedTemplateName * | getAsQualifiedTemplateName () const |
Retrieve the underlying qualified template name structure, if any. More... | |
DependentTemplateName * | getAsDependentTemplateName () const |
Retrieve the underlying dependent template name structure, if any. More... | |
TemplateName | getUnderlying () const |
TemplateName | getNameToSubstitute () const |
Get the template name to substitute when this template name is used as a template template argument. More... | |
bool | isDependent () const |
Determines whether this is a dependent template name. More... | |
bool | isInstantiationDependent () const |
Determines whether this is a template name that somehow depends on a template parameter. More... | |
bool | containsUnexpandedParameterPack () const |
Determines whether this template name contains an unexpanded parameter pack (for C++0x variadic templates). More... | |
void | print (raw_ostream &OS, const PrintingPolicy &Policy, bool SuppressNNS=false) const |
Print the template name. More... | |
void | dump (raw_ostream &OS) const |
Debugging aid that dumps the template name. More... | |
void | dump () const |
Debugging aid that dumps the template name to standard error. More... | |
void | Profile (llvm::FoldingSetNodeID &ID) |
void * | getAsVoidPointer () const |
Retrieve the template name as a void pointer. More... | |
Static Public Member Functions | |
static TemplateName | getFromVoidPointer (void *Ptr) |
Build a template name from a void pointer. More... | |
Represents a C++ template name within the type system.
A C++ template name refers to a template within the C++ type system. In most cases, a template name is simply a reference to a class template, e.g.
Here, the 'X' in X<int>
is a template name that refers to the declaration of the class template X, above. Template names can also refer to function templates, C++0x template aliases, etc.
Some template names are dependent. For example, consider:
Here, "apply" is treated as a template name within the typename specifier in the typedef. "apply" is a nested template, and can only be understood in the context of
Definition at line 178 of file TemplateName.h.
Definition at line 189 of file TemplateName.h.
|
default |
Referenced by getNameToSubstitute().
|
explicit |
Definition at line 67 of file TemplateName.cpp.
|
explicit |
Definition at line 68 of file TemplateName.cpp.
|
explicit |
Definition at line 70 of file TemplateName.cpp.
|
explicit |
Definition at line 72 of file TemplateName.cpp.
|
explicit |
Definition at line 74 of file TemplateName.cpp.
|
explicit |
Definition at line 75 of file TemplateName.cpp.
bool TemplateName::containsUnexpandedParameterPack | ( | ) | const |
Determines whether this template name contains an unexpanded parameter pack (for C++0x variadic templates).
Definition at line 187 of file TemplateName.cpp.
References getAsDependentTemplateName(), getAsQualifiedTemplateName(), getAsSubstTemplateTemplateParmPack(), getAsTemplateDecl(), and Template.
Referenced by clang::Sema::ActOnPackExpansion(), clang::TemplateSpecializationType::anyDependentTemplateArguments(), and clang::Sema::DiagnoseUnexpandedParameterPack().
void TemplateName::dump | ( | raw_ostream & | OS | ) | const |
Debugging aid that dumps the template name.
Definition at line 254 of file TemplateName.cpp.
References print().
LLVM_DUMP_METHOD void TemplateName::dump | ( | ) | const |
Debugging aid that dumps the template name to standard error.
Definition at line 261 of file TemplateName.cpp.
DependentTemplateName * TemplateName::getAsDependentTemplateName | ( | ) | const |
Retrieve the underlying dependent template name structure, if any.
Definition at line 139 of file TemplateName.cpp.
Referenced by clang::Sema::ActOnTagTemplateIdType(), clang::Sema::ActOnTypenameType(), clang::TemplateSpecializationType::anyDependentTemplateArguments(), clang::Sema::CheckTemplateArgument(), containsUnexpandedParameterPack(), clang::ASTContext::getCanonicalTemplateSpecializationType(), clang::ASTContext::getTemplateSpecializationType(), print(), clang::TreeTransform< Derived >::RebuildDependentTemplateSpecializationType(), clang::TreeTransform< Derived >::TransformDependentTemplateSpecializationType(), and clang::RecursiveASTVisitor< CallGraph >::TraverseTemplateName().
OverloadedTemplateStorage * TemplateName::getAsOverloadedTemplate | ( | ) | const |
Retrieve the underlying, overloaded function template.
Definition at line 109 of file TemplateName.cpp.
References clang::UncommonTemplateNameStorage::getAsOverloadedStorage().
Referenced by clang::ASTImporter::Import(), isDependent(), and print().
QualifiedTemplateName * TemplateName::getAsQualifiedTemplateName | ( | ) | const |
Retrieve the underlying qualified template name structure, if any.
Definition at line 135 of file TemplateName.cpp.
Referenced by containsUnexpandedParameterPack(), getAsTemplateDecl(), clang::ASTContext::getCanonicalTemplateSpecializationType(), clang::TypeName::getFullyQualifiedTemplateName(), clang::ASTContext::getTemplateSpecializationType(), isInstantiationDependent(), print(), and clang::RecursiveASTVisitor< CallGraph >::TraverseTemplateName().
SubstTemplateTemplateParmStorage * TemplateName::getAsSubstTemplateTemplateParm | ( | ) | const |
Retrieve the substituted template template parameter, if known.
Definition at line 118 of file TemplateName.cpp.
References clang::UncommonTemplateNameStorage::getAsSubstTemplateTemplateParm().
Referenced by getAsTemplateDecl(), and print().
SubstTemplateTemplateParmPackStorage * TemplateName::getAsSubstTemplateTemplateParmPack | ( | ) | const |
Retrieve the substituted template template parameter pack, if known.
Definition at line 127 of file TemplateName.cpp.
References clang::UncommonTemplateNameStorage::getAsSubstTemplateTemplateParmPack().
Referenced by containsUnexpandedParameterPack(), clang::Sema::getFullyPackExpandedSize(), and print().
TemplateDecl * TemplateName::getAsTemplateDecl | ( | ) | const |
Retrieve the underlying template declaration that this template name refers to, if known.
Definition at line 96 of file TemplateName.cpp.
References getAsQualifiedTemplateName(), getAsSubstTemplateTemplateParm(), and Template.
Referenced by addAssociatedClassesAndNamespaces(), clang::Sema::CheckDeductionGuideDeclarator(), containsUnexpandedParameterPack(), DeduceTemplateArguments(), clang::Sema::DeduceTemplateSpecializationFromInitializer(), clang::TypeName::getFullyQualifiedTemplateName(), getNameToSubstitute(), clang::ASTContext::getTemplateSpecializationType(), hasMangledSubstitutionQualifiers(), clang::ASTImporter::Import(), isDependent(), isEnableIf(), IsSmallVector(), IsStdVector(), isStreamCharSpecialization(), and clang::TreeTransform< Derived >::TransformDependentTemplateSpecializationType().
|
inline |
Retrieve the template name as a void pointer.
Definition at line 310 of file TemplateName.h.
Referenced by llvm::PointerLikeTypeTraits< clang::TemplateName >::getAsVoidPointer(), clang::ASTContext::hasSameTemplateName(), and clang::SubstTemplateTemplateParmStorage::Profile().
|
inlinestatic |
Build a template name from a void pointer.
Definition at line 313 of file TemplateName.h.
References clang::operator<<().
Referenced by llvm::PointerLikeTypeTraits< clang::TemplateName >::getFromVoidPointer().
TemplateName::NameKind TemplateName::getKind | ( | ) | const |
Definition at line 79 of file TemplateName.cpp.
References DependentTemplate, clang::UncommonTemplateNameStorage::getAsOverloadedStorage(), clang::UncommonTemplateNameStorage::getAsSubstTemplateTemplateParm(), OverloadedTemplate, QualifiedTemplate, SubstTemplateTemplateParm, SubstTemplateTemplateParmPack, and Template.
Referenced by clang::TemplateSpecializationType::anyDependentTemplateArguments(), and clang::ASTImporter::Import().
TemplateName TemplateName::getNameToSubstitute | ( | ) | const |
Get the template name to substitute when this template name is used as a template template argument.
This refers to the most recent declaration of the template, including any default template arguments.
Definition at line 143 of file TemplateName.cpp.
References getAsTemplateDecl(), clang::Decl::getFriendObjectKind(), clang::NamedDecl::getMostRecentDecl(), clang::Decl::getPreviousDecl(), and TemplateName().
|
inline |
Definition at line 348 of file TemplateName.h.
References clang::UncommonTemplateNameStorage::getAsSubstTemplateTemplateParm(), and getUnderlying().
Referenced by getUnderlying().
bool TemplateName::isDependent | ( | ) | const |
Determines whether this is a dependent template name.
Definition at line 160 of file TemplateName.cpp.
References getAsOverloadedTemplate(), getAsTemplateDecl(), and Template.
Referenced by clang::TemplateArgument::isDependent(), and isInstantiationDependent().
bool TemplateName::isInstantiationDependent | ( | ) | const |
Determines whether this is a template name that somehow depends on a template parameter.
Definition at line 178 of file TemplateName.cpp.
References getAsQualifiedTemplateName(), and isDependent().
Referenced by clang::TemplateArgument::isInstantiationDependent().
bool TemplateName::isNull | ( | ) | const |
Determine whether this template name is NULL.
Definition at line 77 of file TemplateName.cpp.
Referenced by clang::Sema::DiagnoseUnexpandedParameterPack(), clang::ASTNodeImporter::ImportTemplateArgument(), clang::TreeTransform< Derived >::RebuildDependentTemplateSpecializationType(), clang::Sema::SubstDefaultTemplateArgumentIfAvailable(), clang::TreeTransform< Derived >::TransformTemplateArgument(), clang::TreeTransform< Derived >::TransformTemplateSpecializationType(), and clang::ASTNodeImporter::VisitTemplateSpecializationType().
void TemplateName::print | ( | raw_ostream & | OS, |
const PrintingPolicy & | Policy, | ||
bool | SuppressNNS = false |
||
) | const |
Print the template name.
OS | the output stream to which the template name will be printed. |
SuppressNNS | if true, don't print the nested-name-specifier that precedes the template name (if it has one). |
Definition at line 209 of file TemplateName.cpp.
References clang::OverloadedTemplateStorage::begin(), getAsDependentTemplateName(), getAsOverloadedTemplate(), getAsQualifiedTemplateName(), getAsSubstTemplateTemplateParm(), getAsSubstTemplateTemplateParmPack(), clang::getOperatorSpelling(), and Template.
Referenced by dump(), clang::getParameterABISpelling(), clang::operator<<(), and clang::TemplateArgument::print().
|
inline |
Definition at line 305 of file TemplateName.h.
Referenced by clang::DeducedTemplateSpecializationType::Profile(), and clang::TemplateSpecializationType::Profile().