clang 20.0.0git
TemplateName.h
Go to the documentation of this file.
1//===- TemplateName.h - C++ Template Name Representation --------*- 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 TemplateName interface and subclasses.
10//
11//===----------------------------------------------------------------------===//
12
13#ifndef LLVM_CLANG_AST_TEMPLATENAME_H
14#define LLVM_CLANG_AST_TEMPLATENAME_H
15
18#include "clang/Basic/LLVM.h"
19#include "llvm/ADT/FoldingSet.h"
20#include "llvm/ADT/PointerIntPair.h"
21#include "llvm/ADT/PointerUnion.h"
22#include "llvm/Support/PointerLikeTypeTraits.h"
23#include <cassert>
24#include <optional>
25
26namespace clang {
27
28class ASTContext;
29class Decl;
30class DependentTemplateName;
31class IdentifierInfo;
32class NamedDecl;
33class NestedNameSpecifier;
35class OverloadedTemplateStorage;
36class AssumedTemplateStorage;
37class DeducedTemplateStorage;
38struct PrintingPolicy;
39class QualifiedTemplateName;
40class SubstTemplateTemplateParmPackStorage;
41class SubstTemplateTemplateParmStorage;
42class TemplateArgument;
43class TemplateDecl;
44class TemplateTemplateParmDecl;
45class UsingShadowDecl;
46
47/// Implementation class used to describe either a set of overloaded
48/// template names or an already-substituted template template parameter pack.
50protected:
51 enum Kind {
53 Assumed, // defined in DeclarationName.h
57 };
58
59 struct BitsTag {
60 LLVM_PREFERRED_TYPE(Kind)
62
63 // The template parameter index.
64 unsigned Index : 14;
65
66 /// The pack index, or the number of stored templates
67 /// or template arguments, depending on which subclass we have.
68 unsigned Data : 15;
69 };
70
71 union {
72 struct BitsTag Bits;
74 };
75
77 Bits.Kind = Kind;
79 Bits.Data = Data;
80 }
81
82public:
84 return Bits.Kind == Overloaded
85 ? reinterpret_cast<OverloadedTemplateStorage *>(this)
86 : nullptr;
87 }
88
90 return Bits.Kind == Assumed
91 ? reinterpret_cast<AssumedTemplateStorage *>(this)
92 : nullptr;
93 }
94
96 return Bits.Kind == Deduced
97 ? reinterpret_cast<DeducedTemplateStorage *>(this)
98 : nullptr;
99 }
100
103 ? reinterpret_cast<SubstTemplateTemplateParmStorage *>(this)
104 : nullptr;
105 }
106
109 ? reinterpret_cast<SubstTemplateTemplateParmPackStorage *>(this)
110 : nullptr;
111 }
112};
113
114/// A structure for storing the information associated with an
115/// overloaded template name.
117 friend class ASTContext;
118
119 OverloadedTemplateStorage(unsigned size)
120 : UncommonTemplateNameStorage(Overloaded, 0, size) {}
121
123 return reinterpret_cast<NamedDecl **>(this + 1);
124 }
125 NamedDecl * const *getStorage() const {
126 return reinterpret_cast<NamedDecl *const *>(this + 1);
127 }
128
129public:
130 unsigned size() const { return Bits.Data; }
131
132 using iterator = NamedDecl *const *;
133
134 iterator begin() const { return getStorage(); }
135 iterator end() const { return getStorage() + Bits.Data; }
136
138 return llvm::ArrayRef(begin(), end());
139 }
140};
141
142/// A structure for storing an already-substituted template template
143/// parameter pack.
144///
145/// This kind of template names occurs when the parameter pack has been
146/// provided with a template template argument pack in a context where its
147/// enclosing pack expansion could not be fully expanded.
149 public llvm::FoldingSetNode {
150 const TemplateArgument *Arguments;
151 llvm::PointerIntPair<Decl *, 1, bool> AssociatedDeclAndFinal;
152
153public:
155 Decl *AssociatedDecl, unsigned Index,
156 bool Final);
157
158 /// A template-like entity which owns the whole pattern being substituted.
159 /// This will own a set of template parameters.
160 Decl *getAssociatedDecl() const;
161
162 /// Returns the index of the replaced parameter in the associated declaration.
163 /// This should match the result of `getParameterPack()->getIndex()`.
164 unsigned getIndex() const { return Bits.Index; }
165
166 // When true the substitution will be 'Final' (subst node won't be placed).
167 bool getFinal() const;
168
169 /// Retrieve the template template parameter pack being substituted.
170 TemplateTemplateParmDecl *getParameterPack() const;
171
172 /// Retrieve the template template argument pack with which this
173 /// parameter was substituted.
174 TemplateArgument getArgumentPack() const;
175
176 void Profile(llvm::FoldingSetNodeID &ID, ASTContext &Context);
177
178 static void Profile(llvm::FoldingSetNodeID &ID, ASTContext &Context,
179 const TemplateArgument &ArgPack, Decl *AssociatedDecl,
180 unsigned Index, bool Final);
181};
182
184 // The position in the template parameter list
185 // the first argument corresponds to.
186 unsigned StartPos;
188
189 operator bool() const { return !Args.empty(); }
190};
191
192/// Represents a C++ template name within the type system.
193///
194/// A C++ template name refers to a template within the C++ type
195/// system. In most cases, a template name is simply a reference to a
196/// class template, e.g.
197///
198/// \code
199/// template<typename T> class X { };
200///
201/// X<int> xi;
202/// \endcode
203///
204/// Here, the 'X' in \c X<int> is a template name that refers to the
205/// declaration of the class template X, above. Template names can
206/// also refer to function templates, C++0x template aliases, etc.
207///
208/// Some template names are dependent. For example, consider:
209///
210/// \code
211/// template<typename MetaFun, typename T1, typename T2> struct apply2 {
212/// typedef typename MetaFun::template apply<T1, T2>::type type;
213/// };
214/// \endcode
215///
216/// Here, "apply" is treated as a template name within the typename
217/// specifier in the typedef. "apply" is a nested template, and can
218/// only be understood in the context of a template instantiation,
219/// hence is represented as a dependent template name.
221 // NameDecl is either a TemplateDecl or a UsingShadowDecl depending on the
222 // NameKind.
223 // !! There is no free low bits in 32-bit builds to discriminate more than 4
224 // pointer types in PointerUnion.
225 using StorageType =
226 llvm::PointerUnion<Decl *, UncommonTemplateNameStorage *,
228
229 StorageType Storage;
230
231 explicit TemplateName(void *Ptr);
232
233public:
234 // Kind of name that is actually stored.
235 enum NameKind {
236 /// A single template declaration.
238
239 /// A set of overloaded template declarations.
241
242 /// An unqualified-id that has been assumed to name a function template
243 /// that will be found by ADL.
245
246 /// A qualified template name, where the qualification is kept
247 /// to describe the source code as written.
249
250 /// A dependent template name that has not been resolved to a
251 /// template (or set of templates).
253
254 /// A template template parameter that has been substituted
255 /// for some other template name.
257
258 /// A template template parameter pack that has been substituted for
259 /// a template template argument pack, but has not yet been expanded into
260 /// individual arguments.
262
263 /// A template name that refers to a template declaration found through a
264 /// specific using shadow declaration.
266
267 /// A template name that refers to another TemplateName with deduced default
268 /// arguments.
270 };
271
272 TemplateName() = default;
273 explicit TemplateName(TemplateDecl *Template);
274 explicit TemplateName(OverloadedTemplateStorage *Storage);
275 explicit TemplateName(AssumedTemplateStorage *Storage);
278 explicit TemplateName(QualifiedTemplateName *Qual);
279 explicit TemplateName(DependentTemplateName *Dep);
280 explicit TemplateName(UsingShadowDecl *Using);
281 explicit TemplateName(DeducedTemplateStorage *Deduced);
282
283 /// Determine whether this template name is NULL.
284 bool isNull() const;
285
286 // Get the kind of name that is actually stored.
287 NameKind getKind() const;
288
289 /// Retrieve the underlying template declaration that
290 /// this template name refers to, if known.
291 ///
292 /// \returns The template declaration that this template name refers
293 /// to, if any. If the template name does not refer to a specific
294 /// declaration because it is a dependent name, or if it refers to a
295 /// set of function templates, returns NULL.
296 TemplateDecl *getAsTemplateDecl(bool IgnoreDeduced = false) const;
297
298 /// Retrieves the underlying template declaration that
299 /// this template name refers to, along with the
300 /// deduced default arguments, if any.
301 std::pair<TemplateDecl *, DefaultArguments>
302 getTemplateDeclAndDefaultArgs() const;
303
304 /// Retrieve the underlying, overloaded function template
305 /// declarations that this template name refers to, if known.
306 ///
307 /// \returns The set of overloaded function templates that this template
308 /// name refers to, if known. If the template name does not refer to a
309 /// specific set of function templates because it is a dependent name or
310 /// refers to a single template, returns NULL.
311 OverloadedTemplateStorage *getAsOverloadedTemplate() const;
312
313 /// Retrieve information on a name that has been assumed to be a
314 /// template-name in order to permit a call via ADL.
315 AssumedTemplateStorage *getAsAssumedTemplateName() const;
316
317 /// Retrieve the substituted template template parameter, if
318 /// known.
319 ///
320 /// \returns The storage for the substituted template template parameter,
321 /// if known. Otherwise, returns NULL.
322 SubstTemplateTemplateParmStorage *getAsSubstTemplateTemplateParm() const;
323
324 /// Retrieve the substituted template template parameter pack, if
325 /// known.
326 ///
327 /// \returns The storage for the substituted template template parameter pack,
328 /// if known. Otherwise, returns NULL.
330 getAsSubstTemplateTemplateParmPack() const;
331
332 /// Retrieve the underlying qualified template name
333 /// structure, if any.
334 QualifiedTemplateName *getAsQualifiedTemplateName() const;
335
336 /// Retrieve the underlying dependent template name
337 /// structure, if any.
338 DependentTemplateName *getAsDependentTemplateName() const;
339
340 /// Retrieve the using shadow declaration through which the underlying
341 /// template declaration is introduced, if any.
342 UsingShadowDecl *getAsUsingShadowDecl() const;
343
344 /// Retrieve the deduced template info, if any.
345 DeducedTemplateStorage *getAsDeducedTemplateName() const;
346
347 std::optional<TemplateName> desugar(bool IgnoreDeduced) const;
348
349 TemplateName getUnderlying() const;
350
351 TemplateNameDependence getDependence() const;
352
353 /// Determines whether this is a dependent template name.
354 bool isDependent() const;
355
356 /// Determines whether this is a template name that somehow
357 /// depends on a template parameter.
358 bool isInstantiationDependent() const;
359
360 /// Determines whether this template name contains an
361 /// unexpanded parameter pack (for C++0x variadic templates).
362 bool containsUnexpandedParameterPack() const;
363
364 enum class Qualified { None, AsWritten };
365 /// Print the template name.
366 ///
367 /// \param OS the output stream to which the template name will be
368 /// printed.
369 ///
370 /// \param Qual print the (Qualified::None) simple name,
371 /// (Qualified::AsWritten) any written (possibly partial) qualifier, or
372 /// (Qualified::Fully) the fully qualified name.
373 void print(raw_ostream &OS, const PrintingPolicy &Policy,
374 Qualified Qual = Qualified::AsWritten) const;
375
376 /// Debugging aid that dumps the template name.
377 void dump(raw_ostream &OS, const ASTContext &Context) const;
378
379 /// Debugging aid that dumps the template name to standard
380 /// error.
381 void dump() const;
382
383 void Profile(llvm::FoldingSetNodeID &ID) {
384 ID.AddPointer(Storage.getOpaqueValue());
385 }
386
387 /// Retrieve the template name as a void pointer.
388 void *getAsVoidPointer() const { return Storage.getOpaqueValue(); }
389
390 /// Build a template name from a void pointer.
392 return TemplateName(Ptr);
393 }
394
395 /// Structural equality.
396 bool operator==(TemplateName Other) const { return Storage == Other.Storage; }
397 bool operator!=(TemplateName Other) const { return !operator==(Other); }
398};
399
400/// Insertion operator for diagnostics. This allows sending TemplateName's
401/// into a diagnostic with <<.
402const StreamingDiagnostic &operator<<(const StreamingDiagnostic &DB,
403 TemplateName N);
404
405/// A structure for storing the information associated with a
406/// substituted template template parameter.
408 : public UncommonTemplateNameStorage, public llvm::FoldingSetNode {
409 friend class ASTContext;
410
411 TemplateName Replacement;
412 Decl *AssociatedDecl;
413
415 Decl *AssociatedDecl, unsigned Index,
416 std::optional<unsigned> PackIndex)
417 : UncommonTemplateNameStorage(SubstTemplateTemplateParm, Index,
418 PackIndex ? *PackIndex + 1 : 0),
419 Replacement(Replacement), AssociatedDecl(AssociatedDecl) {
420 assert(AssociatedDecl != nullptr);
421 }
422
423public:
424 /// A template-like entity which owns the whole pattern being substituted.
425 /// This will own a set of template parameters.
426 Decl *getAssociatedDecl() const { return AssociatedDecl; }
427
428 /// Returns the index of the replaced parameter in the associated declaration.
429 /// This should match the result of `getParameter()->getIndex()`.
430 unsigned getIndex() const { return Bits.Index; }
431
432 std::optional<unsigned> getPackIndex() const {
433 if (Bits.Data == 0)
434 return std::nullopt;
435 return Bits.Data - 1;
436 }
437
438 TemplateTemplateParmDecl *getParameter() const;
439 TemplateName getReplacement() const { return Replacement; }
440
441 void Profile(llvm::FoldingSetNodeID &ID);
442
443 static void Profile(llvm::FoldingSetNodeID &ID, TemplateName Replacement,
444 Decl *AssociatedDecl, unsigned Index,
445 std::optional<unsigned> PackIndex);
446};
447
449 public llvm::FoldingSetNode {
450 friend class ASTContext;
451
452 TemplateName Underlying;
453
455 const DefaultArguments &DefArgs);
456
457public:
458 TemplateName getUnderlying() const { return Underlying; }
459
461 return {/*StartPos=*/Bits.Index,
462 /*Args=*/{reinterpret_cast<const TemplateArgument *>(this + 1),
463 Bits.Data}};
464 }
465
466 void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Context) const;
467
468 static void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Context,
469 TemplateName Underlying, const DefaultArguments &DefArgs);
470};
471
475 return subst->getReplacement().getUnderlying();
476 return *this;
477}
478
479/// Represents a template name as written in source code.
480///
481/// This kind of template name may refer to a template name that was
482/// preceded by a nested name specifier, e.g., \c std::vector. Here,
483/// the nested name specifier is "std::" and the template name is the
484/// declaration for "vector". It may also have been written with the
485/// 'template' keyword. The QualifiedTemplateName class is only
486/// used to provide "sugar" for template names, so that they can
487/// be differentiated from canonical template names. and has no
488/// semantic meaning. In this manner, it is to TemplateName what
489/// ElaboratedType is to Type, providing extra syntactic sugar
490/// for downstream clients.
491class QualifiedTemplateName : public llvm::FoldingSetNode {
492 friend class ASTContext;
493
494 /// The nested name specifier that qualifies the template name.
495 ///
496 /// The bit is used to indicate whether the "template" keyword was
497 /// present before the template name itself. Note that the
498 /// "template" keyword is always redundant in this case (otherwise,
499 /// the template name would be a dependent name and we would express
500 /// this name with DependentTemplateName).
501 llvm::PointerIntPair<NestedNameSpecifier *, 1> Qualifier;
502
503 /// The underlying template name, it is either
504 /// 1) a Template -- a template declaration that this qualified name refers
505 /// to.
506 /// 2) or a UsingTemplate -- a template declaration introduced by a
507 /// using-shadow declaration.
508 TemplateName UnderlyingTemplate;
509
510 QualifiedTemplateName(NestedNameSpecifier *NNS, bool TemplateKeyword,
511 TemplateName Template)
512 : Qualifier(NNS, TemplateKeyword ? 1 : 0), UnderlyingTemplate(Template) {
513 assert(UnderlyingTemplate.getKind() == TemplateName::Template ||
514 UnderlyingTemplate.getKind() == TemplateName::UsingTemplate);
515 }
516
517public:
518 /// Return the nested name specifier that qualifies this name.
519 NestedNameSpecifier *getQualifier() const { return Qualifier.getPointer(); }
520
521 /// Whether the template name was prefixed by the "template"
522 /// keyword.
523 bool hasTemplateKeyword() const { return Qualifier.getInt(); }
524
525 /// Return the underlying template name.
526 TemplateName getUnderlyingTemplate() const { return UnderlyingTemplate; }
527
528 void Profile(llvm::FoldingSetNodeID &ID) {
529 Profile(ID, getQualifier(), hasTemplateKeyword(), UnderlyingTemplate);
530 }
531
532 static void Profile(llvm::FoldingSetNodeID &ID, NestedNameSpecifier *NNS,
533 bool TemplateKeyword, TemplateName TN) {
534 ID.AddPointer(NNS);
535 ID.AddBoolean(TemplateKeyword);
536 ID.AddPointer(TN.getAsVoidPointer());
537 }
538};
539
540/// Represents a dependent template name that cannot be
541/// resolved prior to template instantiation.
542///
543/// This kind of template name refers to a dependent template name,
544/// including its nested name specifier (if any). For example,
545/// DependentTemplateName can refer to "MetaFun::template apply",
546/// where "MetaFun::" is the nested name specifier and "apply" is the
547/// template name referenced. The "template" keyword is implied.
548class DependentTemplateName : public llvm::FoldingSetNode {
549 friend class ASTContext;
550
551 /// The nested name specifier that qualifies the template
552 /// name.
553 ///
554 /// The bit stored in this qualifier describes whether the \c Name field
555 /// is interpreted as an IdentifierInfo pointer (when clear) or as an
556 /// overloaded operator kind (when set).
557 llvm::PointerIntPair<NestedNameSpecifier *, 1, bool> Qualifier;
558
559 /// The dependent template name.
560 union {
561 /// The identifier template name.
562 ///
563 /// Only valid when the bit on \c Qualifier is clear.
565
566 /// The overloaded operator name.
567 ///
568 /// Only valid when the bit on \c Qualifier is set.
570 };
571
572 /// The canonical template name to which this dependent
573 /// template name refers.
574 ///
575 /// The canonical template name for a dependent template name is
576 /// another dependent template name whose nested name specifier is
577 /// canonical.
578 TemplateName CanonicalTemplateName;
579
582 : Qualifier(Qualifier, false), Identifier(Identifier),
583 CanonicalTemplateName(this) {}
584
585 DependentTemplateName(NestedNameSpecifier *Qualifier,
586 const IdentifierInfo *Identifier,
587 TemplateName Canon)
588 : Qualifier(Qualifier, false), Identifier(Identifier),
589 CanonicalTemplateName(Canon) {}
590
591 DependentTemplateName(NestedNameSpecifier *Qualifier,
592 OverloadedOperatorKind Operator)
593 : Qualifier(Qualifier, true), Operator(Operator),
594 CanonicalTemplateName(this) {}
595
596 DependentTemplateName(NestedNameSpecifier *Qualifier,
597 OverloadedOperatorKind Operator,
598 TemplateName Canon)
599 : Qualifier(Qualifier, true), Operator(Operator),
600 CanonicalTemplateName(Canon) {}
601
602public:
603 /// Return the nested name specifier that qualifies this name.
604 NestedNameSpecifier *getQualifier() const { return Qualifier.getPointer(); }
605
606 /// Determine whether this template name refers to an identifier.
607 bool isIdentifier() const { return !Qualifier.getInt(); }
608
609 /// Returns the identifier to which this template name refers.
611 assert(isIdentifier() && "Template name isn't an identifier?");
612 return Identifier;
613 }
614
615 /// Determine whether this template name refers to an overloaded
616 /// operator.
617 bool isOverloadedOperator() const { return Qualifier.getInt(); }
618
619 /// Return the overloaded operator to which this template name refers.
621 assert(isOverloadedOperator() &&
622 "Template name isn't an overloaded operator?");
623 return Operator;
624 }
625
626 void Profile(llvm::FoldingSetNodeID &ID) {
627 if (isIdentifier())
628 Profile(ID, getQualifier(), getIdentifier());
629 else
630 Profile(ID, getQualifier(), getOperator());
631 }
632
633 static void Profile(llvm::FoldingSetNodeID &ID, NestedNameSpecifier *NNS,
634 const IdentifierInfo *Identifier) {
635 ID.AddPointer(NNS);
636 ID.AddBoolean(false);
637 ID.AddPointer(Identifier);
638 }
639
640 static void Profile(llvm::FoldingSetNodeID &ID, NestedNameSpecifier *NNS,
641 OverloadedOperatorKind Operator) {
642 ID.AddPointer(NNS);
643 ID.AddBoolean(true);
644 ID.AddInteger(Operator);
645 }
646};
647
648} // namespace clang.
649
650namespace llvm {
651
652/// The clang::TemplateName class is effectively a pointer.
653template<>
654struct PointerLikeTypeTraits<clang::TemplateName> {
655 static inline void *getAsVoidPointer(clang::TemplateName TN) {
656 return TN.getAsVoidPointer();
657 }
658
659 static inline clang::TemplateName getFromVoidPointer(void *Ptr) {
661 }
662
663 // No bits are available!
664 static constexpr int NumLowBitsAvailable = 0;
665};
666
667} // namespace llvm.
668
669#endif // LLVM_CLANG_AST_TEMPLATENAME_H
static char ID
Definition: Arena.cpp:183
static llvm::GlobalValue::DLLStorageClassTypes getStorage(CodeGenModule &CGM, StringRef Name)
Definition: CGObjCMac.cpp:6430
static void dump(llvm::raw_ostream &OS, StringRef FunctionName, ArrayRef< CounterExpression > Expressions, ArrayRef< CounterMappingRegion > Regions)
static Decl::Kind getKind(const Decl *D)
Definition: DeclBase.cpp:1172
StringRef Identifier
Definition: Format.cpp:3040
static void print(llvm::raw_ostream &OS, const T &V, ASTContext &ASTCtx, QualType Ty)
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified.
static StringRef getIdentifier(const Token &Tok)
__device__ int
#define bool
Definition: amdgpuintrin.h:20
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Definition: ASTContext.h:188
A structure for storing the information associated with a name that has been assumed to be a template...
Decl - This represents one declaration (or definition), e.g.
Definition: DeclBase.h:86
TemplateName getUnderlying() const
Definition: TemplateName.h:458
DefaultArguments getDefaultArguments() const
Definition: TemplateName.h:460
Represents a dependent template name that cannot be resolved prior to template instantiation.
Definition: TemplateName.h:548
OverloadedOperatorKind Operator
The overloaded operator name.
Definition: TemplateName.h:569
OverloadedOperatorKind getOperator() const
Return the overloaded operator to which this template name refers.
Definition: TemplateName.h:620
bool isIdentifier() const
Determine whether this template name refers to an identifier.
Definition: TemplateName.h:607
static void Profile(llvm::FoldingSetNodeID &ID, NestedNameSpecifier *NNS, OverloadedOperatorKind Operator)
Definition: TemplateName.h:640
NestedNameSpecifier * getQualifier() const
Return the nested name specifier that qualifies this name.
Definition: TemplateName.h:604
static void Profile(llvm::FoldingSetNodeID &ID, NestedNameSpecifier *NNS, const IdentifierInfo *Identifier)
Definition: TemplateName.h:633
const IdentifierInfo * getIdentifier() const
Returns the identifier to which this template name refers.
Definition: TemplateName.h:610
const IdentifierInfo * Identifier
The identifier template name.
Definition: TemplateName.h:564
void Profile(llvm::FoldingSetNodeID &ID)
Definition: TemplateName.h:626
bool isOverloadedOperator() const
Determine whether this template name refers to an overloaded operator.
Definition: TemplateName.h:617
One of these records is kept for each identifier that is lexed.
This represents a decl that may have a name.
Definition: Decl.h:253
Represents a C++ nested name specifier, such as "\::std::vector<int>::".
A structure for storing the information associated with an overloaded template name.
Definition: TemplateName.h:116
llvm::ArrayRef< NamedDecl * > decls() const
Definition: TemplateName.h:137
Represents a template name as written in source code.
Definition: TemplateName.h:491
static void Profile(llvm::FoldingSetNodeID &ID, NestedNameSpecifier *NNS, bool TemplateKeyword, TemplateName TN)
Definition: TemplateName.h:532
void Profile(llvm::FoldingSetNodeID &ID)
Definition: TemplateName.h:528
TemplateName getUnderlyingTemplate() const
Return the underlying template name.
Definition: TemplateName.h:526
NestedNameSpecifier * getQualifier() const
Return the nested name specifier that qualifies this name.
Definition: TemplateName.h:519
bool hasTemplateKeyword() const
Whether the template name was prefixed by the "template" keyword.
Definition: TemplateName.h:523
A structure for storing an already-substituted template template parameter pack.
Definition: TemplateName.h:149
unsigned getIndex() const
Returns the index of the replaced parameter in the associated declaration.
Definition: TemplateName.h:164
A structure for storing the information associated with a substituted template template parameter.
Definition: TemplateName.h:408
std::optional< unsigned > getPackIndex() const
Definition: TemplateName.h:432
unsigned getIndex() const
Returns the index of the replaced parameter in the associated declaration.
Definition: TemplateName.h:430
Decl * getAssociatedDecl() const
A template-like entity which owns the whole pattern being substituted.
Definition: TemplateName.h:426
Represents a template argument.
Definition: TemplateBase.h:61
The base class of all kinds of template declarations (e.g., class, function, etc.).
Definition: DeclTemplate.h:399
Represents a C++ template name within the type system.
Definition: TemplateName.h:220
TemplateName()=default
bool operator==(TemplateName Other) const
Structural equality.
Definition: TemplateName.h:396
static TemplateName getFromVoidPointer(void *Ptr)
Build a template name from a void pointer.
Definition: TemplateName.h:391
bool operator!=(TemplateName Other) const
Definition: TemplateName.h:397
NameKind getKind() const
void * getAsVoidPointer() const
Retrieve the template name as a void pointer.
Definition: TemplateName.h:388
@ UsingTemplate
A template name that refers to a template declaration found through a specific using shadow declarati...
Definition: TemplateName.h:265
@ OverloadedTemplate
A set of overloaded template declarations.
Definition: TemplateName.h:240
@ Template
A single template declaration.
Definition: TemplateName.h:237
@ DependentTemplate
A dependent template name that has not been resolved to a template (or set of templates).
Definition: TemplateName.h:252
@ SubstTemplateTemplateParm
A template template parameter that has been substituted for some other template name.
Definition: TemplateName.h:256
@ SubstTemplateTemplateParmPack
A template template parameter pack that has been substituted for a template template argument pack,...
Definition: TemplateName.h:261
@ DeducedTemplate
A template name that refers to another TemplateName with deduced default arguments.
Definition: TemplateName.h:269
@ QualifiedTemplate
A qualified template name, where the qualification is kept to describe the source code as written.
Definition: TemplateName.h:248
@ AssumedTemplate
An unqualified-id that has been assumed to name a function template that will be found by ADL.
Definition: TemplateName.h:244
void Profile(llvm::FoldingSetNodeID &ID)
Definition: TemplateName.h:383
TemplateName getUnderlying() const
Definition: TemplateName.h:472
void dump(raw_ostream &OS, const ASTContext &Context) const
Debugging aid that dumps the template name.
TemplateTemplateParmDecl - Declares a template template parameter, e.g., "T" in.
Implementation class used to describe either a set of overloaded template names or an already-substit...
Definition: TemplateName.h:49
SubstTemplateTemplateParmPackStorage * getAsSubstTemplateTemplateParmPack()
Definition: TemplateName.h:107
UncommonTemplateNameStorage(Kind Kind, unsigned Index, unsigned Data)
Definition: TemplateName.h:76
SubstTemplateTemplateParmStorage * getAsSubstTemplateTemplateParm()
Definition: TemplateName.h:101
AssumedTemplateStorage * getAsAssumedTemplateName()
Definition: TemplateName.h:89
DeducedTemplateStorage * getAsDeducedTemplateName()
Definition: TemplateName.h:95
OverloadedTemplateStorage * getAsOverloadedStorage()
Definition: TemplateName.h:83
Represents a shadow declaration implicitly introduced into a scope by a (resolved) using-declaration ...
Definition: DeclCXX.h:3338
@ Decl
The l-value was an access to a declared entity or something equivalently strong, like the address of ...
The JSON file list parser is used to communicate input to InstallAPI.
OverloadedOperatorKind
Enumeration specifying the different kinds of C++ overloaded operators.
Definition: OperatorKinds.h:21
bool operator==(const CallGraphNode::CallRecord &LHS, const CallGraphNode::CallRecord &RHS)
Definition: CallGraph.h:204
const StreamingDiagnostic & operator<<(const StreamingDiagnostic &DB, const ASTContext::SectionInfo &Section)
Insertion operator for diagnostics.
@ Other
Other implicit parameter.
Diagnostic wrappers for TextAPI types for error reporting.
Definition: Dominators.h:30
#define true
Definition: stdbool.h:25
#define false
Definition: stdbool.h:26
ArrayRef< TemplateArgument > Args
Definition: TemplateName.h:187
Describes how types, statements, expressions, and declarations should be printed.
Definition: PrettyPrinter.h:57
unsigned Data
The pack index, or the number of stored templates or template arguments, depending on which subclass ...
Definition: TemplateName.h:68
static void * getAsVoidPointer(clang::TemplateName TN)
Definition: TemplateName.h:655
static clang::TemplateName getFromVoidPointer(void *Ptr)
Definition: TemplateName.h:659