clang API Documentation

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

Represents a C++ nested name specifier, such as "::std::vector<int>::". More...

#include <NestedNameSpecifier.h>

Inheritance diagram for clang::NestedNameSpecifier:
Inheritance graph
[legend]
Collaboration diagram for clang::NestedNameSpecifier:
Collaboration graph
[legend]

List of all members.

Public Types

enum  SpecifierKind {
  Identifier, Namespace, NamespaceAlias, TypeSpec,
  TypeSpecWithTemplate, Global
}
 The kind of specifier that completes this nested name specifier. More...

Public Member Functions

NestedNameSpecifiergetPrefix () const
 Return the prefix of this nested name specifier.
SpecifierKind getKind () const
 Determine what kind of nested name specifier is stored.
IdentifierInfogetAsIdentifier () const
 Retrieve the identifier stored in this nested name specifier.
NamespaceDeclgetAsNamespace () const
 Retrieve the namespace stored in this nested name specifier.
NamespaceAliasDeclgetAsNamespaceAlias () const
 Retrieve the namespace alias stored in this nested name specifier.
const TypegetAsType () const
 Retrieve the type stored in this nested name specifier.
bool isDependent () const
 Whether this nested name specifier refers to a dependent type or not.
bool isInstantiationDependent () const
 Whether this nested name specifier involves a template parameter.
bool containsUnexpandedParameterPack () const
 Whether this nested-name-specifier contains an unexpanded parameter pack (for C++0x variadic templates).
void print (raw_ostream &OS, const PrintingPolicy &Policy) const
 Print this nested name specifier to the given output stream.
void Profile (llvm::FoldingSetNodeID &ID) const
void dump (const LangOptions &LO)
 Dump the nested name specifier to standard output to aid in debugging.

Static Public Member Functions

static NestedNameSpecifierCreate (const ASTContext &Context, NestedNameSpecifier *Prefix, IdentifierInfo *II)
 Builds a specifier combining a prefix and an identifier.
static NestedNameSpecifierCreate (const ASTContext &Context, NestedNameSpecifier *Prefix, NamespaceDecl *NS)
 Builds a nested name specifier that names a namespace.
static NestedNameSpecifierCreate (const ASTContext &Context, NestedNameSpecifier *Prefix, NamespaceAliasDecl *Alias)
 Builds a nested name specifier that names a namespace alias.
static NestedNameSpecifierCreate (const ASTContext &Context, NestedNameSpecifier *Prefix, bool Template, const Type *T)
 Builds a nested name specifier that names a type.
static NestedNameSpecifierCreate (const ASTContext &Context, IdentifierInfo *II)
 Builds a specifier that consists of just an identifier.
static NestedNameSpecifierGlobalSpecifier (const ASTContext &Context)
 Returns the nested name specifier representing the global scope.

Detailed Description

Represents a C++ nested name specifier, such as "::std::vector<int>::".

C++ nested name specifiers are the prefixes to qualified namespaces. For example, "foo::" in "foo::x" is a nested name specifier. Nested name specifiers are made up of a sequence of specifiers, each of which can be a namespace, type, identifier (for dependent names), decltype specifier, or the global specifier ('::'). The last two specifiers can only appear at the start of a nested-namespace-specifier.

Definition at line 42 of file NestedNameSpecifier.h.


Member Enumeration Documentation

The kind of specifier that completes this nested name specifier.

Enumerator:
Identifier 

An identifier, stored as an IdentifierInfo*.

Namespace 

A namespace, stored as a NamespaceDecl*.

NamespaceAlias 

A namespace alias, stored as a NamespaceAliasDecl*.

TypeSpec 

A type, stored as a Type*.

TypeSpecWithTemplate 

A type that was preceded by the 'template' keyword, stored as a Type*.

Global 

The global specifier '::'. There is no stored value.

Definition at line 72 of file NestedNameSpecifier.h.


Member Function Documentation

bool NestedNameSpecifier::containsUnexpandedParameterPack ( ) const

Whether this nested-name-specifier contains an unexpanded parameter pack (for C++0x variadic templates).

Definition at line 197 of file NestedNameSpecifier.cpp.

References containsUnexpandedParameterPack(), clang::Type::containsUnexpandedParameterPack(), getAsType(), getKind(), getPrefix(), Global, Identifier, Namespace, NamespaceAlias, TypeSpec, and TypeSpecWithTemplate.

Referenced by containsUnexpandedParameterPack(), and clang::Sema::DiagnoseUnexpandedParameterPack().

NestedNameSpecifier * NestedNameSpecifier::Create ( const ASTContext Context,
NestedNameSpecifier Prefix,
IdentifierInfo II 
) [static]

Builds a specifier combining a prefix and an identifier.

The prefix must be dependent, since nested name specifiers referencing an identifier are only permitted when the identifier cannot be resolved.

Definition at line 44 of file NestedNameSpecifier.cpp.

References isDependent().

Referenced by clang::Sema::BuildExpressionFromDeclTemplateArgument(), BuildSingleCopyAssign(), clang::NestedNameSpecifierLocBuilder::Extend(), clang::ASTContext::getCanonicalNestedNameSpecifier(), getRequiredQualification(), clang::ASTImporter::Import(), and clang::ASTReader::ReadNestedNameSpecifier().

NestedNameSpecifier * NestedNameSpecifier::Create ( const ASTContext Context,
NestedNameSpecifier Prefix,
NamespaceDecl NS 
) [static]

Builds a nested name specifier that names a namespace.

Definition at line 57 of file NestedNameSpecifier.cpp.

References getAsIdentifier(), and getAsType().

NestedNameSpecifier * NestedNameSpecifier::Create ( const ASTContext Context,
NestedNameSpecifier Prefix,
NamespaceAliasDecl Alias 
) [static]

Builds a nested name specifier that names a namespace alias.

Definition at line 71 of file NestedNameSpecifier.cpp.

References getAsIdentifier(), and getAsType().

NestedNameSpecifier * NestedNameSpecifier::Create ( const ASTContext Context,
NestedNameSpecifier Prefix,
bool  Template,
const Type T 
) [static]

Builds a nested name specifier that names a type.

Definition at line 86 of file NestedNameSpecifier.cpp.

NestedNameSpecifier * NestedNameSpecifier::Create ( const ASTContext Context,
IdentifierInfo II 
) [static]

Builds a specifier that consists of just an identifier.

The nested-name-specifier is assumed to be dependent, but has no prefix because the prefix is implied by something outside of the nested name specifier, e.g., in "x->Base::f", the "x" has a dependent type.

Definition at line 98 of file NestedNameSpecifier.cpp.

void NestedNameSpecifier::dump ( const LangOptions LO)

Dump the nested name specifier to standard output to aid in debugging.

Definition at line 285 of file NestedNameSpecifier.cpp.

References print().

IdentifierInfo* clang::NestedNameSpecifier::getAsIdentifier ( ) const [inline]
NamespaceDecl * NestedNameSpecifier::getAsNamespace ( ) const
NamespaceAliasDecl * NestedNameSpecifier::getAsNamespaceAlias ( ) const
const Type* clang::NestedNameSpecifier::getAsType ( ) const [inline]
NestedNameSpecifier::SpecifierKind NestedNameSpecifier::getKind ( ) const
NestedNameSpecifier* clang::NestedNameSpecifier::getPrefix ( ) const [inline]
NestedNameSpecifier * NestedNameSpecifier::GlobalSpecifier ( const ASTContext Context) [static]

Returns the nested name specifier representing the global scope.

Definition at line 108 of file NestedNameSpecifier.cpp.

Referenced by clang::ASTImporter::Import(), clang::NestedNameSpecifierLocBuilder::MakeGlobal(), and clang::ASTReader::ReadNestedNameSpecifier().

bool NestedNameSpecifier::isDependent ( ) const
bool NestedNameSpecifier::isInstantiationDependent ( ) const

Whether this nested name specifier involves a template parameter.

Whether this nested name specifier refers to a dependent type or not.

Definition at line 178 of file NestedNameSpecifier.cpp.

References getAsType(), getKind(), Global, Identifier, clang::Type::isInstantiationDependentType(), Namespace, NamespaceAlias, TypeSpec, and TypeSpecWithTemplate.

Referenced by clang::MemberExpr::Create().

void NestedNameSpecifier::print ( raw_ostream &  OS,
const PrintingPolicy Policy 
) const
void clang::NestedNameSpecifier::Profile ( llvm::FoldingSetNodeID &  ID) const [inline]

Definition at line 199 of file NestedNameSpecifier.h.


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