clang  3.7.0
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()) {
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 
92  const TemplateArgument *Args,
93  unsigned NumArgs) {
94  if (NumArgs == 0)
95  return getEmptyPack();
96 
97  TemplateArgument *Storage = new (Context) TemplateArgument [NumArgs];
98  std::copy(Args, Args + NumArgs, Storage);
99  return TemplateArgument(Storage, NumArgs);
100 }
101 
103  switch (getKind()) {
104  case Null:
105  llvm_unreachable("Should not have a NULL template argument");
106 
107  case Type:
108  return getAsType()->isDependentType() ||
109  isa<PackExpansionType>(getAsType());
110 
111  case Template:
112  return getAsTemplate().isDependent();
113 
114  case TemplateExpansion:
115  return true;
116 
117  case Declaration:
118  if (DeclContext *DC = dyn_cast<DeclContext>(getAsDecl()))
119  return DC->isDependentContext();
121 
122  case NullPtr:
123  return false;
124 
125  case Integral:
126  // Never dependent
127  return false;
128 
129  case Expression:
130  return (getAsExpr()->isTypeDependent() || getAsExpr()->isValueDependent() ||
131  isa<PackExpansionExpr>(getAsExpr()));
132 
133  case Pack:
134  for (const auto &P : pack_elements())
135  if (P.isDependent())
136  return true;
137  return false;
138  }
139 
140  llvm_unreachable("Invalid TemplateArgument Kind!");
141 }
142 
144  switch (getKind()) {
145  case Null:
146  llvm_unreachable("Should not have a NULL template argument");
147 
148  case Type:
150 
151  case Template:
153 
154  case TemplateExpansion:
155  return true;
156 
157  case Declaration:
158  if (DeclContext *DC = dyn_cast<DeclContext>(getAsDecl()))
159  return DC->isDependentContext();
161 
162  case NullPtr:
163  return false;
164 
165  case Integral:
166  // Never dependent
167  return false;
168 
169  case Expression:
171 
172  case Pack:
173  for (const auto &P : pack_elements())
174  if (P.isInstantiationDependent())
175  return true;
176  return false;
177  }
178 
179  llvm_unreachable("Invalid TemplateArgument Kind!");
180 }
181 
183  switch (getKind()) {
184  case Null:
185  case Declaration:
186  case Integral:
187  case Pack:
188  case Template:
189  case NullPtr:
190  return false;
191 
192  case TemplateExpansion:
193  return true;
194 
195  case Type:
196  return isa<PackExpansionType>(getAsType());
197 
198  case Expression:
199  return isa<PackExpansionExpr>(getAsExpr());
200  }
201 
202  llvm_unreachable("Invalid TemplateArgument Kind!");
203 }
204 
206  switch (getKind()) {
207  case Null:
208  case Declaration:
209  case Integral:
210  case TemplateExpansion:
211  case NullPtr:
212  break;
213 
214  case Type:
216  return true;
217  break;
218 
219  case Template:
221  return true;
222  break;
223 
224  case Expression:
226  return true;
227  break;
228 
229  case Pack:
230  for (const auto &P : pack_elements())
231  if (P.containsUnexpandedParameterPack())
232  return true;
233 
234  break;
235  }
236 
237  return false;
238 }
239 
241  assert(getKind() == TemplateExpansion);
242  if (TemplateArg.NumExpansions)
243  return TemplateArg.NumExpansions - 1;
244 
245  return None;
246 }
247 
248 void TemplateArgument::Profile(llvm::FoldingSetNodeID &ID,
249  const ASTContext &Context) const {
250  ID.AddInteger(getKind());
251  switch (getKind()) {
252  case Null:
253  break;
254 
255  case Type:
256  getAsType().Profile(ID);
257  break;
258 
259  case NullPtr:
260  getNullPtrType().Profile(ID);
261  break;
262 
263  case Declaration:
264  ID.AddPointer(getAsDecl()? getAsDecl()->getCanonicalDecl() : nullptr);
265  break;
266 
267  case Template:
268  case TemplateExpansion: {
270  if (TemplateTemplateParmDecl *TTP
271  = dyn_cast_or_null<TemplateTemplateParmDecl>(
272  Template.getAsTemplateDecl())) {
273  ID.AddBoolean(true);
274  ID.AddInteger(TTP->getDepth());
275  ID.AddInteger(TTP->getPosition());
276  ID.AddBoolean(TTP->isParameterPack());
277  } else {
278  ID.AddBoolean(false);
279  ID.AddPointer(Context.getCanonicalTemplateName(Template)
280  .getAsVoidPointer());
281  }
282  break;
283  }
284 
285  case Integral:
286  getAsIntegral().Profile(ID);
287  getIntegralType().Profile(ID);
288  break;
289 
290  case Expression:
291  getAsExpr()->Profile(ID, Context, true);
292  break;
293 
294  case Pack:
295  ID.AddInteger(Args.NumArgs);
296  for (unsigned I = 0; I != Args.NumArgs; ++I)
297  Args.Args[I].Profile(ID, Context);
298  }
299 }
300 
302  if (getKind() != Other.getKind()) return false;
303 
304  switch (getKind()) {
305  case Null:
306  case Type:
307  case Expression:
308  case Template:
309  case TemplateExpansion:
310  case NullPtr:
311  return TypeOrValue.V == Other.TypeOrValue.V;
312 
313  case Declaration:
314  return getAsDecl() == Other.getAsDecl();
315 
316  case Integral:
317  return getIntegralType() == Other.getIntegralType() &&
318  getAsIntegral() == Other.getAsIntegral();
319 
320  case Pack:
321  if (Args.NumArgs != Other.Args.NumArgs) return false;
322  for (unsigned I = 0, E = Args.NumArgs; I != E; ++I)
323  if (!Args.Args[I].structurallyEquals(Other.Args.Args[I]))
324  return false;
325  return true;
326  }
327 
328  llvm_unreachable("Invalid TemplateArgument Kind!");
329 }
330 
332  assert(isPackExpansion());
333 
334  switch (getKind()) {
335  case Type:
336  return getAsType()->getAs<PackExpansionType>()->getPattern();
337 
338  case Expression:
339  return cast<PackExpansionExpr>(getAsExpr())->getPattern();
340 
341  case TemplateExpansion:
343 
344  case Declaration:
345  case Integral:
346  case Pack:
347  case Null:
348  case Template:
349  case NullPtr:
350  return TemplateArgument();
351  }
352 
353  llvm_unreachable("Invalid TemplateArgument Kind!");
354 }
355 
357  raw_ostream &Out) const {
358  switch (getKind()) {
359  case Null:
360  Out << "(no value)";
361  break;
362 
363  case Type: {
364  PrintingPolicy SubPolicy(Policy);
365  SubPolicy.SuppressStrongLifetime = true;
366  getAsType().print(Out, SubPolicy);
367  break;
368  }
369 
370  case Declaration: {
371  NamedDecl *ND = cast<NamedDecl>(getAsDecl());
372  Out << '&';
373  if (ND->getDeclName()) {
374  // FIXME: distinguish between pointer and reference args?
375  ND->printQualifiedName(Out);
376  } else {
377  Out << "(anonymous)";
378  }
379  break;
380  }
381 
382  case NullPtr:
383  Out << "nullptr";
384  break;
385 
386  case Template:
387  getAsTemplate().print(Out, Policy);
388  break;
389 
390  case TemplateExpansion:
391  getAsTemplateOrTemplatePattern().print(Out, Policy);
392  Out << "...";
393  break;
394 
395  case Integral: {
396  printIntegral(*this, Out, Policy);
397  break;
398  }
399 
400  case Expression:
401  getAsExpr()->printPretty(Out, nullptr, Policy);
402  break;
403 
404  case Pack:
405  Out << "<";
406  bool First = true;
407  for (const auto &P : pack_elements()) {
408  if (First)
409  First = false;
410  else
411  Out << ", ";
412 
413  P.print(Policy, Out);
414  }
415  Out << ">";
416  break;
417  }
418 }
419 
420 //===----------------------------------------------------------------------===//
421 // TemplateArgumentLoc Implementation
422 //===----------------------------------------------------------------------===//
423 
425  memset((void*)this, 0, sizeof(TemplateArgumentLocInfo));
426 }
427 
429  switch (Argument.getKind()) {
431  return getSourceExpression()->getSourceRange();
432 
434  return getSourceDeclExpression()->getSourceRange();
435 
437  return getSourceNullPtrExpression()->getSourceRange();
438 
440  if (TypeSourceInfo *TSI = getTypeSourceInfo())
441  return TSI->getTypeLoc().getSourceRange();
442  else
443  return SourceRange();
444 
447  return SourceRange(getTemplateQualifierLoc().getBeginLoc(),
450 
453  return SourceRange(getTemplateQualifierLoc().getBeginLoc(),
456 
458  return getSourceIntegralExpression()->getSourceRange();
459 
462  return SourceRange();
463  }
464 
465  llvm_unreachable("Invalid TemplateArgument Kind!");
466 }
467 
469  const TemplateArgument &Arg) {
470  switch (Arg.getKind()) {
472  // This is bad, but not as bad as crashing because of argument
473  // count mismatches.
474  return DB << "(null template argument)";
475 
477  return DB << Arg.getAsType();
478 
480  return DB << Arg.getAsDecl();
481 
483  return DB << "nullptr";
484 
486  return DB << Arg.getAsIntegral().toString(10);
487 
489  return DB << Arg.getAsTemplate();
490 
492  return DB << Arg.getAsTemplateOrTemplatePattern() << "...";
493 
495  // This shouldn't actually ever happen, so it's okay that we're
496  // regurgitating an expression here.
497  // FIXME: We're guessing at LangOptions!
498  SmallString<32> Str;
499  llvm::raw_svector_ostream OS(Str);
500  LangOptions LangOpts;
501  LangOpts.CPlusPlus = true;
502  PrintingPolicy Policy(LangOpts);
503  Arg.getAsExpr()->printPretty(OS, nullptr, Policy);
504  return DB << OS.str();
505  }
506 
507  case TemplateArgument::Pack: {
508  // FIXME: We're guessing at LangOptions!
509  SmallString<32> Str;
510  llvm::raw_svector_ostream OS(Str);
511  LangOptions LangOpts;
512  LangOpts.CPlusPlus = true;
513  PrintingPolicy Policy(LangOpts);
514  Arg.print(Policy, OS);
515  return DB << OS.str();
516  }
517  }
518 
519  llvm_unreachable("Invalid TemplateArgument Kind!");
520 }
521 
524  const TemplateArgumentListInfo &List) {
525  assert(llvm::alignOf<ASTTemplateArgumentListInfo>() >=
526  llvm::alignOf<TemplateArgumentLoc>());
528  void *Mem = C.Allocate(size, llvm::alignOf<ASTTemplateArgumentListInfo>());
530  TAI->initializeFrom(List);
531  return TAI;
532 }
533 
535  const TemplateArgumentListInfo &Info) {
536  LAngleLoc = Info.getLAngleLoc();
537  RAngleLoc = Info.getRAngleLoc();
538  NumTemplateArgs = Info.size();
539 
540  TemplateArgumentLoc *ArgBuffer = getTemplateArgs();
541  for (unsigned i = 0; i != NumTemplateArgs; ++i)
542  new (&ArgBuffer[i]) TemplateArgumentLoc(Info[i]);
543 }
544 
546  const TemplateArgumentListInfo &Info,
547  bool &Dependent,
548  bool &InstantiationDependent,
549  bool &ContainsUnexpandedParameterPack) {
550  LAngleLoc = Info.getLAngleLoc();
551  RAngleLoc = Info.getRAngleLoc();
552  NumTemplateArgs = Info.size();
553 
554  TemplateArgumentLoc *ArgBuffer = getTemplateArgs();
555  for (unsigned i = 0; i != NumTemplateArgs; ++i) {
556  Dependent = Dependent || Info[i].getArgument().isDependent();
557  InstantiationDependent = InstantiationDependent ||
558  Info[i].getArgument().isInstantiationDependent();
559  ContainsUnexpandedParameterPack
560  = ContainsUnexpandedParameterPack ||
561  Info[i].getArgument().containsUnexpandedParameterPack();
562 
563  new (&ArgBuffer[i]) TemplateArgumentLoc(Info[i]);
564  }
565 }
566 
568  TemplateArgumentListInfo &Info) const {
569  Info.setLAngleLoc(LAngleLoc);
570  Info.setRAngleLoc(RAngleLoc);
571  for (unsigned I = 0; I != NumTemplateArgs; ++I)
572  Info.addArgument(getTemplateArgs()[I]);
573 }
574 
576  return sizeof(ASTTemplateArgumentListInfo) +
578 }
579 
580 void
582  const TemplateArgumentListInfo &Info) {
583  Base::initializeFrom(Info);
584  setTemplateKeywordLoc(TemplateKWLoc);
585 }
586 
587 void
590  const TemplateArgumentListInfo &Info,
591  bool &Dependent,
592  bool &InstantiationDependent,
593  bool &ContainsUnexpandedParameterPack) {
594  Base::initializeFrom(Info, Dependent, InstantiationDependent,
595  ContainsUnexpandedParameterPack);
596  setTemplateKeywordLoc(TemplateKWLoc);
597 }
598 
599 void
601  // No explicit template arguments, but template keyword loc is valid.
602  assert(TemplateKWLoc.isValid());
605  NumTemplateArgs = 0;
606  setTemplateKeywordLoc(TemplateKWLoc);
607 }
608 
610 ASTTemplateKWAndArgsInfo::sizeFor(unsigned NumTemplateArgs) {
611  // Add space for the template keyword location.
612  // FIXME: There's room for this in the padding before the template args in
613  // 64-bit builds.
614  return Base::sizeFor(NumTemplateArgs) + sizeof(SourceLocation);
615 }
Defines the clang::ASTContext interface.
void print(raw_ostream &OS, const PrintingPolicy &Policy, bool SuppressNNS=false) const
Print the template name.
TemplateArgument getPackExpansionPattern() const
When the template argument is a pack expansion, returns the pattern of the pack expansion.
Expr * getSourceExpression() const
Definition: TemplateBase.h:479
llvm::iterator_range< pack_iterator > pack_elements() const
Iterator range referencing all of the elements of a template argument pack.
Definition: TemplateBase.h:331
static void printIntegral(const TemplateArgument &TemplArg, raw_ostream &Out, const PrintingPolicy &Policy)
Print a template integral argument value.
llvm::APSInt getAsIntegral() const
Retrieve the template argument as an integral value.
Definition: TemplateBase.h:284
static std::size_t sizeFor(unsigned NumTemplateArgs)
bool isInstantiationDependentType() const
Determine whether this type is an instantiation-dependent type, meaning that the type involves a temp...
Definition: Type.h:1733
void initializeFrom(const TemplateArgumentListInfo &List)
TemplateDecl * getAsTemplateDecl() const
Retrieve the underlying template declaration that this template name refers to, if known...
TemplateArgument()
Construct an empty, invalid template argument.
Definition: TemplateBase.h:121
Defines the C++ template declaration subclasses.
const DiagnosticBuilder & operator<<(const DiagnosticBuilder &DB, const Attr *At)
Definition: Attr.h:154
bool isDependentContext() const
Determines whether this context is dependent on a template parameter.
Definition: DeclBase.cpp:851
A container of type source information.
Definition: Decl.h:60
Expr * getAsExpr() const
Retrieve the template argument as an expression.
Definition: TemplateBase.h:307
void * getAsOpaquePtr() const
Definition: Type.h:614
void setTemplateKeywordLoc(SourceLocation TemplateKWLoc)
Sets the source location of the template keyword.
Definition: TemplateBase.h:624
void setRAngleLoc(SourceLocation Loc)
Definition: TemplateBase.h:539
static TemplateArgument CreatePackCopy(ASTContext &Context, const TemplateArgument *Args, unsigned NumArgs)
Create a new template argument pack by copying the given set of template arguments.
Represents an empty template argument, e.g., one that has not been deduced.
Definition: TemplateBase.h:45
Represents an explicit template argument list in C++, e.g., the "<int>" in "sort<int>". This is safe to be used inside an AST node, in contrast with TemplateArgumentListInfo.
Definition: TemplateBase.h:564
Describes how types, statements, expressions, and declarations should be printed. ...
Definition: PrettyPrinter.h:35
Defines the clang::Expr interface and subclasses for C++ expressions.
bool isPackExpansion() const
Determine whether this template argument is a pack expansion.
static TemplateArgument getEmptyPack()
Definition: TemplateBase.h:207
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Definition: ASTContext.h:89
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
Definition: LangOptions.h:48
TypeSourceInfo * getTypeSourceInfo() const
Definition: TemplateBase.h:474
SourceRange getSourceRange() const LLVM_READONLY
Fetches the full source range of the argument.
SourceLocation getTemplateEllipsisLoc() const
Definition: TemplateBase.h:511
unsigned SuppressStrongLifetime
When true, suppress printing of the __strong lifetime qualifier in ARC.
bool containsUnexpandedParameterPack() const
Whether this template argument contains an unexpanded parameter pack.
NestedNameSpecifierLoc getTemplateQualifierLoc() const
Definition: TemplateBase.h:499
SourceLocation RAngleLoc
The source location of the right angle bracket ('>').
Definition: TemplateBase.h:569
SourceLocation getRAngleLoc() const
Definition: TemplateBase.h:536
SourceLocation getTemplateNameLoc() const
Definition: TemplateBase.h:505
AnnotatingParser & P
bool isInstantiationDependent() const
Whether this template argument is dependent on a template parameter.
Optional< unsigned > getNumTemplateExpansions() const
Retrieve the number of expansions that a template template argument expansion will produce...
A little helper class used to produce diagnostics.
Definition: Diagnostic.h:866
ASTContext * Context
bool isInstantiationDependent() const
Whether this expression is instantiation-dependent, meaning that it depends in some way on a template...
Definition: Expr.h:192
ID
Defines the set of possible language-specific address spaces.
Definition: AddressSpaces.h:27
unsigned NumTemplateArgs
The number of template arguments in TemplateArgs. The actual template arguments (if any) are stored a...
Definition: TemplateBase.h:575
bool isInstantiationDependent() const
Determines whether this is a template name that somehow depends on a template parameter.
ArgKind getKind() const
Return the kind of stored template argument.
Definition: TemplateBase.h:218
DeclContext * getDeclContext()
Definition: DeclBase.h:381
Represents a C++ template name within the type system.
Definition: TemplateName.h:175
Expr * getSourceNullPtrExpression() const
Definition: TemplateBase.h:489
Defines the clang::TypeLoc interface and its subclasses.
void print(raw_ostream &OS, const PrintingPolicy &Policy, const Twine &PlaceHolder=Twine()) const
Definition: Type.h:907
bool isDependentType() const
Definition: Type.h:1727
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:271
DeclarationName getDeclName() const
Definition: Decl.h:189
TemplateArgumentLoc * getTemplateArgs()
Retrieve the template arguments.
Definition: TemplateBase.h:584
Expr * getSourceIntegralExpression() const
Definition: TemplateBase.h:494
Encodes a location in the source. The SourceManager can decode this to get at the full include stack...
const Type * getTypePtr() const
Definition: Type.h:5016
TemplateName getAsTemplate() const
Retrieve the template name for a template name argument.
Definition: TemplateBase.h:264
bool isValid() const
Return true if this is a valid SourceLocation object.
void print(const PrintingPolicy &Policy, raw_ostream &Out) const
Print this template argument to the given output stream.
void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Context) const
Used to insert TemplateArguments into FoldingSets.
SourceLocation getLAngleLoc() const
Definition: TemplateBase.h:535
void setLAngleLoc(SourceLocation Loc)
Definition: TemplateBase.h:538
void addArgument(const TemplateArgumentLoc &Loc)
Definition: TemplateBase.h:555
void printQualifiedName(raw_ostream &OS) const
Definition: Decl.cpp:1367
__SIZE_TYPE__ size_t
Definition: stddef.h:62
ValueDecl * getAsDecl() const
Retrieve the declaration for a declaration non-type template argument.
Definition: TemplateBase.h:247
Represents a pack expansion of types.
Definition: Type.h:4428
Represents a template argument.
Definition: TemplateBase.h:39
QualType getAsType() const
Retrieve the type for a type template argument.
Definition: TemplateBase.h:240
static std::size_t sizeFor(unsigned NumTemplateArgs)
void * getAsVoidPointer() const
Retrieve the template name as a void pointer.
Definition: TemplateName.h:324
bool isDependent() const
Determines whether this is a dependent template name.
TemplateName getCanonicalTemplateName(TemplateName Name) const
Retrieves the "canonical" template name that refers to a given template.
SourceLocation LAngleLoc
The source location of the left angle bracket ('<').
Definition: TemplateBase.h:566
Defines the Diagnostic-related interfaces.
const T * getAs() const
Definition: Type.h:5555
QualType getIntegralType() const
Retrieve the type of the integral value.
Definition: TemplateBase.h:296
bool structurallyEquals(const TemplateArgument &Other) const
Determines whether two template arguments are superficially the same.
The template argument is a type.
Definition: TemplateBase.h:47
Expr * getSourceDeclExpression() const
Definition: TemplateBase.h:484
QualType getNullPtrType() const
Retrieve the type for null non-type template argument.
Definition: TemplateBase.h:258
bool isDependent() const
Whether this template argument is dependent on a template parameter such that its result can change f...
static const ASTTemplateArgumentListInfo * Create(ASTContext &C, const TemplateArgumentListInfo &List)
void initializeFrom(SourceLocation TemplateKWLoc, const TemplateArgumentListInfo &List)
void * Allocate(size_t Size, unsigned Align=8) const
Definition: ASTContext.h:501
Location information for a TemplateArgument.
Definition: TemplateBase.h:364
void copyInto(TemplateArgumentListInfo &List) const
void Profile(llvm::FoldingSetNodeID &ID) const
Definition: Type.h:955
A trivial tuple used to represent a source range.