::". More...">

clang: clang::NestedNameSpecifier Class Reference (original) (raw)

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

#include "[clang/AST/NestedNameSpecifier.h](NestedNameSpecifier%5F8h%5Fsource.html)"

Public Member Functions
NestedNameSpecifier & operator= (const NestedNameSpecifier &)=delete
NestedNameSpecifier * getPrefix () const
Return the prefix of this nested name specifier.
SpecifierKind getKind () const
Determine what kind of nested name specifier is stored.
IdentifierInfo * getAsIdentifier () const
Retrieve the identifier stored in this nested name specifier.
NamespaceDecl * getAsNamespace () const
Retrieve the namespace stored in this nested name specifier.
NamespaceAliasDecl * getAsNamespaceAlias () const
Retrieve the namespace alias stored in this nested name specifier.
CXXRecordDecl * getAsRecordDecl () const
Retrieve the record declaration stored in this nested name specifier.
const Type * getAsType () const
Retrieve the type stored in this nested name specifier.
NestedNameSpecifierDependence getDependence () const
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++11 variadic templates).
bool containsErrors () const
Whether this nested name specifier contains an error.
void print (raw_ostream &OS, const PrintingPolicy &Policy, bool ResolveTemplateArguments=false) const
Print this nested name specifier to the given output stream.
void Profile (llvm::FoldingSetNodeID &ID) const
void dump (const LangOptions &LO) const
Dump the nested name specifier to standard output to aid in debugging.
void dump () const
void dump (llvm::raw_ostream &OS) const
void dump (llvm::raw_ostream &OS, const LangOptions &LO) const
Static Public Member Functions
static NestedNameSpecifier * Create (const ASTContext &Context, NestedNameSpecifier *Prefix, const IdentifierInfo *II)
Builds a specifier combining a prefix and an identifier.
static NestedNameSpecifier * Create (const ASTContext &Context, NestedNameSpecifier *Prefix, const NamespaceDecl *NS)
Builds a nested name specifier that names a namespace.
static NestedNameSpecifier * Create (const ASTContext &Context, NestedNameSpecifier *Prefix, const NamespaceAliasDecl *Alias)
Builds a nested name specifier that names a namespace alias.
static NestedNameSpecifier * Create (const ASTContext &Context, NestedNameSpecifier *Prefix, bool Template, const Type *T)
Builds a nested name specifier that names a type.
static NestedNameSpecifier * Create (const ASTContext &Context, const IdentifierInfo *II)
Builds a specifier that consists of just an identifier.
static NestedNameSpecifier * GlobalSpecifier (const ASTContext &Context)
Returns the nested name specifier representing the global scope.
static NestedNameSpecifier * SuperSpecifier (const ASTContext &Context, CXXRecordDecl *RD)
Returns the nested name specifier representing the __super scope for the given CXXRecordDecl.

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

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 50 of file NestedNameSpecifier.h.

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 79 of file NestedNameSpecifier.h.

containsErrors()

bool NestedNameSpecifier::containsErrors ( ) const

containsUnexpandedParameterPack()

bool NestedNameSpecifier::containsUnexpandedParameterPack ( ) const

Create() [1/5]

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

Create() [2/5]

Create() [3/5]

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

References isDependent().

Referenced by clang::Sema::ActOnMSVCUnknownTypeName(), clang::Sema::BuildExpressionFromDeclTemplateArgument(), buildSingleCopyAssignRecursively(), clang::Sema::BuildStdInitializerList(), clang::Sema::CheckComparisonCategoryType(), clang::TypeName::createNestedNameSpecifier(), clang::NestedNameSpecifierLocBuilder::Extend(), clang::ASTContext::getCanonicalNestedNameSpecifier(), getRequiredQualification(), clang::ASTImporter::Import(), lookupPromiseType(), clang::serialization::DataStreamBasicReader< Impl >::readNestedNameSpecifier(), recoverFromMSUnqualifiedLookup(), recoverFromTypeInKnownDependentBase(), and synthesizeCurrentNestedNameSpecifier().

Create() [4/5]

Create() [5/5]

dump() [1/4]

LLVM_DUMP_METHOD void NestedNameSpecifier::dump ( ) const

dump() [2/4]

LLVM_DUMP_METHOD void NestedNameSpecifier::dump ( const LangOptions & LO ) const

dump() [3/4]

LLVM_DUMP_METHOD void NestedNameSpecifier::dump ( llvm::raw_ostream & OS ) const

dump() [4/4]

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

getAsIdentifier()

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

Retrieve the identifier stored in this nested name specifier.

Definition at line 176 of file NestedNameSpecifier.h.

References Specifier.

Referenced by clang::ODRHash::AddNestedNameSpecifier(), clang::ASTRecordWriter::AddNestedNameSpecifierLoc(), Create(), clang::Sema::FindFirstQualifierInScope(), clang::ASTContext::getCanonicalNestedNameSpecifier(), GetFullTypeForDeclarator(), clang::Sema::getInheritingConstructorName(), getNestedNameSpecifierIdentifiers(), clang::ASTImporter::Import(), isSameQualifier(), IsStructurallyEquivalent(), print(), clang::TreeTransform< Derived >::TransformNestedNameSpecifierLoc(), and clang::serialization::DataStreamBasicWriter< Impl >::writeNestedNameSpecifier().

getAsNamespace()

Retrieve the namespace stored in this nested name specifier.

Definition at line 167 of file NestedNameSpecifier.cpp.

Referenced by clang::ODRHash::AddNestedNameSpecifier(), clang::ASTRecordWriter::AddNestedNameSpecifierLoc(), clang::Sema::computeDeclContext(), clang::ASTContext::getCanonicalNestedNameSpecifier(), getNestedNameSpecifierIdentifiers(), clang::ASTImporter::Import(), clang::index::IndexingContext::indexNestedNameSpecifierLoc(), IsStructurallyEquivalent(), print(), clang::TreeTransform< Derived >::TransformNestedNameSpecifierLoc(), clang::tooling::RecursiveSymbolVisitor< T >::TraverseNestedNameSpecifierLoc(), and clang::serialization::DataStreamBasicWriter< Impl >::writeNestedNameSpecifier().

getAsNamespaceAlias()

Retrieve the namespace alias stored in this nested name specifier.

Definition at line 175 of file NestedNameSpecifier.cpp.

Referenced by clang::ODRHash::AddNestedNameSpecifier(), clang::ASTRecordWriter::AddNestedNameSpecifierLoc(), clang::Sema::computeDeclContext(), clang::ASTContext::getCanonicalNestedNameSpecifier(), getNestedNameSpecifierIdentifiers(), clang::ASTImporter::Import(), clang::index::IndexingContext::indexNestedNameSpecifierLoc(), IsStructurallyEquivalent(), print(), clang::TreeTransform< Derived >::TransformNestedNameSpecifierLoc(), and clang::serialization::DataStreamBasicWriter< Impl >::writeNestedNameSpecifier().

getAsRecordDecl()

Retrieve the record declaration stored in this nested name specifier.

Definition at line 183 of file NestedNameSpecifier.cpp.

References clang::Type::getAsCXXRecordDecl(), and getAsType().

Referenced by clang::ASTRecordWriter::AddNestedNameSpecifierLoc(), clang::Sema::computeDeclContext(), clang::CXXRecordDecl::FindBaseClass(), clang::CXXRecordDecl::FindVirtualBaseClass(), clang::ConstructorUsingShadowDecl::getNominatedBaseClass(), clang::ASTImporter::Import(), IsStructurallyEquivalent(), print(), clang::TreeTransform< Derived >::TransformNestedNameSpecifierLoc(), and clang::serialization::DataStreamBasicWriter< Impl >::writeNestedNameSpecifier().

getAsType()

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

Retrieve the type stored in this nested name specifier.

Definition at line 196 of file NestedNameSpecifier.h.

References Specifier.

Referenced by clang::TypoCorrectionConsumer::addNamespaces(), clang::ODRHash::AddNestedNameSpecifier(), clang::Sema::CheckInheritingConstructorUsingDecl(), clang::Sema::CheckTypenameType(), clang::SemaCodeCompletion::CodeCompleteQualifiedId(), clang::Sema::computeDeclContext(), Create(), clang::Sema::DiagnoseEmptyLookup(), clang::Sema::diagnoseQualifiedDeclaration(), getAsRecordDecl(), clang::ASTContext::getCanonicalNestedNameSpecifier(), clang::Sema::getCurrentInstantiationOf(), getDependence(), GetFullTypeForDeclarator(), clang::Sema::getInheritingConstructorName(), clang::UnresolvedMemberExpr::getNamingClass(), getNestedNameSpecifierIdentifiers(), clang::ASTImporter::Import(), isEnableIf(), clang::Sema::isMicrosoftMissingTypename(), isSameQualifier(), IsStructurallyEquivalent(), clang::NestedNameSpecifierLocBuilder::MakeTrivial(), MarkUsedTemplateParameters(), clang::Sema::MatchTemplateParametersToScopeSpecifier(), print(), ScopeSpecifierHasTemplateId(), clang::RecursiveASTVisitor< Derived >::TraverseNestedNameSpecifier(), and clang::serialization::DataStreamBasicWriter< Impl >::writeNestedNameSpecifier().

getDependence()

NestedNameSpecifierDependence NestedNameSpecifier::getDependence ( ) const

Definition at line 199 of file NestedNameSpecifier.cpp.

References clang::CXXRecordDecl::bases(), getAsType(), getDependence(), getKind(), getPrefix(), Global, Identifier, Namespace, NamespaceAlias, Super, clang::toNestedNameSpecifierDependendence(), TypeSpec, and TypeSpecWithTemplate.

Referenced by containsErrors(), containsUnexpandedParameterPack(), getDependence(), isDependent(), and isInstantiationDependent().

getKind()

Determine what kind of nested name specifier is stored.

Definition at line 141 of file NestedNameSpecifier.cpp.

References Global, Identifier, Namespace, NamespaceAlias, Super, TypeSpec, and TypeSpecWithTemplate.

Referenced by clang::ODRHash::AddNestedNameSpecifier(), clang::ASTRecordWriter::AddNestedNameSpecifierLoc(), clang::Sema::checkLiteralOperatorId(), clang::Sema::computeDeclContext(), clang::Sema::diagnoseQualifiedDeclaration(), clang::TextNodeDumper::dumpNestedNameSpecifier(), clang::Sema::FindFirstQualifierInScope(), clang::ASTContext::getCanonicalNestedNameSpecifier(), getDependence(), GetFullTypeForDeclarator(), clang::Sema::getInheritingConstructorName(), getNestedNameSpecifierIdentifiers(), clang::ASTImporter::Import(), clang::index::IndexingContext::indexNestedNameSpecifierLoc(), isFullyQualified(), clang::Sema::isMicrosoftMissingTypename(), isSameQualifier(), IsStructurallyEquivalent(), clang::Sema::LookupParsedName(), clang::NestedNameSpecifierLocBuilder::MakeTrivial(), print(), clang::TreeTransform< Derived >::TransformNestedNameSpecifierLoc(), clang::RecursiveASTVisitor< Derived >::TraverseNestedNameSpecifier(), clang::RecursiveASTVisitor< Derived >::TraverseNestedNameSpecifierLoc(), and clang::serialization::DataStreamBasicWriter< Impl >::writeNestedNameSpecifier().

getPrefix()

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::".

Definition at line 169 of file NestedNameSpecifier.h.

Referenced by clang::ODRHash::AddNestedNameSpecifier(), clang::TextNodeDumper::dumpNestedNameSpecifier(), clang::Sema::FindFirstQualifierInScope(), clang::ASTContext::getCanonicalNestedNameSpecifier(), getDependence(), clang::Sema::getDestructorName(), GetFullTypeForDeclarator(), clang::Sema::getInheritingConstructorName(), getNestedNameSpecifierIdentifiers(), clang::ASTImporter::Import(), isFullyQualified(), isSameQualifier(), IsStructurallyEquivalent(), clang::NestedNameSpecifierLocBuilder::MakeTrivial(), MarkUsedTemplateParameters(), print(), ScopeSpecifierHasTemplateId(), clang::RecursiveASTVisitor< Derived >::TraverseNestedNameSpecifier(), and clang::serialization::DataStreamBasicWriter< Impl >::writeNestedNameSpecifier().

GlobalSpecifier()

isDependent()

bool NestedNameSpecifier::isDependent ( ) const

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

Definition at line 232 of file NestedNameSpecifier.cpp.

References getDependence().

Referenced by clang::Sema::ActOnFriendFunctionDecl(), clang::Sema::BuildMemberReferenceExpr(), clang::Sema::CheckTypenameType(), clang::Sema::CheckUsingDeclRedeclaration(), clang::SemaCodeCompletion::CodeCompleteQualifiedId(), clang::Sema::computeDeclContext(), Create(), clang::Sema::getCurrentInstantiationOf(), clang::ASTContext::getDependentTemplateName(), clang::ASTContext::getDependentTemplateSpecializationType(), clang::Sema::isDependentScopeSpecifier(), and clang::TreeTransform< Derived >::RebuildDependentNameType().

isInstantiationDependent()

bool NestedNameSpecifier::isInstantiationDependent ( ) const

operator=()

print()

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

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

Definition at line 250 of file NestedNameSpecifier.cpp.

References getAsIdentifier(), getAsNamespace(), getAsNamespaceAlias(), getAsRecordDecl(), getAsType(), getKind(), clang::NamedDecl::getName(), clang::IdentifierInfo::getName(), getPrefix(), Global, Identifier, Namespace, NamespaceAlias, clang::TemplateName::None, print(), clang::QualType::print(), clang::printTemplateArgumentList(), Super, clang::PrintingPolicy::SuppressScope, clang::T, TypeSpec, and TypeSpecWithTemplate.

Referenced by dump(), clang::FormatASTNodeDiagnosticArgument(), clang::TypoCorrection::getAsString(), MaybeAddOverrideCalls(), clang::ConceptReference::print(), print(), PrintMapper(), and printQualifier().

Profile()

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

SuperSpecifier()


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