clang  6.0.0svn
Public Types | Public Member Functions | Static Public Member Functions | List of all members
clang::NestedNameSpecifier Class Reference

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

#include "clang/AST/NestedNameSpecifier.h"

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

Public Types

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

Public Member Functions

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

Static Public Member Functions

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

Detailed 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.

Definition at line 49 of file NestedNameSpecifier.h.

Member Enumeration Documentation

◆ SpecifierKind

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.

Super 

Microsoft's '__super' specifier, stored as a CXXRecordDecl* of the class it appeared in.

Definition at line 78 of file NestedNameSpecifier.h.

Member Function Documentation

◆ containsUnexpandedParameterPack()

bool NestedNameSpecifier::containsUnexpandedParameterPack ( ) const

◆ Create() [1/5]

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 58 of file NestedNameSpecifier.cpp.

References isDependent().

Referenced by clang::TypeName::createNestedNameSpecifier(), clang::NestedNameSpecifierLocBuilder::Extend(), clang::ASTContext::getCanonicalNestedNameSpecifier(), and clang::ASTImporter::Import().

◆ Create() [2/5]

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

Builds a nested name specifier that names a namespace.

Definition at line 71 of file NestedNameSpecifier.cpp.

References getAsIdentifier(), and getAsType().

◆ Create() [3/5]

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

Builds a nested name specifier that names a namespace alias.

Definition at line 87 of file NestedNameSpecifier.cpp.

References getAsIdentifier(), and getAsType().

◆ Create() [4/5]

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 103 of file NestedNameSpecifier.cpp.

References clang::T.

◆ Create() [5/5]

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 115 of file NestedNameSpecifier.cpp.

◆ dump() [1/2]

void NestedNameSpecifier::dump ( const LangOptions LO) const

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

Definition at line 342 of file NestedNameSpecifier.cpp.

References print().

◆ dump() [2/2]

LLVM_DUMP_METHOD void NestedNameSpecifier::dump ( ) const

Definition at line 346 of file NestedNameSpecifier.cpp.

References print().

Referenced by Profile().

◆ getAsIdentifier()

IdentifierInfo* clang::NestedNameSpecifier::getAsIdentifier ( ) const
inline

◆ getAsNamespace()

NamespaceDecl * NestedNameSpecifier::getAsNamespace ( ) const

◆ getAsNamespaceAlias()

NamespaceAliasDecl * NestedNameSpecifier::getAsNamespaceAlias ( ) const

◆ getAsRecordDecl()

CXXRecordDecl * NestedNameSpecifier::getAsRecordDecl ( ) const

◆ getAsType()

const Type* clang::NestedNameSpecifier::getAsType ( ) const
inline

◆ getKind()

NestedNameSpecifier::SpecifierKind NestedNameSpecifier::getKind ( ) const

◆ getPrefix()

NestedNameSpecifier* clang::NestedNameSpecifier::getPrefix ( ) const
inline

◆ GlobalSpecifier()

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

◆ isDependent()

bool NestedNameSpecifier::isDependent ( ) const

◆ isInstantiationDependent()

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 232 of file NestedNameSpecifier.cpp.

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

Referenced by getAsType(), and clang::OverloadExpr::getNamingClass().

◆ operator=()

NestedNameSpecifier& clang::NestedNameSpecifier::operator= ( const NestedNameSpecifier )
delete

◆ print()

void NestedNameSpecifier::print ( raw_ostream &  OS,
const PrintingPolicy Policy 
) const

◆ Profile()

void clang::NestedNameSpecifier::Profile ( llvm::FoldingSetNodeID &  ID) const
inline

Definition at line 219 of file NestedNameSpecifier.h.

References dump().

◆ SuperSpecifier()

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

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

Definition at line 133 of file NestedNameSpecifier.cpp.

Referenced by clang::ASTImporter::Import(), and clang::NestedNameSpecifierLocBuilder::MakeSuper().


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