clang  3.9.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() && !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();
118  return getAsDecl()->getDeclContext()->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();
158  return getAsDecl()->getDeclContext()->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 
246 void TemplateArgument::Profile(llvm::FoldingSetNodeID &ID,
247  const ASTContext &Context) const {
248  ID.AddInteger(getKind());
249  switch (getKind()) {
250  case Null:
251  break;
252 
253  case Type:
254  getAsType().Profile(ID);
255  break;
256 
257  case NullPtr:
258  getNullPtrType().Profile(ID);
259  break;
260 
261  case Declaration:
262  ID.AddPointer(getAsDecl()? getAsDecl()->getCanonicalDecl() : nullptr);
263  break;
264 
265  case Template:
266  case TemplateExpansion: {
268  if (TemplateTemplateParmDecl *TTP
269  = dyn_cast_or_null<TemplateTemplateParmDecl>(
270  Template.getAsTemplateDecl())) {
271  ID.AddBoolean(true);
272  ID.AddInteger(TTP->getDepth());
273  ID.AddInteger(TTP->getPosition());
274  ID.AddBoolean(TTP->isParameterPack());
275  } else {
276  ID.AddBoolean(false);
277  ID.AddPointer(Context.getCanonicalTemplateName(Template)
278  .getAsVoidPointer());
279  }
280  break;
281  }
282 
283  case Integral:
284  getAsIntegral().Profile(ID);
285  getIntegralType().Profile(ID);
286  break;
287 
288  case Expression:
289  getAsExpr()->Profile(ID, Context, true);
290  break;
291 
292  case Pack:
293  ID.AddInteger(Args.NumArgs);
294  for (unsigned I = 0; I != Args.NumArgs; ++I)
295  Args.Args[I].Profile(ID, Context);
296  }
297 }
298 
300  if (getKind() != Other.getKind()) return false;
301 
302  switch (getKind()) {
303  case Null:
304  case Type:
305  case Expression:
306  case Template:
307  case TemplateExpansion:
308  case NullPtr:
309  return TypeOrValue.V == Other.TypeOrValue.V;
310 
311  case Declaration:
312  return getAsDecl() == Other.getAsDecl();
313 
314  case Integral:
315  return getIntegralType() == Other.getIntegralType() &&
316  getAsIntegral() == Other.getAsIntegral();
317 
318  case Pack:
319  if (Args.NumArgs != Other.Args.NumArgs) return false;
320  for (unsigned I = 0, E = Args.NumArgs; I != E; ++I)
321  if (!Args.Args[I].structurallyEquals(Other.Args.Args[I]))
322  return false;
323  return true;
324  }
325 
326  llvm_unreachable("Invalid TemplateArgument Kind!");
327 }
328 
330  assert(isPackExpansion());
331 
332  switch (getKind()) {
333  case Type:
334  return getAsType()->getAs<PackExpansionType>()->getPattern();
335 
336  case Expression:
337  return cast<PackExpansionExpr>(getAsExpr())->getPattern();
338 
339  case TemplateExpansion:
341 
342  case Declaration:
343  case Integral:
344  case Pack:
345  case Null:
346  case Template:
347  case NullPtr:
348  return TemplateArgument();
349  }
350 
351  llvm_unreachable("Invalid TemplateArgument Kind!");
352 }
353 
355  raw_ostream &Out) const {
356  switch (getKind()) {
357  case Null:
358  Out << "(no value)";
359  break;
360 
361  case Type: {
362  PrintingPolicy SubPolicy(Policy);
363  SubPolicy.SuppressStrongLifetime = true;
364  getAsType().print(Out, SubPolicy);
365  break;
366  }
367 
368  case Declaration: {
369  NamedDecl *ND = cast<NamedDecl>(getAsDecl());
370  Out << '&';
371  if (ND->getDeclName()) {
372  // FIXME: distinguish between pointer and reference args?
373  ND->printQualifiedName(Out);
374  } else {
375  Out << "(anonymous)";
376  }
377  break;
378  }
379 
380  case NullPtr:
381  Out << "nullptr";
382  break;
383 
384  case Template:
385  getAsTemplate().print(Out, Policy);
386  break;
387 
388  case TemplateExpansion:
389  getAsTemplateOrTemplatePattern().print(Out, Policy);
390  Out << "...";
391  break;
392 
393  case Integral: {
394  printIntegral(*this, Out, Policy);
395  break;
396  }
397 
398  case Expression:
399  getAsExpr()->printPretty(Out, nullptr, Policy);
400  break;
401 
402  case Pack:
403  Out << "<";
404  bool First = true;
405  for (const auto &P : pack_elements()) {
406  if (First)
407  First = false;
408  else
409  Out << ", ";
410 
411  P.print(Policy, Out);
412  }
413  Out << ">";
414  break;
415  }
416 }
417 
418 void TemplateArgument::dump(raw_ostream &Out) const {
419  LangOptions LO; // FIXME! see also TemplateName::dump().
420  LO.CPlusPlus = true;
421  LO.Bool = true;
422  print(PrintingPolicy(LO), Out);
423 }
424 
425 LLVM_DUMP_METHOD void TemplateArgument::dump() const { dump(llvm::errs()); }
426 
427 //===----------------------------------------------------------------------===//
428 // TemplateArgumentLoc Implementation
429 //===----------------------------------------------------------------------===//
430 
432  memset((void*)this, 0, sizeof(TemplateArgumentLocInfo));
433 }
434 
436  switch (Argument.getKind()) {
438  return getSourceExpression()->getSourceRange();
439 
441  return getSourceDeclExpression()->getSourceRange();
442 
444  return getSourceNullPtrExpression()->getSourceRange();
445 
447  if (TypeSourceInfo *TSI = getTypeSourceInfo())
448  return TSI->getTypeLoc().getSourceRange();
449  else
450  return SourceRange();
451 
454  return SourceRange(getTemplateQualifierLoc().getBeginLoc(),
457 
460  return SourceRange(getTemplateQualifierLoc().getBeginLoc(),
463 
465  return getSourceIntegralExpression()->getSourceRange();
466 
469  return SourceRange();
470  }
471 
472  llvm_unreachable("Invalid TemplateArgument Kind!");
473 }
474 
476  const TemplateArgument &Arg) {
477  switch (Arg.getKind()) {
479  // This is bad, but not as bad as crashing because of argument
480  // count mismatches.
481  return DB << "(null template argument)";
482 
484  return DB << Arg.getAsType();
485 
487  return DB << Arg.getAsDecl();
488 
490  return DB << "nullptr";
491 
493  return DB << Arg.getAsIntegral().toString(10);
494 
496  return DB << Arg.getAsTemplate();
497 
499  return DB << Arg.getAsTemplateOrTemplatePattern() << "...";
500 
502  // This shouldn't actually ever happen, so it's okay that we're
503  // regurgitating an expression here.
504  // FIXME: We're guessing at LangOptions!
505  SmallString<32> Str;
506  llvm::raw_svector_ostream OS(Str);
507  LangOptions LangOpts;
508  LangOpts.CPlusPlus = true;
509  PrintingPolicy Policy(LangOpts);
510  Arg.getAsExpr()->printPretty(OS, nullptr, Policy);
511  return DB << OS.str();
512  }
513 
514  case TemplateArgument::Pack: {
515  // FIXME: We're guessing at LangOptions!
516  SmallString<32> Str;
517  llvm::raw_svector_ostream OS(Str);
518  LangOptions LangOpts;
519  LangOpts.CPlusPlus = true;
520  PrintingPolicy Policy(LangOpts);
521  Arg.print(Policy, OS);
522  return DB << OS.str();
523  }
524  }
525 
526  llvm_unreachable("Invalid TemplateArgument Kind!");
527 }
528 
531  const TemplateArgumentListInfo &List) {
532  std::size_t size = totalSizeToAlloc<TemplateArgumentLoc>(List.size());
533  void *Mem = C.Allocate(size, llvm::alignOf<ASTTemplateArgumentListInfo>());
534  return new (Mem) ASTTemplateArgumentListInfo(List);
535 }
536 
537 ASTTemplateArgumentListInfo::ASTTemplateArgumentListInfo(
538  const TemplateArgumentListInfo &Info) {
539  LAngleLoc = Info.getLAngleLoc();
540  RAngleLoc = Info.getRAngleLoc();
541  NumTemplateArgs = Info.size();
542 
543  TemplateArgumentLoc *ArgBuffer = getTrailingObjects<TemplateArgumentLoc>();
544  for (unsigned i = 0; i != NumTemplateArgs; ++i)
545  new (&ArgBuffer[i]) TemplateArgumentLoc(Info[i]);
546 }
547 
548 void ASTTemplateKWAndArgsInfo::initializeFrom(
549  SourceLocation TemplateKWLoc, const TemplateArgumentListInfo &Info,
550  TemplateArgumentLoc *OutArgArray) {
551  this->TemplateKWLoc = TemplateKWLoc;
552  LAngleLoc = Info.getLAngleLoc();
553  RAngleLoc = Info.getRAngleLoc();
554  NumTemplateArgs = Info.size();
555 
556  for (unsigned i = 0; i != NumTemplateArgs; ++i)
557  new (&OutArgArray[i]) TemplateArgumentLoc(Info[i]);
558 }
559 
560 void ASTTemplateKWAndArgsInfo::initializeFrom(SourceLocation TemplateKWLoc) {
561  assert(TemplateKWLoc.isValid());
562  LAngleLoc = SourceLocation();
563  RAngleLoc = SourceLocation();
564  this->TemplateKWLoc = TemplateKWLoc;
565  NumTemplateArgs = 0;
566 }
567 
568 void ASTTemplateKWAndArgsInfo::initializeFrom(
569  SourceLocation TemplateKWLoc, const TemplateArgumentListInfo &Info,
570  TemplateArgumentLoc *OutArgArray, bool &Dependent,
571  bool &InstantiationDependent, bool &ContainsUnexpandedParameterPack) {
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  Dependent = Dependent || Info[i].getArgument().isDependent();
579  InstantiationDependent = InstantiationDependent ||
580  Info[i].getArgument().isInstantiationDependent();
581  ContainsUnexpandedParameterPack =
582  ContainsUnexpandedParameterPack ||
583  Info[i].getArgument().containsUnexpandedParameterPack();
584 
585  new (&OutArgArray[i]) TemplateArgumentLoc(Info[i]);
586  }
587 }
588 
589 void ASTTemplateKWAndArgsInfo::copyInto(const TemplateArgumentLoc *ArgArray,
590  TemplateArgumentListInfo &Info) const {
591  Info.setLAngleLoc(LAngleLoc);
592  Info.setRAngleLoc(RAngleLoc);
593  for (unsigned I = 0; I != NumTemplateArgs; ++I)
594  Info.addArgument(ArgArray[I]);
595 }
Defines the clang::ASTContext interface.
void print(raw_ostream &OS, const PrintingPolicy &Policy, bool SuppressNNS=false) const
Print the template name.
static const Decl * getCanonicalDecl(const Decl *D)
TemplateArgument getPackExpansionPattern() const
When the template argument is a pack expansion, returns the pattern of the pack expansion.
Expr * getSourceExpression() const
Definition: TemplateBase.h:483
llvm::iterator_range< pack_iterator > pack_elements() const
Iterator range referencing all of the elements of a template argument pack.
Definition: TemplateBase.h:329
A (possibly-)qualified type.
Definition: Type.h:598
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:282
__SIZE_TYPE__ size_t
The unsigned integer type of the result of the sizeof operator.
Definition: opencl-c.h:53
bool isInstantiationDependentType() const
Determine whether this type is an instantiation-dependent type, meaning that the type involves a temp...
Definition: Type.h:1780
TemplateDecl * getAsTemplateDecl() const
Retrieve the underlying template declaration that this template name refers to, if known...
EnumConstantDecl - An instance of this object exists for each enum constant that is defined...
Definition: Decl.h:2481
C Language Family Type Representation.
The template argument is an expression, and we've not resolved it to one of the other forms yet...
Definition: TemplateBase.h:69
TemplateArgument()
Construct an empty, invalid template argument.
Definition: TemplateBase.h:122
Defines the C++ template declaration subclasses.
StringRef P
const DiagnosticBuilder & operator<<(const DiagnosticBuilder &DB, const Attr *At)
Definition: Attr.h:198
The base class of the type hierarchy.
Definition: Type.h:1281
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
Expr * getAsExpr() const
Retrieve the template argument as an expression.
Definition: TemplateBase.h:305
void * getAsOpaquePtr() const
Definition: Type.h:646
void setRAngleLoc(SourceLocation Loc)
Definition: TemplateBase.h:543
Represents an empty template argument, e.g., one that has not been deduced.
Definition: TemplateBase.h:46
Represents an explicit template argument list in C++, e.g., the "<int>" in "sort<int>".
Definition: TemplateBase.h:572
Describes how types, statements, expressions, and declarations should be printed. ...
Definition: PrettyPrinter.h:38
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:208
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Definition: ASTContext.h:92
The template argument is an integral value stored in an llvm::APSInt that was provided for an integra...
Definition: TemplateBase.h:57
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:478
SourceRange getSourceRange() const LLVM_READONLY
Fetches the full source range of the argument.
SourceLocation getTemplateEllipsisLoc() const
Definition: TemplateBase.h:515
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.
A convenient class for passing around template argument information.
Definition: TemplateBase.h:523
NestedNameSpecifierLoc getTemplateQualifierLoc() const
Definition: TemplateBase.h:503
SourceLocation RAngleLoc
The source location of the right angle bracket ('>').
Definition: TemplateBase.h:585
void print(raw_ostream &OS, const PrintingPolicy &Policy, const Twine &PlaceHolder=Twine(), unsigned Indentation=0) const
Definition: Type.h:934
static TemplateArgument CreatePackCopy(ASTContext &Context, ArrayRef< TemplateArgument > Args)
Create a new template argument pack by copying the given set of template arguments.
SourceLocation getRAngleLoc() const
Definition: TemplateBase.h:540
SourceLocation getTemplateNameLoc() const
Definition: TemplateBase.h:509
detail::InMemoryDirectory::const_iterator I
void dump() const
Debugging aid that dumps the template argument to standard error.
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:873
ASTContext * Context
bool isInstantiationDependent() const
Whether this expression is instantiation-dependent, meaning that it depends in some way on a template...
Definition: Expr.h:189
unsigned NumTemplateArgs
The number of template arguments in TemplateArgs.
Definition: TemplateBase.h:588
The template argument is a null pointer or null pointer to member that was provided for a non-type te...
Definition: TemplateBase.h:54
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:216
Represents a C++ template name within the type system.
Definition: TemplateName.h:176
Expr * getSourceNullPtrExpression() const
Definition: TemplateBase.h:493
Defines the clang::TypeLoc interface and its subclasses.
bool isDependentType() const
Whether this type is a dependent type, meaning that its definition somehow depends on a template para...
Definition: Type.h:1774
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:269
DeclarationName getDeclName() const
getDeclName - Get the actual, stored name of the declaration, which may be a special name...
Definition: Decl.h:258
TemplateTemplateParmDecl - Declares a template template parameter, e.g., "T" in.
Expr * getSourceIntegralExpression() const
Definition: TemplateBase.h:498
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:3733
const Type * getTypePtr() const
Retrieves a pointer to the underlying (unqualified) type.
Definition: Type.h:5259
TemplateName getAsTemplate() const
Retrieve the template name for a template name argument.
Definition: TemplateBase.h:262
bool isValid() const
Return true if this is a valid SourceLocation object.
const std::string ID
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:539
void setLAngleLoc(SourceLocation Loc)
Definition: TemplateBase.h:542
void addArgument(const TemplateArgumentLoc &Loc)
Definition: TemplateBase.h:563
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:1405
ValueDecl * getAsDecl() const
Retrieve the declaration for a declaration non-type template argument.
Definition: TemplateBase.h:245
Represents a pack expansion of types.
Definition: Type.h:4641
Represents a template argument.
Definition: TemplateBase.h:40
QualType getAsType() const
Retrieve the type for a type template argument.
Definition: TemplateBase.h:238
void * getAsVoidPointer() const
Retrieve the template name as a void pointer.
Definition: TemplateName.h:299
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
Definition: DeclBase.h:1135
bool isDependent() const
Determines whether this is a dependent template name.
The template argument is a pack expansion of a template name that was provided for a template templat...
Definition: TemplateBase.h:63
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:582
detail::InMemoryDirectory::const_iterator E
Defines the Diagnostic-related interfaces.
Location wrapper for a TemplateArgument.
Definition: TemplateBase.h:427
const T * getAs() const
Member-template getAs<specific type>'.
Definition: Type.h:5818
QualType getIntegralType() const
Retrieve the type of the integral value.
Definition: TemplateBase.h:294
bool structurallyEquals(const TemplateArgument &Other) const
Determines whether two template arguments are superficially the same.
The template argument is a type.
Definition: TemplateBase.h:48
The template argument is actually a parameter pack.
Definition: TemplateBase.h:72
Expr * getSourceDeclExpression() const
Definition: TemplateBase.h:488
QualType getNullPtrType() const
Retrieve the type for null non-type template argument.
Definition: TemplateBase.h:256
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)
The template argument is a template name that was provided for a template template parameter...
Definition: TemplateBase.h:60
void * Allocate(size_t Size, unsigned Align=8) const
Definition: ASTContext.h:568
Location information for a TemplateArgument.
Definition: TemplateBase.h:368
void Profile(llvm::FoldingSetNodeID &ID) const
Definition: Type.h:988
bool MSVCFormatting
Use whitespace and punctuation like MSVC does.
A trivial tuple used to represent a source range.
NamedDecl - This represents a decl with a name.
Definition: Decl.h:213