clang 24.0.0git
NestedNameSpecifierBase.h
Go to the documentation of this file.
1//===- NestedNameSpecifier.h - C++ nested name specifiers -------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9// This file defines the NestedNameSpecifier class, which represents
10// a C++ nested-name-specifier.
11//
12//===----------------------------------------------------------------------===//
13
14#ifndef LLVM_CLANG_AST_NESTEDNAMESPECIFIERBASE_H
15#define LLVM_CLANG_AST_NESTEDNAMESPECIFIERBASE_H
16
20#include "llvm/ADT/FoldingSet.h"
21#include "llvm/Support/Compiler.h"
22#include "llvm/Support/PointerLikeTypeTraits.h"
23#include <cstdint>
24#include <cstdlib>
25#include <utility>
26
27namespace clang {
28
29class ASTContext;
30class CXXRecordDecl;
31class NamedDecl;
32class IdentifierInfo;
33class LangOptions;
35struct PrintingPolicy;
36class Type;
37class TypeLoc;
38
40struct alignas(8) NamespaceAndPrefixStorage;
41
42/// Represents a C++ nested name specifier, such as
43/// "\::std::vector<int>::".
44///
45/// C++ nested name specifiers are the prefixes to qualified
46/// names. For example, "foo::" in "foo::x" is a nested name
47/// specifier. Nested name specifiers are made up of a sequence of
48/// specifiers, each of which can be a namespace, type, decltype specifier, or
49/// the global specifier ('::'). The last two specifiers can only appear at the
50/// start of a nested-namespace-specifier.
51class NestedNameSpecifier {
52 enum class FlagKind { Null, Global };
53 enum class StoredKind {
54 Type,
55 NamespaceOrSuper,
56 NamespaceWithGlobal,
57 NamespaceWithNamespace
58 };
59 static constexpr uintptr_t FlagBits = 2, FlagMask = (1u << FlagBits) - 1u,
60 FlagOffset = 1, PtrOffset = FlagBits + FlagOffset,
61 PtrMask = (1u << PtrOffset) - 1u;
62
63 uintptr_t StoredOrFlag;
64
65 explicit NestedNameSpecifier(uintptr_t StoredOrFlag)
66 : StoredOrFlag(StoredOrFlag) {}
67 struct PtrKind {
68 StoredKind SK;
69 const void *Ptr;
70 };
71 explicit NestedNameSpecifier(PtrKind PK)
72 : StoredOrFlag(uintptr_t(PK.Ptr) | (uintptr_t(PK.SK) << FlagOffset)) {
73 assert(PK.Ptr != nullptr);
74 assert((uintptr_t(PK.Ptr) & ((1u << PtrOffset) - 1u)) == 0);
75 assert((uintptr_t(PK.Ptr) >> PtrOffset) != 0);
76 }
77
78 explicit constexpr NestedNameSpecifier(FlagKind K)
79 : StoredOrFlag(uintptr_t(K) << FlagOffset) {}
80
81 bool isStoredKind() const { return (StoredOrFlag >> PtrOffset) != 0; }
82
83 std::pair<StoredKind, const void *> getStored() const {
84 assert(isStoredKind());
85 return {StoredKind(StoredOrFlag >> FlagOffset & FlagMask),
86 reinterpret_cast<const void *>(StoredOrFlag & ~PtrMask)};
87 }
88
89 FlagKind getFlagKind() const {
90 assert(!isStoredKind());
91 return FlagKind(StoredOrFlag >> FlagOffset);
92 }
93
94 static const NamespaceAndPrefixStorage *
95 MakeNamespaceAndPrefixStorage(const ASTContext &Ctx,
97 NestedNameSpecifier Prefix);
98 static inline PtrKind MakeNamespacePtrKind(const ASTContext &Ctx,
100 NestedNameSpecifier Prefix);
101
102public:
103 static constexpr NestedNameSpecifier getGlobal() {
104 return NestedNameSpecifier(FlagKind::Global);
105 }
106
108
109 /// The kind of specifier that completes this nested name
110 /// specifier.
111 enum class Kind {
112 /// Empty.
113 Null,
114
115 /// The global specifier '::'. There is no stored value.
116 Global,
117
118 /// A type, stored as a Type*.
119 Type,
120
121 /// A namespace-like entity, stored as a NamespaceBaseDecl*.
123
124 /// Microsoft's '__super' specifier, stored as a CXXRecordDecl* of
125 /// the class it appeared in.
127 };
128
129 inline Kind getKind() const;
130
131 NestedNameSpecifier(std::nullopt_t) : StoredOrFlag(0) {}
132
133 explicit inline NestedNameSpecifier(const Type *T);
134
135 /// Builds a nested name specifier that names a namespace.
136 inline NestedNameSpecifier(const ASTContext &Ctx,
137 const NamespaceBaseDecl *Namespace,
138 NestedNameSpecifier Prefix);
139
140 /// Builds a nested name specifier that names a class through microsoft's
141 /// __super specifier.
142 explicit inline NestedNameSpecifier(CXXRecordDecl *RD);
143
144 explicit operator bool() const { return StoredOrFlag != 0; }
145
146 void *getAsVoidPointer() const {
147 return reinterpret_cast<void *>(StoredOrFlag);
148 }
149 static NestedNameSpecifier getFromVoidPointer(const void *Ptr) {
150 return NestedNameSpecifier(reinterpret_cast<uintptr_t>(Ptr));
151 }
152
153 const Type *getAsType() const {
154 auto [Kind, Ptr] = getStored();
155 assert(Kind == StoredKind::Type);
156 assert(Ptr != nullptr);
157 return static_cast<const Type *>(Ptr);
158 }
159
161
163 auto [Kind, Ptr] = getStored();
164 assert(Kind == StoredKind::NamespaceOrSuper);
165 assert(Ptr != nullptr);
166 return static_cast<CXXRecordDecl *>(const_cast<void *>(Ptr));
167 }
168
169 /// Retrieve the record declaration stored in this nested name
170 /// specifier, or null.
171 inline CXXRecordDecl *getAsRecordDecl() const;
172
173 friend bool operator==(NestedNameSpecifier LHS, NestedNameSpecifier RHS) {
174 return LHS.StoredOrFlag == RHS.StoredOrFlag;
175 }
176 friend bool operator!=(NestedNameSpecifier LHS, NestedNameSpecifier RHS) {
177 return LHS.StoredOrFlag != RHS.StoredOrFlag;
178 }
179
180 /// Retrieves the "canonical" nested name specifier for a
181 /// given nested name specifier.
182 ///
183 /// The canonical nested name specifier is a nested name specifier
184 /// that uniquely identifies a type or namespace within the type
185 /// system. For example, given:
186 ///
187 /// \code
188 /// namespace N {
189 /// struct S {
190 /// template<typename T> struct X { typename T* type; };
191 /// };
192 /// }
193 ///
194 /// template<typename T> struct Y {
195 /// typename N::S::X<T>::type member;
196 /// };
197 /// \endcode
198 ///
199 /// Here, the nested-name-specifier for N::S::X<T>:: will be
200 /// S::X<template-param-0-0>, since 'S' and 'X' are uniquely defined
201 /// by declarations in the type system and the canonical type for
202 /// the template type parameter 'T' is template-param-0-0.
203 inline NestedNameSpecifier getCanonical() const;
204
205 /// Whether this nested name specifier is canonical.
206 inline bool isCanonical() const;
207
208 /// Whether this nested name specifier starts with a '::'.
209 bool isFullyQualified() const;
210
211 NestedNameSpecifierDependence getDependence() const;
212
213 /// Whether this nested name specifier refers to a dependent
214 /// type or not.
215 bool isDependent() const {
216 return getDependence() & NestedNameSpecifierDependence::Dependent;
217 }
218
219 /// Whether this nested name specifier involves a template
220 /// parameter.
222 return getDependence() & NestedNameSpecifierDependence::Instantiation;
223 }
224
225 /// Whether this nested-name-specifier contains an unexpanded
226 /// parameter pack (for C++11 variadic templates).
228 return getDependence() & NestedNameSpecifierDependence::UnexpandedPack;
229 }
230
231 /// Whether this nested name specifier contains an error.
232 bool containsErrors() const {
233 return getDependence() & NestedNameSpecifierDependence::Error;
234 }
235
236 /// Print this nested name specifier to the given output stream. If
237 /// `ResolveTemplateArguments` is true, we'll print actual types, e.g.
238 /// `ns::SomeTemplate<int, MyClass>` instead of
239 /// `ns::SomeTemplate<Container::value_type, T>`.
240 void print(raw_ostream &OS, const PrintingPolicy &Policy,
241 bool ResolveTemplateArguments = false,
242 bool PrintFinalScopeResOp = true) const;
243
244 void Profile(llvm::FoldingSetNodeID &ID) const {
245 ID.AddInteger(StoredOrFlag);
246 }
247
248 /// Dump the nested name specifier to aid in debugging.
249 void dump(llvm::raw_ostream *OS = nullptr,
250 const LangOptions *LO = nullptr) const;
251 void dump(const LangOptions &LO) const;
252 void dump(llvm::raw_ostream &OS) const;
253 void dump(llvm::raw_ostream &OS, const LangOptions &LO) const;
254
255 static constexpr auto NumLowBitsAvailable = FlagOffset;
256};
257
262
264 llvm::FoldingSetNode {
268 void Profile(llvm::FoldingSetNodeID &ID) { Profile(ID, Namespace, Prefix); }
269 static void Profile(llvm::FoldingSetNodeID &ID,
272 ID.AddPointer(Namespace);
273 Prefix.Profile(ID);
274 }
275};
276
278 auto [Kind, Ptr] = getStored();
279 switch (Kind) {
280 case StoredKind::NamespaceOrSuper:
281 case StoredKind::NamespaceWithGlobal:
282 return {static_cast<const NamespaceBaseDecl *>(Ptr),
283 Kind == StoredKind::NamespaceWithGlobal
285 : std::nullopt};
286 case StoredKind::NamespaceWithNamespace:
287 return *static_cast<const NamespaceAndPrefixStorage *>(Ptr);
288 case StoredKind::Type:;
289 }
290 llvm_unreachable("unexpected stored kind");
291}
292
294
295/// A C++ nested-name-specifier augmented with source location
296/// information.
298 NestedNameSpecifier Qualifier = std::nullopt;
299 void *Data = nullptr;
300
301 /// Load a (possibly unaligned) source location from a given address
302 /// and offset.
303 SourceLocation LoadSourceLocation(unsigned Offset) const {
305 memcpy(&Raw, static_cast<char *>(Data) + Offset, sizeof(Raw));
307 }
308
309 /// Load a (possibly unaligned) pointer from a given address and
310 /// offset.
311 void *LoadPointer(unsigned Offset) const {
312 void *Result;
313 memcpy(&Result, static_cast<char *>(Data) + Offset, sizeof(void *));
314 return Result;
315 }
316
317 /// Determines the data length for the last component in the
318 /// given nested-name-specifier.
319 static inline unsigned getLocalDataLength(NestedNameSpecifier Qualifier);
320
321 /// Determines the data length for the entire
322 /// nested-name-specifier.
323 static inline unsigned getDataLength(NestedNameSpecifier Qualifier);
324
325public:
326 /// Construct an empty nested-name-specifier.
328
329 /// Construct a nested-name-specifier with source location information
330 /// from
332 : Qualifier(Qualifier), Data(Data) {}
333
334 /// Evaluates true when this nested-name-specifier location is
335 /// non-empty.
336 explicit operator bool() const { return bool(Qualifier); }
337
338 /// Evaluates true when this nested-name-specifier location is
339 /// non-empty.
340 bool hasQualifier() const { return bool(Qualifier); }
341
342 /// Retrieve the nested-name-specifier to which this instance
343 /// refers.
344 NestedNameSpecifier getNestedNameSpecifier() const { return Qualifier; }
345
346 /// Retrieve the opaque pointer that refers to source-location data.
347 void *getOpaqueData() const { return Data; }
348
349 /// Retrieve the source range covering the entirety of this
350 /// nested-name-specifier.
351 ///
352 /// For example, if this instance refers to a nested-name-specifier
353 /// \c \::std::vector<int>::, the returned source range would cover
354 /// from the initial '::' to the last '::'.
355 inline SourceRange getSourceRange() const LLVM_READONLY;
356
357 /// Retrieve the source range covering just the last part of
358 /// this nested-name-specifier, not including the prefix.
359 ///
360 /// Note that this is the source range of this NestedNameSpecifier chunk,
361 /// and for a type this includes the prefix of that type.
362 ///
363 /// For example, if this instance refers to a nested-name-specifier
364 /// \c \::std::vector<int>::, the returned source range would cover
365 /// from "vector" to the last '::'.
366 inline SourceRange getLocalSourceRange() const;
367
368 /// Retrieve the location of the beginning of this
369 /// nested-name-specifier.
371
372 /// Retrieve the location of the end of this
373 /// nested-name-specifier.
374 inline SourceLocation getEndLoc() const;
375
376 /// Retrieve the location of the beginning of this
377 /// component of the nested-name-specifier.
378 inline SourceLocation getLocalBeginLoc() const;
379
380 /// Retrieve the location of the end of this component of the
381 /// nested-name-specifier.
382 inline SourceLocation getLocalEndLoc() const;
383
384 /// For a nested-name-specifier that refers to a namespace,
385 /// retrieve the namespace and its prefix.
386 ///
387 /// For example, if this instance refers to a nested-name-specifier
388 /// \c \::std::chrono::, the prefix is \c \::std::. Note that the
389 /// returned prefix may be empty, if this is the first component of
390 /// the nested-name-specifier.
393
394 /// For a nested-name-specifier that refers to a type,
395 /// retrieve the type with source-location information.
396 inline TypeLoc castAsTypeLoc() const;
397 inline TypeLoc getAsTypeLoc() const;
398
399 /// Determines the data length for the entire
400 /// nested-name-specifier.
401 inline unsigned getDataLength() const;
402
404 return X.Qualifier == Y.Qualifier && X.Data == Y.Data;
405 }
406
408 return !(X == Y);
409 }
410};
411
413 const NamespaceBaseDecl *Namespace = nullptr;
415
416 explicit operator bool() const { return Namespace != nullptr; }
417};
418
419/// Class that aids in the construction of nested-name-specifiers along
420/// with source-location information for all of the components of the
421/// nested-name-specifier.
423 /// The current representation of the nested-name-specifier we're
424 /// building.
425 NestedNameSpecifier Representation = std::nullopt;
426
427 /// Buffer used to store source-location information for the
428 /// nested-name-specifier.
429 ///
430 /// Note that we explicitly manage the buffer (rather than using a
431 /// SmallVector) because \c Declarator expects it to be possible to memcpy()
432 /// a \c CXXScopeSpec, and CXXScopeSpec uses a NestedNameSpecifierLocBuilder.
433 char *Buffer = nullptr;
434
435 /// The size of the buffer used to store source-location information
436 /// for the nested-name-specifier.
437 unsigned BufferSize = 0;
438
439 /// The capacity of the buffer used to store source-location
440 /// information for the nested-name-specifier.
441 unsigned BufferCapacity = 0;
442
443 void PushTrivial(ASTContext &Context, NestedNameSpecifier Qualifier,
444 SourceRange R);
445
446public:
450
453
456
458 if (BufferCapacity)
459 free(Buffer);
460 }
461
462 /// Retrieve the representation of the nested-name-specifier.
463 NestedNameSpecifier getRepresentation() const { return Representation; }
464
465 /// Make a nested-name-specifier of the form 'type::'.
466 ///
467 /// \param Context The AST context in which this nested-name-specifier
468 /// resides.
469 ///
470 /// \param TL The TypeLoc that describes the type preceding the '::'.
471 ///
472 /// \param ColonColonLoc The location of the trailing '::'.
473 void Make(ASTContext &Context, TypeLoc TL, SourceLocation ColonColonLoc);
474
475 /// Extend the current nested-name-specifier by another
476 /// nested-name-specifier component of the form 'namespace::'.
477 ///
478 /// \param Context The AST context in which this nested-name-specifier
479 /// resides.
480 ///
481 /// \param Namespace The namespace.
482 ///
483 /// \param NamespaceLoc The location of the namespace name.
484 ///
485 /// \param ColonColonLoc The location of the trailing '::'.
486 void Extend(ASTContext &Context, const NamespaceBaseDecl *Namespace,
487 SourceLocation NamespaceLoc, SourceLocation ColonColonLoc);
488
489 /// Turn this (empty) nested-name-specifier into the global
490 /// nested-name-specifier '::'.
491 void MakeGlobal(ASTContext &Context, SourceLocation ColonColonLoc);
492
493 /// Turns this (empty) nested-name-specifier into '__super'
494 /// nested-name-specifier.
495 ///
496 /// \param Context The AST context in which this nested-name-specifier
497 /// resides.
498 ///
499 /// \param RD The declaration of the class in which nested-name-specifier
500 /// appeared.
501 ///
502 /// \param SuperLoc The location of the '__super' keyword.
503 /// name.
504 ///
505 /// \param ColonColonLoc The location of the trailing '::'.
507 SourceLocation SuperLoc,
508 SourceLocation ColonColonLoc);
509
510 /// Make a new nested-name-specifier from incomplete source-location
511 /// information.
512 ///
513 /// This routine should be used very, very rarely, in cases where we
514 /// need to synthesize a nested-name-specifier. Most code should instead use
515 /// \c Adopt() with a proper \c NestedNameSpecifierLoc.
517 SourceRange R) {
518 Representation = Qualifier;
519 BufferSize = 0;
520 PushTrivial(Context, Qualifier, R);
521 }
522
523 /// Adopt an existing nested-name-specifier (with source-range
524 /// information).
526
527 /// Retrieve the source range covered by this nested-name-specifier.
528 inline SourceRange getSourceRange() const LLVM_READONLY;
529
530 /// Retrieve a nested-name-specifier with location information,
531 /// copied into the given AST context.
532 ///
533 /// \param Context The context into which this nested-name-specifier will be
534 /// copied.
536
537 /// Retrieve a nested-name-specifier with location
538 /// information based on the information in this builder.
539 ///
540 /// This loc will contain references to the builder's internal data and may
541 /// be invalidated by any change to the builder.
543 return NestedNameSpecifierLoc(Representation, Buffer);
544 }
545
546 /// Clear out this builder, and prepare it to build another
547 /// nested-name-specifier with source-location information.
548 void Clear() {
549 Representation = std::nullopt;
550 BufferSize = 0;
551 }
552
553 /// Retrieve the underlying buffer.
554 ///
555 /// \returns A pair containing a pointer to the buffer of source-location
556 /// data and the size of the source-location data that resides in that
557 /// buffer.
558 std::pair<char *, unsigned> getBuffer() const {
559 return std::make_pair(Buffer, BufferSize);
560 }
561};
562
563/// Insertion operator for diagnostics. This allows sending
564/// NestedNameSpecifiers into a diagnostic with <<.
567 DB.AddTaggedVal(reinterpret_cast<uintptr_t>(NNS.getAsVoidPointer()),
569 return DB;
570}
571
572} // namespace clang
573
574namespace llvm {
575
576template <> struct PointerLikeTypeTraits<clang::NestedNameSpecifier> {
578 return P.getAsVoidPointer();
579 }
583 static constexpr int NumLowBitsAvailable =
585};
586
587} // namespace llvm
588
589#endif // LLVM_CLANG_AST_NESTEDNAMESPECIFIERBASE_H
Defines the Diagnostic-related interfaces.
#define X(type, name)
Definition Value.h:97
Defines the clang::SourceLocation class and associated facilities.
__DEVICE__ void * memcpy(void *__a, const void *__b, size_t __c)
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Definition ASTContext.h:239
Represents a C++ struct/union/class.
Definition DeclCXX.h:258
@ ak_nestednamespec
NestedNameSpecifier *.
Definition Diagnostic.h:281
One of these records is kept for each identifier that is lexed.
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
This represents a decl that may have a name.
Definition Decl.h:275
Represents C++ namespaces and their aliases.
Definition Decl.h:574
void Adopt(NestedNameSpecifierLoc Other)
Adopt an existing nested-name-specifier (with source-range information).
NestedNameSpecifierLocBuilder & operator=(const NestedNameSpecifierLocBuilder &Other)
void MakeMicrosoftSuper(ASTContext &Context, CXXRecordDecl *RD, SourceLocation SuperLoc, SourceLocation ColonColonLoc)
Turns this (empty) nested-name-specifier into '__super' nested-name-specifier.
void MakeTrivial(ASTContext &Context, NestedNameSpecifier Qualifier, SourceRange R)
Make a new nested-name-specifier from incomplete source-location information.
void Clear()
Clear out this builder, and prepare it to build another nested-name-specifier with source-location in...
NestedNameSpecifierLoc getTemporary() const
Retrieve a nested-name-specifier with location information based on the information in this builder.
std::pair< char *, unsigned > getBuffer() const
Retrieve the underlying buffer.
SourceRange getSourceRange() const LLVM_READONLY
Retrieve the source range covered by this nested-name-specifier.
NestedNameSpecifier getRepresentation() const
Retrieve the representation of the nested-name-specifier.
void MakeGlobal(ASTContext &Context, SourceLocation ColonColonLoc)
Turn this (empty) nested-name-specifier into the global nested-name-specifier '::'.
NestedNameSpecifierLoc getWithLocInContext(ASTContext &Context) const
Retrieve a nested-name-specifier with location information, copied into the given AST context.
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.
NestedNameSpecifierLoc(NestedNameSpecifier Qualifier, void *Data)
Construct a nested-name-specifier with source location information from.
SourceLocation getEndLoc() const
Retrieve the location of the end of this nested-name-specifier.
SourceLocation getBeginLoc() const
Retrieve the location of the beginning of this nested-name-specifier.
friend bool operator!=(NestedNameSpecifierLoc X, NestedNameSpecifierLoc Y)
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.
bool hasQualifier() const
Evaluates true when this nested-name-specifier location is non-empty.
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>::".
static constexpr NestedNameSpecifier getGlobal()
void dump(llvm::raw_ostream *OS=nullptr, const LangOptions *LO=nullptr) const
Dump the nested name specifier to aid in debugging.
NestedNameSpecifier getCanonical() const
Retrieves the "canonical" nested name specifier for a given nested name specifier.
bool isInstantiationDependent() const
Whether this nested name specifier involves a template parameter.
CXXRecordDecl * getAsMicrosoftSuper() const
NamespaceAndPrefix getAsNamespaceAndPrefix() const
bool isFullyQualified() const
Whether this nested name specifier starts with a '::'.
bool containsUnexpandedParameterPack() const
Whether this nested-name-specifier contains an unexpanded parameter pack (for C++11 variadic template...
void Profile(llvm::FoldingSetNodeID &ID) const
static constexpr auto NumLowBitsAvailable
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.
static NestedNameSpecifier getFromVoidPointer(const void *Ptr)
NestedNameSpecifierDependence getDependence() 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.
bool containsErrors() const
Whether this nested name specifier contains an error.
friend bool operator==(NestedNameSpecifier LHS, NestedNameSpecifier RHS)
bool isDependent() const
Whether this nested name specifier refers to a dependent type or not.
friend bool operator!=(NestedNameSpecifier LHS, NestedNameSpecifier RHS)
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.
@ Namespace
A namespace-like entity, stored as a NamespaceBaseDecl*.
Encodes a location in the source.
static SourceLocation getFromRawEncoding(UIntTy Encoding)
Turn a raw encoding of a SourceLocation object into a real SourceLocation.
A trivial tuple used to represent a source range.
The streaming interface shared between DiagnosticBuilder and PartialDiagnostic.
void AddTaggedVal(uint64_t V, DiagnosticsEngine::ArgumentKind Kind) const
Base wrapper for a particular "section" of type source info.
Definition TypeLoc.h:59
The base class of the type hierarchy.
Definition TypeBase.h:1879
@ Extend
Lifetime-extend along this path.
Top level wrappers for InstallAPI frontend operations.
@ Result
The result type of a method or function.
Definition TypeBase.h:906
const FunctionProtoType * T
const StreamingDiagnostic & operator<<(const StreamingDiagnostic &DB, const ConceptReference *C)
Insertion operator for diagnostics.
@ Other
Other implicit parameter.
Definition Decl.h:1775
Diagnostic wrappers for TextAPI types for error reporting.
Definition Dominators.h:30
__UINTPTR_TYPE__ uintptr_t
An unsigned integer type with the property that any valid pointer to void can be converted to this ty...
const NamespaceBaseDecl * Namespace
static void Profile(llvm::FoldingSetNodeID &ID, const NamespaceBaseDecl *Namespace, NestedNameSpecifier Prefix)
NamespaceAndPrefixStorage(const NamespaceBaseDecl *Namespace, NestedNameSpecifier Prefix)
void Profile(llvm::FoldingSetNodeID &ID)
const NamespaceBaseDecl * Namespace
Describes how types, statements, expressions, and declarations should be printed.
static void * getAsVoidPointer(clang::NestedNameSpecifier P)
static clang::NestedNameSpecifier getFromVoidPointer(const void *P)