14 #ifndef LLVM_CLANG_AST_NESTEDNAMESPECIFIER_H
15 #define LLVM_CLANG_AST_NESTEDNAMESPECIFIER_H
18 #include "llvm/ADT/FoldingSet.h"
19 #include "llvm/ADT/PointerIntPair.h"
20 #include "llvm/Support/Compiler.h"
26 class NamespaceAliasDecl;
29 struct PrintingPolicy;
47 enum StoredSpecifierKind {
51 StoredTypeSpecWithTemplate = 3
60 llvm::PointerIntPair<NestedNameSpecifier *, 2, StoredSpecifierKind> Prefix;
96 : Prefix(nullptr, StoredIdentifier), Specifier(nullptr) {}
100 NestedNameSpecifier(
const NestedNameSpecifier &Other)
101 : llvm::FoldingSetNode(Other), Prefix(Other.Prefix),
102 Specifier(Other.Specifier) {
105 void operator=(
const NestedNameSpecifier &) =
delete;
110 const NestedNameSpecifier &Mockup);
119 NestedNameSpecifier *Prefix,
124 NestedNameSpecifier *Prefix,
125 const NamespaceDecl *NS);
129 NestedNameSpecifier *Prefix,
130 NamespaceAliasDecl *Alias);
134 NestedNameSpecifier *Prefix,
135 bool Template,
const Type *T);
170 if (Prefix.getInt() == StoredIdentifier)
190 if (Prefix.getInt() == StoredTypeSpec ||
191 Prefix.getInt() == StoredTypeSpecWithTemplate)
192 return (
const Type *)Specifier;
214 ID.AddPointer(Prefix.getOpaqueValue());
215 ID.AddPointer(Specifier);
245 : Qualifier(Qualifier), Data(Data) { }
249 explicit operator bool()
const {
return Qualifier; }
327 return X.Qualifier == Y.Qualifier && X.Data == Y.Data;
358 unsigned BufferCapacity;
362 : Representation(nullptr), Buffer(nullptr), BufferSize(0),
491 Representation =
nullptr;
501 return std::make_pair(Buffer, BufferSize);
SourceLocation getLocalEndLoc() const
Retrieve the location of the end of this component of the nested-name-specifier.
SourceLocation getEnd() const
NestedNameSpecifier * getRepresentation() const
Retrieve the representation of the nested-name-specifier.
bool containsUnexpandedParameterPack() const
Whether this nested-name-specifier contains an unexpanded parameter pack (for C++11 variadic template...
void MakeTrivial(ASTContext &Context, NestedNameSpecifier *Qualifier, SourceRange R)
Make a new nested-name-specifier from incomplete source-location information.
SourceRange getSourceRange() const LLVM_READONLY
Retrieve the source range covering the entirety of this nested-name-specifier.
Microsoft's '__super' specifier, stored as a CXXRecordDecl* of the class it appeared in...
bool hasQualifier() const
Evalutes true when this nested-name-specifier location is empty.
NestedNameSpecifierLoc getPrefix() const
Return the prefix of this nested-name-specifier.
friend bool operator!=(NestedNameSpecifierLoc X, NestedNameSpecifierLoc Y)
const DiagnosticBuilder & operator<<(const DiagnosticBuilder &DB, const Attr *At)
The base class of the type hierarchy.
CXXRecordDecl * getAsRecordDecl() const
Retrieve the record declaration stored in this nested name specifier.
NamespaceDecl - Represent a C++ namespace.
NestedNameSpecifier * getPrefix() const
Return the prefix of this nested name specifier.
An identifier, stored as an IdentifierInfo*.
static NestedNameSpecifier * Create(const ASTContext &Context, NestedNameSpecifier *Prefix, IdentifierInfo *II)
Builds a specifier combining a prefix and an identifier.
NestedNameSpecifierLocBuilder & operator=(const NestedNameSpecifierLocBuilder &Other)
A namespace, stored as a NamespaceDecl*.
NestedNameSpecifierLocBuilder()
Describes how types, statements, expressions, and declarations should be printed. ...
void Adopt(NestedNameSpecifierLoc Other)
Adopt an existing nested-name-specifier (with source-range information).
void AddTaggedVal(intptr_t V, DiagnosticsEngine::ArgumentKind Kind) const
Base wrapper for a particular "section" of type source info.
SourceRange getLocalSourceRange() const
Retrieve the source range covering just the last part of this nested-name-specifier, not including the prefix.
unsigned getDataLength() const
Determines the data length for the entire nested-name-specifier.
One of these records is kept for each identifier that is lexed.
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
A C++ nested-name-specifier augmented with source location information.
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
friend bool operator==(NestedNameSpecifierLoc X, NestedNameSpecifierLoc Y)
bool isInstantiationDependent() const
Whether this nested name specifier involves a template parameter.
bool isDependent() const
Whether this nested name specifier refers to a dependent type or not.
NestedNameSpecifierLoc getWithLocInContext(ASTContext &Context) const
Retrieve a nested-name-specifier with location information, copied into the given AST context...
Class that aids in the construction of nested-name-specifiers along with source-location information ...
SourceRange getSourceRange() const LLVM_READONLY
Retrieve the source range covered by this nested-name-specifier.
A little helper class used to produce diagnostics.
TypeLoc getTypeLoc() const
For a nested-name-specifier that refers to a type, retrieve the type with source-location information...
static NestedNameSpecifier * SuperSpecifier(const ASTContext &Context, CXXRecordDecl *RD)
Returns the nested name specifier representing the __super scope for the given CXXRecordDecl.
SpecifierKind getKind() const
Determine what kind of nested name specifier is stored.
~NestedNameSpecifierLocBuilder()
A namespace alias, stored as a NamespaceAliasDecl*.
Wraps an identifier and optional source location for the identifier.
const Type * getAsType() const
Retrieve the type stored in this nested name specifier.
A type, stored as a Type*.
The l-value was considered opaque, so the alignment was determined from a type.
SpecifierKind
The kind of specifier that completes this nested name specifier.
NamespaceDecl * getAsNamespace() const
Retrieve the namespace stored in this nested name specifier.
void MakeSuper(ASTContext &Context, CXXRecordDecl *RD, SourceLocation SuperLoc, SourceLocation ColonColonLoc)
Turns this (empty) nested-name-specifier into '__super' nested-name-specifier.
Encodes a location in the source.
SourceLocation getEndLoc() const
Retrieve the location of the end of this nested-name-specifier.
void Profile(llvm::FoldingSetNodeID &ID) const
std::pair< char *, unsigned > getBuffer() const
Retrieve the underlying buffer.
NestedNameSpecifierLoc getTemporary() const
Retrieve a nested-name-specifier with location information based on the information in this builder...
SourceLocation getBeginLoc() const
Retrieve the location of the beginning of this nested-name-specifier.
SourceLocation getLocalBeginLoc() const
Retrieve the location of the beginning of this component of the nested-name-specifier.
Represents a C++ nested name specifier, such as "\::std::vector<int>::".
void MakeGlobal(ASTContext &Context, SourceLocation ColonColonLoc)
Turn this (empty) nested-name-specifier into the global nested-name-specifier '::'.
NestedNameSpecifierLoc(NestedNameSpecifier *Qualifier, void *Data)
Construct a nested-name-specifier with source location information from.
NamespaceAliasDecl * getAsNamespaceAlias() const
Retrieve the namespace alias stored in this nested name specifier.
SourceLocation getBegin() const
NestedNameSpecifierLoc()
Construct an empty nested-name-specifier.
void print(raw_ostream &OS, const PrintingPolicy &Policy) const
Print this nested name specifier to the given output stream.
IdentifierInfo * getAsIdentifier() const
Retrieve the identifier stored in this nested name specifier.
A type that was preceded by the 'template' keyword, stored as a Type*.
void * getOpaqueData() const
Retrieve the opaque pointer that refers to source-location data.
Defines the Diagnostic-related interfaces.
X
Add a minimal nested name specifier fixit hint to allow lookup of a tag name from an outer enclosing ...
Represents a C++ struct/union/class.
NestedNameSpecifier * getNestedNameSpecifier() const
Retrieve the nested-name-specifier to which this instance refers.
void Extend(ASTContext &Context, SourceLocation TemplateKWLoc, TypeLoc TL, SourceLocation ColonColonLoc)
Extend the current nested-name-specifier by another nested-name-specifier component of the form 'type...
A trivial tuple used to represent a source range.
Represents a C++ namespace alias.
The global specifier '::'. There is no stored value.
void Clear()
Clear out this builder, and prepare it to build another nested-name-specifier with source-location in...
static NestedNameSpecifier * GlobalSpecifier(const ASTContext &Context)
Returns the nested name specifier representing the global scope.