clang 20.0.0git
QualTypeNames.cpp
Go to the documentation of this file.
1//===------- QualTypeNames.cpp - Generate Complete QualType Names ---------===//
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
12#include "clang/AST/Mangle.h"
14
15#include <stdio.h>
16#include <memory>
17
18namespace clang {
19
20namespace TypeName {
21
22/// Create a NestedNameSpecifier for Namesp and its enclosing
23/// scopes.
24///
25/// \param[in] Ctx - the AST Context to be used.
26/// \param[in] Namesp - the NamespaceDecl for which a NestedNameSpecifier
27/// is requested.
28/// \param[in] WithGlobalNsPrefix - Indicate whether the global namespace
29/// specifier "::" should be prepended or not.
30static NestedNameSpecifier *createNestedNameSpecifier(
31 const ASTContext &Ctx,
32 const NamespaceDecl *Namesp,
33 bool WithGlobalNsPrefix);
34
35/// Create a NestedNameSpecifier for TagDecl and its enclosing
36/// scopes.
37///
38/// \param[in] Ctx - the AST Context to be used.
39/// \param[in] TD - the TagDecl for which a NestedNameSpecifier is
40/// requested.
41/// \param[in] FullyQualify - Convert all template arguments into fully
42/// qualified names.
43/// \param[in] WithGlobalNsPrefix - Indicate whether the global namespace
44/// specifier "::" should be prepended or not.
45static NestedNameSpecifier *createNestedNameSpecifier(
46 const ASTContext &Ctx, const TypeDecl *TD,
47 bool FullyQualify, bool WithGlobalNsPrefix);
48
49static NestedNameSpecifier *createNestedNameSpecifierForScopeOf(
50 const ASTContext &Ctx, const Decl *decl,
51 bool FullyQualified, bool WithGlobalNsPrefix);
52
53static NestedNameSpecifier *getFullyQualifiedNestedNameSpecifier(
54 const ASTContext &Ctx, NestedNameSpecifier *scope, bool WithGlobalNsPrefix);
55
57 TemplateName &TName,
58 bool WithGlobalNsPrefix) {
59 bool Changed = false;
60 NestedNameSpecifier *NNS = nullptr;
61
62 TemplateDecl *ArgTDecl = TName.getAsTemplateDecl();
63 // ArgTDecl won't be NULL because we asserted that this isn't a
64 // dependent context very early in the call chain.
65 assert(ArgTDecl != nullptr);
67
68 if (QTName &&
69 !QTName->hasTemplateKeyword() &&
70 (NNS = QTName->getQualifier())) {
72 Ctx, NNS, WithGlobalNsPrefix);
73 if (QNNS != NNS) {
74 Changed = true;
75 NNS = QNNS;
76 } else {
77 NNS = nullptr;
78 }
79 } else {
81 Ctx, ArgTDecl, true, WithGlobalNsPrefix);
82 }
83 if (NNS) {
84 TemplateName UnderlyingTN(ArgTDecl);
85 if (UsingShadowDecl *USD = TName.getAsUsingShadowDecl())
86 UnderlyingTN = TemplateName(USD);
87 TName =
89 /*TemplateKeyword=*/false, UnderlyingTN);
90 Changed = true;
91 }
92 return Changed;
93}
94
97 bool WithGlobalNsPrefix) {
98 bool Changed = false;
99
100 // Note: we do not handle TemplateArgument::Expression, to replace it
101 // we need the information for the template instance decl.
102
103 if (Arg.getKind() == TemplateArgument::Template) {
104 TemplateName TName = Arg.getAsTemplate();
105 Changed = getFullyQualifiedTemplateName(Ctx, TName, WithGlobalNsPrefix);
106 if (Changed) {
107 Arg = TemplateArgument(TName);
108 }
109 } else if (Arg.getKind() == TemplateArgument::Type) {
110 QualType SubTy = Arg.getAsType();
111 // Check if the type needs more desugaring and recurse.
112 QualType QTFQ = getFullyQualifiedType(SubTy, Ctx, WithGlobalNsPrefix);
113 if (QTFQ != SubTy) {
114 Arg = TemplateArgument(QTFQ);
115 Changed = true;
116 }
117 }
118 return Changed;
119}
120
122 const Type *TypePtr,
123 bool WithGlobalNsPrefix) {
124 // DependentTemplateTypes exist within template declarations and
125 // definitions. Therefore we shouldn't encounter them at the end of
126 // a translation unit. If we do, the caller has made an error.
127 assert(!isa<DependentTemplateSpecializationType>(TypePtr));
128 // In case of template specializations, iterate over the arguments
129 // and fully qualify them as well.
130 if (const auto *TST = dyn_cast<const TemplateSpecializationType>(TypePtr)) {
131 bool MightHaveChanged = false;
133 // Cheap to copy and potentially modified by
134 // getFullyQualifedTemplateArgument.
135 for (TemplateArgument Arg : TST->template_arguments()) {
136 MightHaveChanged |= getFullyQualifiedTemplateArgument(
137 Ctx, Arg, WithGlobalNsPrefix);
138 FQArgs.push_back(Arg);
139 }
140
141 // If a fully qualified arg is different from the unqualified arg,
142 // allocate new type in the AST.
143 if (MightHaveChanged) {
145 TST->getTemplateName(), FQArgs,
146 TST->getCanonicalTypeInternal());
147 // getTemplateSpecializationType returns a fully qualified
148 // version of the specialization itself, so no need to qualify
149 // it.
150 return QT.getTypePtr();
151 }
152 } else if (const auto *TSTRecord = dyn_cast<const RecordType>(TypePtr)) {
153 // We are asked to fully qualify and we have a Record Type,
154 // which can point to a template instantiation with no sugar in any of
155 // its template argument, however we still need to fully qualify them.
156
157 if (const auto *TSTDecl =
158 dyn_cast<ClassTemplateSpecializationDecl>(TSTRecord->getDecl())) {
159 const TemplateArgumentList &TemplateArgs = TSTDecl->getTemplateArgs();
160
161 bool MightHaveChanged = false;
163 for (unsigned int I = 0, E = TemplateArgs.size(); I != E; ++I) {
164 // cheap to copy and potentially modified by
165 // getFullyQualifedTemplateArgument
166 TemplateArgument Arg(TemplateArgs[I]);
167 MightHaveChanged |= getFullyQualifiedTemplateArgument(
168 Ctx, Arg, WithGlobalNsPrefix);
169 FQArgs.push_back(Arg);
170 }
171
172 // If a fully qualified arg is different from the unqualified arg,
173 // allocate new type in the AST.
174 if (MightHaveChanged) {
175 TemplateName TN(TSTDecl->getSpecializedTemplate());
177 TN, FQArgs,
178 TSTRecord->getCanonicalTypeInternal());
179 // getTemplateSpecializationType returns a fully qualified
180 // version of the specialization itself, so no need to qualify
181 // it.
182 return QT.getTypePtr();
183 }
184 }
185 }
186 return TypePtr;
187}
188
190 bool FullyQualify,
191 bool WithGlobalNsPrefix) {
192 const DeclContext *DC = D->getDeclContext();
193 if (const auto *NS = dyn_cast<NamespaceDecl>(DC)) {
194 while (NS && NS->isInline()) {
195 // Ignore inline namespace;
196 NS = dyn_cast<NamespaceDecl>(NS->getDeclContext());
197 }
198 if (NS && NS->getDeclName()) {
199 return createNestedNameSpecifier(Ctx, NS, WithGlobalNsPrefix);
200 }
201 return nullptr; // no starting '::', no anonymous
202 } else if (const auto *TD = dyn_cast<TagDecl>(DC)) {
203 return createNestedNameSpecifier(Ctx, TD, FullyQualify, WithGlobalNsPrefix);
204 } else if (const auto *TDD = dyn_cast<TypedefNameDecl>(DC)) {
206 Ctx, TDD, FullyQualify, WithGlobalNsPrefix);
207 } else if (WithGlobalNsPrefix && DC->isTranslationUnit()) {
209 }
210 return nullptr; // no starting '::' if |WithGlobalNsPrefix| is false
211}
212
213/// Return a fully qualified version of this name specifier.
216 bool WithGlobalNsPrefix) {
217 switch (Scope->getKind()) {
219 // Already fully qualified
220 return Scope;
223 Ctx, Scope->getAsNamespace(), WithGlobalNsPrefix);
225 // Namespace aliases are only valid for the duration of the
226 // scope where they were introduced, and therefore are often
227 // invalid at the end of the TU. So use the namespace name more
228 // likely to be valid at the end of the TU.
230 Ctx,
231 Scope->getAsNamespaceAlias()->getNamespace()->getCanonicalDecl(),
232 WithGlobalNsPrefix);
234 // A function or some other construct that makes it un-namable
235 // at the end of the TU. Skip the current component of the name,
236 // but use the name of it's prefix.
238 Ctx, Scope->getPrefix(), WithGlobalNsPrefix);
242 const Type *Type = Scope->getAsType();
243 // Find decl context.
244 const TagDecl *TD = nullptr;
245 if (const TagType *TagDeclType = Type->getAs<TagType>()) {
246 TD = TagDeclType->getDecl();
247 } else {
248 TD = Type->getAsCXXRecordDecl();
249 }
250 if (TD) {
252 true /*FullyQualified*/,
253 WithGlobalNsPrefix);
254 } else if (const auto *TDD = dyn_cast<TypedefType>(Type)) {
255 return TypeName::createNestedNameSpecifier(Ctx, TDD->getDecl(),
256 true /*FullyQualified*/,
257 WithGlobalNsPrefix);
258 }
259 return Scope;
260 }
261 }
262 llvm_unreachable("bad NNS kind");
263}
264
265/// Create a nested name specifier for the declaring context of
266/// the type.
268 const ASTContext &Ctx, const Decl *Decl,
269 bool FullyQualified, bool WithGlobalNsPrefix) {
270 assert(Decl);
271
273 const auto *Outer = dyn_cast<NamedDecl>(DC);
274 const auto *OuterNS = dyn_cast<NamespaceDecl>(DC);
275 if (Outer && !(OuterNS && OuterNS->isAnonymousNamespace())) {
276 if (const auto *CxxDecl = dyn_cast<CXXRecordDecl>(DC)) {
277 if (ClassTemplateDecl *ClassTempl =
278 CxxDecl->getDescribedClassTemplate()) {
279 // We are in the case of a type(def) that was declared in a
280 // class template but is *not* type dependent. In clang, it
281 // gets attached to the class template declaration rather than
282 // any specific class template instantiation. This result in
283 // 'odd' fully qualified typename:
284 //
285 // vector<_Tp,_Alloc>::size_type
286 //
287 // Make the situation is 'useable' but looking a bit odd by
288 // picking a random instance as the declaring context.
289 if (ClassTempl->spec_begin() != ClassTempl->spec_end()) {
290 Decl = *(ClassTempl->spec_begin());
291 Outer = dyn_cast<NamedDecl>(Decl);
292 OuterNS = dyn_cast<NamespaceDecl>(Decl);
293 }
294 }
295 }
296
297 if (OuterNS) {
298 return createNestedNameSpecifier(Ctx, OuterNS, WithGlobalNsPrefix);
299 } else if (const auto *TD = dyn_cast<TagDecl>(Outer)) {
301 Ctx, TD, FullyQualified, WithGlobalNsPrefix);
302 } else if (isa<TranslationUnitDecl>(Outer)) {
303 // Context is the TU. Nothing needs to be done.
304 return nullptr;
305 } else {
306 // Decl's context was neither the TU, a namespace, nor a
307 // TagDecl, which means it is a type local to a scope, and not
308 // accessible at the end of the TU.
309 return nullptr;
310 }
311 } else if (WithGlobalNsPrefix && DC->isTranslationUnit()) {
313 }
314 return nullptr;
315}
316
317/// Create a nested name specifier for the declaring context of
318/// the type.
320 const ASTContext &Ctx, const Type *TypePtr,
321 bool FullyQualified, bool WithGlobalNsPrefix) {
322 if (!TypePtr) return nullptr;
323
324 Decl *Decl = nullptr;
325 // There are probably other cases ...
326 if (const auto *TDT = dyn_cast<TypedefType>(TypePtr)) {
327 Decl = TDT->getDecl();
328 } else if (const auto *TagDeclType = dyn_cast<TagType>(TypePtr)) {
329 Decl = TagDeclType->getDecl();
330 } else if (const auto *TST = dyn_cast<TemplateSpecializationType>(TypePtr)) {
331 Decl = TST->getTemplateName().getAsTemplateDecl();
332 } else {
333 Decl = TypePtr->getAsCXXRecordDecl();
334 }
335
336 if (!Decl) return nullptr;
337
339 Ctx, Decl, FullyQualified, WithGlobalNsPrefix);
340}
341
343 const NamespaceDecl *Namespace,
344 bool WithGlobalNsPrefix) {
345 while (Namespace && Namespace->isInline()) {
346 // Ignore inline namespace;
347 Namespace = dyn_cast<NamespaceDecl>(Namespace->getDeclContext());
348 }
349 if (!Namespace) return nullptr;
350
351 bool FullyQualified = true; // doesn't matter, DeclContexts are namespaces
353 Ctx,
354 createOuterNNS(Ctx, Namespace, FullyQualified, WithGlobalNsPrefix),
355 Namespace);
356}
357
359 const TypeDecl *TD,
360 bool FullyQualify,
361 bool WithGlobalNsPrefix) {
362 const Type *TypePtr = TD->getTypeForDecl();
363 if (isa<const TemplateSpecializationType>(TypePtr) ||
364 isa<const RecordType>(TypePtr)) {
365 // We are asked to fully qualify and we have a Record Type (which
366 // may point to a template specialization) or Template
367 // Specialization Type. We need to fully qualify their arguments.
368
369 TypePtr = getFullyQualifiedTemplateType(Ctx, TypePtr, WithGlobalNsPrefix);
370 }
371
373 Ctx, createOuterNNS(Ctx, TD, FullyQualify, WithGlobalNsPrefix),
374 false /*No TemplateKeyword*/, TypePtr);
375}
376
377/// Return the fully qualified type, including fully-qualified
378/// versions of any template parameters.
380 bool WithGlobalNsPrefix) {
381 // In case of myType* we need to strip the pointer first, fully
382 // qualify and attach the pointer once again.
383 if (isa<PointerType>(QT.getTypePtr())) {
384 // Get the qualifiers.
385 Qualifiers Quals = QT.getQualifiers();
386 QT = getFullyQualifiedType(QT->getPointeeType(), Ctx, WithGlobalNsPrefix);
387 QT = Ctx.getPointerType(QT);
388 // Add back the qualifiers.
389 QT = Ctx.getQualifiedType(QT, Quals);
390 return QT;
391 }
392
393 if (auto *MPT = dyn_cast<MemberPointerType>(QT.getTypePtr())) {
394 // Get the qualifiers.
395 Qualifiers Quals = QT.getQualifiers();
396 // Fully qualify the pointee and class types.
397 QT = getFullyQualifiedType(QT->getPointeeType(), Ctx, WithGlobalNsPrefix);
398 QualType Class = getFullyQualifiedType(QualType(MPT->getClass(), 0), Ctx,
399 WithGlobalNsPrefix);
400 QT = Ctx.getMemberPointerType(QT, Class.getTypePtr());
401 // Add back the qualifiers.
402 QT = Ctx.getQualifiedType(QT, Quals);
403 return QT;
404 }
405
406 // In case of myType& we need to strip the reference first, fully
407 // qualify and attach the reference once again.
408 if (isa<ReferenceType>(QT.getTypePtr())) {
409 // Get the qualifiers.
410 bool IsLValueRefTy = isa<LValueReferenceType>(QT.getTypePtr());
411 Qualifiers Quals = QT.getQualifiers();
412 QT = getFullyQualifiedType(QT->getPointeeType(), Ctx, WithGlobalNsPrefix);
413 // Add the r- or l-value reference type back to the fully
414 // qualified one.
415 if (IsLValueRefTy)
416 QT = Ctx.getLValueReferenceType(QT);
417 else
418 QT = Ctx.getRValueReferenceType(QT);
419 // Add back the qualifiers.
420 QT = Ctx.getQualifiedType(QT, Quals);
421 return QT;
422 }
423
424 // Remove the part of the type related to the type being a template
425 // parameter (we won't report it as part of the 'type name' and it
426 // is actually make the code below to be more complex (to handle
427 // those)
428 while (isa<SubstTemplateTypeParmType>(QT.getTypePtr())) {
429 // Get the qualifiers.
430 Qualifiers Quals = QT.getQualifiers();
431
432 QT = cast<SubstTemplateTypeParmType>(QT.getTypePtr())->desugar();
433
434 // Add back the qualifiers.
435 QT = Ctx.getQualifiedType(QT, Quals);
436 }
437
438 NestedNameSpecifier *Prefix = nullptr;
439 // Local qualifiers are attached to the QualType outside of the
440 // elaborated type. Retrieve them before descending into the
441 // elaborated type.
442 Qualifiers PrefixQualifiers = QT.getLocalQualifiers();
443 QT = QualType(QT.getTypePtr(), 0);
445 if (const auto *ETypeInput = dyn_cast<ElaboratedType>(QT.getTypePtr())) {
446 QT = ETypeInput->getNamedType();
447 assert(!QT.hasLocalQualifiers());
448 Keyword = ETypeInput->getKeyword();
449 }
450
451 // We don't consider the alias introduced by `using a::X` as a new type.
452 // The qualified name is still a::X.
453 if (const auto *UT = QT->getAs<UsingType>()) {
454 QT = Ctx.getQualifiedType(UT->getUnderlyingType(), PrefixQualifiers);
455 return getFullyQualifiedType(QT, Ctx, WithGlobalNsPrefix);
456 }
457
458 // Create a nested name specifier if needed.
460 true /*FullyQualified*/,
461 WithGlobalNsPrefix);
462
463 // In case of template specializations iterate over the arguments and
464 // fully qualify them as well.
465 if (isa<const TemplateSpecializationType>(QT.getTypePtr()) ||
466 isa<const RecordType>(QT.getTypePtr())) {
467 // We are asked to fully qualify and we have a Record Type (which
468 // may point to a template specialization) or Template
469 // Specialization Type. We need to fully qualify their arguments.
470
471 const Type *TypePtr = getFullyQualifiedTemplateType(
472 Ctx, QT.getTypePtr(), WithGlobalNsPrefix);
473 QT = QualType(TypePtr, 0);
474 }
475 if (Prefix || Keyword != ElaboratedTypeKeyword::None) {
476 QT = Ctx.getElaboratedType(Keyword, Prefix, QT);
477 }
478 QT = Ctx.getQualifiedType(QT, PrefixQualifiers);
479 return QT;
480}
481
483 const ASTContext &Ctx,
484 const PrintingPolicy &Policy,
485 bool WithGlobalNsPrefix) {
486 QualType FQQT = getFullyQualifiedType(QT, Ctx, WithGlobalNsPrefix);
487 return FQQT.getAsString(Policy);
488}
489
490} // end namespace TypeName
491} // end namespace clang
const Decl * D
Expr * E
Defines the C++ template declaration subclasses.
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Definition: ASTContext.h:186
QualType getRValueReferenceType(QualType T) const
Return the uniqued reference to the type for an rvalue reference to the specified type.
QualType getMemberPointerType(QualType T, const Type *Cls) const
Return the uniqued reference to the type for a member pointer to the specified type in the specified ...
QualType getTemplateSpecializationType(TemplateName T, ArrayRef< TemplateArgument > Args, QualType Canon=QualType()) const
TemplateName getQualifiedTemplateName(NestedNameSpecifier *NNS, bool TemplateKeyword, TemplateName Template) const
Retrieve the template name that represents a qualified template name such as std::vector.
QualType getPointerType(QualType T) const
Return the uniqued reference to the type for a pointer to the specified type.
QualType getLValueReferenceType(QualType T, bool SpelledAsLValue=true) const
Return the uniqued reference to the type for an lvalue reference to the specified type.
QualType getQualifiedType(SplitQualType split) const
Un-split a SplitQualType.
Definition: ASTContext.h:2207
QualType getElaboratedType(ElaboratedTypeKeyword Keyword, NestedNameSpecifier *NNS, QualType NamedType, TagDecl *OwnedTagDecl=nullptr) const
Declaration of a class template.
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
Definition: DeclBase.h:1425
bool isTranslationUnit() const
Definition: DeclBase.h:2155
DeclContext * getRedeclContext()
getRedeclContext - Retrieve the context in which an entity conflicts with other entities of the same ...
Definition: DeclBase.cpp:1964
Decl - This represents one declaration (or definition), e.g.
Definition: DeclBase.h:86
DeclContext * getDeclContext()
Definition: DeclBase.h:454
Represent a C++ namespace.
Definition: Decl.h:547
Represents a C++ nested name specifier, such as "\::std::vector<int>::".
static NestedNameSpecifier * Create(const ASTContext &Context, NestedNameSpecifier *Prefix, const IdentifierInfo *II)
Builds a specifier combining a prefix and an identifier.
static NestedNameSpecifier * GlobalSpecifier(const ASTContext &Context)
Returns the nested name specifier representing the global scope.
@ NamespaceAlias
A namespace alias, stored as a NamespaceAliasDecl*.
@ TypeSpec
A type, stored as a Type*.
@ TypeSpecWithTemplate
A type that was preceded by the 'template' keyword, stored as a Type*.
@ Super
Microsoft's '__super' specifier, stored as a CXXRecordDecl* of the class it appeared in.
@ Identifier
An identifier, stored as an IdentifierInfo*.
@ Global
The global specifier '::'. There is no stored value.
@ Namespace
A namespace, stored as a NamespaceDecl*.
A (possibly-)qualified type.
Definition: Type.h:941
bool hasLocalQualifiers() const
Determine whether this particular QualType instance has any qualifiers, without looking through any t...
Definition: Type.h:1068
const Type * getTypePtr() const
Retrieves a pointer to the underlying (unqualified) type.
Definition: Type.h:7743
Qualifiers getQualifiers() const
Retrieve the set of qualifiers applied to this type.
Definition: Type.h:7783
static std::string getAsString(SplitQualType split, const PrintingPolicy &Policy)
Definition: Type.h:1339
Qualifiers getLocalQualifiers() const
Retrieve the set of qualifiers local to this particular QualType instance, not including any qualifie...
Definition: Type.h:7775
Represents a template name as written in source code.
Definition: TemplateName.h:434
NestedNameSpecifier * getQualifier() const
Return the nested name specifier that qualifies this name.
Definition: TemplateName.h:462
bool hasTemplateKeyword() const
Whether the template name was prefixed by the "template" keyword.
Definition: TemplateName.h:466
The collection of all-type qualifiers we support.
Definition: Type.h:319
Scope - A scope is a transient data structure that is used while parsing the program.
Definition: Scope.h:41
Represents the declaration of a struct/union/class/enum.
Definition: Decl.h:3557
A template argument list.
Definition: DeclTemplate.h:244
unsigned size() const
Retrieve the number of template arguments in this template argument list.
Definition: DeclTemplate.h:280
Represents a template argument.
Definition: TemplateBase.h:61
QualType getAsType() const
Retrieve the type for a type template argument.
Definition: TemplateBase.h:319
TemplateName getAsTemplate() const
Retrieve the template name for a template name argument.
Definition: TemplateBase.h:343
@ Template
The template argument is a template name that was provided for a template template parameter.
Definition: TemplateBase.h:93
@ Type
The template argument is a type.
Definition: TemplateBase.h:70
ArgKind getKind() const
Return the kind of stored template argument.
Definition: TemplateBase.h:295
The base class of all kinds of template declarations (e.g., class, function, etc.).
Definition: DeclTemplate.h:394
Represents a C++ template name within the type system.
Definition: TemplateName.h:203
TemplateDecl * getAsTemplateDecl() const
Retrieve the underlying template declaration that this template name refers to, if known.
QualifiedTemplateName * getAsQualifiedTemplateName() const
Retrieve the underlying qualified template name structure, if any.
UsingShadowDecl * getAsUsingShadowDecl() const
Retrieve the using shadow declaration through which the underlying template declaration is introduced...
Represents a declaration of a type.
Definition: Decl.h:3363
const Type * getTypeForDecl() const
Definition: Decl.h:3387
The base class of the type hierarchy.
Definition: Type.h:1829
CXXRecordDecl * getAsCXXRecordDecl() const
Retrieves the CXXRecordDecl that this type refers to, either because the type is a RecordType or beca...
Definition: Type.cpp:1882
QualType getPointeeType() const
If this is a pointer, ObjC object pointer, or block pointer, this returns the respective pointee.
Definition: Type.cpp:705
const T * getAs() const
Member-template getAs<specific type>'.
Definition: Type.h:8516
Represents a shadow declaration implicitly introduced into a scope by a (resolved) using-declaration ...
Definition: DeclCXX.h:3320
static NestedNameSpecifier * createOuterNNS(const ASTContext &Ctx, const Decl *D, bool FullyQualify, bool WithGlobalNsPrefix)
static bool getFullyQualifiedTemplateName(const ASTContext &Ctx, TemplateName &TName, bool WithGlobalNsPrefix)
static const Type * getFullyQualifiedTemplateType(const ASTContext &Ctx, const Type *TypePtr, bool WithGlobalNsPrefix)
static NestedNameSpecifier * getFullyQualifiedNestedNameSpecifier(const ASTContext &Ctx, NestedNameSpecifier *scope, bool WithGlobalNsPrefix)
Return a fully qualified version of this name specifier.
static bool getFullyQualifiedTemplateArgument(const ASTContext &Ctx, TemplateArgument &Arg, bool WithGlobalNsPrefix)
static NestedNameSpecifier * createNestedNameSpecifierForScopeOf(const ASTContext &Ctx, const Decl *decl, bool FullyQualified, bool WithGlobalNsPrefix)
Create a nested name specifier for the declaring context of the type.
std::string getFullyQualifiedName(QualType QT, const ASTContext &Ctx, const PrintingPolicy &Policy, bool WithGlobalNsPrefix=false)
Get the fully qualified name for a type.
static NestedNameSpecifier * createNestedNameSpecifier(const ASTContext &Ctx, const NamespaceDecl *Namesp, bool WithGlobalNsPrefix)
Create a NestedNameSpecifier for Namesp and its enclosing scopes.
QualType getFullyQualifiedType(QualType QT, const ASTContext &Ctx, bool WithGlobalNsPrefix=false)
Generates a QualType that can be used to name the same type if used at the end of the current transla...
const internal::VariadicAllOfMatcher< Decl > decl
Matches declarations.
The JSON file list parser is used to communicate input to InstallAPI.
ElaboratedTypeKeyword
The elaboration keyword that precedes a qualified type name or introduces an elaborated-type-specifie...
Definition: Type.h:6658
@ None
No keyword precedes the qualified type name.
@ Class
The "class" keyword introduces the elaborated-type-specifier.
Describes how types, statements, expressions, and declarations should be printed.
Definition: PrettyPrinter.h:57