clang  5.0.0
TypeLoc.h
Go to the documentation of this file.
1 //===--- TypeLoc.h - Type Source Info Wrapper -------------------*- C++ -*-===//
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 /// \file
11 /// \brief Defines the clang::TypeLoc interface and its subclasses.
12 ///
13 //===----------------------------------------------------------------------===//
14 
15 #ifndef LLVM_CLANG_AST_TYPELOC_H
16 #define LLVM_CLANG_AST_TYPELOC_H
17 
18 #include "clang/AST/Decl.h"
19 #include "clang/AST/TemplateBase.h"
20 #include "clang/AST/Type.h"
21 #include "clang/Basic/Specifiers.h"
22 #include "llvm/Support/Compiler.h"
23 
24 namespace clang {
25  class ASTContext;
26  class ParmVarDecl;
27  class TypeSourceInfo;
28  class UnqualTypeLoc;
29 
30 // Predeclare all the type nodes.
31 #define ABSTRACT_TYPELOC(Class, Base)
32 #define TYPELOC(Class, Base) \
33  class Class##TypeLoc;
34 #include "clang/AST/TypeLocNodes.def"
35 
36 /// \brief Base wrapper for a particular "section" of type source info.
37 ///
38 /// A client should use the TypeLoc subclasses through castAs()/getAs()
39 /// in order to get at the actual information.
40 class TypeLoc {
41 protected:
42  // The correctness of this relies on the property that, for Type *Ty,
43  // QualType(Ty, 0).getAsOpaquePtr() == (void*) Ty
44  const void *Ty;
45  void *Data;
46 
47 public:
48  /// \brief Convert to the specified TypeLoc type, asserting that this TypeLoc
49  /// is of the desired type.
50  ///
51  /// \pre T::isKind(*this)
52  template<typename T>
53  T castAs() const {
54  assert(T::isKind(*this));
55  T t;
56  TypeLoc& tl = t;
57  tl = *this;
58  return t;
59  }
60 
61  /// \brief Convert to the specified TypeLoc type, returning a null TypeLoc if
62  /// this TypeLoc is not of the desired type.
63  template<typename T>
64  T getAs() const {
65  if (!T::isKind(*this))
66  return T();
67  T t;
68  TypeLoc& tl = t;
69  tl = *this;
70  return t;
71  }
72 
73  /// \brief Convert to the specified TypeLoc type, returning a null TypeLoc if
74  /// this TypeLock is not of the desired type. It will consider type
75  /// adjustments from a type that wad written as a T to another type that is
76  /// still canonically a T (ignores parens, attributes, elaborated types, etc).
77  template <typename T>
78  T getAsAdjusted() const;
79 
80  /// The kinds of TypeLocs. Equivalent to the Type::TypeClass enum,
81  /// except it also defines a Qualified enum that corresponds to the
82  /// QualifiedLoc class.
83  enum TypeLocClass {
84 #define ABSTRACT_TYPE(Class, Base)
85 #define TYPE(Class, Base) \
86  Class = Type::Class,
87 #include "clang/AST/TypeNodes.def"
89  };
90 
91  TypeLoc() : Ty(nullptr), Data(nullptr) { }
92  TypeLoc(QualType ty, void *opaqueData)
93  : Ty(ty.getAsOpaquePtr()), Data(opaqueData) { }
94  TypeLoc(const Type *ty, void *opaqueData)
95  : Ty(ty), Data(opaqueData) { }
96 
98  if (getType().hasLocalQualifiers()) return Qualified;
99  return (TypeLocClass) getType()->getTypeClass();
100  }
101 
102  bool isNull() const { return !Ty; }
103  explicit operator bool() const { return Ty; }
104 
105  /// \brief Returns the size of type source info data block for the given type.
106  static unsigned getFullDataSizeForType(QualType Ty);
107 
108  /// \brief Returns the alignment of type source info data block for
109  /// the given type.
110  static unsigned getLocalAlignmentForType(QualType Ty);
111 
112  /// \brief Get the type for which this source info wrapper provides
113  /// information.
114  QualType getType() const {
116  }
117 
118  const Type *getTypePtr() const {
120  }
121 
122  /// \brief Get the pointer where source information is stored.
123  void *getOpaqueData() const {
124  return Data;
125  }
126 
127  /// \brief Get the begin source location.
128  SourceLocation getBeginLoc() const;
129 
130  /// \brief Get the end source location.
131  SourceLocation getEndLoc() const;
132 
133  /// \brief Get the full source range.
134  SourceRange getSourceRange() const LLVM_READONLY {
135  return SourceRange(getBeginLoc(), getEndLoc());
136  }
137  SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
138  SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
139 
140  /// \brief Get the local source range.
142  return getLocalSourceRangeImpl(*this);
143  }
144 
145  /// \brief Returns the size of the type source info data block.
146  unsigned getFullDataSize() const {
148  }
149 
150  /// \brief Get the next TypeLoc pointed by this TypeLoc, e.g for "int*" the
151  /// TypeLoc is a PointerLoc and next TypeLoc is for "int".
153  return getNextTypeLocImpl(*this);
154  }
155 
156  /// \brief Skips past any qualifiers, if this is qualified.
157  UnqualTypeLoc getUnqualifiedLoc() const; // implemented in this header
158 
159  TypeLoc IgnoreParens() const;
160 
161  /// \brief Find a type with the location of an explicit type qualifier.
162  ///
163  /// The result, if non-null, will be one of:
164  /// QualifiedTypeLoc
165  /// AtomicTypeLoc
166  /// AttributedTypeLoc, for those type attributes that behave as qualifiers
168 
169  /// \brief Initializes this to state that every location in this
170  /// type is the given location.
171  ///
172  /// This method exists to provide a simple transition for code that
173  /// relies on location-less types.
175  initializeImpl(Context, *this, Loc);
176  }
177 
178  /// \brief Initializes this by copying its information from another
179  /// TypeLoc of the same type.
181  assert(getType() == Other.getType());
182  copy(Other);
183  }
184 
185  /// \brief Initializes this by copying its information from another
186  /// TypeLoc of the same type. The given size must be the full data
187  /// size.
188  void initializeFullCopy(TypeLoc Other, unsigned Size) {
189  assert(getType() == Other.getType());
190  assert(getFullDataSize() == Size);
191  copy(Other);
192  }
193 
194  /// Copies the other type loc into this one.
195  void copy(TypeLoc other);
196 
197  friend bool operator==(const TypeLoc &LHS, const TypeLoc &RHS) {
198  return LHS.Ty == RHS.Ty && LHS.Data == RHS.Data;
199  }
200 
201  friend bool operator!=(const TypeLoc &LHS, const TypeLoc &RHS) {
202  return !(LHS == RHS);
203  }
204 
205  /// Find the location of the nullability specifier (__nonnull,
206  /// __nullable, or __null_unspecifier), if there is one.
208 
209 private:
210  static bool isKind(const TypeLoc&) {
211  return true;
212  }
213 
214  static void initializeImpl(ASTContext &Context, TypeLoc TL,
215  SourceLocation Loc);
216  static TypeLoc getNextTypeLocImpl(TypeLoc TL);
217  static TypeLoc IgnoreParensImpl(TypeLoc TL);
218  static SourceRange getLocalSourceRangeImpl(TypeLoc TL);
219 };
220 
221 /// \brief Return the TypeLoc for a type source info.
223  // TODO: is this alignment already sufficient?
224  return TypeLoc(Ty, const_cast<void*>(static_cast<const void*>(this + 1)));
225 }
226 
227 /// \brief Wrapper of type source information for a type with
228 /// no direct qualifiers.
229 class UnqualTypeLoc : public TypeLoc {
230 public:
232  UnqualTypeLoc(const Type *Ty, void *Data) : TypeLoc(Ty, Data) {}
233 
234  const Type *getTypePtr() const {
235  return reinterpret_cast<const Type*>(Ty);
236  }
237 
239  return (TypeLocClass) getTypePtr()->getTypeClass();
240  }
241 
242 private:
243  friend class TypeLoc;
244  static bool isKind(const TypeLoc &TL) {
245  return !TL.getType().hasLocalQualifiers();
246  }
247 };
248 
249 /// \brief Wrapper of type source information for a type with
250 /// non-trivial direct qualifiers.
251 ///
252 /// Currently, we intentionally do not provide source location for
253 /// type qualifiers.
254 class QualifiedTypeLoc : public TypeLoc {
255 public:
257  return SourceRange();
258  }
259 
261  unsigned align =
263  uintptr_t dataInt = reinterpret_cast<uintptr_t>(Data);
264  dataInt = llvm::alignTo(dataInt, align);
265  return UnqualTypeLoc(getTypePtr(), reinterpret_cast<void*>(dataInt));
266  }
267 
268  /// Initializes the local data of this type source info block to
269  /// provide no information.
271  // do nothing
272  }
273 
274  void copyLocal(TypeLoc other) {
275  // do nothing
276  }
277 
279  return getUnqualifiedLoc();
280  }
281 
282  /// \brief Returns the size of the type source info data block that is
283  /// specific to this type.
284  unsigned getLocalDataSize() const {
285  // In fact, we don't currently preserve any location information
286  // for qualifiers.
287  return 0;
288  }
289 
290  /// \brief Returns the alignment of the type source info data block that is
291  /// specific to this type.
292  unsigned getLocalDataAlignment() const {
293  // We don't preserve any location information.
294  return 1;
295  }
296 
297 private:
298  friend class TypeLoc;
299  static bool isKind(const TypeLoc &TL) {
300  return TL.getType().hasLocalQualifiers();
301  }
302 };
303 
305  if (QualifiedTypeLoc Loc = getAs<QualifiedTypeLoc>())
306  return Loc.getUnqualifiedLoc();
307  return castAs<UnqualTypeLoc>();
308 }
309 
310 /// A metaprogramming base class for TypeLoc classes which correspond
311 /// to a particular Type subclass. It is accepted for a single
312 /// TypeLoc class to correspond to multiple Type classes.
313 ///
314 /// \tparam Base a class from which to derive
315 /// \tparam Derived the class deriving from this one
316 /// \tparam TypeClass the concrete Type subclass associated with this
317 /// location type
318 /// \tparam LocalData the structure type of local location data for
319 /// this type
320 ///
321 /// TypeLocs with non-constant amounts of local data should override
322 /// getExtraLocalDataSize(); getExtraLocalData() will then point to
323 /// this extra memory.
324 ///
325 /// TypeLocs with an inner type should define
326 /// QualType getInnerType() const
327 /// and getInnerTypeLoc() will then point to this inner type's
328 /// location data.
329 ///
330 /// A word about hierarchies: this template is not designed to be
331 /// derived from multiple times in a hierarchy. It is also not
332 /// designed to be used for classes where subtypes might provide
333 /// different amounts of source information. It should be subclassed
334 /// only at the deepest portion of the hierarchy where all children
335 /// have identical source information; if that's an abstract type,
336 /// then further descendents should inherit from
337 /// InheritingConcreteTypeLoc instead.
338 template <class Base, class Derived, class TypeClass, class LocalData>
339 class ConcreteTypeLoc : public Base {
340 
341  const Derived *asDerived() const {
342  return static_cast<const Derived*>(this);
343  }
344 
345  friend class TypeLoc;
346  static bool isKind(const TypeLoc &TL) {
347  return !TL.getType().hasLocalQualifiers() &&
348  Derived::classofType(TL.getTypePtr());
349  }
350 
351  static bool classofType(const Type *Ty) {
352  return TypeClass::classof(Ty);
353  }
354 
355 public:
356  unsigned getLocalDataAlignment() const {
357  return std::max(unsigned(alignof(LocalData)),
358  asDerived()->getExtraLocalDataAlignment());
359  }
360  unsigned getLocalDataSize() const {
361  unsigned size = sizeof(LocalData);
362  unsigned extraAlign = asDerived()->getExtraLocalDataAlignment();
363  size = llvm::alignTo(size, extraAlign);
364  size += asDerived()->getExtraLocalDataSize();
365  return size;
366  }
367 
368  void copyLocal(Derived other) {
369  // Some subclasses have no data to copy.
370  if (asDerived()->getLocalDataSize() == 0) return;
371 
372  // Copy the fixed-sized local data.
373  memcpy(getLocalData(), other.getLocalData(), sizeof(LocalData));
374 
375  // Copy the variable-sized local data. We need to do this
376  // separately because the padding in the source and the padding in
377  // the destination might be different.
378  memcpy(getExtraLocalData(), other.getExtraLocalData(),
379  asDerived()->getExtraLocalDataSize());
380  }
381 
383  return getNextTypeLoc(asDerived()->getInnerType());
384  }
385 
386  const TypeClass *getTypePtr() const {
387  return cast<TypeClass>(Base::getTypePtr());
388  }
389 
390 protected:
391  unsigned getExtraLocalDataSize() const {
392  return 0;
393  }
394 
395  unsigned getExtraLocalDataAlignment() const {
396  return 1;
397  }
398 
399  LocalData *getLocalData() const {
400  return static_cast<LocalData*>(Base::Data);
401  }
402 
403  /// Gets a pointer past the Info structure; useful for classes with
404  /// local data that can't be captured in the Info (e.g. because it's
405  /// of variable size).
406  void *getExtraLocalData() const {
407  unsigned size = sizeof(LocalData);
408  unsigned extraAlign = asDerived()->getExtraLocalDataAlignment();
409  size = llvm::alignTo(size, extraAlign);
410  return reinterpret_cast<char*>(Base::Data) + size;
411  }
412 
413  void *getNonLocalData() const {
414  uintptr_t data = reinterpret_cast<uintptr_t>(Base::Data);
415  data += asDerived()->getLocalDataSize();
416  data = llvm::alignTo(data, getNextTypeAlign());
417  return reinterpret_cast<void*>(data);
418  }
419 
420  struct HasNoInnerType {};
421  HasNoInnerType getInnerType() const { return HasNoInnerType(); }
422 
424  return TypeLoc(asDerived()->getInnerType(), getNonLocalData());
425  }
426 
427 private:
428  unsigned getInnerTypeSize() const {
429  return getInnerTypeSize(asDerived()->getInnerType());
430  }
431 
432  unsigned getInnerTypeSize(HasNoInnerType _) const {
433  return 0;
434  }
435 
436  unsigned getInnerTypeSize(QualType _) const {
437  return getInnerTypeLoc().getFullDataSize();
438  }
439 
440  unsigned getNextTypeAlign() const {
441  return getNextTypeAlign(asDerived()->getInnerType());
442  }
443 
444  unsigned getNextTypeAlign(HasNoInnerType _) const {
445  return 1;
446  }
447 
448  unsigned getNextTypeAlign(QualType T) const {
450  }
451 
452  TypeLoc getNextTypeLoc(HasNoInnerType _) const {
453  return TypeLoc();
454  }
455 
456  TypeLoc getNextTypeLoc(QualType T) const {
457  return TypeLoc(T, getNonLocalData());
458  }
459 };
460 
461 /// A metaprogramming class designed for concrete subtypes of abstract
462 /// types where all subtypes share equivalently-structured source
463 /// information. See the note on ConcreteTypeLoc.
464 template <class Base, class Derived, class TypeClass>
465 class InheritingConcreteTypeLoc : public Base {
466  friend class TypeLoc;
467  static bool classofType(const Type *Ty) {
468  return TypeClass::classof(Ty);
469  }
470 
471  static bool isKind(const TypeLoc &TL) {
472  return !TL.getType().hasLocalQualifiers() &&
473  Derived::classofType(TL.getTypePtr());
474  }
475  static bool isKind(const UnqualTypeLoc &TL) {
476  return Derived::classofType(TL.getTypePtr());
477  }
478 
479 public:
480  const TypeClass *getTypePtr() const {
481  return cast<TypeClass>(Base::getTypePtr());
482  }
483 };
484 
485 
488 };
489 
490 /// \brief A reasonable base class for TypeLocs that correspond to
491 /// types that are written as a type-specifier.
492 class TypeSpecTypeLoc : public ConcreteTypeLoc<UnqualTypeLoc,
493  TypeSpecTypeLoc,
494  Type,
495  TypeSpecLocInfo> {
496 public:
497  enum {
500  };
501 
503  return this->getLocalData()->NameLoc;
504  }
506  this->getLocalData()->NameLoc = Loc;
507  }
509  return SourceRange(getNameLoc(), getNameLoc());
510  }
512  setNameLoc(Loc);
513  }
514 
515 private:
516  friend class TypeLoc;
517  static bool isKind(const TypeLoc &TL);
518 };
519 
520 
523 };
524 
525 /// \brief Wrapper for source info for builtin types.
526 class BuiltinTypeLoc : public ConcreteTypeLoc<UnqualTypeLoc,
527  BuiltinTypeLoc,
528  BuiltinType,
529  BuiltinLocInfo> {
530 public:
532  return getLocalData()->BuiltinRange.getBegin();
533  }
535  getLocalData()->BuiltinRange = Loc;
536  }
538  SourceRange &BuiltinRange = getLocalData()->BuiltinRange;
539  if (!BuiltinRange.getBegin().isValid()) {
540  BuiltinRange = Range;
541  } else {
542  BuiltinRange.setBegin(std::min(Range.getBegin(), BuiltinRange.getBegin()));
543  BuiltinRange.setEnd(std::max(Range.getEnd(), BuiltinRange.getEnd()));
544  }
545  }
546 
548 
550  return *(static_cast<WrittenBuiltinSpecs*>(getExtraLocalData()));
551  }
553  return *(static_cast<WrittenBuiltinSpecs*>(getExtraLocalData()));
554  }
555 
556  bool needsExtraLocalData() const {
558  return (bk >= BuiltinType::UShort && bk <= BuiltinType::UInt128)
559  || (bk >= BuiltinType::Short && bk <= BuiltinType::Float128)
560  || bk == BuiltinType::UChar
561  || bk == BuiltinType::SChar;
562  }
563 
564  unsigned getExtraLocalDataSize() const {
565  return needsExtraLocalData() ? sizeof(WrittenBuiltinSpecs) : 0;
566  }
567 
568  unsigned getExtraLocalDataAlignment() const {
569  return needsExtraLocalData() ? alignof(WrittenBuiltinSpecs) : 1;
570  }
571 
573  return getLocalData()->BuiltinRange;
574  }
575 
577  if (needsExtraLocalData())
578  return static_cast<TypeSpecifierSign>(getWrittenBuiltinSpecs().Sign);
579  else
580  return TSS_unspecified;
581  }
582  bool hasWrittenSignSpec() const {
584  }
586  if (needsExtraLocalData())
587  getWrittenBuiltinSpecs().Sign = written;
588  }
589 
591  if (needsExtraLocalData())
592  return static_cast<TypeSpecifierWidth>(getWrittenBuiltinSpecs().Width);
593  else
594  return TSW_unspecified;
595  }
596  bool hasWrittenWidthSpec() const {
598  }
600  if (needsExtraLocalData())
601  getWrittenBuiltinSpecs().Width = written;
602  }
603 
605  bool hasWrittenTypeSpec() const {
607  }
609  if (needsExtraLocalData())
610  getWrittenBuiltinSpecs().Type = written;
611  }
612 
613  bool hasModeAttr() const {
614  if (needsExtraLocalData())
616  else
617  return false;
618  }
619  void setModeAttr(bool written) {
620  if (needsExtraLocalData())
621  getWrittenBuiltinSpecs().ModeAttr = written;
622  }
623 
625  setBuiltinLoc(Loc);
626  if (needsExtraLocalData()) {
628  wbs.Sign = TSS_unspecified;
629  wbs.Width = TSW_unspecified;
630  wbs.Type = TST_unspecified;
631  wbs.ModeAttr = false;
632  }
633  }
634 };
635 
636 
637 /// \brief Wrapper for source info for typedefs.
638 class TypedefTypeLoc : public InheritingConcreteTypeLoc<TypeSpecTypeLoc,
639  TypedefTypeLoc,
640  TypedefType> {
641 public:
643  return getTypePtr()->getDecl();
644  }
645 };
646 
647 /// \brief Wrapper for source info for injected class names of class
648 /// templates.
650  public InheritingConcreteTypeLoc<TypeSpecTypeLoc,
651  InjectedClassNameTypeLoc,
652  InjectedClassNameType> {
653 public:
655  return getTypePtr()->getDecl();
656  }
657 };
658 
659 /// \brief Wrapper for source info for unresolved typename using decls.
661  public InheritingConcreteTypeLoc<TypeSpecTypeLoc,
662  UnresolvedUsingTypeLoc,
663  UnresolvedUsingType> {
664 public:
666  return getTypePtr()->getDecl();
667  }
668 };
669 
670 /// \brief Wrapper for source info for tag types. Note that this only
671 /// records source info for the name itself; a type written 'struct foo'
672 /// should be represented as an ElaboratedTypeLoc. We currently
673 /// only do that when C++ is enabled because of the expense of
674 /// creating an ElaboratedType node for so many type references in C.
675 class TagTypeLoc : public InheritingConcreteTypeLoc<TypeSpecTypeLoc,
676  TagTypeLoc,
677  TagType> {
678 public:
679  TagDecl *getDecl() const { return getTypePtr()->getDecl(); }
680 
681  /// \brief True if the tag was defined in this type specifier.
682  bool isDefinition() const {
683  TagDecl *D = getDecl();
684  return D->isCompleteDefinition() &&
685  (D->getIdentifier() == nullptr || D->getLocation() == getNameLoc());
686  }
687 };
688 
689 /// \brief Wrapper for source info for record types.
690 class RecordTypeLoc : public InheritingConcreteTypeLoc<TagTypeLoc,
691  RecordTypeLoc,
692  RecordType> {
693 public:
694  RecordDecl *getDecl() const { return getTypePtr()->getDecl(); }
695 };
696 
697 /// \brief Wrapper for source info for enum types.
698 class EnumTypeLoc : public InheritingConcreteTypeLoc<TagTypeLoc,
699  EnumTypeLoc,
700  EnumType> {
701 public:
702  EnumDecl *getDecl() const { return getTypePtr()->getDecl(); }
703 };
704 
705 /// \brief Wrapper for template type parameters.
707  public InheritingConcreteTypeLoc<TypeSpecTypeLoc,
708  TemplateTypeParmTypeLoc,
709  TemplateTypeParmType> {
710 public:
711  TemplateTypeParmDecl *getDecl() const { return getTypePtr()->getDecl(); }
712 };
713 
716 };
717 
718 /// ProtocolLAngleLoc, ProtocolRAngleLoc, and the source locations for
719 /// protocol qualifiers are stored after Info.
720 class ObjCTypeParamTypeLoc : public ConcreteTypeLoc<UnqualTypeLoc,
721  ObjCTypeParamTypeLoc,
722  ObjCTypeParamType,
723  ObjCTypeParamTypeLocInfo> {
724  // SourceLocations are stored after Info, one for each protocol qualifier.
725  SourceLocation *getProtocolLocArray() const {
726  return (SourceLocation*)this->getExtraLocalData() + 2;
727  }
728 
729 public:
730  ObjCTypeParamDecl *getDecl() const { return getTypePtr()->getDecl(); }
731 
733  return this->getLocalData()->NameLoc;
734  }
735 
737  this->getLocalData()->NameLoc = Loc;
738  }
739 
741  return getNumProtocols() ?
742  *((SourceLocation*)this->getExtraLocalData()) :
743  SourceLocation();
744  }
746  *((SourceLocation*)this->getExtraLocalData()) = Loc;
747  }
748 
750  return getNumProtocols() ?
751  *((SourceLocation*)this->getExtraLocalData() + 1) :
752  SourceLocation();
753  }
755  *((SourceLocation*)this->getExtraLocalData() + 1) = Loc;
756  }
757 
758  unsigned getNumProtocols() const {
759  return this->getTypePtr()->getNumProtocols();
760  }
761 
762  SourceLocation getProtocolLoc(unsigned i) const {
763  assert(i < getNumProtocols() && "Index is out of bounds!");
764  return getProtocolLocArray()[i];
765  }
766  void setProtocolLoc(unsigned i, SourceLocation Loc) {
767  assert(i < getNumProtocols() && "Index is out of bounds!");
768  getProtocolLocArray()[i] = Loc;
769  }
770 
771  ObjCProtocolDecl *getProtocol(unsigned i) const {
772  assert(i < getNumProtocols() && "Index is out of bounds!");
773  return *(this->getTypePtr()->qual_begin() + i);
774  }
775 
777  return llvm::makeArrayRef(getProtocolLocArray(), getNumProtocols());
778  }
779 
781 
782  unsigned getExtraLocalDataSize() const {
783  if (!this->getNumProtocols()) return 0;
784  // When there are protocol qualifers, we have LAngleLoc and RAngleLoc
785  // as well.
786  return (this->getNumProtocols() + 2) * sizeof(SourceLocation) ;
787  }
788  unsigned getExtraLocalDataAlignment() const {
789  return alignof(SourceLocation);
790  }
792  SourceLocation start = getNameLoc();
794  if (end.isInvalid()) return SourceRange(start, start);
795  return SourceRange(start, end);
796  }
797 };
798 
799 /// \brief Wrapper for substituted template type parameters.
801  public InheritingConcreteTypeLoc<TypeSpecTypeLoc,
802  SubstTemplateTypeParmTypeLoc,
803  SubstTemplateTypeParmType> {
804 };
805 
806  /// \brief Wrapper for substituted template type parameters.
808  public InheritingConcreteTypeLoc<TypeSpecTypeLoc,
809  SubstTemplateTypeParmPackTypeLoc,
810  SubstTemplateTypeParmPackType> {
811 };
812 
814  union {
816 
817  /// A raw SourceLocation.
818  unsigned EnumOperandLoc;
819  };
820 
822 
824 };
825 
826 /// \brief Type source information for an attributed type.
827 class AttributedTypeLoc : public ConcreteTypeLoc<UnqualTypeLoc,
828  AttributedTypeLoc,
829  AttributedType,
830  AttributedLocInfo> {
831 public:
833  return getTypePtr()->getAttrKind();
834  }
835 
836  bool hasAttrExprOperand() const {
839  }
840 
841  bool hasAttrEnumOperand() const {
844  }
845 
846  bool hasAttrOperand() const {
848  }
849 
850  bool isQualifier() const {
851  return getTypePtr()->isQualifier();
852  }
853 
854  /// The modified type, which is generally canonically different from
855  /// the attribute type.
856  /// int main(int, char**) __attribute__((noreturn))
857  /// ~~~ ~~~~~~~~~~~~~
858  TypeLoc getModifiedLoc() const {
859  return getInnerTypeLoc();
860  }
861 
862  /// The location of the attribute name, i.e.
863  /// __attribute__((regparm(1000)))
864  /// ^~~~~~~
865  SourceLocation getAttrNameLoc() const {
866  return getLocalData()->AttrLoc;
867  }
868  void setAttrNameLoc(SourceLocation loc) {
869  getLocalData()->AttrLoc = loc;
870  }
871 
872  /// The attribute's expression operand, if it has one.
873  /// void *cur_thread __attribute__((address_space(21)))
874  /// ^~
875  Expr *getAttrExprOperand() const {
876  assert(hasAttrExprOperand());
877  return getLocalData()->ExprOperand;
878  }
879  void setAttrExprOperand(Expr *e) {
880  assert(hasAttrExprOperand());
881  getLocalData()->ExprOperand = e;
882  }
883 
884  /// The location of the attribute's enumerated operand, if it has one.
885  /// void * __attribute__((objc_gc(weak)))
886  /// ^~~~
888  assert(hasAttrEnumOperand());
889  return SourceLocation::getFromRawEncoding(getLocalData()->EnumOperandLoc);
890  }
892  assert(hasAttrEnumOperand());
894  }
895 
896  /// The location of the parentheses around the operand, if there is
897  /// an operand.
898  /// void * __attribute__((objc_gc(weak)))
899  /// ^ ^
901  assert(hasAttrOperand());
902  return getLocalData()->OperandParens;
903  }
905  assert(hasAttrOperand());
906  getLocalData()->OperandParens = range;
907  }
908 
910  // Note that this does *not* include the range of the attribute
911  // enclosure, e.g.:
912  // __attribute__((foo(bar)))
913  // ^~~~~~~~~~~~~~~ ~~
914  // or
915  // [[foo(bar)]]
916  // ^~ ~~
917  // That enclosure doesn't necessarily belong to a single attribute
918  // anyway.
919  SourceRange range(getAttrNameLoc());
920  if (hasAttrOperand())
921  range.setEnd(getAttrOperandParensRange().getEnd());
922  return range;
923  }
924 
926  setAttrNameLoc(loc);
927  if (hasAttrExprOperand()) {
929  setAttrExprOperand(nullptr);
930  } else if (hasAttrEnumOperand()) {
933  }
934  }
935 
937  return getTypePtr()->getModifiedType();
938  }
939 };
940 
941 
948 };
949 
950 // A helper class for defining ObjC TypeLocs that can qualified with
951 // protocols.
952 //
953 // TypeClass basically has to be either ObjCInterfaceType or
954 // ObjCObjectPointerType.
955 class ObjCObjectTypeLoc : public ConcreteTypeLoc<UnqualTypeLoc,
956  ObjCObjectTypeLoc,
957  ObjCObjectType,
958  ObjCObjectTypeLocInfo> {
959  // TypeSourceInfo*'s are stored after Info, one for each type argument.
960  TypeSourceInfo **getTypeArgLocArray() const {
961  return (TypeSourceInfo**)this->getExtraLocalData();
962  }
963 
964  // SourceLocations are stored after the type argument information, one for
965  // each Protocol.
966  SourceLocation *getProtocolLocArray() const {
967  return (SourceLocation*)(getTypeArgLocArray() + getNumTypeArgs());
968  }
969 
970 public:
972  return this->getLocalData()->TypeArgsLAngleLoc;
973  }
975  this->getLocalData()->TypeArgsLAngleLoc = Loc;
976  }
977 
979  return this->getLocalData()->TypeArgsRAngleLoc;
980  }
982  this->getLocalData()->TypeArgsRAngleLoc = Loc;
983  }
984 
985  unsigned getNumTypeArgs() const {
986  return this->getTypePtr()->getTypeArgsAsWritten().size();
987  }
988 
989  TypeSourceInfo *getTypeArgTInfo(unsigned i) const {
990  assert(i < getNumTypeArgs() && "Index is out of bounds!");
991  return getTypeArgLocArray()[i];
992  }
993 
994  void setTypeArgTInfo(unsigned i, TypeSourceInfo *TInfo) {
995  assert(i < getNumTypeArgs() && "Index is out of bounds!");
996  getTypeArgLocArray()[i] = TInfo;
997  }
998 
1000  return this->getLocalData()->ProtocolLAngleLoc;
1001  }
1003  this->getLocalData()->ProtocolLAngleLoc = Loc;
1004  }
1005 
1007  return this->getLocalData()->ProtocolRAngleLoc;
1008  }
1010  this->getLocalData()->ProtocolRAngleLoc = Loc;
1011  }
1012 
1013  unsigned getNumProtocols() const {
1014  return this->getTypePtr()->getNumProtocols();
1015  }
1016 
1017  SourceLocation getProtocolLoc(unsigned i) const {
1018  assert(i < getNumProtocols() && "Index is out of bounds!");
1019  return getProtocolLocArray()[i];
1020  }
1021  void setProtocolLoc(unsigned i, SourceLocation Loc) {
1022  assert(i < getNumProtocols() && "Index is out of bounds!");
1023  getProtocolLocArray()[i] = Loc;
1024  }
1025 
1026  ObjCProtocolDecl *getProtocol(unsigned i) const {
1027  assert(i < getNumProtocols() && "Index is out of bounds!");
1028  return *(this->getTypePtr()->qual_begin() + i);
1029  }
1030 
1031 
1033  return llvm::makeArrayRef(getProtocolLocArray(), getNumProtocols());
1034  }
1035 
1036  bool hasBaseTypeAsWritten() const {
1038  }
1039 
1040  void setHasBaseTypeAsWritten(bool HasBaseType) {
1041  getLocalData()->HasBaseTypeAsWritten = HasBaseType;
1042  }
1043 
1045  return getInnerTypeLoc();
1046  }
1047 
1050  if (start.isInvalid())
1051  start = getProtocolLAngleLoc();
1053  if (end.isInvalid())
1054  end = getTypeArgsRAngleLoc();
1055  return SourceRange(start, end);
1056  }
1057 
1059 
1060  unsigned getExtraLocalDataSize() const {
1061  return this->getNumTypeArgs() * sizeof(TypeSourceInfo *)
1062  + this->getNumProtocols() * sizeof(SourceLocation);
1063  }
1064 
1065  unsigned getExtraLocalDataAlignment() const {
1066  static_assert(alignof(ObjCObjectTypeLoc) >= alignof(TypeSourceInfo *),
1067  "not enough alignment for tail-allocated data");
1068  return alignof(TypeSourceInfo *);
1069  }
1070 
1072  return getTypePtr()->getBaseType();
1073  }
1074 };
1075 
1076 
1080 };
1081 
1082 /// \brief Wrapper for source info for ObjC interfaces.
1083 class ObjCInterfaceTypeLoc : public ConcreteTypeLoc<ObjCObjectTypeLoc,
1084  ObjCInterfaceTypeLoc,
1085  ObjCInterfaceType,
1086  ObjCInterfaceLocInfo> {
1087 public:
1089  return getTypePtr()->getDecl();
1090  }
1091 
1093  return getLocalData()->NameLoc;
1094  }
1095 
1097  getLocalData()->NameLoc = Loc;
1098  }
1099 
1101  return SourceRange(getNameLoc(), getNameEndLoc());
1102  }
1103 
1105  return getLocalData()->NameEndLoc;
1106  }
1107 
1109  getLocalData()->NameEndLoc = Loc;
1110  }
1111 
1113  setNameLoc(Loc);
1114  setNameEndLoc(Loc);
1115  }
1116 };
1117 
1121 };
1122 
1124  : public ConcreteTypeLoc<UnqualTypeLoc, ParenTypeLoc, ParenType,
1125  ParenLocInfo> {
1126 public:
1128  return this->getLocalData()->LParenLoc;
1129  }
1131  return this->getLocalData()->RParenLoc;
1132  }
1134  this->getLocalData()->LParenLoc = Loc;
1135  }
1137  this->getLocalData()->RParenLoc = Loc;
1138  }
1139 
1141  return SourceRange(getLParenLoc(), getRParenLoc());
1142  }
1143 
1145  setLParenLoc(Loc);
1146  setRParenLoc(Loc);
1147  }
1148 
1150  return getInnerTypeLoc();
1151  }
1152 
1154  return this->getTypePtr()->getInnerType();
1155  }
1156 };
1157 
1159  if (ParenTypeLoc::isKind(*this))
1160  return IgnoreParensImpl(*this);
1161  return *this;
1162 }
1163 
1164 
1165 struct AdjustedLocInfo { }; // Nothing.
1166 
1167 class AdjustedTypeLoc : public ConcreteTypeLoc<UnqualTypeLoc, AdjustedTypeLoc,
1168  AdjustedType, AdjustedLocInfo> {
1169 public:
1171  return getInnerTypeLoc();
1172  }
1173 
1175  // do nothing
1176  }
1177 
1179  // The inner type is the undecayed type, since that's what we have source
1180  // location information for.
1181  return getTypePtr()->getOriginalType();
1182  }
1183 
1185  return SourceRange();
1186  }
1187 
1188  unsigned getLocalDataSize() const {
1189  // sizeof(AdjustedLocInfo) is 1, but we don't need its address to be unique
1190  // anyway. TypeLocBuilder can't handle data sizes of 1.
1191  return 0; // No data.
1192  }
1193 };
1194 
1195 /// \brief Wrapper for source info for pointers decayed from arrays and
1196 /// functions.
1198  AdjustedTypeLoc, DecayedTypeLoc, DecayedType> {
1199 };
1200 
1203 };
1204 
1205 /// A base class for
1206 template <class Derived, class TypeClass, class LocalData = PointerLikeLocInfo>
1207 class PointerLikeTypeLoc : public ConcreteTypeLoc<UnqualTypeLoc, Derived,
1208  TypeClass, LocalData> {
1209 public:
1211  return this->getLocalData()->StarLoc;
1212  }
1214  this->getLocalData()->StarLoc = Loc;
1215  }
1216 
1218  return this->getInnerTypeLoc();
1219  }
1220 
1222  return SourceRange(getSigilLoc(), getSigilLoc());
1223  }
1224 
1226  setSigilLoc(Loc);
1227  }
1228 
1230  return this->getTypePtr()->getPointeeType();
1231  }
1232 };
1233 
1234 
1235 /// \brief Wrapper for source info for pointers.
1236 class PointerTypeLoc : public PointerLikeTypeLoc<PointerTypeLoc,
1237  PointerType> {
1238 public:
1240  return getSigilLoc();
1241  }
1243  setSigilLoc(Loc);
1244  }
1245 };
1246 
1247 
1248 /// \brief Wrapper for source info for block pointers.
1249 class BlockPointerTypeLoc : public PointerLikeTypeLoc<BlockPointerTypeLoc,
1250  BlockPointerType> {
1251 public:
1253  return getSigilLoc();
1254  }
1256  setSigilLoc(Loc);
1257  }
1258 };
1259 
1262 };
1263 
1264 /// \brief Wrapper for source info for member pointers.
1265 class MemberPointerTypeLoc : public PointerLikeTypeLoc<MemberPointerTypeLoc,
1266  MemberPointerType,
1267  MemberPointerLocInfo> {
1268 public:
1270  return getSigilLoc();
1271  }
1273  setSigilLoc(Loc);
1274  }
1275 
1276  const Type *getClass() const {
1277  return getTypePtr()->getClass();
1278  }
1280  return getLocalData()->ClassTInfo;
1281  }
1283  getLocalData()->ClassTInfo = TI;
1284  }
1285 
1287  setSigilLoc(Loc);
1288  setClassTInfo(nullptr);
1289  }
1290 
1292  if (TypeSourceInfo *TI = getClassTInfo())
1293  return SourceRange(TI->getTypeLoc().getBeginLoc(), getStarLoc());
1294  else
1295  return SourceRange(getStarLoc());
1296  }
1297 };
1298 
1299 /// Wraps an ObjCPointerType with source location information.
1301  public PointerLikeTypeLoc<ObjCObjectPointerTypeLoc,
1302  ObjCObjectPointerType> {
1303 public:
1305  return getSigilLoc();
1306  }
1307 
1309  setSigilLoc(Loc);
1310  }
1311 };
1312 
1313 
1314 class ReferenceTypeLoc : public PointerLikeTypeLoc<ReferenceTypeLoc,
1315  ReferenceType> {
1316 public:
1318  return getTypePtr()->getPointeeTypeAsWritten();
1319  }
1320 };
1321 
1323  public InheritingConcreteTypeLoc<ReferenceTypeLoc,
1324  LValueReferenceTypeLoc,
1325  LValueReferenceType> {
1326 public:
1328  return getSigilLoc();
1329  }
1331  setSigilLoc(Loc);
1332  }
1333 };
1334 
1336  public InheritingConcreteTypeLoc<ReferenceTypeLoc,
1337  RValueReferenceTypeLoc,
1338  RValueReferenceType> {
1339 public:
1341  return getSigilLoc();
1342  }
1344  setSigilLoc(Loc);
1345  }
1346 };
1347 
1348 
1354 };
1355 
1356 /// \brief Wrapper for source info for functions.
1357 class FunctionTypeLoc : public ConcreteTypeLoc<UnqualTypeLoc,
1358  FunctionTypeLoc,
1359  FunctionType,
1360  FunctionLocInfo> {
1361  bool hasExceptionSpec() const {
1362  if (auto *FPT = dyn_cast<FunctionProtoType>(getTypePtr())) {
1363  return FPT->hasExceptionSpec();
1364  }
1365  return false;
1366  }
1367 
1368  SourceRange *getExceptionSpecRangePtr() const {
1369  assert(hasExceptionSpec() && "No exception spec range");
1370  // After the Info comes the ParmVarDecl array, and after that comes the
1371  // exception specification information.
1372  return (SourceRange *)(getParmArray() + getNumParams());
1373  }
1374 public:
1376  return getLocalData()->LocalRangeBegin;
1377  }
1380  }
1381 
1383  return getLocalData()->LocalRangeEnd;
1384  }
1386  getLocalData()->LocalRangeEnd = L;
1387  }
1388 
1390  return this->getLocalData()->LParenLoc;
1391  }
1393  this->getLocalData()->LParenLoc = Loc;
1394  }
1395 
1397  return this->getLocalData()->RParenLoc;
1398  }
1400  this->getLocalData()->RParenLoc = Loc;
1401  }
1402 
1404  return SourceRange(getLParenLoc(), getRParenLoc());
1405  }
1406 
1408  if (hasExceptionSpec())
1409  return *getExceptionSpecRangePtr();
1410  return SourceRange();
1411  }
1413  if (hasExceptionSpec())
1414  *getExceptionSpecRangePtr() = R;
1415  }
1416 
1418  return llvm::makeArrayRef(getParmArray(), getNumParams());
1419  }
1420 
1421  // ParmVarDecls* are stored after Info, one for each parameter.
1423  return (ParmVarDecl**) getExtraLocalData();
1424  }
1425 
1426  unsigned getNumParams() const {
1427  if (isa<FunctionNoProtoType>(getTypePtr()))
1428  return 0;
1429  return cast<FunctionProtoType>(getTypePtr())->getNumParams();
1430  }
1431  ParmVarDecl *getParam(unsigned i) const { return getParmArray()[i]; }
1432  void setParam(unsigned i, ParmVarDecl *VD) { getParmArray()[i] = VD; }
1433 
1435  return getInnerTypeLoc();
1436  }
1437 
1440  }
1441 
1443  setLocalRangeBegin(Loc);
1444  setLParenLoc(Loc);
1445  setRParenLoc(Loc);
1446  setLocalRangeEnd(Loc);
1447  for (unsigned i = 0, e = getNumParams(); i != e; ++i)
1448  setParam(i, nullptr);
1449  if (hasExceptionSpec())
1450  setExceptionSpecRange(Loc);
1451  }
1452 
1453  /// \brief Returns the size of the type source info data block that is
1454  /// specific to this type.
1455  unsigned getExtraLocalDataSize() const {
1456  unsigned ExceptSpecSize = hasExceptionSpec() ? sizeof(SourceRange) : 0;
1457  return (getNumParams() * sizeof(ParmVarDecl *)) + ExceptSpecSize;
1458  }
1459 
1460  unsigned getExtraLocalDataAlignment() const { return alignof(ParmVarDecl *); }
1461 
1463 };
1464 
1466  public InheritingConcreteTypeLoc<FunctionTypeLoc,
1467  FunctionProtoTypeLoc,
1468  FunctionProtoType> {
1469 };
1470 
1472  public InheritingConcreteTypeLoc<FunctionTypeLoc,
1473  FunctionNoProtoTypeLoc,
1474  FunctionNoProtoType> {
1475 };
1476 
1477 
1481 };
1482 
1483 /// \brief Wrapper for source info for arrays.
1484 class ArrayTypeLoc : public ConcreteTypeLoc<UnqualTypeLoc,
1485  ArrayTypeLoc,
1486  ArrayType,
1487  ArrayLocInfo> {
1488 public:
1490  return getLocalData()->LBracketLoc;
1491  }
1493  getLocalData()->LBracketLoc = Loc;
1494  }
1495 
1497  return getLocalData()->RBracketLoc;
1498  }
1500  getLocalData()->RBracketLoc = Loc;
1501  }
1502 
1505  }
1506 
1507  Expr *getSizeExpr() const {
1508  return getLocalData()->Size;
1509  }
1510  void setSizeExpr(Expr *Size) {
1511  getLocalData()->Size = Size;
1512  }
1513 
1515  return getInnerTypeLoc();
1516  }
1517 
1520  }
1521 
1523  setLBracketLoc(Loc);
1524  setRBracketLoc(Loc);
1525  setSizeExpr(nullptr);
1526  }
1527 
1529 };
1530 
1532  public InheritingConcreteTypeLoc<ArrayTypeLoc,
1533  ConstantArrayTypeLoc,
1534  ConstantArrayType> {
1535 };
1536 
1538  public InheritingConcreteTypeLoc<ArrayTypeLoc,
1539  IncompleteArrayTypeLoc,
1540  IncompleteArrayType> {
1541 };
1542 
1544  public InheritingConcreteTypeLoc<ArrayTypeLoc,
1545  DependentSizedArrayTypeLoc,
1546  DependentSizedArrayType> {
1547 public:
1549  ArrayTypeLoc::initializeLocal(Context, Loc);
1551  }
1552 };
1553 
1555  public InheritingConcreteTypeLoc<ArrayTypeLoc,
1556  VariableArrayTypeLoc,
1557  VariableArrayType> {
1558 };
1559 
1560 
1561 // Location information for a TemplateName. Rudimentary for now.
1564 };
1565 
1570 };
1571 
1573  public ConcreteTypeLoc<UnqualTypeLoc,
1574  TemplateSpecializationTypeLoc,
1575  TemplateSpecializationType,
1576  TemplateSpecializationLocInfo> {
1577 public:
1579  return getLocalData()->TemplateKWLoc;
1580  }
1582  getLocalData()->TemplateKWLoc = Loc;
1583  }
1584 
1586  return getLocalData()->LAngleLoc;
1587  }
1589  getLocalData()->LAngleLoc = Loc;
1590  }
1591 
1593  return getLocalData()->RAngleLoc;
1594  }
1596  getLocalData()->RAngleLoc = Loc;
1597  }
1598 
1599  unsigned getNumArgs() const {
1600  return getTypePtr()->getNumArgs();
1601  }
1603  getArgInfos()[i] = AI;
1604  }
1606  return getArgInfos()[i];
1607  }
1608 
1609  TemplateArgumentLoc getArgLoc(unsigned i) const {
1610  return TemplateArgumentLoc(getTypePtr()->getArg(i), getArgLocInfo(i));
1611  }
1612 
1614  return getLocalData()->NameLoc;
1615  }
1617  getLocalData()->NameLoc = Loc;
1618  }
1619 
1620  /// \brief - Copy the location information from the given info.
1622  unsigned size = getFullDataSize();
1623  assert(size == Loc.getFullDataSize());
1624 
1625  // We're potentially copying Expr references here. We don't
1626  // bother retaining them because TypeSourceInfos live forever, so
1627  // as long as the Expr was retained when originally written into
1628  // the TypeLoc, we're okay.
1629  memcpy(Data, Loc.Data, size);
1630  }
1631 
1633  if (getTemplateKeywordLoc().isValid())
1635  else
1637  }
1638 
1640  setTemplateKeywordLoc(Loc);
1641  setTemplateNameLoc(Loc);
1642  setLAngleLoc(Loc);
1643  setRAngleLoc(Loc);
1644  initializeArgLocs(Context, getNumArgs(), getTypePtr()->getArgs(),
1645  getArgInfos(), Loc);
1646  }
1647 
1648  static void initializeArgLocs(ASTContext &Context, unsigned NumArgs,
1649  const TemplateArgument *Args,
1650  TemplateArgumentLocInfo *ArgInfos,
1651  SourceLocation Loc);
1652 
1653  unsigned getExtraLocalDataSize() const {
1654  return getNumArgs() * sizeof(TemplateArgumentLocInfo);
1655  }
1656 
1657  unsigned getExtraLocalDataAlignment() const {
1658  return alignof(TemplateArgumentLocInfo);
1659  }
1660 
1661 private:
1662  TemplateArgumentLocInfo *getArgInfos() const {
1663  return static_cast<TemplateArgumentLocInfo*>(getExtraLocalData());
1664  }
1665 };
1666 
1667 //===----------------------------------------------------------------------===//
1668 //
1669 // All of these need proper implementations.
1670 //
1671 //===----------------------------------------------------------------------===//
1672 
1673 // FIXME: size expression and attribute locations (or keyword if we
1674 // ever fully support altivec syntax).
1675 class VectorTypeLoc : public InheritingConcreteTypeLoc<TypeSpecTypeLoc,
1676  VectorTypeLoc,
1677  VectorType> {
1678 };
1679 
1680 // FIXME: size expression and attribute locations.
1681 class ExtVectorTypeLoc : public InheritingConcreteTypeLoc<VectorTypeLoc,
1682  ExtVectorTypeLoc,
1683  ExtVectorType> {
1684 };
1685 
1686 // FIXME: attribute locations.
1687 // For some reason, this isn't a subtype of VectorType.
1689  public InheritingConcreteTypeLoc<TypeSpecTypeLoc,
1690  DependentSizedExtVectorTypeLoc,
1691  DependentSizedExtVectorType> {
1692 };
1693 
1694 // FIXME: location of the '_Complex' keyword.
1695 class ComplexTypeLoc : public InheritingConcreteTypeLoc<TypeSpecTypeLoc,
1696  ComplexTypeLoc,
1697  ComplexType> {
1698 };
1699 
1704 };
1705 
1707 };
1708 
1711 };
1712 
1713 template <class Derived, class TypeClass, class LocalData = TypeofLocInfo>
1715  : public ConcreteTypeLoc<UnqualTypeLoc, Derived, TypeClass, LocalData> {
1716 public:
1718  return this->getLocalData()->TypeofLoc;
1719  }
1721  this->getLocalData()->TypeofLoc = Loc;
1722  }
1723 
1725  return this->getLocalData()->LParenLoc;
1726  }
1728  this->getLocalData()->LParenLoc = Loc;
1729  }
1730 
1732  return this->getLocalData()->RParenLoc;
1733  }
1735  this->getLocalData()->RParenLoc = Loc;
1736  }
1737 
1739  return SourceRange(getLParenLoc(), getRParenLoc());
1740  }
1742  setLParenLoc(range.getBegin());
1743  setRParenLoc(range.getEnd());
1744  }
1745 
1747  return SourceRange(getTypeofLoc(), getRParenLoc());
1748  }
1749 
1751  setTypeofLoc(Loc);
1752  setLParenLoc(Loc);
1753  setRParenLoc(Loc);
1754  }
1755 };
1756 
1757 class TypeOfExprTypeLoc : public TypeofLikeTypeLoc<TypeOfExprTypeLoc,
1758  TypeOfExprType,
1759  TypeOfExprTypeLocInfo> {
1760 public:
1762  return getTypePtr()->getUnderlyingExpr();
1763  }
1764  // Reimplemented to account for GNU/C++ extension
1765  // typeof unary-expression
1766  // where there are no parentheses.
1768 };
1769 
1771  : public TypeofLikeTypeLoc<TypeOfTypeLoc, TypeOfType, TypeOfTypeLocInfo> {
1772 public:
1774  return this->getTypePtr()->getUnderlyingType();
1775  }
1777  return this->getLocalData()->UnderlyingTInfo;
1778  }
1780  this->getLocalData()->UnderlyingTInfo = TI;
1781  }
1782 
1784 };
1785 
1786 // FIXME: location of the 'decltype' and parens.
1787 class DecltypeTypeLoc : public InheritingConcreteTypeLoc<TypeSpecTypeLoc,
1788  DecltypeTypeLoc,
1789  DecltypeType> {
1790 public:
1792 };
1793 
1795  // FIXME: While there's only one unary transform right now, future ones may
1796  // need different representations
1799 };
1800 
1801 class UnaryTransformTypeLoc : public ConcreteTypeLoc<UnqualTypeLoc,
1802  UnaryTransformTypeLoc,
1803  UnaryTransformType,
1804  UnaryTransformTypeLocInfo> {
1805 public:
1807  void setKWLoc(SourceLocation Loc) { getLocalData()->KWLoc = Loc; }
1808 
1811 
1814 
1816  return getLocalData()->UnderlyingTInfo;
1817  }
1819  getLocalData()->UnderlyingTInfo = TInfo;
1820  }
1821 
1823  return SourceRange(getKWLoc(), getRParenLoc());
1824  }
1825 
1827  return SourceRange(getLParenLoc(), getRParenLoc());
1828  }
1830  setLParenLoc(Range.getBegin());
1831  setRParenLoc(Range.getEnd());
1832  }
1833 
1835  setKWLoc(Loc);
1836  setRParenLoc(Loc);
1837  setLParenLoc(Loc);
1838  }
1839 };
1840 
1842  : public InheritingConcreteTypeLoc<TypeSpecTypeLoc, DeducedTypeLoc,
1843  DeducedType> {};
1844 
1846  : public InheritingConcreteTypeLoc<DeducedTypeLoc, AutoTypeLoc, AutoType> {
1847 };
1848 
1850  : public InheritingConcreteTypeLoc<DeducedTypeLoc,
1851  DeducedTemplateSpecializationTypeLoc,
1852  DeducedTemplateSpecializationType> {
1853 public:
1855  return getNameLoc();
1856  }
1858  setNameLoc(Loc);
1859  }
1860 };
1861 
1864  /// \brief Data associated with the nested-name-specifier location.
1866 };
1867 
1868 class ElaboratedTypeLoc : public ConcreteTypeLoc<UnqualTypeLoc,
1869  ElaboratedTypeLoc,
1870  ElaboratedType,
1871  ElaboratedLocInfo> {
1872 public:
1874  return this->getLocalData()->ElaboratedKWLoc;
1875  }
1877  this->getLocalData()->ElaboratedKWLoc = Loc;
1878  }
1879 
1881  return NestedNameSpecifierLoc(getTypePtr()->getQualifier(),
1882  getLocalData()->QualifierData);
1883  }
1884 
1886  assert(QualifierLoc.getNestedNameSpecifier()
1887  == getTypePtr()->getQualifier() &&
1888  "Inconsistent nested-name-specifier pointer");
1889  getLocalData()->QualifierData = QualifierLoc.getOpaqueData();
1890  }
1891 
1893  if (getElaboratedKeywordLoc().isValid())
1894  if (getQualifierLoc())
1897  else
1899  else
1900  return getQualifierLoc().getSourceRange();
1901  }
1902 
1904 
1906  return getInnerTypeLoc();
1907  }
1908 
1910  return getTypePtr()->getNamedType();
1911  }
1912 
1914  unsigned size = getFullDataSize();
1915  assert(size == Loc.getFullDataSize());
1916  memcpy(Data, Loc.Data, size);
1917  }
1918 };
1919 
1920 // This is exactly the structure of an ElaboratedTypeLoc whose inner
1921 // type is some sort of TypeDeclTypeLoc.
1924 };
1925 
1926 class DependentNameTypeLoc : public ConcreteTypeLoc<UnqualTypeLoc,
1927  DependentNameTypeLoc,
1928  DependentNameType,
1929  DependentNameLocInfo> {
1930 public:
1932  return this->getLocalData()->ElaboratedKWLoc;
1933  }
1935  this->getLocalData()->ElaboratedKWLoc = Loc;
1936  }
1937 
1939  return NestedNameSpecifierLoc(getTypePtr()->getQualifier(),
1940  getLocalData()->QualifierData);
1941  }
1942 
1944  assert(QualifierLoc.getNestedNameSpecifier()
1945  == getTypePtr()->getQualifier() &&
1946  "Inconsistent nested-name-specifier pointer");
1947  getLocalData()->QualifierData = QualifierLoc.getOpaqueData();
1948  }
1949 
1951  return this->getLocalData()->NameLoc;
1952  }
1954  this->getLocalData()->NameLoc = Loc;
1955  }
1956 
1958  if (getElaboratedKeywordLoc().isValid())
1960  else
1962  }
1963 
1965  unsigned size = getFullDataSize();
1966  assert(size == Loc.getFullDataSize());
1967  memcpy(Data, Loc.Data, size);
1968  }
1969 
1971 };
1972 
1977  // followed by a TemplateArgumentLocInfo[]
1978 };
1979 
1981  public ConcreteTypeLoc<UnqualTypeLoc,
1982  DependentTemplateSpecializationTypeLoc,
1983  DependentTemplateSpecializationType,
1984  DependentTemplateSpecializationLocInfo> {
1985 public:
1987  return this->getLocalData()->ElaboratedKWLoc;
1988  }
1990  this->getLocalData()->ElaboratedKWLoc = Loc;
1991  }
1992 
1994  if (!getLocalData()->QualifierData)
1995  return NestedNameSpecifierLoc();
1996 
1997  return NestedNameSpecifierLoc(getTypePtr()->getQualifier(),
1998  getLocalData()->QualifierData);
1999  }
2000 
2002  if (!QualifierLoc) {
2003  // Even if we have a nested-name-specifier in the dependent
2004  // template specialization type, we won't record the nested-name-specifier
2005  // location information when this type-source location information is
2006  // part of a nested-name-specifier.
2007  getLocalData()->QualifierData = nullptr;
2008  return;
2009  }
2010 
2011  assert(QualifierLoc.getNestedNameSpecifier()
2012  == getTypePtr()->getQualifier() &&
2013  "Inconsistent nested-name-specifier pointer");
2014  getLocalData()->QualifierData = QualifierLoc.getOpaqueData();
2015  }
2016 
2018  return getLocalData()->TemplateKWLoc;
2019  }
2021  getLocalData()->TemplateKWLoc = Loc;
2022  }
2023 
2025  return this->getLocalData()->NameLoc;
2026  }
2028  this->getLocalData()->NameLoc = Loc;
2029  }
2030 
2032  return this->getLocalData()->LAngleLoc;
2033  }
2035  this->getLocalData()->LAngleLoc = Loc;
2036  }
2037 
2039  return this->getLocalData()->RAngleLoc;
2040  }
2042  this->getLocalData()->RAngleLoc = Loc;
2043  }
2044 
2045  unsigned getNumArgs() const {
2046  return getTypePtr()->getNumArgs();
2047  }
2048 
2050  getArgInfos()[i] = AI;
2051  }
2053  return getArgInfos()[i];
2054  }
2055 
2056  TemplateArgumentLoc getArgLoc(unsigned i) const {
2057  return TemplateArgumentLoc(getTypePtr()->getArg(i), getArgLocInfo(i));
2058  }
2059 
2061  if (getElaboratedKeywordLoc().isValid())
2063  else if (getQualifierLoc())
2065  else if (getTemplateKeywordLoc().isValid())
2067  else
2069  }
2070 
2072  unsigned size = getFullDataSize();
2073  assert(size == Loc.getFullDataSize());
2074  memcpy(Data, Loc.Data, size);
2075  }
2076 
2078 
2079  unsigned getExtraLocalDataSize() const {
2080  return getNumArgs() * sizeof(TemplateArgumentLocInfo);
2081  }
2082 
2083  unsigned getExtraLocalDataAlignment() const {
2084  return alignof(TemplateArgumentLocInfo);
2085  }
2086 
2087 private:
2088  TemplateArgumentLocInfo *getArgInfos() const {
2089  return static_cast<TemplateArgumentLocInfo*>(getExtraLocalData());
2090  }
2091 };
2092 
2093 
2096 };
2097 
2099  : public ConcreteTypeLoc<UnqualTypeLoc, PackExpansionTypeLoc,
2100  PackExpansionType, PackExpansionTypeLocInfo> {
2101 public:
2103  return this->getLocalData()->EllipsisLoc;
2104  }
2105 
2107  this->getLocalData()->EllipsisLoc = Loc;
2108  }
2109 
2112  }
2113 
2115  setEllipsisLoc(Loc);
2116  }
2117 
2119  return getInnerTypeLoc();
2120  }
2121 
2123  return this->getTypePtr()->getPattern();
2124  }
2125 };
2126 
2129 };
2130 
2131 class AtomicTypeLoc : public ConcreteTypeLoc<UnqualTypeLoc, AtomicTypeLoc,
2132  AtomicType, AtomicTypeLocInfo> {
2133 public:
2135  return this->getInnerTypeLoc();
2136  }
2137 
2139  return SourceRange(getKWLoc(), getRParenLoc());
2140  }
2141 
2143  return this->getLocalData()->KWLoc;
2144  }
2146  this->getLocalData()->KWLoc = Loc;
2147  }
2148 
2150  return this->getLocalData()->LParenLoc;
2151  }
2153  this->getLocalData()->LParenLoc = Loc;
2154  }
2155 
2157  return this->getLocalData()->RParenLoc;
2158  }
2160  this->getLocalData()->RParenLoc = Loc;
2161  }
2162 
2164  return SourceRange(getLParenLoc(), getRParenLoc());
2165  }
2167  setLParenLoc(Range.getBegin());
2168  setRParenLoc(Range.getEnd());
2169  }
2170 
2172  setKWLoc(Loc);
2173  setLParenLoc(Loc);
2174  setRParenLoc(Loc);
2175  }
2176 
2178  return this->getTypePtr()->getValueType();
2179  }
2180 };
2181 
2184 };
2185 
2186 class PipeTypeLoc : public ConcreteTypeLoc<UnqualTypeLoc, PipeTypeLoc, PipeType,
2187  PipeTypeLocInfo> {
2188 public:
2189  TypeLoc getValueLoc() const { return this->getInnerTypeLoc(); }
2190 
2192 
2193  SourceLocation getKWLoc() const { return this->getLocalData()->KWLoc; }
2194  void setKWLoc(SourceLocation Loc) { this->getLocalData()->KWLoc = Loc; }
2195 
2197  setKWLoc(Loc);
2198  }
2199 
2200  QualType getInnerType() const { return this->getTypePtr()->getElementType(); }
2201 };
2202 
2203 template <typename T>
2204 inline T TypeLoc::getAsAdjusted() const {
2205  TypeLoc Cur = *this;
2206  while (!T::isKind(Cur)) {
2207  if (auto PTL = Cur.getAs<ParenTypeLoc>())
2208  Cur = PTL.getInnerLoc();
2209  else if (auto ATL = Cur.getAs<AttributedTypeLoc>())
2210  Cur = ATL.getModifiedLoc();
2211  else if (auto ETL = Cur.getAs<ElaboratedTypeLoc>())
2212  Cur = ETL.getNamedTypeLoc();
2213  else if (auto ATL = Cur.getAs<AdjustedTypeLoc>())
2214  Cur = ATL.getOriginalLoc();
2215  else
2216  break;
2217  }
2218  return Cur.getAs<T>();
2219 }
2220 }
2221 
2222 #endif
Kind getKind() const
Definition: Type.h:2105
TypeSourceInfo * getUnderlyingTInfo() const
Definition: TypeLoc.h:1776
unsigned getLocalDataSize() const
Definition: TypeLoc.h:1188
SourceLocation getEnd() const
SourceLocation getNameLoc() const
Definition: TypeLoc.h:732
T getAs() const
Convert to the specified TypeLoc type, returning a null TypeLoc if this TypeLoc is not of the desired...
Definition: TypeLoc.h:64
ObjCInterfaceDecl * getDecl() const
Get the declaration of this interface.
Definition: Type.h:5177
static unsigned getFullDataSizeForType(QualType Ty)
Returns the size of type source info data block for the given type.
Definition: TypeLoc.cpp:75
SourceLocation getElaboratedKeywordLoc() const
Definition: TypeLoc.h:1986
unsigned getLocalDataAlignment() const
Returns the alignment of the type source info data block that is specific to this type...
Definition: TypeLoc.h:292
void initializeLocal(ASTContext &Context, SourceLocation Loc)
Definition: TypeLoc.h:1750
TypeSourceInfo * ClassTInfo
Definition: TypeLoc.h:1261
CXXRecordDecl * getDecl() const
Definition: TypeLoc.h:654
A (possibly-)qualified type.
Definition: Type.h:616
QualType getInnerType() const
Definition: TypeLoc.h:2122
void setStarLoc(SourceLocation Loc)
Definition: TypeLoc.h:1308
SourceLocation TypeArgsRAngleLoc
Definition: TypeLoc.h:944
Wrapper for source info for tag types.
Definition: TypeLoc.h:675
SourceLocation getNameLoc() const
Definition: TypeLoc.h:1950
HasNoInnerType getInnerType() const
Definition: TypeLoc.h:421
SourceRange getSourceRange() const LLVM_READONLY
Retrieve the source range covering the entirety of this nested-name-specifier.
SourceLocation findNullabilityLoc() const
Find the location of the nullability specifier (__nonnull, __nullable, or __null_unspecifier), if there is one.
Definition: TypeLoc.cpp:358
IdentifierInfo * getIdentifier() const
getIdentifier - Get the identifier that names this declaration, if there is one.
Definition: Decl.h:232
void setNameEndLoc(SourceLocation Loc)
Definition: TypeLoc.h:1108
SourceLocation LParenLoc
Definition: TypeLoc.h:1702
void setKWLoc(SourceLocation Loc)
Definition: TypeLoc.h:2194
SourceLocation KWLoc
Definition: TypeLoc.h:2183
unsigned getExtraLocalDataAlignment() const
Definition: TypeLoc.h:568
void setRParenLoc(SourceLocation Loc)
Definition: TypeLoc.h:1399
void setStarLoc(SourceLocation Loc)
Definition: TypeLoc.h:1242
void setLAngleLoc(SourceLocation Loc)
Definition: TypeLoc.h:1588
void setExceptionSpecRange(SourceRange R)
Definition: TypeLoc.h:1412
TypeLoc getNamedTypeLoc() const
Definition: TypeLoc.h:1905
unsigned getNumArgs() const
Retrieve the number of template arguments.
Definition: Type.h:4734
void initializeLocal(ASTContext &Context, SourceLocation Loc)
Definition: TypeLoc.h:624
C Language Family Type Representation.
void setWrittenWidthSpec(TypeSpecifierWidth written)
Definition: TypeLoc.h:599
CXXRecordDecl * getDecl() const
Definition: Type.cpp:3095
ArrayRef< SourceLocation > getProtocolLocs() const
Definition: TypeLoc.h:1032
SourceLocation StarLoc
Definition: TypeLoc.h:1202
bool hasWrittenTypeSpec() const
Definition: TypeLoc.h:605
TypeLoc getPatternLoc() const
Definition: TypeLoc.h:2118
QualType getInnerType() const
Definition: TypeLoc.h:1909
WrittenBuiltinSpecs & getWrittenBuiltinSpecs()
Definition: TypeLoc.h:549
SourceRange getLocalSourceRange() const
Definition: TypeLoc.h:2138
SourceLocation ProtocolLAngleLoc
Definition: TypeLoc.h:945
The base class of the type hierarchy.
Definition: Type.h:1303
SourceLocation getLocalRangeBegin() const
Definition: TypeLoc.h:1375
void setTemplateKeywordLoc(SourceLocation Loc)
Definition: TypeLoc.h:2020
Wrapper for source info for typedefs.
Definition: TypeLoc.h:638
bool hasBaseTypeAsWritten() const
Definition: TypeLoc.h:1036
A container of type source information.
Definition: Decl.h:62
unsigned EnumOperandLoc
A raw SourceLocation.
Definition: TypeLoc.h:818
SourceLocation LParenLoc
Definition: TypeLoc.h:2128
unsigned getRawEncoding() const
When a SourceLocation itself cannot be used, this returns an (opaque) 32-bit integer encoding for it...
Wrapper for source info for pointers decayed from arrays and functions.
Definition: TypeLoc.h:1197
bool hasAttrEnumOperand() const
Definition: TypeLoc.h:841
T getAsAdjusted() const
Convert to the specified TypeLoc type, returning a null TypeLoc if this TypeLock is not of the desire...
Definition: TypeLoc.h:2204
SourceLocation LocalRangeEnd
Definition: TypeLoc.h:1353
SourceRange getAttrOperandParensRange() const
The location of the parentheses around the operand, if there is an operand.
Definition: TypeLoc.h:900
TypeLoc getNextTypeLoc() const
Definition: TypeLoc.h:382
unsigned getLocalDataSize() const
Returns the size of the type source info data block that is specific to this type.
Definition: TypeLoc.h:284
Expr * getUnderlyingExpr() const
Definition: TypeLoc.h:1761
void setParensRange(SourceRange range)
Definition: TypeLoc.h:1741
void initializeLocal(ASTContext &Context, SourceLocation Loc)
Definition: TypeLoc.cpp:443
SourceLocation AttrLoc
Definition: TypeLoc.h:823
Wrapper for source info for member pointers.
Definition: TypeLoc.h:1265
Wrapper of type source information for a type with non-trivial direct qualifiers. ...
Definition: TypeLoc.h:254
unsigned getExtraLocalDataAlignment() const
Definition: TypeLoc.h:788
bool hasAttrExprOperand() const
Definition: TypeLoc.h:836
TypeSpecifierType
Specifies the kind of type.
Definition: Specifiers.h:45
TemplateTypeParmDecl * getDecl() const
Definition: Type.h:4028
QualType getOriginalType() const
Definition: Type.h:2288
void setProtocolRAngleLoc(SourceLocation Loc)
Definition: TypeLoc.h:754
void setBegin(SourceLocation b)
SourceLocation RParenLoc
Definition: TypeLoc.h:1703
void * Data
Definition: TypeLoc.h:45
bool hasAttrOperand() const
Definition: TypeLoc.h:846
const Type * getTypePtr() const
Definition: TypeLoc.h:234
ParmVarDecl - Represents a parameter to a function.
Definition: Decl.h:1434
TypeLocClass getTypeLocClass() const
Definition: TypeLoc.h:238
unsigned getNumArgs() const
Retrieve the number of template arguments.
Definition: Type.h:4390
SourceLocation NameEndLoc
Definition: TypeLoc.h:1079
void initializeLocal(ASTContext &Context, SourceLocation Loc)
Definition: TypeLoc.h:1225
SourceLocation getAmpAmpLoc() const
Definition: TypeLoc.h:1340
void setQualifierLoc(NestedNameSpecifierLoc QualifierLoc)
Definition: TypeLoc.h:1885
A reasonable base class for TypeLocs that correspond to types that are written as a type-specifier...
Definition: TypeLoc.h:492
SourceLocation NameLoc
Definition: TypeLoc.h:1078
void setTypeArgTInfo(unsigned i, TypeSourceInfo *TInfo)
Definition: TypeLoc.h:994
SourceRange getLocalSourceRange() const
Definition: TypeLoc.h:1822
void setParensRange(SourceRange Range)
Definition: TypeLoc.h:2166
void initializeLocal(ASTContext &Context, SourceLocation Loc)
Definition: TypeLoc.h:511
Base wrapper for a particular "section" of type source info.
Definition: TypeLoc.h:40
RecordDecl - Represents a struct/union/class.
Definition: Decl.h:3354
QualType getInnerType() const
Definition: TypeLoc.h:1229
void initializeLocal(ASTContext &Context, SourceLocation Loc)
Definition: TypeLoc.h:2196
unsigned getExtraLocalDataSize() const
Definition: TypeLoc.h:564
void setLocalRangeEnd(SourceLocation L)
Definition: TypeLoc.h:1385
SourceLocation TypeArgsLAngleLoc
Definition: TypeLoc.h:943
bool isDefinition() const
True if the tag was defined in this type specifier.
Definition: TypeLoc.h:682
bool isNull() const
Definition: TypeLoc.h:102
unsigned getExtraLocalDataAlignment() const
Definition: TypeLoc.h:1065
qual_iterator qual_begin() const
Definition: Type.h:4875
SourceRange getLocalSourceRange() const
Definition: TypeLoc.h:508
TypeLoc getPointeeLoc() const
Definition: TypeLoc.h:1217
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Definition: ASTContext.h:128
unsigned getLocalDataAlignment() const
Definition: TypeLoc.h:356
unsigned getExtraLocalDataSize() const
Returns the size of the type source info data block that is specific to this type.
Definition: TypeLoc.h:1455
A C++ nested-name-specifier augmented with source location information.
void initializeLocal(ASTContext &Context, SourceLocation Loc)
Definition: TypeLoc.h:2171
void setBuiltinLoc(SourceLocation Loc)
Definition: TypeLoc.h:534
SourceRange getLocalSourceRange() const
Definition: TypeLoc.h:1632
void setArgLocInfo(unsigned i, TemplateArgumentLocInfo AI)
Definition: TypeLoc.h:1602
TypeSpecifierSign
Specifies the signedness of a type, e.g., signed or unsigned.
Definition: Specifiers.h:33
EnumDecl * getDecl() const
Definition: TypeLoc.h:702
void setRBracketLoc(SourceLocation Loc)
Definition: TypeLoc.h:1499
static SourceLocation getFromRawEncoding(unsigned Encoding)
Turn a raw encoding of a SourceLocation object into a real SourceLocation.
TypeSourceInfo * getTypeArgTInfo(unsigned i) const
Definition: TypeLoc.h:989
SourceLocation getLocalRangeEnd() const
Definition: TypeLoc.h:1382
bool isCompleteDefinition() const
isCompleteDefinition - Return true if this decl has its body fully specified.
Definition: Decl.h:2960
SourceLocation getTypeArgsRAngleLoc() const
Definition: TypeLoc.h:978
bool hasWrittenSignSpec() const
Definition: TypeLoc.h:582
SourceLocation RBracketLoc
Definition: TypeLoc.h:1479
ParmVarDecl * getParam(unsigned i) const
Definition: TypeLoc.h:1431
UnresolvedUsingTypenameDecl * getDecl() const
Definition: TypeLoc.h:665
SourceLocation KWLoc
Definition: TypeLoc.h:2128
SourceLocation getLParenLoc() const
Definition: TypeLoc.h:1809
NestedNameSpecifier * getQualifier() const
Retrieve the qualification on this type.
Definition: Type.h:4662
unsigned getNumProtocols() const
Definition: TypeLoc.h:758
void setElaboratedKeywordLoc(SourceLocation Loc)
Definition: TypeLoc.h:1934
SourceRange getLocalSourceRange() const
Get the local source range.
Definition: TypeLoc.h:141
TypeLoc getValueLoc() const
Definition: TypeLoc.h:2189
void initializeLocal(ASTContext &Context, SourceLocation Loc)
Definition: TypeLoc.h:2114
unsigned getNumProtocols() const
Definition: TypeLoc.h:1013
Wrapper for source info for unresolved typename using decls.
Definition: TypeLoc.h:660
SourceLocation getBuiltinLoc() const
Definition: TypeLoc.h:531
void copy(DependentTemplateSpecializationTypeLoc Loc)
Definition: TypeLoc.h:2071
SourceRange getLocalSourceRange() const
Definition: TypeLoc.h:572
void setUnderlyingTInfo(TypeSourceInfo *TInfo)
Definition: TypeLoc.h:1818
Wrapper of type source information for a type with no direct qualifiers.
Definition: TypeLoc.h:229
QualType getUnderlyingType() const
Definition: Type.h:3655
RecordDecl * getDecl() const
Definition: TypeLoc.h:694
Expr * getUnderlyingExpr() const
Definition: Type.h:3675
SourceLocation getBeginLoc() const
Get the begin source location.
Definition: TypeLoc.cpp:169
ArrayRef< SourceLocation > getProtocolLocs() const
Definition: TypeLoc.h:776
void setProtocolLoc(unsigned i, SourceLocation Loc)
Definition: TypeLoc.h:766
const Type * getTypePtr() const
Definition: TypeLoc.h:118
void setLParenLoc(SourceLocation Loc)
Definition: TypeLoc.h:2152
void setNameLoc(SourceLocation Loc)
Definition: TypeLoc.h:505
void setCaretLoc(SourceLocation Loc)
Definition: TypeLoc.h:1255
void setRAngleLoc(SourceLocation Loc)
Definition: TypeLoc.h:2041
Wrapper for source info for injected class names of class templates.
Definition: TypeLoc.h:649
QualType getInnerType() const
Definition: TypeLoc.h:2200
friend bool operator==(const TypeLoc &LHS, const TypeLoc &RHS)
Definition: TypeLoc.h:197
SourceLocation getRAngleLoc() const
Definition: TypeLoc.h:1592
QualType getBaseType() const
Gets the base type of this object type.
Definition: Type.h:5030
void initializeLocal(ASTContext &Context, SourceLocation Loc)
Definition: TypeLoc.cpp:425
QualType getReturnType() const
Definition: Type.h:3065
Wrapper for source info for functions.
Definition: TypeLoc.h:1357
void initializeLocal(ASTContext &Context, SourceLocation Loc)
Initializes the local data of this type source info block to provide no information.
Definition: TypeLoc.h:270
UnresolvedUsingTypenameDecl * getDecl() const
Definition: Type.h:3560
NestedNameSpecifierLoc getQualifierLoc() const
Definition: TypeLoc.h:1938
Wrapper for substituted template type parameters.
Definition: TypeLoc.h:807
TypeSourceInfo * getClassTInfo() const
Definition: TypeLoc.h:1279
Wrapper for substituted template type parameters.
Definition: TypeLoc.h:800
bool needsExtraLocalData() const
Definition: TypeLoc.h:556
RecordDecl * getDecl() const
Definition: Type.h:3793
void setRParenLoc(SourceLocation Loc)
Definition: TypeLoc.h:1734
TypeLoc(const Type *ty, void *opaqueData)
Definition: TypeLoc.h:94
void expandBuiltinRange(SourceRange Range)
Definition: TypeLoc.h:537
unsigned getExtraLocalDataSize() const
Definition: TypeLoc.h:1653
SourceLocation getProtocolRAngleLoc() const
Definition: TypeLoc.h:749
SourceRange getLocalSourceRange() const
Definition: TypeLoc.h:1291
SourceLocation getRParenLoc() const
Definition: TypeLoc.h:1731
Wrapper for source info for ObjC interfaces.
Definition: TypeLoc.h:1083
SourceRange BuiltinRange
Definition: TypeLoc.h:522
void initializeLocal(ASTContext &Context, SourceLocation Loc)
Definition: TypeLoc.h:1442
NestedNameSpecifier * getQualifier() const
Retrieve the qualification on this type.
Definition: Type.h:4603
SourceRange getLocalSourceRange() const
Definition: TypeLoc.h:1140
TypeClass getTypeClass() const
Definition: Type.h:1555
void setNameLoc(SourceLocation Loc)
Definition: TypeLoc.h:736
Represents an Objective-C protocol declaration.
Definition: DeclObjC.h:1985
void setProtocolLoc(unsigned i, SourceLocation Loc)
Definition: TypeLoc.h:1021
void setLocalRangeBegin(SourceLocation L)
Definition: TypeLoc.h:1378
Represents an ObjC class declaration.
Definition: DeclObjC.h:1108
void copy(ElaboratedTypeLoc Loc)
Definition: TypeLoc.h:1913
SourceLocation getTypeofLoc() const
Definition: TypeLoc.h:1717
SourceLocation getTypeArgsLAngleLoc() const
Definition: TypeLoc.h:971
unsigned getNumParams() const
Definition: TypeLoc.h:1426
SourceLocation LocalRangeBegin
Definition: TypeLoc.h:1350
bool isInvalid() const
T castAs() const
Convert to the specified TypeLoc type, asserting that this TypeLoc is of the desired type...
Definition: TypeLoc.h:53
TypedefNameDecl * getTypedefNameDecl() const
Definition: TypeLoc.h:642
SourceRange getBracketsRange() const
Definition: TypeLoc.h:1503
void setKWLoc(SourceLocation Loc)
Definition: TypeLoc.h:1807
bool hasModeAttr() const
Definition: TypeLoc.h:613
void setUnderlyingTInfo(TypeSourceInfo *TI) const
Definition: TypeLoc.h:1779
AttributedType::Kind getAttrKind() const
Definition: TypeLoc.h:832
EnumDecl * getDecl() const
Definition: Type.h:3816
SourceLocation getKWLoc() const
Definition: TypeLoc.h:2193
SourceRange getLocalSourceRange() const
Definition: TypeLoc.h:1221
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:152
QualType getValueType() const
Gets the type contained by this atomic type, i.e.
Definition: Type.h:5402
void * QualifierData
Data associated with the nested-name-specifier location.
Definition: TypeLoc.h:1865
TagDecl * getDecl() const
Definition: TypeLoc.h:679
void setParensRange(SourceRange Range)
Definition: TypeLoc.h:1829
QualType getInnerType() const
Definition: TypeLoc.h:1462
unsigned getExtraLocalDataAlignment() const
Definition: TypeLoc.h:395
SourceLocation getAttrEnumOperandLoc() const
The modified type, which is generally canonically different from the attribute type.
Definition: TypeLoc.h:887
SourceLocation getNameLoc() const
Definition: TypeLoc.h:547
SourceLocation getLBracketLoc() const
Definition: TypeLoc.h:1489
SourceRange getLocalSourceRange() const
Definition: TypeLoc.h:1746
TypeSourceInfo * UnderlyingTInfo
Definition: TypeLoc.h:1798
ASTContext * Context
SourceRange getLocalSourceRange() const
Definition: TypeLoc.h:1100
void setSizeExpr(Expr *Size)
Definition: TypeLoc.h:1510
void setArgLocInfo(unsigned i, TemplateArgumentLocInfo AI)
Definition: TypeLoc.h:2049
void initialize(ASTContext &Context, SourceLocation Loc) const
Initializes this to state that every location in this type is the given location. ...
Definition: TypeLoc.h:174
bool hasLocalQualifiers() const
Determine whether this particular QualType instance has any qualifiers, without looking through any t...
Definition: Type.h:720
void setTemplateNameLoc(SourceLocation Loc)
Definition: TypeLoc.h:2027
bool isQualifier() const
Definition: TypeLoc.h:850
SourceLocation getElaboratedKeywordLoc() const
Definition: TypeLoc.h:1873
QualType getInnerType() const
Definition: TypeLoc.h:936
Type source information for an attributed type.
Definition: TypeLoc.h:827
SourceLocation getRBracketLoc() const
Definition: TypeLoc.h:1496
void setQualifierLoc(NestedNameSpecifierLoc QualifierLoc)
Definition: TypeLoc.h:2001
Expr - This represents one expression.
Definition: Expr.h:105
void setModeAttr(bool written)
Definition: TypeLoc.h:619
void * getOpaqueData() const
Get the pointer where source information is stored.
Definition: TypeLoc.h:123
Declaration of a template type parameter.
TypeSpecifierWidth getWrittenWidthSpec() const
Definition: TypeLoc.h:590
unsigned getExtraLocalDataSize() const
Definition: TypeLoc.h:391
SourceLocation getSigilLoc() const
Definition: TypeLoc.h:1210
Expr * getUnderlyingExpr() const
Definition: Type.h:3609
unsigned getExtraLocalDataAlignment() const
Definition: TypeLoc.h:1460
TypeLoc getInnerTypeLoc() const
Definition: TypeLoc.h:423
QualType getNamedType() const
Retrieve the type named by the qualified-id.
Definition: Type.h:4606
void initializeLocal(ASTContext &Context, SourceLocation Loc)
Definition: TypeLoc.h:1286
#define bool
Definition: stdbool.h:31
SourceLocation getLParenLoc() const
Definition: TypeLoc.h:2149
void setWrittenSignSpec(TypeSpecifierSign written)
Definition: TypeLoc.h:585
void setRParenLoc(SourceLocation Loc)
Definition: TypeLoc.h:2159
char __ovld __cnfn min(char x, char y)
Returns y if y < x, otherwise it returns x.
SourceRange getExceptionSpecRange() const
Definition: TypeLoc.h:1407
void setNameLoc(SourceLocation Loc)
Definition: TypeLoc.h:1096
Kind getAttrKind() const
Definition: Type.h:3906
void setLParenLoc(SourceLocation Loc)
Definition: TypeLoc.h:1727
SourceLocation getTemplateNameLoc() const
Definition: TypeLoc.h:1613
QualType getType() const
Get the type for which this source info wrapper provides information.
Definition: TypeLoc.h:114
Wrapper for source info for enum types.
Definition: TypeLoc.h:698
void setEllipsisLoc(SourceLocation Loc)
Definition: TypeLoc.h:2106
ProtocolLAngleLoc, ProtocolRAngleLoc, and the source locations for protocol qualifiers are stored aft...
Definition: TypeLoc.h:720
SourceLocation LParenLoc
Definition: TypeLoc.h:1119
void setHasBaseTypeAsWritten(bool HasBaseType)
Definition: TypeLoc.h:1040
ObjCProtocolDecl * getProtocol(unsigned i) const
Definition: TypeLoc.h:771
SourceRange getLocalSourceRange() const
Definition: TypeLoc.h:1892
void initializeLocal(ASTContext &Context, SourceLocation Loc)
Definition: TypeLoc.cpp:417
SourceRange getParensRange() const
Definition: TypeLoc.h:1403
SourceRange getLocalSourceRange() const
Definition: TypeLoc.h:791
QualType getInnerType() const
Definition: TypeLoc.h:1178
void setLParenLoc(SourceLocation Loc)
Definition: TypeLoc.h:1810
SourceLocation getLocEnd() const LLVM_READONLY
Definition: TypeLoc.h:138
void setQualifierLoc(NestedNameSpecifierLoc QualifierLoc)
Definition: TypeLoc.h:1943
TypeSourceInfo * UnderlyingTInfo
Definition: TypeLoc.h:1710
__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
const TypeClass * getTypePtr() const
Definition: TypeLoc.h:480
SourceLocation TypeofLoc
Definition: TypeLoc.h:1701
SourceLocation getProtocolRAngleLoc() const
Definition: TypeLoc.h:1006
unsigned getExtraLocalDataSize() const
Definition: TypeLoc.h:782
void initializeLocal(ASTContext &Context, SourceLocation Loc)
Definition: TypeLoc.cpp:390
void initializeLocal(ASTContext &Context, SourceLocation Loc)
Definition: TypeLoc.cpp:433
SourceLocation getEndLoc() const
Get the end source location.
Definition: TypeLoc.cpp:206
void setStarLoc(SourceLocation Loc)
Definition: TypeLoc.h:1272
void setTypeofLoc(SourceLocation Loc)
Definition: TypeLoc.h:1720
SourceLocation getKWLoc() const
Definition: TypeLoc.h:1806
TypeLoc getInnerLoc() const
Definition: TypeLoc.h:1149
TemplateArgumentLoc getArgLoc(unsigned i) const
Definition: TypeLoc.h:2056
Wrapper for source info for arrays.
Definition: TypeLoc.h:1484
TypeLoc getNextTypeLoc() const
Definition: TypeLoc.h:278
TemplateArgumentLoc getArgLoc(unsigned i) const
Definition: TypeLoc.h:1609
TypeLoc getTypeLoc() const
Return the TypeLoc wrapper for the type source info.
Definition: TypeLoc.h:222
void setAttrOperandParensRange(SourceRange range)
Definition: TypeLoc.h:904
SourceLocation getTemplateKeywordLoc() const
Definition: TypeLoc.h:1578
SourceLocation getRParenLoc() const
Definition: TypeLoc.h:1130
TypeLoc getValueLoc() const
Definition: TypeLoc.h:2134
SourceLocation LParenLoc
Definition: TypeLoc.h:1351
void setLAngleLoc(SourceLocation Loc)
Definition: TypeLoc.h:2034
QualType getInnerType() const
Definition: TypeLoc.h:1317
Encodes a location in the source.
void initializeLocal(ASTContext &Context, SourceLocation Loc)
Definition: TypeLoc.h:1834
const Type * getTypePtr() const
Retrieves a pointer to the underlying (unqualified) type.
Definition: Type.h:5489
bool isQualifier() const
Does this attribute behave like a type qualifier?
Definition: Type.cpp:2994
SourceRange OperandParens
Definition: TypeLoc.h:821
SourceLocation RParenLoc
Definition: TypeLoc.h:1352
void initializeLocal(ASTContext &Context, SourceLocation Loc)
Definition: TypeLoc.h:1144
bool isValid() const
Return true if this is a valid SourceLocation object.
void initializeLocal(ASTContext &Context, SourceLocation Loc)
Definition: TypeLoc.cpp:401
SourceLocation getLParenLoc() const
Definition: TypeLoc.h:1389
void setProtocolLAngleLoc(SourceLocation Loc)
Definition: TypeLoc.h:745
TagDecl - Represents the declaration of a struct/union/class/enum.
Definition: Decl.h:2816
void setProtocolRAngleLoc(SourceLocation Loc)
Definition: TypeLoc.h:1009
SourceRange getLocalSourceRange() const
Definition: TypeLoc.h:909
SourceLocation getNameEndLoc() const
Definition: TypeLoc.h:1104
A metaprogramming base class for TypeLoc classes which correspond to a particular Type subclass...
Definition: TypeLoc.h:339
QualType getInnerType() const
Definition: TypeLoc.h:1071
SourceLocation getNameLoc() const
Definition: TypeLoc.h:502
LocalData * getLocalData() const
Definition: TypeLoc.h:399
friend bool operator!=(const TypeLoc &LHS, const TypeLoc &RHS)
Definition: TypeLoc.h:201
SourceRange getParensRange() const
Definition: TypeLoc.h:1826
void initializeLocal(ASTContext &Context, SourceLocation Loc)
Definition: TypeLoc.h:1174
SourceLocation ProtocolRAngleLoc
Definition: TypeLoc.h:946
SourceLocation RParenLoc
Definition: TypeLoc.h:1120
unsigned getNumTypeArgs() const
Definition: TypeLoc.h:985
SourceLocation getRParenLoc() const
Definition: TypeLoc.h:2156
UnqualTypeLoc(const Type *Ty, void *Data)
Definition: TypeLoc.h:232
SourceLocation NameLoc
Definition: TypeLoc.h:487
TypeLocClass
The kinds of TypeLocs.
Definition: TypeLoc.h:83
TypedefNameDecl * getDecl() const
Definition: Type.h:3593
void setElaboratedKeywordLoc(SourceLocation Loc)
Definition: TypeLoc.h:1989
SourceRange getLocalSourceRange() const
Definition: TypeLoc.h:1048
TypeLocClass getTypeLocClass() const
Definition: TypeLoc.h:97
TypeSpecifierType getWrittenTypeSpec() const
Definition: TypeLoc.cpp:288
void setWrittenTypeSpec(TypeSpecifierType written)
Definition: TypeLoc.h:608
SourceRange getLocalSourceRange() const
Definition: TypeLoc.h:2191
SourceLocation getBegin() const
void setAmpLoc(SourceLocation Loc)
Definition: TypeLoc.h:1330
TypeLoc getReturnLoc() const
Definition: TypeLoc.h:1434
void setLBracketLoc(SourceLocation Loc)
Definition: TypeLoc.h:1492
SourceLocation ElaboratedKWLoc
Definition: TypeLoc.h:1863
QualType getInnerType() const
Definition: TypeLoc.h:2177
SourceLocation LBracketLoc
Definition: TypeLoc.h:1479
SourceRange getLocalSourceRange() const
Definition: TypeLoc.h:1518
TemplateArgumentLocInfo getArgLocInfo(unsigned i) const
Definition: TypeLoc.h:2052
A metaprogramming class designed for concrete subtypes of abstract types where all subtypes share equ...
Definition: TypeLoc.h:465
SourceLocation getKWLoc() const
Definition: TypeLoc.h:2142
SourceLocation getTemplateNameLoc() const
Definition: TypeLoc.h:1854
const void * Ty
Definition: TypeLoc.h:44
static QualType getFromOpaquePtr(const void *Ptr)
Definition: Type.h:665
SourceLocation getProtocolLAngleLoc() const
Definition: TypeLoc.h:740
ObjCTypeParamDecl * getDecl() const
Definition: Type.h:4938
void * getExtraLocalData() const
Gets a pointer past the Info structure; useful for classes with local data that can't be captured in ...
Definition: TypeLoc.h:406
SourceLocation getNameLoc() const
Definition: TypeLoc.h:1092
friend class TypeLoc
Definition: TypeLoc.h:345
ArrayRef< QualType > getTypeArgsAsWritten() const
Retrieve the type arguments of this object type as they were written.
Definition: Type.h:5076
Defines various enumerations that describe declaration and type specifiers.
void setLParenLoc(SourceLocation Loc)
Definition: TypeLoc.h:1392
QualType getInnerType() const
Definition: TypeLoc.h:1153
void setTemplateKeywordLoc(SourceLocation Loc)
Definition: TypeLoc.h:1581
TypeLoc(QualType ty, void *opaqueData)
Definition: TypeLoc.h:92
void setTypeArgsLAngleLoc(SourceLocation Loc)
Definition: TypeLoc.h:974
TypeLoc findExplicitQualifierLoc() const
Find a type with the location of an explicit type qualifier.
Definition: TypeLoc.cpp:369
Base class for declarations which introduce a typedef-name.
Definition: Decl.h:2682
Represents a template argument.
Definition: TemplateBase.h:40
void setClassTInfo(TypeSourceInfo *TI)
Definition: TypeLoc.h:1282
void initializeLocal(ASTContext &Context, SourceLocation loc)
Definition: TypeLoc.h:925
SourceRange getLocalSourceRange() const
Definition: TypeLoc.h:256
void setAmpAmpLoc(SourceLocation Loc)
Definition: TypeLoc.h:1343
unsigned getLocalDataSize() const
Definition: TypeLoc.h:360
void initializeLocal(ASTContext &Context, SourceLocation Loc)
Definition: TypeLoc.h:1522
SourceLocation getEllipsisLoc() const
Definition: TypeLoc.h:2102
SourceLocation getLocStart() const LLVM_READONLY
Definition: TypeLoc.h:137
TypeLoc IgnoreParens() const
Definition: TypeLoc.h:1158
SourceLocation getStarLoc() const
Definition: TypeLoc.h:1304
SourceLocation getTemplateKeywordLoc() const
Definition: TypeLoc.h:2017
Represents a dependent using declaration which was marked with typename.
Definition: DeclCXX.h:3497
Represents the declaration of an Objective-C type parameter.
Definition: DeclObjC.h:537
SourceLocation getCaretLoc() const
Definition: TypeLoc.h:1252
Expr * getSizeExpr() const
Definition: TypeLoc.h:1507
ObjCInterfaceDecl * getIFaceDecl() const
Definition: TypeLoc.h:1088
void * getNonLocalData() const
Definition: TypeLoc.h:413
SourceRange getLocalSourceRange() const
Definition: TypeLoc.h:1957
EnumDecl - Represents an enum.
Definition: Decl.h:3102
SourceLocation getElaboratedKeywordLoc() const
Definition: TypeLoc.h:1931
QualType getUnderlyingType() const
Definition: TypeLoc.h:1773
QualType getModifiedType() const
Definition: Type.h:3910
unsigned getNumProtocols() const
Return the number of qualifying protocols in this type, or 0 if there are none.
Definition: Type.h:4882
SourceLocation NameLoc
Definition: TypeLoc.h:1563
void setSigilLoc(SourceLocation Loc)
Definition: TypeLoc.h:1213
TemplateTypeParmDecl * getDecl() const
Definition: TypeLoc.h:711
void * getOpaqueData() const
Retrieve the opaque pointer that refers to source-location data.
void setNameLoc(SourceLocation Loc)
Definition: TypeLoc.h:1953
SourceRange getSourceRange() const LLVM_READONLY
Get the full source range.
Definition: TypeLoc.h:134
void setAttrEnumOperandLoc(SourceLocation loc)
Definition: TypeLoc.h:891
TypeSpecifierSign getWrittenSignSpec() const
Definition: TypeLoc.h:576
Location wrapper for a TemplateArgument.
Definition: TemplateBase.h:428
static bool classof(const OMPClause *T)
TypeLoc getOriginalLoc() const
Definition: TypeLoc.h:1170
unsigned getExtraLocalDataAlignment() const
Definition: TypeLoc.h:1657
QualType getInnerType() const
Definition: TypeLoc.h:1528
static void initializeArgLocs(ASTContext &Context, unsigned NumArgs, const TemplateArgument *Args, TemplateArgumentLocInfo *ArgInfos, SourceLocation Loc)
Definition: TypeLoc.cpp:462
void setTemplateNameLoc(SourceLocation Loc)
Definition: TypeLoc.h:1857
UnqualTypeLoc getUnqualifiedLoc() const
Definition: TypeLoc.h:260
QualType getInnerType() const
Definition: Type.h:2207
SourceRange getParensRange() const
Definition: TypeLoc.h:2163
TypeLoc getBaseLoc() const
Definition: TypeLoc.h:1044
void setTypeArgsRAngleLoc(SourceLocation Loc)
Definition: TypeLoc.h:981
Wrapper for source info for record types.
Definition: TypeLoc.h:690
void copy(TemplateSpecializationTypeLoc Loc)
Copy the location information from the given info.
Definition: TypeLoc.h:1621
ObjCProtocolDecl * getProtocol(unsigned i) const
Definition: TypeLoc.h:1026
Wraps an ObjCPointerType with source location information.
Definition: TypeLoc.h:1300
const TypeClass * getTypePtr() const
Definition: TypeLoc.h:386
NestedNameSpecifier * getQualifier() const
Definition: Type.h:4725
void initializeLocal(ASTContext &Context, SourceLocation Loc)
Definition: TypeLoc.h:1639
SourceLocation getProtocolLAngleLoc() const
Definition: TypeLoc.h:999
char __ovld __cnfn max(char x, char y)
Returns y if x < y, otherwise it returns x.
NestedNameSpecifierLoc getQualifierLoc() const
Definition: TypeLoc.h:1993
Structure that packs information about the type specifiers that were written in a particular type spe...
Definition: Specifiers.h:84
Expr * getUnderlyingExpr() const
Definition: TypeLoc.h:1791
const Type * getClass() const
Definition: Type.h:2475
unsigned getFullDataSize() const
Returns the size of the type source info data block.
Definition: TypeLoc.h:146
void setKWLoc(SourceLocation Loc)
Definition: TypeLoc.h:2145
SourceRange getLocalSourceRange() const
Definition: TypeLoc.h:1184
SourceLocation getProtocolLoc(unsigned i) const
Definition: TypeLoc.h:1017
SourceLocation NameLoc
Definition: TypeLoc.h:1923
bool hasWrittenWidthSpec() const
Definition: TypeLoc.h:596
SourceRange getParensRange() const
Definition: TypeLoc.h:1738
void setEnd(SourceLocation e)
Represents a C++ struct/union/class.
Definition: DeclCXX.h:267
TypeSpecifierWidth
Specifies the width of a type, e.g., short, long, or long long.
Definition: Specifiers.h:25
SourceLocation getTemplateNameLoc() const
Definition: TypeLoc.h:2024
void setParam(unsigned i, ParmVarDecl *VD)
Definition: TypeLoc.h:1432
void copyLocal(TypeLoc other)
Definition: TypeLoc.h:274
static unsigned getLocalAlignmentForType(QualType Ty)
Returns the alignment of type source info data block for the given type.
Definition: TypeLoc.cpp:57
NestedNameSpecifier * getNestedNameSpecifier() const
Retrieve the nested-name-specifier to which this instance refers.
void copyLocal(Derived other)
Definition: TypeLoc.h:368
SourceRange getLocalSourceRange() const
Definition: TypeLoc.h:2110
TypeLoc getElementLoc() const
Definition: TypeLoc.h:1514
void setLParenLoc(SourceLocation Loc)
Definition: TypeLoc.h:1133
SourceLocation RParenLoc
Definition: TypeLoc.h:2128
SourceLocation getRParenLoc() const
Definition: TypeLoc.h:1396
Location information for a TemplateArgument.
Definition: TemplateBase.h:369
void initializeLocal(ASTContext &Context, SourceLocation Loc)
Definition: TypeLoc.h:1112
SourceRange getLocalSourceRange() const
Definition: TypeLoc.h:1438
QualType getPattern() const
Retrieve the pattern of this pack expansion, which is the type that will be repeatedly instantiated w...
Definition: Type.h:4814
void setRParenLoc(SourceLocation Loc)
Definition: TypeLoc.h:1813
ArrayRef< ParmVarDecl * > getParams() const
Definition: TypeLoc.h:1417
void setRAngleLoc(SourceLocation Loc)
Definition: TypeLoc.h:1595
SourceLocation getProtocolLoc(unsigned i) const
Definition: TypeLoc.h:762
const WrittenBuiltinSpecs & getWrittenBuiltinSpecs() const
Definition: TypeLoc.h:552
QualType getPointeeTypeAsWritten() const
Definition: Type.h:2380
TagDecl * getDecl() const
Definition: Type.cpp:2986
SourceLocation getRParenLoc() const
Definition: TypeLoc.h:1812
void copy(TypeLoc other)
Copies the other type loc into this one.
Definition: TypeLoc.cpp:145
QualType getElementType() const
Definition: Type.h:5432
QualType getElementType() const
Definition: Type.h:2531
void setProtocolLAngleLoc(SourceLocation Loc)
Definition: TypeLoc.h:1002
SourceLocation getStarLoc() const
Definition: TypeLoc.h:1239
SourceRange getLocalSourceRange() const
Definition: TypeLoc.cpp:279
void initializeFullCopy(TypeLoc Other)
Initializes this by copying its information from another TypeLoc of the same type.
Definition: TypeLoc.h:180
SourceLocation getAmpLoc() const
Definition: TypeLoc.h:1327
SourceLocation getLAngleLoc() const
Definition: TypeLoc.h:1585
Wrapper for source info for builtin types.
Definition: TypeLoc.h:526
void setRParenLoc(SourceLocation Loc)
Definition: TypeLoc.h:1136
Wrapper for template type parameters.
Definition: TypeLoc.h:706
A trivial tuple used to represent a source range.
SourceLocation getLocation() const
Definition: DeclBase.h:407
UnqualTypeLoc getUnqualifiedLoc() const
Skips past any qualifiers, if this is qualified.
Definition: TypeLoc.h:304
void copy(DependentNameTypeLoc Loc)
Definition: TypeLoc.h:1964
NestedNameSpecifierLoc getQualifierLoc() const
Definition: TypeLoc.h:1880
void setTemplateNameLoc(SourceLocation Loc)
Definition: TypeLoc.h:1616
ParmVarDecl ** getParmArray() const
Definition: TypeLoc.h:1422
void initializeLocal(ASTContext &Context, SourceLocation Loc)
Definition: TypeLoc.h:1548
A base class for.
Definition: TypeLoc.h:1207
void initializeFullCopy(TypeLoc Other, unsigned Size)
Initializes this by copying its information from another TypeLoc of the same type.
Definition: TypeLoc.h:188
const Type * getClass() const
Definition: TypeLoc.h:1276
unsigned getExtraLocalDataSize() const
Definition: TypeLoc.h:1060
Wrapper for source info for pointers.
Definition: TypeLoc.h:1236
TemplateArgumentLocInfo getArgLocInfo(unsigned i) const
Definition: TypeLoc.h:1605
Wrapper for source info for block pointers.
Definition: TypeLoc.h:1249
TypeSourceInfo * getUnderlyingTInfo() const
Definition: TypeLoc.h:1815
void setElaboratedKeywordLoc(SourceLocation Loc)
Definition: TypeLoc.h:1876
SourceLocation getStarLoc() const
Definition: TypeLoc.h:1269
ObjCTypeParamDecl * getDecl() const
Definition: TypeLoc.h:730
SourceLocation getLParenLoc() const
Definition: TypeLoc.h:1724
SourceLocation getLParenLoc() const
Definition: TypeLoc.h:1127