clang  9.0.0svn
Template.h
Go to the documentation of this file.
1 //===- SemaTemplate.h - 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 // This file provides types used in the semantic analysis of C++ templates.
9 //
10 //===----------------------------------------------------------------------===//
11 
12 #ifndef LLVM_CLANG_SEMA_TEMPLATE_H
13 #define LLVM_CLANG_SEMA_TEMPLATE_H
14 
15 #include "clang/AST/DeclTemplate.h"
16 #include "clang/AST/DeclVisitor.h"
17 #include "clang/AST/TemplateBase.h"
18 #include "clang/AST/Type.h"
19 #include "clang/Basic/LLVM.h"
20 #include "clang/Sema/Sema.h"
21 #include "llvm/ADT/ArrayRef.h"
22 #include "llvm/ADT/DenseMap.h"
23 #include "llvm/ADT/PointerUnion.h"
24 #include "llvm/ADT/SmallVector.h"
25 #include <cassert>
26 #include <utility>
27 
28 namespace clang {
29 
30 class ASTContext;
31 class BindingDecl;
32 class CXXMethodDecl;
33 class Decl;
34 class DeclaratorDecl;
35 class DeclContext;
36 class EnumDecl;
37 class FunctionDecl;
38 class NamedDecl;
39 class ParmVarDecl;
40 class TagDecl;
41 class TypedefNameDecl;
42 class TypeSourceInfo;
43 class VarDecl;
44 
45  /// Data structure that captures multiple levels of template argument
46  /// lists for use in template instantiation.
47  ///
48  /// Multiple levels of template arguments occur when instantiating the
49  /// definitions of member templates. For example:
50  ///
51  /// \code
52  /// template<typename T>
53  /// struct X {
54  /// template<T Value>
55  /// struct Y {
56  /// void f();
57  /// };
58  /// };
59  /// \endcode
60  ///
61  /// When instantiating X<int>::Y<17>::f, the multi-level template argument
62  /// list will contain a template argument list (int) at depth 0 and a
63  /// template argument list (17) at depth 1.
65  /// The template argument list at a certain template depth
67 
68  /// The template argument lists, stored from the innermost template
69  /// argument list (first) to the outermost template argument list (last).
70  SmallVector<ArgList, 4> TemplateArgumentLists;
71 
72  /// The number of outer levels of template arguments that are not
73  /// being substituted.
74  unsigned NumRetainedOuterLevels = 0;
75 
76  public:
77  /// Construct an empty set of template argument lists.
79 
80  /// Construct a single-level template argument list.
81  explicit
83  addOuterTemplateArguments(&TemplateArgs);
84  }
85 
86  /// Determine the number of levels in this template argument
87  /// list.
88  unsigned getNumLevels() const {
89  return TemplateArgumentLists.size() + NumRetainedOuterLevels;
90  }
91 
92  /// Determine the number of substituted levels in this template
93  /// argument list.
94  unsigned getNumSubstitutedLevels() const {
95  return TemplateArgumentLists.size();
96  }
97 
98  /// Retrieve the template argument at a given depth and index.
99  const TemplateArgument &operator()(unsigned Depth, unsigned Index) const {
100  assert(NumRetainedOuterLevels <= Depth && Depth < getNumLevels());
101  assert(Index < TemplateArgumentLists[getNumLevels() - Depth - 1].size());
102  return TemplateArgumentLists[getNumLevels() - Depth - 1][Index];
103  }
104 
105  /// Determine whether there is a non-NULL template argument at the
106  /// given depth and index.
107  ///
108  /// There must exist a template argument list at the given depth.
109  bool hasTemplateArgument(unsigned Depth, unsigned Index) const {
110  assert(Depth < getNumLevels());
111 
112  if (Depth < NumRetainedOuterLevels)
113  return false;
114 
115  if (Index >= TemplateArgumentLists[getNumLevels() - Depth - 1].size())
116  return false;
117 
118  return !(*this)(Depth, Index).isNull();
119  }
120 
121  /// Clear out a specific template argument.
122  void setArgument(unsigned Depth, unsigned Index,
123  TemplateArgument Arg) {
124  assert(NumRetainedOuterLevels <= Depth && Depth < getNumLevels());
125  assert(Index < TemplateArgumentLists[getNumLevels() - Depth - 1].size());
126  const_cast<TemplateArgument&>(
127  TemplateArgumentLists[getNumLevels() - Depth - 1][Index])
128  = Arg;
129  }
130 
131  /// Add a new outermost level to the multi-level template argument
132  /// list.
134  addOuterTemplateArguments(ArgList(TemplateArgs->data(),
135  TemplateArgs->size()));
136  }
137 
138  /// Add a new outmost level to the multi-level template argument
139  /// list.
141  assert(!NumRetainedOuterLevels &&
142  "substituted args outside retained args?");
143  TemplateArgumentLists.push_back(Args);
144  }
145 
146  /// Add an outermost level that we are not substituting. We have no
147  /// arguments at this level, and do not remove it from the depth of inner
148  /// template parameters that we instantiate.
150  ++NumRetainedOuterLevels;
151  }
152 
153  /// Retrieve the innermost template argument list.
154  const ArgList &getInnermost() const {
155  return TemplateArgumentLists.front();
156  }
157  };
158 
159  /// The context in which partial ordering of function templates occurs.
160  enum TPOC {
161  /// Partial ordering of function templates for a function call.
163 
164  /// Partial ordering of function templates for a call to a
165  /// conversion function.
167 
168  /// Partial ordering of function templates in other contexts, e.g.,
169  /// taking the address of a function template or matching a function
170  /// template specialization to a function template.
172  };
173 
174  // This is lame but unavoidable in a world without forward
175  // declarations of enums. The alternatives are to either pollute
176  // Sema.h (by including this file) or sacrifice type safety (by
177  // making Sema.h declare things as enums).
179  TPOC Value;
180 
181  public:
182  TemplatePartialOrderingContext(TPOC Value) : Value(Value) {}
183 
184  operator TPOC() const { return Value; }
185  };
186 
187  /// Captures a template argument whose value has been deduced
188  /// via c++ template argument deduction.
190  /// For a non-type template argument, whether the value was
191  /// deduced from an array bound.
192  bool DeducedFromArrayBound = false;
193 
194  public:
195  DeducedTemplateArgument() = default;
196 
198  bool DeducedFromArrayBound = false)
199  : TemplateArgument(Arg), DeducedFromArrayBound(DeducedFromArrayBound) {}
200 
201  /// Construct an integral non-type template argument that
202  /// has been deduced, possibly from an array bound.
204  const llvm::APSInt &Value,
205  QualType ValueType,
206  bool DeducedFromArrayBound)
207  : TemplateArgument(Ctx, Value, ValueType),
208  DeducedFromArrayBound(DeducedFromArrayBound) {}
209 
210  /// For a non-type template argument, determine whether the
211  /// template argument was deduced from an array bound.
212  bool wasDeducedFromArrayBound() const { return DeducedFromArrayBound; }
213 
214  /// Specify whether the given non-type template argument
215  /// was deduced from an array bound.
216  void setDeducedFromArrayBound(bool Deduced) {
217  DeducedFromArrayBound = Deduced;
218  }
219  };
220 
221  /// A stack-allocated class that identifies which local
222  /// variable declaration instantiations are present in this scope.
223  ///
224  /// A new instance of this class type will be created whenever we
225  /// instantiate a new function declaration, which will have its own
226  /// set of parameter declarations.
228  public:
229  /// A set of declarations.
231 
232  private:
233  /// Reference to the semantic analysis that is performing
234  /// this template instantiation.
235  Sema &SemaRef;
236 
237  using LocalDeclsMap =
238  llvm::SmallDenseMap<const Decl *,
239  llvm::PointerUnion<Decl *, DeclArgumentPack *>, 4>;
240 
241  /// A mapping from local declarations that occur
242  /// within a template to their instantiations.
243  ///
244  /// This mapping is used during instantiation to keep track of,
245  /// e.g., function parameter and variable declarations. For example,
246  /// given:
247  ///
248  /// \code
249  /// template<typename T> T add(T x, T y) { return x + y; }
250  /// \endcode
251  ///
252  /// when we instantiate add<int>, we will introduce a mapping from
253  /// the ParmVarDecl for 'x' that occurs in the template to the
254  /// instantiated ParmVarDecl for 'x'.
255  ///
256  /// For a parameter pack, the local instantiation scope may contain a
257  /// set of instantiated parameters. This is stored as a DeclArgumentPack
258  /// pointer.
259  LocalDeclsMap LocalDecls;
260 
261  /// The set of argument packs we've allocated.
263 
264  /// The outer scope, which contains local variable
265  /// definitions from some other instantiation (that may not be
266  /// relevant to this particular scope).
268 
269  /// Whether we have already exited this scope.
270  bool Exited = false;
271 
272  /// Whether to combine this scope with the outer scope, such that
273  /// lookup will search our outer scope.
274  bool CombineWithOuterScope;
275 
276  /// If non-NULL, the template parameter pack that has been
277  /// partially substituted per C++0x [temp.arg.explicit]p9.
278  NamedDecl *PartiallySubstitutedPack = nullptr;
279 
280  /// If \c PartiallySubstitutedPack is non-null, the set of
281  /// explicitly-specified template arguments in that pack.
282  const TemplateArgument *ArgsInPartiallySubstitutedPack;
283 
284  /// If \c PartiallySubstitutedPack, the number of
285  /// explicitly-specified template arguments in
286  /// ArgsInPartiallySubstitutedPack.
287  unsigned NumArgsInPartiallySubstitutedPack;
288 
289  public:
290  LocalInstantiationScope(Sema &SemaRef, bool CombineWithOuterScope = false)
291  : SemaRef(SemaRef), Outer(SemaRef.CurrentInstantiationScope),
292  CombineWithOuterScope(CombineWithOuterScope) {
293  SemaRef.CurrentInstantiationScope = this;
294  }
295 
298  operator=(const LocalInstantiationScope &) = delete;
299 
301  Exit();
302  }
303 
304  const Sema &getSema() const { return SemaRef; }
305 
306  /// Exit this local instantiation scope early.
307  void Exit() {
308  if (Exited)
309  return;
310 
311  for (unsigned I = 0, N = ArgumentPacks.size(); I != N; ++I)
312  delete ArgumentPacks[I];
313 
314  SemaRef.CurrentInstantiationScope = Outer;
315  Exited = true;
316  }
317 
318  /// Clone this scope, and all outer scopes, down to the given
319  /// outermost scope.
321  if (this == Outermost) return this;
322 
323  // Save the current scope from SemaRef since the LocalInstantiationScope
324  // will overwrite it on construction
326 
327  LocalInstantiationScope *newScope =
328  new LocalInstantiationScope(SemaRef, CombineWithOuterScope);
329 
330  newScope->Outer = nullptr;
331  if (Outer)
332  newScope->Outer = Outer->cloneScopes(Outermost);
333 
334  newScope->PartiallySubstitutedPack = PartiallySubstitutedPack;
335  newScope->ArgsInPartiallySubstitutedPack = ArgsInPartiallySubstitutedPack;
336  newScope->NumArgsInPartiallySubstitutedPack =
337  NumArgsInPartiallySubstitutedPack;
338 
339  for (LocalDeclsMap::iterator I = LocalDecls.begin(), E = LocalDecls.end();
340  I != E; ++I) {
341  const Decl *D = I->first;
342  llvm::PointerUnion<Decl *, DeclArgumentPack *> &Stored =
343  newScope->LocalDecls[D];
344  if (I->second.is<Decl *>()) {
345  Stored = I->second.get<Decl *>();
346  } else {
347  DeclArgumentPack *OldPack = I->second.get<DeclArgumentPack *>();
348  DeclArgumentPack *NewPack = new DeclArgumentPack(*OldPack);
349  Stored = NewPack;
350  newScope->ArgumentPacks.push_back(NewPack);
351  }
352  }
353  // Restore the saved scope to SemaRef
354  SemaRef.CurrentInstantiationScope = oldScope;
355  return newScope;
356  }
357 
358  /// deletes the given scope, and all otuer scopes, down to the
359  /// given outermost scope.
361  LocalInstantiationScope *Outermost) {
362  while (Scope && Scope != Outermost) {
363  LocalInstantiationScope *Out = Scope->Outer;
364  delete Scope;
365  Scope = Out;
366  }
367  }
368 
369  /// Find the instantiation of the declaration D within the current
370  /// instantiation scope.
371  ///
372  /// \param D The declaration whose instantiation we are searching for.
373  ///
374  /// \returns A pointer to the declaration or argument pack of declarations
375  /// to which the declaration \c D is instantiated, if found. Otherwise,
376  /// returns NULL.
377  llvm::PointerUnion<Decl *, DeclArgumentPack *> *
378  findInstantiationOf(const Decl *D);
379 
380  void InstantiatedLocal(const Decl *D, Decl *Inst);
381  void InstantiatedLocalPackArg(const Decl *D, VarDecl *Inst);
382  void MakeInstantiatedLocalArgPack(const Decl *D);
383 
384  /// Note that the given parameter pack has been partially substituted
385  /// via explicit specification of template arguments
386  /// (C++0x [temp.arg.explicit]p9).
387  ///
388  /// \param Pack The parameter pack, which will always be a template
389  /// parameter pack.
390  ///
391  /// \param ExplicitArgs The explicitly-specified template arguments provided
392  /// for this parameter pack.
393  ///
394  /// \param NumExplicitArgs The number of explicitly-specified template
395  /// arguments provided for this parameter pack.
396  void SetPartiallySubstitutedPack(NamedDecl *Pack,
397  const TemplateArgument *ExplicitArgs,
398  unsigned NumExplicitArgs);
399 
400  /// Reset the partially-substituted pack when it is no longer of
401  /// interest.
403  assert(PartiallySubstitutedPack && "No partially-substituted pack");
404  PartiallySubstitutedPack = nullptr;
405  ArgsInPartiallySubstitutedPack = nullptr;
406  NumArgsInPartiallySubstitutedPack = 0;
407  }
408 
409  /// Retrieve the partially-substitued template parameter pack.
410  ///
411  /// If there is no partially-substituted parameter pack, returns NULL.
412  NamedDecl *
413  getPartiallySubstitutedPack(const TemplateArgument **ExplicitArgs = nullptr,
414  unsigned *NumExplicitArgs = nullptr) const;
415  };
416 
418  : public DeclVisitor<TemplateDeclInstantiator, Decl *>
419  {
420  Sema &SemaRef;
422  DeclContext *Owner;
423  const MultiLevelTemplateArgumentList &TemplateArgs;
424  Sema::LateInstantiatedAttrVec* LateAttrs = nullptr;
425  LocalInstantiationScope *StartingScope = nullptr;
426 
427  /// A list of out-of-line class template partial
428  /// specializations that will need to be instantiated after the
429  /// enclosing class's instantiation is complete.
430  SmallVector<std::pair<ClassTemplateDecl *,
432  OutOfLinePartialSpecs;
433 
434  /// A list of out-of-line variable template partial
435  /// specializations that will need to be instantiated after the
436  /// enclosing variable's instantiation is complete.
437  /// FIXME: Verify that this is needed.
438  SmallVector<
439  std::pair<VarTemplateDecl *, VarTemplatePartialSpecializationDecl *>, 4>
440  OutOfLineVarPartialSpecs;
441 
442  public:
444  const MultiLevelTemplateArgumentList &TemplateArgs)
445  : SemaRef(SemaRef),
446  SubstIndex(SemaRef, SemaRef.ArgumentPackSubstitutionIndex),
447  Owner(Owner), TemplateArgs(TemplateArgs) {}
448 
449 // Define all the decl visitors using DeclNodes.inc
450 #define DECL(DERIVED, BASE) \
451  Decl *Visit ## DERIVED ## Decl(DERIVED ## Decl *D);
452 #define ABSTRACT_DECL(DECL)
453 
454 // Decls which never appear inside a class or function.
455 #define OBJCCONTAINER(DERIVED, BASE)
456 #define FILESCOPEASM(DERIVED, BASE)
457 #define IMPORT(DERIVED, BASE)
458 #define EXPORT(DERIVED, BASE)
459 #define LINKAGESPEC(DERIVED, BASE)
460 #define OBJCCOMPATIBLEALIAS(DERIVED, BASE)
461 #define OBJCMETHOD(DERIVED, BASE)
462 #define OBJCTYPEPARAM(DERIVED, BASE)
463 #define OBJCIVAR(DERIVED, BASE)
464 #define OBJCPROPERTY(DERIVED, BASE)
465 #define OBJCPROPERTYIMPL(DERIVED, BASE)
466 #define EMPTY(DERIVED, BASE)
467 
468 // Decls which use special-case instantiation code.
469 #define BLOCK(DERIVED, BASE)
470 #define CAPTURED(DERIVED, BASE)
471 #define IMPLICITPARAM(DERIVED, BASE)
472 
473 #include "clang/AST/DeclNodes.inc"
474 
475  // A few supplemental visitor functions.
476  Decl *VisitCXXMethodDecl(CXXMethodDecl *D,
477  TemplateParameterList *TemplateParams,
478  Optional<const ASTTemplateArgumentListInfo *>
479  ClassScopeSpecializationArgs = llvm::None);
480  Decl *VisitFunctionDecl(FunctionDecl *D,
481  TemplateParameterList *TemplateParams);
482  Decl *VisitDecl(Decl *D);
483  Decl *VisitVarDecl(VarDecl *D, bool InstantiatingVarTemplate,
484  ArrayRef<BindingDecl *> *Bindings = nullptr);
485 
486  // Enable late instantiation of attributes. Late instantiated attributes
487  // will be stored in LA.
489  LateAttrs = LA;
490  StartingScope = SemaRef.CurrentInstantiationScope;
491  }
492 
493  // Disable late instantiation of attributes.
495  LateAttrs = nullptr;
496  StartingScope = nullptr;
497  }
498 
499  LocalInstantiationScope *getStartingScope() const { return StartingScope; }
500 
502  ClassTemplateDecl *, ClassTemplatePartialSpecializationDecl *>>::iterator;
503 
506 
507  /// Return an iterator to the beginning of the set of
508  /// "delayed" partial specializations, which must be passed to
509  /// InstantiateClassTemplatePartialSpecialization once the class
510  /// definition has been completed.
512  return OutOfLinePartialSpecs.begin();
513  }
514 
516  return OutOfLineVarPartialSpecs.begin();
517  }
518 
519  /// Return an iterator to the end of the set of
520  /// "delayed" partial specializations, which must be passed to
521  /// InstantiateClassTemplatePartialSpecialization once the class
522  /// definition has been completed.
524  return OutOfLinePartialSpecs.end();
525  }
526 
528  return OutOfLineVarPartialSpecs.end();
529  }
530 
531  // Helper functions for instantiating methods.
532  TypeSourceInfo *SubstFunctionType(FunctionDecl *D,
534  bool InitFunctionInstantiation(FunctionDecl *New, FunctionDecl *Tmpl);
535  bool InitMethodInstantiation(CXXMethodDecl *New, CXXMethodDecl *Tmpl);
536 
538  SubstTemplateParams(TemplateParameterList *List);
539 
540  bool SubstQualifier(const DeclaratorDecl *OldDecl,
541  DeclaratorDecl *NewDecl);
542  bool SubstQualifier(const TagDecl *OldDecl,
543  TagDecl *NewDecl);
544 
545  Decl *VisitVarTemplateSpecializationDecl(
546  VarTemplateDecl *VarTemplate, VarDecl *FromVar, void *InsertPos,
547  const TemplateArgumentListInfo &TemplateArgsInfo,
548  ArrayRef<TemplateArgument> Converted,
549  VarTemplateSpecializationDecl *PrevDecl = nullptr);
550 
551  Decl *InstantiateTypedefNameDecl(TypedefNameDecl *D, bool IsTypeAlias);
552  ClassTemplatePartialSpecializationDecl *
553  InstantiateClassTemplatePartialSpecialization(
554  ClassTemplateDecl *ClassTemplate,
555  ClassTemplatePartialSpecializationDecl *PartialSpec);
557  InstantiateVarTemplatePartialSpecialization(
558  VarTemplateDecl *VarTemplate,
560  void InstantiateEnumDefinition(EnumDecl *Enum, EnumDecl *Pattern);
561 
562  private:
563  template<typename T>
564  Decl *instantiateUnresolvedUsingDecl(T *D,
565  bool InstantiatingPackElement = false);
566  };
567 
568 } // namespace clang
569 
570 #endif // LLVM_CLANG_SEMA_TEMPLATE_H
DeducedTemplateArgument(ASTContext &Ctx, const llvm::APSInt &Value, QualType ValueType, bool DeducedFromArrayBound)
Construct an integral non-type template argument that has been deduced, possibly from an array bound...
Definition: Template.h:203
Represents a function declaration or definition.
Definition: Decl.h:1748
delayed_var_partial_spec_iterator delayed_var_partial_spec_begin()
Definition: Template.h:515
A (possibly-)qualified type.
Definition: Type.h:643
A stack-allocated class that identifies which local variable declaration instantiations are present i...
Definition: Template.h:227
void addOuterTemplateArguments(const TemplateArgumentList *TemplateArgs)
Add a new outermost level to the multi-level template argument list.
Definition: Template.h:133
C Language Family Type Representation.
unsigned size() const
Retrieve the number of template arguments in this template argument list.
Definition: DeclTemplate.h:274
Decl - This represents one declaration (or definition), e.g.
Definition: DeclBase.h:88
Defines the C++ template declaration subclasses.
Declaration of a variable template.
The l-value was an access to a declared entity or something equivalently strong, like the address of ...
A container of type source information.
Definition: Decl.h:86
TemplateDeclInstantiator(Sema &SemaRef, DeclContext *Owner, const MultiLevelTemplateArgumentList &TemplateArgs)
Definition: Template.h:443
Partial ordering of function templates for a call to a conversion function.
Definition: Template.h:166
LocalInstantiationScope * getStartingScope() const
Definition: Template.h:499
Represents a variable declaration or definition.
Definition: Decl.h:812
const Sema & getSema() const
Definition: Template.h:304
Represents a variable template specialization, which refers to a variable template with a given set o...
Stores a list of template parameters for a TemplateDecl and its derived classes.
Definition: DeclTemplate.h:67
LocalInstantiationScope * CurrentInstantiationScope
The current instantiation scope used to store local variables.
Definition: Sema.h:7852
void setDeducedFromArrayBound(bool Deduced)
Specify whether the given non-type template argument was deduced from an array bound.
Definition: Template.h:216
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Definition: ASTContext.h:154
void setArgument(unsigned Depth, unsigned Index, TemplateArgument Arg)
Clear out a specific template argument.
Definition: Template.h:122
void Exit()
Exit this local instantiation scope early.
Definition: Template.h:307
delayed_var_partial_spec_iterator delayed_var_partial_spec_end()
Definition: Template.h:527
A convenient class for passing around template argument information.
Definition: TemplateBase.h:554
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified...
Scope - A scope is a transient data structure that is used while parsing the program.
Definition: Scope.h:40
const TemplateArgument * data() const
Retrieve a pointer to the template argument list.
Definition: DeclTemplate.h:277
DeducedTemplateArgument(const TemplateArgument &Arg, bool DeducedFromArrayBound=false)
Definition: Template.h:197
RAII object used to change the argument pack substitution index within a Sema object.
Definition: Sema.h:7593
Sema - This implements semantic analysis and AST building for C.
Definition: Sema.h:328
Represents a ValueDecl that came out of a declarator.
Definition: Decl.h:688
unsigned getNumSubstitutedLevels() const
Determine the number of substituted levels in this template argument list.
Definition: Template.h:94
void addOuterRetainedLevel()
Add an outermost level that we are not substituting.
Definition: Template.h:149
const ArgList & getInnermost() const
Retrieve the innermost template argument list.
Definition: Template.h:154
delayed_partial_spec_iterator delayed_partial_spec_begin()
Return an iterator to the beginning of the set of "delayed" partial specializations, which must be passed to InstantiateClassTemplatePartialSpecialization once the class definition has been completed.
Definition: Template.h:511
int Depth
Definition: ASTDiff.cpp:190
Data structure that captures multiple levels of template argument lists for use in template instantia...
Definition: Template.h:64
Captures a template argument whose value has been deduced via c++ template argument deduction...
Definition: Template.h:189
static void deleteScopes(LocalInstantiationScope *Scope, LocalInstantiationScope *Outermost)
deletes the given scope, and all otuer scopes, down to the given outermost scope. ...
Definition: Template.h:360
const TemplateArgument & operator()(unsigned Depth, unsigned Index) const
Retrieve the template argument at a given depth and index.
Definition: Template.h:99
void ResetPartiallySubstitutedPack()
Reset the partially-substituted pack when it is no longer of interest.
Definition: Template.h:402
Represents the declaration of a struct/union/class/enum.
Definition: Decl.h:3090
Represents a static or instance method of a struct/union/class.
Definition: DeclCXX.h:2109
MultiLevelTemplateArgumentList()=default
Construct an empty set of template argument lists.
A simple visitor class that helps create declaration visitors.
Definition: DeclVisitor.h:66
bool hasTemplateArgument(unsigned Depth, unsigned Index) const
Determine whether there is a non-NULL template argument at the given depth and index.
Definition: Template.h:109
Base class for declarations which introduce a typedef-name.
Definition: Decl.h:2942
Represents a template argument.
Definition: TemplateBase.h:50
Dataflow Directional Tag Classes.
LocalInstantiationScope * cloneScopes(LocalInstantiationScope *Outermost)
Clone this scope, and all outer scopes, down to the given outermost scope.
Definition: Template.h:320
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
Definition: DeclBase.h:1271
delayed_partial_spec_iterator delayed_partial_spec_end()
Return an iterator to the end of the set of "delayed" partial specializations, which must be passed t...
Definition: Template.h:523
static NamedDecl * findInstantiationOf(ASTContext &Ctx, NamedDecl *D, ForwardIterator first, ForwardIterator last)
Represents an enum.
Definition: Decl.h:3352
MultiLevelTemplateArgumentList(const TemplateArgumentList &TemplateArgs)
Construct a single-level template argument list.
Definition: Template.h:82
bool wasDeducedFromArrayBound() const
For a non-type template argument, determine whether the template argument was deduced from an array b...
Definition: Template.h:212
void addOuterTemplateArguments(ArgList Args)
Add a new outmost level to the multi-level template argument list.
Definition: Template.h:140
LocalInstantiationScope(Sema &SemaRef, bool CombineWithOuterScope=false)
Definition: Template.h:290
static bool SubstQualifier(Sema &SemaRef, const DeclT *OldDecl, DeclT *NewDecl, const MultiLevelTemplateArgumentList &TemplateArgs)
unsigned getNumLevels() const
Determine the number of levels in this template argument list.
Definition: Template.h:88
SmallVectorImpl< std::pair< VarTemplateDecl *, VarTemplatePartialSpecializationDecl * > >::iterator delayed_var_partial_spec_iterator
Definition: Template.h:505
A template argument list.
Definition: DeclTemplate.h:214
void enableLateAttributeInstantiation(Sema::LateInstantiatedAttrVec *LA)
Definition: Template.h:488
TPOC
The context in which partial ordering of function templates occurs.
Definition: Template.h:160
SmallVectorImpl< std::pair< ClassTemplateDecl *, ClassTemplatePartialSpecializationDecl * > >::iterator delayed_partial_spec_iterator
Definition: Template.h:502
Declaration of a class template.
Partial ordering of function templates for a function call.
Definition: Template.h:162
This represents a decl that may have a name.
Definition: Decl.h:248
Partial ordering of function templates in other contexts, e.g., taking the address of a function temp...
Definition: Template.h:171