clang
7.0.0
|
Represents a C++ nested name specifier, such as "\::std::vector<int>::". More...
#include "clang/AST/NestedNameSpecifier.h"
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 | |
NestedNameSpecifier & | operator= (const NestedNameSpecifier &)=delete |
NestedNameSpecifier * | getPrefix () const |
Return the prefix of this nested name specifier. More... | |
SpecifierKind | getKind () const |
Determine what kind of nested name specifier is stored. More... | |
IdentifierInfo * | getAsIdentifier () const |
Retrieve the identifier stored in this nested name specifier. More... | |
NamespaceDecl * | getAsNamespace () const |
Retrieve the namespace stored in this nested name specifier. More... | |
NamespaceAliasDecl * | getAsNamespaceAlias () const |
Retrieve the namespace alias stored in this nested name specifier. More... | |
CXXRecordDecl * | getAsRecordDecl () const |
Retrieve the record declaration stored in this nested name specifier. More... | |
const Type * | getAsType () 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 NestedNameSpecifier * | Create (const ASTContext &Context, NestedNameSpecifier *Prefix, IdentifierInfo *II) |
Builds a specifier combining a prefix and an identifier. More... | |
static NestedNameSpecifier * | Create (const ASTContext &Context, NestedNameSpecifier *Prefix, const NamespaceDecl *NS) |
Builds a nested name specifier that names a namespace. More... | |
static NestedNameSpecifier * | Create (const ASTContext &Context, NestedNameSpecifier *Prefix, NamespaceAliasDecl *Alias) |
Builds a nested name specifier that names a namespace alias. More... | |
static NestedNameSpecifier * | Create (const ASTContext &Context, NestedNameSpecifier *Prefix, bool Template, const Type *T) |
Builds a nested name specifier that names a type. More... | |
static NestedNameSpecifier * | Create (const ASTContext &Context, IdentifierInfo *II) |
Builds a specifier that consists of just an identifier. More... | |
static NestedNameSpecifier * | GlobalSpecifier (const ASTContext &Context) |
Returns the nested name specifier representing the global scope. More... | |
static NestedNameSpecifier * | SuperSpecifier (const ASTContext &Context, CXXRecordDecl *RD) |
Returns the nested name specifier representing the __super scope for the given CXXRecordDecl. More... | |
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.
The kind of specifier that completes this nested name specifier.
Definition at line 78 of file NestedNameSpecifier.h.
bool NestedNameSpecifier::containsUnexpandedParameterPack | ( | ) | const |
Whether this nested-name-specifier contains an unexpanded parameter pack (for C++11 variadic templates).
Definition at line 252 of file NestedNameSpecifier.cpp.
References containsUnexpandedParameterPack(), clang::Type::containsUnexpandedParameterPack(), getAsType(), getKind(), getPrefix(), Global, Identifier, Namespace, NamespaceAlias, Super, TypeSpec, and TypeSpecWithTemplate.
Referenced by containsUnexpandedParameterPack(), clang::Sema::DiagnoseUnexpandedParameterPack(), getAsType(), clang::CXXUnresolvedConstructExpr::getBeginLoc(), and clang::OverloadExpr::getNamingClass().
|
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().
|
static |
Builds a nested name specifier that names a namespace.
Definition at line 71 of file NestedNameSpecifier.cpp.
References getAsIdentifier(), and getAsType().
|
static |
Builds a nested name specifier that names a namespace alias.
Definition at line 87 of file NestedNameSpecifier.cpp.
References getAsIdentifier(), and getAsType().
|
static |
Builds a nested name specifier that names a type.
Definition at line 103 of file NestedNameSpecifier.cpp.
|
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.
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().
LLVM_DUMP_METHOD void NestedNameSpecifier::dump | ( | ) | const |
Definition at line 346 of file NestedNameSpecifier.cpp.
References clang::NestedNameSpecifierLoc::getDataLength(), getKind(), getPrefix(), Global, Identifier, Namespace, NamespaceAlias, print(), Super, TypeSpec, and TypeSpecWithTemplate.
Referenced by Profile().
|
inline |
Retrieve the identifier stored in this nested name specifier.
Definition at line 175 of file NestedNameSpecifier.h.
References getAsNamespace(), getAsNamespaceAlias(), and getAsRecordDecl().
Referenced by clang::ODRHash::AddNestedNameSpecifier(), clang::ASTRecordWriter::AddNestedNameSpecifier(), clang::ASTRecordWriter::AddNestedNameSpecifierLoc(), Create(), clang::ASTContext::getCanonicalNestedNameSpecifier(), getNestedNameSpecifierIdentifiers(), clang::ASTImporter::Import(), isSameQualifier(), print(), and clang::TreeTransform< Derived >::TransformNestedNameSpecifierLoc().
NamespaceDecl * NestedNameSpecifier::getAsNamespace | ( | ) | const |
Retrieve the namespace stored in this nested name specifier.
Definition at line 168 of file NestedNameSpecifier.cpp.
Referenced by clang::ODRHash::AddNestedNameSpecifier(), clang::ASTRecordWriter::AddNestedNameSpecifier(), clang::ASTRecordWriter::AddNestedNameSpecifierLoc(), clang::Sema::computeDeclContext(), getAsIdentifier(), clang::ASTContext::getCanonicalNestedNameSpecifier(), clang::TypeName::getFullyQualifiedNestedNameSpecifier(), getNamespace(), getNestedNameSpecifierIdentifiers(), clang::ASTImporter::Import(), clang::index::IndexingContext::indexNestedNameSpecifierLoc(), print(), clang::TreeTransform< Derived >::TransformNestedNameSpecifierLoc(), and clang::tooling::RecursiveSymbolVisitor< T >::TraverseNestedNameSpecifierLoc().
NamespaceAliasDecl * NestedNameSpecifier::getAsNamespaceAlias | ( | ) | const |
Retrieve the namespace alias stored in this nested name specifier.
Definition at line 176 of file NestedNameSpecifier.cpp.
Referenced by clang::ODRHash::AddNestedNameSpecifier(), clang::ASTRecordWriter::AddNestedNameSpecifier(), clang::ASTRecordWriter::AddNestedNameSpecifierLoc(), clang::Sema::computeDeclContext(), getAsIdentifier(), clang::ASTContext::getCanonicalNestedNameSpecifier(), clang::TypeName::getFullyQualifiedNestedNameSpecifier(), getNamespace(), getNestedNameSpecifierIdentifiers(), clang::ASTImporter::Import(), clang::index::IndexingContext::indexNestedNameSpecifierLoc(), print(), and clang::TreeTransform< Derived >::TransformNestedNameSpecifierLoc().
CXXRecordDecl * NestedNameSpecifier::getAsRecordDecl | ( | ) | const |
Retrieve the record declaration stored in this nested name specifier.
Definition at line 184 of file NestedNameSpecifier.cpp.
References clang::Type::getAsCXXRecordDecl(), and getAsType().
Referenced by clang::ASTRecordWriter::AddNestedNameSpecifier(), clang::ASTRecordWriter::AddNestedNameSpecifierLoc(), clang::Sema::BuildUsingShadowDecl(), clang::Sema::computeDeclContext(), getAsIdentifier(), clang::ConstructorUsingShadowDecl::getNominatedBaseClass(), clang::ASTImporter::Import(), clang::Sema::LookupParsedName(), and clang::TreeTransform< Derived >::TransformNestedNameSpecifierLoc().
|
inline |
Retrieve the type stored in this nested name specifier.
Definition at line 195 of file NestedNameSpecifier.h.
References containsUnexpandedParameterPack(), isDependent(), isInstantiationDependent(), and print().
Referenced by clang::TypoCorrectionConsumer::addNamespaces(), clang::ODRHash::AddNestedNameSpecifier(), clang::ASTRecordWriter::AddNestedNameSpecifier(), clang::CodeGen::CodeGenFunction::BuildAppleKextVirtualCall(), clang::Sema::CheckInheritingConstructorUsingDecl(), clang::Sema::computeDeclContext(), containsUnexpandedParameterPack(), Create(), findDirectBaseWithType(), getAsRecordDecl(), clang::ASTContext::getCanonicalNestedNameSpecifier(), clang::Sema::getCurrentInstantiationOf(), clang::TypeName::getFullyQualifiedNestedNameSpecifier(), clang::NestedNameSpecifierLoc::getLocalSourceRange(), getNestedNameSpecifierIdentifiers(), clang::NestedNameSpecifierLoc::getTypeLoc(), clang::ASTImporter::Import(), isDependent(), isEnableIf(), isInstantiationDependent(), isSameQualifier(), MarkUsedTemplateParameters(), print(), clang::TreeTransform< Derived >::RebuildDependentNameType(), ScopeSpecifierHasTemplateId(), and clang::RecursiveASTVisitor< CallGraph >::TraverseNestedNameSpecifier().
NestedNameSpecifier::SpecifierKind NestedNameSpecifier::getKind | ( | ) | const |
Determine what kind of nested name specifier is stored.
Definition at line 142 of file NestedNameSpecifier.cpp.
References Global, Identifier, Namespace, NamespaceAlias, Super, TypeSpec, and TypeSpecWithTemplate.
Referenced by clang::Sema::ActOnUsingDirective(), clang::ODRHash::AddNestedNameSpecifier(), clang::ASTRecordWriter::AddNestedNameSpecifier(), clang::ASTRecordWriter::AddNestedNameSpecifierLoc(), clang::CodeGen::CodeGenFunction::BuildAppleKextVirtualCall(), clang::Sema::computeDeclContext(), containsUnexpandedParameterPack(), dump(), clang::ASTContext::getCanonicalNestedNameSpecifier(), clang::TypeName::getFullyQualifiedNestedNameSpecifier(), clang::NestedNameSpecifierLoc::getLocalSourceRange(), getNestedNameSpecifierIdentifiers(), getPrefix(), clang::NestedNameSpecifierLoc::getTypeLoc(), clang::ASTImporter::Import(), clang::index::IndexingContext::indexNestedNameSpecifierLoc(), isDependent(), isFullyQualified(), isInstantiationDependent(), isSameQualifier(), clang::Sema::LookupParsedName(), print(), clang::TreeTransform< Derived >::TransformNestedNameSpecifierLoc(), clang::RecursiveASTVisitor< CallGraph >::TraverseNestedNameSpecifier(), and clang::RecursiveASTVisitor< CallGraph >::TraverseNestedNameSpecifierLoc().
|
inline |
Return the prefix of this nested name specifier.
The prefix contains all of the parts of the nested name specifier that preced 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 168 of file NestedNameSpecifier.h.
References getKind().
Referenced by clang::ODRHash::AddNestedNameSpecifier(), clang::ASTRecordWriter::AddNestedNameSpecifier(), containsUnexpandedParameterPack(), dump(), clang::ASTContext::getCanonicalNestedNameSpecifier(), clang::TypeName::getFullyQualifiedNestedNameSpecifier(), clang::NestedNameSpecifierLoc::getLocalSourceRange(), getNestedNameSpecifierIdentifiers(), clang::NestedNameSpecifierLoc::getPrefix(), clang::NestedNameSpecifierLoc::getTypeLoc(), clang::ASTImporter::Import(), isFullyQualified(), isSameQualifier(), MarkUsedTemplateParameters(), print(), ScopeSpecifierHasTemplateId(), clang::RecursiveASTVisitor< CallGraph >::TraverseNestedNameSpecifier(), and warnAboutRedundantParens().
|
static |
Returns the nested name specifier representing the global scope.
Definition at line 125 of file NestedNameSpecifier.cpp.
Referenced by clang::TypeName::createNestedNameSpecifierForScopeOf(), clang::TypeName::createOuterNNS(), clang::ASTImporter::Import(), and clang::NestedNameSpecifierLocBuilder::MakeGlobal().
bool NestedNameSpecifier::isDependent | ( | ) | const |
Whether this nested name specifier refers to a dependent type or not.
Definition at line 202 of file NestedNameSpecifier.cpp.
References clang::CXXRecordDecl::bases(), getAsType(), getKind(), Global, Identifier, clang::Type::isDependentType(), Namespace, NamespaceAlias, Super, TypeSpec, and TypeSpecWithTemplate.
Referenced by clang::Sema::CheckTypenameType(), clang::Sema::CheckUsingDeclRedeclaration(), clang::Sema::computeDeclContext(), Create(), getAsType(), clang::Sema::getCurrentInstantiationOf(), clang::ASTContext::getDependentTemplateName(), clang::Sema::isDependentScopeSpecifier(), and clang::TreeTransform< Derived >::RebuildDependentNameType().
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().
|
delete |
void NestedNameSpecifier::print | ( | raw_ostream & | OS, |
const PrintingPolicy & | Policy | ||
) | const |
Print this nested name specifier to the given output stream.
Definition at line 274 of file NestedNameSpecifier.cpp.
References getAsIdentifier(), getAsNamespace(), getAsNamespaceAlias(), getAsType(), getKind(), clang::IdentifierInfo::getName(), clang::NamedDecl::getName(), getPrefix(), Global, Identifier, Namespace, NamespaceAlias, print(), clang::QualType::print(), clang::printTemplateArgumentList(), Super, clang::PrintingPolicy::SuppressScope, TypeSpec, and TypeSpecWithTemplate.
Referenced by dump(), clang::FormatASTNodeDiagnosticArgument(), getAsType(), clang::getParameterABISpelling(), and print().
|
inline |
Definition at line 219 of file NestedNameSpecifier.h.
References dump().
|
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().