clang: clang::NestedNameSpecifier Class Reference (original) (raw)
Represents a C++ nested name specifier, such as "\::std::vector::". More...
#include "[clang/AST/NestedNameSpecifierBase.h](NestedNameSpecifierBase%5F8h%5Fsource.html)"
| Public Types | |
|---|---|
| enum class | Kind { Null, Global, Type, Namespace, MicrosoftSuper } |
| The kind of specifier that completes this nested name specifier. More... |
| Public Member Functions | |
|---|---|
| NestedNameSpecifier () | |
| Kind | getKind () const |
| NestedNameSpecifier (std::nullopt_t) | |
| NestedNameSpecifier (const Type *T) | |
| NestedNameSpecifier (const ASTContext &Ctx, const NamespaceBaseDecl *Namespace, NestedNameSpecifier Prefix) | |
| Builds a nested name specifier that names a namespace. | |
| NestedNameSpecifier (CXXRecordDecl *RD) | |
| Builds a nested name specifier that names a class through microsoft's __super specifier. | |
| operator bool () const | |
| void * | getAsVoidPointer () const |
| const Type * | getAsType () const |
| NamespaceAndPrefix | getAsNamespaceAndPrefix () const |
| CXXRecordDecl * | getAsMicrosoftSuper () const |
| CXXRecordDecl * | getAsRecordDecl () const |
| Retrieve the record declaration stored in this nested name specifier, or null. | |
| NestedNameSpecifier | getCanonical () const |
| Retrieves the "canonical" nested name specifier for a given nested name specifier. | |
| bool | isCanonical () const |
| Whether this nested name specifier is canonical. | |
| bool | isFullyQualified () const |
| Whether this nested name specifier starts with a '::'. | |
| 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, bool PrintFinalScopeResOp=true) const |
| Print this nested name specifier to the given output stream. | |
| void | Profile (llvm::FoldingSetNodeID &ID) const |
| void | dump (llvm::raw_ostream *OS=nullptr, const LangOptions *LO=nullptr) const |
| Dump the nested name specifier to aid in debugging. | |
| void | dump (const LangOptions &LO) const |
| void | dump (llvm::raw_ostream &OS) const |
| void | dump (llvm::raw_ostream &OS, const LangOptions &LO) const |
| Static Public Attributes | |
|---|---|
| static constexpr auto | NumLowBitsAvailable = FlagOffset |
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, decltype specifier, or the global specifier ('::'). The last two specifiers can only appear at the start of a nested-namespace-specifier.
Definition at line 51 of file NestedNameSpecifierBase.h.
◆ Kind
The kind of specifier that completes this nested name specifier.
| Enumerator | |
|---|---|
| Null | Empty. |
| Global | The global specifier '::'. There is no stored value. |
| Type | A type, stored as a Type*. |
| Namespace | A namespace-like entity, stored as a NamespaceBaseDecl*. |
| MicrosoftSuper | Microsoft's '__super' specifier, stored as a CXXRecordDecl* of the class it appeared in. |
Definition at line 115 of file NestedNameSpecifierBase.h.
| clang::NestedNameSpecifier::NestedNameSpecifier ( ) | inline |
|---|
◆ NestedNameSpecifier() [2/5]
| clang::NestedNameSpecifier::NestedNameSpecifier ( std::nullopt_t ) | inline |
|---|
◆ NestedNameSpecifier() [3/5]
| clang::NestedNameSpecifier::NestedNameSpecifier ( const Type * T) | inlineexplicit |
|---|
◆ NestedNameSpecifier() [4/5]
◆ NestedNameSpecifier() [5/5]
| clang::NestedNameSpecifier::NestedNameSpecifier ( CXXRecordDecl * RD) | inlineexplicit |
|---|
Builds a nested name specifier that names a class through microsoft's __super specifier.
Definition at line 91 of file NestedNameSpecifier.h.
◆ containsErrors()
| bool clang::NestedNameSpecifier::containsErrors ( ) const | inline |
|---|
◆ containsUnexpandedParameterPack()
| bool clang::NestedNameSpecifier::containsUnexpandedParameterPack ( ) const | inline |
|---|
◆ dump() [1/4]
| LLVM_DUMP_METHOD void NestedNameSpecifier::dump | ( | const LangOptions & | LO | ) | const |
|---|
◆ dump() [2/4]
| LLVM_DUMP_METHOD void NestedNameSpecifier::dump | ( | llvm::raw_ostream & | OS | ) | const |
|---|
◆ dump() [3/4]
| LLVM_DUMP_METHOD void NestedNameSpecifier::dump | ( | llvm::raw_ostream & | OS, |
|---|---|---|---|
| const LangOptions & | LO ) const |
◆ dump() [4/4]
◆ getAsMicrosoftSuper()
| CXXRecordDecl * clang::NestedNameSpecifier::getAsMicrosoftSuper ( ) const | inline |
|---|
◆ getAsNamespaceAndPrefix()
Definition at line 281 of file NestedNameSpecifierBase.h.
References getGlobal().
Referenced by clang::ODRHash::AddNestedNameSpecifier(), clang::Sema::computeDeclContext(), clang::TextNodeDumper::dumpNestedNameSpecifier(), getCanonical(), getCommonNNS(), getNestedNameSpecifierIdentifiers(), clang::ASTImporter::Import(), clang::ASTImporter::Import(), isFullyQualified(), isSameQualifier(), IsStructurallyEquivalent(), print(), clang::TreeTransform< Derived >::TransformNestedNameSpecifierLoc(), clang::RecursiveASTVisitor< Derived >::TraverseNestedNameSpecifier(), warnAboutRedundantParens(), and clang::serialization::DataStreamBasicWriter< Impl >::writeNestedNameSpecifier().
◆ getAsRecordDecl()
| CXXRecordDecl * clang::NestedNameSpecifier::getAsRecordDecl ( ) const | inline |
|---|
Retrieve the record declaration stored in this nested name specifier, or null.
Definition at line 96 of file NestedNameSpecifier.h.
References clang::Type::getAsCXXRecordDecl(), getAsMicrosoftSuper(), getAsType(), getKind(), Global, MicrosoftSuper, Namespace, Null, and Type.
Referenced by clang::CodeGen::CodeGenFunction::BuildAppleKextVirtualCall(), clang::Sema::DiagnoseEmptyLookup(), clang::ConstructorUsingShadowDecl::getNominatedBaseClass(), clang::MemberPointerType::isSugared(), and clang::TreeTransform< Derived >::TransformNestedNameSpecifierLoc().
◆ getAsType()
| const Type * clang::NestedNameSpecifier::getAsType ( ) const | inline |
|---|
Definition at line 157 of file NestedNameSpecifierBase.h.
Referenced by clang::TypoCorrectionConsumer::addNamespaces(), clang::ODRHash::AddNestedNameSpecifier(), clang::Sema::BuildCXXNestedNameSpecifier(), clang::Sema::CheckInheritingConstructorUsingDecl(), clang::SemaCodeCompletion::CodeCompleteQualifiedId(), clang::Sema::computeDeclContext(), clang::TextNodeDumper::dumpNestedNameSpecifier(), clang::Sema::FindFirstQualifierInScope(), getAsRecordDecl(), getCanonical(), getCommonNNS(), clang::Sema::getCurrentInstantiationOf(), getDependence(), clang::Sema::getInheritingConstructorName(), clang::UnresolvedMemberExpr::getNamingClass(), getNestedNameSpecifierIdentifiers(), getRangeOfTypeInNestedNameSpecifier(), clang::ASTImporter::Import(), clang::ASTImporter::Import(), isFullyQualified(), clang::Sema::isMicrosoftMissingTypename(), isSameQualifier(), IsStructurallyEquivalent(), MarkUsedTemplateParameters(), MarkUsedTemplateParameters(), print(), ScopeSpecifierHasTemplateId(), clang::RecursiveASTVisitor< Derived >::TraverseNestedNameSpecifier(), warnAboutRedundantParens(), and clang::serialization::DataStreamBasicWriter< Impl >::writeNestedNameSpecifier().
◆ getAsVoidPointer()
| void * clang::NestedNameSpecifier::getAsVoidPointer ( ) const | inline |
|---|
◆ getCanonical()
Retrieves the "canonical" nested name specifier for a given nested name specifier.
The canonical nested name specifier is a nested name specifier that uniquely identifies a type or namespace within the type system. For example, given:
namespace N {
struct S {
template struct X { typename T* type; };
};
}
template struct Y {
typename N::S::X::type member;
};
const internal::VariadicAllOfMatcher< Type > type
Matches Types in the clang AST.
RangeSelector member(std::string ID)
Given a MemberExpr, selects the member token. ID is the node's binding in the match result.
const FunctionProtoType * T
Here, the nested-name-specifier for N::S::X:: will be S::X, since 'S' and 'X' are uniquely defined by declarations in the type system and the canonical type for the template type parameter 'T' is template-param-0-0.
Definition at line 110 of file NestedNameSpecifier.h.
References getAsNamespaceAndPrefix(), getAsType(), clang::NamespaceDecl::getCanonicalDecl(), getKind(), clang::NamespaceBaseDecl::getNamespace(), Global, MicrosoftSuper, clang::NamespaceAndPrefix::Namespace, Namespace, NestedNameSpecifier(), Null, and Type.
Referenced by clang::Sema::CheckUsingDeclRedeclaration(), getCommonNNS(), clang::ASTContext::getDependentNameType(), and isCanonical().
◆ getDependence()
| NestedNameSpecifierDependence NestedNameSpecifier::getDependence | ( | ) | const |
|---|
Definition at line 70 of file NestedNameSpecifier.cpp.
References getAsMicrosoftSuper(), getAsType(), getDependence(), getKind(), Global, clang::DeclContext::isDependentContext(), MicrosoftSuper, Namespace, Null, clang::toNestedNameSpecifierDependence(), and Type.
Referenced by clang::computeDependence(), clang::computeDependence(), clang::computeDependence(), clang::computeDependence(), clang::computeDependence(), clang::computeDependence(), containsErrors(), containsUnexpandedParameterPack(), getDependence(), clang::TemplateName::getDependence(), isDependent(), and isInstantiationDependent().
◆ getFromVoidPointer()
| NestedNameSpecifier clang::NestedNameSpecifier::getFromVoidPointer ( const void * Ptr) | inlinestatic |
|---|
◆ getGlobal()
◆ getInvalid()
◆ getKind()
| auto clang::NestedNameSpecifier::getKind ( ) const | inline |
|---|
Definition at line 24 of file NestedNameSpecifier.h.
References getKind(), Global, MicrosoftSuper, Namespace, Null, and Type.
Referenced by clang::TypoCorrectionConsumer::addNamespaces(), clang::ODRHash::AddNestedNameSpecifier(), clang::Sema::checkLiteralOperatorId(), clang::SemaCodeCompletion::CodeCompleteQualifiedId(), clang::Sema::computeDeclContext(), clang::TextNodeDumper::dumpNestedNameSpecifier(), clang::Sema::FindFirstQualifierInScope(), getAsRecordDecl(), getCanonical(), getCommonNNS(), clang::Sema::getCurrentInstantiationOf(), getDependence(), getKind(), getNestedNameSpecifierIdentifiers(), getRangeOfTypeInNestedNameSpecifier(), hasRecursiveCallInPath(), clang::ASTImporter::Import(), clang::ASTImporter::Import(), isEnableIf(), isFullyQualified(), clang::Sema::isMicrosoftMissingTypename(), isSameQualifier(), IsStructurallyEquivalent(), MarkUsedTemplateParameters(), clang::Sema::MatchTemplateParametersToScopeSpecifier(), NestedNameSpecifier(), print(), ScopeSpecifierHasTemplateId(), clang::Sema::ShouldEnterDeclaratorScope(), clang::TreeTransform< Derived >::TransformNestedNameSpecifierLoc(), clang::RecursiveASTVisitor< Derived >::TraverseNestedNameSpecifier(), clang::RecursiveASTVisitor< Derived >::TraverseNestedNameSpecifierLoc(), warnAboutRedundantParens(), and clang::serialization::DataStreamBasicWriter< Impl >::writeNestedNameSpecifier().
◆ isCanonical()
| bool clang::NestedNameSpecifier::isCanonical ( ) const | inline |
|---|
◆ isDependent()
| bool clang::NestedNameSpecifier::isDependent ( ) const | inline |
|---|
◆ isFullyQualified()
| bool NestedNameSpecifier::isFullyQualified | ( | ) | const |
|---|
Whether this nested name specifier starts with a '::'.
Definition at line 55 of file NestedNameSpecifier.cpp.
References getAsNamespaceAndPrefix(), getAsType(), getKind(), clang::Type::getPrefix(), Global, isFullyQualified(), MicrosoftSuper, Namespace, Null, clang::NamespaceAndPrefix::Prefix, and Type.
Referenced by isFullyQualified(), and clang::tooling::replaceNestedName().
◆ isInstantiationDependent()
| bool clang::NestedNameSpecifier::isInstantiationDependent ( ) const | inline |
|---|
◆ operator bool()
| clang::NestedNameSpecifier::operator bool ( ) const | inlineexplicit |
|---|
◆ print()
| void NestedNameSpecifier::print | ( | raw_ostream & | OS, |
|---|---|---|---|
| const PrintingPolicy & | Policy, | ||
| bool | ResolveTemplateArguments = false, | ||
| bool | PrintFinalScopeResOp = true ) 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 91 of file NestedNameSpecifier.cpp.
References getAsNamespaceAndPrefix(), getAsType(), getKind(), Global, MicrosoftSuper, Namespace, Null, print(), clang::QualType::print(), clang::PrintingPolicy::SuppressTagKeyword, and Type.
Referenced by dump(), clang::FormatASTNodeDiagnosticArgument(), MaybeAddOverrideCalls(), clang::DependentTemplateStorage::print(), print(), PrintMapper(), printQualifier(), clang::TextNodeDumper::VisitUnresolvedUsingTypenameDecl(), clang::TextNodeDumper::VisitUnresolvedUsingValueDecl(), and clang::TextNodeDumper::VisitUsingDecl().
◆ Profile()
| void clang::NestedNameSpecifier::Profile ( llvm::FoldingSetNodeID & ID) const | inline |
|---|
◆ operator!=
◆ operator==
◆ NumLowBitsAvailable
| auto clang::NestedNameSpecifier::NumLowBitsAvailable = FlagOffset | staticconstexpr |
|---|
The documentation for this class was generated from the following files:
- include/clang/AST/NestedNameSpecifierBase.h
- include/clang/AST/NestedNameSpecifier.h
- lib/AST/NestedNameSpecifier.cpp