clang 20.0.0git
|
Represents a C++ template name within the type system. More...
#include "clang/AST/TemplateName.h"
Public Types | |
enum | NameKind { Template , OverloadedTemplate , AssumedTemplate , QualifiedTemplate , DependentTemplate , SubstTemplateTemplateParm , SubstTemplateTemplateParmPack , UsingTemplate } |
enum class | Qualified { None , AsWritten } |
Public Member Functions | |
TemplateName ()=default | |
TemplateName (TemplateDecl *Template) | |
TemplateName (OverloadedTemplateStorage *Storage) | |
TemplateName (AssumedTemplateStorage *Storage) | |
TemplateName (SubstTemplateTemplateParmStorage *Storage) | |
TemplateName (SubstTemplateTemplateParmPackStorage *Storage) | |
TemplateName (QualifiedTemplateName *Qual) | |
TemplateName (DependentTemplateName *Dep) | |
TemplateName (UsingShadowDecl *Using) | |
bool | isNull () const |
Determine whether this template name is NULL. | |
NameKind | getKind () const |
TemplateDecl * | getAsTemplateDecl () const |
Retrieve the underlying template declaration that this template name refers to, if known. | |
OverloadedTemplateStorage * | getAsOverloadedTemplate () const |
Retrieve the underlying, overloaded function template declarations that this template name refers to, if known. | |
AssumedTemplateStorage * | getAsAssumedTemplateName () const |
Retrieve information on a name that has been assumed to be a template-name in order to permit a call via ADL. | |
SubstTemplateTemplateParmStorage * | getAsSubstTemplateTemplateParm () const |
Retrieve the substituted template template parameter, if known. | |
SubstTemplateTemplateParmPackStorage * | getAsSubstTemplateTemplateParmPack () const |
Retrieve the substituted template template parameter pack, if known. | |
QualifiedTemplateName * | getAsQualifiedTemplateName () const |
Retrieve the underlying qualified template name structure, if any. | |
DependentTemplateName * | getAsDependentTemplateName () const |
Retrieve the underlying dependent template name structure, if any. | |
UsingShadowDecl * | getAsUsingShadowDecl () const |
Retrieve the using shadow declaration through which the underlying template declaration is introduced, if any. | |
TemplateName | getUnderlying () const |
TemplateNameDependence | getDependence () const |
bool | isDependent () const |
Determines whether this is a dependent template name. | |
bool | isInstantiationDependent () const |
Determines whether this is a template name that somehow depends on a template parameter. | |
bool | containsUnexpandedParameterPack () const |
Determines whether this template name contains an unexpanded parameter pack (for C++0x variadic templates). | |
void | print (raw_ostream &OS, const PrintingPolicy &Policy, Qualified Qual=Qualified::AsWritten) const |
Print the template name. | |
void | dump (raw_ostream &OS, const ASTContext &Context) const |
Debugging aid that dumps the template name. | |
void | dump () const |
Debugging aid that dumps the template name to standard error. | |
void | Profile (llvm::FoldingSetNodeID &ID) |
void * | getAsVoidPointer () const |
Retrieve the template name as a void pointer. | |
bool | operator== (TemplateName Other) const |
Structural equality. | |
bool | operator!= (TemplateName Other) const |
Static Public Member Functions | |
static TemplateName | getFromVoidPointer (void *Ptr) |
Build a template name from a void pointer. | |
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 a template instantiation, hence is represented as a dependent template name.
Definition at line 203 of file TemplateName.h.
Definition at line 218 of file TemplateName.h.
|
strong |
Enumerator | |
---|---|
None | |
AsWritten |
Definition at line 331 of file TemplateName.h.
|
default |
|
explicit |
Definition at line 106 of file TemplateName.cpp.
|
explicit |
Definition at line 107 of file TemplateName.cpp.
|
explicit |
Definition at line 109 of file TemplateName.cpp.
|
explicit |
Definition at line 111 of file TemplateName.cpp.
|
explicit |
Definition at line 113 of file TemplateName.cpp.
|
explicit |
Definition at line 115 of file TemplateName.cpp.
|
explicit |
Definition at line 116 of file TemplateName.cpp.
|
explicit |
Definition at line 117 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 263 of file TemplateName.cpp.
References getDependence().
Referenced by clang::Sema::ActOnPackExpansion(), and clang::Sema::DiagnoseUnexpandedParameterPack().
LLVM_DUMP_METHOD void TemplateName::dump | ( | ) | const |
Debugging aid that dumps the template name to standard error.
Definition at line 371 of file ASTDumper.cpp.
References clang::ASTNodeTraverser< Derived, NodeDelegateType >::Visit().
void clang::TemplateName::dump | ( | raw_ostream & | OS, |
const ASTContext & | Context | ||
) | const |
Debugging aid that dumps the template name.
AssumedTemplateStorage * TemplateName::getAsAssumedTemplateName | ( | ) | const |
Retrieve information on a name that has been assumed to be a template-name in order to permit a call via ADL.
Definition at line 174 of file TemplateName.cpp.
References clang::UncommonTemplateNameStorage::getAsAssumedTemplateName().
Referenced by clang::Sema::ActOnCXXNestedNameSpecifier(), clang::Sema::ActOnTemplateIdType(), clang::ASTImporter::Import(), IsStructurallyEquivalent(), and print().
DependentTemplateName * TemplateName::getAsDependentTemplateName | ( | ) | const |
Retrieve the underlying dependent template name structure, if any.
Definition at line 204 of file TemplateName.cpp.
Referenced by clang::Sema::ActOnCXXNestedNameSpecifier(), clang::Sema::ActOnTagTemplateIdType(), clang::Sema::ActOnTemplateIdType(), clang::Sema::ActOnTypenameType(), clang::Sema::CheckTemplateArgument(), clang::TextNodeDumper::dumpBareTemplateName(), clang::ASTContext::getCanonicalTemplateSpecializationType(), getDependence(), clang::ASTContext::getTemplateSpecializationType(), clang::Sema::getTrivialTemplateArgumentLoc(), clang::ASTImporter::Import(), clang::TemplateSpecializationTypeLoc::initializeArgLocs(), IsStructurallyEquivalent(), print(), clang::TreeTransform< Derived >::RebuildDependentTemplateSpecializationType(), clang::TreeTransform< Derived >::TransformDependentTemplateSpecializationType(), and clang::RecursiveASTVisitor< Derived >::TraverseTemplateName().
OverloadedTemplateStorage * TemplateName::getAsOverloadedTemplate | ( | ) | const |
Retrieve the underlying, overloaded function template declarations that this template name refers to, if known.
Definition at line 166 of file TemplateName.cpp.
References clang::UncommonTemplateNameStorage::getAsOverloadedStorage().
Referenced by clang::Sema::ActOnCXXNestedNameSpecifier(), clang::ASTImporter::Import(), IsStructurallyEquivalent(), print(), and clang::SemaCodeCompletion::ProduceTemplateArgumentSignatureHelp().
QualifiedTemplateName * TemplateName::getAsQualifiedTemplateName | ( | ) | const |
Retrieve the underlying qualified template name structure, if any.
Definition at line 200 of file TemplateName.cpp.
Referenced by clang::Sema::CheckDeductionGuideDeclarator(), clang::TextNodeDumper::dumpBareTemplateName(), getAsTemplateDecl(), getAsUsingShadowDecl(), getDependence(), clang::TypeName::getFullyQualifiedTemplateName(), clang::Sema::getTrivialTemplateArgumentLoc(), clang::ASTImporter::Import(), clang::TemplateSpecializationTypeLoc::initializeArgLocs(), print(), and clang::RecursiveASTVisitor< Derived >::TraverseTemplateName().
SubstTemplateTemplateParmStorage * TemplateName::getAsSubstTemplateTemplateParm | ( | ) | const |
Retrieve the substituted template template parameter, if known.
Definition at line 183 of file TemplateName.cpp.
References clang::UncommonTemplateNameStorage::getAsSubstTemplateTemplateParm().
Referenced by clang::TextNodeDumper::dumpBareTemplateName(), getAsTemplateDecl(), clang::ASTImporter::Import(), and print().
SubstTemplateTemplateParmPackStorage * TemplateName::getAsSubstTemplateTemplateParmPack | ( | ) | const |
Retrieve the substituted template template parameter pack, if known.
Definition at line 192 of file TemplateName.cpp.
References clang::UncommonTemplateNameStorage::getAsSubstTemplateTemplateParmPack().
Referenced by clang::Sema::getFullyPackExpandedSize(), clang::ASTImporter::Import(), IsStructurallyEquivalent(), and print().
TemplateDecl * TemplateName::getAsTemplateDecl | ( | ) | const |
Retrieve the underlying template declaration that this template name refers to, if known.
Definition at line 145 of file TemplateName.cpp.
References getAsQualifiedTemplateName(), getAsSubstTemplateTemplateParm(), and getAsUsingShadowDecl().
Referenced by clang::Sema::ActOnCXXNestedNameSpecifier(), clang::Sema::ActOnTagTemplateIdType(), addAssociatedClassesAndNamespaces(), clang::Sema::BuildTypeConstraint(), clang::Sema::CheckDeductionGuideDeclarator(), clang::Sema::CheckTypeConstraint(), DeduceTemplateArguments(), DeduceTemplateSpecArguments(), clang::Sema::DeduceTemplateSpecializationFromInitializer(), DiagnoseBadDeduction(), clang::TextNodeDumper::dumpBareTemplateName(), findOrdinaryMemberInDependentClasses(), GetDeclSpecTypeForDeclarator(), getDependence(), clang::TypeName::getFullyQualifiedTemplateName(), clang::Sema::GetNameFromUnqualifiedId(), clang::ASTContext::getTemplateSpecializationType(), clang::ASTImporter::Import(), InventTemplateParameter(), isEnableIf(), IsSmallVector(), clang::Sema::isStdInitializerList(), IsStdVector(), IsStructurallyEquivalent(), isSubstitutedTemplateArgument(), isTemplateArgumentTemplateParameter(), CXXNameMangler::TemplateArgManglingInfo::needToMangleTemplateParam(), print(), clang::SemaCodeCompletion::ProduceTemplateArgumentSignatureHelp(), and CXXNameMangler::TemplateArgManglingInfo::TemplateArgManglingInfo().
UsingShadowDecl * TemplateName::getAsUsingShadowDecl | ( | ) | const |
Retrieve the using shadow declaration through which the underlying template declaration is introduced, if any.
Definition at line 208 of file TemplateName.cpp.
References D, and getAsQualifiedTemplateName().
Referenced by clang::Sema::BuildTypeConstraint(), clang::TextNodeDumper::dumpBareTemplateName(), getAsTemplateDecl(), clang::TypeName::getFullyQualifiedTemplateName(), clang::ASTImporter::Import(), and InventTemplateParameter().
|
inline |
Retrieve the template name as a void pointer.
Definition at line 355 of file TemplateName.h.
Referenced by llvm::PointerLikeTypeTraits< clang::TemplateName >::getAsVoidPointer(), getCommonSugarTypeNode(), getCommonTemplateArgument(), getCommonTemplateName(), getCommonTemplateNameChecked(), clang::ASTContext::hasSameTemplateName(), isSameTemplateArg(), and clang::QualifiedTemplateName::Profile().
TemplateNameDependence TemplateName::getDependence | ( | ) | const |
Definition at line 217 of file TemplateName.cpp.
References D, DependentTemplate, getAsDependentTemplateName(), getAsQualifiedTemplateName(), getAsTemplateDecl(), getDependence(), getKind(), OverloadedTemplate, QualifiedTemplate, SubstTemplateTemplateParmPack, Template, and clang::toTemplateNameDependence().
Referenced by containsUnexpandedParameterPack(), getDependence(), isDependent(), and isInstantiationDependent().
|
inlinestatic |
Build a template name from a void pointer.
Definition at line 358 of file TemplateName.h.
Referenced by clang::TemplateArgument::getAsTemplate(), clang::TemplateArgument::getAsTemplateOrTemplatePattern(), and llvm::PointerLikeTypeTraits< clang::TemplateName >::getFromVoidPointer().
TemplateName::NameKind TemplateName::getKind | ( | ) | const |
Definition at line 121 of file TemplateName.cpp.
References AssumedTemplate, DependentTemplate, clang::UncommonTemplateNameStorage::getAsAssumedTemplateName(), clang::UncommonTemplateNameStorage::getAsOverloadedStorage(), clang::UncommonTemplateNameStorage::getAsSubstTemplateTemplateParm(), OverloadedTemplate, QualifiedTemplate, SubstTemplateTemplateParm, SubstTemplateTemplateParmPack, Template, and UsingTemplate.
Referenced by DiagnoseBadDeduction(), clang::TextNodeDumper::dumpBareTemplateName(), getDependence(), clang::ASTContext::getQualifiedTemplateName(), clang::ASTImporter::Import(), IsStructurallyEquivalent(), and print().
|
inline |
Definition at line 415 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 255 of file TemplateName.cpp.
References getDependence().
Referenced by clang::Sema::DeduceTemplateSpecializationFromInitializer(), and clang::DeducedTemplateSpecializationType::Profile().
bool TemplateName::isInstantiationDependent | ( | ) | const |
Determines whether this is a template name that somehow depends on a template parameter.
Definition at line 259 of file TemplateName.cpp.
References getDependence().
bool TemplateName::isNull | ( | ) | const |
Determine whether this template name is NULL.
Definition at line 119 of file TemplateName.cpp.
Referenced by clang::Sema::ActOnTemplateTemplateParameter(), clang::Sema::DiagnoseUnexpandedParameterPack(), clang::TreeTransform< Derived >::RebuildDependentTemplateSpecializationType(), clang::Sema::SubstDefaultTemplateArgumentIfAvailable(), clang::TreeTransform< Derived >::TransformTemplateArgument(), and clang::TreeTransform< Derived >::TransformTemplateSpecializationType().
|
inline |
Definition at line 364 of file TemplateName.h.
References clang::operator==(), and clang::Other.
|
inline |
void TemplateName::print | ( | raw_ostream & | OS, |
const PrintingPolicy & | Policy, | ||
Qualified | Qual = Qualified::AsWritten |
||
) | const |
Print the template name.
OS | the output stream to which the template name will be printed. |
Qual | print the (Qualified::None) simple name, (Qualified::AsWritten) any written (possibly partial) qualifier, or (Qualified::Fully) the fully qualified name. |
Definition at line 267 of file TemplateName.cpp.
References clang::OverloadedTemplateStorage::begin(), clang::PrintingPolicy::CleanUglifiedParameters, getAsAssumedTemplateName(), getAsDependentTemplateName(), getAsOverloadedTemplate(), getAsQualifiedTemplateName(), getAsSubstTemplateTemplateParm(), getAsSubstTemplateTemplateParmPack(), getAsTemplateDecl(), clang::NamedDecl::getIdentifier(), getKind(), clang::getOperatorSpelling(), None, OverloadedTemplate, clang::Decl::print(), Template, and UsingTemplate.
Referenced by clang::TextNodeDumper::dumpTemplateName(), clang::operator<<(), clang::TemplateArgument::print(), and clang::JSONNodeDumper::VisitTemplateSpecializationType().
|
inline |
Definition at line 350 of file TemplateName.h.
References ID.
Referenced by clang::DeducedTemplateSpecializationType::Profile().