13#ifndef LLVM_CLANG_AST_NESTEDNAMESPECIFIER_H
14#define LLVM_CLANG_AST_NESTEDNAMESPECIFIER_H
20#include "llvm/ADT/DenseMapInfo.h"
25 if (!isStoredKind()) {
26 switch (getFlagKind()) {
29 case FlagKind::Global:
31 case FlagKind::Invalid:
32 llvm_unreachable(
"use of invalid NestedNameSpecifier");
34 llvm_unreachable(
"unhandled FlagKind");
36 switch (
auto [K, Ptr] = getStored(); K) {
37 case StoredKind::Type:
39 case StoredKind::NamespaceWithGlobal:
40 case StoredKind::NamespaceWithNamespace:
42 case StoredKind::NamespaceOrSuper:
43 switch (
static_cast<const Decl *
>(Ptr)->
getKind()) {
45 case Decl::NamespaceAlias:
48 case Decl::ClassTemplateSpecialization:
49 case Decl::ClassTemplatePartialSpecialization:
52 llvm_unreachable(
"unexpected decl kind");
55 llvm_unreachable(
"unknown StoredKind");
60 assert(
getKind() == Kind::Type);
63auto NestedNameSpecifier::MakeNamespacePtrKind(
64 const ASTContext &Ctx,
const NamespaceBaseDecl *Namespace,
65 NestedNameSpecifier Prefix) -> PtrKind {
66 switch (Prefix.getKind()) {
68 return {StoredKind::NamespaceOrSuper, Namespace};
70 return {StoredKind::NamespaceWithGlobal,
Namespace};
72 return {StoredKind::NamespaceWithNamespace,
73 MakeNamespaceAndPrefixStorage(Ctx, Namespace, Prefix)};
74 case Kind::MicrosoftSuper:
76 llvm_unreachable(
"invalid prefix for namespace");
78 llvm_unreachable(
"unhandled kind");
93 assert(
getKind() == Kind::MicrosoftSuper);
107 llvm_unreachable(
"Invalid NNS Kind!");
126 getAsType()->getCanonicalTypeInternal().getTypePtr());
128 llvm_unreachable(
"unhandled kind");
150 switch (Qualifier.getKind()) {
164 Length +=
sizeof(
void *);
168 llvm_unreachable(
"Expected a non-NULL qualifier");
175 auto [Namespace, Prefix] = Qualifier.getAsNamespaceAndPrefix();
187 for (; Qualifier; Qualifier = Qualifier.getAsNamespaceAndPrefix().Prefix) {
188 Length += getLocalDataLength(Qualifier);
200 switch (
auto Kind = Qualifier.getKind()) {
204 return LoadSourceLocation(0);
212 LoadSourceLocation(Offset),
218 void *TypeData = LoadPointer(0);
219 TypeLoc TL(Qualifier.getAsType(), TypeData);
224 llvm_unreachable(
"Invalid NNS Kind!");
255template <>
struct DenseMapInfo<
clang::NestedNameSpecifier> {
263 return hash_combine(
V.getAsVoidPointer());
267template <>
struct DenseMapInfo<
clang::NestedNameSpecifierLoc> {
268 using FirstInfo = DenseMapInfo<clang::NestedNameSpecifier>;
273 SecondInfo::getEmptyKey());
278 SecondInfo::getTombstoneKey());
enum clang::sema::@1840::IndirectLocalPathEntry::EntryKind Kind
static Decl::Kind getKind(const Decl *D)
static const Decl * getCanonicalDecl(const Decl *D)
Defines the clang::TypeLoc interface and its subclasses.
C Language Family Type Representation.
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Represents a C++ struct/union/class.
Decl - This represents one declaration (or definition), e.g.
Represents C++ namespaces and their aliases.
NamespaceDecl * getNamespace()
SourceRange getSourceRange() const LLVM_READONLY
Retrieve the source range covered by this nested-name-specifier.
A C++ nested-name-specifier augmented with source location information.
NamespaceAndPrefixLoc getAsNamespaceAndPrefix() const
NestedNameSpecifier getNestedNameSpecifier() const
Retrieve the nested-name-specifier to which this instance refers.
SourceLocation getLocalEndLoc() const
Retrieve the location of the end of this component of the nested-name-specifier.
SourceRange getSourceRange() const LLVM_READONLY
Retrieve the source range covering the entirety of this nested-name-specifier.
NestedNameSpecifierLoc()=default
Construct an empty nested-name-specifier.
NamespaceAndPrefixLoc castAsNamespaceAndPrefix() const
For a nested-name-specifier that refers to a namespace, retrieve the namespace and its prefix.
SourceLocation getEndLoc() const
Retrieve the location of the end of this nested-name-specifier.
TypeLoc getAsTypeLoc() const
SourceLocation getBeginLoc() const
Retrieve the location of the beginning of this nested-name-specifier.
TypeLoc castAsTypeLoc() const
For a nested-name-specifier that refers to a type, retrieve the type with source-location information...
void * getOpaqueData() const
Retrieve the opaque pointer that refers to source-location data.
SourceRange getLocalSourceRange() const
Retrieve the source range covering just the last part of this nested-name-specifier,...
SourceLocation getLocalBeginLoc() const
Retrieve the location of the beginning of this component of the nested-name-specifier.
unsigned getDataLength() const
Determines the data length for the entire nested-name-specifier.
Represents a C++ nested name specifier, such as "\::std::vector<int>::".
NestedNameSpecifier getCanonical() const
Retrieves the "canonical" nested name specifier for a given nested name specifier.
CXXRecordDecl * getAsMicrosoftSuper() const
NamespaceAndPrefix getAsNamespaceAndPrefix() const
bool isCanonical() const
Whether this nested name specifier is canonical.
CXXRecordDecl * getAsRecordDecl() const
Retrieve the record declaration stored in this nested name specifier, or null.
static constexpr NestedNameSpecifier getInvalid()
const Type * getAsType() const
Kind
The kind of specifier that completes this nested name specifier.
@ MicrosoftSuper
Microsoft's '__super' specifier, stored as a CXXRecordDecl* of the class it appeared in.
@ 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*.
Encodes a location in the source.
A trivial tuple used to represent a source range.
SourceLocation getEnd() const
SourceLocation getBegin() const
Base wrapper for a particular "section" of type source info.
SourceLocation getBeginLoc() const
Get the begin source location.
The base class of the type hierarchy.
CXXRecordDecl * getAsCXXRecordDecl() const
Retrieves the CXXRecordDecl that this type refers to, either because the type is a RecordType or beca...
The JSON file list parser is used to communicate input to InstallAPI.
const FunctionProtoType * T
Diagnostic wrappers for TextAPI types for error reporting.
const NamespaceBaseDecl * Namespace
static bool isEqual(const clang::NestedNameSpecifierLoc &LHS, const clang::NestedNameSpecifierLoc &RHS)
DenseMapInfo< void * > SecondInfo
static unsigned getHashValue(const clang::NestedNameSpecifierLoc &PairVal)
static clang::NestedNameSpecifierLoc getEmptyKey()
static clang::NestedNameSpecifierLoc getTombstoneKey()
static clang::NestedNameSpecifier getEmptyKey()
static unsigned getHashValue(const clang::NestedNameSpecifier &V)
static clang::NestedNameSpecifier getTombstoneKey()