clang 22.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;
34class NamespaceBaseDecl;
35struct PrintingPolicy;
36class Type;
37class TypeLoc;
38
39struct NamespaceAndPrefix;
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.
52 enum class FlagKind { Null, Global, Invalid };
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 getInvalid() {
104 return NestedNameSpecifier(FlagKind::Invalid);
105 }
106
107 static constexpr NestedNameSpecifier getGlobal() {
108 return NestedNameSpecifier(FlagKind::Global);
109 }
110
111 NestedNameSpecifier() : NestedNameSpecifier(FlagKind::Invalid) {}
112
113 /// The kind of specifier that completes this nested name
114 /// specifier.
115 enum class Kind {
116 /// Empty.
117 Null,
118
119 /// The global specifier '::'. There is no stored value.
120 Global,
121
122 /// A type, stored as a Type*.
123 Type,
124
125 /// A namespace-like entity, stored as a NamespaceBaseDecl*.
126 Namespace,
127
128 /// Microsoft's '__super' specifier, stored as a CXXRecordDecl* of
129 /// the class it appeared in.
131 };
132
133 inline Kind getKind() const;
134
135 NestedNameSpecifier(std::nullopt_t) : StoredOrFlag(0) {}
136
137 explicit inline NestedNameSpecifier(const Type *T);
138
139 /// Builds a nested name specifier that names a namespace.
140 inline NestedNameSpecifier(const ASTContext &Ctx,
142 NestedNameSpecifier Prefix);
143
144 /// Builds a nested name specifier that names a class through microsoft's
145 /// __super specifier.
146 explicit inline NestedNameSpecifier(CXXRecordDecl *RD);
147
148 explicit operator bool() const { return StoredOrFlag != 0; }
149
150 void *getAsVoidPointer() const {
151 return reinterpret_cast<void *>(StoredOrFlag);
152 }
153 static NestedNameSpecifier getFromVoidPointer(const void *Ptr) {
154 return NestedNameSpecifier(reinterpret_cast<uintptr_t>(Ptr));
155 }
156
157 const Type *getAsType() const {
158 auto [Kind, Ptr] = getStored();
159 assert(Kind == StoredKind::Type);
160 assert(Ptr != nullptr);
161 return static_cast<const Type *>(Ptr);
162 }
163
165
167 auto [Kind, Ptr] = getStored();
168 assert(Kind == StoredKind::NamespaceOrSuper);
169 assert(Ptr != nullptr);
170 return static_cast<CXXRecordDecl *>(const_cast<void *>(Ptr));
171 }
172
173 /// Retrieve the record declaration stored in this nested name
174 /// specifier, or null.
175 inline CXXRecordDecl *getAsRecordDecl() const;
176
178 return LHS.StoredOrFlag == RHS.StoredOrFlag;
179 }
181 return LHS.StoredOrFlag != RHS.StoredOrFlag;
182 }
183
184 /// Retrieves the "canonical" nested name specifier for a
185 /// given nested name specifier.
186 ///
187 /// The canonical nested name specifier is a nested name specifier
188 /// that uniquely identifies a type or namespace within the type
189 /// system. For example, given:
190 ///
191 /// \code
192 /// namespace N {
193 /// struct S {
194 /// template<typename T> struct X { typename T* type; };
195 /// };
196 /// }
197 ///
198 /// template<typename T> struct Y {
199 /// typename N::S::X<T>::type member;
200 /// };
201 /// \endcode
202 ///
203 /// Here, the nested-name-specifier for N::S::X<T>:: will be
204 /// S::X<template-param-0-0>, since 'S' and 'X' are uniquely defined
205 /// by declarations in the type system and the canonical type for
206 /// the template type parameter 'T' is template-param-0-0.
207 inline NestedNameSpecifier getCanonical() const;
208
209 /// Whether this nested name specifier is canonical.
210 inline bool isCanonical() const;
211
212 /// Whether this nested name specifier starts with a '::'.
213 bool isFullyQualified() const;
214
215 NestedNameSpecifierDependence getDependence() const;
216
217 /// Whether this nested name specifier refers to a dependent
218 /// type or not.
219 bool isDependent() const {
220 return getDependence() & NestedNameSpecifierDependence::Dependent;
221 }
222
223 /// Whether this nested name specifier involves a template
224 /// parameter.
226 return getDependence() & NestedNameSpecifierDependence::Instantiation;
227 }
228
229 /// Whether this nested-name-specifier contains an unexpanded
230 /// parameter pack (for C++11 variadic templates).
232 return getDependence() & NestedNameSpecifierDependence::UnexpandedPack;
233 }
234
235 /// Whether this nested name specifier contains an error.
236 bool containsErrors() const {
237 return getDependence() & NestedNameSpecifierDependence::Error;
238 }
239
240 /// Print this nested name specifier to the given output stream. If
241 /// `ResolveTemplateArguments` is true, we'll print actual types, e.g.
242 /// `ns::SomeTemplate<int, MyClass>` instead of
243 /// `ns::SomeTemplate<Container::value_type, T>`.
244 void print(raw_ostream &OS, const PrintingPolicy &Policy,
245 bool ResolveTemplateArguments = false,
246 bool PrintFinalScopeResOp = true) const;
247
248 void Profile(llvm::FoldingSetNodeID &ID) const {
249 ID.AddInteger(StoredOrFlag);
250 }
251
252 /// Dump the nested name specifier to aid in debugging.
253 void dump(llvm::raw_ostream *OS = nullptr,
254 const LangOptions *LO = nullptr) const;
255 void dump(const LangOptions &LO) const;
256 void dump(llvm::raw_ostream &OS) const;
257 void dump(llvm::raw_ostream &OS, const LangOptions &LO) const;
258
259 static constexpr auto NumLowBitsAvailable = FlagOffset;
260};
261
265};
266
268 llvm::FoldingSetNode {
272 void Profile(llvm::FoldingSetNodeID &ID) { Profile(ID, Namespace, Prefix); }
273 static void Profile(llvm::FoldingSetNodeID &ID,
276 ID.AddPointer(Namespace);
278 }
279};
280
282 auto [Kind, Ptr] = getStored();
283 switch (Kind) {
284 case StoredKind::NamespaceOrSuper:
285 case StoredKind::NamespaceWithGlobal:
286 return {static_cast<const NamespaceBaseDecl *>(Ptr),
287 Kind == StoredKind::NamespaceWithGlobal
289 : std::nullopt};
290 case StoredKind::NamespaceWithNamespace:
291 return *static_cast<const NamespaceAndPrefixStorage *>(Ptr);
292 case StoredKind::Type:;
293 }
294 llvm_unreachable("unexpected stored kind");
295}
296
298
299/// A C++ nested-name-specifier augmented with source location
300/// information.
302 NestedNameSpecifier Qualifier = std::nullopt;
303 void *Data = nullptr;
304
305 /// Load a (possibly unaligned) source location from a given address
306 /// and offset.
307 SourceLocation LoadSourceLocation(unsigned Offset) const {
309 memcpy(&Raw, static_cast<char *>(Data) + Offset, sizeof(Raw));
311 }
312
313 /// Load a (possibly unaligned) pointer from a given address and
314 /// offset.
315 void *LoadPointer(unsigned Offset) const {
316 void *Result;
317 memcpy(&Result, static_cast<char *>(Data) + Offset, sizeof(void *));
318 return Result;
319 }
320
321 /// Determines the data length for the last component in the
322 /// given nested-name-specifier.
323 static inline unsigned getLocalDataLength(NestedNameSpecifier Qualifier);
324
325 /// Determines the data length for the entire
326 /// nested-name-specifier.
327 static inline unsigned getDataLength(NestedNameSpecifier Qualifier);
328
329public:
330 /// Construct an empty nested-name-specifier.
332
333 /// Construct a nested-name-specifier with source location information
334 /// from
336 : Qualifier(Qualifier), Data(Data) {}
337
338 /// Evaluates true when this nested-name-specifier location is
339 /// non-empty.
340 explicit operator bool() const { return bool(Qualifier); }
341
342 /// Evaluates true when this nested-name-specifier location is
343 /// non-empty.
344 bool hasQualifier() const { return bool(Qualifier); }
345
346 /// Retrieve the nested-name-specifier to which this instance
347 /// refers.
348 NestedNameSpecifier getNestedNameSpecifier() const { return Qualifier; }
349
350 /// Retrieve the opaque pointer that refers to source-location data.
351 void *getOpaqueData() const { return Data; }
352
353 /// Retrieve the source range covering the entirety of this
354 /// nested-name-specifier.
355 ///
356 /// For example, if this instance refers to a nested-name-specifier
357 /// \c \::std::vector<int>::, the returned source range would cover
358 /// from the initial '::' to the last '::'.
359 inline SourceRange getSourceRange() const LLVM_READONLY;
360
361 /// Retrieve the source range covering just the last part of
362 /// this nested-name-specifier, not including the prefix.
363 ///
364 /// For example, if this instance refers to a nested-name-specifier
365 /// \c \::std::vector<int>::, the returned source range would cover
366 /// from "vector" to the last '::'.
367 inline SourceRange getLocalSourceRange() const;
368
369 /// Retrieve the location of the beginning of this
370 /// nested-name-specifier.
372
373 /// Retrieve the location of the end of this
374 /// nested-name-specifier.
375 inline SourceLocation getEndLoc() const;
376
377 /// Retrieve the location of the beginning of this
378 /// component of the nested-name-specifier.
379 inline SourceLocation getLocalBeginLoc() const;
380
381 /// Retrieve the location of the end of this component of the
382 /// nested-name-specifier.
383 inline SourceLocation getLocalEndLoc() const;
384
385 /// For a nested-name-specifier that refers to a namespace,
386 /// retrieve the namespace and its prefix.
387 ///
388 /// For example, if this instance refers to a nested-name-specifier
389 /// \c \::std::chrono::, the prefix is \c \::std::. Note that the
390 /// returned prefix may be empty, if this is the first component of
391 /// the nested-name-specifier.
394
395 /// For a nested-name-specifier that refers to a type,
396 /// retrieve the type with source-location information.
397 inline TypeLoc castAsTypeLoc() const;
398 inline TypeLoc getAsTypeLoc() const;
399
400 /// Determines the data length for the entire
401 /// nested-name-specifier.
402 inline unsigned getDataLength() const;
403
405 return X.Qualifier == Y.Qualifier && X.Data == Y.Data;
406 }
407
409 return !(X == Y);
410 }
411};
412
414 const NamespaceBaseDecl *Namespace = nullptr;
416
417 explicit operator bool() const { return Namespace != nullptr; }
418};
419
420/// Class that aids in the construction of nested-name-specifiers along
421/// with source-location information for all of the components of the
422/// nested-name-specifier.
424 /// The current representation of the nested-name-specifier we're
425 /// building.
426 NestedNameSpecifier Representation = std::nullopt;
427
428 /// Buffer used to store source-location information for the
429 /// nested-name-specifier.
430 ///
431 /// Note that we explicitly manage the buffer (rather than using a
432 /// SmallVector) because \c Declarator expects it to be possible to memcpy()
433 /// a \c CXXScopeSpec, and CXXScopeSpec uses a NestedNameSpecifierLocBuilder.
434 char *Buffer = nullptr;
435
436 /// The size of the buffer used to store source-location information
437 /// for the nested-name-specifier.
438 unsigned BufferSize = 0;
439
440 /// The capacity of the buffer used to store source-location
441 /// information for the nested-name-specifier.
442 unsigned BufferCapacity = 0;
443
444 void PushTrivial(ASTContext &Context, NestedNameSpecifier Qualifier,
445 SourceRange R);
446
447public:
450
453
455 if (BufferCapacity)
456 free(Buffer);
457 }
458
459 /// Retrieve the representation of the nested-name-specifier.
460 NestedNameSpecifier getRepresentation() const { return Representation; }
461
462 /// Make a nested-name-specifier of the form 'type::'.
463 ///
464 /// \param Context The AST context in which this nested-name-specifier
465 /// resides.
466 ///
467 /// \param TL The TypeLoc that describes the type preceding the '::'.
468 ///
469 /// \param ColonColonLoc The location of the trailing '::'.
470 void Make(ASTContext &Context, TypeLoc TL, SourceLocation ColonColonLoc);
471
472 /// Extend the current nested-name-specifier by another
473 /// nested-name-specifier component of the form 'namespace::'.
474 ///
475 /// \param Context The AST context in which this nested-name-specifier
476 /// resides.
477 ///
478 /// \param Namespace The namespace.
479 ///
480 /// \param NamespaceLoc The location of the namespace name.
481 ///
482 /// \param ColonColonLoc The location of the trailing '::'.
483 void Extend(ASTContext &Context, const NamespaceBaseDecl *Namespace,
484 SourceLocation NamespaceLoc, SourceLocation ColonColonLoc);
485
486 /// Turn this (empty) nested-name-specifier into the global
487 /// nested-name-specifier '::'.
488 void MakeGlobal(ASTContext &Context, SourceLocation ColonColonLoc);
489
490 /// Turns this (empty) nested-name-specifier into '__super'
491 /// nested-name-specifier.
492 ///
493 /// \param Context The AST context in which this nested-name-specifier
494 /// resides.
495 ///
496 /// \param RD The declaration of the class in which nested-name-specifier
497 /// appeared.
498 ///
499 /// \param SuperLoc The location of the '__super' keyword.
500 /// name.
501 ///
502 /// \param ColonColonLoc The location of the trailing '::'.
504 SourceLocation SuperLoc,
505 SourceLocation ColonColonLoc);
506
507 /// Make a new nested-name-specifier from incomplete source-location
508 /// information.
509 ///
510 /// This routine should be used very, very rarely, in cases where we
511 /// need to synthesize a nested-name-specifier. Most code should instead use
512 /// \c Adopt() with a proper \c NestedNameSpecifierLoc.
514 SourceRange R) {
515 Representation = Qualifier;
516 BufferSize = 0;
517 PushTrivial(Context, Qualifier, R);
518 }
519
520 /// Adopt an existing nested-name-specifier (with source-range
521 /// information).
523
524 /// Retrieve the source range covered by this nested-name-specifier.
525 inline SourceRange getSourceRange() const LLVM_READONLY;
526
527 /// Retrieve a nested-name-specifier with location information,
528 /// copied into the given AST context.
529 ///
530 /// \param Context The context into which this nested-name-specifier will be
531 /// copied.
533
534 /// Retrieve a nested-name-specifier with location
535 /// information based on the information in this builder.
536 ///
537 /// This loc will contain references to the builder's internal data and may
538 /// be invalidated by any change to the builder.
540 return NestedNameSpecifierLoc(Representation, Buffer);
541 }
542
543 /// Clear out this builder, and prepare it to build another
544 /// nested-name-specifier with source-location information.
545 void Clear() {
546 Representation = std::nullopt;
547 BufferSize = 0;
548 }
549
550 /// Retrieve the underlying buffer.
551 ///
552 /// \returns A pair containing a pointer to the buffer of source-location
553 /// data and the size of the source-location data that resides in that
554 /// buffer.
555 std::pair<char *, unsigned> getBuffer() const {
556 return std::make_pair(Buffer, BufferSize);
557 }
558};
559
560/// Insertion operator for diagnostics. This allows sending
561/// NestedNameSpecifiers into a diagnostic with <<.
564 DB.AddTaggedVal(reinterpret_cast<uintptr_t>(NNS.getAsVoidPointer()),
566 return DB;
567}
568
569} // namespace clang
570
571namespace llvm {
572
573template <> struct PointerLikeTypeTraits<clang::NestedNameSpecifier> {
575 return P.getAsVoidPointer();
576 }
579 }
580 static constexpr int NumLowBitsAvailable =
582};
583
584} // namespace llvm
585
586#endif // LLVM_CLANG_AST_NESTEDNAMESPECIFIERBASE_H
MatchType Type
StringRef P
static char ID
Definition: Arena.cpp:183
Defines the Diagnostic-related interfaces.
#define X(type, name)
Definition: Value.h:145
Defines the clang::SourceLocation class and associated facilities.
const char * Data
__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:188
Represents a C++ struct/union/class.
Definition: DeclCXX.h:258
@ ak_nestednamespec
NestedNameSpecifier *.
Definition: Diagnostic.h:280
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
Definition: LangOptions.h:434
Represents C++ namespaces and their aliases.
Definition: Decl.h:572
Class that aids in the construction of nested-name-specifiers along with source-location information ...
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.
static constexpr NestedNameSpecifier getInvalid()
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.
Definition: Diagnostic.h:1115
void AddTaggedVal(uint64_t V, DiagnosticsEngine::ArgumentKind Kind) const
Definition: Diagnostic.h:1156
Base wrapper for a particular "section" of type source info.
Definition: TypeLoc.h:59
The base class of the type hierarchy.
Definition: TypeBase.h:1833
#define bool
Definition: gpuintrin.h:32
@ Extend
Lifetime-extend along this path.
The JSON file list parser is used to communicate input to InstallAPI.
const StreamingDiagnostic & operator<<(const StreamingDiagnostic &DB, const ASTContext::SectionInfo &Section)
Insertion operator for diagnostics.
@ Result
The result type of a method or function.
const FunctionProtoType * T
@ Other
Other implicit parameter.
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.
Definition: PrettyPrinter.h:57
static void * getAsVoidPointer(clang::NestedNameSpecifier P)
static clang::NestedNameSpecifier getFromVoidPointer(const void *P)