clang  17.0.0git
DeclTemplate.h
Go to the documentation of this file.
1 //===- DeclTemplate.h - Classes for representing C++ templates --*- 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 /// \file
10 /// Defines the C++ template declaration subclasses.
11 //
12 //===----------------------------------------------------------------------===//
13 
14 #ifndef LLVM_CLANG_AST_DECLTEMPLATE_H
15 #define LLVM_CLANG_AST_DECLTEMPLATE_H
16 
17 #include "clang/AST/ASTConcept.h"
18 #include "clang/AST/ASTContext.h"
19 #include "clang/AST/Decl.h"
20 #include "clang/AST/DeclBase.h"
21 #include "clang/AST/DeclCXX.h"
23 #include "clang/AST/Redeclarable.h"
24 #include "clang/AST/TemplateBase.h"
25 #include "clang/AST/Type.h"
26 #include "clang/Basic/LLVM.h"
28 #include "clang/Basic/Specifiers.h"
29 #include "llvm/ADT/ArrayRef.h"
30 #include "llvm/ADT/FoldingSet.h"
31 #include "llvm/ADT/PointerIntPair.h"
32 #include "llvm/ADT/PointerUnion.h"
33 #include "llvm/ADT/iterator.h"
34 #include "llvm/ADT/iterator_range.h"
35 #include "llvm/Support/Casting.h"
36 #include "llvm/Support/Compiler.h"
37 #include "llvm/Support/TrailingObjects.h"
38 #include <cassert>
39 #include <cstddef>
40 #include <cstdint>
41 #include <iterator>
42 #include <optional>
43 #include <utility>
44 
45 namespace clang {
46 
48 class ClassTemplateDecl;
49 class ClassTemplatePartialSpecializationDecl;
50 class Expr;
51 class FunctionTemplateDecl;
52 class IdentifierInfo;
53 class NonTypeTemplateParmDecl;
54 class TemplateDecl;
55 class TemplateTemplateParmDecl;
56 class TemplateTypeParmDecl;
57 class ConceptDecl;
58 class UnresolvedSetImpl;
59 class VarTemplateDecl;
60 class VarTemplatePartialSpecializationDecl;
61 
62 /// Stores a template parameter of any kind.
63 using TemplateParameter =
64  llvm::PointerUnion<TemplateTypeParmDecl *, NonTypeTemplateParmDecl *,
66 
68 
69 /// Stores a list of template parameters for a TemplateDecl and its
70 /// derived classes.
72  : private llvm::TrailingObjects<TemplateParameterList, NamedDecl *,
73  Expr *> {
74  /// The location of the 'template' keyword.
75  SourceLocation TemplateLoc;
76 
77  /// The locations of the '<' and '>' angle brackets.
78  SourceLocation LAngleLoc, RAngleLoc;
79 
80  /// The number of template parameters in this template
81  /// parameter list.
82  unsigned NumParams : 29;
83 
84  /// Whether this template parameter list contains an unexpanded parameter
85  /// pack.
86  unsigned ContainsUnexpandedParameterPack : 1;
87 
88  /// Whether this template parameter list has a requires clause.
89  unsigned HasRequiresClause : 1;
90 
91  /// Whether any of the template parameters has constrained-parameter
92  /// constraint-expression.
93  unsigned HasConstrainedParameters : 1;
94 
95 protected:
96  TemplateParameterList(const ASTContext& C, SourceLocation TemplateLoc,
97  SourceLocation LAngleLoc, ArrayRef<NamedDecl *> Params,
98  SourceLocation RAngleLoc, Expr *RequiresClause);
99 
100  size_t numTrailingObjects(OverloadToken<NamedDecl *>) const {
101  return NumParams;
102  }
103 
104  size_t numTrailingObjects(OverloadToken<Expr *>) const {
105  return HasRequiresClause ? 1 : 0;
106  }
107 
108 public:
109  template <size_t N, bool HasRequiresClause>
112 
113  static TemplateParameterList *Create(const ASTContext &C,
114  SourceLocation TemplateLoc,
115  SourceLocation LAngleLoc,
116  ArrayRef<NamedDecl *> Params,
117  SourceLocation RAngleLoc,
118  Expr *RequiresClause);
119 
120  /// Iterates through the template parameters in this list.
121  using iterator = NamedDecl **;
122 
123  /// Iterates through the template parameters in this list.
124  using const_iterator = NamedDecl * const *;
125 
126  iterator begin() { return getTrailingObjects<NamedDecl *>(); }
127  const_iterator begin() const { return getTrailingObjects<NamedDecl *>(); }
128  iterator end() { return begin() + NumParams; }
129  const_iterator end() const { return begin() + NumParams; }
130 
131  unsigned size() const { return NumParams; }
132 
135  return llvm::ArrayRef(begin(), size());
136  }
137 
138  NamedDecl* getParam(unsigned Idx) {
139  assert(Idx < size() && "Template parameter index out-of-range");
140  return begin()[Idx];
141  }
142  const NamedDecl* getParam(unsigned Idx) const {
143  assert(Idx < size() && "Template parameter index out-of-range");
144  return begin()[Idx];
145  }
146 
147  /// Returns the minimum number of arguments needed to form a
148  /// template specialization.
149  ///
150  /// This may be fewer than the number of template parameters, if some of
151  /// the parameters have default arguments or if there is a parameter pack.
152  unsigned getMinRequiredArguments() const;
153 
154  /// Get the depth of this template parameter list in the set of
155  /// template parameter lists.
156  ///
157  /// The first template parameter list in a declaration will have depth 0,
158  /// the second template parameter list will have depth 1, etc.
159  unsigned getDepth() const;
160 
161  /// Determine whether this template parameter list contains an
162  /// unexpanded parameter pack.
163  bool containsUnexpandedParameterPack() const;
164 
165  /// Determine whether this template parameter list contains a parameter pack.
166  bool hasParameterPack() const {
167  for (const NamedDecl *P : asArray())
168  if (P->isParameterPack())
169  return true;
170  return false;
171  }
172 
173  /// The constraint-expression of the associated requires-clause.
175  return HasRequiresClause ? getTrailingObjects<Expr *>()[0] : nullptr;
176  }
177 
178  /// The constraint-expression of the associated requires-clause.
179  const Expr *getRequiresClause() const {
180  return HasRequiresClause ? getTrailingObjects<Expr *>()[0] : nullptr;
181  }
182 
183  /// \brief All associated constraints derived from this template parameter
184  /// list, including the requires clause and any constraints derived from
185  /// constrained-parameters.
186  ///
187  /// The constraints in the resulting list are to be treated as if in a
188  /// conjunction ("and").
190 
191  bool hasAssociatedConstraints() const;
192 
193  SourceLocation getTemplateLoc() const { return TemplateLoc; }
194  SourceLocation getLAngleLoc() const { return LAngleLoc; }
195  SourceLocation getRAngleLoc() const { return RAngleLoc; }
196 
197  SourceRange getSourceRange() const LLVM_READONLY {
198  return SourceRange(TemplateLoc, RAngleLoc);
199  }
200 
201  void print(raw_ostream &Out, const ASTContext &Context,
202  bool OmitTemplateKW = false) const;
203  void print(raw_ostream &Out, const ASTContext &Context,
204  const PrintingPolicy &Policy, bool OmitTemplateKW = false) const;
205 
206  static bool shouldIncludeTypeForArgument(const PrintingPolicy &Policy,
207  const TemplateParameterList *TPL,
208  unsigned Idx);
209 };
210 
211 /// Stores a list of template parameters and the associated
212 /// requires-clause (if any) for a TemplateDecl and its derived classes.
213 /// Suitable for creating on the stack.
214 template <size_t N, bool HasRequiresClause>
216  : public TemplateParameterList::FixedSizeStorageOwner {
217  typename TemplateParameterList::FixedSizeStorage<
218  NamedDecl *, Expr *>::with_counts<
219  N, HasRequiresClause ? 1u : 0u
220  >::type storage;
221 
222 public:
224  SourceLocation TemplateLoc,
225  SourceLocation LAngleLoc,
226  ArrayRef<NamedDecl *> Params,
227  SourceLocation RAngleLoc,
228  Expr *RequiresClause)
229  : FixedSizeStorageOwner(
230  (assert(N == Params.size()),
231  assert(HasRequiresClause == (RequiresClause != nullptr)),
232  new (static_cast<void *>(&storage)) TemplateParameterList(C,
233  TemplateLoc, LAngleLoc, Params, RAngleLoc, RequiresClause))) {}
234 };
235 
236 /// A template argument list.
238  : private llvm::TrailingObjects<TemplateArgumentList, TemplateArgument> {
239  /// The template argument list.
240  const TemplateArgument *Arguments;
241 
242  /// The number of template arguments in this template
243  /// argument list.
244  unsigned NumArguments;
245 
246  // Constructs an instance with an internal Argument list, containing
247  // a copy of the Args array. (Called by CreateCopy)
249 
250 public:
252 
253  TemplateArgumentList(const TemplateArgumentList &) = delete;
255 
256  /// Type used to indicate that the template argument list itself is a
257  /// stack object. It does not own its template arguments.
259 
260  /// Create a new template argument list that copies the given set of
261  /// template arguments.
262  static TemplateArgumentList *CreateCopy(ASTContext &Context,
264 
265  /// Construct a new, temporary template argument list on the stack.
266  ///
267  /// The template argument list does not own the template arguments
268  /// provided.
270  : Arguments(Args.data()), NumArguments(Args.size()) {}
271 
272  /// Produces a shallow copy of the given template argument list.
273  ///
274  /// This operation assumes that the input argument list outlives it.
275  /// This takes the list as a pointer to avoid looking like a copy
276  /// constructor, since this really isn't safe to use that way.
278  : Arguments(Other->data()), NumArguments(Other->size()) {}
279 
280  /// Retrieve the template argument at a given index.
281  const TemplateArgument &get(unsigned Idx) const {
282  assert(Idx < NumArguments && "Invalid template argument index");
283  return data()[Idx];
284  }
285 
286  /// Retrieve the template argument at a given index.
287  const TemplateArgument &operator[](unsigned Idx) const { return get(Idx); }
288 
289  /// Produce this as an array ref.
291  return llvm::ArrayRef(data(), size());
292  }
293 
294  /// Retrieve the number of template arguments in this
295  /// template argument list.
296  unsigned size() const { return NumArguments; }
297 
298  /// Retrieve a pointer to the template argument list.
299  const TemplateArgument *data() const { return Arguments; }
300 };
301 
302 void *allocateDefaultArgStorageChain(const ASTContext &C);
303 
304 /// Storage for a default argument. This is conceptually either empty, or an
305 /// argument value, or a pointer to a previous declaration that had a default
306 /// argument.
307 ///
308 /// However, this is complicated by modules: while we require all the default
309 /// arguments for a template to be equivalent, there may be more than one, and
310 /// we need to track all the originating parameters to determine if the default
311 /// argument is visible.
312 template<typename ParmDecl, typename ArgType>
314  /// Storage for both the value *and* another parameter from which we inherit
315  /// the default argument. This is used when multiple default arguments for a
316  /// parameter are merged together from different modules.
317  struct Chain {
318  ParmDecl *PrevDeclWithDefaultArg;
319  ArgType Value;
320  };
321  static_assert(sizeof(Chain) == sizeof(void *) * 2,
322  "non-pointer argument type?");
323 
324  llvm::PointerUnion<ArgType, ParmDecl*, Chain*> ValueOrInherited;
325 
326  static ParmDecl *getParmOwningDefaultArg(ParmDecl *Parm) {
327  const DefaultArgStorage &Storage = Parm->getDefaultArgStorage();
328  if (auto *Prev = Storage.ValueOrInherited.template dyn_cast<ParmDecl *>())
329  Parm = Prev;
330  assert(!Parm->getDefaultArgStorage()
331  .ValueOrInherited.template is<ParmDecl *>() &&
332  "should only be one level of indirection");
333  return Parm;
334  }
335 
336 public:
337  DefaultArgStorage() : ValueOrInherited(ArgType()) {}
338 
339  /// Determine whether there is a default argument for this parameter.
340  bool isSet() const { return !ValueOrInherited.isNull(); }
341 
342  /// Determine whether the default argument for this parameter was inherited
343  /// from a previous declaration of the same entity.
344  bool isInherited() const { return ValueOrInherited.template is<ParmDecl*>(); }
345 
346  /// Get the default argument's value. This does not consider whether the
347  /// default argument is visible.
348  ArgType get() const {
349  const DefaultArgStorage *Storage = this;
350  if (const auto *Prev = ValueOrInherited.template dyn_cast<ParmDecl *>())
351  Storage = &Prev->getDefaultArgStorage();
352  if (const auto *C = Storage->ValueOrInherited.template dyn_cast<Chain *>())
353  return C->Value;
354  return Storage->ValueOrInherited.template get<ArgType>();
355  }
356 
357  /// Get the parameter from which we inherit the default argument, if any.
358  /// This is the parameter on which the default argument was actually written.
359  const ParmDecl *getInheritedFrom() const {
360  if (const auto *D = ValueOrInherited.template dyn_cast<ParmDecl *>())
361  return D;
362  if (const auto *C = ValueOrInherited.template dyn_cast<Chain *>())
363  return C->PrevDeclWithDefaultArg;
364  return nullptr;
365  }
366 
367  /// Set the default argument.
368  void set(ArgType Arg) {
369  assert(!isSet() && "default argument already set");
370  ValueOrInherited = Arg;
371  }
372 
373  /// Set that the default argument was inherited from another parameter.
374  void setInherited(const ASTContext &C, ParmDecl *InheritedFrom) {
375  InheritedFrom = getParmOwningDefaultArg(InheritedFrom);
376  if (!isSet())
377  ValueOrInherited = InheritedFrom;
378  else if (auto *D = ValueOrInherited.template dyn_cast<ParmDecl *>()) {
379  assert(C.isSameDefaultTemplateArgument(D, InheritedFrom));
380  ValueOrInherited =
381  new (allocateDefaultArgStorageChain(C)) Chain{InheritedFrom, get()};
382  } else if (auto *Inherited =
383  ValueOrInherited.template dyn_cast<Chain *>()) {
384  assert(C.isSameDefaultTemplateArgument(Inherited->PrevDeclWithDefaultArg,
385  InheritedFrom));
386  Inherited->PrevDeclWithDefaultArg = InheritedFrom;
387  } else
388  ValueOrInherited = new (allocateDefaultArgStorageChain(C))
389  Chain{InheritedFrom, ValueOrInherited.template get<ArgType>()};
390  }
391 
392  /// Remove the default argument, even if it was inherited.
393  void clear() {
394  ValueOrInherited = ArgType();
395  }
396 };
397 
398 //===----------------------------------------------------------------------===//
399 // Kinds of Templates
400 //===----------------------------------------------------------------------===//
401 
402 /// \brief The base class of all kinds of template declarations (e.g.,
403 /// class, function, etc.).
404 ///
405 /// The TemplateDecl class stores the list of template parameters and a
406 /// reference to the templated scoped declaration: the underlying AST node.
407 class TemplateDecl : public NamedDecl {
408  void anchor() override;
409 
410 protected:
411  // Construct a template decl with name, parameters, and templated element.
414 
415  // Construct a template decl with the given name and parameters.
416  // Used when there is no templated element (e.g., for tt-params).
418  TemplateParameterList *Params)
419  : TemplateDecl(DK, DC, L, Name, Params, nullptr) {}
420 
421 public:
422  friend class ASTDeclReader;
423  friend class ASTDeclWriter;
424 
425  /// Get the list of template parameters
427  return TemplateParams;
428  }
429 
430  /// \brief Get the total constraint-expression associated with this template,
431  /// including constraint-expressions derived from the requires-clause,
432  /// trailing requires-clause (for functions and methods) and constrained
433  /// template parameters.
435 
436  bool hasAssociatedConstraints() const;
437 
438  /// Get the underlying, templated declaration.
440 
441  // Should a specialization behave like an alias for another type.
442  bool isTypeAlias() const;
443 
444  // Implement isa/cast/dyncast/etc.
445  static bool classof(const Decl *D) { return classofKind(D->getKind()); }
446 
447  static bool classofKind(Kind K) {
448  return K >= firstTemplate && K <= lastTemplate;
449  }
450 
451  SourceRange getSourceRange() const override LLVM_READONLY {
452  return SourceRange(getTemplateParameters()->getTemplateLoc(),
454  }
455 
456 protected:
459 
460 public:
462  TemplateParams = TParams;
463  }
464 
465  /// Initialize the underlying templated declaration.
466  void init(NamedDecl *NewTemplatedDecl) {
467  if (TemplatedDecl)
468  assert(TemplatedDecl == NewTemplatedDecl && "Inconsistent TemplatedDecl");
469  else
470  TemplatedDecl = NewTemplatedDecl;
471  }
472 };
473 
474 /// Provides information about a function template specialization,
475 /// which is a FunctionDecl that has been explicitly specialization or
476 /// instantiated from a function template.
478  : public llvm::FoldingSetNode,
479  private llvm::TrailingObjects<FunctionTemplateSpecializationInfo,
480  MemberSpecializationInfo *> {
481  /// The function template specialization that this structure describes and a
482  /// flag indicating if the function is a member specialization.
483  llvm::PointerIntPair<FunctionDecl *, 1, bool> Function;
484 
485  /// The function template from which this function template
486  /// specialization was generated.
487  ///
488  /// The two bits contain the top 4 values of TemplateSpecializationKind.
489  llvm::PointerIntPair<FunctionTemplateDecl *, 2> Template;
490 
491 public:
492  /// The template arguments used to produce the function template
493  /// specialization from the function template.
495 
496  /// The template arguments as written in the sources, if provided.
497  /// FIXME: Normally null; tail-allocate this.
499 
500  /// The point at which this function template specialization was
501  /// first instantiated.
503 
504 private:
506  FunctionDecl *FD, FunctionTemplateDecl *Template,
507  TemplateSpecializationKind TSK, const TemplateArgumentList *TemplateArgs,
508  const ASTTemplateArgumentListInfo *TemplateArgsAsWritten,
510  : Function(FD, MSInfo ? true : false), Template(Template, TSK - 1),
511  TemplateArguments(TemplateArgs),
512  TemplateArgumentsAsWritten(TemplateArgsAsWritten),
513  PointOfInstantiation(POI) {
514  if (MSInfo)
515  getTrailingObjects<MemberSpecializationInfo *>()[0] = MSInfo;
516  }
517 
518  size_t numTrailingObjects(OverloadToken<MemberSpecializationInfo*>) const {
519  return Function.getInt();
520  }
521 
522 public:
524 
528  const TemplateArgumentList *TemplateArgs,
529  const TemplateArgumentListInfo *TemplateArgsAsWritten,
531 
532  /// Retrieve the declaration of the function template specialization.
533  FunctionDecl *getFunction() const { return Function.getPointer(); }
534 
535  /// Retrieve the template from which this function was specialized.
536  FunctionTemplateDecl *getTemplate() const { return Template.getPointer(); }
537 
538  /// Determine what kind of template specialization this is.
540  return (TemplateSpecializationKind)(Template.getInt() + 1);
541  }
542 
545  }
546 
547  /// True if this declaration is an explicit specialization,
548  /// explicit instantiation declaration, or explicit instantiation
549  /// definition.
553  }
554 
555  /// Set the template specialization kind.
557  assert(TSK != TSK_Undeclared &&
558  "Cannot encode TSK_Undeclared for a function template specialization");
559  Template.setInt(TSK - 1);
560  }
561 
562  /// Retrieve the first point of instantiation of this function
563  /// template specialization.
564  ///
565  /// The point of instantiation may be an invalid source location if this
566  /// function has yet to be instantiated.
568  return PointOfInstantiation;
569  }
570 
571  /// Set the (first) point of instantiation of this function template
572  /// specialization.
574  PointOfInstantiation = POI;
575  }
576 
577  /// Get the specialization info if this function template specialization is
578  /// also a member specialization:
579  ///
580  /// \code
581  /// template<typename> struct A {
582  /// template<typename> void f();
583  /// template<> void f<int>(); // ClassScopeFunctionSpecializationDecl
584  /// };
585  /// \endcode
586  ///
587  /// Here, A<int>::f<int> is a function template specialization that is
588  /// an explicit specialization of A<int>::f, but it's also a member
589  /// specialization (an implicit instantiation in this case) of A::f<int>.
590  /// Further:
591  ///
592  /// \code
593  /// template<> template<> void A<int>::f<int>() {}
594  /// \endcode
595  ///
596  /// ... declares a function template specialization that is an explicit
597  /// specialization of A<int>::f, and is also an explicit member
598  /// specialization of A::f<int>.
599  ///
600  /// Note that the TemplateSpecializationKind of the MemberSpecializationInfo
601  /// need not be the same as that returned by getTemplateSpecializationKind(),
602  /// and represents the relationship between the function and the class-scope
603  /// explicit specialization in the original templated class -- whereas our
604  /// TemplateSpecializationKind represents the relationship between the
605  /// function and the function template, and should always be
606  /// TSK_ExplicitSpecialization whenever we have MemberSpecializationInfo.
608  return numTrailingObjects(OverloadToken<MemberSpecializationInfo *>())
609  ? getTrailingObjects<MemberSpecializationInfo *>()[0]
610  : nullptr;
611  }
612 
613  void Profile(llvm::FoldingSetNodeID &ID) {
614  Profile(ID, TemplateArguments->asArray(), getFunction()->getASTContext());
615  }
616 
617  static void
618  Profile(llvm::FoldingSetNodeID &ID, ArrayRef<TemplateArgument> TemplateArgs,
619  ASTContext &Context) {
620  ID.AddInteger(TemplateArgs.size());
621  for (const TemplateArgument &TemplateArg : TemplateArgs)
622  TemplateArg.Profile(ID, Context);
623  }
624 };
625 
626 /// Provides information a specialization of a member of a class
627 /// template, which may be a member function, static data member,
628 /// member class or member enumeration.
630  // The member declaration from which this member was instantiated, and the
631  // manner in which the instantiation occurred (in the lower two bits).
632  llvm::PointerIntPair<NamedDecl *, 2> MemberAndTSK;
633 
634  // The point at which this member was first instantiated.
635  SourceLocation PointOfInstantiation;
636 
637 public:
638  explicit
641  : MemberAndTSK(IF, TSK - 1), PointOfInstantiation(POI) {
642  assert(TSK != TSK_Undeclared &&
643  "Cannot encode undeclared template specializations for members");
644  }
645 
646  /// Retrieve the member declaration from which this member was
647  /// instantiated.
648  NamedDecl *getInstantiatedFrom() const { return MemberAndTSK.getPointer(); }
649 
650  /// Determine what kind of template specialization this is.
652  return (TemplateSpecializationKind)(MemberAndTSK.getInt() + 1);
653  }
654 
657  }
658 
659  /// Set the template specialization kind.
661  assert(TSK != TSK_Undeclared &&
662  "Cannot encode undeclared template specializations for members");
663  MemberAndTSK.setInt(TSK - 1);
664  }
665 
666  /// Retrieve the first point of instantiation of this member.
667  /// If the point of instantiation is an invalid location, then this member
668  /// has not yet been instantiated.
670  return PointOfInstantiation;
671  }
672 
673  /// Set the first point of instantiation.
675  PointOfInstantiation = POI;
676  }
677 };
678 
679 /// Provides information about a dependent function-template
680 /// specialization declaration.
681 ///
682 /// Since explicit function template specialization and instantiation
683 /// declarations can only appear in namespace scope, and you can only
684 /// specialize a member of a fully-specialized class, the only way to
685 /// get one of these is in a friend declaration like the following:
686 ///
687 /// \code
688 /// template <class T> void foo(T);
689 /// template <class T> class A {
690 /// friend void foo<>(T);
691 /// };
692 /// \endcode
694  : private llvm::TrailingObjects<DependentFunctionTemplateSpecializationInfo,
695  TemplateArgumentLoc,
696  FunctionTemplateDecl *> {
697  /// The number of potential template candidates.
698  unsigned NumTemplates;
699 
700  /// The number of template arguments.
701  unsigned NumArgs;
702 
703  /// The locations of the left and right angle brackets.
704  SourceRange AngleLocs;
705 
706  size_t numTrailingObjects(OverloadToken<TemplateArgumentLoc>) const {
707  return NumArgs;
708  }
709  size_t numTrailingObjects(OverloadToken<FunctionTemplateDecl *>) const {
710  return NumTemplates;
711  }
712 
714  const UnresolvedSetImpl &Templates,
715  const TemplateArgumentListInfo &TemplateArgs);
716 
717 public:
719 
721  Create(ASTContext &Context, const UnresolvedSetImpl &Templates,
722  const TemplateArgumentListInfo &TemplateArgs);
723 
724  /// Returns the number of function templates that this might
725  /// be a specialization of.
726  unsigned getNumTemplates() const { return NumTemplates; }
727 
728  /// Returns the i'th template candidate.
729  FunctionTemplateDecl *getTemplate(unsigned I) const {
730  assert(I < getNumTemplates() && "template index out of range");
731  return getTrailingObjects<FunctionTemplateDecl *>()[I];
732  }
733 
734  /// Returns the explicit template arguments that were given.
736  return getTrailingObjects<TemplateArgumentLoc>();
737  }
738 
739  /// Returns the number of explicit template arguments that were given.
740  unsigned getNumTemplateArgs() const { return NumArgs; }
741 
744  }
745 
746  /// Returns the nth template argument.
747  const TemplateArgumentLoc &getTemplateArg(unsigned I) const {
748  assert(I < getNumTemplateArgs() && "template arg index out of range");
749  return getTemplateArgs()[I];
750  }
751 
753  return AngleLocs.getBegin();
754  }
755 
757  return AngleLocs.getEnd();
758  }
759 };
760 
761 /// Declaration of a redeclarable template.
763  public Redeclarable<RedeclarableTemplateDecl>
764 {
766 
767  RedeclarableTemplateDecl *getNextRedeclarationImpl() override {
768  return getNextRedeclaration();
769  }
770 
771  RedeclarableTemplateDecl *getPreviousDeclImpl() override {
772  return getPreviousDecl();
773  }
774 
775  RedeclarableTemplateDecl *getMostRecentDeclImpl() override {
776  return getMostRecentDecl();
777  }
778 
779  void anchor() override;
780 protected:
781  template <typename EntryType> struct SpecEntryTraits {
782  using DeclType = EntryType;
783 
784  static DeclType *getDecl(EntryType *D) {
785  return D;
786  }
787 
789  return D->getTemplateArgs().asArray();
790  }
791  };
792 
793  template <typename EntryType, typename SETraits = SpecEntryTraits<EntryType>,
794  typename DeclType = typename SETraits::DeclType>
796  : llvm::iterator_adaptor_base<
797  SpecIterator<EntryType, SETraits, DeclType>,
798  typename llvm::FoldingSetVector<EntryType>::iterator,
799  typename std::iterator_traits<typename llvm::FoldingSetVector<
800  EntryType>::iterator>::iterator_category,
801  DeclType *, ptrdiff_t, DeclType *, DeclType *> {
802  SpecIterator() = default;
803  explicit SpecIterator(
804  typename llvm::FoldingSetVector<EntryType>::iterator SetIter)
805  : SpecIterator::iterator_adaptor_base(std::move(SetIter)) {}
806 
807  DeclType *operator*() const {
808  return SETraits::getDecl(&*this->I)->getMostRecentDecl();
809  }
810 
811  DeclType *operator->() const { return **this; }
812  };
813 
814  template <typename EntryType>
815  static SpecIterator<EntryType>
816  makeSpecIterator(llvm::FoldingSetVector<EntryType> &Specs, bool isEnd) {
817  return SpecIterator<EntryType>(isEnd ? Specs.end() : Specs.begin());
818  }
819 
820  void loadLazySpecializationsImpl() const;
821 
822  template <class EntryType, typename ...ProfileArguments>
824  findSpecializationImpl(llvm::FoldingSetVector<EntryType> &Specs,
825  void *&InsertPos, ProfileArguments &&...ProfileArgs);
826 
827  template <class Derived, class EntryType>
828  void addSpecializationImpl(llvm::FoldingSetVector<EntryType> &Specs,
829  EntryType *Entry, void *InsertPos);
830 
831  struct CommonBase {
833 
834  /// The template from which this was most
835  /// directly instantiated (or null).
836  ///
837  /// The boolean value indicates whether this template
838  /// was explicitly specialized.
839  llvm::PointerIntPair<RedeclarableTemplateDecl*, 1, bool>
841 
842  /// If non-null, points to an array of specializations (including
843  /// partial specializations) known only by their external declaration IDs.
844  ///
845  /// The first value in the array is the number of specializations/partial
846  /// specializations that follow.
847  uint32_t *LazySpecializations = nullptr;
848 
849  /// The set of "injected" template arguments used within this
850  /// template.
851  ///
852  /// This pointer refers to the template arguments (there are as
853  /// many template arguments as template parameaters) for the
854  /// template, and is allocated lazily, since most templates do not
855  /// require the use of this information.
857  };
858 
859  /// Pointer to the common data shared by all declarations of this
860  /// template.
861  mutable CommonBase *Common = nullptr;
862 
863  /// Retrieves the "common" pointer shared by all (re-)declarations of
864  /// the same template. Calling this routine may implicitly allocate memory
865  /// for the common pointer.
866  CommonBase *getCommonPtr() const;
867 
868  virtual CommonBase *newCommon(ASTContext &C) const = 0;
869 
870  // Construct a template decl with name, parameters, and templated element.
874  : TemplateDecl(DK, DC, L, Name, Params, Decl), redeclarable_base(C) {}
875 
876 public:
877  friend class ASTDeclReader;
878  friend class ASTDeclWriter;
879  friend class ASTReader;
880  template <class decl_type> friend class RedeclarableTemplate;
881 
882  /// Retrieves the canonical declaration of this template.
884  return getFirstDecl();
885  }
887  return getFirstDecl();
888  }
889 
890  /// Determines whether this template was a specialization of a
891  /// member template.
892  ///
893  /// In the following example, the function template \c X<int>::f and the
894  /// member template \c X<int>::Inner are member specializations.
895  ///
896  /// \code
897  /// template<typename T>
898  /// struct X {
899  /// template<typename U> void f(T, U);
900  /// template<typename U> struct Inner;
901  /// };
902  ///
903  /// template<> template<typename T>
904  /// void X<int>::f(int, T);
905  /// template<> template<typename T>
906  /// struct X<int>::Inner { /* ... */ };
907  /// \endcode
908  bool isMemberSpecialization() const {
909  return getCommonPtr()->InstantiatedFromMember.getInt();
910  }
911 
912  /// Note that this member template is a specialization.
914  assert(getCommonPtr()->InstantiatedFromMember.getPointer() &&
915  "Only member templates can be member template specializations");
916  getCommonPtr()->InstantiatedFromMember.setInt(true);
917  }
918 
919  /// Retrieve the member template from which this template was
920  /// instantiated, or nullptr if this template was not instantiated from a
921  /// member template.
922  ///
923  /// A template is instantiated from a member template when the member
924  /// template itself is part of a class template (or member thereof). For
925  /// example, given
926  ///
927  /// \code
928  /// template<typename T>
929  /// struct X {
930  /// template<typename U> void f(T, U);
931  /// };
932  ///
933  /// void test(X<int> x) {
934  /// x.f(1, 'a');
935  /// };
936  /// \endcode
937  ///
938  /// \c X<int>::f is a FunctionTemplateDecl that describes the function
939  /// template
940  ///
941  /// \code
942  /// template<typename U> void X<int>::f(int, U);
943  /// \endcode
944  ///
945  /// which was itself created during the instantiation of \c X<int>. Calling
946  /// getInstantiatedFromMemberTemplate() on this FunctionTemplateDecl will
947  /// retrieve the FunctionTemplateDecl for the original template \c f within
948  /// the class template \c X<T>, i.e.,
949  ///
950  /// \code
951  /// template<typename T>
952  /// template<typename U>
953  /// void X<T>::f(T, U);
954  /// \endcode
956  return getCommonPtr()->InstantiatedFromMember.getPointer();
957  }
958 
960  assert(!getCommonPtr()->InstantiatedFromMember.getPointer());
961  getCommonPtr()->InstantiatedFromMember.setPointer(TD);
962  }
963 
964  /// Retrieve the "injected" template arguments that correspond to the
965  /// template parameters of this template.
966  ///
967  /// Although the C++ standard has no notion of the "injected" template
968  /// arguments for a template, the notion is convenient when
969  /// we need to perform substitutions inside the definition of a template.
971 
973  using redecl_iterator = redeclarable_base::redecl_iterator;
974 
981 
982  // Implement isa/cast/dyncast/etc.
983  static bool classof(const Decl *D) { return classofKind(D->getKind()); }
984 
985  static bool classofKind(Kind K) {
986  return K >= firstRedeclarableTemplate && K <= lastRedeclarableTemplate;
987  }
988 };
989 
990 template <> struct RedeclarableTemplateDecl::
991 SpecEntryTraits<FunctionTemplateSpecializationInfo> {
993 
995  return I->getFunction();
996  }
997 
1000  return I->TemplateArguments->asArray();
1001  }
1002 };
1003 
1004 /// Declaration of a template function.
1006 protected:
1007  friend class FunctionDecl;
1008 
1009  /// Data that is common to all of the declarations of a given
1010  /// function template.
1011  struct Common : CommonBase {
1012  /// The function template specializations for this function
1013  /// template, including explicit specializations and instantiations.
1014  llvm::FoldingSetVector<FunctionTemplateSpecializationInfo> Specializations;
1015 
1016  Common() = default;
1017  };
1018 
1020  DeclarationName Name, TemplateParameterList *Params,
1021  NamedDecl *Decl)
1022  : RedeclarableTemplateDecl(FunctionTemplate, C, DC, L, Name, Params,
1023  Decl) {}
1024 
1025  CommonBase *newCommon(ASTContext &C) const override;
1026 
1028  return static_cast<Common *>(RedeclarableTemplateDecl::getCommonPtr());
1029  }
1030 
1031  /// Retrieve the set of function template specializations of this
1032  /// function template.
1033  llvm::FoldingSetVector<FunctionTemplateSpecializationInfo> &
1034  getSpecializations() const;
1035 
1036  /// Add a specialization of this function template.
1037  ///
1038  /// \param InsertPos Insert position in the FoldingSetVector, must have been
1039  /// retrieved by an earlier call to findSpecialization().
1041  void *InsertPos);
1042 
1043 public:
1044  friend class ASTDeclReader;
1045  friend class ASTDeclWriter;
1046 
1047  /// Load any lazily-loaded specializations from the external source.
1048  void LoadLazySpecializations() const;
1049 
1050  /// Get the underlying function declaration of the template.
1052  return static_cast<FunctionDecl *>(TemplatedDecl);
1053  }
1054 
1055  /// Returns whether this template declaration defines the primary
1056  /// pattern.
1059  }
1060 
1061  /// Return the specialization with the provided arguments if it exists,
1062  /// otherwise return the insertion point.
1064  void *&InsertPos);
1065 
1067  return cast<FunctionTemplateDecl>(
1069  }
1071  return cast<FunctionTemplateDecl>(
1073  }
1074 
1075  /// Retrieve the previous declaration of this function template, or
1076  /// nullptr if no such declaration exists.
1078  return cast_or_null<FunctionTemplateDecl>(
1079  static_cast<RedeclarableTemplateDecl *>(this)->getPreviousDecl());
1080  }
1082  return cast_or_null<FunctionTemplateDecl>(
1083  static_cast<const RedeclarableTemplateDecl *>(this)->getPreviousDecl());
1084  }
1085 
1087  return cast<FunctionTemplateDecl>(
1088  static_cast<RedeclarableTemplateDecl *>(this)
1089  ->getMostRecentDecl());
1090  }
1092  return const_cast<FunctionTemplateDecl*>(this)->getMostRecentDecl();
1093  }
1094 
1096  return cast_or_null<FunctionTemplateDecl>(
1098  }
1099 
1101  using spec_range = llvm::iterator_range<spec_iterator>;
1102 
1104  return spec_range(spec_begin(), spec_end());
1105  }
1106 
1108  return makeSpecIterator(getSpecializations(), false);
1109  }
1110 
1112  return makeSpecIterator(getSpecializations(), true);
1113  }
1114 
1115  /// Return whether this function template is an abbreviated function template,
1116  /// e.g. `void foo(auto x)` or `template<typename T> void foo(auto x)`
1117  bool isAbbreviated() const {
1118  // Since the invented template parameters generated from 'auto' parameters
1119  // are either appended to the end of the explicit template parameter list or
1120  // form a new template parameter list, we can simply observe the last
1121  // parameter to determine if such a thing happened.
1123  return TPL->getParam(TPL->size() - 1)->isImplicit();
1124  }
1125 
1126  /// Merge \p Prev with our RedeclarableTemplateDecl::Common.
1127  void mergePrevDecl(FunctionTemplateDecl *Prev);
1128 
1129  /// Create a function template node.
1131  SourceLocation L,
1132  DeclarationName Name,
1133  TemplateParameterList *Params,
1134  NamedDecl *Decl);
1135 
1136  /// Create an empty function template node.
1138 
1139  // Implement isa/cast/dyncast support
1140  static bool classof(const Decl *D) { return classofKind(D->getKind()); }
1141  static bool classofKind(Kind K) { return K == FunctionTemplate; }
1142 };
1143 
1144 //===----------------------------------------------------------------------===//
1145 // Kinds of Template Parameters
1146 //===----------------------------------------------------------------------===//
1147 
1148 /// Defines the position of a template parameter within a template
1149 /// parameter list.
1150 ///
1151 /// Because template parameter can be listed
1152 /// sequentially for out-of-line template members, each template parameter is
1153 /// given a Depth - the nesting of template parameter scopes - and a Position -
1154 /// the occurrence within the parameter list.
1155 /// This class is inheritedly privately by different kinds of template
1156 /// parameters and is not part of the Decl hierarchy. Just a facility.
1158 protected:
1159  enum { DepthWidth = 20, PositionWidth = 12 };
1160  unsigned Depth : DepthWidth;
1162 
1163  static constexpr unsigned MaxDepth = (1U << DepthWidth) - 1;
1164  static constexpr unsigned MaxPosition = (1U << PositionWidth) - 1;
1165 
1166  TemplateParmPosition(unsigned D, unsigned P) : Depth(D), Position(P) {
1167  // The input may fill maximum values to show that it is invalid.
1168  // Add one here to convert it to zero.
1169  assert((D + 1) <= MaxDepth &&
1170  "The depth of template parmeter position is more than 2^20!");
1171  assert((P + 1) <= MaxPosition &&
1172  "The position of template parmeter position is more than 2^12!");
1173  }
1174 
1175 public:
1176  TemplateParmPosition() = delete;
1177 
1178  /// Get the nesting depth of the template parameter.
1179  unsigned getDepth() const { return Depth; }
1180  void setDepth(unsigned D) {
1181  assert((D + 1) <= MaxDepth &&
1182  "The depth of template parmeter position is more than 2^20!");
1183  Depth = D;
1184  }
1185 
1186  /// Get the position of the template parameter within its parameter list.
1187  unsigned getPosition() const { return Position; }
1188  void setPosition(unsigned P) {
1189  assert((P + 1) <= MaxPosition &&
1190  "The position of template parmeter position is more than 2^12!");
1191  Position = P;
1192  }
1193 
1194  /// Get the index of the template parameter within its parameter list.
1195  unsigned getIndex() const { return Position; }
1196 };
1197 
1198 /// Declaration of a template type parameter.
1199 ///
1200 /// For example, "T" in
1201 /// \code
1202 /// template<typename T> class vector;
1203 /// \endcode
1204 class TemplateTypeParmDecl final : public TypeDecl,
1205  private llvm::TrailingObjects<TemplateTypeParmDecl, TypeConstraint> {
1206  /// Sema creates these on the stack during auto type deduction.
1207  friend class Sema;
1208  friend TrailingObjects;
1209  friend class ASTDeclReader;
1210 
1211  /// Whether this template type parameter was declaration with
1212  /// the 'typename' keyword.
1213  ///
1214  /// If false, it was declared with the 'class' keyword.
1215  bool Typename : 1;
1216 
1217  /// Whether this template type parameter has a type-constraint construct.
1218  bool HasTypeConstraint : 1;
1219 
1220  /// Whether the type constraint has been initialized. This can be false if the
1221  /// constraint was not initialized yet or if there was an error forming the
1222  /// type constraint.
1223  bool TypeConstraintInitialized : 1;
1224 
1225  /// Whether this type template parameter is an "expanded"
1226  /// parameter pack, meaning that its type is a pack expansion and we
1227  /// already know the set of types that expansion expands to.
1228  bool ExpandedParameterPack : 1;
1229 
1230  /// The number of type parameters in an expanded parameter pack.
1231  unsigned NumExpanded = 0;
1232 
1233  /// The default template argument, if any.
1234  using DefArgStorage =
1236  DefArgStorage DefaultArgument;
1237 
1239  SourceLocation IdLoc, IdentifierInfo *Id, bool Typename,
1240  bool HasTypeConstraint,
1241  std::optional<unsigned> NumExpanded)
1242  : TypeDecl(TemplateTypeParm, DC, IdLoc, Id, KeyLoc), Typename(Typename),
1243  HasTypeConstraint(HasTypeConstraint), TypeConstraintInitialized(false),
1244  ExpandedParameterPack(NumExpanded),
1245  NumExpanded(NumExpanded.value_or(0)) {}
1246 
1247 public:
1248  static TemplateTypeParmDecl *
1249  Create(const ASTContext &C, DeclContext *DC, SourceLocation KeyLoc,
1250  SourceLocation NameLoc, unsigned D, unsigned P, IdentifierInfo *Id,
1251  bool Typename, bool ParameterPack, bool HasTypeConstraint = false,
1252  std::optional<unsigned> NumExpanded = std::nullopt);
1254  unsigned ID);
1256  unsigned ID,
1257  bool HasTypeConstraint);
1258 
1259  /// Whether this template type parameter was declared with
1260  /// the 'typename' keyword.
1261  ///
1262  /// If not, it was either declared with the 'class' keyword or with a
1263  /// type-constraint (see hasTypeConstraint()).
1265  return Typename && !HasTypeConstraint;
1266  }
1267 
1268  const DefArgStorage &getDefaultArgStorage() const { return DefaultArgument; }
1269 
1270  /// Determine whether this template parameter has a default
1271  /// argument.
1272  bool hasDefaultArgument() const { return DefaultArgument.isSet(); }
1273 
1274  /// Retrieve the default argument, if any.
1276  return DefaultArgument.get()->getType();
1277  }
1278 
1279  /// Retrieves the default argument's source information, if any.
1281  return DefaultArgument.get();
1282  }
1283 
1284  /// Retrieves the location of the default argument declaration.
1286 
1287  /// Determines whether the default argument was inherited
1288  /// from a previous declaration of this template.
1290  return DefaultArgument.isInherited();
1291  }
1292 
1293  /// Set the default argument for this template parameter.
1295  DefaultArgument.set(DefArg);
1296  }
1297 
1298  /// Set that this default argument was inherited from another
1299  /// parameter.
1301  TemplateTypeParmDecl *Prev) {
1302  DefaultArgument.setInherited(C, Prev);
1303  }
1304 
1305  /// Removes the default argument of this template parameter.
1307  DefaultArgument.clear();
1308  }
1309 
1310  /// Set whether this template type parameter was declared with
1311  /// the 'typename' or 'class' keyword.
1312  void setDeclaredWithTypename(bool withTypename) { Typename = withTypename; }
1313 
1314  /// Retrieve the depth of the template parameter.
1315  unsigned getDepth() const;
1316 
1317  /// Retrieve the index of the template parameter.
1318  unsigned getIndex() const;
1319 
1320  /// Returns whether this is a parameter pack.
1321  bool isParameterPack() const;
1322 
1323  /// Whether this parameter pack is a pack expansion.
1324  ///
1325  /// A template type template parameter pack can be a pack expansion if its
1326  /// type-constraint contains an unexpanded parameter pack.
1327  bool isPackExpansion() const {
1328  if (!isParameterPack())
1329  return false;
1330  if (const TypeConstraint *TC = getTypeConstraint())
1331  if (TC->hasExplicitTemplateArgs())
1332  for (const auto &ArgLoc : TC->getTemplateArgsAsWritten()->arguments())
1333  if (ArgLoc.getArgument().containsUnexpandedParameterPack())
1334  return true;
1335  return false;
1336  }
1337 
1338  /// Whether this parameter is a template type parameter pack that has a known
1339  /// list of different type-constraints at different positions.
1340  ///
1341  /// A parameter pack is an expanded parameter pack when the original
1342  /// parameter pack's type-constraint was itself a pack expansion, and that
1343  /// expansion has already been expanded. For example, given:
1344  ///
1345  /// \code
1346  /// template<typename ...Types>
1347  /// struct X {
1348  /// template<convertible_to<Types> ...Convertibles>
1349  /// struct Y { /* ... */ };
1350  /// };
1351  /// \endcode
1352  ///
1353  /// The parameter pack \c Convertibles has (convertible_to<Types> && ...) as
1354  /// its type-constraint. When \c Types is supplied with template arguments by
1355  /// instantiating \c X, the instantiation of \c Convertibles becomes an
1356  /// expanded parameter pack. For example, instantiating
1357  /// \c X<int, unsigned int> results in \c Convertibles being an expanded
1358  /// parameter pack of size 2 (use getNumExpansionTypes() to get this number).
1359  bool isExpandedParameterPack() const { return ExpandedParameterPack; }
1360 
1361  /// Retrieves the number of parameters in an expanded parameter pack.
1362  unsigned getNumExpansionParameters() const {
1363  assert(ExpandedParameterPack && "Not an expansion parameter pack");
1364  return NumExpanded;
1365  }
1366 
1367  /// Returns the type constraint associated with this template parameter (if
1368  /// any).
1370  return TypeConstraintInitialized ? getTrailingObjects<TypeConstraint>() :
1371  nullptr;
1372  }
1373 
1375  DeclarationNameInfo NameInfo, NamedDecl *FoundDecl,
1376  ConceptDecl *CD,
1377  const ASTTemplateArgumentListInfo *ArgsAsWritten,
1378  Expr *ImmediatelyDeclaredConstraint);
1379 
1380  /// Determine whether this template parameter has a type-constraint.
1381  bool hasTypeConstraint() const {
1382  return HasTypeConstraint;
1383  }
1384 
1385  /// \brief Get the associated-constraints of this template parameter.
1386  /// This will either be the immediately-introduced constraint or empty.
1387  ///
1388  /// Use this instead of getTypeConstraint for concepts APIs that
1389  /// accept an ArrayRef of constraint expressions.
1391  if (HasTypeConstraint)
1392  AC.push_back(getTypeConstraint()->getImmediatelyDeclaredConstraint());
1393  }
1394 
1395  SourceRange getSourceRange() const override LLVM_READONLY;
1396 
1397  // Implement isa/cast/dyncast/etc.
1398  static bool classof(const Decl *D) { return classofKind(D->getKind()); }
1399  static bool classofKind(Kind K) { return K == TemplateTypeParm; }
1400 };
1401 
1402 /// NonTypeTemplateParmDecl - Declares a non-type template parameter,
1403 /// e.g., "Size" in
1404 /// @code
1405 /// template<int Size> class array { };
1406 /// @endcode
1408  : public DeclaratorDecl,
1409  protected TemplateParmPosition,
1410  private llvm::TrailingObjects<NonTypeTemplateParmDecl,
1411  std::pair<QualType, TypeSourceInfo *>,
1412  Expr *> {
1413  friend class ASTDeclReader;
1414  friend TrailingObjects;
1415 
1416  /// The default template argument, if any, and whether or not
1417  /// it was inherited.
1419  DefArgStorage DefaultArgument;
1420 
1421  // FIXME: Collapse this into TemplateParamPosition; or, just move depth/index
1422  // down here to save memory.
1423 
1424  /// Whether this non-type template parameter is a parameter pack.
1425  bool ParameterPack;
1426 
1427  /// Whether this non-type template parameter is an "expanded"
1428  /// parameter pack, meaning that its type is a pack expansion and we
1429  /// already know the set of types that expansion expands to.
1430  bool ExpandedParameterPack = false;
1431 
1432  /// The number of types in an expanded parameter pack.
1433  unsigned NumExpandedTypes = 0;
1434 
1435  size_t numTrailingObjects(
1436  OverloadToken<std::pair<QualType, TypeSourceInfo *>>) const {
1437  return NumExpandedTypes;
1438  }
1439 
1441  SourceLocation IdLoc, unsigned D, unsigned P,
1443  bool ParameterPack, TypeSourceInfo *TInfo)
1444  : DeclaratorDecl(NonTypeTemplateParm, DC, IdLoc, Id, T, TInfo, StartLoc),
1445  TemplateParmPosition(D, P), ParameterPack(ParameterPack) {}
1446 
1447  NonTypeTemplateParmDecl(DeclContext *DC, SourceLocation StartLoc,
1448  SourceLocation IdLoc, unsigned D, unsigned P,
1449  IdentifierInfo *Id, QualType T,
1450  TypeSourceInfo *TInfo,
1451  ArrayRef<QualType> ExpandedTypes,
1452  ArrayRef<TypeSourceInfo *> ExpandedTInfos);
1453 
1454 public:
1455  static NonTypeTemplateParmDecl *
1456  Create(const ASTContext &C, DeclContext *DC, SourceLocation StartLoc,
1457  SourceLocation IdLoc, unsigned D, unsigned P, IdentifierInfo *Id,
1458  QualType T, bool ParameterPack, TypeSourceInfo *TInfo);
1459 
1460  static NonTypeTemplateParmDecl *
1461  Create(const ASTContext &C, DeclContext *DC, SourceLocation StartLoc,
1462  SourceLocation IdLoc, unsigned D, unsigned P, IdentifierInfo *Id,
1463  QualType T, TypeSourceInfo *TInfo, ArrayRef<QualType> ExpandedTypes,
1464  ArrayRef<TypeSourceInfo *> ExpandedTInfos);
1465 
1466  static NonTypeTemplateParmDecl *CreateDeserialized(ASTContext &C,
1467  unsigned ID,
1468  bool HasTypeConstraint);
1469  static NonTypeTemplateParmDecl *CreateDeserialized(ASTContext &C,
1470  unsigned ID,
1471  unsigned NumExpandedTypes,
1472  bool HasTypeConstraint);
1473 
1479 
1480  SourceRange getSourceRange() const override LLVM_READONLY;
1481 
1482  const DefArgStorage &getDefaultArgStorage() const { return DefaultArgument; }
1483 
1484  /// Determine whether this template parameter has a default
1485  /// argument.
1486  bool hasDefaultArgument() const { return DefaultArgument.isSet(); }
1487 
1488  /// Retrieve the default argument, if any.
1489  Expr *getDefaultArgument() const { return DefaultArgument.get(); }
1490 
1491  /// Retrieve the location of the default argument, if any.
1493 
1494  /// Determines whether the default argument was inherited
1495  /// from a previous declaration of this template.
1497  return DefaultArgument.isInherited();
1498  }
1499 
1500  /// Set the default argument for this template parameter, and
1501  /// whether that default argument was inherited from another
1502  /// declaration.
1503  void setDefaultArgument(Expr *DefArg) { DefaultArgument.set(DefArg); }
1505  NonTypeTemplateParmDecl *Parm) {
1506  DefaultArgument.setInherited(C, Parm);
1507  }
1508 
1509  /// Removes the default argument of this template parameter.
1510  void removeDefaultArgument() { DefaultArgument.clear(); }
1511 
1512  /// Whether this parameter is a non-type template parameter pack.
1513  ///
1514  /// If the parameter is a parameter pack, the type may be a
1515  /// \c PackExpansionType. In the following example, the \c Dims parameter
1516  /// is a parameter pack (whose type is 'unsigned').
1517  ///
1518  /// \code
1519  /// template<typename T, unsigned ...Dims> struct multi_array;
1520  /// \endcode
1521  bool isParameterPack() const { return ParameterPack; }
1522 
1523  /// Whether this parameter pack is a pack expansion.
1524  ///
1525  /// A non-type template parameter pack is a pack expansion if its type
1526  /// contains an unexpanded parameter pack. In this case, we will have
1527  /// built a PackExpansionType wrapping the type.
1528  bool isPackExpansion() const {
1529  return ParameterPack && getType()->getAs<PackExpansionType>();
1530  }
1531 
1532  /// Whether this parameter is a non-type template parameter pack
1533  /// that has a known list of different types at different positions.
1534  ///
1535  /// A parameter pack is an expanded parameter pack when the original
1536  /// parameter pack's type was itself a pack expansion, and that expansion
1537  /// has already been expanded. For example, given:
1538  ///
1539  /// \code
1540  /// template<typename ...Types>
1541  /// struct X {
1542  /// template<Types ...Values>
1543  /// struct Y { /* ... */ };
1544  /// };
1545  /// \endcode
1546  ///
1547  /// The parameter pack \c Values has a \c PackExpansionType as its type,
1548  /// which expands \c Types. When \c Types is supplied with template arguments
1549  /// by instantiating \c X, the instantiation of \c Values becomes an
1550  /// expanded parameter pack. For example, instantiating
1551  /// \c X<int, unsigned int> results in \c Values being an expanded parameter
1552  /// pack with expansion types \c int and \c unsigned int.
1553  ///
1554  /// The \c getExpansionType() and \c getExpansionTypeSourceInfo() functions
1555  /// return the expansion types.
1556  bool isExpandedParameterPack() const { return ExpandedParameterPack; }
1557 
1558  /// Retrieves the number of expansion types in an expanded parameter
1559  /// pack.
1560  unsigned getNumExpansionTypes() const {
1561  assert(ExpandedParameterPack && "Not an expansion parameter pack");
1562  return NumExpandedTypes;
1563  }
1564 
1565  /// Retrieve a particular expansion type within an expanded parameter
1566  /// pack.
1567  QualType getExpansionType(unsigned I) const {
1568  assert(I < NumExpandedTypes && "Out-of-range expansion type index");
1569  auto TypesAndInfos =
1570  getTrailingObjects<std::pair<QualType, TypeSourceInfo *>>();
1571  return TypesAndInfos[I].first;
1572  }
1573 
1574  /// Retrieve a particular expansion type source info within an
1575  /// expanded parameter pack.
1577  assert(I < NumExpandedTypes && "Out-of-range expansion type index");
1578  auto TypesAndInfos =
1579  getTrailingObjects<std::pair<QualType, TypeSourceInfo *>>();
1580  return TypesAndInfos[I].second;
1581  }
1582 
1583  /// Return the constraint introduced by the placeholder type of this non-type
1584  /// template parameter (if any).
1586  return hasPlaceholderTypeConstraint() ? *getTrailingObjects<Expr *>() :
1587  nullptr;
1588  }
1589 
1591  *getTrailingObjects<Expr *>() = E;
1592  }
1593 
1594  /// Determine whether this non-type template parameter's type has a
1595  /// placeholder with a type-constraint.
1597  auto *AT = getType()->getContainedAutoType();
1598  return AT && AT->isConstrained();
1599  }
1600 
1601  /// \brief Get the associated-constraints of this template parameter.
1602  /// This will either be a vector of size 1 containing the immediately-declared
1603  /// constraint introduced by the placeholder type, or an empty vector.
1604  ///
1605  /// Use this instead of getPlaceholderImmediatelyDeclaredConstraint for
1606  /// concepts APIs that accept an ArrayRef of constraint expressions.
1609  AC.push_back(E);
1610  }
1611 
1612  // Implement isa/cast/dyncast/etc.
1613  static bool classof(const Decl *D) { return classofKind(D->getKind()); }
1614  static bool classofKind(Kind K) { return K == NonTypeTemplateParm; }
1615 };
1616 
1617 /// TemplateTemplateParmDecl - Declares a template template parameter,
1618 /// e.g., "T" in
1619 /// @code
1620 /// template <template <typename> class T> class container { };
1621 /// @endcode
1622 /// A template template parameter is a TemplateDecl because it defines the
1623 /// name of a template and the template parameters allowable for substitution.
1625  : public TemplateDecl,
1626  protected TemplateParmPosition,
1627  private llvm::TrailingObjects<TemplateTemplateParmDecl,
1628  TemplateParameterList *> {
1629  /// The default template argument, if any.
1630  using DefArgStorage =
1632  DefArgStorage DefaultArgument;
1633 
1634  /// Whether this parameter is a parameter pack.
1635  bool ParameterPack;
1636 
1637  /// Whether this template template parameter is an "expanded"
1638  /// parameter pack, meaning that it is a pack expansion and we
1639  /// already know the set of template parameters that expansion expands to.
1640  bool ExpandedParameterPack = false;
1641 
1642  /// The number of parameters in an expanded parameter pack.
1643  unsigned NumExpandedParams = 0;
1644 
1646  unsigned D, unsigned P, bool ParameterPack,
1648  : TemplateDecl(TemplateTemplateParm, DC, L, Id, Params),
1649  TemplateParmPosition(D, P), ParameterPack(ParameterPack) {}
1650 
1652  unsigned D, unsigned P,
1655 
1656  void anchor() override;
1657 
1658 public:
1659  friend class ASTDeclReader;
1660  friend class ASTDeclWriter;
1662 
1664  SourceLocation L, unsigned D,
1665  unsigned P, bool ParameterPack,
1666  IdentifierInfo *Id,
1667  TemplateParameterList *Params);
1669  SourceLocation L, unsigned D,
1670  unsigned P,
1671  IdentifierInfo *Id,
1672  TemplateParameterList *Params,
1674 
1676  unsigned ID);
1678  unsigned ID,
1679  unsigned NumExpansions);
1680 
1686 
1687  /// Whether this template template parameter is a template
1688  /// parameter pack.
1689  ///
1690  /// \code
1691  /// template<template <class T> ...MetaFunctions> struct Apply;
1692  /// \endcode
1693  bool isParameterPack() const { return ParameterPack; }
1694 
1695  /// Whether this parameter pack is a pack expansion.
1696  ///
1697  /// A template template parameter pack is a pack expansion if its template
1698  /// parameter list contains an unexpanded parameter pack.
1699  bool isPackExpansion() const {
1700  return ParameterPack &&
1702  }
1703 
1704  /// Whether this parameter is a template template parameter pack that
1705  /// has a known list of different template parameter lists at different
1706  /// positions.
1707  ///
1708  /// A parameter pack is an expanded parameter pack when the original parameter
1709  /// pack's template parameter list was itself a pack expansion, and that
1710  /// expansion has already been expanded. For exampe, given:
1711  ///
1712  /// \code
1713  /// template<typename...Types> struct Outer {
1714  /// template<template<Types> class...Templates> struct Inner;
1715  /// };
1716  /// \endcode
1717  ///
1718  /// The parameter pack \c Templates is a pack expansion, which expands the
1719  /// pack \c Types. When \c Types is supplied with template arguments by
1720  /// instantiating \c Outer, the instantiation of \c Templates is an expanded
1721  /// parameter pack.
1722  bool isExpandedParameterPack() const { return ExpandedParameterPack; }
1723 
1724  /// Retrieves the number of expansion template parameters in
1725  /// an expanded parameter pack.
1727  assert(ExpandedParameterPack && "Not an expansion parameter pack");
1728  return NumExpandedParams;
1729  }
1730 
1731  /// Retrieve a particular expansion type within an expanded parameter
1732  /// pack.
1734  assert(I < NumExpandedParams && "Out-of-range expansion type index");
1735  return getTrailingObjects<TemplateParameterList *>()[I];
1736  }
1737 
1738  const DefArgStorage &getDefaultArgStorage() const { return DefaultArgument; }
1739 
1740  /// Determine whether this template parameter has a default
1741  /// argument.
1742  bool hasDefaultArgument() const { return DefaultArgument.isSet(); }
1743 
1744  /// Retrieve the default argument, if any.
1746  static const TemplateArgumentLoc NoneLoc;
1747  return DefaultArgument.isSet() ? *DefaultArgument.get() : NoneLoc;
1748  }
1749 
1750  /// Retrieve the location of the default argument, if any.
1752 
1753  /// Determines whether the default argument was inherited
1754  /// from a previous declaration of this template.
1756  return DefaultArgument.isInherited();
1757  }
1758 
1759  /// Set the default argument for this template parameter, and
1760  /// whether that default argument was inherited from another
1761  /// declaration.
1762  void setDefaultArgument(const ASTContext &C,
1763  const TemplateArgumentLoc &DefArg);
1765  TemplateTemplateParmDecl *Prev) {
1766  DefaultArgument.setInherited(C, Prev);
1767  }
1768 
1769  /// Removes the default argument of this template parameter.
1770  void removeDefaultArgument() { DefaultArgument.clear(); }
1771 
1772  SourceRange getSourceRange() const override LLVM_READONLY {
1776  return SourceRange(getTemplateParameters()->getTemplateLoc(), End);
1777  }
1778 
1779  // Implement isa/cast/dyncast/etc.
1780  static bool classof(const Decl *D) { return classofKind(D->getKind()); }
1781  static bool classofKind(Kind K) { return K == TemplateTemplateParm; }
1782 };
1783 
1784 /// Represents the builtin template declaration which is used to
1785 /// implement __make_integer_seq and other builtin templates. It serves
1786 /// no real purpose beyond existing as a place to hold template parameters.
1788  BuiltinTemplateKind BTK;
1789 
1792 
1793  void anchor() override;
1794 
1795 public:
1796  // Implement isa/cast/dyncast support
1797  static bool classof(const Decl *D) { return classofKind(D->getKind()); }
1798  static bool classofKind(Kind K) { return K == BuiltinTemplate; }
1799 
1801  DeclarationName Name,
1802  BuiltinTemplateKind BTK) {
1803  return new (C, DC) BuiltinTemplateDecl(C, DC, Name, BTK);
1804  }
1805 
1806  SourceRange getSourceRange() const override LLVM_READONLY {
1807  return {};
1808  }
1809 
1811 };
1812 
1813 /// Represents a class template specialization, which refers to
1814 /// a class template with a given set of template arguments.
1815 ///
1816 /// Class template specializations represent both explicit
1817 /// specialization of class templates, as in the example below, and
1818 /// implicit instantiations of class templates.
1819 ///
1820 /// \code
1821 /// template<typename T> class array;
1822 ///
1823 /// template<>
1824 /// class array<bool> { }; // class template specialization array<bool>
1825 /// \endcode
1827  : public CXXRecordDecl, public llvm::FoldingSetNode {
1828  /// Structure that stores information about a class template
1829  /// specialization that was instantiated from a class template partial
1830  /// specialization.
1831  struct SpecializedPartialSpecialization {
1832  /// The class template partial specialization from which this
1833  /// class template specialization was instantiated.
1834  ClassTemplatePartialSpecializationDecl *PartialSpecialization;
1835 
1836  /// The template argument list deduced for the class template
1837  /// partial specialization itself.
1838  const TemplateArgumentList *TemplateArgs;
1839  };
1840 
1841  /// The template that this specialization specializes
1842  llvm::PointerUnion<ClassTemplateDecl *, SpecializedPartialSpecialization *>
1843  SpecializedTemplate;
1844 
1845  /// Further info for explicit template specialization/instantiation.
1846  struct ExplicitSpecializationInfo {
1847  /// The type-as-written.
1848  TypeSourceInfo *TypeAsWritten = nullptr;
1849 
1850  /// The location of the extern keyword.
1851  SourceLocation ExternLoc;
1852 
1853  /// The location of the template keyword.
1854  SourceLocation TemplateKeywordLoc;
1855 
1856  ExplicitSpecializationInfo() = default;
1857  };
1858 
1859  /// Further info for explicit template specialization/instantiation.
1860  /// Does not apply to implicit specializations.
1861  ExplicitSpecializationInfo *ExplicitInfo = nullptr;
1862 
1863  /// The template arguments used to describe this specialization.
1864  const TemplateArgumentList *TemplateArgs;
1865 
1866  /// The point where this template was instantiated (if any)
1867  SourceLocation PointOfInstantiation;
1868 
1869  /// The kind of specialization this declaration refers to.
1870  /// Really a value of type TemplateSpecializationKind.
1871  unsigned SpecializationKind : 3;
1872 
1873 protected:
1875  DeclContext *DC, SourceLocation StartLoc,
1876  SourceLocation IdLoc,
1877  ClassTemplateDecl *SpecializedTemplate,
1880 
1882 
1883 public:
1884  friend class ASTDeclReader;
1885  friend class ASTDeclWriter;
1886 
1888  Create(ASTContext &Context, TagKind TK, DeclContext *DC,
1889  SourceLocation StartLoc, SourceLocation IdLoc,
1890  ClassTemplateDecl *SpecializedTemplate,
1894  CreateDeserialized(ASTContext &C, unsigned ID);
1895 
1896  void getNameForDiagnostic(raw_ostream &OS, const PrintingPolicy &Policy,
1897  bool Qualified) const override;
1898 
1899  // FIXME: This is broken. CXXRecordDecl::getMostRecentDecl() returns a
1900  // different "most recent" declaration from this function for the same
1901  // declaration, because we don't override getMostRecentDeclImpl(). But
1902  // it's not clear that we should override that, because the most recent
1903  // declaration as a CXXRecordDecl sometimes is the injected-class-name.
1905  return cast<ClassTemplateSpecializationDecl>(
1907  }
1908 
1909  /// Retrieve the template that this specialization specializes.
1911 
1912  /// Retrieve the template arguments of the class template
1913  /// specialization.
1915  return *TemplateArgs;
1916  }
1917 
1919  TemplateArgs = Args;
1920  }
1921 
1922  /// Determine the kind of specialization that this
1923  /// declaration represents.
1925  return static_cast<TemplateSpecializationKind>(SpecializationKind);
1926  }
1927 
1930  }
1931 
1932  /// Is this an explicit specialization at class scope (within the class that
1933  /// owns the primary template)? For example:
1934  ///
1935  /// \code
1936  /// template<typename T> struct Outer {
1937  /// template<typename U> struct Inner;
1938  /// template<> struct Inner; // class-scope explicit specialization
1939  /// };
1940  /// \endcode
1942  return isExplicitSpecialization() &&
1943  isa<CXXRecordDecl>(getLexicalDeclContext());
1944  }
1945 
1946  /// True if this declaration is an explicit specialization,
1947  /// explicit instantiation declaration, or explicit instantiation
1948  /// definition.
1952  }
1953 
1955  SpecializedTemplate = Specialized;
1956  }
1957 
1959  SpecializationKind = TSK;
1960  }
1961 
1962  /// Get the point of instantiation (if any), or null if none.
1964  return PointOfInstantiation;
1965  }
1966 
1968  assert(Loc.isValid() && "point of instantiation must be valid!");
1969  PointOfInstantiation = Loc;
1970  }
1971 
1972  /// If this class template specialization is an instantiation of
1973  /// a template (rather than an explicit specialization), return the
1974  /// class template or class template partial specialization from which it
1975  /// was instantiated.
1976  llvm::PointerUnion<ClassTemplateDecl *,
1980  return llvm::PointerUnion<ClassTemplateDecl *,
1982 
1984  }
1985 
1986  /// Retrieve the class template or class template partial
1987  /// specialization which was specialized by this.
1988  llvm::PointerUnion<ClassTemplateDecl *,
1991  if (const auto *PartialSpec =
1992  SpecializedTemplate.dyn_cast<SpecializedPartialSpecialization *>())
1993  return PartialSpec->PartialSpecialization;
1994 
1995  return SpecializedTemplate.get<ClassTemplateDecl*>();
1996  }
1997 
1998  /// Retrieve the set of template arguments that should be used
1999  /// to instantiate members of the class template or class template partial
2000  /// specialization from which this class template specialization was
2001  /// instantiated.
2002  ///
2003  /// \returns For a class template specialization instantiated from the primary
2004  /// template, this function will return the same template arguments as
2005  /// getTemplateArgs(). For a class template specialization instantiated from
2006  /// a class template partial specialization, this function will return the
2007  /// deduced template arguments for the class template partial specialization
2008  /// itself.
2010  if (const auto *PartialSpec =
2011  SpecializedTemplate.dyn_cast<SpecializedPartialSpecialization *>())
2012  return *PartialSpec->TemplateArgs;
2013 
2014  return getTemplateArgs();
2015  }
2016 
2017  /// Note that this class template specialization is actually an
2018  /// instantiation of the given class template partial specialization whose
2019  /// template arguments have been deduced.
2021  const TemplateArgumentList *TemplateArgs) {
2022  assert(!SpecializedTemplate.is<SpecializedPartialSpecialization*>() &&
2023  "Already set to a class template partial specialization!");
2024  auto *PS = new (getASTContext()) SpecializedPartialSpecialization();
2025  PS->PartialSpecialization = PartialSpec;
2026  PS->TemplateArgs = TemplateArgs;
2027  SpecializedTemplate = PS;
2028  }
2029 
2030  /// Note that this class template specialization is an instantiation
2031  /// of the given class template.
2033  assert(!SpecializedTemplate.is<SpecializedPartialSpecialization*>() &&
2034  "Previously set to a class template partial specialization!");
2035  SpecializedTemplate = TemplDecl;
2036  }
2037 
2038  /// Sets the type of this specialization as it was written by
2039  /// the user. This will be a class template specialization type.
2041  if (!ExplicitInfo)
2042  ExplicitInfo = new (getASTContext()) ExplicitSpecializationInfo;
2043  ExplicitInfo->TypeAsWritten = T;
2044  }
2045 
2046  /// Gets the type of this specialization as it was written by
2047  /// the user, if it was so written.
2049  return ExplicitInfo ? ExplicitInfo->TypeAsWritten : nullptr;
2050  }
2051 
2052  /// Gets the location of the extern keyword, if present.
2054  return ExplicitInfo ? ExplicitInfo->ExternLoc : SourceLocation();
2055  }
2056 
2057  /// Sets the location of the extern keyword.
2059  if (!ExplicitInfo)
2060  ExplicitInfo = new (getASTContext()) ExplicitSpecializationInfo;
2061  ExplicitInfo->ExternLoc = Loc;
2062  }
2063 
2064  /// Sets the location of the template keyword.
2066  if (!ExplicitInfo)
2067  ExplicitInfo = new (getASTContext()) ExplicitSpecializationInfo;
2068  ExplicitInfo->TemplateKeywordLoc = Loc;
2069  }
2070 
2071  /// Gets the location of the template keyword, if present.
2073  return ExplicitInfo ? ExplicitInfo->TemplateKeywordLoc : SourceLocation();
2074  }
2075 
2076  SourceRange getSourceRange() const override LLVM_READONLY;
2077 
2078  void Profile(llvm::FoldingSetNodeID &ID) const {
2079  Profile(ID, TemplateArgs->asArray(), getASTContext());
2080  }
2081 
2082  static void
2083  Profile(llvm::FoldingSetNodeID &ID, ArrayRef<TemplateArgument> TemplateArgs,
2084  ASTContext &Context) {
2085  ID.AddInteger(TemplateArgs.size());
2086  for (const TemplateArgument &TemplateArg : TemplateArgs)
2087  TemplateArg.Profile(ID, Context);
2088  }
2089 
2090  static bool classof(const Decl *D) { return classofKind(D->getKind()); }
2091 
2092  static bool classofKind(Kind K) {
2093  return K >= firstClassTemplateSpecialization &&
2094  K <= lastClassTemplateSpecialization;
2095  }
2096 };
2097 
2100  /// The list of template parameters
2101  TemplateParameterList* TemplateParams = nullptr;
2102 
2103  /// The source info for the template arguments as written.
2104  /// FIXME: redundant with TypeAsWritten?
2105  const ASTTemplateArgumentListInfo *ArgsAsWritten = nullptr;
2106 
2107  /// The class template partial specialization from which this
2108  /// class template partial specialization was instantiated.
2109  ///
2110  /// The boolean value will be true to indicate that this class template
2111  /// partial specialization was specialized at this level.
2112  llvm::PointerIntPair<ClassTemplatePartialSpecializationDecl *, 1, bool>
2113  InstantiatedFromMember;
2114 
2116  DeclContext *DC,
2117  SourceLocation StartLoc,
2118  SourceLocation IdLoc,
2119  TemplateParameterList *Params,
2120  ClassTemplateDecl *SpecializedTemplate,
2122  const ASTTemplateArgumentListInfo *ArgsAsWritten,
2124 
2126  : ClassTemplateSpecializationDecl(C, ClassTemplatePartialSpecialization),
2127  InstantiatedFromMember(nullptr, false) {}
2128 
2129  void anchor() override;
2130 
2131 public:
2132  friend class ASTDeclReader;
2133  friend class ASTDeclWriter;
2134 
2136  Create(ASTContext &Context, TagKind TK, DeclContext *DC,
2137  SourceLocation StartLoc, SourceLocation IdLoc,
2138  TemplateParameterList *Params,
2139  ClassTemplateDecl *SpecializedTemplate,
2141  const TemplateArgumentListInfo &ArgInfos,
2142  QualType CanonInjectedType,
2144 
2146  CreateDeserialized(ASTContext &C, unsigned ID);
2147 
2149  return cast<ClassTemplatePartialSpecializationDecl>(
2150  static_cast<ClassTemplateSpecializationDecl *>(
2151  this)->getMostRecentDecl());
2152  }
2153 
2154  /// Get the list of template parameters
2156  return TemplateParams;
2157  }
2158 
2159  /// \brief All associated constraints of this partial specialization,
2160  /// including the requires clause and any constraints derived from
2161  /// constrained-parameters.
2162  ///
2163  /// The constraints in the resulting list are to be treated as if in a
2164  /// conjunction ("and").
2166  TemplateParams->getAssociatedConstraints(AC);
2167  }
2168 
2170  return TemplateParams->hasAssociatedConstraints();
2171  }
2172 
2173  /// Get the template arguments as written.
2175  return ArgsAsWritten;
2176  }
2177 
2178  /// Retrieve the member class template partial specialization from
2179  /// which this particular class template partial specialization was
2180  /// instantiated.
2181  ///
2182  /// \code
2183  /// template<typename T>
2184  /// struct Outer {
2185  /// template<typename U> struct Inner;
2186  /// template<typename U> struct Inner<U*> { }; // #1
2187  /// };
2188  ///
2189  /// Outer<float>::Inner<int*> ii;
2190  /// \endcode
2191  ///
2192  /// In this example, the instantiation of \c Outer<float>::Inner<int*> will
2193  /// end up instantiating the partial specialization
2194  /// \c Outer<float>::Inner<U*>, which itself was instantiated from the class
2195  /// template partial specialization \c Outer<T>::Inner<U*>. Given
2196  /// \c Outer<float>::Inner<U*>, this function would return
2197  /// \c Outer<T>::Inner<U*>.
2199  const auto *First =
2200  cast<ClassTemplatePartialSpecializationDecl>(getFirstDecl());
2201  return First->InstantiatedFromMember.getPointer();
2202  }
2205  return getInstantiatedFromMember();
2206  }
2207 
2210  auto *First = cast<ClassTemplatePartialSpecializationDecl>(getFirstDecl());
2211  First->InstantiatedFromMember.setPointer(PartialSpec);
2212  }
2213 
2214  /// Determines whether this class template partial specialization
2215  /// template was a specialization of a member partial specialization.
2216  ///
2217  /// In the following example, the member template partial specialization
2218  /// \c X<int>::Inner<T*> is a member specialization.
2219  ///
2220  /// \code
2221  /// template<typename T>
2222  /// struct X {
2223  /// template<typename U> struct Inner;
2224  /// template<typename U> struct Inner<U*>;
2225  /// };
2226  ///
2227  /// template<> template<typename T>
2228  /// struct X<int>::Inner<T*> { /* ... */ };
2229  /// \endcode
2231  const auto *First =
2232  cast<ClassTemplatePartialSpecializationDecl>(getFirstDecl());
2233  return First->InstantiatedFromMember.getInt();
2234  }
2235 
2236  /// Note that this member template is a specialization.
2238  auto *First = cast<ClassTemplatePartialSpecializationDecl>(getFirstDecl());
2239  assert(First->InstantiatedFromMember.getPointer() &&
2240  "Only member templates can be member template specializations");
2241  return First->InstantiatedFromMember.setInt(true);
2242  }
2243 
2244  /// Retrieves the injected specialization type for this partial
2245  /// specialization. This is not the same as the type-decl-type for
2246  /// this partial specialization, which is an InjectedClassNameType.
2248  assert(getTypeForDecl() && "partial specialization has no type set!");
2249  return cast<InjectedClassNameType>(getTypeForDecl())
2250  ->getInjectedSpecializationType();
2251  }
2252 
2253  void Profile(llvm::FoldingSetNodeID &ID) const {
2255  getASTContext());
2256  }
2257 
2258  static void
2259  Profile(llvm::FoldingSetNodeID &ID, ArrayRef<TemplateArgument> TemplateArgs,
2260  TemplateParameterList *TPL, ASTContext &Context);
2261 
2262  static bool classof(const Decl *D) { return classofKind(D->getKind()); }
2263 
2264  static bool classofKind(Kind K) {
2265  return K == ClassTemplatePartialSpecialization;
2266  }
2267 };
2268 
2269 /// Declaration of a class template.
2271 protected:
2272  /// Data that is common to all of the declarations of a given
2273  /// class template.
2274  struct Common : CommonBase {
2275  /// The class template specializations for this class
2276  /// template, including explicit specializations and instantiations.
2277  llvm::FoldingSetVector<ClassTemplateSpecializationDecl> Specializations;
2278 
2279  /// The class template partial specializations for this class
2280  /// template.
2281  llvm::FoldingSetVector<ClassTemplatePartialSpecializationDecl>
2283 
2284  /// The injected-class-name type for this class template.
2286 
2287  Common() = default;
2288  };
2289 
2290  /// Retrieve the set of specializations of this class template.
2291  llvm::FoldingSetVector<ClassTemplateSpecializationDecl> &
2292  getSpecializations() const;
2293 
2294  /// Retrieve the set of partial specializations of this class
2295  /// template.
2296  llvm::FoldingSetVector<ClassTemplatePartialSpecializationDecl> &
2297  getPartialSpecializations() const;
2298 
2300  DeclarationName Name, TemplateParameterList *Params,
2301  NamedDecl *Decl)
2302  : RedeclarableTemplateDecl(ClassTemplate, C, DC, L, Name, Params, Decl) {}
2303 
2304  CommonBase *newCommon(ASTContext &C) const override;
2305 
2307  return static_cast<Common *>(RedeclarableTemplateDecl::getCommonPtr());
2308  }
2309 
2310 public:
2311  friend class ASTDeclReader;
2312  friend class ASTDeclWriter;
2313 
2314  /// Load any lazily-loaded specializations from the external source.
2315  void LoadLazySpecializations() const;
2316 
2317  /// Get the underlying class declarations of the template.
2319  return static_cast<CXXRecordDecl *>(TemplatedDecl);
2320  }
2321 
2322  /// Returns whether this template declaration defines the primary
2323  /// class pattern.
2326  }
2327 
2328  /// \brief Create a class template node.
2330  SourceLocation L,
2331  DeclarationName Name,
2332  TemplateParameterList *Params,
2333  NamedDecl *Decl);
2334 
2335  /// Create an empty class template node.
2336  static ClassTemplateDecl *CreateDeserialized(ASTContext &C, unsigned ID);
2337 
2338  /// Return the specialization with the provided arguments if it exists,
2339  /// otherwise return the insertion point.
2341  findSpecialization(ArrayRef<TemplateArgument> Args, void *&InsertPos);
2342 
2343  /// Insert the specified specialization knowing that it is not already
2344  /// in. InsertPos must be obtained from findSpecialization.
2345  void AddSpecialization(ClassTemplateSpecializationDecl *D, void *InsertPos);
2346 
2348  return cast<ClassTemplateDecl>(
2350  }
2352  return cast<ClassTemplateDecl>(
2354  }
2355 
2356  /// Retrieve the previous declaration of this class template, or
2357  /// nullptr if no such declaration exists.
2359  return cast_or_null<ClassTemplateDecl>(
2360  static_cast<RedeclarableTemplateDecl *>(this)->getPreviousDecl());
2361  }
2363  return cast_or_null<ClassTemplateDecl>(
2364  static_cast<const RedeclarableTemplateDecl *>(
2365  this)->getPreviousDecl());
2366  }
2367 
2369  return cast<ClassTemplateDecl>(
2370  static_cast<RedeclarableTemplateDecl *>(this)->getMostRecentDecl());
2371  }
2373  return const_cast<ClassTemplateDecl*>(this)->getMostRecentDecl();
2374  }
2375 
2377  return cast_or_null<ClassTemplateDecl>(
2379  }
2380 
2381  /// Return the partial specialization with the provided arguments if it
2382  /// exists, otherwise return the insertion point.
2385  TemplateParameterList *TPL, void *&InsertPos);
2386 
2387  /// Insert the specified partial specialization knowing that it is not
2388  /// already in. InsertPos must be obtained from findPartialSpecialization.
2390  void *InsertPos);
2391 
2392  /// Retrieve the partial specializations as an ordered list.
2395 
2396  /// Find a class template partial specialization with the given
2397  /// type T.
2398  ///
2399  /// \param T a dependent type that names a specialization of this class
2400  /// template.
2401  ///
2402  /// \returns the class template partial specialization that exactly matches
2403  /// the type \p T, or nullptr if no such partial specialization exists.
2405 
2406  /// Find a class template partial specialization which was instantiated
2407  /// from the given member partial specialization.
2408  ///
2409  /// \param D a member class template partial specialization.
2410  ///
2411  /// \returns the class template partial specialization which was instantiated
2412  /// from the given member partial specialization, or nullptr if no such
2413  /// partial specialization exists.
2417 
2418  /// Retrieve the template specialization type of the
2419  /// injected-class-name for this class template.
2420  ///
2421  /// The injected-class-name for a class template \c X is \c
2422  /// X<template-args>, where \c template-args is formed from the
2423  /// template arguments that correspond to the template parameters of
2424  /// \c X. For example:
2425  ///
2426  /// \code
2427  /// template<typename T, int N>
2428  /// struct array {
2429  /// typedef array this_type; // "array" is equivalent to "array<T, N>"
2430  /// };
2431  /// \endcode
2433 
2435  using spec_range = llvm::iterator_range<spec_iterator>;
2436 
2438  return spec_range(spec_begin(), spec_end());
2439  }
2440 
2442  return makeSpecIterator(getSpecializations(), false);
2443  }
2444 
2446  return makeSpecIterator(getSpecializations(), true);
2447  }
2448 
2449  // Implement isa/cast/dyncast support
2450  static bool classof(const Decl *D) { return classofKind(D->getKind()); }
2451  static bool classofKind(Kind K) { return K == ClassTemplate; }
2452 };
2453 
2454 /// Declaration of a friend template.
2455 ///
2456 /// For example:
2457 /// \code
2458 /// template <typename T> class A {
2459 /// friend class MyVector<T>; // not a friend template
2460 /// template <typename U> friend class B; // not a friend template
2461 /// template <typename U> friend class Foo<T>::Nested; // friend template
2462 /// };
2463 /// \endcode
2464 ///
2465 /// \note This class is not currently in use. All of the above
2466 /// will yield a FriendDecl, not a FriendTemplateDecl.
2467 class FriendTemplateDecl : public Decl {
2468  virtual void anchor();
2469 
2470 public:
2471  using FriendUnion = llvm::PointerUnion<NamedDecl *,TypeSourceInfo *>;
2472 
2473 private:
2474  // The number of template parameters; always non-zero.
2475  unsigned NumParams = 0;
2476 
2477  // The parameter list.
2478  TemplateParameterList **Params = nullptr;
2479 
2480  // The declaration that's a friend of this class.
2481  FriendUnion Friend;
2482 
2483  // Location of the 'friend' specifier.
2484  SourceLocation FriendLoc;
2485 
2487  TemplateParameterList **Params, unsigned NumParams,
2488  FriendUnion Friend, SourceLocation FriendLoc)
2489  : Decl(Decl::FriendTemplate, DC, Loc), NumParams(NumParams),
2490  Params(Params), Friend(Friend), FriendLoc(FriendLoc) {}
2491 
2492  FriendTemplateDecl(EmptyShell Empty) : Decl(Decl::FriendTemplate, Empty) {}
2493 
2494 public:
2495  friend class ASTDeclReader;
2496 
2497  static FriendTemplateDecl *
2498  Create(ASTContext &Context, DeclContext *DC, SourceLocation Loc,
2500  SourceLocation FriendLoc);
2501 
2502  static FriendTemplateDecl *CreateDeserialized(ASTContext &C, unsigned ID);
2503 
2504  /// If this friend declaration names a templated type (or
2505  /// a dependent member type of a templated type), return that
2506  /// type; otherwise return null.
2508  return Friend.dyn_cast<TypeSourceInfo*>();
2509  }
2510 
2511  /// If this friend declaration names a templated function (or
2512  /// a member function of a templated type), return that type;
2513  /// otherwise return null.
2515  return Friend.dyn_cast<NamedDecl*>();
2516  }
2517 
2518  /// Retrieves the location of the 'friend' keyword.
2520  return FriendLoc;
2521  }
2522 
2524  assert(i <= NumParams);
2525  return Params[i];
2526  }
2527 
2528  unsigned getNumTemplateParameters() const {
2529  return NumParams;
2530  }
2531 
2532  // Implement isa/cast/dyncast/etc.
2533  static bool classof(const Decl *D) { return classofKind(D->getKind()); }
2534  static bool classofKind(Kind K) { return K == Decl::FriendTemplate; }
2535 };
2536 
2537 /// Declaration of an alias template.
2538 ///
2539 /// For example:
2540 /// \code
2541 /// template <typename T> using V = std::map<T*, int, MyCompare<T>>;
2542 /// \endcode
2544 protected:
2546 
2548  DeclarationName Name, TemplateParameterList *Params,
2549  NamedDecl *Decl)
2550  : RedeclarableTemplateDecl(TypeAliasTemplate, C, DC, L, Name, Params,
2551  Decl) {}
2552 
2553  CommonBase *newCommon(ASTContext &C) const override;
2554 
2556  return static_cast<Common *>(RedeclarableTemplateDecl::getCommonPtr());
2557  }
2558 
2559 public:
2560  friend class ASTDeclReader;
2561  friend class ASTDeclWriter;
2562 
2563  /// Get the underlying function declaration of the template.
2565  return static_cast<TypeAliasDecl *>(TemplatedDecl);
2566  }
2567 
2568 
2570  return cast<TypeAliasTemplateDecl>(
2572  }
2574  return cast<TypeAliasTemplateDecl>(
2576  }
2577 
2578  /// Retrieve the previous declaration of this function template, or
2579  /// nullptr if no such declaration exists.
2581  return cast_or_null<TypeAliasTemplateDecl>(
2582  static_cast<RedeclarableTemplateDecl *>(this)->getPreviousDecl());
2583  }
2585  return cast_or_null<TypeAliasTemplateDecl>(
2586  static_cast<const RedeclarableTemplateDecl *>(
2587  this)->getPreviousDecl());
2588  }
2589 
2591  return cast_or_null<TypeAliasTemplateDecl>(
2593  }
2594 
2595  /// Create a function template node.
2597  SourceLocation L,
2598  DeclarationName Name,
2599  TemplateParameterList *Params,
2600  NamedDecl *Decl);
2601 
2602  /// Create an empty alias template node.
2604 
2605  // Implement isa/cast/dyncast support
2606  static bool classof(const Decl *D) { return classofKind(D->getKind()); }
2607  static bool classofKind(Kind K) { return K == TypeAliasTemplate; }
2608 };
2609 
2610 /// Declaration of a function specialization at template class scope.
2611 ///
2612 /// For example:
2613 /// \code
2614 /// template <class T>
2615 /// class A {
2616 /// template <class U> void foo(U a) { }
2617 /// template<> void foo(int a) { }
2618 /// }
2619 /// \endcode
2620 ///
2621 /// "template<> foo(int a)" will be saved in Specialization as a normal
2622 /// CXXMethodDecl. Then during an instantiation of class A, it will be
2623 /// transformed into an actual function specialization.
2624 ///
2625 /// FIXME: This is redundant; we could store the same information directly on
2626 /// the CXXMethodDecl as a DependentFunctionTemplateSpecializationInfo.
2628  CXXMethodDecl *Specialization;
2629  const ASTTemplateArgumentListInfo *TemplateArgs;
2630 
2633  const ASTTemplateArgumentListInfo *TemplArgs)
2634  : Decl(Decl::ClassScopeFunctionSpecialization, DC, Loc),
2635  Specialization(FD), TemplateArgs(TemplArgs) {}
2636 
2638  : Decl(Decl::ClassScopeFunctionSpecialization, Empty) {}
2639 
2640  virtual void anchor();
2641 
2642 public:
2643  friend class ASTDeclReader;
2644  friend class ASTDeclWriter;
2645 
2647  bool hasExplicitTemplateArgs() const { return TemplateArgs; }
2649  return TemplateArgs;
2650  }
2651 
2654  bool HasExplicitTemplateArgs,
2655  const TemplateArgumentListInfo &TemplateArgs) {
2656  return new (C, DC) ClassScopeFunctionSpecializationDecl(
2657  DC, Loc, FD,
2658  HasExplicitTemplateArgs
2659  ? ASTTemplateArgumentListInfo::Create(C, TemplateArgs)
2660  : nullptr);
2661  }
2662 
2664  CreateDeserialized(ASTContext &Context, unsigned ID);
2665 
2666  // Implement isa/cast/dyncast/etc.
2667  static bool classof(const Decl *D) { return classofKind(D->getKind()); }
2668 
2669  static bool classofKind(Kind K) {
2670  return K == Decl::ClassScopeFunctionSpecialization;
2671  }
2672 };
2673 
2674 /// Represents a variable template specialization, which refers to
2675 /// a variable template with a given set of template arguments.
2676 ///
2677 /// Variable template specializations represent both explicit
2678 /// specializations of variable templates, as in the example below, and
2679 /// implicit instantiations of variable templates.
2680 ///
2681 /// \code
2682 /// template<typename T> constexpr T pi = T(3.1415926535897932385);
2683 ///
2684 /// template<>
2685 /// constexpr float pi<float>; // variable template specialization pi<float>
2686 /// \endcode
2688  public llvm::FoldingSetNode {
2689 
2690  /// Structure that stores information about a variable template
2691  /// specialization that was instantiated from a variable template partial
2692  /// specialization.
2693  struct SpecializedPartialSpecialization {
2694  /// The variable template partial specialization from which this
2695  /// variable template specialization was instantiated.
2696  VarTemplatePartialSpecializationDecl *PartialSpecialization;
2697 
2698  /// The template argument list deduced for the variable template
2699  /// partial specialization itself.
2700  const TemplateArgumentList *TemplateArgs;
2701  };
2702 
2703  /// The template that this specialization specializes.
2704  llvm::PointerUnion<VarTemplateDecl *, SpecializedPartialSpecialization *>
2705  SpecializedTemplate;
2706 
2707  /// Further info for explicit template specialization/instantiation.
2708  struct ExplicitSpecializationInfo {
2709  /// The type-as-written.
2710  TypeSourceInfo *TypeAsWritten = nullptr;
2711 
2712  /// The location of the extern keyword.
2713  SourceLocation ExternLoc;
2714 
2715  /// The location of the template keyword.
2716  SourceLocation TemplateKeywordLoc;
2717 
2718  ExplicitSpecializationInfo() = default;
2719  };
2720 
2721  /// Further info for explicit template specialization/instantiation.
2722  /// Does not apply to implicit specializations.
2723  ExplicitSpecializationInfo *ExplicitInfo = nullptr;
2724 
2725  /// The template arguments used to describe this specialization.
2726  const TemplateArgumentList *TemplateArgs;
2727  const ASTTemplateArgumentListInfo *TemplateArgsInfo = nullptr;
2728 
2729  /// The point where this template was instantiated (if any).
2730  SourceLocation PointOfInstantiation;
2731 
2732  /// The kind of specialization this declaration refers to.
2733  /// Really a value of type TemplateSpecializationKind.
2734  unsigned SpecializationKind : 3;
2735 
2736  /// Whether this declaration is a complete definition of the
2737  /// variable template specialization. We can't otherwise tell apart
2738  /// an instantiated declaration from an instantiated definition with
2739  /// no initializer.
2740  unsigned IsCompleteDefinition : 1;
2741 
2742 protected:
2744  SourceLocation StartLoc, SourceLocation IdLoc,
2745  VarTemplateDecl *SpecializedTemplate,
2746  QualType T, TypeSourceInfo *TInfo,
2747  StorageClass S,
2749 
2750  explicit VarTemplateSpecializationDecl(Kind DK, ASTContext &Context);
2751 
2752 public:
2753  friend class ASTDeclReader;
2754  friend class ASTDeclWriter;
2755  friend class VarDecl;
2756 
2758  Create(ASTContext &Context, DeclContext *DC, SourceLocation StartLoc,
2759  SourceLocation IdLoc, VarTemplateDecl *SpecializedTemplate, QualType T,
2760  TypeSourceInfo *TInfo, StorageClass S,
2763  unsigned ID);
2764 
2765  void getNameForDiagnostic(raw_ostream &OS, const PrintingPolicy &Policy,
2766  bool Qualified) const override;
2767 
2769  VarDecl *Recent = static_cast<VarDecl *>(this)->getMostRecentDecl();
2770  return cast<VarTemplateSpecializationDecl>(Recent);
2771  }
2772 
2773  /// Retrieve the template that this specialization specializes.
2775 
2776  /// Retrieve the template arguments of the variable template
2777  /// specialization.
2778  const TemplateArgumentList &getTemplateArgs() const { return *TemplateArgs; }
2779 
2780  // TODO: Always set this when creating the new specialization?
2781  void setTemplateArgsInfo(const TemplateArgumentListInfo &ArgsInfo);
2782  void setTemplateArgsInfo(const ASTTemplateArgumentListInfo *ArgsInfo);
2783 
2785  return TemplateArgsInfo;
2786  }
2787 
2788  /// Determine the kind of specialization that this
2789  /// declaration represents.
2791  return static_cast<TemplateSpecializationKind>(SpecializationKind);
2792  }
2793 
2796  }
2797 
2799  return isExplicitSpecialization() &&
2800  isa<CXXRecordDecl>(getLexicalDeclContext());
2801  }
2802 
2803  /// True if this declaration is an explicit specialization,
2804  /// explicit instantiation declaration, or explicit instantiation
2805  /// definition.
2809  }
2810 
2812  SpecializationKind = TSK;
2813  }
2814 
2815  /// Get the point of instantiation (if any), or null if none.
2817  return PointOfInstantiation;
2818  }
2819 
2821  assert(Loc.isValid() && "point of instantiation must be valid!");
2822  PointOfInstantiation = Loc;
2823  }
2824 
2825  void setCompleteDefinition() { IsCompleteDefinition = true; }
2826 
2827  /// If this variable template specialization is an instantiation of
2828  /// a template (rather than an explicit specialization), return the
2829  /// variable template or variable template partial specialization from which
2830  /// it was instantiated.
2831  llvm::PointerUnion<VarTemplateDecl *, VarTemplatePartialSpecializationDecl *>
2834  return llvm::PointerUnion<VarTemplateDecl *,
2836 
2838  }
2839 
2840  /// Retrieve the variable template or variable template partial
2841  /// specialization which was specialized by this.
2842  llvm::PointerUnion<VarTemplateDecl *, VarTemplatePartialSpecializationDecl *>
2844  if (const auto *PartialSpec =
2845  SpecializedTemplate.dyn_cast<SpecializedPartialSpecialization *>())
2846  return PartialSpec->PartialSpecialization;
2847 
2848  return SpecializedTemplate.get<VarTemplateDecl *>();
2849  }
2850 
2851  /// Retrieve the set of template arguments that should be used
2852  /// to instantiate the initializer of the variable template or variable
2853  /// template partial specialization from which this variable template
2854  /// specialization was instantiated.
2855  ///
2856  /// \returns For a variable template specialization instantiated from the
2857  /// primary template, this function will return the same template arguments
2858  /// as getTemplateArgs(). For a variable template specialization instantiated
2859  /// from a variable template partial specialization, this function will the
2860  /// return deduced template arguments for the variable template partial
2861  /// specialization itself.
2863  if (const auto *PartialSpec =
2864  SpecializedTemplate.dyn_cast<SpecializedPartialSpecialization *>())
2865  return *PartialSpec->TemplateArgs;
2866 
2867  return getTemplateArgs();
2868  }
2869 
2870  /// Note that this variable template specialization is actually an
2871  /// instantiation of the given variable template partial specialization whose
2872  /// template arguments have been deduced.
2874  const TemplateArgumentList *TemplateArgs) {
2875  assert(!SpecializedTemplate.is<SpecializedPartialSpecialization *>() &&
2876  "Already set to a variable template partial specialization!");
2877  auto *PS = new (getASTContext()) SpecializedPartialSpecialization();
2878  PS->PartialSpecialization = PartialSpec;
2879  PS->TemplateArgs = TemplateArgs;
2880  SpecializedTemplate = PS;
2881  }
2882 
2883  /// Note that this variable template specialization is an instantiation
2884  /// of the given variable template.
2886  assert(!SpecializedTemplate.is<SpecializedPartialSpecialization *>() &&
2887  "Previously set to a variable template partial specialization!");
2888  SpecializedTemplate = TemplDecl;
2889  }
2890 
2891  /// Sets the type of this specialization as it was written by
2892  /// the user.
2894  if (!ExplicitInfo)
2895  ExplicitInfo = new (getASTContext()) ExplicitSpecializationInfo;
2896  ExplicitInfo->TypeAsWritten = T;
2897  }
2898 
2899  /// Gets the type of this specialization as it was written by
2900  /// the user, if it was so written.
2902  return ExplicitInfo ? ExplicitInfo->TypeAsWritten : nullptr;
2903  }
2904 
2905  /// Gets the location of the extern keyword, if present.
2907  return ExplicitInfo ? ExplicitInfo->ExternLoc : SourceLocation();
2908  }
2909 
2910  /// Sets the location of the extern keyword.
2912  if (!ExplicitInfo)
2913  ExplicitInfo = new (getASTContext()) ExplicitSpecializationInfo;
2914  ExplicitInfo->ExternLoc = Loc;
2915  }
2916 
2917  /// Sets the location of the template keyword.
2919  if (!ExplicitInfo)
2920  ExplicitInfo = new (getASTContext()) ExplicitSpecializationInfo;
2921  ExplicitInfo->TemplateKeywordLoc = Loc;
2922  }
2923 
2924  /// Gets the location of the template keyword, if present.
2926  return ExplicitInfo ? ExplicitInfo->TemplateKeywordLoc : SourceLocation();
2927  }
2928 
2929  SourceRange getSourceRange() const override LLVM_READONLY {
2930  if (isExplicitSpecialization()) {
2932  return SourceRange(getOuterLocStart(), Info->getRAngleLoc());
2933  }
2934  return VarDecl::getSourceRange();
2935  }
2936 
2937  void Profile(llvm::FoldingSetNodeID &ID) const {
2938  Profile(ID, TemplateArgs->asArray(), getASTContext());
2939  }
2940 
2941  static void Profile(llvm::FoldingSetNodeID &ID,
2942  ArrayRef<TemplateArgument> TemplateArgs,
2943  ASTContext &Context) {
2944  ID.AddInteger(TemplateArgs.size());
2945  for (const TemplateArgument &TemplateArg : TemplateArgs)
2946  TemplateArg.Profile(ID, Context);
2947  }
2948 
2949  static bool classof(const Decl *D) { return classofKind(D->getKind()); }
2950 
2951  static bool classofKind(Kind K) {
2952  return K >= firstVarTemplateSpecialization &&
2953  K <= lastVarTemplateSpecialization;
2954  }
2955 };
2956 
2959  /// The list of template parameters
2960  TemplateParameterList *TemplateParams = nullptr;
2961 
2962  /// The source info for the template arguments as written.
2963  /// FIXME: redundant with TypeAsWritten?
2964  const ASTTemplateArgumentListInfo *ArgsAsWritten = nullptr;
2965 
2966  /// The variable template partial specialization from which this
2967  /// variable template partial specialization was instantiated.
2968  ///
2969  /// The boolean value will be true to indicate that this variable template
2970  /// partial specialization was specialized at this level.
2971  llvm::PointerIntPair<VarTemplatePartialSpecializationDecl *, 1, bool>
2972  InstantiatedFromMember;
2973 
2975  ASTContext &Context, DeclContext *DC, SourceLocation StartLoc,
2976  SourceLocation IdLoc, TemplateParameterList *Params,
2977  VarTemplateDecl *SpecializedTemplate, QualType T, TypeSourceInfo *TInfo,
2979  const ASTTemplateArgumentListInfo *ArgInfos);
2980 
2982  : VarTemplateSpecializationDecl(VarTemplatePartialSpecialization,
2983  Context),
2984  InstantiatedFromMember(nullptr, false) {}
2985 
2986  void anchor() override;
2987 
2988 public:
2989  friend class ASTDeclReader;
2990  friend class ASTDeclWriter;
2991 
2993  Create(ASTContext &Context, DeclContext *DC, SourceLocation StartLoc,
2994  SourceLocation IdLoc, TemplateParameterList *Params,
2995  VarTemplateDecl *SpecializedTemplate, QualType T,
2997  const TemplateArgumentListInfo &ArgInfos);
2998 
3000  unsigned ID);
3001 
3003  return cast<VarTemplatePartialSpecializationDecl>(
3004  static_cast<VarTemplateSpecializationDecl *>(
3005  this)->getMostRecentDecl());
3006  }
3007 
3008  /// Get the list of template parameters
3010  return TemplateParams;
3011  }
3012 
3013  /// Get the template arguments as written.
3015  return ArgsAsWritten;
3016  }
3017 
3018  /// \brief All associated constraints of this partial specialization,
3019  /// including the requires clause and any constraints derived from
3020  /// constrained-parameters.
3021  ///
3022  /// The constraints in the resulting list are to be treated as if in a
3023  /// conjunction ("and").
3025  TemplateParams->getAssociatedConstraints(AC);
3026  }
3027 
3029  return TemplateParams->hasAssociatedConstraints();
3030  }
3031 
3032  /// \brief Retrieve the member variable template partial specialization from
3033  /// which this particular variable template partial specialization was
3034  /// instantiated.
3035  ///
3036  /// \code
3037  /// template<typename T>
3038  /// struct Outer {
3039  /// template<typename U> U Inner;
3040  /// template<typename U> U* Inner<U*> = (U*)(0); // #1
3041  /// };
3042  ///
3043  /// template int* Outer<float>::Inner<int*>;
3044  /// \endcode
3045  ///
3046  /// In this example, the instantiation of \c Outer<float>::Inner<int*> will
3047  /// end up instantiating the partial specialization
3048  /// \c Outer<float>::Inner<U*>, which itself was instantiated from the
3049  /// variable template partial specialization \c Outer<T>::Inner<U*>. Given
3050  /// \c Outer<float>::Inner<U*>, this function would return
3051  /// \c Outer<T>::Inner<U*>.
3053  const auto *First =
3054  cast<VarTemplatePartialSpecializationDecl>(getFirstDecl());
3055  return First->InstantiatedFromMember.getPointer();
3056  }
3057 
3058  void
3060  auto *First = cast<VarTemplatePartialSpecializationDecl>(getFirstDecl());
3061  First->InstantiatedFromMember.setPointer(PartialSpec);
3062  }
3063 
3064  /// Determines whether this variable template partial specialization
3065  /// was a specialization of a member partial specialization.
3066  ///
3067  /// In the following example, the member template partial specialization
3068  /// \c X<int>::Inner<T*> is a member specialization.
3069  ///
3070  /// \code
3071  /// template<typename T>
3072  /// struct X {
3073  /// template<typename U> U Inner;
3074  /// template<typename U> U* Inner<U*> = (U*)(0);
3075  /// };
3076  ///
3077  /// template<> template<typename T>
3078  /// U* X<int>::Inner<T*> = (T*)(0) + 1;
3079  /// \endcode
3081  const auto *First =
3082  cast<VarTemplatePartialSpecializationDecl>(getFirstDecl());
3083  return First->InstantiatedFromMember.getInt();
3084  }
3085 
3086  /// Note that this member template is a specialization.
3088  auto *First = cast<VarTemplatePartialSpecializationDecl>(getFirstDecl());
3089  assert(First->InstantiatedFromMember.getPointer() &&
3090  "Only member templates can be member template specializations");
3091  return First->InstantiatedFromMember.setInt(true);
3092  }
3093 
3094  SourceRange getSourceRange() const override LLVM_READONLY {
3095  if (isExplicitSpecialization()) {
3097  return SourceRange(getOuterLocStart(), Info->getRAngleLoc());
3098  }
3099  return VarDecl::getSourceRange();
3100  }
3101 
3102  void Profile(llvm::FoldingSetNodeID &ID) const {
3104  getASTContext());
3105  }
3106 
3107  static void
3108  Profile(llvm::FoldingSetNodeID &ID, ArrayRef<TemplateArgument> TemplateArgs,
3109  TemplateParameterList *TPL, ASTContext &Context);
3110 
3111  static bool classof(const Decl *D) { return classofKind(D->getKind()); }
3112 
3113  static bool classofKind(Kind K) {
3114  return K == VarTemplatePartialSpecialization;
3115  }
3116 };
3117 
3118 /// Declaration of a variable template.
3120 protected:
3121  /// Data that is common to all of the declarations of a given
3122  /// variable template.
3123  struct Common : CommonBase {
3124  /// The variable template specializations for this variable
3125  /// template, including explicit specializations and instantiations.
3126  llvm::FoldingSetVector<VarTemplateSpecializationDecl> Specializations;
3127 
3128  /// The variable template partial specializations for this variable
3129  /// template.
3130  llvm::FoldingSetVector<VarTemplatePartialSpecializationDecl>
3132 
3133  Common() = default;
3134  };
3135 
3136  /// Retrieve the set of specializations of this variable template.
3137  llvm::FoldingSetVector<VarTemplateSpecializationDecl> &
3138  getSpecializations() const;
3139 
3140  /// Retrieve the set of partial specializations of this class
3141  /// template.
3142  llvm::FoldingSetVector<VarTemplatePartialSpecializationDecl> &
3143  getPartialSpecializations() const;
3144 
3146  DeclarationName Name, TemplateParameterList *Params,
3147  NamedDecl *Decl)
3148  : RedeclarableTemplateDecl(VarTemplate, C, DC, L, Name, Params, Decl) {}
3149 
3150  CommonBase *newCommon(ASTContext &C) const override;
3151 
3153  return static_cast<Common *>(RedeclarableTemplateDecl::getCommonPtr());
3154  }
3155 
3156 public:
3157  friend class ASTDeclReader;
3158  friend class ASTDeclWriter;
3159 
3160  /// Load any lazily-loaded specializations from the external source.
3161  void LoadLazySpecializations() const;
3162 
3163  /// Get the underlying variable declarations of the template.
3165  return static_cast<VarDecl *>(TemplatedDecl);
3166  }
3167 
3168  /// Returns whether this template declaration defines the primary
3169  /// variable pattern.
3172  }
3173 
3175 
3176  /// Create a variable template node.
3179  TemplateParameterList *Params,
3180  VarDecl *Decl);
3181 
3182  /// Create an empty variable template node.
3183  static VarTemplateDecl *CreateDeserialized(ASTContext &C, unsigned ID);
3184 
3185  /// Return the specialization with the provided arguments if it exists,
3186  /// otherwise return the insertion point.
3188  findSpecialization(ArrayRef<TemplateArgument> Args, void *&InsertPos);
3189 
3190  /// Insert the specified specialization knowing that it is not already
3191  /// in. InsertPos must be obtained from findSpecialization.
3192  void AddSpecialization(VarTemplateSpecializationDecl *D, void *InsertPos);
3193 
3195  return cast<VarTemplateDecl>(RedeclarableTemplateDecl::getCanonicalDecl());
3196  }
3198  return cast<VarTemplateDecl>(RedeclarableTemplateDecl::getCanonicalDecl());
3199  }
3200 
3201  /// Retrieve the previous declaration of this variable template, or
3202  /// nullptr if no such declaration exists.
3204  return cast_or_null<VarTemplateDecl>(
3205  static_cast<RedeclarableTemplateDecl *>(this)->getPreviousDecl());
3206  }
3208  return cast_or_null<VarTemplateDecl>(
3209  static_cast<const RedeclarableTemplateDecl *>(
3210  this)->getPreviousDecl());
3211  }
3212 
3214  return cast<VarTemplateDecl>(
3215  static_cast<RedeclarableTemplateDecl *>(this)->getMostRecentDecl());
3216  }
3218  return const_cast<VarTemplateDecl *>(this)->getMostRecentDecl();
3219  }
3220 
3222  return cast_or_null<VarTemplateDecl>(
3224  }
3225 
3226  /// Return the partial specialization with the provided arguments if it
3227  /// exists, otherwise return the insertion point.
3230  TemplateParameterList *TPL, void *&InsertPos);
3231 
3232  /// Insert the specified partial specialization knowing that it is not
3233  /// already in. InsertPos must be obtained from findPartialSpecialization.
3235  void *InsertPos);
3236 
3237  /// Retrieve the partial specializations as an ordered list.
3240 
3241  /// Find a variable template partial specialization which was
3242  /// instantiated
3243  /// from the given member partial specialization.
3244  ///
3245  /// \param D a member variable template partial specialization.
3246  ///
3247  /// \returns the variable template partial specialization which was
3248  /// instantiated
3249  /// from the given member partial specialization, or nullptr if no such
3250  /// partial specialization exists.
3253 
3255  using spec_range = llvm::iterator_range<spec_iterator>;
3256 
3258  return spec_range(spec_begin(), spec_end());
3259  }
3260 
3262  return makeSpecIterator(getSpecializations(), false);
3263  }
3264 
3266  return makeSpecIterator(getSpecializations(), true);
3267  }
3268 
3269  // Implement isa/cast/dyncast support
3270  static bool classof(const Decl *D) { return classofKind(D->getKind()); }
3271  static bool classofKind(Kind K) { return K == VarTemplate; }
3272 };
3273 
3274 /// Declaration of a C++20 concept.
3275 class ConceptDecl : public TemplateDecl, public Mergeable<ConceptDecl> {
3276 protected:
3278 
3281  : TemplateDecl(Concept, DC, L, Name, Params),
3283 public:
3284  static ConceptDecl *Create(ASTContext &C, DeclContext *DC,
3286  TemplateParameterList *Params,
3287  Expr *ConstraintExpr);
3288  static ConceptDecl *CreateDeserialized(ASTContext &C, unsigned ID);
3289 
3291  return ConstraintExpr;
3292  }
3293 
3294  SourceRange getSourceRange() const override LLVM_READONLY {
3295  return SourceRange(getTemplateParameters()->getTemplateLoc(),
3297  }
3298 
3299  bool isTypeConcept() const {
3300  return isa<TemplateTypeParmDecl>(getTemplateParameters()->getParam(0));
3301  }
3302 
3304  return cast<ConceptDecl>(getPrimaryMergedDecl(this));
3305  }
3307  return const_cast<ConceptDecl *>(this)->getCanonicalDecl();
3308  }
3309 
3310  // Implement isa/cast/dyncast/etc.
3311  static bool classof(const Decl *D) { return classofKind(D->getKind()); }
3312  static bool classofKind(Kind K) { return K == Concept; }
3313 
3314  friend class ASTReader;
3315  friend class ASTDeclReader;
3316  friend class ASTDeclWriter;
3317 };
3318 
3319 // An implementation detail of ConceptSpecialicationExpr that holds the template
3320 // arguments, so we can later use this to reconstitute the template arguments
3321 // during constraint checking.
3323  : public Decl,
3324  private llvm::TrailingObjects<ImplicitConceptSpecializationDecl,
3325  TemplateArgument> {
3326  unsigned NumTemplateArgs;
3327 
3329  ArrayRef<TemplateArgument> ConvertedArgs);
3330  ImplicitConceptSpecializationDecl(EmptyShell Empty, unsigned NumTemplateArgs);
3331 
3332 public:
3334  Create(const ASTContext &C, DeclContext *DC, SourceLocation SL,
3335  ArrayRef<TemplateArgument> ConvertedArgs);
3337  CreateDeserialized(const ASTContext &C, unsigned ID,
3338  unsigned NumTemplateArgs);
3339 
3341  return ArrayRef<TemplateArgument>(getTrailingObjects<TemplateArgument>(),
3342  NumTemplateArgs);
3343  }
3345 
3346  static bool classofKind(Kind K) { return K == ImplicitConceptSpecialization; }
3347  static bool classof(const Decl *D) { return classofKind(D->getKind()); }
3348 
3350  friend class ASTDeclReader;
3351 };
3352 
3353 /// A template parameter object.
3354 ///
3355 /// Template parameter objects represent values of class type used as template
3356 /// arguments. There is one template parameter object for each such distinct
3357 /// value used as a template argument across the program.
3358 ///
3359 /// \code
3360 /// struct A { int x, y; };
3361 /// template<A> struct S;
3362 /// S<A{1, 2}> s1;
3363 /// S<A{1, 2}> s2; // same type, argument is same TemplateParamObjectDecl.
3364 /// \endcode
3366  public Mergeable<TemplateParamObjectDecl>,
3367  public llvm::FoldingSetNode {
3368 private:
3369  /// The value of this template parameter object.
3370  APValue Value;
3371 
3373  : ValueDecl(TemplateParamObject, DC, SourceLocation(), DeclarationName(),
3374  T),
3375  Value(V) {}
3376 
3377  static TemplateParamObjectDecl *Create(const ASTContext &C, QualType T,
3378  const APValue &V);
3379  static TemplateParamObjectDecl *CreateDeserialized(ASTContext &C,
3380  unsigned ID);
3381 
3382  /// Only ASTContext::getTemplateParamObjectDecl and deserialization
3383  /// create these.
3384  friend class ASTContext;
3385  friend class ASTReader;
3386  friend class ASTDeclReader;
3387 
3388 public:
3389  /// Print this template parameter object in a human-readable format.
3390  void printName(llvm::raw_ostream &OS,
3391  const PrintingPolicy &Policy) const override;
3392 
3393  /// Print this object as an equivalent expression.
3394  void printAsExpr(llvm::raw_ostream &OS) const;
3395  void printAsExpr(llvm::raw_ostream &OS, const PrintingPolicy &Policy) const;
3396 
3397  /// Print this object as an initializer suitable for a variable of the
3398  /// object's type.
3399  void printAsInit(llvm::raw_ostream &OS) const;
3400  void printAsInit(llvm::raw_ostream &OS, const PrintingPolicy &Policy) const;
3401 
3402  const APValue &getValue() const { return Value; }
3403 
3404  static void Profile(llvm::FoldingSetNodeID &ID, QualType T,
3405  const APValue &V) {
3406  ID.AddPointer(T.getCanonicalType().getAsOpaquePtr());
3407  V.Profile(ID);
3408  }
3409  void Profile(llvm::FoldingSetNodeID &ID) {
3410  Profile(ID, getType(), getValue());
3411  }
3412 
3414  return getFirstDecl();
3415  }
3417  return getFirstDecl();
3418  }
3419 
3420  static bool classof(const Decl *D) { return classofKind(D->getKind()); }
3421  static bool classofKind(Kind K) { return K == TemplateParamObject; }
3422 };
3423 
3425  if (auto *PD = P.dyn_cast<TemplateTypeParmDecl *>())
3426  return PD;
3427  if (auto *PD = P.dyn_cast<NonTypeTemplateParmDecl *>())
3428  return PD;
3429  return P.get<TemplateTemplateParmDecl *>();
3430 }
3431 
3433  auto *TD = dyn_cast<TemplateDecl>(D);
3434  return TD && (isa<ClassTemplateDecl>(TD) ||
3435  isa<ClassTemplatePartialSpecializationDecl>(TD) ||
3436  isa<TypeAliasTemplateDecl>(TD) ||
3437  isa<TemplateTemplateParmDecl>(TD))
3438  ? TD
3439  : nullptr;
3440 }
3441 
3442 /// Check whether the template parameter is a pack expansion, and if so,
3443 /// determine the number of parameters produced by that expansion. For instance:
3444 ///
3445 /// \code
3446 /// template<typename ...Ts> struct A {
3447 /// template<Ts ...NTs, template<Ts> class ...TTs, typename ...Us> struct B;
3448 /// };
3449 /// \endcode
3450 ///
3451 /// In \c A<int,int>::B, \c NTs and \c TTs have expanded pack size 2, and \c Us
3452 /// is not a pack expansion, so returns an empty Optional.
3453 inline std::optional<unsigned> getExpandedPackSize(const NamedDecl *Param) {
3454  if (const auto *TTP = dyn_cast<TemplateTypeParmDecl>(Param)) {
3455  if (TTP->isExpandedParameterPack())
3456  return TTP->getNumExpansionParameters();
3457  }
3458 
3459  if (const auto *NTTP = dyn_cast<NonTypeTemplateParmDecl>(Param)) {
3460  if (NTTP->isExpandedParameterPack())
3461  return NTTP->getNumExpansionTypes();
3462  }
3463 
3464  if (const auto *TTP = dyn_cast<TemplateTemplateParmDecl>(Param)) {
3465  if (TTP->isExpandedParameterPack())
3466  return TTP->getNumExpansionTemplateParameters();
3467  }
3468 
3469  return std::nullopt;
3470 }
3471 
3472 /// Internal helper used by Subst* nodes to retrieve the parameter list
3473 /// for their AssociatedDecl.
3474 TemplateParameterList *getReplacedTemplateParameterList(Decl *D);
3475 
3476 } // namespace clang
3477 
3478 #endif // LLVM_CLANG_AST_DECLTEMPLATE_H
clang::DependentFunctionTemplateSpecializationInfo::Create
static DependentFunctionTemplateSpecializationInfo * Create(ASTContext &Context, const UnresolvedSetImpl &Templates, const TemplateArgumentListInfo &TemplateArgs)
Definition: Decl.cpp:4009
clang::TemplateParameterList::getRequiresClause
Expr * getRequiresClause()
The constraint-expression of the associated requires-clause.
Definition: DeclTemplate.h:174
clang::VarTemplatePartialSpecializationDecl::getTemplateParameters
TemplateParameterList * getTemplateParameters() const
Get the list of template parameters.
Definition: DeclTemplate.h:3009
clang::isTemplateExplicitInstantiationOrSpecialization
bool isTemplateExplicitInstantiationOrSpecialization(TemplateSpecializationKind Kind)
True if this template specialization kind is an explicit specialization, explicit instantiation decla...
Definition: Specifiers.h:207
clang::TemplateDecl::getTemplatedDecl
NamedDecl * getTemplatedDecl() const
Get the underlying, templated declaration.
Definition: DeclTemplate.h:439
clang::allocateDefaultArgStorageChain
void * allocateDefaultArgStorageChain(const ASTContext &C)
Definition: DeclTemplate.cpp:220
clang::ClassTemplateSpecializationDecl::setTemplateKeywordLoc
void setTemplateKeywordLoc(SourceLocation Loc)
Sets the location of the template keyword.
Definition: DeclTemplate.h:2065
clang::BuiltinTemplateDecl::Create
static BuiltinTemplateDecl * Create(const ASTContext &C, DeclContext *DC, DeclarationName Name, BuiltinTemplateKind BTK)
Definition: DeclTemplate.h:1800
clang::ClassTemplateDecl::spec_range
llvm::iterator_range< spec_iterator > spec_range
Definition: DeclTemplate.h:2435
clang::ClassTemplateDecl::isThisDeclarationADefinition
bool isThisDeclarationADefinition() const
Returns whether this template declaration defines the primary class pattern.
Definition: DeclTemplate.h:2324
clang::FunctionTemplateDecl::LoadLazySpecializations
void LoadLazySpecializations() const
Load any lazily-loaded specializations from the external source.
Definition: DeclTemplate.cpp:400
clang::ConceptDecl::getConstraintExpr
Expr * getConstraintExpr() const
Definition: DeclTemplate.h:3290
clang::ClassTemplatePartialSpecializationDecl::getMostRecentDecl
ClassTemplatePartialSpecializationDecl * getMostRecentDecl()
Definition: DeclTemplate.h:2148
clang::FunctionTemplateDecl::mergePrevDecl
void mergePrevDecl(FunctionTemplateDecl *Prev)
Merge Prev with our RedeclarableTemplateDecl::Common.
Definition: DeclTemplate.cpp:422
clang::Decl::getASTContext
ASTContext & getASTContext() const LLVM_READONLY
Definition: DeclBase.cpp:428
clang::RedeclarableTemplateDecl::setInstantiatedFromMemberTemplate
void setInstantiatedFromMemberTemplate(RedeclarableTemplateDecl *TD)
Definition: DeclTemplate.h:959
clang::TemplateParameterList::print
void print(raw_ostream &Out, const ASTContext &Context, bool OmitTemplateKW=false) const
Definition: DeclPrinter.cpp:138
clang::TemplateParameterList::Create
static TemplateParameterList * Create(const ASTContext &C, SourceLocation TemplateLoc, SourceLocation LAngleLoc, ArrayRef< NamedDecl * > Params, SourceLocation RAngleLoc, Expr *RequiresClause)
Definition: DeclTemplate.cpp:119
clang::DefaultArgStorage::get
ArgType get() const
Get the default argument's value.
Definition: DeclTemplate.h:348
clang::FriendTemplateDecl::classofKind
static bool classofKind(Kind K)
Definition: DeclTemplate.h:2534
llvm
YAML serialization mapping.
Definition: Dominators.h:30
clang::TemplateArgumentList::TrailingObjects
friend TrailingObjects
Definition: DeclTemplate.h:251
clang::VarTemplateDecl::findSpecialization
VarTemplateSpecializationDecl * findSpecialization(ArrayRef< TemplateArgument > Args, void *&InsertPos)
Return the specialization with the provided arguments if it exists, otherwise return the insertion po...
Definition: DeclTemplate.cpp:1269
clang::VarDecl::getSourceRange
SourceRange getSourceRange() const override LLVM_READONLY
Source range that this declaration covers.
Definition: Decl.cpp:2126
clang::VarTemplateDecl::getMostRecentDecl
const VarTemplateDecl * getMostRecentDecl() const
Definition: DeclTemplate.h:3217
clang::FriendTemplateDecl::getFriendLoc
SourceLocation getFriendLoc() const
Retrieves the location of the 'friend' keyword.
Definition: DeclTemplate.h:2519
clang::ClassTemplateDecl::Common::PartialSpecializations
llvm::FoldingSetVector< ClassTemplatePartialSpecializationDecl > PartialSpecializations
The class template partial specializations for this class template.
Definition: DeclTemplate.h:2282
clang::RedeclarableTemplateDecl::CommonBase
Definition: DeclTemplate.h:831
clang::FriendTemplateDecl
Declaration of a friend template.
Definition: DeclTemplate.h:2467
Specifiers.h
clang::RedeclarableTemplateDecl::newCommon
virtual CommonBase * newCommon(ASTContext &C) const =0
clang::TemplateArgumentList::TemplateArgumentList
TemplateArgumentList(OnStackType, ArrayRef< TemplateArgument > Args)
Construct a new, temporary template argument list on the stack.
Definition: DeclTemplate.h:269
clang::NonTypeTemplateParmDecl::getDefaultArgStorage
const DefArgStorage & getDefaultArgStorage() const
Definition: DeclTemplate.h:1482
clang::TemplateParmPosition::TemplateParmPosition
TemplateParmPosition()=delete
clang::TypeSourceInfo::getType
QualType getType() const
Return the type wrapped by this type source info.
Definition: Type.h:6615
clang::TemplateTemplateParmDecl::hasDefaultArgument
bool hasDefaultArgument() const
Determine whether this template parameter has a default argument.
Definition: DeclTemplate.h:1742
clang::DependentFunctionTemplateSpecializationInfo
Provides information about a dependent function-template specialization declaration.
Definition: DeclTemplate.h:693
clang::VarTemplateDecl::Common::Specializations
llvm::FoldingSetVector< VarTemplateSpecializationDecl > Specializations
The variable template specializations for this variable template, including explicit specializations ...
Definition: DeclTemplate.h:3126
clang::TemplateTypeParmDecl::defaultArgumentWasInherited
bool defaultArgumentWasInherited() const
Determines whether the default argument was inherited from a previous declaration of this template.
Definition: DeclTemplate.h:1289
clang::DependentFunctionTemplateSpecializationInfo::TrailingObjects
friend TrailingObjects
Definition: DeclTemplate.h:718
clang::TemplateTypeParmDecl::getIndex
unsigned getIndex() const
Retrieve the index of the template parameter.
Definition: DeclTemplate.cpp:693
clang::VarTemplatePartialSpecializationDecl::CreateDeserialized
static VarTemplatePartialSpecializationDecl * CreateDeserialized(ASTContext &C, unsigned ID)
Definition: DeclTemplate.cpp:1445
clang::MemberSpecializationInfo
Provides information a specialization of a member of a class template, which may be a member function...
Definition: DeclTemplate.h:629
clang::ClassTemplatePartialSpecializationDecl::Create
static ClassTemplatePartialSpecializationDecl * Create(ASTContext &Context, TagKind TK, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, TemplateParameterList *Params, ClassTemplateDecl *SpecializedTemplate, ArrayRef< TemplateArgument > Args, const TemplateArgumentListInfo &ArgInfos, QualType CanonInjectedType, ClassTemplatePartialSpecializationDecl *PrevDecl)
Definition: DeclTemplate.cpp:1118
clang::UnresolvedSetImpl
A set of unresolved declarations.
Definition: UnresolvedSet.h:61
clang::TypeAliasTemplateDecl::getInstantiatedFromMemberTemplate
TypeAliasTemplateDecl * getInstantiatedFromMemberTemplate() const
Definition: DeclTemplate.h:2590
clang::TypeAliasTemplateDecl::CreateDeserialized
static TypeAliasTemplateDecl * CreateDeserialized(ASTContext &C, unsigned ID)
Create an empty alias template node.
Definition: DeclTemplate.cpp:1188
clang::AutoType::isConstrained
bool isConstrained() const
Definition: Type.h:5270
clang::SourceRange
A trivial tuple used to represent a source range.
Definition: SourceLocation.h:210
clang::DeclContext
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
Definition: DeclBase.h:1389
clang::NonTypeTemplateParmDecl::hasPlaceholderTypeConstraint
bool hasPlaceholderTypeConstraint() const
Determine whether this non-type template parameter's type has a placeholder with a type-constraint.
Definition: DeclTemplate.h:1596
clang::VarTemplateSpecializationDecl::getInstantiatedFrom
llvm::PointerUnion< VarTemplateDecl *, VarTemplatePartialSpecializationDecl * > getInstantiatedFrom() const
If this variable template specialization is an instantiation of a template (rather than an explicit s...
Definition: DeclTemplate.h:2832
clang::TemplateTypeParmDecl::getDefaultArgument
QualType getDefaultArgument() const
Retrieve the default argument, if any.
Definition: DeclTemplate.h:1275
clang::TemplateParmPosition::getDepth
unsigned getDepth() const
Get the nesting depth of the template parameter.
Definition: DeclTemplate.h:1179
clang::Redeclarable
Provides common interface for the Decls that can be redeclared.
Definition: Redeclarable.h:84
clang::ClassTemplateSpecializationDecl::setTypeAsWritten
void setTypeAsWritten(TypeSourceInfo *T)
Sets the type of this specialization as it was written by the user.
Definition: DeclTemplate.h:2040
clang::ClassTemplateDecl::spec_begin
spec_iterator spec_begin() const
Definition: DeclTemplate.h:2441
clang::ClassTemplatePartialSpecializationDecl::getTemplateParameters
TemplateParameterList * getTemplateParameters() const
Get the list of template parameters.
Definition: DeclTemplate.h:2155
clang::Decl::Decl
Decl()=delete
clang::ClassTemplateSpecializationDecl::getMostRecentDecl
ClassTemplateSpecializationDecl * getMostRecentDecl()
Definition: DeclTemplate.h:1904
clang::FunctionTemplateSpecializationInfo::TemplateArguments
const TemplateArgumentList * TemplateArguments
The template arguments used to produce the function template specialization from the function templat...
Definition: DeclTemplate.h:494
clang::TypeAliasTemplateDecl::classofKind
static bool classofKind(Kind K)
Definition: DeclTemplate.h:2607
clang::VarTemplateSpecializationDecl::getSourceRange
SourceRange getSourceRange() const override LLVM_READONLY
Source range that this declaration covers.
Definition: DeclTemplate.h:2929
clang::RedeclarableTemplateDecl::makeSpecIterator
static SpecIterator< EntryType > makeSpecIterator(llvm::FoldingSetVector< EntryType > &Specs, bool isEnd)
Definition: DeclTemplate.h:816
clang::VarTemplateDecl::getPreviousDecl
VarTemplateDecl * getPreviousDecl()
Retrieve the previous declaration of this variable template, or nullptr if no such declaration exists...
Definition: DeclTemplate.h:3203
clang::FunctionTemplateDecl::isThisDeclarationADefinition
bool isThisDeclarationADefinition() const
Returns whether this template declaration defines the primary pattern.
Definition: DeclTemplate.h:1057
clang::Redeclarable< RedeclarableTemplateDecl >::redecls_begin
redecl_iterator redecls_begin() const
Definition: Redeclarable.h:302
clang::TemplateDecl::hasAssociatedConstraints
bool hasAssociatedConstraints() const
Definition: DeclTemplate.cpp:245
clang::VarTemplateSpecializationDecl::getMostRecentDecl
VarTemplateSpecializationDecl * getMostRecentDecl()
Definition: DeclTemplate.h:2768
clang::TemplateTypeParmDecl::CreateDeserialized
static TemplateTypeParmDecl * CreateDeserialized(const ASTContext &C, unsigned ID)
Definition: DeclTemplate.cpp:656
clang::SourceLocation
Encodes a location in the source.
Definition: SourceLocation.h:86
clang::TemplateParmPosition::TemplateParmPosition
TemplateParmPosition(unsigned D, unsigned P)
Definition: DeclTemplate.h:1166
clang::NonTypeTemplateParmDecl::classof
static bool classof(const Decl *D)
Definition: DeclTemplate.h:1613
clang::VarTemplateSpecializationDecl::getTemplateInstantiationArgs
const TemplateArgumentList & getTemplateInstantiationArgs() const
Retrieve the set of template arguments that should be used to instantiate the initializer of the vari...
Definition: DeclTemplate.h:2862
clang::TemplateParameterList::numTrailingObjects
size_t numTrailingObjects(OverloadToken< NamedDecl * >) const
Definition: DeclTemplate.h:100
clang::FunctionTemplateDecl::findSpecialization
FunctionDecl * findSpecialization(ArrayRef< TemplateArgument > Args, void *&InsertPos)
Return the specialization with the provided arguments if it exists, otherwise return the insertion po...
Definition: DeclTemplate.cpp:411
clang::TemplateParameterList::getParam
const NamedDecl * getParam(unsigned Idx) const
Definition: DeclTemplate.h:142
clang::NamedDecl
This represents a decl that may have a name.
Definition: Decl.h:247
clang::SourceRange::getBegin
SourceLocation getBegin() const
Definition: SourceLocation.h:219
clang::ClassTemplateSpecializationDecl::getPointOfInstantiation
SourceLocation getPointOfInstantiation() const
Get the point of instantiation (if any), or null if none.
Definition: DeclTemplate.h:1963
clang::ClassTemplateSpecializationDecl::getSpecializedTemplate
ClassTemplateDecl * getSpecializedTemplate() const
Retrieve the template that this specialization specializes.
Definition: DeclTemplate.cpp:984
clang::VarTemplateDecl::AddPartialSpecialization
void AddPartialSpecialization(VarTemplatePartialSpecializationDecl *D, void *InsertPos)
Insert the specified partial specialization knowing that it is not already in.
Definition: DeclTemplate.cpp:1296
clang::RedeclarableTemplateDecl::SpecEntryTraits< FunctionTemplateSpecializationInfo >::getDecl
static DeclType * getDecl(FunctionTemplateSpecializationInfo *I)
Definition: DeclTemplate.h:994
clang::VarTemplateDecl::spec_end
spec_iterator spec_end() const
Definition: DeclTemplate.h:3265
clang::ClassTemplateSpecializationDecl::getExternLoc
SourceLocation getExternLoc() const
Gets the location of the extern keyword, if present.
Definition: DeclTemplate.h:2053
clang::TemplateTypeParmDecl::setDefaultArgument
void setDefaultArgument(TypeSourceInfo *DefArg)
Set the default argument for this template parameter.
Definition: DeclTemplate.h:1294
clang::ClassTemplateSpecializationDecl::Create
static ClassTemplateSpecializationDecl * Create(ASTContext &Context, TagKind TK, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, ClassTemplateDecl *SpecializedTemplate, ArrayRef< TemplateArgument > Args, ClassTemplateSpecializationDecl *PrevDecl)
Definition: DeclTemplate.cpp:931
clang::TemplateArgumentList::TemplateArgumentList
TemplateArgumentList(const TemplateArgumentList *Other)
Produces a shallow copy of the given template argument list.
Definition: DeclTemplate.h:277
clang::TSK_Undeclared
@ TSK_Undeclared
This template specialization was formed from a template-id but has not yet been declared,...
Definition: Specifiers.h:179
clang::TemplateParameterList::getRequiresClause
const Expr * getRequiresClause() const
The constraint-expression of the associated requires-clause.
Definition: DeclTemplate.h:179
clang::ClassTemplateDecl::Common::InjectedClassNameType
QualType InjectedClassNameType
The injected-class-name type for this class template.
Definition: DeclTemplate.h:2285
clang::VarTemplateSpecializationDecl::setSpecializationKind
void setSpecializationKind(TemplateSpecializationKind TSK)
Definition: DeclTemplate.h:2811
clang::QualType
A (possibly-)qualified type.
Definition: Type.h:736
clang::TypeDecl::getTypeForDecl
const Type * getTypeForDecl() const
Definition: Decl.h:3270
clang::NonTypeTemplateParmDecl
NonTypeTemplateParmDecl - Declares a non-type template parameter, e.g., "Size" in.
Definition: DeclTemplate.h:1407
clang::TemplateDecl::getAssociatedConstraints
void getAssociatedConstraints(llvm::SmallVectorImpl< const Expr * > &AC) const
Get the total constraint-expression associated with this template, including constraint-expressions d...
Definition: DeclTemplate.cpp:238
clang::DefaultArgStorage::isSet
bool isSet() const
Determine whether there is a default argument for this parameter.
Definition: DeclTemplate.h:340
clang::RedeclarableTemplateDecl::SpecEntryTraits
Definition: DeclTemplate.h:781
clang::ClassTemplateDecl::spec_end
spec_iterator spec_end() const
Definition: DeclTemplate.h:2445
clang::Redeclarable< RedeclarableTemplateDecl >::redecls_end
redecl_iterator redecls_end() const
Definition: Redeclarable.h:303
AttributeLangSupport::C
@ C
Definition: SemaDeclAttr.cpp:56
clang::ClassScopeFunctionSpecializationDecl::hasExplicitTemplateArgs
bool hasExplicitTemplateArgs() const
Definition: DeclTemplate.h:2647
clang::TemplateTemplateParmDecl::getDefaultArgStorage
const DefArgStorage & getDefaultArgStorage() const
Definition: DeclTemplate.h:1738
clang::ClassTemplateDecl::getInstantiatedFromMemberTemplate
ClassTemplateDecl * getInstantiatedFromMemberTemplate() const
Definition: DeclTemplate.h:2376
clang::ClassScopeFunctionSpecializationDecl
Declaration of a function specialization at template class scope.
Definition: DeclTemplate.h:2627
clang::NonTypeTemplateParmDecl::isPackExpansion
bool isPackExpansion() const
Whether this parameter pack is a pack expansion.
Definition: DeclTemplate.h:1528
clang::TemplateTemplateParmDecl::setDefaultArgument
void setDefaultArgument(const ASTContext &C, const TemplateArgumentLoc &DefArg)
Set the default argument for this template parameter, and whether that default argument was inherited...
Definition: DeclTemplate.cpp:865
clang::QualType::getCanonicalType
QualType getCanonicalType() const
Definition: Type.h:6685
clang::TemplateParameterList::end
const_iterator end() const
Definition: DeclTemplate.h:129
clang::ClassTemplateSpecializationDecl::getSpecializationKind
TemplateSpecializationKind getSpecializationKind() const
Determine the kind of specialization that this declaration represents.
Definition: DeclTemplate.h:1924
clang::Decl::redecl_range
llvm::iterator_range< redecl_iterator > redecl_range
Definition: DeclBase.h:1010
clang::VarTemplateDecl::getInstantiatedFromMemberTemplate
VarTemplateDecl * getInstantiatedFromMemberTemplate() const
Definition: DeclTemplate.h:3221
clang::ast_matchers::type
const internal::VariadicAllOfMatcher< Type > type
Matches Types in the clang AST.
Definition: ASTMatchersInternal.cpp:774
clang::VarTemplateDecl::getCommonPtr
Common * getCommonPtr() const
Definition: DeclTemplate.h:3152
clang::Redeclarable< RedeclarableTemplateDecl >::getFirstDecl
RedeclarableTemplateDecl * getFirstDecl()
Return the first declaration of this declaration or itself if this is the only declaration.
Definition: Redeclarable.h:216
DeclCXX.h
clang::TemplateParameterList::getLAngleLoc
SourceLocation getLAngleLoc() const
Definition: DeclTemplate.h:194
int
__device__ int
Definition: __clang_hip_libdevice_declares.h:63
clang::DependentFunctionTemplateSpecializationInfo::getTemplateArg
const TemplateArgumentLoc & getTemplateArg(unsigned I) const
Returns the nth template argument.
Definition: DeclTemplate.h:747
clang::VarTemplateDecl::getTemplatedDecl
VarDecl * getTemplatedDecl() const
Get the underlying variable declarations of the template.
Definition: DeclTemplate.h:3164
clang::DependentFunctionTemplateSpecializationInfo::getNumTemplateArgs
unsigned getNumTemplateArgs() const
Returns the number of explicit template arguments that were given.
Definition: DeclTemplate.h:740
clang::ClassTemplateSpecializationDecl::setInstantiationOf
void setInstantiationOf(ClassTemplatePartialSpecializationDecl *PartialSpec, const TemplateArgumentList *TemplateArgs)
Note that this class template specialization is actually an instantiation of the given class template...
Definition: DeclTemplate.h:2020
clang::TemplateSubstitutionKind::Specialization
@ Specialization
We are substituting template parameters for template arguments in order to form a template specializa...
clang::RedeclarableTemplateDecl::SpecIterator::operator*
DeclType * operator*() const
Definition: DeclTemplate.h:807
clang::NonTypeTemplateParmDecl::getSourceRange
SourceRange getSourceRange() const override LLVM_READONLY
Source range that this declaration covers.
Definition: DeclTemplate.cpp:792
clang::FixedSizeTemplateParameterListStorage::FixedSizeTemplateParameterListStorage
FixedSizeTemplateParameterListStorage(const ASTContext &C, SourceLocation TemplateLoc, SourceLocation LAngleLoc, ArrayRef< NamedDecl * > Params, SourceLocation RAngleLoc, Expr *RequiresClause)
Definition: DeclTemplate.h:223
clang::NonTypeTemplateParmDecl::getExpansionType
QualType getExpansionType(unsigned I) const
Retrieve a particular expansion type within an expanded parameter pack.
Definition: DeclTemplate.h:1567
clang::ImplicitConceptSpecializationDecl::getTemplateArguments
ArrayRef< TemplateArgument > getTemplateArguments() const
Definition: DeclTemplate.h:3340
clang::TemplateParmPosition::PositionWidth
@ PositionWidth
Definition: DeclTemplate.h:1159
clang::TemplateParameterList::asArray
ArrayRef< const NamedDecl * > asArray() const
Definition: DeclTemplate.h:134
clang::VarTemplateSpecializationDecl::getNameForDiagnostic
void getNameForDiagnostic(raw_ostream &OS, const PrintingPolicy &Policy, bool Qualified) const override
Appends a human-readable name for this declaration into the given stream.
Definition: DeclTemplate.cpp:1368
clang::TemplateTypeParmDecl::Create
static TemplateTypeParmDecl * Create(const ASTContext &C, DeclContext *DC, SourceLocation KeyLoc, SourceLocation NameLoc, unsigned D, unsigned P, IdentifierInfo *Id, bool Typename, bool ParameterPack, bool HasTypeConstraint=false, std::optional< unsigned > NumExpanded=std::nullopt)
Definition: DeclTemplate.cpp:640
clang::VarTemplatePartialSpecializationDecl::getAssociatedConstraints
void getAssociatedConstraints(llvm::SmallVectorImpl< const Expr * > &AC) const
All associated constraints of this partial specialization, including the requires clause and any cons...
Definition: DeclTemplate.h:3024
clang::BuiltinTemplateDecl::getSourceRange
SourceRange getSourceRange() const override LLVM_READONLY
Source range that this declaration covers.
Definition: DeclTemplate.h:1806
clang::RedeclarableTemplateDecl::setMemberSpecialization
void setMemberSpecialization()
Note that this member template is a specialization.
Definition: DeclTemplate.h:913
clang::ClassTemplatePartialSpecializationDecl::getInstantiatedFromMemberTemplate
ClassTemplatePartialSpecializationDecl * getInstantiatedFromMemberTemplate() const
Definition: DeclTemplate.h:2204
clang::NonTypeTemplateParmDecl::hasDefaultArgument
bool hasDefaultArgument() const
Determine whether this template parameter has a default argument.
Definition: DeclTemplate.h:1486
clang::VarTemplateSpecializationDecl::getTemplateArgs
const TemplateArgumentList & getTemplateArgs() const
Retrieve the template arguments of the variable template specialization.
Definition: DeclTemplate.h:2778
clang::FunctionTemplateSpecializationInfo::setTemplateSpecializationKind
void setTemplateSpecializationKind(TemplateSpecializationKind TSK)
Set the template specialization kind.
Definition: DeclTemplate.h:556
clang::VarTemplateDecl::findPartialSpecInstantiatedFromMember
VarTemplatePartialSpecializationDecl * findPartialSpecInstantiatedFromMember(VarTemplatePartialSpecializationDecl *D)
Find a variable template partial specialization which was instantiated from the given member partial ...
Definition: DeclTemplate.cpp:1322
clang::DefaultArgStorage::clear
void clear()
Remove the default argument, even if it was inherited.
Definition: DeclTemplate.h:393
clang::ClassTemplateSpecializationDecl::getSourceRange
SourceRange getSourceRange() const override LLVM_READONLY
Source range that this declaration covers.
Definition: DeclTemplate.cpp:992
clang::DeclaratorDecl::getOuterLocStart
SourceLocation getOuterLocStart() const
Return start of source range taking into account any outer template declarations.
Definition: Decl.cpp:1986
clang::ClassTemplatePartialSpecializationDecl
Definition: DeclTemplate.h:2098
clang::ClassTemplateSpecializationDecl::setTemplateArgs
void setTemplateArgs(TemplateArgumentList *Args)
Definition: DeclTemplate.h:1918
clang::PrintingPolicy
Describes how types, statements, expressions, and declarations should be printed.
Definition: PrettyPrinter.h:57
clang::TemplateParmPosition::getPosition
unsigned getPosition() const
Get the position of the template parameter within its parameter list.
Definition: DeclTemplate.h:1187
clang::DependentFunctionTemplateSpecializationInfo::arguments
llvm::ArrayRef< TemplateArgumentLoc > arguments() const
Definition: DeclTemplate.h:742
clang::RedeclarableTemplateDecl
Declaration of a redeclarable template.
Definition: DeclTemplate.h:762
clang::FunctionTemplateDecl::Create
static FunctionTemplateDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation L, DeclarationName Name, TemplateParameterList *Params, NamedDecl *Decl)
Create a function template node.
Definition: DeclTemplate.cpp:377
clang::TemplateDecl::classof
static bool classof(const Decl *D)
Definition: DeclTemplate.h:445
clang::VarTemplateSpecializationDecl
Represents a variable template specialization, which refers to a variable template with a given set o...
Definition: DeclTemplate.h:2687
clang::VarTemplateSpecializationDecl::setPointOfInstantiation
void setPointOfInstantiation(SourceLocation Loc)
Definition: DeclTemplate.h:2820
clang::VarTemplateSpecializationDecl::setTemplateKeywordLoc
void setTemplateKeywordLoc(SourceLocation Loc)
Sets the location of the template keyword.
Definition: DeclTemplate.h:2918
clang::DependentFunctionTemplateSpecializationInfo::getTemplateArgs
const TemplateArgumentLoc * getTemplateArgs() const
Returns the explicit template arguments that were given.
Definition: DeclTemplate.h:735
clang::detail::Qualified
std::conditional_t< Const, const T, T > Qualified
Definition: HeaderSearch.h:158
clang::TemplateParmPosition::setDepth
void setDepth(unsigned D)
Definition: DeclTemplate.h:1180
clang::DefaultArgStorage::DefaultArgStorage
DefaultArgStorage()
Definition: DeclTemplate.h:337
clang::TemplateTypeParmDecl::classofKind
static bool classofKind(Kind K)
Definition: DeclTemplate.h:1399
clang::DeclarationName
The name of a declaration.
Definition: DeclarationName.h:144
End
SourceLocation End
Definition: USRLocFinder.cpp:167
clang::TemplateDecl::TemplatedDecl
NamedDecl * TemplatedDecl
Definition: DeclTemplate.h:457
clang::ClassTemplateDecl::Common
Data that is common to all of the declarations of a given class template.
Definition: DeclTemplate.h:2274
clang::TemplateTypeParmDecl::hasTypeConstraint
bool hasTypeConstraint() const
Determine whether this template parameter has a type-constraint.
Definition: DeclTemplate.h:1381
clang::VarTemplateDecl::getCanonicalDecl
const VarTemplateDecl * getCanonicalDecl() const
Definition: DeclTemplate.h:3197
clang::ClassTemplateDecl::CreateDeserialized
static ClassTemplateDecl * CreateDeserialized(ASTContext &C, unsigned ID)
Create an empty class template node.
Definition: DeclTemplate.cpp:472
clang::VarTemplateSpecializationDecl::isExplicitInstantiationOrSpecialization
bool isExplicitInstantiationOrSpecialization() const
True if this declaration is an explicit specialization, explicit instantiation declaration,...
Definition: DeclTemplate.h:2806
clang::TemplateParamObjectDecl::printAsInit
void printAsInit(llvm::raw_ostream &OS) const
Print this object as an initializer suitable for a variable of the object's type.
Definition: DeclTemplate.cpp:1588
clang::TemplateDecl::classofKind
static bool classofKind(Kind K)
Definition: DeclTemplate.h:447
clang::VarTemplateDecl::spec_range
llvm::iterator_range< spec_iterator > spec_range
Definition: DeclTemplate.h:3255
clang::TemplateTemplateParmDecl::classof
static bool classof(const Decl *D)
Definition: DeclTemplate.h:1780
clang::DeclaratorContext::TemplateArg
@ TemplateArg
clang::TemplateTypeParmDecl::getDefaultArgumentInfo
TypeSourceInfo * getDefaultArgumentInfo() const
Retrieves the default argument's source information, if any.
Definition: DeclTemplate.h:1280
clang::TemplateTypeParmDecl::setTypeConstraint
void setTypeConstraint(NestedNameSpecifierLoc NNS, DeclarationNameInfo NameInfo, NamedDecl *FoundDecl, ConceptDecl *CD, const ASTTemplateArgumentListInfo *ArgsAsWritten, Expr *ImmediatelyDeclaredConstraint)
Definition: DeclTemplate.cpp:701
clang::TemplateArgumentList::data
const TemplateArgument * data() const
Retrieve a pointer to the template argument list.
Definition: DeclTemplate.h:299
clang::VarTemplatePartialSpecializationDecl::getInstantiatedFromMember
VarTemplatePartialSpecializationDecl * getInstantiatedFromMember() const
Retrieve the member variable template partial specialization from which this particular variable temp...
Definition: DeclTemplate.h:3052
clang::VarTemplateDecl::Common::Common
Common()=default
clang::FunctionTemplateSpecializationInfo::getTemplate
FunctionTemplateDecl * getTemplate() const
Retrieve the template from which this function was specialized.
Definition: DeclTemplate.h:536
clang::ConceptDecl::getCanonicalDecl
ConceptDecl * getCanonicalDecl() override
Retrieves the "canonical" declaration of the given declaration.
Definition: DeclTemplate.h:3303
clang::TemplateTypeParmDecl::hasDefaultArgument
bool hasDefaultArgument() const
Determine whether this template parameter has a default argument.
Definition: DeclTemplate.h:1272
Decl.h
clang::VarTemplateSpecializationDecl::setTemplateArgsInfo
void setTemplateArgsInfo(const TemplateArgumentListInfo &ArgsInfo)
Definition: DeclTemplate.cpp:1393
clang::Redeclarable< RedeclarableTemplateDecl >::redecl_range
llvm::iterator_range< redecl_iterator > redecl_range
Definition: Redeclarable.h:292
clang::ClassTemplateDecl::classof
static bool classof(const Decl *D)
Definition: DeclTemplate.h:2450
clang::VarTemplatePartialSpecializationDecl::classof
static bool classof(const Decl *D)
Definition: DeclTemplate.h:3111
clang::TemplateParameterList::getAssociatedConstraints
void getAssociatedConstraints(llvm::SmallVectorImpl< const Expr * > &AC) const
All associated constraints derived from this template parameter list, including the requires clause a...
Definition: DeclTemplate.cpp:186
clang::FriendTemplateDecl::Create
static FriendTemplateDecl * Create(ASTContext &Context, DeclContext *DC, SourceLocation Loc, MutableArrayRef< TemplateParameterList * > Params, FriendUnion Friend, SourceLocation FriendLoc)
Definition: DeclTemplate.cpp:1155
clang::TemplateParameterList::TrailingObjects
friend TrailingObjects
Definition: DeclTemplate.h:111
clang::TemplateArgumentList::operator=
TemplateArgumentList & operator=(const TemplateArgumentList &)=delete
clang::ClassTemplateDecl::getPartialSpecializations
llvm::FoldingSetVector< ClassTemplatePartialSpecializationDecl > & getPartialSpecializations() const
Retrieve the set of partial specializations of this class template.
Definition: DeclTemplate.cpp:489
clang::TemplateArgumentList::get
const TemplateArgument & get(unsigned Idx) const
Retrieve the template argument at a given index.
Definition: DeclTemplate.h:281
clang::NonTypeTemplateParmDecl::classofKind
static bool classofKind(Kind K)
Definition: DeclTemplate.h:1614
clang::TypeAliasTemplateDecl::getTemplatedDecl
TypeAliasDecl * getTemplatedDecl() const
Get the underlying function declaration of the template.
Definition: DeclTemplate.h:2564
clang::TemplateTypeParmDecl::getSourceRange
SourceRange getSourceRange() const override LLVM_READONLY
Source range that this declaration covers.
Definition: DeclTemplate.cpp:677
U
clang::RedeclarableTemplateDecl::classofKind
static bool classofKind(Kind K)
Definition: DeclTemplate.h:985
clang::FunctionTemplateDecl::getMostRecentDecl
const FunctionTemplateDecl * getMostRecentDecl() const
Definition: DeclTemplate.h:1091
clang::Decl::getLexicalDeclContext
DeclContext * getLexicalDeclContext()
getLexicalDeclContext - The declaration context where this Decl was lexically declared (LexicalDC).
Definition: DeclBase.h:883
clang::TypeAliasTemplateDecl::getCanonicalDecl
TypeAliasTemplateDecl * getCanonicalDecl() override
Retrieves the canonical declaration of this template.
Definition: DeclTemplate.h:2569
clang::FunctionTemplateDecl
Declaration of a template function.
Definition: DeclTemplate.h:1005
llvm::MutableArrayRef
Definition: LLVM.h:35
clang::TemplateTypeParmDecl::isExpandedParameterPack
bool isExpandedParameterPack() const
Whether this parameter is a template type parameter pack that has a known list of different type-cons...
Definition: DeclTemplate.h:1359
clang::ClassTemplateDecl::classofKind
static bool classofKind(Kind K)
Definition: DeclTemplate.h:2451
clang::ImplicitConceptSpecializationDecl::classof
static bool classof(const Decl *D)
Definition: DeclTemplate.h:3347
clang::FunctionTemplateSpecializationInfo::getPointOfInstantiation
SourceLocation getPointOfInstantiation() const
Retrieve the first point of instantiation of this function template specialization.
Definition: DeclTemplate.h:567
TemplateBase.h
clang::ClassTemplatePartialSpecializationDecl::getInstantiatedFromMember
ClassTemplatePartialSpecializationDecl * getInstantiatedFromMember() const
Retrieve the member class template partial specialization from which this particular class template p...
Definition: DeclTemplate.h:2198
V
#define V(N, I)
Definition: ASTContext.h:3211
clang::TemplateDecl::TemplateDecl
TemplateDecl(Kind DK, DeclContext *DC, SourceLocation L, DeclarationName Name, TemplateParameterList *Params, NamedDecl *Decl)
Definition: DeclTemplate.cpp:230
clang::VarTemplateSpecializationDecl::getTemplateKeywordLoc
SourceLocation getTemplateKeywordLoc() const
Gets the location of the template keyword, if present.
Definition: DeclTemplate.h:2925
clang::NonTypeTemplateParmDecl::defaultArgumentWasInherited
bool defaultArgumentWasInherited() const
Determines whether the default argument was inherited from a previous declaration of this template.
Definition: DeclTemplate.h:1496
clang::Decl::Kind
Kind
Lists the kind of concrete classes of Decl.
Definition: DeclBase.h:86
clang::VarTemplateDecl::VarTemplateDecl
VarTemplateDecl(ASTContext &C, DeclContext *DC, SourceLocation L, DeclarationName Name, TemplateParameterList *Params, NamedDecl *Decl)
Definition: DeclTemplate.h:3145
clang::TemplateArgumentList::CreateCopy
static TemplateArgumentList * CreateCopy(ASTContext &Context, ArrayRef< TemplateArgument > Args)
Create a new template argument list that copies the given set of template arguments.
Definition: DeclTemplate.cpp:884
clang::VarTemplateDecl::Create
static VarTemplateDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation L, DeclarationName Name, TemplateParameterList *Params, VarDecl *Decl)
Create a variable template node.
Definition: DeclTemplate.cpp:1228
clang::VarTemplatePartialSpecializationDecl::isMemberSpecialization
bool isMemberSpecialization()
Determines whether this variable template partial specialization was a specialization of a member par...
Definition: DeclTemplate.h:3080
clang::ClassTemplateSpecializationDecl::getTemplateArgs
const TemplateArgumentList & getTemplateArgs() const
Retrieve the template arguments of the class template specialization.
Definition: DeclTemplate.h:1914
clang::TemplateParameterList::getParam
NamedDecl * getParam(unsigned Idx)
Definition: DeclTemplate.h:138
clang::TemplateParmPosition::getIndex
unsigned getIndex() const
Get the index of the template parameter within its parameter list.
Definition: DeclTemplate.h:1195
clang::PackExpansionType
Represents a pack expansion of types.
Definition: Type.h:5842
clang::FunctionTemplateSpecializationInfo::Profile
void Profile(llvm::FoldingSetNodeID &ID)
Definition: DeclTemplate.h:613
clang::TypeAliasTemplateDecl::classof
static bool classof(const Decl *D)
Definition: DeclTemplate.h:2606
clang::RedeclarableTemplateDecl::SpecEntryTraits< FunctionTemplateSpecializationInfo >::getTemplateArgs
static ArrayRef< TemplateArgument > getTemplateArgs(FunctionTemplateSpecializationInfo *I)
Definition: DeclTemplate.h:999
clang::ClassTemplateDecl::ClassTemplateDecl
ClassTemplateDecl(ASTContext &C, DeclContext *DC, SourceLocation L, DeclarationName Name, TemplateParameterList *Params, NamedDecl *Decl)
Definition: DeclTemplate.h:2299
clang::TemplateArgumentListInfo
A convenient class for passing around template argument information.
Definition: TemplateBase.h:590
clang::TagTypeKind
TagTypeKind
The kind of a tag type.
Definition: Type.h:5545
clang::FunctionTemplateDecl::classof
static bool classof(const Decl *D)
Definition: DeclTemplate.h:1140
clang::ClassTemplateDecl::newCommon
CommonBase * newCommon(ASTContext &C) const override
Definition: DeclTemplate.cpp:495
clang::RedeclarableTemplateDecl::SpecIterator::operator->
DeclType * operator->() const
Definition: DeclTemplate.h:811
clang::VarTemplateDecl::getPreviousDecl
const VarTemplateDecl * getPreviousDecl() const
Definition: DeclTemplate.h:3207
clang::Decl::getKind
Kind getKind() const
Definition: DeclBase.h:435
clang::TypeAliasTemplateDecl::getPreviousDecl
TypeAliasTemplateDecl * getPreviousDecl()
Retrieve the previous declaration of this function template, or nullptr if no such declaration exists...
Definition: DeclTemplate.h:2580
clang::VarTemplateDecl::specializations
spec_range specializations() const
Definition: DeclTemplate.h:3257
Id
int Id
Definition: ASTDiff.cpp:190
clang::NonTypeTemplateParmDecl::getNumExpansionTypes
unsigned getNumExpansionTypes() const
Retrieves the number of expansion types in an expanded parameter pack.
Definition: DeclTemplate.h:1560
clang::FunctionTemplateDecl::spec_range
llvm::iterator_range< spec_iterator > spec_range
Definition: DeclTemplate.h:1101
clang::VarTemplateDecl::getPartialSpecializations
llvm::FoldingSetVector< VarTemplatePartialSpecializationDecl > & getPartialSpecializations() const
Retrieve the set of partial specializations of this class template.
Definition: DeclTemplate.cpp:1256
DeclBase.h
clang::RedeclarableTemplateDecl::redecl_iterator
redeclarable_base::redecl_iterator redecl_iterator
Definition: DeclTemplate.h:973
clang::ConceptDecl
Declaration of a C++20 concept.
Definition: DeclTemplate.h:3275
clang::ClassTemplateSpecializationDecl::classof
static bool classof(const Decl *D)
Definition: DeclTemplate.h:2090
clang::ClassTemplateDecl::Common::Common
Common()=default
clang::SourceRange::getEnd
SourceLocation getEnd() const
Definition: SourceLocation.h:220
clang::FunctionTemplateSpecializationInfo::TrailingObjects
friend TrailingObjects
Definition: DeclTemplate.h:523
clang::NonTypeTemplateParmDecl::CreateDeserialized
static NonTypeTemplateParmDecl * CreateDeserialized(ASTContext &C, unsigned ID, bool HasTypeConstraint)
Definition: DeclTemplate.cpp:767
clang::TemplateDecl::TemplateParams
TemplateParameterList * TemplateParams
Definition: DeclTemplate.h:458
clang::FunctionTemplateDecl::getCommonPtr
Common * getCommonPtr() const
Definition: DeclTemplate.h:1027
clang::ClassScopeFunctionSpecializationDecl::getTemplateArgsAsWritten
const ASTTemplateArgumentListInfo * getTemplateArgsAsWritten() const
Definition: DeclTemplate.h:2648
clang::RedeclarableTemplateDecl::RedeclarableTemplateDecl
RedeclarableTemplateDecl(Kind DK, ASTContext &C, DeclContext *DC, SourceLocation L, DeclarationName Name, TemplateParameterList *Params, NamedDecl *Decl)
Definition: DeclTemplate.h:871
clang::FunctionTemplateDecl::Common
Data that is common to all of the declarations of a given function template.
Definition: DeclTemplate.h:1011
clang::FunctionDecl::isThisDeclarationADefinition
bool isThisDeclarationADefinition() const
Returns whether this specific declaration of the function is also a definition that does not contain ...
Definition: Decl.h:2218
Redeclarable.h
clang::TemplateTemplateParmDecl::getExpansionTemplateParameters
TemplateParameterList * getExpansionTemplateParameters(unsigned I) const
Retrieve a particular expansion type within an expanded parameter pack.
Definition: DeclTemplate.h:1733
clang::TemplateDecl::TemplateDecl
TemplateDecl(Kind DK, DeclContext *DC, SourceLocation L, DeclarationName Name, TemplateParameterList *Params)
Definition: DeclTemplate.h:417
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::ClassTemplatePartialSpecializationDecl::getInjectedSpecializationType
QualType getInjectedSpecializationType() const
Retrieves the injected specialization type for this partial specialization.
Definition: DeclTemplate.h:2247
clang::TemplateParameterList::TemplateParameterList
TemplateParameterList(const ASTContext &C, SourceLocation TemplateLoc, SourceLocation LAngleLoc, ArrayRef< NamedDecl * > Params, SourceLocation RAngleLoc, Expr *RequiresClause)
Definition: DeclTemplate.cpp:48
clang::FriendTemplateDecl::FriendUnion
llvm::PointerUnion< NamedDecl *, TypeSourceInfo * > FriendUnion
Definition: DeclTemplate.h:2471
clang::VarTemplatePartialSpecializationDecl::getTemplateArgsAsWritten
const ASTTemplateArgumentListInfo * getTemplateArgsAsWritten() const
Get the template arguments as written.
Definition: DeclTemplate.h:3014
clang::ClassScopeFunctionSpecializationDecl::classof
static bool classof(const Decl *D)
Definition: DeclTemplate.h:2667
clang::ClassTemplateSpecializationDecl::CreateDeserialized
static ClassTemplateSpecializationDecl * CreateDeserialized(ASTContext &C, unsigned ID)
Definition: DeclTemplate.cpp:957
clang::ClassTemplateDecl::LoadLazySpecializations
void LoadLazySpecializations() const
Load any lazily-loaded specializations from the external source.
Definition: DeclTemplate.cpp:478
clang::FunctionTemplateDecl::getCanonicalDecl
FunctionTemplateDecl * getCanonicalDecl() override
Retrieves the canonical declaration of this template.
Definition: DeclTemplate.h:1066
clang::ClassTemplateDecl::getPreviousDecl
ClassTemplateDecl * getPreviousDecl()
Retrieve the previous declaration of this class template, or nullptr if no such declaration exists.
Definition: DeclTemplate.h:2358
clang::Type::getAs
const T * getAs() const
Member-template getAs<specific type>'.
Definition: Type.h:7397
clang::VarTemplatePartialSpecializationDecl::setMemberSpecialization
void setMemberSpecialization()
Note that this member template is a specialization.
Definition: DeclTemplate.h:3087
clang::FunctionTemplateDecl::spec_end
spec_iterator spec_end() const
Definition: DeclTemplate.h:1111
clang::VarTemplateDecl::getDefinition
VarTemplateDecl * getDefinition()
Definition: DeclTemplate.cpp:1218
clang::ImplicitConceptSpecializationDecl::setTemplateArguments
void setTemplateArguments(ArrayRef< TemplateArgument > Converted)
Definition: DeclTemplate.cpp:1084
clang::VarTemplateDecl::Common::PartialSpecializations
llvm::FoldingSetVector< VarTemplatePartialSpecializationDecl > PartialSpecializations
The variable template partial specializations for this variable template.
Definition: DeclTemplate.h:3131
clang::TemplateParameterList::hasAssociatedConstraints
bool hasAssociatedConstraints() const
Definition: DeclTemplate.cpp:201
clang::ConceptDecl::getSourceRange
SourceRange getSourceRange() const override LLVM_READONLY
Source range that this declaration covers.
Definition: DeclTemplate.h:3294
clang::VarTemplateDecl::LoadLazySpecializations
void LoadLazySpecializations() const
Load any lazily-loaded specializations from the external source.
Definition: DeclTemplate.cpp:1245
clang::TemplateArgument
Represents a template argument.
Definition: TemplateBase.h:60
clang::FunctionTemplateDecl::specializations
spec_range specializations() const
Definition: DeclTemplate.h:1103
clang::MemberSpecializationInfo::setTemplateSpecializationKind
void setTemplateSpecializationKind(TemplateSpecializationKind TSK)
Set the template specialization kind.
Definition: DeclTemplate.h:660
clang::TagDecl::isThisDeclarationADefinition
bool isThisDeclarationADefinition() const
Return true if this declaration is a completion definition of the type.
Definition: Decl.h:3536
clang::TemplateParamObjectDecl::Profile
void Profile(llvm::FoldingSetNodeID &ID)
Definition: DeclTemplate.h:3409
clang::ConceptDecl::classofKind
static bool classofKind(Kind K)
Definition: DeclTemplate.h:3312
clang::ClassTemplateDecl::getMostRecentDecl
const ClassTemplateDecl * getMostRecentDecl() const
Definition: DeclTemplate.h:2372
clang::FriendTemplateDecl::getTemplateParameterList
TemplateParameterList * getTemplateParameterList(unsigned i) const
Definition: DeclTemplate.h:2523
clang::ClassTemplateDecl::specializations
spec_range specializations() const
Definition: DeclTemplate.h:2437
clang::ClassTemplateDecl::findPartialSpecInstantiatedFromMember
ClassTemplatePartialSpecializationDecl * findPartialSpecInstantiatedFromMember(ClassTemplatePartialSpecializationDecl *D)
Find a class template partial specialization which was instantiated from the given member partial spe...
Definition: DeclTemplate.cpp:602
clang::Stmt::getEndLoc
SourceLocation getEndLoc() const LLVM_READONLY
Definition: Stmt.cpp:349
clang::Mergeable< TemplateParamObjectDecl >::getFirstDecl
TemplateParamObjectDecl * getFirstDecl()
Return the first declaration of this declaration or itself if this is the only declaration.
Definition: Redeclarable.h:320
clang::ClassTemplateSpecializationDecl::setPointOfInstantiation
void setPointOfInstantiation(SourceLocation Loc)
Definition: DeclTemplate.h:1967
clang::NonTypeTemplateParmDecl::setPlaceholderTypeConstraint
void setPlaceholderTypeConstraint(Expr *E)
Definition: DeclTemplate.h:1590
clang::TemplateArgumentLoc::getSourceRange
SourceRange getSourceRange() const LLVM_READONLY
Definition: TemplateBase.cpp:493
clang::TemplateArgumentLoc
Location wrapper for a TemplateArgument.
Definition: TemplateBase.h:484
Type.h
clang::VarTemplateSpecializationDecl::getTemplateArgsInfo
const ASTTemplateArgumentListInfo * getTemplateArgsInfo() const
Definition: DeclTemplate.h:2784
clang::ConceptDecl::Create
static ConceptDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation L, DeclarationName Name, TemplateParameterList *Params, Expr *ConstraintExpr)
Definition: DeclTemplate.cpp:1033
clang::FriendTemplateDecl::getFriendDecl
NamedDecl * getFriendDecl() const
If this friend declaration names a templated function (or a member function of a templated type),...
Definition: DeclTemplate.h:2514
clang::TemplateTemplateParmDecl
TemplateTemplateParmDecl - Declares a template template parameter, e.g., "T" in.
Definition: DeclTemplate.h:1624
clang::RedeclarableTemplateDecl::classof
static bool classof(const Decl *D)
Definition: DeclTemplate.h:983
clang::Redeclarable< RedeclarableTemplateDecl >::redecls
redecl_range redecls() const
Returns an iterator range for all the redeclarations of the same decl.
Definition: Redeclarable.h:296
clang::TemplateParmPosition::MaxPosition
static constexpr unsigned MaxPosition
Definition: DeclTemplate.h:1164
ASTContext.h
clang::getPrimaryMergedDecl
Decl * getPrimaryMergedDecl(Decl *D)
Get the primary declaration for a declaration from an AST file.
Definition: Decl.cpp:77
clang::FunctionTemplateDecl::newCommon
CommonBase * newCommon(ASTContext &C) const override
Definition: DeclTemplate.cpp:394
clang::TemplateTemplateParmDecl::getNumExpansionTemplateParameters
unsigned getNumExpansionTemplateParameters() const
Retrieves the number of expansion template parameters in an expanded parameter pack.
Definition: DeclTemplate.h:1726
clang::VarDecl
Represents a variable declaration or definition.
Definition: Decl.h:915
clang::VarTemplateSpecializationDecl::setInstantiationOf
void setInstantiationOf(VarTemplatePartialSpecializationDecl *PartialSpec, const TemplateArgumentList *TemplateArgs)
Note that this variable template specialization is actually an instantiation of the given variable te...
Definition: DeclTemplate.h:2873
clang::ClassTemplateSpecializationDecl::setInstantiationOf
void setInstantiationOf(ClassTemplateDecl *TemplDecl)
Note that this class template specialization is an instantiation of the given class template.
Definition: DeclTemplate.h:2032
clang::getExpandedPackSize
std::optional< unsigned > getExpandedPackSize(const NamedDecl *Param)
Check whether the template parameter is a pack expansion, and if so, determine the number of paramete...
Definition: DeclTemplate.h:3453
clang::ImplicitConceptSpecializationDecl::classofKind
static bool classofKind(Kind K)
Definition: DeclTemplate.h:3346
clang::NonTypeTemplateParmDecl::Create
static NonTypeTemplateParmDecl * Create(const ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, unsigned D, unsigned P, IdentifierInfo *Id, QualType T, bool ParameterPack, TypeSourceInfo *TInfo)
Definition: DeclTemplate.cpp:737
clang::TemplateParameterList
Stores a list of template parameters for a TemplateDecl and its derived classes.
Definition: DeclTemplate.h:71
clang::NonTypeTemplateParmDecl::setInheritedDefaultArgument
void setInheritedDefaultArgument(const ASTContext &C, NonTypeTemplateParmDecl *Parm)
Definition: DeclTemplate.h:1504
clang::TemplateDecl::setTemplateParameters
void setTemplateParameters(TemplateParameterList *TParams)
Definition: DeclTemplate.h:461
clang::RedeclarableTemplateDecl::getCanonicalDecl
RedeclarableTemplateDecl * getCanonicalDecl() override
Retrieves the canonical declaration of this template.
Definition: DeclTemplate.h:883
clang::TypeDecl
Represents a declaration of a type.
Definition: Decl.h:3246
clang::RedeclarableTemplateDecl::SpecIterator::SpecIterator
SpecIterator()=default
clang::MemberSpecializationInfo::MemberSpecializationInfo
MemberSpecializationInfo(NamedDecl *IF, TemplateSpecializationKind TSK, SourceLocation POI=SourceLocation())
Definition: DeclTemplate.h:639
clang::TemplateArgumentList::operator[]
const TemplateArgument & operator[](unsigned Idx) const
Retrieve the template argument at a given index.
Definition: DeclTemplate.h:287
clang::FunctionTemplateSpecializationInfo::Profile
static void Profile(llvm::FoldingSetNodeID &ID, ArrayRef< TemplateArgument > TemplateArgs, ASTContext &Context)
Definition: DeclTemplate.h:618
clang::TemplateTemplateParmDecl::Create
static TemplateTemplateParmDecl * Create(const ASTContext &C, DeclContext *DC, SourceLocation L, unsigned D, unsigned P, bool ParameterPack, IdentifierInfo *Id, TemplateParameterList *Params)
Definition: DeclTemplate.cpp:824
clang::DependentFunctionTemplateSpecializationInfo::getNumTemplates
unsigned getNumTemplates() const
Returns the number of function templates that this might be a specialization of.
Definition: DeclTemplate.h:726
clang::TypeAliasTemplateDecl::getCanonicalDecl
const TypeAliasTemplateDecl * getCanonicalDecl() const
Definition: DeclTemplate.h:2573
clang::TemplateTypeParmDecl::setInheritedDefaultArgument
void setInheritedDefaultArgument(const ASTContext &C, TemplateTypeParmDecl *Prev)
Set that this default argument was inherited from another parameter.
Definition: DeclTemplate.h:1300
clang::TemplateParmPosition::DepthWidth
@ DepthWidth
Definition: DeclTemplate.h:1159
clang::FunctionTemplateSpecializationInfo::Create
static FunctionTemplateSpecializationInfo * Create(ASTContext &C, FunctionDecl *FD, FunctionTemplateDecl *Template, TemplateSpecializationKind TSK, const TemplateArgumentList *TemplateArgs, const TemplateArgumentListInfo *TemplateArgsAsWritten, SourceLocation POI, MemberSpecializationInfo *MSInfo)
Definition: DeclTemplate.cpp:890
clang::RedeclarableTemplateDecl::CommonBase::InjectedArgs
TemplateArgument * InjectedArgs
The set of "injected" template arguments used within this template.
Definition: DeclTemplate.h:856
clang::NestedNameSpecifierLoc
A C++ nested-name-specifier augmented with source location information.
Definition: NestedNameSpecifier.h:243
clang::Redeclarable< RedeclarableTemplateDecl >::getPreviousDecl
RedeclarableTemplateDecl * getPreviousDecl()
Return the previous declaration of this declaration or NULL if this is the first declaration.
Definition: Redeclarable.h:204
clang::VarTemplateSpecializationDecl::Profile
void Profile(llvm::FoldingSetNodeID &ID) const
Definition: DeclTemplate.h:2937
clang::FriendTemplateDecl::CreateDeserialized
static FriendTemplateDecl * CreateDeserialized(ASTContext &C, unsigned ID)
Definition: DeclTemplate.cpp:1168
clang::ClassTemplateSpecializationDecl::getTemplateInstantiationArgs
const TemplateArgumentList & getTemplateInstantiationArgs() const
Retrieve the set of template arguments that should be used to instantiate members of the class templa...
Definition: DeclTemplate.h:2009
clang::TemplateTemplateParmDecl::isPackExpansion
bool isPackExpansion() const
Whether this parameter pack is a pack expansion.
Definition: DeclTemplate.h:1699
clang::RedeclarableTemplateDecl::RedeclarableTemplate
friend class RedeclarableTemplate
Definition: DeclTemplate.h:880
clang::Redeclarable< RedeclarableTemplateDecl >::isFirstDecl
bool isFirstDecl() const
True if this is the first declaration in its redeclaration chain.
Definition: Redeclarable.h:223
ASTConcept.h
This file provides AST data structures related to concepts.
clang::TemplateTemplateParmDecl::getSourceRange
SourceRange getSourceRange() const override LLVM_READONLY
Source range that this declaration covers.
Definition: DeclTemplate.h:1772
clang::TemplateParamObjectDecl::getCanonicalDecl
const TemplateParamObjectDecl * getCanonicalDecl() const
Definition: DeclTemplate.h:3416
clang::ImplicitConceptSpecializationDecl::Create
static ImplicitConceptSpecializationDecl * Create(const ASTContext &C, DeclContext *DC, SourceLocation SL, ArrayRef< TemplateArgument > ConvertedArgs)
Definition: DeclTemplate.cpp:1069
clang::DefaultArgStorage::set
void set(ArgType Arg)
Set the default argument.
Definition: DeclTemplate.h:368
clang::VarTemplateSpecializationDecl::Create
static VarTemplateSpecializationDecl * Create(ASTContext &Context, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, VarTemplateDecl *SpecializedTemplate, QualType T, TypeSourceInfo *TInfo, StorageClass S, ArrayRef< TemplateArgument > Args)
Definition: DeclTemplate.cpp:1353
clang::TemplateTypeParmDecl
Declaration of a template type parameter.
Definition: DeclTemplate.h:1204
clang::ClassTemplateSpecializationDecl::getSpecializedTemplateOrPartial
llvm::PointerUnion< ClassTemplateDecl *, ClassTemplatePartialSpecializationDecl * > getSpecializedTemplateOrPartial() const
Retrieve the class template or class template partial specialization which was specialized by this.
Definition: DeclTemplate.h:1990
clang::TemplateParameterList::getTemplateLoc
SourceLocation getTemplateLoc() const
Definition: DeclTemplate.h:193
clang::TemplateTemplateParmDecl::classofKind
static bool classofKind(Kind K)
Definition: DeclTemplate.h:1781
clang::TemplateParmPosition::setPosition
void setPosition(unsigned P)
Definition: DeclTemplate.h:1188
clang::TemplateParamObjectDecl
A template parameter object.
Definition: DeclTemplate.h:3365
clang::Decl::isImplicit
bool isImplicit() const
isImplicit - Indicates whether the declaration was implicitly generated by the implementation.
Definition: DeclBase.h:576
clang::MemberSpecializationInfo::getPointOfInstantiation
SourceLocation getPointOfInstantiation() const
Retrieve the first point of instantiation of this member.
Definition: DeclTemplate.h:669
clang::FunctionTemplateDecl::isAbbreviated
bool isAbbreviated() const
Return whether this function template is an abbreviated function template, e.g.
Definition: DeclTemplate.h:1117
clang::ClassTemplateDecl::findSpecialization
ClassTemplateSpecializationDecl * findSpecialization(ArrayRef< TemplateArgument > Args, void *&InsertPos)
Return the specialization with the provided arguments if it exists, otherwise return the insertion po...
Definition: DeclTemplate.cpp:502
clang::TemplateDecl::getTemplateParameters
TemplateParameterList * getTemplateParameters() const
Get the list of template parameters.
Definition: DeclTemplate.h:426
clang::ClassTemplateDecl::AddSpecialization
void AddSpecialization(ClassTemplateSpecializationDecl *D, void *InsertPos)
Insert the specified specialization knowing that it is not already in.
Definition: DeclTemplate.cpp:507
clang::FriendTemplateDecl::classof
static bool classof(const Decl *D)
Definition: DeclTemplate.h:2533
clang::TemplateParameterList::getRAngleLoc
SourceLocation getRAngleLoc() const
Definition: DeclTemplate.h:195
clang::TemplateArgumentList::asArray
ArrayRef< TemplateArgument > asArray() const
Produce this as an array ref.
Definition: DeclTemplate.h:290
clang::ClassTemplateSpecializationDecl::getTypeAsWritten
TypeSourceInfo * getTypeAsWritten() const
Gets the type of this specialization as it was written by the user, if it was so written.
Definition: DeclTemplate.h:2048
clang::VarTemplateDecl::getMostRecentDecl
VarTemplateDecl * getMostRecentDecl()
Definition: DeclTemplate.h:3213
clang::TemplateTypeParmDecl::classof
static bool classof(const Decl *D)
Definition: DeclTemplate.h:1398
clang::VarTemplateSpecializationDecl::getPointOfInstantiation
SourceLocation getPointOfInstantiation() const
Get the point of instantiation (if any), or null if none.
Definition: DeclTemplate.h:2816
clang::ClassTemplateSpecializationDecl::isExplicitSpecialization
bool isExplicitSpecialization() const
Definition: DeclTemplate.h:1928
clang::TemplateParamObjectDecl::printAsExpr
void printAsExpr(llvm::raw_ostream &OS) const
Print this object as an equivalent expression.
Definition: DeclTemplate.cpp:1578
clang::RedeclarableTemplateDecl::loadLazySpecializationsImpl
void loadLazySpecializationsImpl() const
Definition: DeclTemplate.cpp:301
clang::VarTemplateDecl::getSpecializations
llvm::FoldingSetVector< VarTemplateSpecializationDecl > & getSpecializations() const
Retrieve the set of specializations of this variable template.
Definition: DeclTemplate.cpp:1250
clang::VarTemplateDecl::Common
Data that is common to all of the declarations of a given variable template.
Definition: DeclTemplate.h:3123
clang::RedeclarableTemplateDecl::CommonBase::CommonBase
CommonBase()
Definition: DeclTemplate.h:832
clang::VarTemplateDecl::getCanonicalDecl
VarTemplateDecl * getCanonicalDecl() override
Retrieves the canonical declaration of this template.
Definition: DeclTemplate.h:3194
clang::TemplateTypeParmDecl::wasDeclaredWithTypename
bool wasDeclaredWithTypename() const
Whether this template type parameter was declared with the 'typename' keyword.
Definition: DeclTemplate.h:1264
clang::RedeclarableTemplateDecl::SpecEntryTraits::getDecl
static DeclType * getDecl(EntryType *D)
Definition: DeclTemplate.h:784
clang::FunctionTemplateSpecializationInfo::isExplicitSpecialization
bool isExplicitSpecialization() const
Definition: DeclTemplate.h:543
clang::FriendTemplateDecl::getFriendType
TypeSourceInfo * getFriendType() const
If this friend declaration names a templated type (or a dependent member type of a templated type),...
Definition: DeclTemplate.h:2507
clang::Decl::getSourceRange
virtual SourceRange getSourceRange() const LLVM_READONLY
Source range that this declaration covers.
Definition: DeclBase.h:420
clang::FunctionTemplateSpecializationInfo::getFunction
FunctionDecl * getFunction() const
Retrieve the declaration of the function template specialization.
Definition: DeclTemplate.h:533
clang::ConceptDecl::ConstraintExpr
Expr * ConstraintExpr
Definition: DeclTemplate.h:3277
clang::TemplateTemplateParmDecl::defaultArgumentWasInherited
bool defaultArgumentWasInherited() const
Determines whether the default argument was inherited from a previous declaration of this template.
Definition: DeclTemplate.h:1755
clang::CXXRecordDecl
Represents a C++ struct/union/class.
Definition: DeclCXX.h:254
clang::Mergeable
Provides common interface for the Decls that cannot be redeclared, but can be merged if the same decl...
Definition: Redeclarable.h:314
clang::Redeclarable< TagDecl >::First
TagDecl * First
Definition: Redeclarable.h:187
clang::ClassTemplateSpecializationDecl::Profile
void Profile(llvm::FoldingSetNodeID &ID) const
Definition: DeclTemplate.h:2078
SourceLocation.h
clang::VarDecl::isThisDeclarationADefinition
DefinitionKind isThisDeclarationADefinition(ASTContext &) const
Check whether this declaration is a definition.
Definition: Decl.cpp:2197
clang::VarTemplateDecl::classof
static bool classof(const Decl *D)
Definition: DeclTemplate.h:3270
P
StringRef P
Definition: ASTMatchersInternal.cpp:564
clang::MemberSpecializationInfo::isExplicitSpecialization
bool isExplicitSpecialization() const
Definition: DeclTemplate.h:655
clang::TemplateTemplateParmDecl::setInheritedDefaultArgument
void setInheritedDefaultArgument(const ASTContext &C, TemplateTemplateParmDecl *Prev)
Definition: DeclTemplate.h:1764
clang::TemplateSpecializationKind
TemplateSpecializationKind
Describes the kind of template specialization that a particular template specialization declaration r...
Definition: Specifiers.h:176
clang::ClassTemplatePartialSpecializationDecl::getTemplateArgsAsWritten
const ASTTemplateArgumentListInfo * getTemplateArgsAsWritten() const
Get the template arguments as written.
Definition: DeclTemplate.h:2174
clang::RedeclarableTemplateDecl::getCanonicalDecl
const RedeclarableTemplateDecl * getCanonicalDecl() const
Definition: DeclTemplate.h:886
clang::Type::getContainedAutoType
AutoType * getContainedAutoType() const
Get the AutoType whose type will be deduced for a variable with an initializer of this type.
Definition: Type.h:2413
clang::FunctionTemplateSpecializationInfo
Provides information about a function template specialization, which is a FunctionDecl that has been ...
Definition: DeclTemplate.h:477
clang::NonTypeTemplateParmDecl::getExpansionTypeSourceInfo
TypeSourceInfo * getExpansionTypeSourceInfo(unsigned I) const
Retrieve a particular expansion type source info within an expanded parameter pack.
Definition: DeclTemplate.h:1576
clang::FunctionTemplateDecl::Common::Common
Common()=default
clang::TemplateParameterList::end
iterator end()
Definition: DeclTemplate.h:128
clang::NonTypeTemplateParmDecl::getDefaultArgument
Expr * getDefaultArgument() const
Retrieve the default argument, if any.
Definition: DeclTemplate.h:1489
clang::TemplateTypeParmDecl::getTypeConstraint
const TypeConstraint * getTypeConstraint() const
Returns the type constraint associated with this template parameter (if any).
Definition: DeclTemplate.h:1369
clang::getAsNamedDecl
NamedDecl * getAsNamedDecl(TemplateParameter P)
Definition: DeclTemplate.h:3424
false
#define false
Definition: stdbool.h:22
clang::FunctionTemplateDecl::addSpecialization
void addSpecialization(FunctionTemplateSpecializationInfo *Info, void *InsertPos)
Add a specialization of this function template.
Definition: DeclTemplate.cpp:416
clang::TemplateTemplateParmDecl::TrailingObjects
friend TrailingObjects
Definition: DeclTemplate.h:1661
clang::ImplicitConceptSpecializationDecl::TrailingObjects
friend TrailingObjects
Definition: DeclTemplate.h:3349
clang::ClassTemplateDecl
Declaration of a class template.
Definition: DeclTemplate.h:2270
clang::ValueDecl
Represent the declaration of a variable (in which case it is an lvalue) a function (in which case it ...
Definition: Decl.h:703
clang::ClassTemplateSpecializationDecl::ClassTemplateSpecializationDecl
ClassTemplateSpecializationDecl(ASTContext &Context, Kind DK, TagKind TK, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, ClassTemplateDecl *SpecializedTemplate, ArrayRef< TemplateArgument > Args, ClassTemplateSpecializationDecl *PrevDecl)
Definition: DeclTemplate.cpp:911
clang::VarTemplateDecl::isThisDeclarationADefinition
bool isThisDeclarationADefinition() const
Returns whether this template declaration defines the primary variable pattern.
Definition: DeclTemplate.h:3170
clang::ClassTemplateSpecializationDecl::classofKind
static bool classofKind(Kind K)
Definition: DeclTemplate.h:2092
clang::TemplateTypeParmDecl::setDeclaredWithTypename
void setDeclaredWithTypename(bool withTypename)
Set whether this template type parameter was declared with the 'typename' or 'class' keyword.
Definition: DeclTemplate.h:1312
clang::DependentFunctionTemplateSpecializationInfo::getRAngleLoc
SourceLocation getRAngleLoc() const
Definition: DeclTemplate.h:756
clang::ClassTemplateDecl::findPartialSpecialization
ClassTemplatePartialSpecializationDecl * findPartialSpecialization(ArrayRef< TemplateArgument > Args, TemplateParameterList *TPL, void *&InsertPos)
Return the partial specialization with the provided arguments if it exists, otherwise return the inse...
Definition: DeclTemplate.cpp:513
clang::ImplicitConceptSpecializationDecl
Definition: DeclTemplate.h:3322
clang::VarTemplateSpecializationDecl::isExplicitSpecialization
bool isExplicitSpecialization() const
Definition: DeclTemplate.h:2794
clang::VarTemplateSpecializationDecl::CreateDeserialized
static VarTemplateSpecializationDecl * CreateDeserialized(ASTContext &C, unsigned ID)
Definition: DeclTemplate.cpp:1363
clang::TemplateParameterList::begin
const_iterator begin() const
Definition: DeclTemplate.h:127
clang::ClassTemplateSpecializationDecl::Profile
static void Profile(llvm::FoldingSetNodeID &ID, ArrayRef< TemplateArgument > TemplateArgs, ASTContext &Context)
Definition: DeclTemplate.h:2083
clang::NonTypeTemplateParmDecl::removeDefaultArgument
void removeDefaultArgument()
Removes the default argument of this template parameter.
Definition: DeclTemplate.h:1510
clang::RedeclarableTemplateDecl::CommonBase::LazySpecializations
uint32_t * LazySpecializations
If non-null, points to an array of specializations (including partial specializations) known only by ...
Definition: DeclTemplate.h:847
clang::Redeclarable< RedeclarableTemplateDecl >::getNextRedeclaration
RedeclarableTemplateDecl * getNextRedeclaration() const
Definition: Redeclarable.h:189
clang::ClassTemplateSpecializationDecl::setExternLoc
void setExternLoc(SourceLocation Loc)
Sets the location of the extern keyword.
Definition: DeclTemplate.h:2058
clang::TemplateDecl
The base class of all kinds of template declarations (e.g., class, function, etc.).
Definition: DeclTemplate.h:407
clang::NonTypeTemplateParmDecl::isExpandedParameterPack
bool isExpandedParameterPack() const
Whether this parameter is a non-type template parameter pack that has a known list of different types...
Definition: DeclTemplate.h:1556
clang::BuiltinTemplateDecl::getBuiltinTemplateKind
BuiltinTemplateKind getBuiltinTemplateKind() const
Definition: DeclTemplate.h:1810
clang::VarTemplatePartialSpecializationDecl
Definition: DeclTemplate.h:2957
clang::FunctionTemplateSpecializationInfo::setPointOfInstantiation
void setPointOfInstantiation(SourceLocation POI)
Set the (first) point of instantiation of this function template specialization.
Definition: DeclTemplate.h:573
clang::TemplateArgumentList::OnStackType
OnStackType
Type used to indicate that the template argument list itself is a stack object.
Definition: DeclTemplate.h:258
clang::TemplateParmPosition::Depth
unsigned Depth
Definition: DeclTemplate.h:1160
clang::RedeclarableTemplateDecl::SpecIterator::SpecIterator
SpecIterator(typename llvm::FoldingSetVector< EntryType >::iterator SetIter)
Definition: DeclTemplate.h:803
llvm::ArrayRef
Definition: LLVM.h:34
clang::RedeclarableTemplateDecl::getCommonPtr
CommonBase * getCommonPtr() const
Retrieves the "common" pointer shared by all (re-)declarations of the same template.
Definition: DeclTemplate.cpp:269
Value
Value
Definition: UninitializedValues.cpp:102
clang::Decl
Decl - This represents one declaration (or definition), e.g.
Definition: DeclBase.h:83
clang::BuiltinTemplateDecl::classofKind
static bool classofKind(Kind K)
Definition: DeclTemplate.h:1798
clang::DeclaratorDecl
Represents a ValueDecl that came out of a declarator.
Definition: Decl.h:767
clang::ClassTemplatePartialSpecializationDecl::CreateDeserialized
static ClassTemplatePartialSpecializationDecl * CreateDeserialized(ASTContext &C, unsigned ID)
Definition: DeclTemplate.cpp:1141
clang::VarTemplatePartialSpecializationDecl::classofKind
static bool classofKind(Kind K)
Definition: DeclTemplate.h:3113
clang::VarTemplateDecl::AddSpecialization
void AddSpecialization(VarTemplateSpecializationDecl *D, void *InsertPos)
Insert the specified specialization knowing that it is not already in.
Definition: DeclTemplate.cpp:1274
clang::FixedSizeTemplateParameterListStorage
Stores a list of template parameters and the associated requires-clause (if any) for a TemplateDecl a...
Definition: DeclTemplate.h:215
clang::ClassTemplatePartialSpecializationDecl::setMemberSpecialization
void setMemberSpecialization()
Note that this member template is a specialization.
Definition: DeclTemplate.h:2237
clang::ClassScopeFunctionSpecializationDecl::getSpecialization
CXXMethodDecl * getSpecialization() const
Definition: DeclTemplate.h:2646
clang::Sema
Sema - This implements semantic analysis and AST building for C.
Definition: Sema.h:358
clang::VarDecl::getTemplateSpecializationKind
TemplateSpecializationKind getTemplateSpecializationKind() const
If this variable is an instantiation of a variable template or a static data member of a class templa...
Definition: Decl.cpp:2683
clang::TypeAliasTemplateDecl::Create
static TypeAliasTemplateDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation L, DeclarationName Name, TemplateParameterList *Params, NamedDecl *Decl)
Create a function template node.
Definition: DeclTemplate.cpp:1178
LLVM.h
clang::VarTemplateSpecializationDecl::setExternLoc
void setExternLoc(SourceLocation Loc)
Sets the location of the extern keyword.
Definition: DeclTemplate.h:2911
clang::VarTemplateSpecializationDecl::setTypeAsWritten
void setTypeAsWritten(TypeSourceInfo *T)
Sets the type of this specialization as it was written by the user.
Definition: DeclTemplate.h:2893
clang::VarTemplateSpecializationDecl::classof
static bool classof(const Decl *D)
Definition: DeclTemplate.h:2949
clang::ClassTemplateDecl::getCanonicalDecl
ClassTemplateDecl * getCanonicalDecl() override
Retrieves the canonical declaration of this template.
Definition: DeclTemplate.h:2347
clang::ClassTemplateDecl::getTemplatedDecl
CXXRecordDecl * getTemplatedDecl() const
Get the underlying class declarations of the template.
Definition: DeclTemplate.h:2318
clang::TSK_ExplicitSpecialization
@ TSK_ExplicitSpecialization
This template specialization was declared or defined by an explicit specialization (C++ [temp....
Definition: Specifiers.h:186
clang::DependentFunctionTemplateSpecializationInfo::getTemplate
FunctionTemplateDecl * getTemplate(unsigned I) const
Returns the i'th template candidate.
Definition: DeclTemplate.h:729
clang::ValueDecl::ValueDecl
ValueDecl(Kind DK, DeclContext *DC, SourceLocation L, DeclarationName N, QualType T)
Definition: Decl.h:709
clang::TemplateParamObjectDecl::classofKind
static bool classofKind(Kind K)
Definition: DeclTemplate.h:3421
clang::VarTemplatePartialSpecializationDecl::Create
static VarTemplatePartialSpecializationDecl * Create(ASTContext &Context, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, TemplateParameterList *Params, VarTemplateDecl *SpecializedTemplate, QualType T, TypeSourceInfo *TInfo, StorageClass S, ArrayRef< TemplateArgument > Args, const TemplateArgumentListInfo &ArgInfos)
Definition: DeclTemplate.cpp:1427
clang::TemplateTypeParmDecl::getDefaultArgumentLoc
SourceLocation getDefaultArgumentLoc() const
Retrieves the location of the default argument declaration.
Definition: DeclTemplate.cpp:671
clang::VarTemplateSpecializationDecl::classofKind
static bool classofKind(Kind K)
Definition: DeclTemplate.h:2951
clang::TemplateArgumentList
A template argument list.
Definition: DeclTemplate.h:237
clang::Redeclarable< RedeclarableTemplateDecl >::getMostRecentDecl
RedeclarableTemplateDecl * getMostRecentDecl()
Returns the most recent (re)declaration of this declaration.
Definition: Redeclarable.h:226
clang::RedeclarableTemplateDecl::SpecIterator
Definition: DeclTemplate.h:795
clang::TemplateParameterList::size
unsigned size() const
Definition: DeclTemplate.h:131
clang::VarTemplateSpecializationDecl::getExternLoc
SourceLocation getExternLoc() const
Gets the location of the extern keyword, if present.
Definition: DeclTemplate.h:2906
clang::IdentifierInfo
One of these records is kept for each identifier that is lexed.
Definition: IdentifierTable.h:85
clang::VarTemplateSpecializationDecl::setCompleteDefinition
void setCompleteDefinition()
Definition: DeclTemplate.h:2825
clang::ClassScopeFunctionSpecializationDecl::CreateDeserialized
static ClassScopeFunctionSpecializationDecl * CreateDeserialized(ASTContext &Context, unsigned ID)
Definition: DeclTemplate.cpp:1208
clang::ConceptDecl::ConceptDecl
ConceptDecl(DeclContext *DC, SourceLocation L, DeclarationName Name, TemplateParameterList *Params, Expr *ConstraintExpr)
Definition: DeclTemplate.h:3279
clang::ClassTemplatePartialSpecializationDecl::Profile
void Profile(llvm::FoldingSetNodeID &ID) const
Definition: DeclTemplate.h:2253
clang::RedeclarableTemplateDecl::addSpecializationImpl
void addSpecializationImpl(llvm::FoldingSetVector< EntryType > &Specs, EntryType *Entry, void *InsertPos)
Definition: DeclTemplate.cpp:329
clang::MemberSpecializationInfo::getInstantiatedFrom
NamedDecl * getInstantiatedFrom() const
Retrieve the member declaration from which this member was instantiated.
Definition: DeclTemplate.h:648
clang::TemplateParameterList::getDepth
unsigned getDepth() const
Get the depth of this template parameter list in the set of template parameter lists.
Definition: DeclTemplate.cpp:156
clang::VarTemplateSpecializationDecl::getSpecializedTemplateOrPartial
llvm::PointerUnion< VarTemplateDecl *, VarTemplatePartialSpecializationDecl * > getSpecializedTemplateOrPartial() const
Retrieve the variable template or variable template partial specialization which was specialized by t...
Definition: DeclTemplate.h:2843
clang::TemplateTypeParmDecl::isParameterPack
bool isParameterPack() const
Returns whether this is a parameter pack.
Definition: DeclTemplate.cpp:697
clang::TemplateArgumentList::OnStack
@ OnStack
Definition: DeclTemplate.h:258
clang::TemplateParameterList::asArray
ArrayRef< NamedDecl * > asArray()
Definition: DeclTemplate.h:133
clang::TemplateTypeParmDecl::getDefaultArgStorage
const DefArgStorage & getDefaultArgStorage() const
Definition: DeclTemplate.h:1268
clang::CXXRecordDecl::getMostRecentNonInjectedDecl
CXXRecordDecl * getMostRecentNonInjectedDecl()
Definition: DeclCXX.h:533
clang::TemplateParameterList::getSourceRange
SourceRange getSourceRange() const LLVM_READONLY
Definition: DeclTemplate.h:197
clang::VarTemplateSpecializationDecl::setInstantiationOf
void setInstantiationOf(VarTemplateDecl *TemplDecl)
Note that this variable template specialization is an instantiation of the given variable template.
Definition: DeclTemplate.h:2885
clang::TypeAliasTemplateDecl::getCommonPtr
Common * getCommonPtr()
Definition: DeclTemplate.h:2555
clang::FunctionTemplateDecl::getTemplatedDecl
FunctionDecl * getTemplatedDecl() const
Get the underlying function declaration of the template.
Definition: DeclTemplate.h:1051
clang::TemplateTypeParmDecl::isPackExpansion
bool isPackExpansion() const
Whether this parameter pack is a pack expansion.
Definition: DeclTemplate.h:1327
clang::ASTReader
Reads an AST files chain containing the contents of a translation unit.
Definition: ASTReader.h:359
clang::ConceptDecl::isTypeConcept
bool isTypeConcept() const
Definition: DeclTemplate.h:3299
clang::TemplateParmPosition::MaxDepth
static constexpr unsigned MaxDepth
Definition: DeclTemplate.h:1163
std
Definition: Format.h:4605
clang::DefaultArgStorage
Storage for a default argument.
Definition: DeclTemplate.h:313
clang::VarTemplatePartialSpecializationDecl::getSourceRange
SourceRange getSourceRange() const override LLVM_READONLY
Source range that this declaration covers.
Definition: DeclTemplate.h:3094
clang::FunctionTemplateDecl::getPreviousDecl
const FunctionTemplateDecl * getPreviousDecl() const
Definition: DeclTemplate.h:1081
DeclarationName.h
clang::ClassTemplateDecl::getPreviousDecl
const ClassTemplateDecl * getPreviousDecl() const
Definition: DeclTemplate.h:2362
clang::VarTemplatePartialSpecializationDecl::Profile
void Profile(llvm::FoldingSetNodeID &ID) const
Definition: DeclTemplate.h:3102
clang::TemplateParamObjectDecl::printName
void printName(llvm::raw_ostream &OS, const PrintingPolicy &Policy) const override
Print this template parameter object in a human-readable format.
Definition: DeclTemplate.cpp:1571
clang::RedeclarableTemplateDecl::Common
CommonBase * Common
Pointer to the common data shared by all declarations of this template.
Definition: DeclTemplate.h:861
clang::TypeAliasTemplateDecl::getPreviousDecl
const TypeAliasTemplateDecl * getPreviousDecl() const
Definition: DeclTemplate.h:2584
clang::ClassTemplateSpecializationDecl::getNameForDiagnostic
void getNameForDiagnostic(raw_ostream &OS, const PrintingPolicy &Policy, bool Qualified) const override
Appends a human-readable name for this declaration into the given stream.
Definition: DeclTemplate.cpp:965
clang::FunctionTemplateDecl::getPreviousDecl
FunctionTemplateDecl * getPreviousDecl()
Retrieve the previous declaration of this function template, or nullptr if no such declaration exists...
Definition: DeclTemplate.h:1077
clang::Builtin::ID
ID
Definition: Builtins.h:64
clang::ClassTemplateSpecializationDecl::getInstantiatedFrom
llvm::PointerUnion< ClassTemplateDecl *, ClassTemplatePartialSpecializationDecl * > getInstantiatedFrom() const
If this class template specialization is an instantiation of a template (rather than an explicit spec...
Definition: DeclTemplate.h:1978
clang::TemplateTemplateParmDecl::getDefaultArgument
const TemplateArgumentLoc & getDefaultArgument() const
Retrieve the default argument, if any.
Definition: DeclTemplate.h:1745
clang::TemplateTypeParmDecl::getAssociatedConstraints
void getAssociatedConstraints(llvm::SmallVectorImpl< const Expr * > &AC) const
Get the associated-constraints of this template parameter.
Definition: DeclTemplate.h:1390
clang::ClassTemplatePartialSpecializationDecl::classof
static bool classof(const Decl *D)
Definition: DeclTemplate.h:2262
clang::FunctionTemplateDecl::FunctionTemplateDecl
FunctionTemplateDecl(ASTContext &C, DeclContext *DC, SourceLocation L, DeclarationName Name, TemplateParameterList *Params, NamedDecl *Decl)
Definition: DeclTemplate.h:1019
clang::CXXRecordDecl::getTemplateSpecializationKind
TemplateSpecializationKind getTemplateSpecializationKind() const
Determine whether this particular class is a specialization or instantiation of a class template or m...
Definition: DeclCXX.cpp:1861
clang::ClassTemplateDecl::Create
static ClassTemplateDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation L, DeclarationName Name, TemplateParameterList *Params, NamedDecl *Decl)
Create a class template node.
Definition: DeclTemplate.cpp:460
clang::ClassTemplateDecl::getMostRecentDecl
ClassTemplateDecl * getMostRecentDecl()
Definition: DeclTemplate.h:2368
clang
Definition: CalledOnceCheck.h:17
clang::VarTemplateSpecializationDecl::isClassScopeExplicitSpecialization
bool isClassScopeExplicitSpecialization() const
Definition: DeclTemplate.h:2798
clang::TemplateTypeParmDecl::getNumExpansionParameters
unsigned getNumExpansionParameters() const
Retrieves the number of parameters in an expanded parameter pack.
Definition: DeclTemplate.h:1362
clang::VarTemplatePartialSpecializationDecl::getMostRecentDecl
VarTemplatePartialSpecializationDecl * getMostRecentDecl()
Definition: DeclTemplate.h:3002
clang::VarTemplatePartialSpecializationDecl::hasAssociatedConstraints
bool hasAssociatedConstraints() const
Definition: DeclTemplate.h:3028
clang::TemplateTemplateParmDecl::getDefaultArgumentLoc
SourceLocation getDefaultArgumentLoc() const
Retrieve the location of the default argument, if any.
Definition: DeclTemplate.cpp:860
clang::ClassTemplateSpecializationDecl::isClassScopeExplicitSpecialization
bool isClassScopeExplicitSpecialization() const
Is this an explicit specialization at class scope (within the class that owns the primary template)?...
Definition: DeclTemplate.h:1941
clang::FunctionTemplateDecl::getInstantiatedFromMemberTemplate
FunctionTemplateDecl * getInstantiatedFromMemberTemplate() const
Definition: DeclTemplate.h:1095
clang::ConceptDecl::classof
static bool classof(const Decl *D)
Definition: DeclTemplate.h:3311
clang::NonTypeTemplateParmDecl::isParameterPack
bool isParameterPack() const
Whether this parameter is a non-type template parameter pack.
Definition: DeclTemplate.h:1521
clang::ClassTemplateSpecializationDecl::setSpecializationKind
void setSpecializationKind(TemplateSpecializationKind TSK)
Definition: DeclTemplate.h:1958
clang::DefaultArgStorage::isInherited
bool isInherited() const
Determine whether the default argument for this parameter was inherited from a previous declaration o...
Definition: DeclTemplate.h:344
clang::FunctionTemplateDecl::getSpecializations
llvm::FoldingSetVector< FunctionTemplateSpecializationInfo > & getSpecializations() const
Retrieve the set of function template specializations of this function template.
Definition: DeclTemplate.cpp:405
clang::TemplateDecl::getSourceRange
SourceRange getSourceRange() const override LLVM_READONLY
Source range that this declaration covers.
Definition: DeclTemplate.h:451
clang::ClassTemplateDecl::Common::Specializations
llvm::FoldingSetVector< ClassTemplateSpecializationDecl > Specializations
The class template specializations for this class template, including explicit specializations and in...
Definition: DeclTemplate.h:2277
clang::ClassTemplatePartialSpecializationDecl::classofKind
static bool classofKind(Kind K)
Definition: DeclTemplate.h:2264
clang::RedeclarableTemplateDecl::findSpecializationImpl
SpecEntryTraits< EntryType >::DeclType * findSpecializationImpl(llvm::FoldingSetVector< EntryType > &Specs, void *&InsertPos, ProfileArguments &&...ProfileArgs)
Definition: DeclTemplate.cpp:316
clang::FunctionTemplateDecl::getCanonicalDecl
const FunctionTemplateDecl * getCanonicalDecl() const
Definition: DeclTemplate.h:1070
clang::TemplateTemplateParmDecl::isExpandedParameterPack
bool isExpandedParameterPack() const
Whether this parameter is a template template parameter pack that has a known list of different templ...
Definition: DeclTemplate.h:1722
clang::SourceLocation::isValid
bool isValid() const
Return true if this is a valid SourceLocation object.
Definition: SourceLocation.h:110
clang::ClassTemplatePartialSpecializationDecl::getAssociatedConstraints
void getAssociatedConstraints(llvm::SmallVectorImpl< const Expr * > &AC) const
All associated constraints of this partial specialization, including the requires clause and any cons...
Definition: DeclTemplate.h:2165
clang::VarTemplateDecl::newCommon
CommonBase * newCommon(ASTContext &C) const override
Definition: DeclTemplate.cpp:1262
clang::TypeSourceInfo
A container of type source information.
Definition: Type.h:6604
clang::TemplateParmPosition
Defines the position of a template parameter within a template parameter list.
Definition: DeclTemplate.h:1157
clang::TemplateTemplateParmDecl::removeDefaultArgument
void removeDefaultArgument()
Removes the default argument of this template parameter.
Definition: DeclTemplate.h:1770
clang::TemplateParameterList::begin
iterator begin()
Definition: DeclTemplate.h:126
clang::ClassTemplateDecl::getCommonPtr
Common * getCommonPtr() const
Definition: DeclTemplate.h:2306
clang::ClassTemplatePartialSpecializationDecl::isMemberSpecialization
bool isMemberSpecialization()
Determines whether this class template partial specialization template was a specialization of a memb...
Definition: DeclTemplate.h:2230
clang::RedeclarableTemplateDecl::getInstantiatedFromMemberTemplate
RedeclarableTemplateDecl * getInstantiatedFromMemberTemplate() const
Retrieve the member template from which this template was instantiated, or nullptr if this template w...
Definition: DeclTemplate.h:955
clang::RedeclarableTemplateDecl::CommonBase::InstantiatedFromMember
llvm::PointerIntPair< RedeclarableTemplateDecl *, 1, bool > InstantiatedFromMember
The template from which this was most directly instantiated (or null).
Definition: DeclTemplate.h:840
clang::TemplateParameterList::const_iterator
NamedDecl *const * const_iterator
Iterates through the template parameters in this list.
Definition: DeclTemplate.h:124
clang::getReplacedTemplateParameterList
TemplateParameterList * getReplacedTemplateParameterList(Decl *D)
Internal helper used by Subst* nodes to retrieve the parameter list for their AssociatedDecl.
Definition: DeclTemplate.cpp:1597
clang::TemplateParameterList::shouldIncludeTypeForArgument
static bool shouldIncludeTypeForArgument(const PrintingPolicy &Policy, const TemplateParameterList *TPL, unsigned Idx)
Definition: DeclTemplate.cpp:205
clang::TemplateParamObjectDecl::getCanonicalDecl
TemplateParamObjectDecl * getCanonicalDecl() override
Retrieves the "canonical" declaration of the given declaration.
Definition: DeclTemplate.h:3413
clang::TemplateTypeParmDecl::removeDefaultArgument
void removeDefaultArgument()
Removes the default argument of this template parameter.
Definition: DeclTemplate.h:1306
clang::Decl::DeclContext
friend class DeclContext
Definition: DeclBase.h:249
clang::NonTypeTemplateParmDecl::getPlaceholderTypeConstraint
Expr * getPlaceholderTypeConstraint() const
Return the constraint introduced by the placeholder type of this non-type template parameter (if any)...
Definition: DeclTemplate.h:1585
clang::ClassTemplateSpecializationDecl::getTemplateKeywordLoc
SourceLocation getTemplateKeywordLoc() const
Gets the location of the template keyword, if present.
Definition: DeclTemplate.h:2072
clang::ASTTemplateArgumentListInfo::Create
static const ASTTemplateArgumentListInfo * Create(const ASTContext &C, const TemplateArgumentListInfo &List)
Definition: TemplateBase.cpp:604
clang::ClassTemplateDecl::getSpecializations
llvm::FoldingSetVector< ClassTemplateSpecializationDecl > & getSpecializations() const
Retrieve the set of specializations of this class template.
Definition: DeclTemplate.cpp:483
clang::BuiltinTemplateDecl
Represents the builtin template declaration which is used to implement __make_integer_seq and other b...
Definition: DeclTemplate.h:1787
clang::RedeclarableTemplateDecl::SpecEntryTraits::DeclType
EntryType DeclType
Definition: DeclTemplate.h:782
clang::VarTemplateSpecializationDecl::getSpecializedTemplate
VarTemplateDecl * getSpecializedTemplate() const
Retrieve the template that this specialization specializes.
Definition: DeclTemplate.cpp:1386
clang::TemplateParameterList::hasParameterPack
bool hasParameterPack() const
Determine whether this template parameter list contains a parameter pack.
Definition: DeclTemplate.h:166
clang::FunctionTemplateDecl::Common::Specializations
llvm::FoldingSetVector< FunctionTemplateSpecializationInfo > Specializations
The function template specializations for this function template, including explicit specializations ...
Definition: DeclTemplate.h:1014
clang::TemplateParamObjectDecl::Profile
static void Profile(llvm::FoldingSetNodeID &ID, QualType T, const APValue &V)
Definition: DeclTemplate.h:3404
clang::ImplicitConceptSpecializationDecl::CreateDeserialized
static ImplicitConceptSpecializationDecl * CreateDeserialized(const ASTContext &C, unsigned ID, unsigned NumTemplateArgs)
Definition: DeclTemplate.cpp:1078
clang::FunctionTemplateSpecializationInfo::TemplateArgumentsAsWritten
const ASTTemplateArgumentListInfo * TemplateArgumentsAsWritten
The template arguments as written in the sources, if provided.
Definition: DeclTemplate.h:498
clang::TypeAliasTemplateDecl
Declaration of an alias template.
Definition: DeclTemplate.h:2543
clang::TemplateParameterList::getMinRequiredArguments
unsigned getMinRequiredArguments() const
Returns the minimum number of arguments needed to form a template specialization.
Definition: DeclTemplate.cpp:130
clang::TemplateTemplateParmDecl::CreateDeserialized
static TemplateTemplateParmDecl * CreateDeserialized(ASTContext &C, unsigned ID)
Definition: DeclTemplate.cpp:844
clang::TypeAliasTemplateDecl::TypeAliasTemplateDecl
TypeAliasTemplateDecl(ASTContext &C, DeclContext *DC, SourceLocation L, DeclarationName Name, TemplateParameterList *Params, NamedDecl *Decl)
Definition: DeclTemplate.h:2547
clang::RedeclarableTemplateDecl::SpecEntryTraits::getTemplateArgs
static ArrayRef< TemplateArgument > getTemplateArgs(EntryType *D)
Definition: DeclTemplate.h:788
clang::ConceptDecl::getCanonicalDecl
const ConceptDecl * getCanonicalDecl() const
Definition: DeclTemplate.h:3306
clang::QualType::getAsOpaquePtr
void * getAsOpaquePtr() const
Definition: Type.h:783
clang::Decl::EmptyShell
A placeholder type used to construct an empty shell of a decl-derived type that will be filled in lat...
Definition: DeclBase.h:99
clang::FunctionTemplateSpecializationInfo::isExplicitInstantiationOrSpecialization
bool isExplicitInstantiationOrSpecialization() const
True if this declaration is an explicit specialization, explicit instantiation declaration,...
Definition: DeclTemplate.h:550
clang::FunctionTemplateSpecializationInfo::getTemplateSpecializationKind
TemplateSpecializationKind getTemplateSpecializationKind() const
Determine what kind of template specialization this is.
Definition: DeclTemplate.h:539
clang::VarTemplateDecl::spec_begin
spec_iterator spec_begin() const
Definition: DeclTemplate.h:3261
clang::ClassTemplateSpecializationDecl::isExplicitInstantiationOrSpecialization
bool isExplicitInstantiationOrSpecialization() const
True if this declaration is an explicit specialization, explicit instantiation declaration,...
Definition: DeclTemplate.h:1949
clang::FunctionTemplateDecl::classofKind
static bool classofKind(Kind K)
Definition: DeclTemplate.h:1141
clang::ClassTemplateDecl::getInjectedClassNameSpecialization
QualType getInjectedClassNameSpecialization()
Retrieve the template specialization type of the injected-class-name for this class template.
Definition: DeclTemplate.cpp:614
clang::FunctionTemplateDecl::getMostRecentDecl
FunctionTemplateDecl * getMostRecentDecl()
Definition: DeclTemplate.h:1086
clang::APValue
APValue - This class implements a discriminated union of [uninitialized] [APSInt] [APFloat],...
Definition: APValue.h:122
clang::ConceptDecl::CreateDeserialized
static ConceptDecl * CreateDeserialized(ASTContext &C, unsigned ID)
Definition: DeclTemplate.cpp:1044
clang::isTemplateInstantiation
bool isTemplateInstantiation(TemplateSpecializationKind Kind)
Determine whether this template specialization kind refers to an instantiation of an entity (as oppos...
Definition: Specifiers.h:200
clang::TemplateDecl::init
void init(NamedDecl *NewTemplatedDecl)
Initialize the underlying templated declaration.
Definition: DeclTemplate.h:466
clang::ASTTemplateArgumentListInfo
Represents an explicit template argument list in C++, e.g., the "<int>" in "sort<int>".
Definition: TemplateBase.h:639
clang::DependentFunctionTemplateSpecializationInfo::getLAngleLoc
SourceLocation getLAngleLoc() const
Definition: DeclTemplate.h:752
clang::DefaultArgStorage::getInheritedFrom
const ParmDecl * getInheritedFrom() const
Get the parameter from which we inherit the default argument, if any.
Definition: DeclTemplate.h:359
llvm::SmallVectorImpl
Definition: Randstruct.h:18
clang::TemplateParameterList::containsUnexpandedParameterPack
bool containsUnexpandedParameterPack() const
Determine whether this template parameter list contains an unexpanded parameter pack.
Definition: DeclTemplate.cpp:94
clang::TypeAliasDecl
Represents the declaration of a typedef-name via a C++11 alias-declaration.
Definition: Decl.h:3410
clang::ValueDecl::getType
QualType getType() const
Definition: Decl.h:714
true
#define true
Definition: stdbool.h:21
clang::MemberSpecializationInfo::getTemplateSpecializationKind
TemplateSpecializationKind getTemplateSpecializationKind() const
Determine what kind of template specialization this is.
Definition: DeclTemplate.h:651
clang::VarTemplateDecl
Declaration of a variable template.
Definition: DeclTemplate.h:3119
clang::RedeclarableTemplateDecl::isMemberSpecialization
bool isMemberSpecialization() const
Determines whether this template was a specialization of a member template.
Definition: DeclTemplate.h:908
clang::NonTypeTemplateParmDecl::setDefaultArgument
void setDefaultArgument(Expr *DefArg)
Set the default argument for this template parameter, and whether that default argument was inherited...
Definition: DeclTemplate.h:1503
clang::Expr
This represents one expression.
Definition: Expr.h:110
clang::ASTDeclReader
Definition: ASTReaderDecl.cpp:81
clang::NonTypeTemplateParmDecl::getDefaultArgumentLoc
SourceLocation getDefaultArgumentLoc() const
Retrieve the location of the default argument, if any.
Definition: DeclTemplate.cpp:799
clang::TemplateParamObjectDecl::classof
static bool classof(const Decl *D)
Definition: DeclTemplate.h:3420
clang::FunctionTemplateDecl::CreateDeserialized
static FunctionTemplateDecl * CreateDeserialized(ASTContext &C, unsigned ID)
Create an empty function template node.
Definition: DeclTemplate.cpp:387
clang::TemplateParamObjectDecl::getValue
const APValue & getValue() const
Definition: DeclTemplate.h:3402
clang::TypeAliasTemplateDecl::newCommon
CommonBase * newCommon(ASTContext &C) const override
Definition: DeclTemplate.cpp:1195
clang::ClassTemplateDecl::getCanonicalDecl
const ClassTemplateDecl * getCanonicalDecl() const
Definition: DeclTemplate.h:2351
clang::FriendTemplateDecl::getNumTemplateParameters
unsigned getNumTemplateParameters() const
Definition: DeclTemplate.h:2528
clang::DeclarationNameInfo
DeclarationNameInfo - A collector data type for bundling together a DeclarationName and the correspnd...
Definition: DeclarationName.h:767
clang::ClassScopeFunctionSpecializationDecl::classofKind
static bool classofKind(Kind K)
Definition: DeclTemplate.h:2669
clang::ClassTemplateSpecializationDecl
Represents a class template specialization, which refers to a class template with a given set of temp...
Definition: DeclTemplate.h:1826
clang::BuiltinTemplateDecl::classof
static bool classof(const Decl *D)
Definition: DeclTemplate.h:1797
clang::ASTDeclWriter
Definition: ASTWriterDecl.cpp:35
clang::FunctionTemplateDecl::spec_begin
spec_iterator spec_begin() const
Definition: DeclTemplate.h:1107
clang::TemplateParmPosition::Position
unsigned Position
Definition: DeclTemplate.h:1161
clang::ClassTemplatePartialSpecializationDecl::setInstantiatedFromMember
void setInstantiatedFromMember(ClassTemplatePartialSpecializationDecl *PartialSpec)
Definition: DeclTemplate.h:2208
clang::ClassTemplatePartialSpecializationDecl::hasAssociatedConstraints
bool hasAssociatedConstraints() const
Definition: DeclTemplate.h:2169
clang::Decl::getLocation
SourceLocation getLocation() const
Definition: DeclBase.h:432
clang::VarTemplateSpecializationDecl::Profile
static void Profile(llvm::FoldingSetNodeID &ID, ArrayRef< TemplateArgument > TemplateArgs, ASTContext &Context)
Definition: DeclTemplate.h:2941
clang::TemplateDecl::isTypeAlias
bool isTypeAlias() const
Definition: DeclTemplate.cpp:253
clang::ClassTemplateSpecializationDecl::setSpecializedTemplate
void setSpecializedTemplate(ClassTemplateDecl *Specialized)
Definition: DeclTemplate.h:1954
clang::TemplateArgumentList::size
unsigned size() const
Retrieve the number of template arguments in this template argument list.
Definition: DeclTemplate.h:296
clang::BuiltinTemplateKind
BuiltinTemplateKind
Kinds of BuiltinTemplateDecl.
Definition: Builtins.h:302
clang::FunctionDecl
Represents a function declaration or definition.
Definition: Decl.h:1917
clang::TemplateTypeParmDecl::getDepth
unsigned getDepth() const
Retrieve the depth of the template parameter.
Definition: DeclTemplate.cpp:689
clang::TemplateParameter
llvm::PointerUnion< TemplateTypeParmDecl *, NonTypeTemplateParmDecl *, TemplateTemplateParmDecl * > TemplateParameter
Stores a template parameter of any kind.
Definition: DeclTemplate.h:65
clang::DefaultArgStorage::setInherited
void setInherited(const ASTContext &C, ParmDecl *InheritedFrom)
Set that the default argument was inherited from another parameter.
Definition: DeclTemplate.h:374
clang::MemberSpecializationInfo::setPointOfInstantiation
void setPointOfInstantiation(SourceLocation POI)
Set the first point of instantiation.
Definition: DeclTemplate.h:674
clang::VarTemplateSpecializationDecl::VarTemplateSpecializationDecl
VarTemplateSpecializationDecl(Kind DK, ASTContext &Context, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, VarTemplateDecl *SpecializedTemplate, QualType T, TypeSourceInfo *TInfo, StorageClass S, ArrayRef< TemplateArgument > Args)
Definition: DeclTemplate.cpp:1337
clang::TypeConstraint
Definition: ASTConcept.h:180
clang::VarTemplateSpecializationDecl::getSpecializationKind
TemplateSpecializationKind getSpecializationKind() const
Determine the kind of specialization that this declaration represents.
Definition: DeclTemplate.h:2790
clang::VarTemplateDecl::findPartialSpecialization
VarTemplatePartialSpecializationDecl * findPartialSpecialization(ArrayRef< TemplateArgument > Args, TemplateParameterList *TPL, void *&InsertPos)
Return the partial specialization with the provided arguments if it exists, otherwise return the inse...
Definition: DeclTemplate.cpp:1280
clang::ClassTemplateDecl::AddPartialSpecialization
void AddPartialSpecialization(ClassTemplatePartialSpecializationDecl *D, void *InsertPos)
Insert the specified partial specialization knowing that it is not already in.
Definition: DeclTemplate.cpp:563
clang::TemplateParameterList::numTrailingObjects
size_t numTrailingObjects(OverloadToken< Expr * >) const
Definition: DeclTemplate.h:104
clang::ClassScopeFunctionSpecializationDecl::Create
static ClassScopeFunctionSpecializationDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation Loc, CXXMethodDecl *FD, bool HasExplicitTemplateArgs, const TemplateArgumentListInfo &TemplateArgs)
Definition: DeclTemplate.h:2653
clang::VarTemplateSpecializationDecl::getTypeAsWritten
TypeSourceInfo * getTypeAsWritten() const
Gets the type of this specialization as it was written by the user, if it was so written.
Definition: DeclTemplate.h:2901
clang::NonTypeTemplateParmDecl::getAssociatedConstraints
void getAssociatedConstraints(llvm::SmallVectorImpl< const Expr * > &AC) const
Get the associated-constraints of this template parameter.
Definition: DeclTemplate.h:1607
clang::RedeclarableTemplateDecl::getInjectedTemplateArgs
ArrayRef< TemplateArgument > getInjectedTemplateArgs()
Retrieve the "injected" template arguments that correspond to the template parameters of this templat...
Definition: DeclTemplate.cpp:356
clang::FunctionTemplateSpecializationInfo::PointOfInstantiation
SourceLocation PointOfInstantiation
The point at which this function template specialization was first instantiated.
Definition: DeclTemplate.h:502
clang::FunctionTemplateSpecializationInfo::getMemberSpecializationInfo
MemberSpecializationInfo * getMemberSpecializationInfo() const
Get the specialization info if this function template specialization is also a member specialization:
Definition: DeclTemplate.h:607
clang::TemplateTemplateParmDecl::isParameterPack
bool isParameterPack() const
Whether this template template parameter is a template parameter pack.
Definition: DeclTemplate.h:1693
clang::VarTemplateDecl::classofKind
static bool classofKind(Kind K)
Definition: DeclTemplate.h:3271
clang::getAsTypeTemplateDecl
TemplateDecl * getAsTypeTemplateDecl(Decl *D)
Definition: DeclTemplate.h:3432
clang::VarTemplateDecl::CreateDeserialized
static VarTemplateDecl * CreateDeserialized(ASTContext &C, unsigned ID)
Create an empty variable template node.
Definition: DeclTemplate.cpp:1239
clang::CXXMethodDecl
Represents a static or instance method of a struct/union/class.
Definition: DeclCXX.h:1995
clang::VarTemplatePartialSpecializationDecl::setInstantiatedFromMember
void setInstantiatedFromMember(VarTemplatePartialSpecializationDecl *PartialSpec)
Definition: DeclTemplate.h:3059
clang::StorageClass
StorageClass
Storage classes.
Definition: Specifiers.h:236