clang  6.0.0svn
TemplateBase.cpp
Go to the documentation of this file.
1 //===--- TemplateBase.cpp - Common template AST class implementation ------===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file implements common classes used throughout C++ template
11 // representations.
12 //
13 //===----------------------------------------------------------------------===//
14 
15 #include "clang/AST/TemplateBase.h"
16 #include "clang/AST/ASTContext.h"
17 #include "clang/AST/DeclBase.h"
18 #include "clang/AST/DeclTemplate.h"
19 #include "clang/AST/Expr.h"
20 #include "clang/AST/ExprCXX.h"
21 #include "clang/AST/Type.h"
22 #include "clang/AST/TypeLoc.h"
23 #include "clang/Basic/Diagnostic.h"
24 #include "llvm/ADT/FoldingSet.h"
25 #include "llvm/ADT/SmallString.h"
26 #include "llvm/Support/raw_ostream.h"
27 #include <algorithm>
28 
29 using namespace clang;
30 
31 /// \brief Print a template integral argument value.
32 ///
33 /// \param TemplArg the TemplateArgument instance to print.
34 ///
35 /// \param Out the raw_ostream instance to use for printing.
36 ///
37 /// \param Policy the printing policy for EnumConstantDecl printing.
38 static void printIntegral(const TemplateArgument &TemplArg,
39  raw_ostream &Out, const PrintingPolicy& Policy) {
40  const ::clang::Type *T = TemplArg.getIntegralType().getTypePtr();
41  const llvm::APSInt &Val = TemplArg.getAsIntegral();
42 
43  if (const EnumType *ET = T->getAs<EnumType>()) {
44  for (const EnumConstantDecl* ECD : ET->getDecl()->enumerators()) {
45  // In Sema::CheckTemplateArugment, enum template arguments value are
46  // extended to the size of the integer underlying the enum type. This
47  // may create a size difference between the enum value and template
48  // argument value, requiring isSameValue here instead of operator==.
49  if (llvm::APSInt::isSameValue(ECD->getInitVal(), Val)) {
50  ECD->printQualifiedName(Out, Policy);
51  return;
52  }
53  }
54  }
55 
56  if (T->isBooleanType() && !Policy.MSVCFormatting) {
57  Out << (Val.getBoolValue() ? "true" : "false");
58  } else if (T->isCharType()) {
59  const char Ch = Val.getZExtValue();
60  Out << ((Ch == '\'') ? "'\\" : "'");
61  Out.write_escaped(StringRef(&Ch, 1), /*UseHexEscapes=*/ true);
62  Out << "'";
63  } else {
64  Out << Val;
65  }
66 }
67 
68 //===----------------------------------------------------------------------===//
69 // TemplateArgument Implementation
70 //===----------------------------------------------------------------------===//
71 
73  QualType Type) {
74  Integer.Kind = Integral;
75  // Copy the APSInt value into our decomposed form.
76  Integer.BitWidth = Value.getBitWidth();
77  Integer.IsUnsigned = Value.isUnsigned();
78  // If the value is large, we have to get additional memory from the ASTContext
79  unsigned NumWords = Value.getNumWords();
80  if (NumWords > 1) {
81  void *Mem = Ctx.Allocate(NumWords * sizeof(uint64_t));
82  std::memcpy(Mem, Value.getRawData(), NumWords * sizeof(uint64_t));
83  Integer.pVal = static_cast<uint64_t *>(Mem);
84  } else {
85  Integer.VAL = Value.getZExtValue();
86  }
87 
88  Integer.Type = Type.getAsOpaquePtr();
89 }
90 
94  if (Args.empty())
95  return getEmptyPack();
96 
97  return TemplateArgument(Args.copy(Context));
98 }
99 
101  switch (getKind()) {
102  case Null:
103  llvm_unreachable("Should not have a NULL template argument");
104 
105  case Type:
106  return getAsType()->isDependentType() ||
107  isa<PackExpansionType>(getAsType());
108 
109  case Template:
110  return getAsTemplate().isDependent();
111 
112  case TemplateExpansion:
113  return true;
114 
115  case Declaration:
116  if (DeclContext *DC = dyn_cast<DeclContext>(getAsDecl()))
117  return DC->isDependentContext();
119 
120  case NullPtr:
121  return false;
122 
123  case Integral:
124  // Never dependent
125  return false;
126 
127  case Expression:
128  return (getAsExpr()->isTypeDependent() || getAsExpr()->isValueDependent() ||
129  isa<PackExpansionExpr>(getAsExpr()));
130 
131  case Pack:
132  for (const auto &P : pack_elements())
133  if (P.isDependent())
134  return true;
135  return false;
136  }
137 
138  llvm_unreachable("Invalid TemplateArgument Kind!");
139 }
140 
142  switch (getKind()) {
143  case Null:
144  llvm_unreachable("Should not have a NULL template argument");
145 
146  case Type:
148 
149  case Template:
151 
152  case TemplateExpansion:
153  return true;
154 
155  case Declaration:
156  if (DeclContext *DC = dyn_cast<DeclContext>(getAsDecl()))
157  return DC->isDependentContext();
159 
160  case NullPtr:
161  return false;
162 
163  case Integral:
164  // Never dependent
165  return false;
166 
167  case Expression:
169 
170  case Pack:
171  for (const auto &P : pack_elements())
172  if (P.isInstantiationDependent())
173  return true;
174  return false;
175  }
176 
177  llvm_unreachable("Invalid TemplateArgument Kind!");
178 }
179 
181  switch (getKind()) {
182  case Null:
183  case Declaration:
184  case Integral:
185  case Pack:
186  case Template:
187  case NullPtr:
188  return false;
189 
190  case TemplateExpansion:
191  return true;
192 
193  case Type:
194  return isa<PackExpansionType>(getAsType());
195 
196  case Expression:
197  return isa<PackExpansionExpr>(getAsExpr());
198  }
199 
200  llvm_unreachable("Invalid TemplateArgument Kind!");
201 }
202 
204  switch (getKind()) {
205  case Null:
206  case Declaration:
207  case Integral:
208  case TemplateExpansion:
209  case NullPtr:
210  break;
211 
212  case Type:
214  return true;
215  break;
216 
217  case Template:
219  return true;
220  break;
221 
222  case Expression:
224  return true;
225  break;
226 
227  case Pack:
228  for (const auto &P : pack_elements())
229  if (P.containsUnexpandedParameterPack())
230  return true;
231 
232  break;
233  }
234 
235  return false;
236 }
237 
239  assert(getKind() == TemplateExpansion);
240  if (TemplateArg.NumExpansions)
241  return TemplateArg.NumExpansions - 1;
242 
243  return None;
244 }
245 
247  switch (getKind()) {
253  return QualType();
254 
256  return getIntegralType();
257 
259  return getAsExpr()->getType();
260 
262  return getParamTypeForDecl();
263 
265  return getNullPtrType();
266  }
267 
268  llvm_unreachable("Invalid TemplateArgument Kind!");
269 }
270 
271 void TemplateArgument::Profile(llvm::FoldingSetNodeID &ID,
272  const ASTContext &Context) const {
273  ID.AddInteger(getKind());
274  switch (getKind()) {
275  case Null:
276  break;
277 
278  case Type:
279  getAsType().Profile(ID);
280  break;
281 
282  case NullPtr:
283  getNullPtrType().Profile(ID);
284  break;
285 
286  case Declaration:
287  ID.AddPointer(getAsDecl()? getAsDecl()->getCanonicalDecl() : nullptr);
288  break;
289 
290  case Template:
291  case TemplateExpansion: {
293  if (TemplateTemplateParmDecl *TTP
294  = dyn_cast_or_null<TemplateTemplateParmDecl>(
295  Template.getAsTemplateDecl())) {
296  ID.AddBoolean(true);
297  ID.AddInteger(TTP->getDepth());
298  ID.AddInteger(TTP->getPosition());
299  ID.AddBoolean(TTP->isParameterPack());
300  } else {
301  ID.AddBoolean(false);
302  ID.AddPointer(Context.getCanonicalTemplateName(Template)
303  .getAsVoidPointer());
304  }
305  break;
306  }
307 
308  case Integral:
309  getAsIntegral().Profile(ID);
310  getIntegralType().Profile(ID);
311  break;
312 
313  case Expression:
314  getAsExpr()->Profile(ID, Context, true);
315  break;
316 
317  case Pack:
318  ID.AddInteger(Args.NumArgs);
319  for (unsigned I = 0; I != Args.NumArgs; ++I)
320  Args.Args[I].Profile(ID, Context);
321  }
322 }
323 
325  if (getKind() != Other.getKind()) return false;
326 
327  switch (getKind()) {
328  case Null:
329  case Type:
330  case Expression:
331  case Template:
332  case TemplateExpansion:
333  case NullPtr:
334  return TypeOrValue.V == Other.TypeOrValue.V;
335 
336  case Declaration:
337  return getAsDecl() == Other.getAsDecl();
338 
339  case Integral:
340  return getIntegralType() == Other.getIntegralType() &&
341  getAsIntegral() == Other.getAsIntegral();
342 
343  case Pack:
344  if (Args.NumArgs != Other.Args.NumArgs) return false;
345  for (unsigned I = 0, E = Args.NumArgs; I != E; ++I)
346  if (!Args.Args[I].structurallyEquals(Other.Args.Args[I]))
347  return false;
348  return true;
349  }
350 
351  llvm_unreachable("Invalid TemplateArgument Kind!");
352 }
353 
355  assert(isPackExpansion());
356 
357  switch (getKind()) {
358  case Type:
359  return getAsType()->getAs<PackExpansionType>()->getPattern();
360 
361  case Expression:
362  return cast<PackExpansionExpr>(getAsExpr())->getPattern();
363 
364  case TemplateExpansion:
366 
367  case Declaration:
368  case Integral:
369  case Pack:
370  case Null:
371  case Template:
372  case NullPtr:
373  return TemplateArgument();
374  }
375 
376  llvm_unreachable("Invalid TemplateArgument Kind!");
377 }
378 
380  raw_ostream &Out) const {
381  switch (getKind()) {
382  case Null:
383  Out << "(no value)";
384  break;
385 
386  case Type: {
387  PrintingPolicy SubPolicy(Policy);
388  SubPolicy.SuppressStrongLifetime = true;
389  getAsType().print(Out, SubPolicy);
390  break;
391  }
392 
393  case Declaration: {
394  NamedDecl *ND = cast<NamedDecl>(getAsDecl());
395  Out << '&';
396  if (ND->getDeclName()) {
397  // FIXME: distinguish between pointer and reference args?
398  ND->printQualifiedName(Out);
399  } else {
400  Out << "(anonymous)";
401  }
402  break;
403  }
404 
405  case NullPtr:
406  Out << "nullptr";
407  break;
408 
409  case Template:
410  getAsTemplate().print(Out, Policy);
411  break;
412 
413  case TemplateExpansion:
414  getAsTemplateOrTemplatePattern().print(Out, Policy);
415  Out << "...";
416  break;
417 
418  case Integral: {
419  printIntegral(*this, Out, Policy);
420  break;
421  }
422 
423  case Expression:
424  getAsExpr()->printPretty(Out, nullptr, Policy);
425  break;
426 
427  case Pack:
428  Out << "<";
429  bool First = true;
430  for (const auto &P : pack_elements()) {
431  if (First)
432  First = false;
433  else
434  Out << ", ";
435 
436  P.print(Policy, Out);
437  }
438  Out << ">";
439  break;
440  }
441 }
442 
443 void TemplateArgument::dump(raw_ostream &Out) const {
444  LangOptions LO; // FIXME! see also TemplateName::dump().
445  LO.CPlusPlus = true;
446  LO.Bool = true;
447  print(PrintingPolicy(LO), Out);
448 }
449 
450 LLVM_DUMP_METHOD void TemplateArgument::dump() const { dump(llvm::errs()); }
451 
452 //===----------------------------------------------------------------------===//
453 // TemplateArgumentLoc Implementation
454 //===----------------------------------------------------------------------===//
455 
457  switch (Argument.getKind()) {
459  return getSourceExpression()->getSourceRange();
460 
462  return getSourceDeclExpression()->getSourceRange();
463 
465  return getSourceNullPtrExpression()->getSourceRange();
466 
468  if (TypeSourceInfo *TSI = getTypeSourceInfo())
469  return TSI->getTypeLoc().getSourceRange();
470  else
471  return SourceRange();
472 
474  if (getTemplateQualifierLoc())
475  return SourceRange(getTemplateQualifierLoc().getBeginLoc(),
476  getTemplateNameLoc());
477  return SourceRange(getTemplateNameLoc());
478 
480  if (getTemplateQualifierLoc())
481  return SourceRange(getTemplateQualifierLoc().getBeginLoc(),
482  getTemplateEllipsisLoc());
483  return SourceRange(getTemplateNameLoc(), getTemplateEllipsisLoc());
484 
486  return getSourceIntegralExpression()->getSourceRange();
487 
490  return SourceRange();
491  }
492 
493  llvm_unreachable("Invalid TemplateArgument Kind!");
494 }
495 
497  const TemplateArgument &Arg) {
498  switch (Arg.getKind()) {
500  // This is bad, but not as bad as crashing because of argument
501  // count mismatches.
502  return DB << "(null template argument)";
503 
505  return DB << Arg.getAsType();
506 
508  return DB << Arg.getAsDecl();
509 
511  return DB << "nullptr";
512 
514  return DB << Arg.getAsIntegral().toString(10);
515 
517  return DB << Arg.getAsTemplate();
518 
520  return DB << Arg.getAsTemplateOrTemplatePattern() << "...";
521 
523  // This shouldn't actually ever happen, so it's okay that we're
524  // regurgitating an expression here.
525  // FIXME: We're guessing at LangOptions!
526  SmallString<32> Str;
527  llvm::raw_svector_ostream OS(Str);
528  LangOptions LangOpts;
529  LangOpts.CPlusPlus = true;
530  PrintingPolicy Policy(LangOpts);
531  Arg.getAsExpr()->printPretty(OS, nullptr, Policy);
532  return DB << OS.str();
533  }
534 
535  case TemplateArgument::Pack: {
536  // FIXME: We're guessing at LangOptions!
537  SmallString<32> Str;
538  llvm::raw_svector_ostream OS(Str);
539  LangOptions LangOpts;
540  LangOpts.CPlusPlus = true;
541  PrintingPolicy Policy(LangOpts);
542  Arg.print(Policy, OS);
543  return DB << OS.str();
544  }
545  }
546 
547  llvm_unreachable("Invalid TemplateArgument Kind!");
548 }
549 
552  const TemplateArgumentListInfo &List) {
553  std::size_t size = totalSizeToAlloc<TemplateArgumentLoc>(List.size());
554  void *Mem = C.Allocate(size, alignof(ASTTemplateArgumentListInfo));
555  return new (Mem) ASTTemplateArgumentListInfo(List);
556 }
557 
558 ASTTemplateArgumentListInfo::ASTTemplateArgumentListInfo(
559  const TemplateArgumentListInfo &Info) {
560  LAngleLoc = Info.getLAngleLoc();
561  RAngleLoc = Info.getRAngleLoc();
562  NumTemplateArgs = Info.size();
563 
564  TemplateArgumentLoc *ArgBuffer = getTrailingObjects<TemplateArgumentLoc>();
565  for (unsigned i = 0; i != NumTemplateArgs; ++i)
566  new (&ArgBuffer[i]) TemplateArgumentLoc(Info[i]);
567 }
568 
570  SourceLocation TemplateKWLoc, const TemplateArgumentListInfo &Info,
571  TemplateArgumentLoc *OutArgArray) {
572  this->TemplateKWLoc = TemplateKWLoc;
573  LAngleLoc = Info.getLAngleLoc();
574  RAngleLoc = Info.getRAngleLoc();
575  NumTemplateArgs = Info.size();
576 
577  for (unsigned i = 0; i != NumTemplateArgs; ++i)
578  new (&OutArgArray[i]) TemplateArgumentLoc(Info[i]);
579 }
580 
582  assert(TemplateKWLoc.isValid());
583  LAngleLoc = SourceLocation();
584  RAngleLoc = SourceLocation();
585  this->TemplateKWLoc = TemplateKWLoc;
586  NumTemplateArgs = 0;
587 }
588 
590  SourceLocation TemplateKWLoc, const TemplateArgumentListInfo &Info,
591  TemplateArgumentLoc *OutArgArray, bool &Dependent,
592  bool &InstantiationDependent, bool &ContainsUnexpandedParameterPack) {
593  this->TemplateKWLoc = TemplateKWLoc;
594  LAngleLoc = Info.getLAngleLoc();
595  RAngleLoc = Info.getRAngleLoc();
596  NumTemplateArgs = Info.size();
597 
598  for (unsigned i = 0; i != NumTemplateArgs; ++i) {
599  Dependent = Dependent || Info[i].getArgument().isDependent();
600  InstantiationDependent = InstantiationDependent ||
601  Info[i].getArgument().isInstantiationDependent();
602  ContainsUnexpandedParameterPack =
603  ContainsUnexpandedParameterPack ||
604  Info[i].getArgument().containsUnexpandedParameterPack();
605 
606  new (&OutArgArray[i]) TemplateArgumentLoc(Info[i]);
607  }
608 }
609 
611  TemplateArgumentListInfo &Info) const {
612  Info.setLAngleLoc(LAngleLoc);
613  Info.setRAngleLoc(RAngleLoc);
614  for (unsigned I = 0; I != NumTemplateArgs; ++I)
615  Info.addArgument(ArgArray[I]);
616 }
Defines the clang::ASTContext interface.
static const Decl * getCanonicalDecl(const Decl *D)
void * getAsVoidPointer() const
Retrieve the template name as a void pointer.
Definition: TemplateName.h:304
A (possibly-)qualified type.
Definition: Type.h:614
static void printIntegral(const TemplateArgument &TemplArg, raw_ostream &Out, const PrintingPolicy &Policy)
Print a template integral argument value.
void print(raw_ostream &OS, const PrintingPolicy &Policy, const Twine &PlaceHolder=Twine(), unsigned Indentation=0) const
Definition: Type.h:950
__SIZE_TYPE__ size_t
The unsigned integer type of the result of the sizeof operator.
Definition: opencl-c.h:60
bool isDependent() const
Whether this template argument is dependent on a template parameter such that its result can change f...
EnumConstantDecl - An instance of this object exists for each enum constant that is defined...
Definition: Decl.h:2592
C Language Family Type Representation.
The template argument is an expression, and we&#39;ve not resolved it to one of the other forms yet...
Definition: TemplateBase.h:69
Defines the C++ template declaration subclasses.
StringRef P
const DiagnosticBuilder & operator<<(const DiagnosticBuilder &DB, const Attr *At)
Definition: Attr.h:195
The base class of the type hierarchy.
Definition: Type.h:1300
The template argument is a declaration that was provided for a pointer, reference, or pointer to member non-type template parameter.
Definition: TemplateBase.h:51
A container of type source information.
Definition: Decl.h:62
void setRAngleLoc(SourceLocation Loc)
Definition: TemplateBase.h:544
void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Context) const
Used to insert TemplateArguments into FoldingSets.
const T * getAs() const
Member-template getAs<specific type>&#39;.
Definition: Type.h:6099
Represents an empty template argument, e.g., one that has not been deduced.
Definition: TemplateBase.h:46
void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Context, bool Canonical) const
Produce a unique representation of the given statement.
Represents an explicit template argument list in C++, e.g., the "<int>" in "sort<int>".
Definition: TemplateBase.h:573
Describes how types, statements, expressions, and declarations should be printed. ...
Definition: PrettyPrinter.h:38
Defines the clang::Expr interface and subclasses for C++ expressions.
QualType getIntegralType() const
Retrieve the type of the integral value.
Definition: TemplateBase.h:291
DeclarationName getDeclName() const
getDeclName - Get the actual, stored name of the declaration, which may be a special name...
Definition: Decl.h:258
TemplateArgument getPackExpansionPattern() const
When the template argument is a pack expansion, returns the pattern of the pack expansion.
static TemplateArgument getEmptyPack()
Definition: TemplateBase.h:205
void print(raw_ostream &OS, const PrintingPolicy &Policy, bool SuppressNNS=false) const
Print the template name.
Expr * getAsExpr() const
Retrieve the template argument as an expression.
Definition: TemplateBase.h:306
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Definition: ASTContext.h:128
The template argument is an integral value stored in an llvm::APSInt that was provided for an integra...
Definition: TemplateBase.h:57
TemplateDecl * getAsTemplateDecl() const
Retrieve the underlying template declaration that this template name refers to, if known...
Optional< unsigned > getNumTemplateExpansions() const
Retrieve the number of expansions that a template template argument expansion will produce...
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
Definition: LangOptions.h:48
SourceRange getSourceRange() const LLVM_READONLY
Fetches the full source range of the argument.
QualType getParamTypeForDecl() const
Definition: TemplateBase.h:247
unsigned SuppressStrongLifetime
When true, suppress printing of the __strong lifetime qualifier in ARC.
A convenient class for passing around template argument information.
Definition: TemplateBase.h:524
QualType getNullPtrType() const
Retrieve the type for null non-type template argument.
Definition: TemplateBase.h:253
Defines the Diagnostic-related interfaces.
void printPretty(raw_ostream &OS, PrinterHelper *Helper, const PrintingPolicy &Policy, unsigned Indentation=0, const ASTContext *Context=nullptr) const
static TemplateArgument CreatePackCopy(ASTContext &Context, ArrayRef< TemplateArgument > Args)
Create a new template argument pack by copying the given set of template arguments.
const Type * getTypePtr() const
Retrieves a pointer to the underlying (unqualified) type.
Definition: Type.h:5543
bool isInstantiationDependent() const
Whether this template argument is dependent on a template parameter.
void * getAsOpaquePtr() const
Definition: Type.h:662
void print(const PrintingPolicy &Policy, raw_ostream &Out) const
Print this template argument to the given output stream.
A little helper class used to produce diagnostics.
Definition: Diagnostic.h:953
ValueDecl * getAsDecl() const
Retrieve the declaration for a declaration non-type template argument.
Definition: TemplateBase.h:242
const FunctionProtoType * T
constexpr TemplateArgument()
Construct an empty, invalid template argument.
Definition: TemplateBase.h:122
The template argument is a null pointer or null pointer to member that was provided for a non-type te...
Definition: TemplateBase.h:54
void Profile(llvm::FoldingSetNodeID &ID) const
Definition: Type.h:1005
DeclContext * getDeclContext()
Definition: DeclBase.h:416
Represents a C++ template name within the type system.
Definition: TemplateName.h:176
Defines the clang::TypeLoc interface and its subclasses.
QualType getType() const
Definition: Expr.h:128
TemplateTemplateParmDecl - Declares a template template parameter, e.g., "T" in.
bool isDependentContext() const
Determines whether this context is dependent on a template parameter.
Definition: DeclBase.cpp:1008
bool isPackExpansion() const
Determine whether this template argument is a pack expansion.
void printQualifiedName(raw_ostream &OS) const
printQualifiedName - Returns human-readable qualified name for declaration, like A::B::i, for i being member of namespace A::B.
Definition: Decl.cpp:1443
void copyInto(const TemplateArgumentLoc *ArgArray, TemplateArgumentListInfo &List) const
bool isInstantiationDependent() const
Whether this expression is instantiation-dependent, meaning that it depends in some way on a template...
Definition: Expr.h:191
Encodes a location in the source.
A helper class that allows the use of isa/cast/dyncast to detect TagType objects of enums...
Definition: Type.h:3864
llvm::APSInt getAsIntegral() const
Retrieve the template argument as an integral value.
Definition: TemplateBase.h:279
void setLAngleLoc(SourceLocation Loc)
Definition: TemplateBase.h:543
void addArgument(const TemplateArgumentLoc &Loc)
Definition: TemplateBase.h:564
bool isInstantiationDependentType() const
Determine whether this type is an instantiation-dependent type, meaning that the type involves a temp...
Definition: Type.h:1801
Represents a pack expansion of types.
Definition: Type.h:4841
ArrayRef< TemplateArgument > pack_elements() const
Iterator range referencing all of the elements of a template argument pack.
Definition: TemplateBase.h:330
void * Allocate(size_t Size, unsigned Align=8) const
Definition: ASTContext.h:625
Represents a template argument.
Definition: TemplateBase.h:40
Dataflow Directional Tag Classes.
bool containsUnexpandedParameterPack() const
Whether this template argument contains an unexpanded parameter pack.
bool isValid() const
Return true if this is a valid SourceLocation object.
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
Definition: DeclBase.h:1224
The template argument is a pack expansion of a template name that was provided for a template templat...
Definition: TemplateBase.h:63
bool structurallyEquals(const TemplateArgument &Other) const
Determines whether two template arguments are superficially the same.
Location wrapper for a TemplateArgument.
Definition: TemplateBase.h:428
The template argument is a type.
Definition: TemplateBase.h:48
The template argument is actually a parameter pack.
Definition: TemplateBase.h:72
ArgKind getKind() const
Return the kind of stored template argument.
Definition: TemplateBase.h:213
static const ASTTemplateArgumentListInfo * Create(ASTContext &C, const TemplateArgumentListInfo &List)
The template argument is a template name that was provided for a template template parameter...
Definition: TemplateBase.h:60
TemplateName getCanonicalTemplateName(TemplateName Name) const
Retrieves the "canonical" template name that refers to a given template.
void initializeFrom(SourceLocation TemplateKWLoc, const TemplateArgumentListInfo &List, TemplateArgumentLoc *OutArgArray)
SourceLocation getLAngleLoc() const
Definition: TemplateBase.h:540
bool isDependentType() const
Whether this type is a dependent type, meaning that its definition somehow depends on a template para...
Definition: Type.h:1795
QualType getAsType() const
Retrieve the type for a type template argument.
Definition: TemplateBase.h:235
bool MSVCFormatting
Use whitespace and punctuation like MSVC does.
void dump() const
Debugging aid that dumps the template argument to standard error.
A trivial tuple used to represent a source range.
NamedDecl - This represents a decl with a name.
Definition: Decl.h:213
QualType getNonTypeTemplateArgumentType() const
If this is a non-type template argument, get its type.
TemplateName getAsTemplate() const
Retrieve the template name for a template name argument.
Definition: TemplateBase.h:259
SourceLocation getRAngleLoc() const
Definition: TemplateBase.h:541
TemplateName getAsTemplateOrTemplatePattern() const
Retrieve the template argument as a template name; if the argument is a pack expansion, return the pattern as a template name.
Definition: TemplateBase.h:266
bool isDependent() const
Determines whether this is a dependent template name.
bool isInstantiationDependent() const
Determines whether this is a template name that somehow depends on a template parameter.