class NestedNameSpecifier

Declaration

class NestedNameSpecifier : public Node { /* full declaration omitted */ };

Description

Represents a C++ nested name specifier, such as "\::std::vector<int>::". C++ nested name specifiers are the prefixes to qualified names. 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.

Declared at: clang/include/clang/AST/NestedNameSpecifier.h:50

Inherits from: FoldingSetBase::Node

Member Variables

private llvm::PointerIntPair<NestedNameSpecifier*, 2, StoredSpecifierKind> Prefix
The pointer is the nested-name-specifier that precedes this one. The integer stores one of the first four values of type SpecifierKind.
private void* Specifier = nullptr
When the pointer is NULL, this specifier represents the global specifier '::'. Otherwise, the pointer is one of IdentifierInfo*, Namespace*, or Type*, depending on the kind of specifier as encoded within the prefix.

Method Overview

  • public static clang::NestedNameSpecifier * Create(const clang::ASTContext & Context, clang::NestedNameSpecifier * Prefix, clang::IdentifierInfo * II)
  • public static clang::NestedNameSpecifier * Create(const clang::ASTContext & Context, clang::NestedNameSpecifier * Prefix, const clang::NamespaceDecl * NS)
  • public static clang::NestedNameSpecifier * Create(const clang::ASTContext & Context, clang::NestedNameSpecifier * Prefix, clang::NamespaceAliasDecl * Alias)
  • public static clang::NestedNameSpecifier * Create(const clang::ASTContext & Context, clang::NestedNameSpecifier * Prefix, bool Template, const clang::Type * T)
  • public static clang::NestedNameSpecifier * Create(const clang::ASTContext & Context, clang::IdentifierInfo * II)
  • private static clang::NestedNameSpecifier * FindOrInsert(const clang::ASTContext & Context, const clang::NestedNameSpecifier & Mockup)
  • public static clang::NestedNameSpecifier * GlobalSpecifier(const clang::ASTContext & Context)
  • private NestedNameSpecifier(const clang::NestedNameSpecifier & Other)
  • private NestedNameSpecifier()
  • public void Profile(llvm::FoldingSetNodeID & ID) const
  • public static clang::NestedNameSpecifier * SuperSpecifier(const clang::ASTContext & Context, clang::CXXRecordDecl * RD)
  • public bool containsErrors() const
  • public bool containsUnexpandedParameterPack() const
  • public void dump(llvm::raw_ostream & OS, const clang::LangOptions & LO) const
  • public void dump(llvm::raw_ostream & OS) const
  • public void dump() const
  • public void dump(const clang::LangOptions & LO) const
  • public clang::IdentifierInfo * getAsIdentifier() const
  • public clang::NamespaceDecl * getAsNamespace() const
  • public clang::NamespaceAliasDecl * getAsNamespaceAlias() const
  • public clang::CXXRecordDecl * getAsRecordDecl() const
  • public const clang::Type * getAsType() const
  • public clang::NestedNameSpecifierDependence getDependence() const
  • public clang::NestedNameSpecifier::SpecifierKind getKind() const
  • public clang::NestedNameSpecifier * getPrefix() const
  • public bool isDependent() const
  • public bool isInstantiationDependent() const
  • public void print(llvm::raw_ostream & OS, const clang::PrintingPolicy & Policy, bool ResolveTemplateArguments = false) const

Inherited from FoldingSetBase::Node:

Methods

static clang::NestedNameSpecifier* Create(
    const clang::ASTContext& Context,
    clang::NestedNameSpecifier* Prefix,
    clang::IdentifierInfo* II)

Description

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.

Declared at: clang/include/clang/AST/NestedNameSpecifier.h:125

Parameters

const clang::ASTContext& Context
clang::NestedNameSpecifier* Prefix
clang::IdentifierInfo* II

static clang::NestedNameSpecifier* Create(
    const clang::ASTContext& Context,
    clang::NestedNameSpecifier* Prefix,
    const clang::NamespaceDecl* NS)

Description

Builds a nested name specifier that names a namespace.

Declared at: clang/include/clang/AST/NestedNameSpecifier.h:130

Parameters

const clang::ASTContext& Context
clang::NestedNameSpecifier* Prefix
const clang::NamespaceDecl* NS

static clang::NestedNameSpecifier* Create(
    const clang::ASTContext& Context,
    clang::NestedNameSpecifier* Prefix,
    clang::NamespaceAliasDecl* Alias)

Description

Builds a nested name specifier that names a namespace alias.

Declared at: clang/include/clang/AST/NestedNameSpecifier.h:135

Parameters

const clang::ASTContext& Context
clang::NestedNameSpecifier* Prefix
clang::NamespaceAliasDecl* Alias

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

Description

Builds a nested name specifier that names a type.

Declared at: clang/include/clang/AST/NestedNameSpecifier.h:140

Parameters

const clang::ASTContext& Context
clang::NestedNameSpecifier* Prefix
bool Template
const clang::Type* T

static clang::NestedNameSpecifier* Create(
    const clang::ASTContext& Context,
    clang::IdentifierInfo* II)

Description

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.

Declared at: clang/include/clang/AST/NestedNameSpecifier.h:150

Parameters

const clang::ASTContext& Context
clang::IdentifierInfo* II

static clang::NestedNameSpecifier* FindOrInsert(
    const clang::ASTContext& Context,
    const clang::NestedNameSpecifier& Mockup)

Description

Either find or insert the given nested name specifier mockup in the given context.

Declared at: clang/include/clang/AST/NestedNameSpecifier.h:114

Parameters

const clang::ASTContext& Context
const clang::NestedNameSpecifier& Mockup

static clang::NestedNameSpecifier*
GlobalSpecifier(const clang::ASTContext& Context)

Description

Returns the nested name specifier representing the global scope.

Declared at: clang/include/clang/AST/NestedNameSpecifier.h:155

Parameters

const clang::ASTContext& Context

NestedNameSpecifier(
    const clang::NestedNameSpecifier& Other)

Description

Copy constructor used internally to clone nested name specifiers.

Declared at: clang/include/clang/AST/NestedNameSpecifier.h:110

Parameters

const clang::NestedNameSpecifier& Other

NestedNameSpecifier()

Description

Builds the global specifier.

Declared at: clang/include/clang/AST/NestedNameSpecifier.h:106

void Profile(llvm::FoldingSetNodeID& ID) const

Declared at: clang/include/clang/AST/NestedNameSpecifier.h:228

Parameters

llvm::FoldingSetNodeID& ID

static clang::NestedNameSpecifier* SuperSpecifier(
    const clang::ASTContext& Context,
    clang::CXXRecordDecl* RD)

Description

Returns the nested name specifier representing the __super scope for the given CXXRecordDecl.

Declared at: clang/include/clang/AST/NestedNameSpecifier.h:159

Parameters

const clang::ASTContext& Context
clang::CXXRecordDecl* RD

bool containsErrors() const

Description

Whether this nested name specifier contains an error.

Declared at: clang/include/clang/AST/NestedNameSpecifier.h:219

bool containsUnexpandedParameterPack() const

Description

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

Declared at: clang/include/clang/AST/NestedNameSpecifier.h:216

void dump(llvm::raw_ostream& OS,
          const clang::LangOptions& LO) const

Declared at: clang/include/clang/AST/NestedNameSpecifier.h:238

Parameters

llvm::raw_ostream& OS
const clang::LangOptions& LO

void dump(llvm::raw_ostream& OS) const

Declared at: clang/include/clang/AST/NestedNameSpecifier.h:237

Parameters

llvm::raw_ostream& OS

void dump() const

Declared at: clang/include/clang/AST/NestedNameSpecifier.h:236

void dump(const clang::LangOptions& LO) const

Description

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

Declared at: clang/include/clang/AST/NestedNameSpecifier.h:235

Parameters

const clang::LangOptions& LO

clang::IdentifierInfo* getAsIdentifier() const

Description

Retrieve the identifier stored in this nested name specifier.

Declared at: clang/include/clang/AST/NestedNameSpecifier.h:176

clang::NamespaceDecl* getAsNamespace() const

Description

Retrieve the namespace stored in this nested name specifier.

Declared at: clang/include/clang/AST/NestedNameSpecifier.h:185

clang::NamespaceAliasDecl* getAsNamespaceAlias()
    const

Description

Retrieve the namespace alias stored in this nested name specifier.

Declared at: clang/include/clang/AST/NestedNameSpecifier.h:189

clang::CXXRecordDecl* getAsRecordDecl() const

Description

Retrieve the record declaration stored in this nested name specifier.

Declared at: clang/include/clang/AST/NestedNameSpecifier.h:193

const clang::Type* getAsType() const

Description

Retrieve the type stored in this nested name specifier.

Declared at: clang/include/clang/AST/NestedNameSpecifier.h:196

clang::NestedNameSpecifierDependence
getDependence() const

Declared at: clang/include/clang/AST/NestedNameSpecifier.h:204

clang::NestedNameSpecifier::SpecifierKind
getKind() const

Description

Determine what kind of nested name specifier is stored.

Declared at: clang/include/clang/AST/NestedNameSpecifier.h:172

clang::NestedNameSpecifier* getPrefix() const

Description

Return the prefix of this nested name specifier. The prefix contains all of the parts of the nested name specifier that precede this current specifier. For example, for a nested name specifier that represents "foo::bar::", the current specifier will contain "bar::" and the prefix will contain "foo::".

Declared at: clang/include/clang/AST/NestedNameSpecifier.h:169

bool isDependent() const

Description

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

Declared at: clang/include/clang/AST/NestedNameSpecifier.h:208

bool isInstantiationDependent() const

Description

Whether this nested name specifier involves a template parameter.

Declared at: clang/include/clang/AST/NestedNameSpecifier.h:212

void print(
    llvm::raw_ostream& OS,
    const clang::PrintingPolicy& Policy,
    bool ResolveTemplateArguments = false) const

Description

Print this nested name specifier to the given output stream. If `ResolveTemplateArguments` is true, we'll print actual types, e.g. `ns::SomeTemplate <int , MyClass>` instead of `ns::SomeTemplate <Container ::value_type, T>`.

Declared at: clang/include/clang/AST/NestedNameSpecifier.h:225

Parameters

llvm::raw_ostream& OS
const clang::PrintingPolicy& Policy
bool ResolveTemplateArguments = false