clang API Documentation
Represents a C++ nested name specifier, such as "\::std::vector<int>::". More...
#include <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 * | 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. | |
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). | |
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 NestedNameSpecifier * | Create (const ASTContext &Context, NestedNameSpecifier *Prefix, 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, 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, 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<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 44 of file NestedNameSpecifier.h.
The kind of specifier that completes this nested name specifier.
Definition at line 74 of file NestedNameSpecifier.h.
Whether this nested-name-specifier contains an unexpanded parameter pack (for C++11 variadic templates).
Definition at line 232 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::containsUnexpandedParameterPacks(), 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 46 of file NestedNameSpecifier.cpp.
References isDependent().
Referenced by clang::Sema::BuildExpressionFromDeclTemplateArgument(), buildSingleCopyAssignRecursively(), clang::NestedNameSpecifierLocBuilder::Extend(), clang::ASTContext::getCanonicalNestedNameSpecifier(), getRequiredQualification(), clang::ASTImporter::Import(), clang::ASTReader::ReadNestedNameSpecifier(), recoverFromMSUnqualifiedLookup(), recoverFromTypeInKnownDependentBase(), and synthesizeCurrentNestedNameSpecifier().
NestedNameSpecifier * NestedNameSpecifier::Create | ( | const ASTContext & | Context, |
NestedNameSpecifier * | Prefix, | ||
const NamespaceDecl * | NS | ||
) | [static] |
Builds a nested name specifier that names a namespace.
Definition at line 59 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 75 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 91 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 103 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 321 of file NestedNameSpecifier.cpp.
References print().
IdentifierInfo* clang::NestedNameSpecifier::getAsIdentifier | ( | ) | const [inline] |
Retrieve the identifier stored in this nested name specifier.
Definition at line 169 of file NestedNameSpecifier.h.
Referenced by clang::ASTWriter::AddNestedNameSpecifier(), clang::ASTWriter::AddNestedNameSpecifierLoc(), Create(), clang::Sema::FindFirstQualifierInScope(), clang::ASTContext::getCanonicalNestedNameSpecifier(), GetFullTypeForDeclarator(), clang::Sema::getInheritingConstructorName(), 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 157 of file NestedNameSpecifier.cpp.
Referenced by clang::ASTWriter::AddNestedNameSpecifier(), clang::ASTWriter::AddNestedNameSpecifierLoc(), clang::Sema::computeDeclContext(), clang::ASTContext::getCanonicalNestedNameSpecifier(), getNamespace(), getNestedNameSpecifierIdentifiers(), clang::ASTImporter::Import(), print(), and clang::TreeTransform< Derived >::TransformNestedNameSpecifierLoc().
Retrieve the namespace alias stored in this nested name specifier.
Definition at line 165 of file NestedNameSpecifier.cpp.
Referenced by clang::ASTWriter::AddNestedNameSpecifier(), clang::ASTWriter::AddNestedNameSpecifierLoc(), clang::Sema::computeDeclContext(), clang::ASTContext::getCanonicalNestedNameSpecifier(), getNamespace(), getNestedNameSpecifierIdentifiers(), clang::ASTImporter::Import(), print(), and clang::TreeTransform< Derived >::TransformNestedNameSpecifierLoc().
CXXRecordDecl * NestedNameSpecifier::getAsRecordDecl | ( | ) | const |
Retrieve the record declaration stored in this nested name specifier.
Definition at line 173 of file NestedNameSpecifier.cpp.
Referenced by clang::ASTWriter::AddNestedNameSpecifier(), clang::ASTWriter::AddNestedNameSpecifierLoc(), clang::Sema::CheckTypenameType(), clang::Sema::computeDeclContext(), clang::ASTImporter::Import(), clang::Sema::LookupParsedName(), and clang::TreeTransform< Derived >::TransformNestedNameSpecifierLoc().
const Type* clang::NestedNameSpecifier::getAsType | ( | ) | const [inline] |
Retrieve the type stored in this nested name specifier.
Definition at line 189 of file NestedNameSpecifier.h.
Referenced by clang::ASTWriter::AddNestedNameSpecifier(), clang::CodeGen::CodeGenFunction::BuildAppleKextVirtualCall(), clang::Sema::CheckInheritingConstructorUsingDecl(), clang::Sema::computeDeclContext(), containsUnexpandedParameterPack(), Create(), clang::Sema::DiagnoseEmptyLookup(), clang::ASTContext::getCanonicalNestedNameSpecifier(), clang::Sema::getCurrentInstantiationOf(), GetFullTypeForDeclarator(), clang::Sema::getInheritingConstructorName(), clang::NestedNameSpecifierLoc::getLocalSourceRange(), clang::UnresolvedMemberExpr::getNamingClass(), getNestedNameSpecifierIdentifiers(), clang::NestedNameSpecifierLoc::getTypeLoc(), clang::ASTImporter::Import(), isDependent(), isEnableIf(), isInstantiationDependent(), clang::Sema::isMicrosoftMissingTypename(), isSameQualifier(), clang::NestedNameSpecifierLocBuilder::MakeTrivial(), MarkUsedTemplateParameters(), clang::Sema::MatchTemplateParametersToScopeSpecifier(), clang::Sema::PerformObjectMemberConversion(), print(), ScopeSpecifierHasTemplateId(), and clang::RecursiveASTVisitor< Derived >::TraverseNestedNameSpecifier().
Determine what kind of nested name specifier is stored.
Definition at line 131 of file NestedNameSpecifier.cpp.
References Global, Identifier, Namespace, NamespaceAlias, Super, TypeSpec, and TypeSpecWithTemplate.
Referenced by clang::Sema::ActOnUsingDirective(), clang::ASTWriter::AddNestedNameSpecifier(), clang::ASTWriter::AddNestedNameSpecifierLoc(), clang::CodeGen::CodeGenFunction::BuildAppleKextVirtualCall(), clang::Sema::checkLiteralOperatorId(), clang::Sema::CheckTypenameType(), clang::Sema::computeDeclContext(), containsUnexpandedParameterPack(), clang::Sema::FindFirstQualifierInScope(), clang::ASTContext::getCanonicalNestedNameSpecifier(), GetFullTypeForDeclarator(), clang::Sema::getInheritingConstructorName(), clang::NestedNameSpecifierLoc::getLocalSourceRange(), getNestedNameSpecifierIdentifiers(), clang::NestedNameSpecifierLoc::getTypeLoc(), clang::ASTImporter::Import(), isDependent(), isInstantiationDependent(), clang::Sema::isMicrosoftMissingTypename(), isSameQualifier(), clang::Sema::LookupParsedName(), clang::NestedNameSpecifierLocBuilder::MakeTrivial(), print(), clang::TreeTransform< Derived >::TransformNestedNameSpecifierLoc(), clang::RecursiveASTVisitor< Derived >::TraverseNestedNameSpecifier(), and clang::RecursiveASTVisitor< Derived >::TraverseNestedNameSpecifierLoc().
NestedNameSpecifier* clang::NestedNameSpecifier::getPrefix | ( | ) | const [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 162 of file NestedNameSpecifier.h.
Referenced by clang::ASTWriter::AddNestedNameSpecifier(), containsUnexpandedParameterPack(), clang::Sema::FindFirstQualifierInScope(), clang::ASTContext::getCanonicalNestedNameSpecifier(), clang::Sema::getDestructorName(), GetFullTypeForDeclarator(), clang::Sema::getInheritingConstructorName(), clang::NestedNameSpecifierLoc::getLocalSourceRange(), getNestedNameSpecifierIdentifiers(), clang::NestedNameSpecifierLoc::getPrefix(), clang::NestedNameSpecifierLoc::getTypeLoc(), clang::ASTImporter::Import(), isSameQualifier(), clang::NestedNameSpecifierLocBuilder::MakeTrivial(), MarkUsedTemplateParameters(), print(), ScopeSpecifierHasTemplateId(), and clang::RecursiveASTVisitor< Derived >::TraverseNestedNameSpecifier().
NestedNameSpecifier * NestedNameSpecifier::GlobalSpecifier | ( | const ASTContext & | Context | ) | [static] |
Returns the nested name specifier representing the global scope.
Definition at line 113 of file NestedNameSpecifier.cpp.
References Context.
Referenced by clang::ASTImporter::Import(), clang::NestedNameSpecifierLocBuilder::MakeGlobal(), clang::ASTReader::ReadNestedNameSpecifier(), and synthesizeCurrentNestedNameSpecifier().
bool NestedNameSpecifier::isDependent | ( | ) | const |
Whether this nested name specifier refers to a dependent type or not.
Definition at line 182 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::ActOnFriendFunctionDecl(), clang::Sema::ActOnFunctionDeclarator(), clang::Sema::CheckTypenameType(), clang::Sema::CodeCompleteQualifiedId(), clang::Sema::computeDeclContext(), Create(), clang::MemberExpr::Create(), clang::Sema::getCurrentInstantiationOf(), clang::ASTContext::getDependentTemplateName(), clang::ASTContext::getDependentTemplateSpecializationType(), clang::Sema::isDependentScopeSpecifier(), and clang::TreeTransform< Derived >::RebuildDependentNameType().
Whether this nested name specifier involves a template parameter.
Whether this nested name specifier refers to a dependent type or not.
Definition at line 212 of file NestedNameSpecifier.cpp.
References getAsType(), getKind(), Global, Identifier, clang::Type::isInstantiationDependentType(), Namespace, NamespaceAlias, Super, TypeSpec, and TypeSpecWithTemplate.
Referenced by clang::MemberExpr::Create().
void NestedNameSpecifier::print | ( | raw_ostream & | OS, |
const PrintingPolicy & | Policy | ||
) | const |
Print this nested name specifier to the given output stream.
Definition at line 254 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::TemplateSpecializationType::PrintTemplateArgumentList(), Super, clang::PrintingPolicy::SuppressScope, TypeSpec, and TypeSpecWithTemplate.
Referenced by AddQualifierToCompletionString(), dump(), clang::FormatASTNodeDiagnosticArgument(), clang::TypoCorrection::getAsString(), MaybeAddOverrideCalls(), and print().
void clang::NestedNameSpecifier::Profile | ( | llvm::FoldingSetNodeID & | ID | ) | const [inline] |
Definition at line 213 of file NestedNameSpecifier.h.
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 122 of file NestedNameSpecifier.cpp.
Referenced by clang::ASTImporter::Import(), clang::NestedNameSpecifierLocBuilder::MakeSuper(), and clang::ASTReader::ReadNestedNameSpecifier().