clang API Documentation
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. | |
| 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. | |
| 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. | |
| TemplateName | getUnderlying () 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, bool SuppressNNS=false) const |
| Print the template name. | |
| void | dump (raw_ostream &OS) 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. | |
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.
template<typename T> class X { }; X<int> xi;
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:
template<typename MetaFun, typename T1, typename T2> struct apply2 { typedef typename MetaFun::template apply<T1, T2>::type type; };
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 175 of file TemplateName.h.
Definition at line 189 of file TemplateName.h.
| clang::TemplateName::TemplateName | ( | ) | [inline] |
Definition at line 209 of file TemplateName.h.
Referenced by getFromVoidPointer().
| clang::TemplateName::TemplateName | ( | TemplateDecl * | Template | ) | [inline, explicit] |
Definition at line 210 of file TemplateName.h.
| clang::TemplateName::TemplateName | ( | OverloadedTemplateStorage * | Storage | ) | [inline, explicit] |
Definition at line 211 of file TemplateName.h.
| clang::TemplateName::TemplateName | ( | SubstTemplateTemplateParmStorage * | Storage | ) | [inline, explicit] |
Definition at line 362 of file TemplateName.h.
| clang::TemplateName::TemplateName | ( | SubstTemplateTemplateParmPackStorage * | Storage | ) | [inline, explicit] |
Definition at line 214 of file TemplateName.h.
| clang::TemplateName::TemplateName | ( | QualifiedTemplateName * | Qual | ) | [inline, explicit] |
Definition at line 216 of file TemplateName.h.
| clang::TemplateName::TemplateName | ( | DependentTemplateName * | Dep | ) | [inline, explicit] |
Definition at line 217 of file TemplateName.h.
Determines whether this template name contains an unexpanded parameter pack (for C++0x variadic templates).
Definition at line 111 of file TemplateName.cpp.
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 173 of file TemplateName.cpp.
| void TemplateName::dump | ( | ) | const |
Debugging aid that dumps the template name to standard error.
Definition at line 180 of file TemplateName.cpp.
References dump().
| DependentTemplateName* clang::TemplateName::getAsDependentTemplateName | ( | ) | const [inline] |
Retrieve the underlying dependent template name structure, if any.
Definition at line 284 of file TemplateName.h.
Referenced by clang::Sema::ActOnCXXNestedNameSpecifier(), clang::Sema::ActOnTagTemplateIdType(), clang::Sema::ActOnTemplateIdType(), clang::Sema::ActOnTypenameType(), clang::ASTWriter::AddTemplateName(), clang::Sema::CheckTemplateArgument(), clang::Sema::CheckTemplateIdType(), 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(), clang::TreeTransform< Derived >::RebuildDependentTemplateSpecializationType(), clang::TreeTransform< Derived >::TransformDependentTemplateSpecializationType(), clang::TreeTransform< Derived >::TransformTemplateName(), and clang::RecursiveASTVisitor< Derived >::TraverseTemplateName().
| OverloadedTemplateStorage* clang::TemplateName::getAsOverloadedTemplate | ( | ) | const [inline] |
Retrieve the underlying, overloaded function template.
Definition at line 241 of file TemplateName.h.
References clang::UncommonTemplateNameStorage::getAsOverloadedStorage().
Referenced by clang::Sema::ActOnCXXNestedNameSpecifier(), clang::Sema::ActOnVarTemplateSpecialization(), clang::ASTWriter::AddTemplateName(), clang::ASTContext::getNameForTemplate(), clang::ASTImporter::Import(), and clang::Sema::NoteAllFoundTemplates().
| QualifiedTemplateName* clang::TemplateName::getAsQualifiedTemplateName | ( | ) | const [inline] |
Retrieve the underlying qualified template name structure, if any.
Definition at line 278 of file TemplateName.h.
Referenced by clang::ASTWriter::AddTemplateName(), clang::ASTContext::getCanonicalTemplateSpecializationType(), clang::ASTContext::getTemplateSpecializationType(), getTrivialTemplateArgumentLoc(), clang::ASTImporter::Import(), clang::TemplateSpecializationTypeLoc::initializeArgLocs(), clang::TreeTransform< Derived >::InventTemplateArgumentLoc(), MarkUsedTemplateParameters(), clang::TreeTransform< Derived >::TransformTemplateName(), and clang::RecursiveASTVisitor< Derived >::TraverseTemplateName().
| SubstTemplateTemplateParmStorage* clang::TemplateName::getAsSubstTemplateTemplateParm | ( | ) | const [inline] |
Retrieve the substituted template template parameter, if known.
Definition at line 254 of file TemplateName.h.
References clang::UncommonTemplateNameStorage::getAsSubstTemplateTemplateParm().
Referenced by clang::ASTWriter::AddTemplateName(), clang::ASTContext::getCanonicalTemplateName(), clang::ASTContext::getNameForTemplate(), getUnderlying(), and clang::ASTImporter::Import().
| SubstTemplateTemplateParmPackStorage* clang::TemplateName::getAsSubstTemplateTemplateParmPack | ( | ) | const [inline] |
Retrieve the substituted template template parameter pack, if known.
Definition at line 268 of file TemplateName.h.
References clang::UncommonTemplateNameStorage::getAsSubstTemplateTemplateParmPack().
Referenced by clang::ASTWriter::AddTemplateName(), clang::Sema::CheckTemplateIdType(), clang::ASTContext::getCanonicalTemplateName(), clang::ASTContext::getNameForTemplate(), clang::ASTImporter::Import(), 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 71 of file TemplateName.cpp.
Referenced by clang::Sema::ActOnClassTemplateSpecialization(), clang::Sema::ActOnCXXNestedNameSpecifier(), clang::Sema::ActOnExplicitInstantiation(), clang::Sema::ActOnTagTemplateIdType(), clang::Sema::ActOnVarTemplateSpecialization(), addAssociatedClassesAndNamespaces(), clang::ASTWriter::AddTemplateName(), clang::Sema::CheckTemplateArgument(), clang::Sema::CheckTemplateIdType(), clang::Sema::CheckTemplateTypeArgument(), DeduceTemplateArguments(), DiagnoseBadDeduction(), clang::Sema::DiagnoseUnknownTypeName(), clang::ASTContext::getCanonicalTemplateName(), clang::Sema::getDestructorName(), clang::ASTContext::getNameForTemplate(), clang::ASTContext::getTemplateSpecializationType(), clang::ASTImporter::Import(), isEnableIf(), IsSmallVector(), IsStdVector(), isTemplateArgumentTemplateParameter(), MarkUsedTemplateParameters(), clang::Sema::NoteAllFoundTemplates(), clang::TemplateArgument::Profile(), recoverFromTypeInKnownDependentBase(), and clang::TreeTransform< Derived >::TransformTemplateName().
| void* clang::TemplateName::getAsVoidPointer | ( | ) | const [inline] |
Retrieve the template name as a void pointer.
Definition at line 324 of file TemplateName.h.
Referenced by llvm::PointerLikeTypeTraits< clang::TemplateName >::getAsVoidPointer(), clang::ASTContext::hasSameTemplateName(), clang::SubstTemplateTemplateParmStorage::Profile(), clang::TemplateArgument::Profile(), and clang::TemplateArgument::TemplateArgument().
| static TemplateName clang::TemplateName::getFromVoidPointer | ( | void * | Ptr | ) | [inline, static] |
Build a template name from a void pointer.
Definition at line 327 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 54 of file TemplateName.cpp.
References clang::UncommonTemplateNameStorage::getAsOverloadedStorage(), and clang::UncommonTemplateNameStorage::getAsSubstTemplateTemplateParm().
Referenced by clang::ASTWriter::AddTemplateName(), DiagnoseBadDeduction(), clang::ASTContext::getCanonicalTemplateName(), clang::ASTContext::getNameForTemplate(), and clang::ASTImporter::Import().
| TemplateName clang::TemplateName::getUnderlying | ( | ) | const [inline] |
Definition at line 365 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 84 of file TemplateName.cpp.
Referenced by clang::Sema::ActOnClassTemplateSpecialization(), clang::Sema::ActOnVarTemplateSpecialization(), clang::Sema::CheckTemplateArgument(), clang::Sema::CheckTemplateIdType(), and clang::TemplateArgument::isDependent().
| bool TemplateName::isInstantiationDependent | ( | ) | const |
Determines whether this is a template name that somehow depends on a template parameter.
Definition at line 102 of file TemplateName.cpp.
Referenced by clang::TemplateArgument::isInstantiationDependent().
| bool clang::TemplateName::isNull | ( | ) | const [inline] |
Determine whether this template name is NULL.
Definition at line 220 of file TemplateName.h.
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 128 of file TemplateName.cpp.
References clang::OverloadedTemplateStorage::begin(), and clang::getOperatorSpelling().
Referenced by clang::operator<<(), and clang::TemplateArgument::print().
| void clang::TemplateName::Profile | ( | llvm::FoldingSetNodeID & | ID | ) | [inline] |
Definition at line 319 of file TemplateName.h.
Referenced by clang::TemplateSpecializationType::Profile().