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