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