clang
3.9.0
|
Represents a C++ template name within the type system. More...
#include <TemplateName.h>
Public Types | |
enum | NameKind { Template, OverloadedTemplate, QualifiedTemplate, DependentTemplate, SubstTemplateTemplateParm, SubstTemplateTemplateParmPack } |
Public Member Functions | |
TemplateName () | |
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 |
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 176 of file TemplateName.h.
Definition at line 188 of file TemplateName.h.
|
inline |
Definition at line 208 of file TemplateName.h.
Referenced by getFromVoidPointer().
|
explicit |
Definition at line 58 of file TemplateName.cpp.
|
explicit |
Definition at line 59 of file TemplateName.cpp.
|
explicit |
Definition at line 61 of file TemplateName.cpp.
|
explicit |
Definition at line 63 of file TemplateName.cpp.
|
explicit |
Definition at line 65 of file TemplateName.cpp.
|
explicit |
Definition at line 66 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 161 of file TemplateName.cpp.
References getAsDependentTemplateName(), getAsSubstTemplateTemplateParmPack(), getAsTemplateDecl(), and Template.
Referenced by clang::Sema::ActOnPackExpansion(), and clang::Sema::DiagnoseUnexpandedParameterPack().
void TemplateName::dump | ( | raw_ostream & | OS | ) | const |
Debugging aid that dumps the template name.
Definition at line 223 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 230 of file TemplateName.cpp.
DependentTemplateName * TemplateName::getAsDependentTemplateName | ( | ) | const |
Retrieve the underlying dependent template name structure, if any.
Definition at line 130 of file TemplateName.cpp.
Referenced by clang::Sema::ActOnCXXNestedNameSpecifier(), clang::Sema::ActOnTagTemplateIdType(), clang::Sema::ActOnTemplateIdType(), clang::Sema::ActOnTypenameType(), clang::ASTRecordWriter::AddTemplateName(), clang::Sema::CheckTemplateArgument(), clang::Sema::CheckTemplateIdType(), containsUnexpandedParameterPack(), clang::ASTContext::getCanonicalTemplateName(), clang::ASTContext::getCanonicalTemplateSpecializationType(), clang::Sema::getDestructorName(), clang::ASTContext::getNameForTemplate(), clang::ASTContext::getTemplateSpecializationType(), clang::ASTContext::getTemplateSpecializationTypeInfo(), getTrivialTemplateArgumentLoc(), clang::ASTImporter::Import(), clang::TemplateSpecializationTypeLoc::initializeArgLocs(), clang::TreeTransform< Derived >::InventTemplateArgumentLoc(), MarkUsedTemplateParameters(), print(), clang::TreeTransform< Derived >::RebuildDependentTemplateSpecializationType(), clang::TreeTransform< Derived >::TransformDependentTemplateSpecializationType(), clang::TreeTransform< Derived >::TransformTemplateName(), and clang::RecursiveASTVisitor< Derived >::TraverseTemplateName().
OverloadedTemplateStorage * TemplateName::getAsOverloadedTemplate | ( | ) | const |
Retrieve the underlying, overloaded function template.
Definition at line 100 of file TemplateName.cpp.
References clang::UncommonTemplateNameStorage::getAsOverloadedStorage().
Referenced by clang::Sema::ActOnCXXNestedNameSpecifier(), clang::Sema::ActOnVarTemplateSpecialization(), clang::ASTRecordWriter::AddTemplateName(), clang::ASTContext::getNameForTemplate(), clang::ASTImporter::Import(), isDependent(), clang::Sema::NoteAllFoundTemplates(), and print().
QualifiedTemplateName * TemplateName::getAsQualifiedTemplateName | ( | ) | const |
Retrieve the underlying qualified template name structure, if any.
Definition at line 126 of file TemplateName.cpp.
Referenced by clang::ASTRecordWriter::AddTemplateName(), getAsTemplateDecl(), clang::ASTContext::getCanonicalTemplateSpecializationType(), clang::TypeName::getFullyQualifiedTemplateName(), clang::ASTContext::getTemplateSpecializationType(), getTrivialTemplateArgumentLoc(), clang::ASTImporter::Import(), clang::TemplateSpecializationTypeLoc::initializeArgLocs(), clang::TreeTransform< Derived >::InventTemplateArgumentLoc(), isInstantiationDependent(), MarkUsedTemplateParameters(), print(), clang::TreeTransform< Derived >::TransformTemplateName(), and clang::RecursiveASTVisitor< Derived >::TraverseTemplateName().
SubstTemplateTemplateParmStorage * TemplateName::getAsSubstTemplateTemplateParm | ( | ) | const |
Retrieve the substituted template template parameter, if known.
Definition at line 109 of file TemplateName.cpp.
References clang::UncommonTemplateNameStorage::getAsSubstTemplateTemplateParm().
Referenced by clang::ASTRecordWriter::AddTemplateName(), getAsTemplateDecl(), clang::ASTContext::getCanonicalTemplateName(), clang::ASTContext::getNameForTemplate(), getUnderlying(), clang::ASTImporter::Import(), and print().
SubstTemplateTemplateParmPackStorage * TemplateName::getAsSubstTemplateTemplateParmPack | ( | ) | const |
Retrieve the substituted template template parameter pack, if known.
Definition at line 118 of file TemplateName.cpp.
References clang::UncommonTemplateNameStorage::getAsSubstTemplateTemplateParmPack().
Referenced by clang::ASTRecordWriter::AddTemplateName(), clang::Sema::CheckTemplateIdType(), containsUnexpandedParameterPack(), clang::ASTContext::getCanonicalTemplateName(), clang::ASTContext::getNameForTemplate(), clang::ASTImporter::Import(), print(), and clang::TreeTransform< Derived >::TransformTemplateName().
TemplateDecl * TemplateName::getAsTemplateDecl | ( | ) | const |
Retrieve the underlying template declaration that this template name refers to, if known.
Definition at line 87 of file TemplateName.cpp.
References getAsQualifiedTemplateName(), getAsSubstTemplateTemplateParm(), and Template.
Referenced by clang::Sema::ActOnClassTemplateSpecialization(), clang::Sema::ActOnCXXNestedNameSpecifier(), clang::Sema::ActOnExplicitInstantiation(), clang::Sema::ActOnTagTemplateIdType(), clang::Sema::ActOnVarTemplateSpecialization(), addAssociatedClassesAndNamespaces(), clang::ASTRecordWriter::AddTemplateName(), clang::Type::canHaveNullability(), clang::Sema::CheckTemplateArgument(), clang::Sema::CheckTemplateIdType(), clang::Sema::CheckTemplateTypeArgument(), containsUnexpandedParameterPack(), DeduceTemplateArguments(), DiagnoseBadDeduction(), clang::Sema::DiagnoseUnknownTypeName(), clang::ASTContext::getCanonicalTemplateName(), clang::Sema::getDestructorName(), clang::TypeName::getFullyQualifiedTemplateName(), clang::ASTContext::getNameForTemplate(), clang::ASTContext::getTemplateSpecializationType(), clang::ASTImporter::Import(), isDependent(), IsSmallVector(), IsStdVector(), isTemplateArgumentTemplateParameter(), MarkUsedTemplateParameters(), clang::Sema::NoteAllFoundTemplates(), clang::TemplateArgument::Profile(), and clang::TreeTransform< Derived >::TransformTemplateName().
|
inline |
Retrieve the template name as a void pointer.
Definition at line 299 of file TemplateName.h.
Referenced by llvm::PointerLikeTypeTraits< clang::TemplateName >::getAsVoidPointer(), clang::ASTContext::hasSameTemplateName(), clang::SubstTemplateTemplateParmStorage::Profile(), clang::TemplateArgument::Profile(), and clang::TemplateArgument::TemplateArgument().
|
inlinestatic |
Build a template name from a void pointer.
Definition at line 302 of file TemplateName.h.
References TemplateName().
Referenced by clang::TemplateArgument::getAsTemplate(), clang::TemplateArgument::getAsTemplateOrTemplatePattern(), and llvm::PointerLikeTypeTraits< clang::TemplateName >::getFromVoidPointer().
TemplateName::NameKind TemplateName::getKind | ( | ) | const |
Definition at line 70 of file TemplateName.cpp.
References DependentTemplate, clang::UncommonTemplateNameStorage::getAsOverloadedStorage(), clang::UncommonTemplateNameStorage::getAsSubstTemplateTemplateParm(), OverloadedTemplate, QualifiedTemplate, SubstTemplateTemplateParm, SubstTemplateTemplateParmPack, and Template.
Referenced by clang::ASTRecordWriter::AddTemplateName(), DiagnoseBadDeduction(), clang::ASTContext::getCanonicalTemplateName(), clang::ASTContext::getNameForTemplate(), and clang::ASTImporter::Import().
|
inline |
Definition at line 337 of file TemplateName.h.
References getAsSubstTemplateTemplateParm(), and getUnderlying().
Referenced by clang::Sema::CheckTemplateIdType(), and getUnderlying().
bool TemplateName::isDependent | ( | ) | const |
Determines whether this is a dependent template name.
Definition at line 134 of file TemplateName.cpp.
References getAsOverloadedTemplate(), getAsTemplateDecl(), and Template.
Referenced by clang::Sema::ActOnClassTemplateSpecialization(), clang::Sema::ActOnVarTemplateSpecialization(), clang::Sema::CheckTemplateArgument(), clang::Sema::CheckTemplateIdType(), 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 152 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 68 of file TemplateName.cpp.
Referenced by clang::Sema::ActOnTemplateTemplateParameter(), clang::Sema::CheckTemplateArgumentList(), clang::Sema::DiagnoseUnexpandedParameterPack(), clang::ASTImporter::Import(), 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 178 of file TemplateName.cpp.
References clang::OverloadedTemplateStorage::begin(), getAsDependentTemplateName(), getAsOverloadedTemplate(), getAsQualifiedTemplateName(), getAsSubstTemplateTemplateParm(), getAsSubstTemplateTemplateParmPack(), clang::getOperatorSpelling(), and Template.
Referenced by dump(), clang::operator<<(), and clang::TemplateArgument::print().
|
inline |
Definition at line 294 of file TemplateName.h.