clang API Documentation

Public Types | Public Member Functions | Static Public Member Functions
clang::TemplateName Class Reference

Represents a C++ template name within the type system. More...

#include <TemplateName.h>

List of all members.

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.

Detailed Description

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.


Member Enumeration Documentation

Enumerator:
Template 

A single template declaration.

OverloadedTemplate 

A set of overloaded template declarations.

QualifiedTemplate 

A qualified template name, where the qualification is kept to describe the source code as written.

DependentTemplate 

A dependent template name that has not been resolved to a template (or set of templates).

SubstTemplateTemplateParm 

A template template parameter that has been substituted for some other template name.

SubstTemplateTemplateParmPack 

A template template parameter pack that has been substituted for a template template argument pack, but has not yet been expanded into individual arguments.

Definition at line 189 of file TemplateName.h.


Constructor & Destructor Documentation

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.


Member Function Documentation

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().

Retrieve the underlying, overloaded function template.

Returns:
The set of overloaded function templates that this template name refers to, if known. If the template name does not refer to a specific set of function templates because it is a dependent name or refers to a single template, returns NULL.

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().

Retrieve the substituted template template parameter, if known.

Returns:
The storage for the substituted template template parameter, if known. Otherwise, returns NULL.

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().

Retrieve the substituted template template parameter pack, if known.

Returns:
The storage for the substituted template template parameter pack, if known. Otherwise, returns NULL.

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().

void* clang::TemplateName::getAsVoidPointer ( ) const [inline]
static TemplateName clang::TemplateName::getFromVoidPointer ( void *  Ptr) [inline, static]

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]
void TemplateName::print ( raw_ostream &  OS,
const PrintingPolicy &  Policy,
bool  SuppressNNS = false 
) const

Print the template name.

Parameters:
OSthe output stream to which the template name will be printed.
SuppressNNSif 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().


The documentation for this class was generated from the following files: