clang  6.0.0svn
TypeLoc.cpp
Go to the documentation of this file.
1 //===- TypeLoc.cpp - Type Source Info Wrapper -----------------------------===//
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 defines the TypeLoc subclasses implementations.
11 //
12 //===----------------------------------------------------------------------===//
13 
14 #include "clang/AST/TypeLoc.h"
15 #include "clang/AST/ASTContext.h"
16 #include "clang/AST/Expr.h"
18 #include "clang/AST/TemplateBase.h"
19 #include "clang/AST/TemplateName.h"
22 #include "clang/Basic/Specifiers.h"
23 #include "llvm/Support/ErrorHandling.h"
24 #include "llvm/Support/MathExtras.h"
25 #include <algorithm>
26 #include <cassert>
27 #include <cstdint>
28 #include <cstring>
29 
30 using namespace clang;
31 
32 static const unsigned TypeLocMaxDataAlign = alignof(void *);
33 
34 //===----------------------------------------------------------------------===//
35 // TypeLoc Implementation
36 //===----------------------------------------------------------------------===//
37 
38 namespace {
39 
40 class TypeLocRanger : public TypeLocVisitor<TypeLocRanger, SourceRange> {
41 public:
42 #define ABSTRACT_TYPELOC(CLASS, PARENT)
43 #define TYPELOC(CLASS, PARENT) \
44  SourceRange Visit##CLASS##TypeLoc(CLASS##TypeLoc TyLoc) { \
45  return TyLoc.getLocalSourceRange(); \
46  }
47 #include "clang/AST/TypeLocNodes.def"
48 };
49 
50 } // namespace
51 
52 SourceRange TypeLoc::getLocalSourceRangeImpl(TypeLoc TL) {
53  if (TL.isNull()) return SourceRange();
54  return TypeLocRanger().Visit(TL);
55 }
56 
57 namespace {
58 
59 class TypeAligner : public TypeLocVisitor<TypeAligner, unsigned> {
60 public:
61 #define ABSTRACT_TYPELOC(CLASS, PARENT)
62 #define TYPELOC(CLASS, PARENT) \
63  unsigned Visit##CLASS##TypeLoc(CLASS##TypeLoc TyLoc) { \
64  return TyLoc.getLocalDataAlignment(); \
65  }
66 #include "clang/AST/TypeLocNodes.def"
67 };
68 
69 } // namespace
70 
71 /// \brief Returns the alignment of the type source info data block.
73  if (Ty.isNull()) return 1;
74  return TypeAligner().Visit(TypeLoc(Ty, nullptr));
75 }
76 
77 namespace {
78 
79 class TypeSizer : public TypeLocVisitor<TypeSizer, unsigned> {
80 public:
81 #define ABSTRACT_TYPELOC(CLASS, PARENT)
82 #define TYPELOC(CLASS, PARENT) \
83  unsigned Visit##CLASS##TypeLoc(CLASS##TypeLoc TyLoc) { \
84  return TyLoc.getLocalDataSize(); \
85  }
86 #include "clang/AST/TypeLocNodes.def"
87 };
88 
89 } // namespace
90 
91 /// \brief Returns the size of the type source info data block.
93  unsigned Total = 0;
94  TypeLoc TyLoc(Ty, nullptr);
95  unsigned MaxAlign = 1;
96  while (!TyLoc.isNull()) {
97  unsigned Align = getLocalAlignmentForType(TyLoc.getType());
98  MaxAlign = std::max(Align, MaxAlign);
99  Total = llvm::alignTo(Total, Align);
100  Total += TypeSizer().Visit(TyLoc);
101  TyLoc = TyLoc.getNextTypeLoc();
102  }
103  Total = llvm::alignTo(Total, MaxAlign);
104  return Total;
105 }
106 
107 namespace {
108 
109 class NextLoc : public TypeLocVisitor<NextLoc, TypeLoc> {
110 public:
111 #define ABSTRACT_TYPELOC(CLASS, PARENT)
112 #define TYPELOC(CLASS, PARENT) \
113  TypeLoc Visit##CLASS##TypeLoc(CLASS##TypeLoc TyLoc) { \
114  return TyLoc.getNextTypeLoc(); \
115  }
116 #include "clang/AST/TypeLocNodes.def"
117 };
118 
119 } // namespace
120 
121 /// \brief Get the next TypeLoc pointed by this TypeLoc, e.g for "int*" the
122 /// TypeLoc is a PointerLoc and next TypeLoc is for "int".
123 TypeLoc TypeLoc::getNextTypeLocImpl(TypeLoc TL) {
124  return NextLoc().Visit(TL);
125 }
126 
127 /// \brief Initializes a type location, and all of its children
128 /// recursively, as if the entire tree had been written in the
129 /// given location.
130 void TypeLoc::initializeImpl(ASTContext &Context, TypeLoc TL,
131  SourceLocation Loc) {
132  while (true) {
133  switch (TL.getTypeLocClass()) {
134 #define ABSTRACT_TYPELOC(CLASS, PARENT)
135 #define TYPELOC(CLASS, PARENT) \
136  case CLASS: { \
137  CLASS##TypeLoc TLCasted = TL.castAs<CLASS##TypeLoc>(); \
138  TLCasted.initializeLocal(Context, Loc); \
139  TL = TLCasted.getNextTypeLoc(); \
140  if (!TL) return; \
141  continue; \
142  }
143 #include "clang/AST/TypeLocNodes.def"
144  }
145  }
146 }
147 
148 namespace {
149 
150 class TypeLocCopier : public TypeLocVisitor<TypeLocCopier> {
151  TypeLoc Source;
152 
153 public:
154  TypeLocCopier(TypeLoc source) : Source(source) {}
155 
156 #define ABSTRACT_TYPELOC(CLASS, PARENT)
157 #define TYPELOC(CLASS, PARENT) \
158  void Visit##CLASS##TypeLoc(CLASS##TypeLoc dest) { \
159  dest.copyLocal(Source.castAs<CLASS##TypeLoc>()); \
160  }
161 #include "clang/AST/TypeLocNodes.def"
162 };
163 
164 } // namespace
165 
166 void TypeLoc::copy(TypeLoc other) {
167  assert(getFullDataSize() == other.getFullDataSize());
168 
169  // If both data pointers are aligned to the maximum alignment, we
170  // can memcpy because getFullDataSize() accurately reflects the
171  // layout of the data.
172  if (reinterpret_cast<uintptr_t>(Data) ==
173  llvm::alignTo(reinterpret_cast<uintptr_t>(Data),
175  reinterpret_cast<uintptr_t>(other.Data) ==
176  llvm::alignTo(reinterpret_cast<uintptr_t>(other.Data),
178  memcpy(Data, other.Data, getFullDataSize());
179  return;
180  }
181 
182  // Copy each of the pieces.
183  TypeLoc TL(getType(), Data);
184  do {
185  TypeLocCopier(other).Visit(TL);
186  other = other.getNextTypeLoc();
187  } while ((TL = TL.getNextTypeLoc()));
188 }
189 
191  TypeLoc Cur = *this;
192  TypeLoc LeftMost = Cur;
193  while (true) {
194  switch (Cur.getTypeLocClass()) {
195  case Elaborated:
196  LeftMost = Cur;
197  break;
198  case FunctionProto:
200  ->hasTrailingReturn()) {
201  LeftMost = Cur;
202  break;
203  }
204  /* Fall through */
205  case FunctionNoProto:
206  case ConstantArray:
207  case DependentSizedArray:
208  case IncompleteArray:
209  case VariableArray:
210  // FIXME: Currently QualifiedTypeLoc does not have a source range
211  case Qualified:
212  Cur = Cur.getNextTypeLoc();
213  continue;
214  default:
215  if (Cur.getLocalSourceRange().getBegin().isValid())
216  LeftMost = Cur;
217  Cur = Cur.getNextTypeLoc();
218  if (Cur.isNull())
219  break;
220  continue;
221  } // switch
222  break;
223  } // while
224  return LeftMost.getLocalSourceRange().getBegin();
225 }
226 
228  TypeLoc Cur = *this;
229  TypeLoc Last;
230  while (true) {
231  switch (Cur.getTypeLocClass()) {
232  default:
233  if (!Last)
234  Last = Cur;
235  return Last.getLocalSourceRange().getEnd();
236  case Paren:
237  case ConstantArray:
238  case DependentSizedArray:
239  case IncompleteArray:
240  case VariableArray:
241  case FunctionNoProto:
242  Last = Cur;
243  break;
244  case FunctionProto:
246  Last = TypeLoc();
247  else
248  Last = Cur;
249  break;
250  case Pointer:
251  case BlockPointer:
252  case MemberPointer:
253  case LValueReference:
254  case RValueReference:
255  case PackExpansion:
256  if (!Last)
257  Last = Cur;
258  break;
259  case Qualified:
260  case Elaborated:
261  break;
262  }
263  Cur = Cur.getNextTypeLoc();
264  }
265 }
266 
267 namespace {
268 
269 struct TSTChecker : public TypeLocVisitor<TSTChecker, bool> {
270  // Overload resolution does the real work for us.
271  static bool isTypeSpec(TypeSpecTypeLoc _) { return true; }
272  static bool isTypeSpec(TypeLoc _) { return false; }
273 
274 #define ABSTRACT_TYPELOC(CLASS, PARENT)
275 #define TYPELOC(CLASS, PARENT) \
276  bool Visit##CLASS##TypeLoc(CLASS##TypeLoc TyLoc) { \
277  return isTypeSpec(TyLoc); \
278  }
279 #include "clang/AST/TypeLocNodes.def"
280 };
281 
282 } // namespace
283 
284 /// \brief Determines if the given type loc corresponds to a
285 /// TypeSpecTypeLoc. Since there is not actually a TypeSpecType in
286 /// the type hierarchy, this is made somewhat complicated.
287 ///
288 /// There are a lot of types that currently use TypeSpecTypeLoc
289 /// because it's a convenient base class. Ideally we would not accept
290 /// those here, but ideally we would have better implementations for
291 /// them.
292 bool TypeSpecTypeLoc::isKind(const TypeLoc &TL) {
293  if (TL.getType().hasLocalQualifiers()) return false;
294  return TSTChecker().Visit(TL);
295 }
296 
297 // Reimplemented to account for GNU/C++ extension
298 // typeof unary-expression
299 // where there are no parentheses.
301  if (getRParenLoc().isValid())
302  return SourceRange(getTypeofLoc(), getRParenLoc());
303  else
304  return SourceRange(getTypeofLoc(),
305  getUnderlyingExpr()->getSourceRange().getEnd());
306 }
307 
308 
310  if (needsExtraLocalData())
311  return static_cast<TypeSpecifierType>(getWrittenBuiltinSpecs().Type);
312  switch (getTypePtr()->getKind()) {
313  case BuiltinType::Void:
314  return TST_void;
315  case BuiltinType::Bool:
316  return TST_bool;
317  case BuiltinType::Char_U:
318  case BuiltinType::Char_S:
319  return TST_char;
320  case BuiltinType::Char16:
321  return TST_char16;
322  case BuiltinType::Char32:
323  return TST_char32;
324  case BuiltinType::WChar_S:
325  case BuiltinType::WChar_U:
326  return TST_wchar;
327  case BuiltinType::UChar:
328  case BuiltinType::UShort:
329  case BuiltinType::UInt:
330  case BuiltinType::ULong:
331  case BuiltinType::ULongLong:
332  case BuiltinType::UInt128:
333  case BuiltinType::SChar:
334  case BuiltinType::Short:
335  case BuiltinType::Int:
336  case BuiltinType::Long:
337  case BuiltinType::LongLong:
338  case BuiltinType::Int128:
339  case BuiltinType::Half:
340  case BuiltinType::Float:
341  case BuiltinType::Double:
342  case BuiltinType::LongDouble:
343  case BuiltinType::Float16:
344  case BuiltinType::Float128:
345  llvm_unreachable("Builtin type needs extra local data!");
346  // Fall through, if the impossible happens.
347 
348  case BuiltinType::NullPtr:
349  case BuiltinType::Overload:
350  case BuiltinType::Dependent:
351  case BuiltinType::BoundMember:
352  case BuiltinType::UnknownAny:
353  case BuiltinType::ARCUnbridgedCast:
354  case BuiltinType::PseudoObject:
355  case BuiltinType::ObjCId:
356  case BuiltinType::ObjCClass:
357  case BuiltinType::ObjCSel:
358 #define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \
359  case BuiltinType::Id:
360 #include "clang/Basic/OpenCLImageTypes.def"
361  case BuiltinType::OCLSampler:
362  case BuiltinType::OCLEvent:
363  case BuiltinType::OCLClkEvent:
364  case BuiltinType::OCLQueue:
365  case BuiltinType::OCLReserveID:
366  case BuiltinType::BuiltinFn:
367  case BuiltinType::OMPArraySection:
368  return TST_unspecified;
369  }
370 
371  llvm_unreachable("Invalid BuiltinType Kind!");
372 }
373 
374 TypeLoc TypeLoc::IgnoreParensImpl(TypeLoc TL) {
375  while (ParenTypeLoc PTL = TL.getAs<ParenTypeLoc>())
376  TL = PTL.getInnerLoc();
377  return TL;
378 }
379 
381  if (auto attributedLoc = getAs<AttributedTypeLoc>()) {
382  if (attributedLoc.getAttrKind() == AttributedType::attr_nullable ||
383  attributedLoc.getAttrKind() == AttributedType::attr_nonnull ||
384  attributedLoc.getAttrKind() == AttributedType::attr_null_unspecified)
385  return attributedLoc.getAttrNameLoc();
386  }
387 
388  return {};
389 }
390 
392  // Qualified types.
393  if (auto qual = getAs<QualifiedTypeLoc>())
394  return qual;
395 
396  TypeLoc loc = IgnoreParens();
397 
398  // Attributed types.
399  if (auto attr = loc.getAs<AttributedTypeLoc>()) {
400  if (attr.isQualifier()) return attr;
401  return attr.getModifiedLoc().findExplicitQualifierLoc();
402  }
403 
404  // C11 _Atomic types.
405  if (auto atomic = loc.getAs<AtomicTypeLoc>()) {
406  return atomic;
407  }
408 
409  return {};
410 }
411 
413  SourceLocation Loc) {
414  setNameLoc(Loc);
415  if (!getNumProtocols()) return;
416 
417  setProtocolLAngleLoc(Loc);
418  setProtocolRAngleLoc(Loc);
419  for (unsigned i = 0, e = getNumProtocols(); i != e; ++i)
420  setProtocolLoc(i, Loc);
421 }
422 
424  SourceLocation Loc) {
425  setHasBaseTypeAsWritten(true);
426  setTypeArgsLAngleLoc(Loc);
427  setTypeArgsRAngleLoc(Loc);
428  for (unsigned i = 0, e = getNumTypeArgs(); i != e; ++i) {
429  setTypeArgTInfo(i,
430  Context.getTrivialTypeSourceInfo(
431  getTypePtr()->getTypeArgsAsWritten()[i], Loc));
432  }
433  setProtocolLAngleLoc(Loc);
434  setProtocolRAngleLoc(Loc);
435  for (unsigned i = 0, e = getNumProtocols(); i != e; ++i)
436  setProtocolLoc(i, Loc);
437 }
438 
440  SourceLocation Loc) {
442  ::initializeLocal(Context, Loc);
443  this->getLocalData()->UnderlyingTInfo = Context.getTrivialTypeSourceInfo(
444  getUnderlyingType(), Loc);
445 }
446 
448  SourceLocation Loc) {
449  setElaboratedKeywordLoc(Loc);
451  Builder.MakeTrivial(Context, getTypePtr()->getQualifier(), Loc);
452  setQualifierLoc(Builder.getWithLocInContext(Context));
453 }
454 
456  SourceLocation Loc) {
457  setElaboratedKeywordLoc(Loc);
459  Builder.MakeTrivial(Context, getTypePtr()->getQualifier(), Loc);
460  setQualifierLoc(Builder.getWithLocInContext(Context));
461  setNameLoc(Loc);
462 }
463 
464 void
466  SourceLocation Loc) {
467  setElaboratedKeywordLoc(Loc);
468  if (getTypePtr()->getQualifier()) {
470  Builder.MakeTrivial(Context, getTypePtr()->getQualifier(), Loc);
471  setQualifierLoc(Builder.getWithLocInContext(Context));
472  } else {
473  setQualifierLoc(NestedNameSpecifierLoc());
474  }
475  setTemplateKeywordLoc(Loc);
476  setTemplateNameLoc(Loc);
477  setLAngleLoc(Loc);
478  setRAngleLoc(Loc);
480  getTypePtr()->getArgs(),
481  getArgInfos(), Loc);
482 }
483 
485  unsigned NumArgs,
486  const TemplateArgument *Args,
487  TemplateArgumentLocInfo *ArgInfos,
488  SourceLocation Loc) {
489  for (unsigned i = 0, e = NumArgs; i != e; ++i) {
490  switch (Args[i].getKind()) {
492  llvm_unreachable("Impossible TemplateArgument");
493 
497  ArgInfos[i] = TemplateArgumentLocInfo();
498  break;
499 
501  ArgInfos[i] = TemplateArgumentLocInfo(Args[i].getAsExpr());
502  break;
503 
505  ArgInfos[i] = TemplateArgumentLocInfo(
506  Context.getTrivialTypeSourceInfo(Args[i].getAsType(),
507  Loc));
508  break;
509 
513  TemplateName Template = Args[i].getAsTemplateOrTemplatePattern();
515  Builder.MakeTrivial(Context, DTN->getQualifier(), Loc);
516  else if (QualifiedTemplateName *QTN = Template.getAsQualifiedTemplateName())
517  Builder.MakeTrivial(Context, QTN->getQualifier(), Loc);
518 
519  ArgInfos[i] = TemplateArgumentLocInfo(
520  Builder.getWithLocInContext(Context), Loc,
522  : Loc);
523  break;
524  }
525 
527  ArgInfos[i] = TemplateArgumentLocInfo();
528  break;
529  }
530  }
531 }
Defines the clang::ASTContext interface.
static unsigned getFullDataSizeForType(QualType Ty)
Returns the size of type source info data block for the given type.
Definition: TypeLoc.cpp:92
void initializeLocal(ASTContext &Context, SourceLocation Loc)
Definition: TypeLoc.h:1875
const TypeClass * getTypePtr() const
Definition: TypeLoc.h:497
A (possibly-)qualified type.
Definition: Type.h:653
void MakeTrivial(ASTContext &Context, NestedNameSpecifier *Qualifier, SourceRange R)
Make a new nested-name-specifier from incomplete source-location information.
TypeLoc getNextTypeLoc() const
Get the next TypeLoc pointed by this TypeLoc, e.g for "int*" the TypeLoc is a PointerLoc and next Typ...
Definition: TypeLoc.h:169
The template argument is an expression, and we&#39;ve not resolved it to one of the other forms yet...
Definition: TemplateBase.h:87
RetTy Visit(TypeLoc TyLoc)
The template argument is a declaration that was provided for a pointer, reference, or pointer to member non-type template parameter.
Definition: TemplateBase.h:64
SourceLocation getEndLoc() const
Get the end source location.
Definition: TypeLoc.cpp:227
void initializeLocal(ASTContext &Context, SourceLocation Loc)
Definition: TypeLoc.cpp:465
Represents an empty template argument, e.g., one that has not been deduced.
Definition: TemplateBase.h:57
TypeSpecifierType
Specifies the kind of type.
Definition: Specifiers.h:45
QualifiedTemplateName * getAsQualifiedTemplateName() const
Retrieve the underlying qualified template name structure, if any.
void * Data
Definition: TypeLoc.h:61
A reasonable base class for TypeLocs that correspond to types that are written as a type-specifier...
Definition: TypeLoc.h:508
Base wrapper for a particular "section" of type source info.
Definition: TypeLoc.h:56
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Definition: ASTContext.h:149
A C++ nested-name-specifier augmented with source location information.
Represents a dependent template name that cannot be resolved prior to template instantiation.
Definition: TemplateName.h:422
The template argument is an integral value stored in an llvm::APSInt that was provided for an integra...
Definition: TemplateBase.h:72
void initializeLocal(ASTContext &Context, SourceLocation Loc)
Definition: TypeLoc.cpp:447
bool isNull() const
Definition: TypeLoc.h:118
SourceLocation findNullabilityLoc() const
Find the location of the nullability specifier (__nonnull, __nullable, or __null_unspecifier), if there is one.
Definition: TypeLoc.cpp:380
Class that aids in the construction of nested-name-specifiers along with source-location information ...
SourceRange getLocalSourceRange() const
Get the local source range.
Definition: TypeLoc.h:158
TypeSourceInfo * getTrivialTypeSourceInfo(QualType T, SourceLocation Loc=SourceLocation()) const
Allocate a TypeSourceInfo where all locations have been initialized to a given location, which defaults to the empty location.
SourceLocation getBeginLoc() const
Get the begin source location.
Definition: TypeLoc.cpp:190
Type source information for an attributed type.
Definition: TypeLoc.h:859
The template argument is a null pointer or null pointer to member that was provided for a non-type te...
Definition: TemplateBase.h:68
T getAs() const
Convert to the specified TypeLoc type, returning a null TypeLoc if this TypeLoc is not of the desired...
Definition: TypeLoc.h:86
Represents a C++ template name within the type system.
Definition: TemplateName.h:178
Defines the clang::TypeLoc interface and its subclasses.
SourceLocation getEnd() const
void initializeLocal(ASTContext &Context, SourceLocation Loc)
Definition: TypeLoc.cpp:439
bool isNull() const
Return true if this QualType doesn&#39;t point to a type yet.
Definition: Type.h:719
__UINTPTR_TYPE__ uintptr_t
An unsigned integer type with the property that any valid pointer to void can be converted to this ty...
Definition: opencl-c.h:82
bool hasTrailingReturn() const
Definition: Type.h:3627
void initializeLocal(ASTContext &Context, SourceLocation Loc)
Definition: TypeLoc.cpp:412
void initializeLocal(ASTContext &Context, SourceLocation Loc)
Definition: TypeLoc.cpp:455
Encodes a location in the source.
void initializeLocal(ASTContext &Context, SourceLocation Loc)
Definition: TypeLoc.cpp:423
static QualType getUnderlyingType(const SubRegion *R)
static const unsigned TypeLocMaxDataAlign
Definition: TypeLoc.cpp:32
TypeLoc findExplicitQualifierLoc() const
Find a type with the location of an explicit type qualifier.
Definition: TypeLoc.cpp:391
unsigned getFullDataSize() const
Returns the size of the type source info data block.
Definition: TypeLoc.h:163
DependentTemplateName * getAsDependentTemplateName() const
Retrieve the underlying dependent template name structure, if any.
Defines various enumerations that describe declaration and type specifiers.
Represents a template argument.
Definition: TemplateBase.h:51
Represents a template name that was expressed as a qualified name.
Definition: TemplateName.h:366
Dataflow Directional Tag Classes.
bool isValid() const
Return true if this is a valid SourceLocation object.
QualType getType() const
Get the type for which this source info wrapper provides information.
Definition: TypeLoc.h:130
The template argument is a pack expansion of a template name that was provided for a template templat...
Definition: TemplateBase.h:80
SourceRange getSourceRange(const SourceRange &Range)
Returns the SourceRange of a SourceRange.
Definition: FixIt.h:34
bool hasLocalQualifiers() const
Determine whether this particular QualType instance has any qualifiers, without looking through any t...
Definition: Type.h:756
SourceRange getLocalSourceRange() const
Definition: TypeLoc.cpp:300
static void initializeArgLocs(ASTContext &Context, unsigned NumArgs, const TemplateArgument *Args, TemplateArgumentLocInfo *ArgInfos, SourceLocation Loc)
Definition: TypeLoc.cpp:484
TypeLocClass getTypeLocClass() const
Definition: TypeLoc.h:113
The template argument is a type.
Definition: TemplateBase.h:60
The template argument is actually a parameter pack.
Definition: TemplateBase.h:91
char __ovld __cnfn max(char x, char y)
Returns y if x < y, otherwise it returns x.
ArgKind getKind() const
Return the kind of stored template argument.
Definition: TemplateBase.h:235
Defines the clang::SourceLocation class and associated facilities.
NestedNameSpecifierLoc getWithLocInContext(ASTContext &Context) const
Retrieve a nested-name-specifier with location information, copied into the given AST context...
The template argument is a template name that was provided for a template template parameter...
Definition: TemplateBase.h:76
static unsigned getLocalAlignmentForType(QualType Ty)
Returns the alignment of type source info data block for the given type.
Definition: TypeLoc.cpp:72
Location information for a TemplateArgument.
Definition: TemplateBase.h:393
static Decl::Kind getKind(const Decl *D)
Definition: DeclBase.cpp:915
QualType getAsType() const
Retrieve the type for a type template argument.
Definition: TemplateBase.h:257
void copy(TypeLoc other)
Copies the other type loc into this one.
Definition: TypeLoc.cpp:166
TypeSpecifierType getWrittenTypeSpec() const
Definition: TypeLoc.cpp:309
A trivial tuple used to represent a source range.
T castAs() const
Convert to the specified TypeLoc type, asserting that this TypeLoc is of the desired type...
Definition: TypeLoc.h:75
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:288
SourceLocation getBegin() const