Clang Project

clang_source_code/include/clang/AST/Type.h
1//===- Type.h - C Language Family Type Representation -----------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9/// \file
10/// C Language Family Type Representation
11///
12/// This file defines the clang::Type interface and subclasses, used to
13/// represent types for languages in the C family.
14//
15//===----------------------------------------------------------------------===//
16
17#ifndef LLVM_CLANG_AST_TYPE_H
18#define LLVM_CLANG_AST_TYPE_H
19
20#include "clang/AST/NestedNameSpecifier.h"
21#include "clang/AST/TemplateName.h"
22#include "clang/Basic/AddressSpaces.h"
23#include "clang/Basic/AttrKinds.h"
24#include "clang/Basic/Diagnostic.h"
25#include "clang/Basic/ExceptionSpecificationType.h"
26#include "clang/Basic/LLVM.h"
27#include "clang/Basic/Linkage.h"
28#include "clang/Basic/PartialDiagnostic.h"
29#include "clang/Basic/SourceLocation.h"
30#include "clang/Basic/Specifiers.h"
31#include "clang/Basic/Visibility.h"
32#include "llvm/ADT/APInt.h"
33#include "llvm/ADT/APSInt.h"
34#include "llvm/ADT/ArrayRef.h"
35#include "llvm/ADT/FoldingSet.h"
36#include "llvm/ADT/None.h"
37#include "llvm/ADT/Optional.h"
38#include "llvm/ADT/PointerIntPair.h"
39#include "llvm/ADT/PointerUnion.h"
40#include "llvm/ADT/StringRef.h"
41#include "llvm/ADT/Twine.h"
42#include "llvm/ADT/iterator_range.h"
43#include "llvm/Support/Casting.h"
44#include "llvm/Support/Compiler.h"
45#include "llvm/Support/ErrorHandling.h"
46#include "llvm/Support/PointerLikeTypeTraits.h"
47#include "llvm/Support/type_traits.h"
48#include "llvm/Support/TrailingObjects.h"
49#include <cassert>
50#include <cstddef>
51#include <cstdint>
52#include <cstring>
53#include <string>
54#include <type_traits>
55#include <utility>
56
57namespace clang {
58
59class ExtQuals;
60class QualType;
61class TagDecl;
62class Type;
63
64enum {
65  TypeAlignmentInBits = 4,
66  TypeAlignment = 1 << TypeAlignmentInBits
67};
68
69// namespace clang
70
71namespace llvm {
72
73  template <typename T>
74  struct PointerLikeTypeTraits;
75  template<>
76  struct PointerLikeTypeTraits::clang::Type*> {
77    static inline void *getAsVoidPointer(::clang::Type *P) { return P; }
78
79    static inline ::clang::Type *getFromVoidPointer(void *P) {
80      return static_cast::clang::Type*>(P);
81    }
82
83    enum { NumLowBitsAvailable = clang::TypeAlignmentInBits };
84  };
85
86  template<>
87  struct PointerLikeTypeTraits::clang::ExtQuals*> {
88    static inline void *getAsVoidPointer(::clang::ExtQuals *P) { return P; }
89
90    static inline ::clang::ExtQuals *getFromVoidPointer(void *P) {
91      return static_cast::clang::ExtQuals*>(P);
92    }
93
94    enum { NumLowBitsAvailable = clang::TypeAlignmentInBits };
95  };
96
97// namespace llvm
98
99namespace clang {
100
101class ASTContext;
102template <typenameclass CanQual;
103class CXXRecordDecl;
104class DeclContext;
105class EnumDecl;
106class Expr;
107class ExtQualsTypeCommonBase;
108class FunctionDecl;
109class IdentifierInfo;
110class NamedDecl;
111class ObjCInterfaceDecl;
112class ObjCProtocolDecl;
113class ObjCTypeParamDecl;
114struct PrintingPolicy;
115class RecordDecl;
116class Stmt;
117class TagDecl;
118class TemplateArgument;
119class TemplateArgumentListInfo;
120class TemplateArgumentLoc;
121class TemplateTypeParmDecl;
122class TypedefNameDecl;
123class UnresolvedUsingTypenameDecl;
124
125using CanQualType = CanQual<Type>;
126
127// Provide forward declarations for all of the *Type classes.
128#define TYPE(Class, Base) class Class##Type;
129#include "clang/AST/TypeNodes.def"
130
131/// The collection of all-type qualifiers we support.
132/// Clang supports five independent qualifiers:
133/// * C99: const, volatile, and restrict
134/// * MS: __unaligned
135/// * Embedded C (TR18037): address spaces
136/// * Objective C: the GC attributes (none, weak, or strong)
137class Qualifiers {
138public:
139  enum TQ { // NOTE: These flags must be kept in sync with DeclSpec::TQ.
140    Const    = 0x1,
141    Restrict = 0x2,
142    Volatile = 0x4,
143    CVRMask = Const | Volatile | Restrict
144  };
145
146  enum GC {
147    GCNone = 0,
148    Weak,
149    Strong
150  };
151
152  enum ObjCLifetime {
153    /// There is no lifetime qualification on this type.
154    OCL_None,
155
156    /// This object can be modified without requiring retains or
157    /// releases.
158    OCL_ExplicitNone,
159
160    /// Assigning into this object requires the old value to be
161    /// released and the new value to be retained.  The timing of the
162    /// release of the old value is inexact: it may be moved to
163    /// immediately after the last known point where the value is
164    /// live.
165    OCL_Strong,
166
167    /// Reading or writing from this object requires a barrier call.
168    OCL_Weak,
169
170    /// Assigning into this object requires a lifetime extension.
171    OCL_Autoreleasing
172  };
173
174  enum {
175    /// The maximum supported address space number.
176    /// 23 bits should be enough for anyone.
177    MaxAddressSpace = 0x7fffffu,
178
179    /// The width of the "fast" qualifier mask.
180    FastWidth = 3,
181
182    /// The fast qualifier mask.
183    FastMask = (1 << FastWidth) - 1
184  };
185
186  /// Returns the common set of qualifiers while removing them from
187  /// the given sets.
188  static Qualifiers removeCommonQualifiers(Qualifiers &LQualifiers &R) {
189    // If both are only CVR-qualified, bit operations are sufficient.
190    if (!(L.Mask & ~CVRMask) && !(R.Mask & ~CVRMask)) {
191      Qualifiers Q;
192      Q.Mask = L.Mask & R.Mask;
193      L.Mask &= ~Q.Mask;
194      R.Mask &= ~Q.Mask;
195      return Q;
196    }
197
198    Qualifiers Q;
199    unsigned CommonCRV = L.getCVRQualifiers() & R.getCVRQualifiers();
200    Q.addCVRQualifiers(CommonCRV);
201    L.removeCVRQualifiers(CommonCRV);
202    R.removeCVRQualifiers(CommonCRV);
203
204    if (L.getObjCGCAttr() == R.getObjCGCAttr()) {
205      Q.setObjCGCAttr(L.getObjCGCAttr());
206      L.removeObjCGCAttr();
207      R.removeObjCGCAttr();
208    }
209
210    if (L.getObjCLifetime() == R.getObjCLifetime()) {
211      Q.setObjCLifetime(L.getObjCLifetime());
212      L.removeObjCLifetime();
213      R.removeObjCLifetime();
214    }
215
216    if (L.getAddressSpace() == R.getAddressSpace()) {
217      Q.setAddressSpace(L.getAddressSpace());
218      L.removeAddressSpace();
219      R.removeAddressSpace();
220    }
221    return Q;
222  }
223
224  static Qualifiers fromFastMask(unsigned Mask) {
225    Qualifiers Qs;
226    Qs.addFastQualifiers(Mask);
227    return Qs;
228  }
229
230  static Qualifiers fromCVRMask(unsigned CVR) {
231    Qualifiers Qs;
232    Qs.addCVRQualifiers(CVR);
233    return Qs;
234  }
235
236  static Qualifiers fromCVRUMask(unsigned CVRU) {
237    Qualifiers Qs;
238    Qs.addCVRUQualifiers(CVRU);
239    return Qs;
240  }
241
242  // Deserialize qualifiers from an opaque representation.
243  static Qualifiers fromOpaqueValue(unsigned opaque) {
244    Qualifiers Qs;
245    Qs.Mask = opaque;
246    return Qs;
247  }
248
249  // Serialize these qualifiers into an opaque representation.
250  unsigned getAsOpaqueValue() const {
251    return Mask;
252  }
253
254  bool hasConst() const { return Mask & Const; }
255  bool hasOnlyConst() const { return Mask == Const; }
256  void removeConst() { Mask &= ~Const; }
257  void addConst() { Mask |= Const; }
258
259  bool hasVolatile() const { return Mask & Volatile; }
260  bool hasOnlyVolatile() const { return Mask == Volatile; }
261  void removeVolatile() { Mask &= ~Volatile; }
262  void addVolatile() { Mask |= Volatile; }
263
264  bool hasRestrict() const { return Mask & Restrict; }
265  bool hasOnlyRestrict() const { return Mask == Restrict; }
266  void removeRestrict() { Mask &= ~Restrict; }
267  void addRestrict() { Mask |= Restrict; }
268
269  bool hasCVRQualifiers() const { return getCVRQualifiers(); }
270  unsigned getCVRQualifiers() const { return Mask & CVRMask; }
271  unsigned getCVRUQualifiers() const { return Mask & (CVRMask | UMask); }
272
273  void setCVRQualifiers(unsigned mask) {
274     (0) . __assert_fail ("!(mask & ~CVRMask) && \"bitmask contains non-CVR bits\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/Type.h", 274, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert(!(mask & ~CVRMask) && "bitmask contains non-CVR bits");
275    Mask = (Mask & ~CVRMask) | mask;
276  }
277  void removeCVRQualifiers(unsigned mask) {
278     (0) . __assert_fail ("!(mask & ~CVRMask) && \"bitmask contains non-CVR bits\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/Type.h", 278, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert(!(mask & ~CVRMask) && "bitmask contains non-CVR bits");
279    Mask &= ~mask;
280  }
281  void removeCVRQualifiers() {
282    removeCVRQualifiers(CVRMask);
283  }
284  void addCVRQualifiers(unsigned mask) {
285     (0) . __assert_fail ("!(mask & ~CVRMask) && \"bitmask contains non-CVR bits\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/Type.h", 285, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert(!(mask & ~CVRMask) && "bitmask contains non-CVR bits");
286    Mask |= mask;
287  }
288  void addCVRUQualifiers(unsigned mask) {
289     (0) . __assert_fail ("!(mask & ~CVRMask & ~UMask) && \"bitmask contains non-CVRU bits\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/Type.h", 289, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert(!(mask & ~CVRMask & ~UMask) && "bitmask contains non-CVRU bits");
290    Mask |= mask;
291  }
292
293  bool hasUnaligned() const { return Mask & UMask; }
294  void setUnaligned(bool flag) {
295    Mask = (Mask & ~UMask) | (flag ? UMask : 0);
296  }
297  void removeUnaligned() { Mask &= ~UMask; }
298  void addUnaligned() { Mask |= UMask; }
299
300  bool hasObjCGCAttr() const { return Mask & GCAttrMask; }
301  GC getObjCGCAttr() const { return GC((Mask & GCAttrMask) >> GCAttrShift); }
302  void setObjCGCAttr(GC type) {
303    Mask = (Mask & ~GCAttrMask) | (type << GCAttrShift);
304  }
305  void removeObjCGCAttr() { setObjCGCAttr(GCNone); }
306  void addObjCGCAttr(GC type) {
307    assert(type);
308    setObjCGCAttr(type);
309  }
310  Qualifiers withoutObjCGCAttr() const {
311    Qualifiers qs = *this;
312    qs.removeObjCGCAttr();
313    return qs;
314  }
315  Qualifiers withoutObjCLifetime() const {
316    Qualifiers qs = *this;
317    qs.removeObjCLifetime();
318    return qs;
319  }
320  Qualifiers withoutAddressSpace() const {
321    Qualifiers qs = *this;
322    qs.removeAddressSpace();
323    return qs;
324  }
325
326  bool hasObjCLifetime() const { return Mask & LifetimeMask; }
327  ObjCLifetime getObjCLifetime() const {
328    return ObjCLifetime((Mask & LifetimeMask) >> LifetimeShift);
329  }
330  void setObjCLifetime(ObjCLifetime type) {
331    Mask = (Mask & ~LifetimeMask) | (type << LifetimeShift);
332  }
333  void removeObjCLifetime() { setObjCLifetime(OCL_None); }
334  void addObjCLifetime(ObjCLifetime type) {
335    assert(type);
336    assert(!hasObjCLifetime());
337    Mask |= (type << LifetimeShift);
338  }
339
340  /// True if the lifetime is neither None or ExplicitNone.
341  bool hasNonTrivialObjCLifetime() const {
342    ObjCLifetime lifetime = getObjCLifetime();
343    return (lifetime > OCL_ExplicitNone);
344  }
345
346  /// True if the lifetime is either strong or weak.
347  bool hasStrongOrWeakObjCLifetime() const {
348    ObjCLifetime lifetime = getObjCLifetime();
349    return (lifetime == OCL_Strong || lifetime == OCL_Weak);
350  }
351
352  bool hasAddressSpace() const { return Mask & AddressSpaceMask; }
353  LangAS getAddressSpace() const {
354    return static_cast<LangAS>(Mask >> AddressSpaceShift);
355  }
356  bool hasTargetSpecificAddressSpace() const {
357    return isTargetAddressSpace(getAddressSpace());
358  }
359  /// Get the address space attribute value to be printed by diagnostics.
360  unsigned getAddressSpaceAttributePrintValue() const {
361    auto Addr = getAddressSpace();
362    // This function is not supposed to be used with language specific
363    // address spaces. If that happens, the diagnostic message should consider
364    // printing the QualType instead of the address space value.
365    assert(Addr == LangAS::Default || hasTargetSpecificAddressSpace());
366    if (Addr != LangAS::Default)
367      return toTargetAddressSpace(Addr);
368    // TODO: The diagnostic messages where Addr may be 0 should be fixed
369    // since it cannot differentiate the situation where 0 denotes the default
370    // address space or user specified __attribute__((address_space(0))).
371    return 0;
372  }
373  void setAddressSpace(LangAS space) {
374    assert((unsigned)space <= MaxAddressSpace);
375    Mask = (Mask & ~AddressSpaceMask)
376         | (((uint32_tspace) << AddressSpaceShift);
377  }
378  void removeAddressSpace() { setAddressSpace(LangAS::Default); }
379  void addAddressSpace(LangAS space) {
380    assert(space != LangAS::Default);
381    setAddressSpace(space);
382  }
383
384  // Fast qualifiers are those that can be allocated directly
385  // on a QualType object.
386  bool hasFastQualifiers() const { return getFastQualifiers(); }
387  unsigned getFastQualifiers() const { return Mask & FastMask; }
388  void setFastQualifiers(unsigned mask) {
389     (0) . __assert_fail ("!(mask & ~FastMask) && \"bitmask contains non-fast qualifier bits\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/Type.h", 389, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert(!(mask & ~FastMask) && "bitmask contains non-fast qualifier bits");
390    Mask = (Mask & ~FastMask) | mask;
391  }
392  void removeFastQualifiers(unsigned mask) {
393     (0) . __assert_fail ("!(mask & ~FastMask) && \"bitmask contains non-fast qualifier bits\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/Type.h", 393, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert(!(mask & ~FastMask) && "bitmask contains non-fast qualifier bits");
394    Mask &= ~mask;
395  }
396  void removeFastQualifiers() {
397    removeFastQualifiers(FastMask);
398  }
399  void addFastQualifiers(unsigned mask) {
400     (0) . __assert_fail ("!(mask & ~FastMask) && \"bitmask contains non-fast qualifier bits\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/Type.h", 400, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert(!(mask & ~FastMask) && "bitmask contains non-fast qualifier bits");
401    Mask |= mask;
402  }
403
404  /// Return true if the set contains any qualifiers which require an ExtQuals
405  /// node to be allocated.
406  bool hasNonFastQualifiers() const { return Mask & ~FastMask; }
407  Qualifiers getNonFastQualifiers() const {
408    Qualifiers Quals = *this;
409    Quals.setFastQualifiers(0);
410    return Quals;
411  }
412
413  /// Return true if the set contains any qualifiers.
414  bool hasQualifiers() const { return Mask; }
415  bool empty() const { return !Mask; }
416
417  /// Add the qualifiers from the given set to this set.
418  void addQualifiers(Qualifiers Q) {
419    // If the other set doesn't have any non-boolean qualifiers, just
420    // bit-or it in.
421    if (!(Q.Mask & ~CVRMask))
422      Mask |= Q.Mask;
423    else {
424      Mask |= (Q.Mask & CVRMask);
425      if (Q.hasAddressSpace())
426        addAddressSpace(Q.getAddressSpace());
427      if (Q.hasObjCGCAttr())
428        addObjCGCAttr(Q.getObjCGCAttr());
429      if (Q.hasObjCLifetime())
430        addObjCLifetime(Q.getObjCLifetime());
431    }
432  }
433
434  /// Remove the qualifiers from the given set from this set.
435  void removeQualifiers(Qualifiers Q) {
436    // If the other set doesn't have any non-boolean qualifiers, just
437    // bit-and the inverse in.
438    if (!(Q.Mask & ~CVRMask))
439      Mask &= ~Q.Mask;
440    else {
441      Mask &= ~(Q.Mask & CVRMask);
442      if (getObjCGCAttr() == Q.getObjCGCAttr())
443        removeObjCGCAttr();
444      if (getObjCLifetime() == Q.getObjCLifetime())
445        removeObjCLifetime();
446      if (getAddressSpace() == Q.getAddressSpace())
447        removeAddressSpace();
448    }
449  }
450
451  /// Add the qualifiers from the given set to this set, given that
452  /// they don't conflict.
453  void addConsistentQualifiers(Qualifiers qs) {
454    assert(getAddressSpace() == qs.getAddressSpace() ||
455           !hasAddressSpace() || !qs.hasAddressSpace());
456    assert(getObjCGCAttr() == qs.getObjCGCAttr() ||
457           !hasObjCGCAttr() || !qs.hasObjCGCAttr());
458    assert(getObjCLifetime() == qs.getObjCLifetime() ||
459           !hasObjCLifetime() || !qs.hasObjCLifetime());
460    Mask |= qs.Mask;
461  }
462
463  /// Returns true if this address space is a superset of the other one.
464  /// OpenCL v2.0 defines conversion rules (OpenCLC v2.0 s6.5.5) and notion of
465  /// overlapping address spaces.
466  /// CL1.1 or CL1.2:
467  ///   every address space is a superset of itself.
468  /// CL2.0 adds:
469  ///   __generic is a superset of any address space except for __constant.
470  bool isAddressSpaceSupersetOf(Qualifiers otherconst {
471    return
472        // Address spaces must match exactly.
473        getAddressSpace() == other.getAddressSpace() ||
474        // Otherwise in OpenCLC v2.0 s6.5.5: every address space except
475        // for __constant can be used as __generic.
476        (getAddressSpace() == LangAS::opencl_generic &&
477         other.getAddressSpace() != LangAS::opencl_constant);
478  }
479
480  /// Determines if these qualifiers compatibly include another set.
481  /// Generally this answers the question of whether an object with the other
482  /// qualifiers can be safely used as an object with these qualifiers.
483  bool compatiblyIncludes(Qualifiers otherconst {
484    return isAddressSpaceSupersetOf(other) &&
485           // ObjC GC qualifiers can match, be added, or be removed, but can't
486           // be changed.
487           (getObjCGCAttr() == other.getObjCGCAttr() || !hasObjCGCAttr() ||
488            !other.hasObjCGCAttr()) &&
489           // ObjC lifetime qualifiers must match exactly.
490           getObjCLifetime() == other.getObjCLifetime() &&
491           // CVR qualifiers may subset.
492           (((Mask & CVRMask) | (other.Mask & CVRMask)) == (Mask & CVRMask)) &&
493           // U qualifier may superset.
494           (!other.hasUnaligned() || hasUnaligned());
495  }
496
497  /// Determines if these qualifiers compatibly include another set of
498  /// qualifiers from the narrow perspective of Objective-C ARC lifetime.
499  ///
500  /// One set of Objective-C lifetime qualifiers compatibly includes the other
501  /// if the lifetime qualifiers match, or if both are non-__weak and the
502  /// including set also contains the 'const' qualifier, or both are non-__weak
503  /// and one is None (which can only happen in non-ARC modes).
504  bool compatiblyIncludesObjCLifetime(Qualifiers otherconst {
505    if (getObjCLifetime() == other.getObjCLifetime())
506      return true;
507
508    if (getObjCLifetime() == OCL_Weak || other.getObjCLifetime() == OCL_Weak)
509      return false;
510
511    if (getObjCLifetime() == OCL_None || other.getObjCLifetime() == OCL_None)
512      return true;
513
514    return hasConst();
515  }
516
517  /// Determine whether this set of qualifiers is a strict superset of
518  /// another set of qualifiers, not considering qualifier compatibility.
519  bool isStrictSupersetOf(Qualifiers Otherconst;
520
521  bool operator==(Qualifiers Otherconst { return Mask == Other.Mask; }
522  bool operator!=(Qualifiers Otherconst { return Mask != Other.Mask; }
523
524  explicit operator bool() const { return hasQualifiers(); }
525
526  Qualifiers &operator+=(Qualifiers R) {
527    addQualifiers(R);
528    return *this;
529  }
530
531  // Union two qualifier sets.  If an enumerated qualifier appears
532  // in both sets, use the one from the right.
533  friend Qualifiers operator+(Qualifiers LQualifiers R) {
534    L += R;
535    return L;
536  }
537
538  Qualifiers &operator-=(Qualifiers R) {
539    removeQualifiers(R);
540    return *this;
541  }
542
543  /// Compute the difference between two qualifier sets.
544  friend Qualifiers operator-(Qualifiers LQualifiers R) {
545    L -= R;
546    return L;
547  }
548
549  std::string getAsString() const;
550  std::string getAsString(const PrintingPolicy &Policyconst;
551
552  bool isEmptyWhenPrinted(const PrintingPolicy &Policyconst;
553  void print(raw_ostream &OSconst PrintingPolicy &Policy,
554             bool appendSpaceIfNonEmpty = falseconst;
555
556  void Profile(llvm::FoldingSetNodeID &IDconst {
557    ID.AddInteger(Mask);
558  }
559
560private:
561  // bits:     |0 1 2|3|4 .. 5|6  ..  8|9   ...   31|
562  //           |C R V|U|GCAttr|Lifetime|AddressSpace|
563  uint32_t Mask = 0;
564
565  static const uint32_t UMask = 0x8;
566  static const uint32_t UShift = 3;
567  static const uint32_t GCAttrMask = 0x30;
568  static const uint32_t GCAttrShift = 4;
569  static const uint32_t LifetimeMask = 0x1C0;
570  static const uint32_t LifetimeShift = 6;
571  static const uint32_t AddressSpaceMask =
572      ~(CVRMask | UMask | GCAttrMask | LifetimeMask);
573  static const uint32_t AddressSpaceShift = 9;
574};
575
576/// A std::pair-like structure for storing a qualified type split
577/// into its local qualifiers and its locally-unqualified type.
578struct SplitQualType {
579  /// The locally-unqualified type.
580  const Type *Ty = nullptr;
581
582  /// The local qualifiers.
583  Qualifiers Quals;
584
585  SplitQualType() = default;
586  SplitQualType(const Type *tyQualifiers qs) : Ty(ty), Quals(qs) {}
587
588  SplitQualType getSingleStepDesugaredType() const// end of this file
589
590  // Make std::tie work.
591  std::pair<const Type *,QualifiersasPair() const {
592    return std::pair<const Type *, Qualifiers>(TyQuals);
593  }
594
595  friend bool operator==(SplitQualType aSplitQualType b) {
596    return a.Ty == b.Ty && a.Quals == b.Quals;
597  }
598  friend bool operator!=(SplitQualType aSplitQualType b) {
599    return a.Ty != b.Ty || a.Quals != b.Quals;
600  }
601};
602
603/// The kind of type we are substituting Objective-C type arguments into.
604///
605/// The kind of substitution affects the replacement of type parameters when
606/// no concrete type information is provided, e.g., when dealing with an
607/// unspecialized type.
608enum class ObjCSubstitutionContext {
609  /// An ordinary type.
610  Ordinary,
611
612  /// The result type of a method or function.
613  Result,
614
615  /// The parameter type of a method or function.
616  Parameter,
617
618  /// The type of a property.
619  Property,
620
621  /// The superclass of a type.
622  Superclass,
623};
624
625/// A (possibly-)qualified type.
626///
627/// For efficiency, we don't store CV-qualified types as nodes on their
628/// own: instead each reference to a type stores the qualifiers.  This
629/// greatly reduces the number of nodes we need to allocate for types (for
630/// example we only need one for 'int', 'const int', 'volatile int',
631/// 'const volatile int', etc).
632///
633/// As an added efficiency bonus, instead of making this a pair, we
634/// just store the two bits we care about in the low bits of the
635/// pointer.  To handle the packing/unpacking, we make QualType be a
636/// simple wrapper class that acts like a smart pointer.  A third bit
637/// indicates whether there are extended qualifiers present, in which
638/// case the pointer points to a special structure.
639class QualType {
640  friend class QualifierCollector;
641
642  // Thankfully, these are efficiently composable.
643  llvm::PointerIntPair<llvm::PointerUnion<const Type *, const ExtQuals *>,
644                       Qualifiers::FastWidth> Value;
645
646  const ExtQuals *getExtQualsUnsafe() const {
647    return Value.getPointer().get<const ExtQuals*>();
648  }
649
650  const Type *getTypePtrUnsafe() const {
651    return Value.getPointer().get<const Type*>();
652  }
653
654  const ExtQualsTypeCommonBase *getCommonPtr() const {
655     (0) . __assert_fail ("!isNull() && \"Cannot retrieve a NULL type pointer\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/Type.h", 655, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert(!isNull() && "Cannot retrieve a NULL type pointer");
656    auto CommonPtrVal = reinterpret_cast<uintptr_t>(Value.getOpaqueValue());
657    CommonPtrVal &= ~(uintptr_t)((1 << TypeAlignmentInBits) - 1);
658    return reinterpret_cast<ExtQualsTypeCommonBase*>(CommonPtrVal);
659  }
660
661public:
662  QualType() = default;
663  QualType(const Type *Ptrunsigned Quals) : Value(Ptr, Quals) {}
664  QualType(const ExtQuals *Ptrunsigned Quals) : Value(Ptr, Quals) {}
665
666  unsigned getLocalFastQualifiers() const { return Value.getInt(); }
667  void setLocalFastQualifiers(unsigned Quals) { Value.setInt(Quals); }
668
669  /// Retrieves a pointer to the underlying (unqualified) type.
670  ///
671  /// This function requires that the type not be NULL. If the type might be
672  /// NULL, use the (slightly less efficient) \c getTypePtrOrNull().
673  const Type *getTypePtr() const;
674
675  const Type *getTypePtrOrNull() const;
676
677  /// Retrieves a pointer to the name of the base type.
678  const IdentifierInfo *getBaseTypeIdentifier() const;
679
680  /// Divides a QualType into its unqualified type and a set of local
681  /// qualifiers.
682  SplitQualType split() const;
683
684  void *getAsOpaquePtr() const { return Value.getOpaqueValue(); }
685
686  static QualType getFromOpaquePtr(const void *Ptr) {
687    QualType T;
688    T.Value.setFromOpaqueValue(const_cast<void*>(Ptr));
689    return T;
690  }
691
692  const Type &operator*() const {
693    return *getTypePtr();
694  }
695
696  const Type *operator->() const {
697    return getTypePtr();
698  }
699
700  bool isCanonical() const;
701  bool isCanonicalAsParam() const;
702
703  /// Return true if this QualType doesn't point to a type yet.
704  bool isNull() const {
705    return Value.getPointer().isNull();
706  }
707
708  /// Determine whether this particular QualType instance has the
709  /// "const" qualifier set, without looking through typedefs that may have
710  /// added "const" at a different level.
711  bool isLocalConstQualified() const {
712    return (getLocalFastQualifiers() & Qualifiers::Const);
713  }
714
715  /// Determine whether this type is const-qualified.
716  bool isConstQualified() const;
717
718  /// Determine whether this particular QualType instance has the
719  /// "restrict" qualifier set, without looking through typedefs that may have
720  /// added "restrict" at a different level.
721  bool isLocalRestrictQualified() const {
722    return (getLocalFastQualifiers() & Qualifiers::Restrict);
723  }
724
725  /// Determine whether this type is restrict-qualified.
726  bool isRestrictQualified() const;
727
728  /// Determine whether this particular QualType instance has the
729  /// "volatile" qualifier set, without looking through typedefs that may have
730  /// added "volatile" at a different level.
731  bool isLocalVolatileQualified() const {
732    return (getLocalFastQualifiers() & Qualifiers::Volatile);
733  }
734
735  /// Determine whether this type is volatile-qualified.
736  bool isVolatileQualified() const;
737
738  /// Determine whether this particular QualType instance has any
739  /// qualifiers, without looking through any typedefs that might add
740  /// qualifiers at a different level.
741  bool hasLocalQualifiers() const {
742    return getLocalFastQualifiers() || hasLocalNonFastQualifiers();
743  }
744
745  /// Determine whether this type has any qualifiers.
746  bool hasQualifiers() const;
747
748  /// Determine whether this particular QualType instance has any
749  /// "non-fast" qualifiers, e.g., those that are stored in an ExtQualType
750  /// instance.
751  bool hasLocalNonFastQualifiers() const {
752    return Value.getPointer().is<const ExtQuals*>();
753  }
754
755  /// Retrieve the set of qualifiers local to this particular QualType
756  /// instance, not including any qualifiers acquired through typedefs or
757  /// other sugar.
758  Qualifiers getLocalQualifiers() const;
759
760  /// Retrieve the set of qualifiers applied to this type.
761  Qualifiers getQualifiers() const;
762
763  /// Retrieve the set of CVR (const-volatile-restrict) qualifiers
764  /// local to this particular QualType instance, not including any qualifiers
765  /// acquired through typedefs or other sugar.
766  unsigned getLocalCVRQualifiers() const {
767    return getLocalFastQualifiers();
768  }
769
770  /// Retrieve the set of CVR (const-volatile-restrict) qualifiers
771  /// applied to this type.
772  unsigned getCVRQualifiers() const;
773
774  bool isConstant(const ASTContextCtxconst {
775    return QualType::isConstant(*thisCtx);
776  }
777
778  /// Determine whether this is a Plain Old Data (POD) type (C++ 3.9p10).
779  bool isPODType(const ASTContext &Contextconst;
780
781  /// Return true if this is a POD type according to the rules of the C++98
782  /// standard, regardless of the current compilation's language.
783  bool isCXX98PODType(const ASTContext &Contextconst;
784
785  /// Return true if this is a POD type according to the more relaxed rules
786  /// of the C++11 standard, regardless of the current compilation's language.
787  /// (C++0x [basic.types]p9). Note that, unlike
788  /// CXXRecordDecl::isCXX11StandardLayout, this takes DRs into account.
789  bool isCXX11PODType(const ASTContext &Contextconst;
790
791  /// Return true if this is a trivial type per (C++0x [basic.types]p9)
792  bool isTrivialType(const ASTContext &Contextconst;
793
794  /// Return true if this is a trivially copyable type (C++0x [basic.types]p9)
795  bool isTriviallyCopyableType(const ASTContext &Contextconst;
796
797
798  /// Returns true if it is a class and it might be dynamic.
799  bool mayBeDynamicClass() const;
800
801  /// Returns true if it is not a class or if the class might not be dynamic.
802  bool mayBeNotDynamicClass() const;
803
804  // Don't promise in the API that anything besides 'const' can be
805  // easily added.
806
807  /// Add the `const` type qualifier to this QualType.
808  void addConst() {
809    addFastQualifiers(Qualifiers::Const);
810  }
811  QualType withConst() const {
812    return withFastQualifiers(Qualifiers::Const);
813  }
814
815  /// Add the `volatile` type qualifier to this QualType.
816  void addVolatile() {
817    addFastQualifiers(Qualifiers::Volatile);
818  }
819  QualType withVolatile() const {
820    return withFastQualifiers(Qualifiers::Volatile);
821  }
822
823  /// Add the `restrict` qualifier to this QualType.
824  void addRestrict() {
825    addFastQualifiers(Qualifiers::Restrict);
826  }
827  QualType withRestrict() const {
828    return withFastQualifiers(Qualifiers::Restrict);
829  }
830
831  QualType withCVRQualifiers(unsigned CVRconst {
832    return withFastQualifiers(CVR);
833  }
834
835  void addFastQualifiers(unsigned TQs) {
836     (0) . __assert_fail ("!(TQs & ~Qualifiers..FastMask) && \"non-fast qualifier bits set in mask!\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/Type.h", 837, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert(!(TQs & ~Qualifiers::FastMask)
837 (0) . __assert_fail ("!(TQs & ~Qualifiers..FastMask) && \"non-fast qualifier bits set in mask!\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/Type.h", 837, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">           && "non-fast qualifier bits set in mask!");
838    Value.setInt(Value.getInt() | TQs);
839  }
840
841  void removeLocalConst();
842  void removeLocalVolatile();
843  void removeLocalRestrict();
844  void removeLocalCVRQualifiers(unsigned Mask);
845
846  void removeLocalFastQualifiers() { Value.setInt(0); }
847  void removeLocalFastQualifiers(unsigned Mask) {
848     (0) . __assert_fail ("!(Mask & ~Qualifiers..FastMask) && \"mask has non-fast qualifiers\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/Type.h", 848, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert(!(Mask & ~Qualifiers::FastMask) && "mask has non-fast qualifiers");
849    Value.setInt(Value.getInt() & ~Mask);
850  }
851
852  // Creates a type with the given qualifiers in addition to any
853  // qualifiers already on this type.
854  QualType withFastQualifiers(unsigned TQsconst {
855    QualType T = *this;
856    T.addFastQualifiers(TQs);
857    return T;
858  }
859
860  // Creates a type with exactly the given fast qualifiers, removing
861  // any existing fast qualifiers.
862  QualType withExactLocalFastQualifiers(unsigned TQsconst {
863    return withoutLocalFastQualifiers().withFastQualifiers(TQs);
864  }
865
866  // Removes fast qualifiers, but leaves any extended qualifiers in place.
867  QualType withoutLocalFastQualifiers() const {
868    QualType T = *this;
869    T.removeLocalFastQualifiers();
870    return T;
871  }
872
873  QualType getCanonicalType() const;
874
875  /// Return this type with all of the instance-specific qualifiers
876  /// removed, but without removing any qualifiers that may have been applied
877  /// through typedefs.
878  QualType getLocalUnqualifiedType() const { return QualType(getTypePtr(), 0); }
879
880  /// Retrieve the unqualified variant of the given type,
881  /// removing as little sugar as possible.
882  ///
883  /// This routine looks through various kinds of sugar to find the
884  /// least-desugared type that is unqualified. For example, given:
885  ///
886  /// \code
887  /// typedef int Integer;
888  /// typedef const Integer CInteger;
889  /// typedef CInteger DifferenceType;
890  /// \endcode
891  ///
892  /// Executing \c getUnqualifiedType() on the type \c DifferenceType will
893  /// desugar until we hit the type \c Integer, which has no qualifiers on it.
894  ///
895  /// The resulting type might still be qualified if it's sugar for an array
896  /// type.  To strip qualifiers even from within a sugared array type, use
897  /// ASTContext::getUnqualifiedArrayType.
898  inline QualType getUnqualifiedType() const;
899
900  /// Retrieve the unqualified variant of the given type, removing as little
901  /// sugar as possible.
902  ///
903  /// Like getUnqualifiedType(), but also returns the set of
904  /// qualifiers that were built up.
905  ///
906  /// The resulting type might still be qualified if it's sugar for an array
907  /// type.  To strip qualifiers even from within a sugared array type, use
908  /// ASTContext::getUnqualifiedArrayType.
909  inline SplitQualType getSplitUnqualifiedType() const;
910
911  /// Determine whether this type is more qualified than the other
912  /// given type, requiring exact equality for non-CVR qualifiers.
913  bool isMoreQualifiedThan(QualType Otherconst;
914
915  /// Determine whether this type is at least as qualified as the other
916  /// given type, requiring exact equality for non-CVR qualifiers.
917  bool isAtLeastAsQualifiedAs(QualType Otherconst;
918
919  QualType getNonReferenceType() const;
920
921  /// Determine the type of a (typically non-lvalue) expression with the
922  /// specified result type.
923  ///
924  /// This routine should be used for expressions for which the return type is
925  /// explicitly specified (e.g., in a cast or call) and isn't necessarily
926  /// an lvalue. It removes a top-level reference (since there are no
927  /// expressions of reference type) and deletes top-level cvr-qualifiers
928  /// from non-class types (in C++) or all types (in C).
929  QualType getNonLValueExprType(const ASTContext &Contextconst;
930
931  /// Return the specified type with any "sugar" removed from
932  /// the type.  This takes off typedefs, typeof's etc.  If the outer level of
933  /// the type is already concrete, it returns it unmodified.  This is similar
934  /// to getting the canonical type, but it doesn't remove *all* typedefs.  For
935  /// example, it returns "T*" as "T*", (not as "int*"), because the pointer is
936  /// concrete.
937  ///
938  /// Qualifiers are left in place.
939  QualType getDesugaredType(const ASTContext &Contextconst {
940    return getDesugaredType(*thisContext);
941  }
942
943  SplitQualType getSplitDesugaredType() const {
944    return getSplitDesugaredType(*this);
945  }
946
947  /// Return the specified type with one level of "sugar" removed from
948  /// the type.
949  ///
950  /// This routine takes off the first typedef, typeof, etc. If the outer level
951  /// of the type is already concrete, it returns it unmodified.
952  QualType getSingleStepDesugaredType(const ASTContext &Contextconst {
953    return getSingleStepDesugaredTypeImpl(*thisContext);
954  }
955
956  /// Returns the specified type after dropping any
957  /// outer-level parentheses.
958  QualType IgnoreParens() const {
959    if (isa<ParenType>(*this))
960      return QualType::IgnoreParens(*this);
961    return *this;
962  }
963
964  /// Indicate whether the specified types and qualifiers are identical.
965  friend bool operator==(const QualType &LHSconst QualType &RHS) {
966    return LHS.Value == RHS.Value;
967  }
968  friend bool operator!=(const QualType &LHSconst QualType &RHS) {
969    return LHS.Value != RHS.Value;
970  }
971
972  static std::string getAsString(SplitQualType split,
973                                 const PrintingPolicy &Policy) {
974    return getAsString(split.Tysplit.QualsPolicy);
975  }
976  static std::string getAsString(const Type *tyQualifiers qs,
977                                 const PrintingPolicy &Policy);
978
979  std::string getAsString() const;
980  std::string getAsString(const PrintingPolicy &Policyconst;
981
982  void print(raw_ostream &OSconst PrintingPolicy &Policy,
983             const Twine &PlaceHolder = Twine(),
984             unsigned Indentation = 0const;
985
986  static void print(SplitQualType splitraw_ostream &OS,
987                    const PrintingPolicy &policyconst Twine &PlaceHolder,
988                    unsigned Indentation = 0) {
989    return print(split.Tysplit.QualsOSpolicyPlaceHolderIndentation);
990  }
991
992  static void print(const Type *tyQualifiers qs,
993                    raw_ostream &OSconst PrintingPolicy &policy,
994                    const Twine &PlaceHolder,
995                    unsigned Indentation = 0);
996
997  void getAsStringInternal(std::string &Str,
998                           const PrintingPolicy &Policyconst;
999
1000  static void getAsStringInternal(SplitQualType splitstd::string &out,
1001                                  const PrintingPolicy &policy) {
1002    return getAsStringInternal(split.Tysplit.Qualsoutpolicy);
1003  }
1004
1005  static void getAsStringInternal(const Type *tyQualifiers qs,
1006                                  std::string &out,
1007                                  const PrintingPolicy &policy);
1008
1009  class StreamedQualTypeHelper {
1010    const QualType &T;
1011    const PrintingPolicy &Policy;
1012    const Twine &PlaceHolder;
1013    unsigned Indentation;
1014
1015  public:
1016    StreamedQualTypeHelper(const QualType &Tconst PrintingPolicy &Policy,
1017                           const Twine &PlaceHolderunsigned Indentation)
1018        : T(T), Policy(Policy), PlaceHolder(PlaceHolder),
1019          Indentation(Indentation) {}
1020
1021    friend raw_ostream &operator<<(raw_ostream &OS,
1022                                   const StreamedQualTypeHelper &SQT) {
1023      SQT.T.print(OSSQT.PolicySQT.PlaceHolderSQT.Indentation);
1024      return OS;
1025    }
1026  };
1027
1028  StreamedQualTypeHelper stream(const PrintingPolicy &Policy,
1029                                const Twine &PlaceHolder = Twine(),
1030                                unsigned Indentation = 0const {
1031    return StreamedQualTypeHelper(*thisPolicyPlaceHolderIndentation);
1032  }
1033
1034  void dump(const char *sconst;
1035  void dump() const;
1036  void dump(llvm::raw_ostream &OSconst;
1037
1038  void Profile(llvm::FoldingSetNodeID &IDconst {
1039    ID.AddPointer(getAsOpaquePtr());
1040  }
1041
1042  /// Return the address space of this type.
1043  inline LangAS getAddressSpace() const;
1044
1045  /// Returns gc attribute of this type.
1046  inline Qualifiers::GC getObjCGCAttr() const;
1047
1048  /// true when Type is objc's weak.
1049  bool isObjCGCWeak() const {
1050    return getObjCGCAttr() == Qualifiers::Weak;
1051  }
1052
1053  /// true when Type is objc's strong.
1054  bool isObjCGCStrong() const {
1055    return getObjCGCAttr() == Qualifiers::Strong;
1056  }
1057
1058  /// Returns lifetime attribute of this type.
1059  Qualifiers::ObjCLifetime getObjCLifetime() const {
1060    return getQualifiers().getObjCLifetime();
1061  }
1062
1063  bool hasNonTrivialObjCLifetime() const {
1064    return getQualifiers().hasNonTrivialObjCLifetime();
1065  }
1066
1067  bool hasStrongOrWeakObjCLifetime() const {
1068    return getQualifiers().hasStrongOrWeakObjCLifetime();
1069  }
1070
1071  // true when Type is objc's weak and weak is enabled but ARC isn't.
1072  bool isNonWeakInMRRWithObjCWeak(const ASTContext &Contextconst;
1073
1074  enum PrimitiveDefaultInitializeKind {
1075    /// The type does not fall into any of the following categories. Note that
1076    /// this case is zero-valued so that values of this enum can be used as a
1077    /// boolean condition for non-triviality.
1078    PDIK_Trivial,
1079
1080    /// The type is an Objective-C retainable pointer type that is qualified
1081    /// with the ARC __strong qualifier.
1082    PDIK_ARCStrong,
1083
1084    /// The type is an Objective-C retainable pointer type that is qualified
1085    /// with the ARC __weak qualifier.
1086    PDIK_ARCWeak,
1087
1088    /// The type is a struct containing a field whose type is not PCK_Trivial.
1089    PDIK_Struct
1090  };
1091
1092  /// Functions to query basic properties of non-trivial C struct types.
1093
1094  /// Check if this is a non-trivial type that would cause a C struct
1095  /// transitively containing this type to be non-trivial to default initialize
1096  /// and return the kind.
1097  PrimitiveDefaultInitializeKind
1098  isNonTrivialToPrimitiveDefaultInitialize() const;
1099
1100  enum PrimitiveCopyKind {
1101    /// The type does not fall into any of the following categories. Note that
1102    /// this case is zero-valued so that values of this enum can be used as a
1103    /// boolean condition for non-triviality.
1104    PCK_Trivial,
1105
1106    /// The type would be trivial except that it is volatile-qualified. Types
1107    /// that fall into one of the other non-trivial cases may additionally be
1108    /// volatile-qualified.
1109    PCK_VolatileTrivial,
1110
1111    /// The type is an Objective-C retainable pointer type that is qualified
1112    /// with the ARC __strong qualifier.
1113    PCK_ARCStrong,
1114
1115    /// The type is an Objective-C retainable pointer type that is qualified
1116    /// with the ARC __weak qualifier.
1117    PCK_ARCWeak,
1118
1119    /// The type is a struct containing a field whose type is neither
1120    /// PCK_Trivial nor PCK_VolatileTrivial.
1121    /// Note that a C++ struct type does not necessarily match this; C++ copying
1122    /// semantics are too complex to express here, in part because they depend
1123    /// on the exact constructor or assignment operator that is chosen by
1124    /// overload resolution to do the copy.
1125    PCK_Struct
1126  };
1127
1128  /// Check if this is a non-trivial type that would cause a C struct
1129  /// transitively containing this type to be non-trivial. This function can be
1130  /// used to determine whether a field of this type can be declared inside a C
1131  /// union.
1132  bool isNonTrivialPrimitiveCType(const ASTContext &Ctxconst;
1133
1134  /// Check if this is a non-trivial type that would cause a C struct
1135  /// transitively containing this type to be non-trivial to copy and return the
1136  /// kind.
1137  PrimitiveCopyKind isNonTrivialToPrimitiveCopy() const;
1138
1139  /// Check if this is a non-trivial type that would cause a C struct
1140  /// transitively containing this type to be non-trivial to destructively
1141  /// move and return the kind. Destructive move in this context is a C++-style
1142  /// move in which the source object is placed in a valid but unspecified state
1143  /// after it is moved, as opposed to a truly destructive move in which the
1144  /// source object is placed in an uninitialized state.
1145  PrimitiveCopyKind isNonTrivialToPrimitiveDestructiveMove() const;
1146
1147  enum DestructionKind {
1148    DK_none,
1149    DK_cxx_destructor,
1150    DK_objc_strong_lifetime,
1151    DK_objc_weak_lifetime,
1152    DK_nontrivial_c_struct
1153  };
1154
1155  /// Returns a nonzero value if objects of this type require
1156  /// non-trivial work to clean up after.  Non-zero because it's
1157  /// conceivable that qualifiers (objc_gc(weak)?) could make
1158  /// something require destruction.
1159  DestructionKind isDestructedType() const {
1160    return isDestructedTypeImpl(*this);
1161  }
1162
1163  /// Determine whether expressions of the given type are forbidden
1164  /// from being lvalues in C.
1165  ///
1166  /// The expression types that are forbidden to be lvalues are:
1167  ///   - 'void', but not qualified void
1168  ///   - function types
1169  ///
1170  /// The exact rule here is C99 6.3.2.1:
1171  ///   An lvalue is an expression with an object type or an incomplete
1172  ///   type other than void.
1173  bool isCForbiddenLValueType() const;
1174
1175  /// Substitute type arguments for the Objective-C type parameters used in the
1176  /// subject type.
1177  ///
1178  /// \param ctx ASTContext in which the type exists.
1179  ///
1180  /// \param typeArgs The type arguments that will be substituted for the
1181  /// Objective-C type parameters in the subject type, which are generally
1182  /// computed via \c Type::getObjCSubstitutions. If empty, the type
1183  /// parameters will be replaced with their bounds or id/Class, as appropriate
1184  /// for the context.
1185  ///
1186  /// \param context The context in which the subject type was written.
1187  ///
1188  /// \returns the resulting type.
1189  QualType substObjCTypeArgs(ASTContext &ctx,
1190                             ArrayRef<QualTypetypeArgs,
1191                             ObjCSubstitutionContext contextconst;
1192
1193  /// Substitute type arguments from an object type for the Objective-C type
1194  /// parameters used in the subject type.
1195  ///
1196  /// This operation combines the computation of type arguments for
1197  /// substitution (\c Type::getObjCSubstitutions) with the actual process of
1198  /// substitution (\c QualType::substObjCTypeArgs) for the convenience of
1199  /// callers that need to perform a single substitution in isolation.
1200  ///
1201  /// \param objectType The type of the object whose member type we're
1202  /// substituting into. For example, this might be the receiver of a message
1203  /// or the base of a property access.
1204  ///
1205  /// \param dc The declaration context from which the subject type was
1206  /// retrieved, which indicates (for example) which type parameters should
1207  /// be substituted.
1208  ///
1209  /// \param context The context in which the subject type was written.
1210  ///
1211  /// \returns the subject type after replacing all of the Objective-C type
1212  /// parameters with their corresponding arguments.
1213  QualType substObjCMemberType(QualType objectType,
1214                               const DeclContext *dc,
1215                               ObjCSubstitutionContext contextconst;
1216
1217  /// Strip Objective-C "__kindof" types from the given type.
1218  QualType stripObjCKindOfType(const ASTContext &ctxconst;
1219
1220  /// Remove all qualifiers including _Atomic.
1221  QualType getAtomicUnqualifiedType() const;
1222
1223private:
1224  // These methods are implemented in a separate translation unit;
1225  // "static"-ize them to avoid creating temporary QualTypes in the
1226  // caller.
1227  static bool isConstant(QualType Tconst ASTContextCtx);
1228  static QualType getDesugaredType(QualType Tconst ASTContext &Context);
1229  static SplitQualType getSplitDesugaredType(QualType T);
1230  static SplitQualType getSplitUnqualifiedTypeImpl(QualType type);
1231  static QualType getSingleStepDesugaredTypeImpl(QualType type,
1232                                                 const ASTContext &C);
1233  static QualType IgnoreParens(QualType T);
1234  static DestructionKind isDestructedTypeImpl(QualType type);
1235};
1236
1237// namespace clang
1238
1239namespace llvm {
1240
1241/// Implement simplify_type for QualType, so that we can dyn_cast from QualType
1242/// to a specific Type class.
1243template<> struct simplify_type< ::clang::QualType> {
1244  using SimpleType = const ::clang::Type *;
1245
1246  static SimpleType getSimplifiedValue(::clang::QualType Val) {
1247    return Val.getTypePtr();
1248  }
1249};
1250
1251// Teach SmallPtrSet that QualType is "basically a pointer".
1252template<>
1253struct PointerLikeTypeTraits<clang::QualType> {
1254  static inline void *getAsVoidPointer(clang::QualType P) {
1255    return P.getAsOpaquePtr();
1256  }
1257
1258  static inline clang::QualType getFromVoidPointer(void *P) {
1259    return clang::QualType::getFromOpaquePtr(P);
1260  }
1261
1262  // Various qualifiers go in low bits.
1263  enum { NumLowBitsAvailable = 0 };
1264};
1265
1266// namespace llvm
1267
1268namespace clang {
1269
1270/// Base class that is common to both the \c ExtQuals and \c Type
1271/// classes, which allows \c QualType to access the common fields between the
1272/// two.
1273class ExtQualsTypeCommonBase {
1274  friend class ExtQuals;
1275  friend class QualType;
1276  friend class Type;
1277
1278  /// The "base" type of an extended qualifiers type (\c ExtQuals) or
1279  /// a self-referential pointer (for \c Type).
1280  ///
1281  /// This pointer allows an efficient mapping from a QualType to its
1282  /// underlying type pointer.
1283  const Type *const BaseType;
1284
1285  /// The canonical type of this type.  A QualType.
1286  QualType CanonicalType;
1287
1288  ExtQualsTypeCommonBase(const Type *baseTypeQualType canon)
1289      : BaseType(baseType), CanonicalType(canon) {}
1290};
1291
1292/// We can encode up to four bits in the low bits of a
1293/// type pointer, but there are many more type qualifiers that we want
1294/// to be able to apply to an arbitrary type.  Therefore we have this
1295/// struct, intended to be heap-allocated and used by QualType to
1296/// store qualifiers.
1297///
1298/// The current design tags the 'const', 'restrict', and 'volatile' qualifiers
1299/// in three low bits on the QualType pointer; a fourth bit records whether
1300/// the pointer is an ExtQuals node. The extended qualifiers (address spaces,
1301/// Objective-C GC attributes) are much more rare.
1302class ExtQuals : public ExtQualsTypeCommonBasepublic llvm::FoldingSetNode {
1303  // NOTE: changing the fast qualifiers should be straightforward as
1304  // long as you don't make 'const' non-fast.
1305  // 1. Qualifiers:
1306  //    a) Modify the bitmasks (Qualifiers::TQ and DeclSpec::TQ).
1307  //       Fast qualifiers must occupy the low-order bits.
1308  //    b) Update Qualifiers::FastWidth and FastMask.
1309  // 2. QualType:
1310  //    a) Update is{Volatile,Restrict}Qualified(), defined inline.
1311  //    b) Update remove{Volatile,Restrict}, defined near the end of
1312  //       this header.
1313  // 3. ASTContext:
1314  //    a) Update get{Volatile,Restrict}Type.
1315
1316  /// The immutable set of qualifiers applied by this node. Always contains
1317  /// extended qualifiers.
1318  Qualifiers Quals;
1319
1320  ExtQuals *this_() { return this; }
1321
1322public:
1323  ExtQuals(const Type *baseTypeQualType canonQualifiers quals)
1324      : ExtQualsTypeCommonBase(baseType,
1325                               canon.isNull() ? QualType(this_(), 0) : canon),
1326        Quals(quals) {
1327     (0) . __assert_fail ("Quals.hasNonFastQualifiers() && \"ExtQuals created with no fast qualifiers\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/Type.h", 1328, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert(Quals.hasNonFastQualifiers()
1328 (0) . __assert_fail ("Quals.hasNonFastQualifiers() && \"ExtQuals created with no fast qualifiers\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/Type.h", 1328, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">           && "ExtQuals created with no fast qualifiers");
1329     (0) . __assert_fail ("!Quals.hasFastQualifiers() && \"ExtQuals created with fast qualifiers\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/Type.h", 1330, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert(!Quals.hasFastQualifiers()
1330 (0) . __assert_fail ("!Quals.hasFastQualifiers() && \"ExtQuals created with fast qualifiers\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/Type.h", 1330, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">           && "ExtQuals created with fast qualifiers");
1331  }
1332
1333  Qualifiers getQualifiers() const { return Quals; }
1334
1335  bool hasObjCGCAttr() const { return Quals.hasObjCGCAttr(); }
1336  Qualifiers::GC getObjCGCAttr() const { return Quals.getObjCGCAttr(); }
1337
1338  bool hasObjCLifetime() const { return Quals.hasObjCLifetime(); }
1339  Qualifiers::ObjCLifetime getObjCLifetime() const {
1340    return Quals.getObjCLifetime();
1341  }
1342
1343  bool hasAddressSpace() const { return Quals.hasAddressSpace(); }
1344  LangAS getAddressSpace() const { return Quals.getAddressSpace(); }
1345
1346  const Type *getBaseType() const { return BaseType; }
1347
1348public:
1349  void Profile(llvm::FoldingSetNodeID &IDconst {
1350    Profile(IDgetBaseType(), Quals);
1351  }
1352
1353  static void Profile(llvm::FoldingSetNodeID &ID,
1354                      const Type *BaseType,
1355                      Qualifiers Quals) {
1356     (0) . __assert_fail ("!Quals.hasFastQualifiers() && \"fast qualifiers in ExtQuals hash!\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/Type.h", 1356, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert(!Quals.hasFastQualifiers() && "fast qualifiers in ExtQuals hash!");
1357    ID.AddPointer(BaseType);
1358    Quals.Profile(ID);
1359  }
1360};
1361
1362/// The kind of C++11 ref-qualifier associated with a function type.
1363/// This determines whether a member function's "this" object can be an
1364/// lvalue, rvalue, or neither.
1365enum RefQualifierKind {
1366  /// No ref-qualifier was provided.
1367  RQ_None = 0,
1368
1369  /// An lvalue ref-qualifier was provided (\c &).
1370  RQ_LValue,
1371
1372  /// An rvalue ref-qualifier was provided (\c &&).
1373  RQ_RValue
1374};
1375
1376/// Which keyword(s) were used to create an AutoType.
1377enum class AutoTypeKeyword {
1378  /// auto
1379  Auto,
1380
1381  /// decltype(auto)
1382  DecltypeAuto,
1383
1384  /// __auto_type (GNU extension)
1385  GNUAutoType
1386};
1387
1388/// The base class of the type hierarchy.
1389///
1390/// A central concept with types is that each type always has a canonical
1391/// type.  A canonical type is the type with any typedef names stripped out
1392/// of it or the types it references.  For example, consider:
1393///
1394///  typedef int  foo;
1395///  typedef foo* bar;
1396///    'int *'    'foo *'    'bar'
1397///
1398/// There will be a Type object created for 'int'.  Since int is canonical, its
1399/// CanonicalType pointer points to itself.  There is also a Type for 'foo' (a
1400/// TypedefType).  Its CanonicalType pointer points to the 'int' Type.  Next
1401/// there is a PointerType that represents 'int*', which, like 'int', is
1402/// canonical.  Finally, there is a PointerType type for 'foo*' whose canonical
1403/// type is 'int*', and there is a TypedefType for 'bar', whose canonical type
1404/// is also 'int*'.
1405///
1406/// Non-canonical types are useful for emitting diagnostics, without losing
1407/// information about typedefs being used.  Canonical types are useful for type
1408/// comparisons (they allow by-pointer equality tests) and useful for reasoning
1409/// about whether something has a particular form (e.g. is a function type),
1410/// because they implicitly, recursively, strip all typedefs out of a type.
1411///
1412/// Types, once created, are immutable.
1413///
1414class Type : public ExtQualsTypeCommonBase {
1415public:
1416  enum TypeClass {
1417#define TYPE(Class, Base) Class,
1418#define LAST_TYPE(Class) TypeLast = Class,
1419#define ABSTRACT_TYPE(Class, Base)
1420#include "clang/AST/TypeNodes.def"
1421    TagFirst = RecordTagLast = Enum
1422  };
1423
1424private:
1425  /// Bitfields required by the Type class.
1426  class TypeBitfields {
1427    friend class Type;
1428    template <class T> friend class TypePropertyCache;
1429
1430    /// TypeClass bitfield - Enum that specifies what subclass this belongs to.
1431    unsigned TC : 8;
1432
1433    /// Whether this type is a dependent type (C++ [temp.dep.type]).
1434    unsigned Dependent : 1;
1435
1436    /// Whether this type somehow involves a template parameter, even
1437    /// if the resolution of the type does not depend on a template parameter.
1438    unsigned InstantiationDependent : 1;
1439
1440    /// Whether this type is a variably-modified type (C99 6.7.5).
1441    unsigned VariablyModified : 1;
1442
1443    /// Whether this type contains an unexpanded parameter pack
1444    /// (for C++11 variadic templates).
1445    unsigned ContainsUnexpandedParameterPack : 1;
1446
1447    /// True if the cache (i.e. the bitfields here starting with
1448    /// 'Cache') is valid.
1449    mutable unsigned CacheValid : 1;
1450
1451    /// Linkage of this type.
1452    mutable unsigned CachedLinkage : 3;
1453
1454    /// Whether this type involves and local or unnamed types.
1455    mutable unsigned CachedLocalOrUnnamed : 1;
1456
1457    /// Whether this type comes from an AST file.
1458    mutable unsigned FromAST : 1;
1459
1460    bool isCacheValid() const {
1461      return CacheValid;
1462    }
1463
1464    Linkage getLinkage() const {
1465       (0) . __assert_fail ("isCacheValid() && \"getting linkage from invalid cache\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/Type.h", 1465, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert(isCacheValid() && "getting linkage from invalid cache");
1466      return static_cast<Linkage>(CachedLinkage);
1467    }
1468
1469    bool hasLocalOrUnnamedType() const {
1470       (0) . __assert_fail ("isCacheValid() && \"getting linkage from invalid cache\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/Type.h", 1470, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert(isCacheValid() && "getting linkage from invalid cache");
1471      return CachedLocalOrUnnamed;
1472    }
1473  };
1474  enum { NumTypeBits = 18 };
1475
1476protected:
1477  // These classes allow subclasses to somewhat cleanly pack bitfields
1478  // into Type.
1479
1480  class ArrayTypeBitfields {
1481    friend class ArrayType;
1482
1483    unsigned : NumTypeBits;
1484
1485    /// CVR qualifiers from declarations like
1486    /// 'int X[static restrict 4]'. For function parameters only.
1487    unsigned IndexTypeQuals : 3;
1488
1489    /// Storage class qualifiers from declarations like
1490    /// 'int X[static restrict 4]'. For function parameters only.
1491    /// Actually an ArrayType::ArraySizeModifier.
1492    unsigned SizeModifier : 3;
1493  };
1494
1495  class BuiltinTypeBitfields {
1496    friend class BuiltinType;
1497
1498    unsigned : NumTypeBits;
1499
1500    /// The kind (BuiltinType::Kind) of builtin type this is.
1501    unsigned Kind : 8;
1502  };
1503
1504  /// FunctionTypeBitfields store various bits belonging to FunctionProtoType.
1505  /// Only common bits are stored here. Additional uncommon bits are stored
1506  /// in a trailing object after FunctionProtoType.
1507  class FunctionTypeBitfields {
1508    friend class FunctionProtoType;
1509    friend class FunctionType;
1510
1511    unsigned : NumTypeBits;
1512
1513    /// Extra information which affects how the function is called, like
1514    /// regparm and the calling convention.
1515    unsigned ExtInfo : 12;
1516
1517    /// The ref-qualifier associated with a \c FunctionProtoType.
1518    ///
1519    /// This is a value of type \c RefQualifierKind.
1520    unsigned RefQualifier : 2;
1521
1522    /// Used only by FunctionProtoType, put here to pack with the
1523    /// other bitfields.
1524    /// The qualifiers are part of FunctionProtoType because...
1525    ///
1526    /// C++ 8.3.5p4: The return type, the parameter type list and the
1527    /// cv-qualifier-seq, [...], are part of the function type.
1528    unsigned FastTypeQuals : Qualifiers::FastWidth;
1529    /// Whether this function has extended Qualifiers.
1530    unsigned HasExtQuals : 1;
1531
1532    /// The number of parameters this function has, not counting '...'.
1533    /// According to [implimits] 8 bits should be enough here but this is
1534    /// somewhat easy to exceed with metaprogramming and so we would like to
1535    /// keep NumParams as wide as reasonably possible.
1536    unsigned NumParams : 16;
1537
1538    /// The type of exception specification this function has.
1539    unsigned ExceptionSpecType : 4;
1540
1541    /// Whether this function has extended parameter information.
1542    unsigned HasExtParameterInfos : 1;
1543
1544    /// Whether the function is variadic.
1545    unsigned Variadic : 1;
1546
1547    /// Whether this function has a trailing return type.
1548    unsigned HasTrailingReturn : 1;
1549  };
1550
1551  class ObjCObjectTypeBitfields {
1552    friend class ObjCObjectType;
1553
1554    unsigned : NumTypeBits;
1555
1556    /// The number of type arguments stored directly on this object type.
1557    unsigned NumTypeArgs : 7;
1558
1559    /// The number of protocols stored directly on this object type.
1560    unsigned NumProtocols : 6;
1561
1562    /// Whether this is a "kindof" type.
1563    unsigned IsKindOf : 1;
1564  };
1565
1566  class ReferenceTypeBitfields {
1567    friend class ReferenceType;
1568
1569    unsigned : NumTypeBits;
1570
1571    /// True if the type was originally spelled with an lvalue sigil.
1572    /// This is never true of rvalue references but can also be false
1573    /// on lvalue references because of C++0x [dcl.typedef]p9,
1574    /// as follows:
1575    ///
1576    ///   typedef int &ref;    // lvalue, spelled lvalue
1577    ///   typedef int &&rvref; // rvalue
1578    ///   ref &a;              // lvalue, inner ref, spelled lvalue
1579    ///   ref &&a;             // lvalue, inner ref
1580    ///   rvref &a;            // lvalue, inner ref, spelled lvalue
1581    ///   rvref &&a;           // rvalue, inner ref
1582    unsigned SpelledAsLValue : 1;
1583
1584    /// True if the inner type is a reference type.  This only happens
1585    /// in non-canonical forms.
1586    unsigned InnerRef : 1;
1587  };
1588
1589  class TypeWithKeywordBitfields {
1590    friend class TypeWithKeyword;
1591
1592    unsigned : NumTypeBits;
1593
1594    /// An ElaboratedTypeKeyword.  8 bits for efficient access.
1595    unsigned Keyword : 8;
1596  };
1597
1598  enum { NumTypeWithKeywordBits = 8 };
1599
1600  class ElaboratedTypeBitfields {
1601    friend class ElaboratedType;
1602
1603    unsigned : NumTypeBits;
1604    unsigned : NumTypeWithKeywordBits;
1605
1606    /// Whether the ElaboratedType has a trailing OwnedTagDecl.
1607    unsigned HasOwnedTagDecl : 1;
1608  };
1609
1610  class VectorTypeBitfields {
1611    friend class VectorType;
1612    friend class DependentVectorType;
1613
1614    unsigned : NumTypeBits;
1615
1616    /// The kind of vector, either a generic vector type or some
1617    /// target-specific vector type such as for AltiVec or Neon.
1618    unsigned VecKind : 3;
1619
1620    /// The number of elements in the vector.
1621    unsigned NumElements : 29 - NumTypeBits;
1622
1623    enum { MaxNumElements = (1 << (29 - NumTypeBits)) - 1 };
1624  };
1625
1626  class AttributedTypeBitfields {
1627    friend class AttributedType;
1628
1629    unsigned : NumTypeBits;
1630
1631    /// An AttributedType::Kind
1632    unsigned AttrKind : 32 - NumTypeBits;
1633  };
1634
1635  class AutoTypeBitfields {
1636    friend class AutoType;
1637
1638    unsigned : NumTypeBits;
1639
1640    /// Was this placeholder type spelled as 'auto', 'decltype(auto)',
1641    /// or '__auto_type'?  AutoTypeKeyword value.
1642    unsigned Keyword : 2;
1643  };
1644
1645  class SubstTemplateTypeParmPackTypeBitfields {
1646    friend class SubstTemplateTypeParmPackType;
1647
1648    unsigned : NumTypeBits;
1649
1650    /// The number of template arguments in \c Arguments, which is
1651    /// expected to be able to hold at least 1024 according to [implimits].
1652    /// However as this limit is somewhat easy to hit with template
1653    /// metaprogramming we'd prefer to keep it as large as possible.
1654    /// At the moment it has been left as a non-bitfield since this type
1655    /// safely fits in 64 bits as an unsigned, so there is no reason to
1656    /// introduce the performance impact of a bitfield.
1657    unsigned NumArgs;
1658  };
1659
1660  class TemplateSpecializationTypeBitfields {
1661    friend class TemplateSpecializationType;
1662
1663    unsigned : NumTypeBits;
1664
1665    /// Whether this template specialization type is a substituted type alias.
1666    unsigned TypeAlias : 1;
1667
1668    /// The number of template arguments named in this class template
1669    /// specialization, which is expected to be able to hold at least 1024
1670    /// according to [implimits]. However, as this limit is somewhat easy to
1671    /// hit with template metaprogramming we'd prefer to keep it as large
1672    /// as possible. At the moment it has been left as a non-bitfield since
1673    /// this type safely fits in 64 bits as an unsigned, so there is no reason
1674    /// to introduce the performance impact of a bitfield.
1675    unsigned NumArgs;
1676  };
1677
1678  class DependentTemplateSpecializationTypeBitfields {
1679    friend class DependentTemplateSpecializationType;
1680
1681    unsigned : NumTypeBits;
1682    unsigned : NumTypeWithKeywordBits;
1683
1684    /// The number of template arguments named in this class template
1685    /// specialization, which is expected to be able to hold at least 1024
1686    /// according to [implimits]. However, as this limit is somewhat easy to
1687    /// hit with template metaprogramming we'd prefer to keep it as large
1688    /// as possible. At the moment it has been left as a non-bitfield since
1689    /// this type safely fits in 64 bits as an unsigned, so there is no reason
1690    /// to introduce the performance impact of a bitfield.
1691    unsigned NumArgs;
1692  };
1693
1694  class PackExpansionTypeBitfields {
1695    friend class PackExpansionType;
1696
1697    unsigned : NumTypeBits;
1698
1699    /// The number of expansions that this pack expansion will
1700    /// generate when substituted (+1), which is expected to be able to
1701    /// hold at least 1024 according to [implimits]. However, as this limit
1702    /// is somewhat easy to hit with template metaprogramming we'd prefer to
1703    /// keep it as large as possible. At the moment it has been left as a
1704    /// non-bitfield since this type safely fits in 64 bits as an unsigned, so
1705    /// there is no reason to introduce the performance impact of a bitfield.
1706    ///
1707    /// This field will only have a non-zero value when some of the parameter
1708    /// packs that occur within the pattern have been substituted but others
1709    /// have not.
1710    unsigned NumExpansions;
1711  };
1712
1713  union {
1714    TypeBitfields TypeBits;
1715    ArrayTypeBitfields ArrayTypeBits;
1716    AttributedTypeBitfields AttributedTypeBits;
1717    AutoTypeBitfields AutoTypeBits;
1718    BuiltinTypeBitfields BuiltinTypeBits;
1719    FunctionTypeBitfields FunctionTypeBits;
1720    ObjCObjectTypeBitfields ObjCObjectTypeBits;
1721    ReferenceTypeBitfields ReferenceTypeBits;
1722    TypeWithKeywordBitfields TypeWithKeywordBits;
1723    ElaboratedTypeBitfields ElaboratedTypeBits;
1724    VectorTypeBitfields VectorTypeBits;
1725    SubstTemplateTypeParmPackTypeBitfields SubstTemplateTypeParmPackTypeBits;
1726    TemplateSpecializationTypeBitfields TemplateSpecializationTypeBits;
1727    DependentTemplateSpecializationTypeBitfields
1728      DependentTemplateSpecializationTypeBits;
1729    PackExpansionTypeBitfields PackExpansionTypeBits;
1730
1731    static_assert(sizeof(TypeBitfields) <= 8,
1732                  "TypeBitfields is larger than 8 bytes!");
1733    static_assert(sizeof(ArrayTypeBitfields) <= 8,
1734                  "ArrayTypeBitfields is larger than 8 bytes!");
1735    static_assert(sizeof(AttributedTypeBitfields) <= 8,
1736                  "AttributedTypeBitfields is larger than 8 bytes!");
1737    static_assert(sizeof(AutoTypeBitfields) <= 8,
1738                  "AutoTypeBitfields is larger than 8 bytes!");
1739    static_assert(sizeof(BuiltinTypeBitfields) <= 8,
1740                  "BuiltinTypeBitfields is larger than 8 bytes!");
1741    static_assert(sizeof(FunctionTypeBitfields) <= 8,
1742                  "FunctionTypeBitfields is larger than 8 bytes!");
1743    static_assert(sizeof(ObjCObjectTypeBitfields) <= 8,
1744                  "ObjCObjectTypeBitfields is larger than 8 bytes!");
1745    static_assert(sizeof(ReferenceTypeBitfields) <= 8,
1746                  "ReferenceTypeBitfields is larger than 8 bytes!");
1747    static_assert(sizeof(TypeWithKeywordBitfields) <= 8,
1748                  "TypeWithKeywordBitfields is larger than 8 bytes!");
1749    static_assert(sizeof(ElaboratedTypeBitfields) <= 8,
1750                  "ElaboratedTypeBitfields is larger than 8 bytes!");
1751    static_assert(sizeof(VectorTypeBitfields) <= 8,
1752                  "VectorTypeBitfields is larger than 8 bytes!");
1753    static_assert(sizeof(SubstTemplateTypeParmPackTypeBitfields) <= 8,
1754                  "SubstTemplateTypeParmPackTypeBitfields is larger"
1755                  " than 8 bytes!");
1756    static_assert(sizeof(TemplateSpecializationTypeBitfields) <= 8,
1757                  "TemplateSpecializationTypeBitfields is larger"
1758                  " than 8 bytes!");
1759    static_assert(sizeof(DependentTemplateSpecializationTypeBitfields) <= 8,
1760                  "DependentTemplateSpecializationTypeBitfields is larger"
1761                  " than 8 bytes!");
1762    static_assert(sizeof(PackExpansionTypeBitfields) <= 8,
1763                  "PackExpansionTypeBitfields is larger than 8 bytes");
1764  };
1765
1766private:
1767  template <class T> friend class TypePropertyCache;
1768
1769  /// Set whether this type comes from an AST file.
1770  void setFromAST(bool V = trueconst {
1771    TypeBits.FromAST = V;
1772  }
1773
1774protected:
1775  friend class ASTContext;
1776
1777  Type(TypeClass tcQualType canonbool Dependent,
1778       bool InstantiationDependentbool VariablyModified,
1779       bool ContainsUnexpandedParameterPack)
1780      : ExtQualsTypeCommonBase(this,
1781                               canon.isNull() ? QualType(this_(), 0) : canon) {
1782    TypeBits.TC = tc;
1783    TypeBits.Dependent = Dependent;
1784    TypeBits.InstantiationDependent = Dependent || InstantiationDependent;
1785    TypeBits.VariablyModified = VariablyModified;
1786    TypeBits.ContainsUnexpandedParameterPack = ContainsUnexpandedParameterPack;
1787    TypeBits.CacheValid = false;
1788    TypeBits.CachedLocalOrUnnamed = false;
1789    TypeBits.CachedLinkage = NoLinkage;
1790    TypeBits.FromAST = false;
1791  }
1792
1793  // silence VC++ warning C4355: 'this' : used in base member initializer list
1794  Type *this_() { return this; }
1795
1796  void setDependent(bool D = true) {
1797    TypeBits.Dependent = D;
1798    if (D)
1799      TypeBits.InstantiationDependent = true;
1800  }
1801
1802  void setInstantiationDependent(bool D = true) {
1803    TypeBits.InstantiationDependent = D; }
1804
1805  void setVariablyModified(bool VM = true) { TypeBits.VariablyModified = VM; }
1806
1807  void setContainsUnexpandedParameterPack(bool PP = true) {
1808    TypeBits.ContainsUnexpandedParameterPack = PP;
1809  }
1810
1811public:
1812  friend class ASTReader;
1813  friend class ASTWriter;
1814
1815  Type(const Type &) = delete;
1816  Type &operator=(const Type &) = delete;
1817
1818  TypeClass getTypeClass() const { return static_cast<TypeClass>(TypeBits.TC); }
1819
1820  /// Whether this type comes from an AST file.
1821  bool isFromAST() const { return TypeBits.FromAST; }
1822
1823  /// Whether this type is or contains an unexpanded parameter
1824  /// pack, used to support C++0x variadic templates.
1825  ///
1826  /// A type that contains a parameter pack shall be expanded by the
1827  /// ellipsis operator at some point. For example, the typedef in the
1828  /// following example contains an unexpanded parameter pack 'T':
1829  ///
1830  /// \code
1831  /// template<typename ...T>
1832  /// struct X {
1833  ///   typedef T* pointer_types; // ill-formed; T is a parameter pack.
1834  /// };
1835  /// \endcode
1836  ///
1837  /// Note that this routine does not specify which
1838  bool containsUnexpandedParameterPack() const {
1839    return TypeBits.ContainsUnexpandedParameterPack;
1840  }
1841
1842  /// Determines if this type would be canonical if it had no further
1843  /// qualification.
1844  bool isCanonicalUnqualified() const {
1845    return CanonicalType == QualType(this0);
1846  }
1847
1848  /// Pull a single level of sugar off of this locally-unqualified type.
1849  /// Users should generally prefer SplitQualType::getSingleStepDesugaredType()
1850  /// or QualType::getSingleStepDesugaredType(const ASTContext&).
1851  QualType getLocallyUnqualifiedSingleStepDesugaredType() const;
1852
1853  /// Types are partitioned into 3 broad categories (C99 6.2.5p1):
1854  /// object types, function types, and incomplete types.
1855
1856  /// Return true if this is an incomplete type.
1857  /// A type that can describe objects, but which lacks information needed to
1858  /// determine its size (e.g. void, or a fwd declared struct). Clients of this
1859  /// routine will need to determine if the size is actually required.
1860  ///
1861  /// Def If non-null, and the type refers to some kind of declaration
1862  /// that can be completed (such as a C struct, C++ class, or Objective-C
1863  /// class), will be set to the declaration.
1864  bool isIncompleteType(NamedDecl **Def = nullptrconst;
1865
1866  /// Return true if this is an incomplete or object
1867  /// type, in other words, not a function type.
1868  bool isIncompleteOrObjectType() const {
1869    return !isFunctionType();
1870  }
1871
1872  /// Determine whether this type is an object type.
1873  bool isObjectType() const {
1874    // C++ [basic.types]p8:
1875    //   An object type is a (possibly cv-qualified) type that is not a
1876    //   function type, not a reference type, and not a void type.
1877    return !isReferenceType() && !isFunctionType() && !isVoidType();
1878  }
1879
1880  /// Return true if this is a literal type
1881  /// (C++11 [basic.types]p10)
1882  bool isLiteralType(const ASTContext &Ctxconst;
1883
1884  /// Test if this type is a standard-layout type.
1885  /// (C++0x [basic.type]p9)
1886  bool isStandardLayoutType() const;
1887
1888  /// Helper methods to distinguish type categories. All type predicates
1889  /// operate on the canonical type, ignoring typedefs and qualifiers.
1890
1891  /// Returns true if the type is a builtin type.
1892  bool isBuiltinType() const;
1893
1894  /// Test for a particular builtin type.
1895  bool isSpecificBuiltinType(unsigned Kconst;
1896
1897  /// Test for a type which does not represent an actual type-system type but
1898  /// is instead used as a placeholder for various convenient purposes within
1899  /// Clang.  All such types are BuiltinTypes.
1900  bool isPlaceholderType() const;
1901  const BuiltinType *getAsPlaceholderType() const;
1902
1903  /// Test for a specific placeholder type.
1904  bool isSpecificPlaceholderType(unsigned Kconst;
1905
1906  /// Test for a placeholder type other than Overload; see
1907  /// BuiltinType::isNonOverloadPlaceholderType.
1908  bool isNonOverloadPlaceholderType() const;
1909
1910  /// isIntegerType() does *not* include complex integers (a GCC extension).
1911  /// isComplexIntegerType() can be used to test for complex integers.
1912  bool isIntegerType() const;     // C99 6.2.5p17 (int, char, bool, enum)
1913  bool isEnumeralType() const;
1914
1915  /// Determine whether this type is a scoped enumeration type.
1916  bool isScopedEnumeralType() const;
1917  bool isBooleanType() const;
1918  bool isCharType() const;
1919  bool isWideCharType() const;
1920  bool isChar8Type() const;
1921  bool isChar16Type() const;
1922  bool isChar32Type() const;
1923  bool isAnyCharacterType() const;
1924  bool isIntegralType(const ASTContext &Ctxconst;
1925
1926  /// Determine whether this type is an integral or enumeration type.
1927  bool isIntegralOrEnumerationType() const;
1928
1929  /// Determine whether this type is an integral or unscoped enumeration type.
1930  bool isIntegralOrUnscopedEnumerationType() const;
1931
1932  /// Floating point categories.
1933  bool isRealFloatingType() const// C99 6.2.5p10 (float, double, long double)
1934  /// isComplexType() does *not* include complex integers (a GCC extension).
1935  /// isComplexIntegerType() can be used to test for complex integers.
1936  bool isComplexType() const;      // C99 6.2.5p11 (complex)
1937  bool isAnyComplexType() const;   // C99 6.2.5p11 (complex) + Complex Int.
1938  bool isFloatingType() const;     // C99 6.2.5p11 (real floating + complex)
1939  bool isHalfType() const;         // OpenCL 6.1.1.1, NEON (IEEE 754-2008 half)
1940  bool isFloat16Type() const;      // C11 extension ISO/IEC TS 18661
1941  bool isFloat128Type() const;
1942  bool isRealType() const;         // C99 6.2.5p17 (real floating + integer)
1943  bool isArithmeticType() const;   // C99 6.2.5p18 (integer + floating)
1944  bool isVoidType() const;         // C99 6.2.5p19
1945  bool isScalarType() const;       // C99 6.2.5p21 (arithmetic + pointers)
1946  bool isAggregateType() const;
1947  bool isFundamentalType() const;
1948  bool isCompoundType() const;
1949
1950  // Type Predicates: Check to see if this type is structurally the specified
1951  // type, ignoring typedefs and qualifiers.
1952  bool isFunctionType() const;
1953  bool isFunctionNoProtoType() const { return getAs<FunctionNoProtoType>(); }
1954  bool isFunctionProtoType() const { return getAs<FunctionProtoType>(); }
1955  bool isPointerType() const;
1956  bool isAnyPointerType() const;   // Any C pointer or ObjC object pointer
1957  bool isBlockPointerType() const;
1958  bool isVoidPointerType() const;
1959  bool isReferenceType() const;
1960  bool isLValueReferenceType() const;
1961  bool isRValueReferenceType() const;
1962  bool isFunctionPointerType() const;
1963  bool isMemberPointerType() const;
1964  bool isMemberFunctionPointerType() const;
1965  bool isMemberDataPointerType() const;
1966  bool isArrayType() const;
1967  bool isConstantArrayType() const;
1968  bool isIncompleteArrayType() const;
1969  bool isVariableArrayType() const;
1970  bool isDependentSizedArrayType() const;
1971  bool isRecordType() const;
1972  bool isClassType() const;
1973  bool isStructureType() const;
1974  bool isObjCBoxableRecordType() const;
1975  bool isInterfaceType() const;
1976  bool isStructureOrClassType() const;
1977  bool isUnionType() const;
1978  bool isComplexIntegerType() const;            // GCC _Complex integer type.
1979  bool isVectorType() const;                    // GCC vector type.
1980  bool isExtVectorType() const;                 // Extended vector type.
1981  bool isDependentAddressSpaceType() const;     // value-dependent address space qualifier
1982  bool isObjCObjectPointerType() const;         // pointer to ObjC object
1983  bool isObjCRetainableType() const;            // ObjC object or block pointer
1984  bool isObjCLifetimeType() const;              // (array of)* retainable type
1985  bool isObjCIndirectLifetimeType() const;      // (pointer to)* lifetime type
1986  bool isObjCNSObjectType() const;              // __attribute__((NSObject))
1987  bool isObjCIndependentClassType() const;      // __attribute__((objc_independent_class))
1988  // FIXME: change this to 'raw' interface type, so we can used 'interface' type
1989  // for the common case.
1990  bool isObjCObjectType() const;                // NSString or typeof(*(id)0)
1991  bool isObjCQualifiedInterfaceType() const;    // NSString<foo>
1992  bool isObjCQualifiedIdType() const;           // id<foo>
1993  bool isObjCQualifiedClassType() const;        // Class<foo>
1994  bool isObjCObjectOrInterfaceType() const;
1995  bool isObjCIdType() const;                    // id
1996  bool isDecltypeType() const;
1997  /// Was this type written with the special inert-in-ARC __unsafe_unretained
1998  /// qualifier?
1999  ///
2000  /// This approximates the answer to the following question: if this
2001  /// translation unit were compiled in ARC, would this type be qualified
2002  /// with __unsafe_unretained?
2003  bool isObjCInertUnsafeUnretainedType() const {
2004    return hasAttr(attr::ObjCInertUnsafeUnretained);
2005  }
2006
2007  /// Whether the type is Objective-C 'id' or a __kindof type of an
2008  /// object type, e.g., __kindof NSView * or __kindof id
2009  /// <NSCopying>.
2010  ///
2011  /// \param bound Will be set to the bound on non-id subtype types,
2012  /// which will be (possibly specialized) Objective-C class type, or
2013  /// null for 'id.
2014  bool isObjCIdOrObjectKindOfType(const ASTContext &ctx,
2015                                  const ObjCObjectType *&boundconst;
2016
2017  bool isObjCClassType() const;                 // Class
2018
2019  /// Whether the type is Objective-C 'Class' or a __kindof type of an
2020  /// Class type, e.g., __kindof Class <NSCopying>.
2021  ///
2022  /// Unlike \c isObjCIdOrObjectKindOfType, there is no relevant bound
2023  /// here because Objective-C's type system cannot express "a class
2024  /// object for a subclass of NSFoo".
2025  bool isObjCClassOrClassKindOfType() const;
2026
2027  bool isBlockCompatibleObjCPointerType(ASTContext &ctxconst;
2028  bool isObjCSelType() const;                 // Class
2029  bool isObjCBuiltinType() const;               // 'id' or 'Class'
2030  bool isObjCARCBridgableType() const;
2031  bool isCARCBridgableType() const;
2032  bool isTemplateTypeParmType() const;          // C++ template type parameter
2033  bool isNullPtrType() const;                   // C++11 std::nullptr_t
2034  bool isAlignValT() const;                     // C++17 std::align_val_t
2035  bool isStdByteType() const;                   // C++17 std::byte
2036  bool isAtomicType() const;                    // C11 _Atomic()
2037
2038#define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \
2039  bool is##Id##Type() const;
2040#include "clang/Basic/OpenCLImageTypes.def"
2041
2042  bool isImageType() const;                     // Any OpenCL image type
2043
2044  bool isSamplerT() const;                      // OpenCL sampler_t
2045  bool isEventT() const;                        // OpenCL event_t
2046  bool isClkEventT() const;                     // OpenCL clk_event_t
2047  bool isQueueT() const;                        // OpenCL queue_t
2048  bool isReserveIDT() const;                    // OpenCL reserve_id_t
2049
2050#define EXT_OPAQUE_TYPE(ExtType, Id, Ext) \
2051  bool is##Id##Type() const;
2052#include "clang/Basic/OpenCLExtensionTypes.def"
2053  // Type defined in cl_intel_device_side_avc_motion_estimation OpenCL extension
2054  bool isOCLIntelSubgroupAVCType() const;
2055  bool isOCLExtOpaqueType() const;              // Any OpenCL extension type
2056
2057  bool isPipeType() const;                      // OpenCL pipe type
2058  bool isOpenCLSpecificType() const;            // Any OpenCL specific type
2059
2060  /// Determines if this type, which must satisfy
2061  /// isObjCLifetimeType(), is implicitly __unsafe_unretained rather
2062  /// than implicitly __strong.
2063  bool isObjCARCImplicitlyUnretainedType() const;
2064
2065  /// Return the implicit lifetime for this type, which must not be dependent.
2066  Qualifiers::ObjCLifetime getObjCARCImplicitLifetime() const;
2067
2068  enum ScalarTypeKind {
2069    STK_CPointer,
2070    STK_BlockPointer,
2071    STK_ObjCObjectPointer,
2072    STK_MemberPointer,
2073    STK_Bool,
2074    STK_Integral,
2075    STK_Floating,
2076    STK_IntegralComplex,
2077    STK_FloatingComplex,
2078    STK_FixedPoint
2079  };
2080
2081  /// Given that this is a scalar type, classify it.
2082  ScalarTypeKind getScalarTypeKind() const;
2083
2084  /// Whether this type is a dependent type, meaning that its definition
2085  /// somehow depends on a template parameter (C++ [temp.dep.type]).
2086  bool isDependentType() const { return TypeBits.Dependent; }
2087
2088  /// Determine whether this type is an instantiation-dependent type,
2089  /// meaning that the type involves a template parameter (even if the
2090  /// definition does not actually depend on the type substituted for that
2091  /// template parameter).
2092  bool isInstantiationDependentType() const {
2093    return TypeBits.InstantiationDependent;
2094  }
2095
2096  /// Determine whether this type is an undeduced type, meaning that
2097  /// it somehow involves a C++11 'auto' type or similar which has not yet been
2098  /// deduced.
2099  bool isUndeducedType() const;
2100
2101  /// Whether this type is a variably-modified type (C99 6.7.5).
2102  bool isVariablyModifiedType() const { return TypeBits.VariablyModified; }
2103
2104  /// Whether this type involves a variable-length array type
2105  /// with a definite size.
2106  bool hasSizedVLAType() const;
2107
2108  /// Whether this type is or contains a local or unnamed type.
2109  bool hasUnnamedOrLocalType() const;
2110
2111  bool isOverloadableType() const;
2112
2113  /// Determine wither this type is a C++ elaborated-type-specifier.
2114  bool isElaboratedTypeSpecifier() const;
2115
2116  bool canDecayToPointerType() const;
2117
2118  /// Whether this type is represented natively as a pointer.  This includes
2119  /// pointers, references, block pointers, and Objective-C interface,
2120  /// qualified id, and qualified interface types, as well as nullptr_t.
2121  bool hasPointerRepresentation() const;
2122
2123  /// Whether this type can represent an objective pointer type for the
2124  /// purpose of GC'ability
2125  bool hasObjCPointerRepresentation() const;
2126
2127  /// Determine whether this type has an integer representation
2128  /// of some sort, e.g., it is an integer type or a vector.
2129  bool hasIntegerRepresentation() const;
2130
2131  /// Determine whether this type has an signed integer representation
2132  /// of some sort, e.g., it is an signed integer type or a vector.
2133  bool hasSignedIntegerRepresentation() const;
2134
2135  /// Determine whether this type has an unsigned integer representation
2136  /// of some sort, e.g., it is an unsigned integer type or a vector.
2137  bool hasUnsignedIntegerRepresentation() const;
2138
2139  /// Determine whether this type has a floating-point representation
2140  /// of some sort, e.g., it is a floating-point type or a vector thereof.
2141  bool hasFloatingRepresentation() const;
2142
2143  // Type Checking Functions: Check to see if this type is structurally the
2144  // specified type, ignoring typedefs and qualifiers, and return a pointer to
2145  // the best type we can.
2146  const RecordType *getAsStructureType() const;
2147  /// NOTE: getAs*ArrayType are methods on ASTContext.
2148  const RecordType *getAsUnionType() const;
2149  const ComplexType *getAsComplexIntegerType() const// GCC complex int type.
2150  const ObjCObjectType *getAsObjCInterfaceType() const;
2151
2152  // The following is a convenience method that returns an ObjCObjectPointerType
2153  // for object declared using an interface.
2154  const ObjCObjectPointerType *getAsObjCInterfacePointerType() const;
2155  const ObjCObjectPointerType *getAsObjCQualifiedIdType() const;
2156  const ObjCObjectPointerType *getAsObjCQualifiedClassType() const;
2157  const ObjCObjectType *getAsObjCQualifiedInterfaceType() const;
2158
2159  /// Retrieves the CXXRecordDecl that this type refers to, either
2160  /// because the type is a RecordType or because it is the injected-class-name
2161  /// type of a class template or class template partial specialization.
2162  CXXRecordDecl *getAsCXXRecordDecl() const;
2163
2164  /// Retrieves the RecordDecl this type refers to.
2165  RecordDecl *getAsRecordDecl() const;
2166
2167  /// Retrieves the TagDecl that this type refers to, either
2168  /// because the type is a TagType or because it is the injected-class-name
2169  /// type of a class template or class template partial specialization.
2170  TagDecl *getAsTagDecl() const;
2171
2172  /// If this is a pointer or reference to a RecordType, return the
2173  /// CXXRecordDecl that the type refers to.
2174  ///
2175  /// If this is not a pointer or reference, or the type being pointed to does
2176  /// not refer to a CXXRecordDecl, returns NULL.
2177  const CXXRecordDecl *getPointeeCXXRecordDecl() const;
2178
2179  /// Get the DeducedType whose type will be deduced for a variable with
2180  /// an initializer of this type. This looks through declarators like pointer
2181  /// types, but not through decltype or typedefs.
2182  DeducedType *getContainedDeducedType() const;
2183
2184  /// Get the AutoType whose type will be deduced for a variable with
2185  /// an initializer of this type. This looks through declarators like pointer
2186  /// types, but not through decltype or typedefs.
2187  AutoType *getContainedAutoType() const {
2188    return dyn_cast_or_null<AutoType>(getContainedDeducedType());
2189  }
2190
2191  /// Determine whether this type was written with a leading 'auto'
2192  /// corresponding to a trailing return type (possibly for a nested
2193  /// function type within a pointer to function type or similar).
2194  bool hasAutoForTrailingReturnType() const;
2195
2196  /// Member-template getAs<specific type>'.  Look through sugar for
2197  /// an instance of \<specific type>.   This scheme will eventually
2198  /// replace the specific getAsXXXX methods above.
2199  ///
2200  /// There are some specializations of this member template listed
2201  /// immediately following this class.
2202  template <typename T> const T *getAs() const;
2203
2204  /// Member-template getAsAdjusted<specific type>. Look through specific kinds
2205  /// of sugar (parens, attributes, etc) for an instance of \<specific type>.
2206  /// This is used when you need to walk over sugar nodes that represent some
2207  /// kind of type adjustment from a type that was written as a \<specific type>
2208  /// to another type that is still canonically a \<specific type>.
2209  template <typename T> const T *getAsAdjusted() const;
2210
2211  /// A variant of getAs<> for array types which silently discards
2212  /// qualifiers from the outermost type.
2213  const ArrayType *getAsArrayTypeUnsafe() const;
2214
2215  /// Member-template castAs<specific type>.  Look through sugar for
2216  /// the underlying instance of \<specific type>.
2217  ///
2218  /// This method has the same relationship to getAs<T> as cast<T> has
2219  /// to dyn_cast<T>; which is to say, the underlying type *must*
2220  /// have the intended type, and this method will never return null.
2221  template <typename T> const T *castAs() const;
2222
2223  /// A variant of castAs<> for array type which silently discards
2224  /// qualifiers from the outermost type.
2225  const ArrayType *castAsArrayTypeUnsafe() const;
2226
2227  /// Determine whether this type had the specified attribute applied to it
2228  /// (looking through top-level type sugar).
2229  bool hasAttr(attr::Kind AKconst;
2230
2231  /// Get the base element type of this type, potentially discarding type
2232  /// qualifiers.  This should never be used when type qualifiers
2233  /// are meaningful.
2234  const Type *getBaseElementTypeUnsafe() const;
2235
2236  /// If this is an array type, return the element type of the array,
2237  /// potentially with type qualifiers missing.
2238  /// This should never be used when type qualifiers are meaningful.
2239  const Type *getArrayElementTypeNoTypeQual() const;
2240
2241  /// If this is a pointer type, return the pointee type.
2242  /// If this is an array type, return the array element type.
2243  /// This should never be used when type qualifiers are meaningful.
2244  const Type *getPointeeOrArrayElementType() const;
2245
2246  /// If this is a pointer, ObjC object pointer, or block
2247  /// pointer, this returns the respective pointee.
2248  QualType getPointeeType() const;
2249
2250  /// Return the specified type with any "sugar" removed from the type,
2251  /// removing any typedefs, typeofs, etc., as well as any qualifiers.
2252  const Type *getUnqualifiedDesugaredType() const;
2253
2254  /// More type predicates useful for type checking/promotion
2255  bool isPromotableIntegerType() const// C99 6.3.1.1p2
2256
2257  /// Return true if this is an integer type that is
2258  /// signed, according to C99 6.2.5p4 [char, signed char, short, int, long..],
2259  /// or an enum decl which has a signed representation.
2260  bool isSignedIntegerType() const;
2261
2262  /// Return true if this is an integer type that is
2263  /// unsigned, according to C99 6.2.5p6 [which returns true for _Bool],
2264  /// or an enum decl which has an unsigned representation.
2265  bool isUnsignedIntegerType() const;
2266
2267  /// Determines whether this is an integer type that is signed or an
2268  /// enumeration types whose underlying type is a signed integer type.
2269  bool isSignedIntegerOrEnumerationType() const;
2270
2271  /// Determines whether this is an integer type that is unsigned or an
2272  /// enumeration types whose underlying type is a unsigned integer type.
2273  bool isUnsignedIntegerOrEnumerationType() const;
2274
2275  /// Return true if this is a fixed point type according to
2276  /// ISO/IEC JTC1 SC22 WG14 N1169.
2277  bool isFixedPointType() const;
2278
2279  /// Return true if this is a fixed point or integer type.
2280  bool isFixedPointOrIntegerType() const;
2281
2282  /// Return true if this is a saturated fixed point type according to
2283  /// ISO/IEC JTC1 SC22 WG14 N1169. This type can be signed or unsigned.
2284  bool isSaturatedFixedPointType() const;
2285
2286  /// Return true if this is a saturated fixed point type according to
2287  /// ISO/IEC JTC1 SC22 WG14 N1169. This type can be signed or unsigned.
2288  bool isUnsaturatedFixedPointType() const;
2289
2290  /// Return true if this is a fixed point type that is signed according
2291  /// to ISO/IEC JTC1 SC22 WG14 N1169. This type can also be saturated.
2292  bool isSignedFixedPointType() const;
2293
2294  /// Return true if this is a fixed point type that is unsigned according
2295  /// to ISO/IEC JTC1 SC22 WG14 N1169. This type can also be saturated.
2296  bool isUnsignedFixedPointType() const;
2297
2298  /// Return true if this is not a variable sized type,
2299  /// according to the rules of C99 6.7.5p3.  It is not legal to call this on
2300  /// incomplete types.
2301  bool isConstantSizeType() const;
2302
2303  /// Returns true if this type can be represented by some
2304  /// set of type specifiers.
2305  bool isSpecifierType() const;
2306
2307  /// Determine the linkage of this type.
2308  Linkage getLinkage() const;
2309
2310  /// Determine the visibility of this type.
2311  Visibility getVisibility() const {
2312    return getLinkageAndVisibility().getVisibility();
2313  }
2314
2315  /// Return true if the visibility was explicitly set is the code.
2316  bool isVisibilityExplicit() const {
2317    return getLinkageAndVisibility().isVisibilityExplicit();
2318  }
2319
2320  /// Determine the linkage and visibility of this type.
2321  LinkageInfo getLinkageAndVisibility() const;
2322
2323  /// True if the computed linkage is valid. Used for consistency
2324  /// checking. Should always return true.
2325  bool isLinkageValid() const;
2326
2327  /// Determine the nullability of the given type.
2328  ///
2329  /// Note that nullability is only captured as sugar within the type
2330  /// system, not as part of the canonical type, so nullability will
2331  /// be lost by canonicalization and desugaring.
2332  Optional<NullabilityKindgetNullability(const ASTContext &contextconst;
2333
2334  /// Determine whether the given type can have a nullability
2335  /// specifier applied to it, i.e., if it is any kind of pointer type.
2336  ///
2337  /// \param ResultIfUnknown The value to return if we don't yet know whether
2338  ///        this type can have nullability because it is dependent.
2339  bool canHaveNullability(bool ResultIfUnknown = trueconst;
2340
2341  /// Retrieve the set of substitutions required when accessing a member
2342  /// of the Objective-C receiver type that is declared in the given context.
2343  ///
2344  /// \c *this is the type of the object we're operating on, e.g., the
2345  /// receiver for a message send or the base of a property access, and is
2346  /// expected to be of some object or object pointer type.
2347  ///
2348  /// \param dc The declaration context for which we are building up a
2349  /// substitution mapping, which should be an Objective-C class, extension,
2350  /// category, or method within.
2351  ///
2352  /// \returns an array of type arguments that can be substituted for
2353  /// the type parameters of the given declaration context in any type described
2354  /// within that context, or an empty optional to indicate that no
2355  /// substitution is required.
2356  Optional<ArrayRef<QualType>>
2357  getObjCSubstitutions(const DeclContext *dcconst;
2358
2359  /// Determines if this is an ObjC interface type that may accept type
2360  /// parameters.
2361  bool acceptsObjCTypeParams() const;
2362
2363  const char *getTypeClassName() const;
2364
2365  QualType getCanonicalTypeInternal() const {
2366    return CanonicalType;
2367  }
2368
2369  CanQualType getCanonicalTypeUnqualified() const// in CanonicalType.h
2370  void dump() const;
2371  void dump(llvm::raw_ostream &OSconst;
2372};
2373
2374/// This will check for a TypedefType by removing any existing sugar
2375/// until it reaches a TypedefType or a non-sugared type.
2376template <> const TypedefType *Type::getAs() const;
2377
2378/// This will check for a TemplateSpecializationType by removing any
2379/// existing sugar until it reaches a TemplateSpecializationType or a
2380/// non-sugared type.
2381template <> const TemplateSpecializationType *Type::getAs() const;
2382
2383/// This will check for an AttributedType by removing any existing sugar
2384/// until it reaches an AttributedType or a non-sugared type.
2385template <> const AttributedType *Type::getAs() const;
2386
2387// We can do canonical leaf types faster, because we don't have to
2388// worry about preserving child type decoration.
2389#define TYPE(Class, Base)
2390#define LEAF_TYPE(Class) \
2391template <> inline const Class##Type *Type::getAs() const { \
2392  return dyn_cast<Class##Type>(CanonicalType); \
2393} \
2394template <> inline const Class##Type *Type::castAs() const { \
2395  return cast<Class##Type>(CanonicalType); \
2396}
2397#include "clang/AST/TypeNodes.def"
2398
2399/// This class is used for builtin types like 'int'.  Builtin
2400/// types are always canonical and have a literal name field.
2401class BuiltinType : public Type {
2402public:
2403  enum Kind {
2404// OpenCL image types
2405#define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) Id,
2406#include "clang/Basic/OpenCLImageTypes.def"
2407// OpenCL extension types
2408#define EXT_OPAQUE_TYPE(ExtType, Id, Ext) Id,
2409#include "clang/Basic/OpenCLExtensionTypes.def"
2410// All other builtin types
2411#define BUILTIN_TYPE(Id, SingletonId) Id,
2412#define LAST_BUILTIN_TYPE(Id) LastKind = Id
2413#include "clang/AST/BuiltinTypes.def"
2414  };
2415
2416private:
2417  friend class ASTContext// ASTContext creates these.
2418
2419  BuiltinType(Kind K)
2420      : Type(BuiltinQualType(), /*Dependent=*/(K == Dependent),
2421             /*InstantiationDependent=*/(K == Dependent),
2422             /*VariablyModified=*/false,
2423             /*Unexpanded parameter pack=*/false) {
2424    BuiltinTypeBits.Kind = K;
2425  }
2426
2427public:
2428  Kind getKind() const { return static_cast<Kind>(BuiltinTypeBits.Kind); }
2429  StringRef getName(const PrintingPolicy &Policyconst;
2430
2431  const char *getNameAsCString(const PrintingPolicy &Policyconst {
2432    // The StringRef is null-terminated.
2433    StringRef str = getName(Policy);
2434    assert(!str.empty() && str.data()[str.size()] == '\0');
2435    return str.data();
2436  }
2437
2438  bool isSugared() const { return false; }
2439  QualType desugar() const { return QualType(this0); }
2440
2441  bool isInteger() const {
2442    return getKind() >= Bool && getKind() <= Int128;
2443  }
2444
2445  bool isSignedInteger() const {
2446    return getKind() >= Char_S && getKind() <= Int128;
2447  }
2448
2449  bool isUnsignedInteger() const {
2450    return getKind() >= Bool && getKind() <= UInt128;
2451  }
2452
2453  bool isFloatingPoint() const {
2454    return getKind() >= Half && getKind() <= Float128;
2455  }
2456
2457  /// Determines whether the given kind corresponds to a placeholder type.
2458  static bool isPlaceholderTypeKind(Kind K) {
2459    return K >= Overload;
2460  }
2461
2462  /// Determines whether this type is a placeholder type, i.e. a type
2463  /// which cannot appear in arbitrary positions in a fully-formed
2464  /// expression.
2465  bool isPlaceholderType() const {
2466    return isPlaceholderTypeKind(getKind());
2467  }
2468
2469  /// Determines whether this type is a placeholder type other than
2470  /// Overload.  Most placeholder types require only syntactic
2471  /// information about their context in order to be resolved (e.g.
2472  /// whether it is a call expression), which means they can (and
2473  /// should) be resolved in an earlier "phase" of analysis.
2474  /// Overload expressions sometimes pick up further information
2475  /// from their context, like whether the context expects a
2476  /// specific function-pointer type, and so frequently need
2477  /// special treatment.
2478  bool isNonOverloadPlaceholderType() const {
2479    return getKind() > Overload;
2480  }
2481
2482  static bool classof(const Type *T) { return T->getTypeClass() == Builtin; }
2483};
2484
2485/// Complex values, per C99 6.2.5p11.  This supports the C99 complex
2486/// types (_Complex float etc) as well as the GCC integer complex extensions.
2487class ComplexType : public Typepublic llvm::FoldingSetNode {
2488  friend class ASTContext// ASTContext creates these.
2489
2490  QualType ElementType;
2491
2492  ComplexType(QualType ElementQualType CanonicalPtr)
2493      : Type(ComplexCanonicalPtrElement->isDependentType(),
2494             Element->isInstantiationDependentType(),
2495             Element->isVariablyModifiedType(),
2496             Element->containsUnexpandedParameterPack()),
2497        ElementType(Element) {}
2498
2499public:
2500  QualType getElementType() const { return ElementType; }
2501
2502  bool isSugared() const { return false; }
2503  QualType desugar() const { return QualType(this0); }
2504
2505  void Profile(llvm::FoldingSetNodeID &ID) {
2506    Profile(IDgetElementType());
2507  }
2508
2509  static void Profile(llvm::FoldingSetNodeID &IDQualType Element) {
2510    ID.AddPointer(Element.getAsOpaquePtr());
2511  }
2512
2513  static bool classof(const Type *T) { return T->getTypeClass() == Complex; }
2514};
2515
2516/// Sugar for parentheses used when specifying types.
2517class ParenType : public Typepublic llvm::FoldingSetNode {
2518  friend class ASTContext// ASTContext creates these.
2519
2520  QualType Inner;
2521
2522  ParenType(QualType InnerTypeQualType CanonType)
2523      : Type(ParenCanonTypeInnerType->isDependentType(),
2524             InnerType->isInstantiationDependentType(),
2525             InnerType->isVariablyModifiedType(),
2526             InnerType->containsUnexpandedParameterPack()),
2527        Inner(InnerType) {}
2528
2529public:
2530  QualType getInnerType() const { return Inner; }
2531
2532  bool isSugared() const { return true; }
2533  QualType desugar() const { return getInnerType(); }
2534
2535  void Profile(llvm::FoldingSetNodeID &ID) {
2536    Profile(IDgetInnerType());
2537  }
2538
2539  static void Profile(llvm::FoldingSetNodeID &IDQualType Inner) {
2540    Inner.Profile(ID);
2541  }
2542
2543  static bool classof(const Type *T) { return T->getTypeClass() == Paren; }
2544};
2545
2546/// PointerType - C99 6.7.5.1 - Pointer Declarators.
2547class PointerType : public Typepublic llvm::FoldingSetNode {
2548  friend class ASTContext// ASTContext creates these.
2549
2550  QualType PointeeType;
2551
2552  PointerType(QualType PointeeQualType CanonicalPtr)
2553      : Type(PointerCanonicalPtrPointee->isDependentType(),
2554             Pointee->isInstantiationDependentType(),
2555             Pointee->isVariablyModifiedType(),
2556             Pointee->containsUnexpandedParameterPack()),
2557        PointeeType(Pointee) {}
2558
2559public:
2560  QualType getPointeeType() const { return PointeeType; }
2561
2562  /// Returns true if address spaces of pointers overlap.
2563  /// OpenCL v2.0 defines conversion rules for pointers to different
2564  /// address spaces (OpenCLC v2.0 s6.5.5) and notion of overlapping
2565  /// address spaces.
2566  /// CL1.1 or CL1.2:
2567  ///   address spaces overlap iff they are they same.
2568  /// CL2.0 adds:
2569  ///   __generic overlaps with any address space except for __constant.
2570  bool isAddressSpaceOverlapping(const PointerType &otherconst {
2571    Qualifiers thisQuals = PointeeType.getQualifiers();
2572    Qualifiers otherQuals = other.getPointeeType().getQualifiers();
2573    // Address spaces overlap if at least one of them is a superset of another
2574    return thisQuals.isAddressSpaceSupersetOf(otherQuals) ||
2575           otherQuals.isAddressSpaceSupersetOf(thisQuals);
2576  }
2577
2578  bool isSugared() const { return false; }
2579  QualType desugar() const { return QualType(this0); }
2580
2581  void Profile(llvm::FoldingSetNodeID &ID) {
2582    Profile(IDgetPointeeType());
2583  }
2584
2585  static void Profile(llvm::FoldingSetNodeID &IDQualType Pointee) {
2586    ID.AddPointer(Pointee.getAsOpaquePtr());
2587  }
2588
2589  static bool classof(const Type *T) { return T->getTypeClass() == Pointer; }
2590};
2591
2592/// Represents a type which was implicitly adjusted by the semantic
2593/// engine for arbitrary reasons.  For example, array and function types can
2594/// decay, and function types can have their calling conventions adjusted.
2595class AdjustedType : public Typepublic llvm::FoldingSetNode {
2596  QualType OriginalTy;
2597  QualType AdjustedTy;
2598
2599protected:
2600  friend class ASTContext// ASTContext creates these.
2601
2602  AdjustedType(TypeClass TCQualType OriginalTyQualType AdjustedTy,
2603               QualType CanonicalPtr)
2604      : Type(TCCanonicalPtrOriginalTy->isDependentType(),
2605             OriginalTy->isInstantiationDependentType(),
2606             OriginalTy->isVariablyModifiedType(),
2607             OriginalTy->containsUnexpandedParameterPack()),
2608        OriginalTy(OriginalTy), AdjustedTy(AdjustedTy) {}
2609
2610public:
2611  QualType getOriginalType() const { return OriginalTy; }
2612  QualType getAdjustedType() const { return AdjustedTy; }
2613
2614  bool isSugared() const { return true; }
2615  QualType desugar() const { return AdjustedTy; }
2616
2617  void Profile(llvm::FoldingSetNodeID &ID) {
2618    Profile(IDOriginalTyAdjustedTy);
2619  }
2620
2621  static void Profile(llvm::FoldingSetNodeID &IDQualType OrigQualType New) {
2622    ID.AddPointer(Orig.getAsOpaquePtr());
2623    ID.AddPointer(New.getAsOpaquePtr());
2624  }
2625
2626  static bool classof(const Type *T) {
2627    return T->getTypeClass() == Adjusted || T->getTypeClass() == Decayed;
2628  }
2629};
2630
2631/// Represents a pointer type decayed from an array or function type.
2632class DecayedType : public AdjustedType {
2633  friend class ASTContext// ASTContext creates these.
2634
2635  inline
2636  DecayedType(QualType OriginalTypeQualType DecayedQualType Canonical);
2637
2638public:
2639  QualType getDecayedType() const { return getAdjustedType(); }
2640
2641  inline QualType getPointeeType() const;
2642
2643  static bool classof(const Type *T) { return T->getTypeClass() == Decayed; }
2644};
2645
2646/// Pointer to a block type.
2647/// This type is to represent types syntactically represented as
2648/// "void (^)(int)", etc. Pointee is required to always be a function type.
2649class BlockPointerType : public Typepublic llvm::FoldingSetNode {
2650  friend class ASTContext// ASTContext creates these.
2651
2652  // Block is some kind of pointer type
2653  QualType PointeeType;
2654
2655  BlockPointerType(QualType PointeeQualType CanonicalCls)
2656      : Type(BlockPointerCanonicalClsPointee->isDependentType(),
2657             Pointee->isInstantiationDependentType(),
2658             Pointee->isVariablyModifiedType(),
2659             Pointee->containsUnexpandedParameterPack()),
2660        PointeeType(Pointee) {}
2661
2662public:
2663  // Get the pointee type. Pointee is required to always be a function type.
2664  QualType getPointeeType() const { return PointeeType; }
2665
2666  bool isSugared() const { return false; }
2667  QualType desugar() const { return QualType(this0); }
2668
2669  void Profile(llvm::FoldingSetNodeID &ID) {
2670      Profile(IDgetPointeeType());
2671  }
2672
2673  static void Profile(llvm::FoldingSetNodeID &IDQualType Pointee) {
2674      ID.AddPointer(Pointee.getAsOpaquePtr());
2675  }
2676
2677  static bool classof(const Type *T) {
2678    return T->getTypeClass() == BlockPointer;
2679  }
2680};
2681
2682/// Base for LValueReferenceType and RValueReferenceType
2683class ReferenceType : public Typepublic llvm::FoldingSetNode {
2684  QualType PointeeType;
2685
2686protected:
2687  ReferenceType(TypeClass tcQualType ReferenceeQualType CanonicalRef,
2688                bool SpelledAsLValue)
2689      : Type(tcCanonicalRefReferencee->isDependentType(),
2690             Referencee->isInstantiationDependentType(),
2691             Referencee->isVariablyModifiedType(),
2692             Referencee->containsUnexpandedParameterPack()),
2693        PointeeType(Referencee) {
2694    ReferenceTypeBits.SpelledAsLValue = SpelledAsLValue;
2695    ReferenceTypeBits.InnerRef = Referencee->isReferenceType();
2696  }
2697
2698public:
2699  bool isSpelledAsLValue() const { return ReferenceTypeBits.SpelledAsLValue; }
2700  bool isInnerRef() const { return ReferenceTypeBits.InnerRef; }
2701
2702  QualType getPointeeTypeAsWritten() const { return PointeeType; }
2703
2704  QualType getPointeeType() const {
2705    // FIXME: this might strip inner qualifiers; okay?
2706    const ReferenceType *T = this;
2707    while (T->isInnerRef())
2708      T = T->PointeeType->castAs<ReferenceType>();
2709    return T->PointeeType;
2710  }
2711
2712  void Profile(llvm::FoldingSetNodeID &ID) {
2713    Profile(IDPointeeTypeisSpelledAsLValue());
2714  }
2715
2716  static void Profile(llvm::FoldingSetNodeID &ID,
2717                      QualType Referencee,
2718                      bool SpelledAsLValue) {
2719    ID.AddPointer(Referencee.getAsOpaquePtr());
2720    ID.AddBoolean(SpelledAsLValue);
2721  }
2722
2723  static bool classof(const Type *T) {
2724    return T->getTypeClass() == LValueReference ||
2725           T->getTypeClass() == RValueReference;
2726  }
2727};
2728
2729/// An lvalue reference type, per C++11 [dcl.ref].
2730class LValueReferenceType : public ReferenceType {
2731  friend class ASTContext// ASTContext creates these
2732
2733  LValueReferenceType(QualType ReferenceeQualType CanonicalRef,
2734                      bool SpelledAsLValue)
2735      : ReferenceType(LValueReferenceReferenceeCanonicalRef,
2736                      SpelledAsLValue) {}
2737
2738public:
2739  bool isSugared() const { return false; }
2740  QualType desugar() const { return QualType(this0); }
2741
2742  static bool classof(const Type *T) {
2743    return T->getTypeClass() == LValueReference;
2744  }
2745};
2746
2747/// An rvalue reference type, per C++11 [dcl.ref].
2748class RValueReferenceType : public ReferenceType {
2749  friend class ASTContext// ASTContext creates these
2750
2751  RValueReferenceType(QualType ReferenceeQualType CanonicalRef)
2752       : ReferenceType(RValueReferenceReferenceeCanonicalReffalse) {}
2753
2754public:
2755  bool isSugared() const { return false; }
2756  QualType desugar() const { return QualType(this0); }
2757
2758  static bool classof(const Type *T) {
2759    return T->getTypeClass() == RValueReference;
2760  }
2761};
2762
2763/// A pointer to member type per C++ 8.3.3 - Pointers to members.
2764///
2765/// This includes both pointers to data members and pointer to member functions.
2766class MemberPointerType : public Typepublic llvm::FoldingSetNode {
2767  friend class ASTContext// ASTContext creates these.
2768
2769  QualType PointeeType;
2770
2771  /// The class of which the pointee is a member. Must ultimately be a
2772  /// RecordType, but could be a typedef or a template parameter too.
2773  const Type *Class;
2774
2775  MemberPointerType(QualType Pointeeconst Type *ClsQualType CanonicalPtr)
2776      : Type(MemberPointerCanonicalPtr,
2777             Cls->isDependentType() || Pointee->isDependentType(),
2778             (Cls->isInstantiationDependentType() ||
2779              Pointee->isInstantiationDependentType()),
2780             Pointee->isVariablyModifiedType(),
2781             (Cls->containsUnexpandedParameterPack() ||
2782              Pointee->containsUnexpandedParameterPack())),
2783             PointeeType(Pointee), Class(Cls) {}
2784
2785public:
2786  QualType getPointeeType() const { return PointeeType; }
2787
2788  /// Returns true if the member type (i.e. the pointee type) is a
2789  /// function type rather than a data-member type.
2790  bool isMemberFunctionPointer() const {
2791    return PointeeType->isFunctionProtoType();
2792  }
2793
2794  /// Returns true if the member type (i.e. the pointee type) is a
2795  /// data type rather than a function type.
2796  bool isMemberDataPointer() const {
2797    return !PointeeType->isFunctionProtoType();
2798  }
2799
2800  const Type *getClass() const { return Class; }
2801  CXXRecordDecl *getMostRecentCXXRecordDecl() const;
2802
2803  bool isSugared() const { return false; }
2804  QualType desugar() const { return QualType(this0); }
2805
2806  void Profile(llvm::FoldingSetNodeID &ID) {
2807    Profile(IDgetPointeeType(), getClass());
2808  }
2809
2810  static void Profile(llvm::FoldingSetNodeID &IDQualType Pointee,
2811                      const Type *Class) {
2812    ID.AddPointer(Pointee.getAsOpaquePtr());
2813    ID.AddPointer(Class);
2814  }
2815
2816  static bool classof(const Type *T) {
2817    return T->getTypeClass() == MemberPointer;
2818  }
2819};
2820
2821/// Represents an array type, per C99 6.7.5.2 - Array Declarators.
2822class ArrayType : public Typepublic llvm::FoldingSetNode {
2823public:
2824  /// Capture whether this is a normal array (e.g. int X[4])
2825  /// an array with a static size (e.g. int X[static 4]), or an array
2826  /// with a star size (e.g. int X[*]).
2827  /// 'static' is only allowed on function parameters.
2828  enum ArraySizeModifier {
2829    NormalStaticStar
2830  };
2831
2832private:
2833  /// The element type of the array.
2834  QualType ElementType;
2835
2836protected:
2837  friend class ASTContext// ASTContext creates these.
2838
2839  // C++ [temp.dep.type]p1:
2840  //   A type is dependent if it is...
2841  //     - an array type constructed from any dependent type or whose
2842  //       size is specified by a constant expression that is
2843  //       value-dependent,
2844  ArrayType(TypeClass tcQualType etQualType can,
2845            ArraySizeModifier smunsigned tq,
2846            bool ContainsUnexpandedParameterPack)
2847      : Type(tccanet->isDependentType() || tc == DependentSizedArray,
2848             et->isInstantiationDependentType() || tc == DependentSizedArray,
2849             (tc == VariableArray || et->isVariablyModifiedType()),
2850             ContainsUnexpandedParameterPack),
2851        ElementType(et) {
2852    ArrayTypeBits.IndexTypeQuals = tq;
2853    ArrayTypeBits.SizeModifier = sm;
2854  }
2855
2856public:
2857  QualType getElementType() const { return ElementType; }
2858
2859  ArraySizeModifier getSizeModifier() const {
2860    return ArraySizeModifier(ArrayTypeBits.SizeModifier);
2861  }
2862
2863  Qualifiers getIndexTypeQualifiers() const {
2864    return Qualifiers::fromCVRMask(getIndexTypeCVRQualifiers());
2865  }
2866
2867  unsigned getIndexTypeCVRQualifiers() const {
2868    return ArrayTypeBits.IndexTypeQuals;
2869  }
2870
2871  static bool classof(const Type *T) {
2872    return T->getTypeClass() == ConstantArray ||
2873           T->getTypeClass() == VariableArray ||
2874           T->getTypeClass() == IncompleteArray ||
2875           T->getTypeClass() == DependentSizedArray;
2876  }
2877};
2878
2879/// Represents the canonical version of C arrays with a specified constant size.
2880/// For example, the canonical type for 'int A[4 + 4*100]' is a
2881/// ConstantArrayType where the element type is 'int' and the size is 404.
2882class ConstantArrayType : public ArrayType {
2883  llvm::APInt Size// Allows us to unique the type.
2884
2885  ConstantArrayType(QualType etQualType canconst llvm::APInt &size,
2886                    ArraySizeModifier smunsigned tq)
2887      : ArrayType(ConstantArrayetcansmtq,
2888                  et->containsUnexpandedParameterPack()),
2889        Size(size) {}
2890
2891protected:
2892  friend class ASTContext// ASTContext creates these.
2893
2894  ConstantArrayType(TypeClass tcQualType etQualType can,
2895                    const llvm::APInt &sizeArraySizeModifier smunsigned tq)
2896      : ArrayType(tcetcansmtqet->containsUnexpandedParameterPack()),
2897        Size(size) {}
2898
2899public:
2900  const llvm::APInt &getSize() const { return Size; }
2901  bool isSugared() const { return false; }
2902  QualType desugar() const { return QualType(this0); }
2903
2904  /// Determine the number of bits required to address a member of
2905  // an array with the given element type and number of elements.
2906  static unsigned getNumAddressingBits(const ASTContext &Context,
2907                                       QualType ElementType,
2908                                       const llvm::APInt &NumElements);
2909
2910  /// Determine the maximum number of active bits that an array's size
2911  /// can require, which limits the maximum size of the array.
2912  static unsigned getMaxSizeBits(const ASTContext &Context);
2913
2914  void Profile(llvm::FoldingSetNodeID &ID) {
2915    Profile(ID, getElementType(), getSize(),
2916            getSizeModifier(), getIndexTypeCVRQualifiers());
2917  }
2918
2919  static void Profile(llvm::FoldingSetNodeID &IDQualType ET,
2920                      const llvm::APInt &ArraySizeArraySizeModifier SizeMod,
2921                      unsigned TypeQuals) {
2922    ID.AddPointer(ET.getAsOpaquePtr());
2923    ID.AddInteger(ArraySize.getZExtValue());
2924    ID.AddInteger(SizeMod);
2925    ID.AddInteger(TypeQuals);
2926  }
2927
2928  static bool classof(const Type *T) {
2929    return T->getTypeClass() == ConstantArray;
2930  }
2931};
2932
2933/// Represents a C array with an unspecified size.  For example 'int A[]' has
2934/// an IncompleteArrayType where the element type is 'int' and the size is
2935/// unspecified.
2936class IncompleteArrayType : public ArrayType {
2937  friend class ASTContext// ASTContext creates these.
2938
2939  IncompleteArrayType(QualType etQualType can,
2940                      ArraySizeModifier smunsigned tq)
2941      : ArrayType(IncompleteArrayetcansmtq,
2942                  et->containsUnexpandedParameterPack()) {}
2943
2944public:
2945  friend class StmtIteratorBase;
2946
2947  bool isSugared() const { return false; }
2948  QualType desugar() const { return QualType(this0); }
2949
2950  static bool classof(const Type *T) {
2951    return T->getTypeClass() == IncompleteArray;
2952  }
2953
2954  void Profile(llvm::FoldingSetNodeID &ID) {
2955    Profile(IDgetElementType(), getSizeModifier(),
2956            getIndexTypeCVRQualifiers());
2957  }
2958
2959  static void Profile(llvm::FoldingSetNodeID &IDQualType ET,
2960                      ArraySizeModifier SizeModunsigned TypeQuals) {
2961    ID.AddPointer(ET.getAsOpaquePtr());
2962    ID.AddInteger(SizeMod);
2963    ID.AddInteger(TypeQuals);
2964  }
2965};
2966
2967/// Represents a C array with a specified size that is not an
2968/// integer-constant-expression.  For example, 'int s[x+foo()]'.
2969/// Since the size expression is an arbitrary expression, we store it as such.
2970///
2971/// Note: VariableArrayType's aren't uniqued (since the expressions aren't) and
2972/// should not be: two lexically equivalent variable array types could mean
2973/// different things, for example, these variables do not have the same type
2974/// dynamically:
2975///
2976/// void foo(int x) {
2977///   int Y[x];
2978///   ++x;
2979///   int Z[x];
2980/// }
2981class VariableArrayType : public ArrayType {
2982  friend class ASTContext// ASTContext creates these.
2983
2984  /// An assignment-expression. VLA's are only permitted within
2985  /// a function block.
2986  Stmt *SizeExpr;
2987
2988  /// The range spanned by the left and right array brackets.
2989  SourceRange Brackets;
2990
2991  VariableArrayType(QualType etQualType canExpr *e,
2992                    ArraySizeModifier smunsigned tq,
2993                    SourceRange brackets)
2994      : ArrayType(VariableArrayetcansmtq,
2995                  et->containsUnexpandedParameterPack()),
2996        SizeExpr((Stmt*) e), Brackets(brackets) {}
2997
2998public:
2999  friend class StmtIteratorBase;
3000
3001  Expr *getSizeExpr() const {
3002    // We use C-style casts instead of cast<> here because we do not wish
3003    // to have a dependency of Type.h on Stmt.h/Expr.h.
3004    return (Expr*) SizeExpr;
3005  }
3006
3007  SourceRange getBracketsRange() const { return Brackets; }
3008  SourceLocation getLBracketLoc() const { return Brackets.getBegin(); }
3009  SourceLocation getRBracketLoc() const { return Brackets.getEnd(); }
3010
3011  bool isSugared() const { return false; }
3012  QualType desugar() const { return QualType(this0); }
3013
3014  static bool classof(const Type *T) {
3015    return T->getTypeClass() == VariableArray;
3016  }
3017
3018  void Profile(llvm::FoldingSetNodeID &ID) {
3019    llvm_unreachable("Cannot unique VariableArrayTypes.");
3020  }
3021};
3022
3023/// Represents an array type in C++ whose size is a value-dependent expression.
3024///
3025/// For example:
3026/// \code
3027/// template<typename T, int Size>
3028/// class array {
3029///   T data[Size];
3030/// };
3031/// \endcode
3032///
3033/// For these types, we won't actually know what the array bound is
3034/// until template instantiation occurs, at which point this will
3035/// become either a ConstantArrayType or a VariableArrayType.
3036class DependentSizedArrayType : public ArrayType {
3037  friend class ASTContext// ASTContext creates these.
3038
3039  const ASTContext &Context;
3040
3041  /// An assignment expression that will instantiate to the
3042  /// size of the array.
3043  ///
3044  /// The expression itself might be null, in which case the array
3045  /// type will have its size deduced from an initializer.
3046  Stmt *SizeExpr;
3047
3048  /// The range spanned by the left and right array brackets.
3049  SourceRange Brackets;
3050
3051  DependentSizedArrayType(const ASTContext &ContextQualType etQualType can,
3052                          Expr *eArraySizeModifier smunsigned tq,
3053                          SourceRange brackets);
3054
3055public:
3056  friend class StmtIteratorBase;
3057
3058  Expr *getSizeExpr() const {
3059    // We use C-style casts instead of cast<> here because we do not wish
3060    // to have a dependency of Type.h on Stmt.h/Expr.h.
3061    return (Expr*) SizeExpr;
3062  }
3063
3064  SourceRange getBracketsRange() const { return Brackets; }
3065  SourceLocation getLBracketLoc() const { return Brackets.getBegin(); }
3066  SourceLocation getRBracketLoc() const { return Brackets.getEnd(); }
3067
3068  bool isSugared() const { return false; }
3069  QualType desugar() const { return QualType(this0); }
3070
3071  static bool classof(const Type *T) {
3072    return T->getTypeClass() == DependentSizedArray;
3073  }
3074
3075  void Profile(llvm::FoldingSetNodeID &ID) {
3076    Profile(IDContextgetElementType(),
3077            getSizeModifier(), getIndexTypeCVRQualifiers(), getSizeExpr());
3078  }
3079
3080  static void Profile(llvm::FoldingSetNodeID &IDconst ASTContext &Context,
3081                      QualType ETArraySizeModifier SizeMod,
3082                      unsigned TypeQualsExpr *E);
3083};
3084
3085/// Represents an extended address space qualifier where the input address space
3086/// value is dependent. Non-dependent address spaces are not represented with a
3087/// special Type subclass; they are stored on an ExtQuals node as part of a QualType.
3088///
3089/// For example:
3090/// \code
3091/// template<typename T, int AddrSpace>
3092/// class AddressSpace {
3093///   typedef T __attribute__((address_space(AddrSpace))) type;
3094/// }
3095/// \endcode
3096class DependentAddressSpaceType : public Typepublic llvm::FoldingSetNode {
3097  friend class ASTContext;
3098
3099  const ASTContext &Context;
3100  Expr *AddrSpaceExpr;
3101  QualType PointeeType;
3102  SourceLocation loc;
3103
3104  DependentAddressSpaceType(const ASTContext &ContextQualType PointeeType,
3105                            QualType canExpr *AddrSpaceExpr,
3106                            SourceLocation loc);
3107
3108public:
3109  Expr *getAddrSpaceExpr() const { return AddrSpaceExpr; }
3110  QualType getPointeeType() const { return PointeeType; }
3111  SourceLocation getAttributeLoc() const { return loc; }
3112
3113  bool isSugared() const { return false; }
3114  QualType desugar() const { return QualType(this0); }
3115
3116  static bool classof(const Type *T) {
3117    return T->getTypeClass() == DependentAddressSpace;
3118  }
3119
3120  void Profile(llvm::FoldingSetNodeID &ID) {
3121    Profile(IDContextgetPointeeType(), getAddrSpaceExpr());
3122  }
3123
3124  static void Profile(llvm::FoldingSetNodeID &IDconst ASTContext &Context,
3125                      QualType PointeeTypeExpr *AddrSpaceExpr);
3126};
3127
3128/// Represents an extended vector type where either the type or size is
3129/// dependent.
3130///
3131/// For example:
3132/// \code
3133/// template<typename T, int Size>
3134/// class vector {
3135///   typedef T __attribute__((ext_vector_type(Size))) type;
3136/// }
3137/// \endcode
3138class DependentSizedExtVectorType : public Typepublic llvm::FoldingSetNode {
3139  friend class ASTContext;
3140
3141  const ASTContext &Context;
3142  Expr *SizeExpr;
3143
3144  /// The element type of the array.
3145  QualType ElementType;
3146
3147  SourceLocation loc;
3148
3149  DependentSizedExtVectorType(const ASTContext &ContextQualType ElementType,
3150                              QualType canExpr *SizeExprSourceLocation loc);
3151
3152public:
3153  Expr *getSizeExpr() const { return SizeExpr; }
3154  QualType getElementType() const { return ElementType; }
3155  SourceLocation getAttributeLoc() const { return loc; }
3156
3157  bool isSugared() const { return false; }
3158  QualType desugar() const { return QualType(this0); }
3159
3160  static bool classof(const Type *T) {
3161    return T->getTypeClass() == DependentSizedExtVector;
3162  }
3163
3164  void Profile(llvm::FoldingSetNodeID &ID) {
3165    Profile(IDContextgetElementType(), getSizeExpr());
3166  }
3167
3168  static void Profile(llvm::FoldingSetNodeID &IDconst ASTContext &Context,
3169                      QualType ElementTypeExpr *SizeExpr);
3170};
3171
3172
3173/// Represents a GCC generic vector type. This type is created using
3174/// __attribute__((vector_size(n)), where "n" specifies the vector size in
3175/// bytes; or from an Altivec __vector or vector declaration.
3176/// Since the constructor takes the number of vector elements, the
3177/// client is responsible for converting the size into the number of elements.
3178class VectorType : public Typepublic llvm::FoldingSetNode {
3179public:
3180  enum VectorKind {
3181    /// not a target-specific vector type
3182    GenericVector,
3183
3184    /// is AltiVec vector
3185    AltiVecVector,
3186
3187    /// is AltiVec 'vector Pixel'
3188    AltiVecPixel,
3189
3190    /// is AltiVec 'vector bool ...'
3191    AltiVecBool,
3192
3193    /// is ARM Neon vector
3194    NeonVector,
3195
3196    /// is ARM Neon polynomial vector
3197    NeonPolyVector
3198  };
3199
3200protected:
3201  friend class ASTContext// ASTContext creates these.
3202
3203  /// The element type of the vector.
3204  QualType ElementType;
3205
3206  VectorType(QualType vecTypeunsigned nElementsQualType canonType,
3207             VectorKind vecKind);
3208
3209  VectorType(TypeClass tcQualType vecTypeunsigned nElements,
3210             QualType canonTypeVectorKind vecKind);
3211
3212public:
3213  QualType getElementType() const { return ElementType; }
3214  unsigned getNumElements() const { return VectorTypeBits.NumElements; }
3215
3216  static bool isVectorSizeTooLarge(unsigned NumElements) {
3217    return NumElements > VectorTypeBitfields::MaxNumElements;
3218  }
3219
3220  bool isSugared() const { return false; }
3221  QualType desugar() const { return QualType(this0); }
3222
3223  VectorKind getVectorKind() const {
3224    return VectorKind(VectorTypeBits.VecKind);
3225  }
3226
3227  void Profile(llvm::FoldingSetNodeID &ID) {
3228    Profile(IDgetElementType(), getNumElements(),
3229            getTypeClass(), getVectorKind());
3230  }
3231
3232  static void Profile(llvm::FoldingSetNodeID &IDQualType ElementType,
3233                      unsigned NumElementsTypeClass TypeClass,
3234                      VectorKind VecKind) {
3235    ID.AddPointer(ElementType.getAsOpaquePtr());
3236    ID.AddInteger(NumElements);
3237    ID.AddInteger(TypeClass);
3238    ID.AddInteger(VecKind);
3239  }
3240
3241  static bool classof(const Type *T) {
3242    return T->getTypeClass() == Vector || T->getTypeClass() == ExtVector;
3243  }
3244};
3245
3246/// Represents a vector type where either the type or size is dependent.
3247////
3248/// For example:
3249/// \code
3250/// template<typename T, int Size>
3251/// class vector {
3252///   typedef T __attribute__((vector_size(Size))) type;
3253/// }
3254/// \endcode
3255class DependentVectorType : public Typepublic llvm::FoldingSetNode {
3256  friend class ASTContext;
3257
3258  const ASTContext &Context;
3259  QualType ElementType;
3260  Expr *SizeExpr;
3261  SourceLocation Loc;
3262
3263  DependentVectorType(const ASTContext &ContextQualType ElementType,
3264                           QualType CanonTypeExpr *SizeExpr,
3265                           SourceLocation LocVectorType::VectorKind vecKind);
3266
3267public:
3268  Expr *getSizeExpr() const { return SizeExpr; }
3269  QualType getElementType() const { return ElementType; }
3270  SourceLocation getAttributeLoc() const { return Loc; }
3271  VectorType::VectorKind getVectorKind() const {
3272    return VectorType::VectorKind(VectorTypeBits.VecKind);
3273  }
3274
3275  bool isSugared() const { return false; }
3276  QualType desugar() const { return QualType(this0); }
3277
3278  static bool classof(const Type *T) {
3279    return T->getTypeClass() == DependentVector;
3280  }
3281
3282  void Profile(llvm::FoldingSetNodeID &ID) {
3283    Profile(IDContextgetElementType(), getSizeExpr(), getVectorKind());
3284  }
3285
3286  static void Profile(llvm::FoldingSetNodeID &IDconst ASTContext &Context,
3287                      QualType ElementTypeconst Expr *SizeExpr,
3288                      VectorType::VectorKind VecKind);
3289};
3290
3291/// ExtVectorType - Extended vector type. This type is created using
3292/// __attribute__((ext_vector_type(n)), where "n" is the number of elements.
3293/// Unlike vector_size, ext_vector_type is only allowed on typedef's. This
3294/// class enables syntactic extensions, like Vector Components for accessing
3295/// points (as .xyzw), colors (as .rgba), and textures (modeled after OpenGL
3296/// Shading Language).
3297class ExtVectorType : public VectorType {
3298  friend class ASTContext// ASTContext creates these.
3299
3300  ExtVectorType(QualType vecTypeunsigned nElementsQualType canonType)
3301      : VectorType(ExtVectorvecTypenElementscanonTypeGenericVector) {}
3302
3303public:
3304  static int getPointAccessorIdx(char c) {
3305    switch (c) {
3306    defaultreturn -1;
3307    case 'x'case 'r'return 0;
3308    case 'y'case 'g'return 1;
3309    case 'z'case 'b'return 2;
3310    case 'w'case 'a'return 3;
3311    }
3312  }
3313
3314  static int getNumericAccessorIdx(char c) {
3315    switch (c) {
3316      defaultreturn -1;
3317      case '0'return 0;
3318      case '1'return 1;
3319      case '2'return 2;
3320      case '3'return 3;
3321      case '4'return 4;
3322      case '5'return 5;
3323      case '6'return 6;
3324      case '7'return 7;
3325      case '8'return 8;
3326      case '9'return 9;
3327      case 'A':
3328      case 'a'return 10;
3329      case 'B':
3330      case 'b'return 11;
3331      case 'C':
3332      case 'c'return 12;
3333      case 'D':
3334      case 'd'return 13;
3335      case 'E':
3336      case 'e'return 14;
3337      case 'F':
3338      case 'f'return 15;
3339    }
3340  }
3341
3342  static int getAccessorIdx(char cbool isNumericAccessor) {
3343    if (isNumericAccessor)
3344      return getNumericAccessorIdx(c);
3345    else
3346      return getPointAccessorIdx(c);
3347  }
3348
3349  bool isAccessorWithinNumElements(char cbool isNumericAccessorconst {
3350    if (int idx = getAccessorIdx(cisNumericAccessor)+1)
3351      return unsigned(idx-1) < getNumElements();
3352    return false;
3353  }
3354
3355  bool isSugared() const { return false; }
3356  QualType desugar() const { return QualType(this0); }
3357
3358  static bool classof(const Type *T) {
3359    return T->getTypeClass() == ExtVector;
3360  }
3361};
3362
3363/// FunctionType - C99 6.7.5.3 - Function Declarators.  This is the common base
3364/// class of FunctionNoProtoType and FunctionProtoType.
3365class FunctionType : public Type {
3366  // The type returned by the function.
3367  QualType ResultType;
3368
3369public:
3370  /// Interesting information about a specific parameter that can't simply
3371  /// be reflected in parameter's type. This is only used by FunctionProtoType
3372  /// but is in FunctionType to make this class available during the
3373  /// specification of the bases of FunctionProtoType.
3374  ///
3375  /// It makes sense to model language features this way when there's some
3376  /// sort of parameter-specific override (such as an attribute) that
3377  /// affects how the function is called.  For example, the ARC ns_consumed
3378  /// attribute changes whether a parameter is passed at +0 (the default)
3379  /// or +1 (ns_consumed).  This must be reflected in the function type,
3380  /// but isn't really a change to the parameter type.
3381  ///
3382  /// One serious disadvantage of modelling language features this way is
3383  /// that they generally do not work with language features that attempt
3384  /// to destructure types.  For example, template argument deduction will
3385  /// not be able to match a parameter declared as
3386  ///   T (*)(U)
3387  /// against an argument of type
3388  ///   void (*)(__attribute__((ns_consumed)) id)
3389  /// because the substitution of T=void, U=id into the former will
3390  /// not produce the latter.
3391  class ExtParameterInfo {
3392    enum {
3393      ABIMask = 0x0F,
3394      IsConsumed = 0x10,
3395      HasPassObjSize = 0x20,
3396      IsNoEscape = 0x40,
3397    };
3398    unsigned char Data = 0;
3399
3400  public:
3401    ExtParameterInfo() = default;
3402
3403    /// Return the ABI treatment of this parameter.
3404    ParameterABI getABI() const { return ParameterABI(Data & ABIMask); }
3405    ExtParameterInfo withABI(ParameterABI kindconst {
3406      ExtParameterInfo copy = *this;
3407      copy.Data = (copy.Data & ~ABIMask) | unsigned(kind);
3408      return copy;
3409    }
3410
3411    /// Is this parameter considered "consumed" by Objective-C ARC?
3412    /// Consumed parameters must have retainable object type.
3413    bool isConsumed() const { return (Data & IsConsumed); }
3414    ExtParameterInfo withIsConsumed(bool consumedconst {
3415      ExtParameterInfo copy = *this;
3416      if (consumed)
3417        copy.Data |= IsConsumed;
3418      else
3419        copy.Data &= ~IsConsumed;
3420      return copy;
3421    }
3422
3423    bool hasPassObjectSize() const { return Data & HasPassObjSize; }
3424    ExtParameterInfo withHasPassObjectSize() const {
3425      ExtParameterInfo Copy = *this;
3426      Copy.Data |= HasPassObjSize;
3427      return Copy;
3428    }
3429
3430    bool isNoEscape() const { return Data & IsNoEscape; }
3431    ExtParameterInfo withIsNoEscape(bool NoEscapeconst {
3432      ExtParameterInfo Copy = *this;
3433      if (NoEscape)
3434        Copy.Data |= IsNoEscape;
3435      else
3436        Copy.Data &= ~IsNoEscape;
3437      return Copy;
3438    }
3439
3440    unsigned char getOpaqueValue() const { return Data; }
3441    static ExtParameterInfo getFromOpaqueValue(unsigned char data) {
3442      ExtParameterInfo result;
3443      result.Data = data;
3444      return result;
3445    }
3446
3447    friend bool operator==(ExtParameterInfo lhsExtParameterInfo rhs) {
3448      return lhs.Data == rhs.Data;
3449    }
3450
3451    friend bool operator!=(ExtParameterInfo lhsExtParameterInfo rhs) {
3452      return lhs.Data != rhs.Data;
3453    }
3454  };
3455
3456  /// A class which abstracts out some details necessary for
3457  /// making a call.
3458  ///
3459  /// It is not actually used directly for storing this information in
3460  /// a FunctionType, although FunctionType does currently use the
3461  /// same bit-pattern.
3462  ///
3463  // If you add a field (say Foo), other than the obvious places (both,
3464  // constructors, compile failures), what you need to update is
3465  // * Operator==
3466  // * getFoo
3467  // * withFoo
3468  // * functionType. Add Foo, getFoo.
3469  // * ASTContext::getFooType
3470  // * ASTContext::mergeFunctionTypes
3471  // * FunctionNoProtoType::Profile
3472  // * FunctionProtoType::Profile
3473  // * TypePrinter::PrintFunctionProto
3474  // * AST read and write
3475  // * Codegen
3476  class ExtInfo {
3477    friend class FunctionType;
3478
3479    // Feel free to rearrange or add bits, but if you go over 12,
3480    // you'll need to adjust both the Bits field below and
3481    // Type::FunctionTypeBitfields.
3482
3483    //   |  CC  |noreturn|produces|nocallersavedregs|regparm|nocfcheck|
3484    //   |0 .. 4|   5    |    6   |       7         |8 .. 10|    11   |
3485    //
3486    // regparm is either 0 (no regparm attribute) or the regparm value+1.
3487    enum { CallConvMask = 0x1F };
3488    enum { NoReturnMask = 0x20 };
3489    enum { ProducesResultMask = 0x40 };
3490    enum { NoCallerSavedRegsMask = 0x80 };
3491    enum { NoCfCheckMask = 0x800 };
3492    enum {
3493      RegParmMask = ~(CallConvMask | NoReturnMask | ProducesResultMask |
3494                      NoCallerSavedRegsMask | NoCfCheckMask),
3495      RegParmOffset = 8
3496    }; // Assumed to be the last field
3497    uint16_t Bits = CC_C;
3498
3499    ExtInfo(unsigned Bits) : Bits(static_cast<uint16_t>(Bits)) {}
3500
3501   public:
3502     // Constructor with no defaults. Use this when you know that you
3503     // have all the elements (when reading an AST file for example).
3504     ExtInfo(bool noReturnbool hasRegParmunsigned regParmCallingConv cc,
3505             bool producesResultbool noCallerSavedRegsbool NoCfCheck) {
3506        (0) . __assert_fail ("(!hasRegParm || regParm < 7) && \"Invalid regparm value\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/Type.h", 3506, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert((!hasRegParm || regParm < 7) && "Invalid regparm value");
3507       Bits = ((unsigned)cc) | (noReturn ? NoReturnMask : 0) |
3508              (producesResult ? ProducesResultMask : 0) |
3509              (noCallerSavedRegs ? NoCallerSavedRegsMask : 0) |
3510              (hasRegParm ? ((regParm + 1) << RegParmOffset) : 0) |
3511              (NoCfCheck ? NoCfCheckMask : 0);
3512    }
3513
3514    // Constructor with all defaults. Use when for example creating a
3515    // function known to use defaults.
3516    ExtInfo() = default;
3517
3518    // Constructor with just the calling convention, which is an important part
3519    // of the canonical type.
3520    ExtInfo(CallingConv CC) : Bits(CC) {}
3521
3522    bool getNoReturn() const { return Bits & NoReturnMask; }
3523    bool getProducesResult() const { return Bits & ProducesResultMask; }
3524    bool getNoCallerSavedRegs() const { return Bits & NoCallerSavedRegsMask; }
3525    bool getNoCfCheck() const { return Bits & NoCfCheckMask; }
3526    bool getHasRegParm() const { return (Bits >> RegParmOffset) != 0; }
3527
3528    unsigned getRegParm() const {
3529      unsigned RegParm = (Bits & RegParmMask) >> RegParmOffset;
3530      if (RegParm > 0)
3531        --RegParm;
3532      return RegParm;
3533    }
3534
3535    CallingConv getCC() const { return CallingConv(Bits & CallConvMask); }
3536
3537    bool operator==(ExtInfo Otherconst {
3538      return Bits == Other.Bits;
3539    }
3540    bool operator!=(ExtInfo Otherconst {
3541      return Bits != Other.Bits;
3542    }
3543
3544    // Note that we don't have setters. That is by design, use
3545    // the following with methods instead of mutating these objects.
3546
3547    ExtInfo withNoReturn(bool noReturnconst {
3548      if (noReturn)
3549        return ExtInfo(Bits | NoReturnMask);
3550      else
3551        return ExtInfo(Bits & ~NoReturnMask);
3552    }
3553
3554    ExtInfo withProducesResult(bool producesResultconst {
3555      if (producesResult)
3556        return ExtInfo(Bits | ProducesResultMask);
3557      else
3558        return ExtInfo(Bits & ~ProducesResultMask);
3559    }
3560
3561    ExtInfo withNoCallerSavedRegs(bool noCallerSavedRegsconst {
3562      if (noCallerSavedRegs)
3563        return ExtInfo(Bits | NoCallerSavedRegsMask);
3564      else
3565        return ExtInfo(Bits & ~NoCallerSavedRegsMask);
3566    }
3567
3568    ExtInfo withNoCfCheck(bool noCfCheckconst {
3569      if (noCfCheck)
3570        return ExtInfo(Bits | NoCfCheckMask);
3571      else
3572        return ExtInfo(Bits & ~NoCfCheckMask);
3573    }
3574
3575    ExtInfo withRegParm(unsigned RegParmconst {
3576       (0) . __assert_fail ("RegParm < 7 && \"Invalid regparm value\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/Type.h", 3576, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert(RegParm < 7 && "Invalid regparm value");
3577      return ExtInfo((Bits & ~RegParmMask) |
3578                     ((RegParm + 1) << RegParmOffset));
3579    }
3580
3581    ExtInfo withCallingConv(CallingConv ccconst {
3582      return ExtInfo((Bits & ~CallConvMask) | (unsignedcc);
3583    }
3584
3585    void Profile(llvm::FoldingSetNodeID &IDconst {
3586      ID.AddInteger(Bits);
3587    }
3588  };
3589
3590  /// A simple holder for a QualType representing a type in an
3591  /// exception specification. Unfortunately needed by FunctionProtoType
3592  /// because TrailingObjects cannot handle repeated types.
3593  struct ExceptionType { QualType Type; };
3594
3595  /// A simple holder for various uncommon bits which do not fit in
3596  /// FunctionTypeBitfields. Aligned to alignof(void *) to maintain the
3597  /// alignment of subsequent objects in TrailingObjects. You must update
3598  /// hasExtraBitfields in FunctionProtoType after adding extra data here.
3599  struct alignas(void *) FunctionTypeExtraBitfields {
3600    /// The number of types in the exception specification.
3601    /// A whole unsigned is not needed here and according to
3602    /// [implimits] 8 bits would be enough here.
3603    unsigned NumExceptionType;
3604  };
3605
3606protected:
3607  FunctionType(TypeClass tcQualType res,
3608               QualType Canonicalbool Dependent,
3609               bool InstantiationDependent,
3610               bool VariablyModifiedbool ContainsUnexpandedParameterPack,
3611               ExtInfo Info)
3612      : Type(tcCanonicalDependentInstantiationDependentVariablyModified,
3613             ContainsUnexpandedParameterPack),
3614        ResultType(res) {
3615    FunctionTypeBits.ExtInfo = Info.Bits;
3616  }
3617
3618  Qualifiers getFastTypeQuals() const {
3619    return Qualifiers::fromFastMask(FunctionTypeBits.FastTypeQuals);
3620  }
3621
3622public:
3623  QualType getReturnType() const { return ResultType; }
3624
3625  bool getHasRegParm() const { return getExtInfo().getHasRegParm(); }
3626  unsigned getRegParmType() const { return getExtInfo().getRegParm(); }
3627
3628  /// Determine whether this function type includes the GNU noreturn
3629  /// attribute. The C++11 [[noreturn]] attribute does not affect the function
3630  /// type.
3631  bool getNoReturnAttr() const { return getExtInfo().getNoReturn(); }
3632
3633  CallingConv getCallConv() const { return getExtInfo().getCC(); }
3634  ExtInfo getExtInfo() const { return ExtInfo(FunctionTypeBits.ExtInfo); }
3635
3636  static_assert((~Qualifiers::FastMask & Qualifiers::CVRMask) == 0,
3637                "Const, volatile and restrict are assumed to be a subset of "
3638                "the fast qualifiers.");
3639
3640  bool isConst() const { return getFastTypeQuals().hasConst(); }
3641  bool isVolatile() const { return getFastTypeQuals().hasVolatile(); }
3642  bool isRestrict() const { return getFastTypeQuals().hasRestrict(); }
3643
3644  /// Determine the type of an expression that calls a function of
3645  /// this type.
3646  QualType getCallResultType(const ASTContext &Contextconst {
3647    return getReturnType().getNonLValueExprType(Context);
3648  }
3649
3650  static StringRef getNameForCallConv(CallingConv CC);
3651
3652  static bool classof(const Type *T) {
3653    return T->getTypeClass() == FunctionNoProto ||
3654           T->getTypeClass() == FunctionProto;
3655  }
3656};
3657
3658/// Represents a K&R-style 'int foo()' function, which has
3659/// no information available about its arguments.
3660class FunctionNoProtoType : public FunctionTypepublic llvm::FoldingSetNode {
3661  friend class ASTContext// ASTContext creates these.
3662
3663  FunctionNoProtoType(QualType ResultQualType CanonicalExtInfo Info)
3664      : FunctionType(FunctionNoProtoResultCanonical,
3665                     /*Dependent=*/false/*InstantiationDependent=*/false,
3666                     Result->isVariablyModifiedType(),
3667                     /*ContainsUnexpandedParameterPack=*/falseInfo) {}
3668
3669public:
3670  // No additional state past what FunctionType provides.
3671
3672  bool isSugared() const { return false; }
3673  QualType desugar() const { return QualType(this0); }
3674
3675  void Profile(llvm::FoldingSetNodeID &ID) {
3676    Profile(IDgetReturnType(), getExtInfo());
3677  }
3678
3679  static void Profile(llvm::FoldingSetNodeID &IDQualType ResultType,
3680                      ExtInfo Info) {
3681    Info.Profile(ID);
3682    ID.AddPointer(ResultType.getAsOpaquePtr());
3683  }
3684
3685  static bool classof(const Type *T) {
3686    return T->getTypeClass() == FunctionNoProto;
3687  }
3688};
3689
3690/// Represents a prototype with parameter type info, e.g.
3691/// 'int foo(int)' or 'int foo(void)'.  'void' is represented as having no
3692/// parameters, not as having a single void parameter. Such a type can have
3693/// an exception specification, but this specification is not part of the
3694/// canonical type. FunctionProtoType has several trailing objects, some of
3695/// which optional. For more information about the trailing objects see
3696/// the first comment inside FunctionProtoType.
3697class FunctionProtoType final
3698    : public FunctionType,
3699      public llvm::FoldingSetNode,
3700      private llvm::TrailingObjects<
3701          FunctionProtoType, QualType, FunctionType::FunctionTypeExtraBitfields,
3702          FunctionType::ExceptionType, Expr *, FunctionDecl *,
3703          FunctionType::ExtParameterInfo, Qualifiers> {
3704  friend class ASTContext// ASTContext creates these.
3705  friend TrailingObjects;
3706
3707  // FunctionProtoType is followed by several trailing objects, some of
3708  // which optional. They are in order:
3709  //
3710  // * An array of getNumParams() QualType holding the parameter types.
3711  //   Always present. Note that for the vast majority of FunctionProtoType,
3712  //   these will be the only trailing objects.
3713  //
3714  // * Optionally if some extra data is stored in FunctionTypeExtraBitfields
3715  //   (see FunctionTypeExtraBitfields and FunctionTypeBitfields):
3716  //   a single FunctionTypeExtraBitfields. Present if and only if
3717  //   hasExtraBitfields() is true.
3718  //
3719  // * Optionally exactly one of:
3720  //   * an array of getNumExceptions() ExceptionType,
3721  //   * a single Expr *,
3722  //   * a pair of FunctionDecl *,
3723  //   * a single FunctionDecl *
3724  //   used to store information about the various types of exception
3725  //   specification. See getExceptionSpecSize for the details.
3726  //
3727  // * Optionally an array of getNumParams() ExtParameterInfo holding
3728  //   an ExtParameterInfo for each of the parameters. Present if and
3729  //   only if hasExtParameterInfos() is true.
3730  //
3731  // * Optionally a Qualifiers object to represent extra qualifiers that can't
3732  //   be represented by FunctionTypeBitfields.FastTypeQuals. Present if and only
3733  //   if hasExtQualifiers() is true.
3734  //
3735  // The optional FunctionTypeExtraBitfields has to be before the data
3736  // related to the exception specification since it contains the number
3737  // of exception types.
3738  //
3739  // We put the ExtParameterInfos last.  If all were equal, it would make
3740  // more sense to put these before the exception specification, because
3741  // it's much easier to skip past them compared to the elaborate switch
3742  // required to skip the exception specification.  However, all is not
3743  // equal; ExtParameterInfos are used to model very uncommon features,
3744  // and it's better not to burden the more common paths.
3745
3746public:
3747  /// Holds information about the various types of exception specification.
3748  /// ExceptionSpecInfo is not stored as such in FunctionProtoType but is
3749  /// used to group together the various bits of information about the
3750  /// exception specification.
3751  struct ExceptionSpecInfo {
3752    /// The kind of exception specification this is.
3753    ExceptionSpecificationType Type = EST_None;
3754
3755    /// Explicitly-specified list of exception types.
3756    ArrayRef<QualTypeExceptions;
3757
3758    /// Noexcept expression, if this is a computed noexcept specification.
3759    Expr *NoexceptExpr = nullptr;
3760
3761    /// The function whose exception specification this is, for
3762    /// EST_Unevaluated and EST_Uninstantiated.
3763    FunctionDecl *SourceDecl = nullptr;
3764
3765    /// The function template whose exception specification this is instantiated
3766    /// from, for EST_Uninstantiated.
3767    FunctionDecl *SourceTemplate = nullptr;
3768
3769    ExceptionSpecInfo() = default;
3770
3771    ExceptionSpecInfo(ExceptionSpecificationType EST) : Type(EST) {}
3772  };
3773
3774  /// Extra information about a function prototype. ExtProtoInfo is not
3775  /// stored as such in FunctionProtoType but is used to group together
3776  /// the various bits of extra information about a function prototype.
3777  struct ExtProtoInfo {
3778    FunctionType::ExtInfo ExtInfo;
3779    bool Variadic : 1;
3780    bool HasTrailingReturn : 1;
3781    Qualifiers TypeQuals;
3782    RefQualifierKind RefQualifier = RQ_None;
3783    ExceptionSpecInfo ExceptionSpec;
3784    const ExtParameterInfo *ExtParameterInfos = nullptr;
3785
3786    ExtProtoInfo() : Variadic(false), HasTrailingReturn(false) {}
3787
3788    ExtProtoInfo(CallingConv CC)
3789        : ExtInfo(CC), Variadic(false), HasTrailingReturn(false) {}
3790
3791    ExtProtoInfo withExceptionSpec(const ExceptionSpecInfo &ESI) {
3792      ExtProtoInfo Result(*this);
3793      Result.ExceptionSpec = ESI;
3794      return Result;
3795    }
3796  };
3797
3798private:
3799  unsigned numTrailingObjects(OverloadToken<QualType>) const {
3800    return getNumParams();
3801  }
3802
3803  unsigned numTrailingObjects(OverloadToken<FunctionTypeExtraBitfields>) const {
3804    return hasExtraBitfields();
3805  }
3806
3807  unsigned numTrailingObjects(OverloadToken<ExceptionType>) const {
3808    return getExceptionSpecSize().NumExceptionType;
3809  }
3810
3811  unsigned numTrailingObjects(OverloadToken<Expr *>) const {
3812    return getExceptionSpecSize().NumExprPtr;
3813  }
3814
3815  unsigned numTrailingObjects(OverloadToken<FunctionDecl *>) const {
3816    return getExceptionSpecSize().NumFunctionDeclPtr;
3817  }
3818
3819  unsigned numTrailingObjects(OverloadToken<ExtParameterInfo>) const {
3820    return hasExtParameterInfos() ? getNumParams() : 0;
3821  }
3822
3823  /// Determine whether there are any argument types that
3824  /// contain an unexpanded parameter pack.
3825  static bool containsAnyUnexpandedParameterPack(const QualType *ArgArray,
3826                                                 unsigned numArgs) {
3827    for (unsigned Idx = 0Idx < numArgs; ++Idx)
3828      if (ArgArray[Idx]->containsUnexpandedParameterPack())
3829        return true;
3830
3831    return false;
3832  }
3833
3834  FunctionProtoType(QualType resultArrayRef<QualTypeparams,
3835                    QualType canonicalconst ExtProtoInfo &epi);
3836
3837  /// This struct is returned by getExceptionSpecSize and is used to
3838  /// translate an ExceptionSpecificationType to the number and kind
3839  /// of trailing objects related to the exception specification.
3840  struct ExceptionSpecSizeHolder {
3841    unsigned NumExceptionType;
3842    unsigned NumExprPtr;
3843    unsigned NumFunctionDeclPtr;
3844  };
3845
3846  /// Return the number and kind of trailing objects
3847  /// related to the exception specification.
3848  static ExceptionSpecSizeHolder
3849  getExceptionSpecSize(ExceptionSpecificationType ESTunsigned NumExceptions) {
3850    switch (EST) {
3851    case EST_None:
3852    case EST_DynamicNone:
3853    case EST_MSAny:
3854    case EST_BasicNoexcept:
3855    case EST_Unparsed:
3856      return {000};
3857
3858    case EST_Dynamic:
3859      return {NumExceptions00};
3860
3861    case EST_DependentNoexcept:
3862    case EST_NoexceptFalse:
3863    case EST_NoexceptTrue:
3864      return {010};
3865
3866    case EST_Uninstantiated:
3867      return {002};
3868
3869    case EST_Unevaluated:
3870      return {001};
3871    }
3872    llvm_unreachable("bad exception specification kind");
3873  }
3874
3875  /// Return the number and kind of trailing objects
3876  /// related to the exception specification.
3877  ExceptionSpecSizeHolder getExceptionSpecSize() const {
3878    return getExceptionSpecSize(getExceptionSpecType(), getNumExceptions());
3879  }
3880
3881  /// Whether the trailing FunctionTypeExtraBitfields is present.
3882  static bool hasExtraBitfields(ExceptionSpecificationType EST) {
3883    // If the exception spec type is EST_Dynamic then we have > 0 exception
3884    // types and the exact number is stored in FunctionTypeExtraBitfields.
3885    return EST == EST_Dynamic;
3886  }
3887
3888  /// Whether the trailing FunctionTypeExtraBitfields is present.
3889  bool hasExtraBitfields() const {
3890    return hasExtraBitfields(getExceptionSpecType());
3891  }
3892
3893  bool hasExtQualifiers() const {
3894    return FunctionTypeBits.HasExtQuals;
3895  }
3896
3897public:
3898  unsigned getNumParams() const { return FunctionTypeBits.NumParams; }
3899
3900  QualType getParamType(unsigned iconst {
3901     (0) . __assert_fail ("i < getNumParams() && \"invalid parameter index\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/Type.h", 3901, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert(i < getNumParams() && "invalid parameter index");
3902    return param_type_begin()[i];
3903  }
3904
3905  ArrayRef<QualTypegetParamTypes() const {
3906    return llvm::makeArrayRef(param_type_begin(), param_type_end());
3907  }
3908
3909  ExtProtoInfo getExtProtoInfo() const {
3910    ExtProtoInfo EPI;
3911    EPI.ExtInfo = getExtInfo();
3912    EPI.Variadic = isVariadic();
3913    EPI.HasTrailingReturn = hasTrailingReturn();
3914    EPI.ExceptionSpec.Type = getExceptionSpecType();
3915    EPI.TypeQuals = getMethodQuals();
3916    EPI.RefQualifier = getRefQualifier();
3917    if (EPI.ExceptionSpec.Type == EST_Dynamic) {
3918      EPI.ExceptionSpec.Exceptions = exceptions();
3919    } else if (isComputedNoexcept(EPI.ExceptionSpec.Type)) {
3920      EPI.ExceptionSpec.NoexceptExpr = getNoexceptExpr();
3921    } else if (EPI.ExceptionSpec.Type == EST_Uninstantiated) {
3922      EPI.ExceptionSpec.SourceDecl = getExceptionSpecDecl();
3923      EPI.ExceptionSpec.SourceTemplate = getExceptionSpecTemplate();
3924    } else if (EPI.ExceptionSpec.Type == EST_Unevaluated) {
3925      EPI.ExceptionSpec.SourceDecl = getExceptionSpecDecl();
3926    }
3927    EPI.ExtParameterInfos = getExtParameterInfosOrNull();
3928    return EPI;
3929  }
3930
3931  /// Get the kind of exception specification on this function.
3932  ExceptionSpecificationType getExceptionSpecType() const {
3933    return static_cast<ExceptionSpecificationType>(
3934        FunctionTypeBits.ExceptionSpecType);
3935  }
3936
3937  /// Return whether this function has any kind of exception spec.
3938  bool hasExceptionSpec() const { return getExceptionSpecType() != EST_None; }
3939
3940  /// Return whether this function has a dynamic (throw) exception spec.
3941  bool hasDynamicExceptionSpec() const {
3942    return isDynamicExceptionSpec(getExceptionSpecType());
3943  }
3944
3945  /// Return whether this function has a noexcept exception spec.
3946  bool hasNoexceptExceptionSpec() const {
3947    return isNoexceptExceptionSpec(getExceptionSpecType());
3948  }
3949
3950  /// Return whether this function has a dependent exception spec.
3951  bool hasDependentExceptionSpec() const;
3952
3953  /// Return whether this function has an instantiation-dependent exception
3954  /// spec.
3955  bool hasInstantiationDependentExceptionSpec() const;
3956
3957  /// Return the number of types in the exception specification.
3958  unsigned getNumExceptions() const {
3959    return getExceptionSpecType() == EST_Dynamic
3960               ? getTrailingObjects<FunctionTypeExtraBitfields>()
3961                     ->NumExceptionType
3962               : 0;
3963  }
3964
3965  /// Return the ith exception type, where 0 <= i < getNumExceptions().
3966  QualType getExceptionType(unsigned iconst {
3967     (0) . __assert_fail ("i < getNumExceptions() && \"Invalid exception number!\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/Type.h", 3967, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert(i < getNumExceptions() && "Invalid exception number!");
3968    return exception_begin()[i];
3969  }
3970
3971  /// Return the expression inside noexcept(expression), or a null pointer
3972  /// if there is none (because the exception spec is not of this form).
3973  Expr *getNoexceptExpr() const {
3974    if (!isComputedNoexcept(getExceptionSpecType()))
3975      return nullptr;
3976    return *getTrailingObjects<Expr *>();
3977  }
3978
3979  /// If this function type has an exception specification which hasn't
3980  /// been determined yet (either because it has not been evaluated or because
3981  /// it has not been instantiated), this is the function whose exception
3982  /// specification is represented by this type.
3983  FunctionDecl *getExceptionSpecDecl() const {
3984    if (getExceptionSpecType() != EST_Uninstantiated &&
3985        getExceptionSpecType() != EST_Unevaluated)
3986      return nullptr;
3987    return getTrailingObjects<FunctionDecl *>()[0];
3988  }
3989
3990  /// If this function type has an uninstantiated exception
3991  /// specification, this is the function whose exception specification
3992  /// should be instantiated to find the exception specification for
3993  /// this type.
3994  FunctionDecl *getExceptionSpecTemplate() const {
3995    if (getExceptionSpecType() != EST_Uninstantiated)
3996      return nullptr;
3997    return getTrailingObjects<FunctionDecl *>()[1];
3998  }
3999
4000  /// Determine whether this function type has a non-throwing exception
4001  /// specification.
4002  CanThrowResult canThrow() const;
4003
4004  /// Determine whether this function type has a non-throwing exception
4005  /// specification. If this depends on template arguments, returns
4006  /// \c ResultIfDependent.
4007  bool isNothrow(bool ResultIfDependent = falseconst {
4008    return ResultIfDependent ? canThrow() != CT_Can : canThrow() == CT_Cannot;
4009  }
4010
4011  /// Whether this function prototype is variadic.
4012  bool isVariadic() const { return FunctionTypeBits.Variadic; }
4013
4014  /// Determines whether this function prototype contains a
4015  /// parameter pack at the end.
4016  ///
4017  /// A function template whose last parameter is a parameter pack can be
4018  /// called with an arbitrary number of arguments, much like a variadic
4019  /// function.
4020  bool isTemplateVariadic() const;
4021
4022  /// Whether this function prototype has a trailing return type.
4023  bool hasTrailingReturn() const { return FunctionTypeBits.HasTrailingReturn; }
4024
4025  Qualifiers getMethodQuals() const {
4026    if (hasExtQualifiers())
4027      return *getTrailingObjects<Qualifiers>();
4028    else
4029      return getFastTypeQuals();
4030  }
4031
4032  /// Retrieve the ref-qualifier associated with this function type.
4033  RefQualifierKind getRefQualifier() const {
4034    return static_cast<RefQualifierKind>(FunctionTypeBits.RefQualifier);
4035  }
4036
4037  using param_type_iterator = const QualType *;
4038  using param_type_range = llvm::iterator_range<param_type_iterator>;
4039
4040  param_type_range param_types() const {
4041    return param_type_range(param_type_begin(), param_type_end());
4042  }
4043
4044  param_type_iterator param_type_begin() const {
4045    return getTrailingObjects<QualType>();
4046  }
4047
4048  param_type_iterator param_type_end() const {
4049    return param_type_begin() + getNumParams();
4050  }
4051
4052  using exception_iterator = const QualType *;
4053
4054  ArrayRef<QualTypeexceptions() const {
4055    return llvm::makeArrayRef(exception_begin(), exception_end());
4056  }
4057
4058  exception_iterator exception_begin() const {
4059    return reinterpret_cast<exception_iterator>(
4060        getTrailingObjects<ExceptionType>());
4061  }
4062
4063  exception_iterator exception_end() const {
4064    return exception_begin() + getNumExceptions();
4065  }
4066
4067  /// Is there any interesting extra information for any of the parameters
4068  /// of this function type?
4069  bool hasExtParameterInfos() const {
4070    return FunctionTypeBits.HasExtParameterInfos;
4071  }
4072
4073  ArrayRef<ExtParameterInfogetExtParameterInfos() const {
4074    assert(hasExtParameterInfos());
4075    return ArrayRef<ExtParameterInfo>(getTrailingObjects<ExtParameterInfo>(),
4076                                      getNumParams());
4077  }
4078
4079  /// Return a pointer to the beginning of the array of extra parameter
4080  /// information, if present, or else null if none of the parameters
4081  /// carry it.  This is equivalent to getExtProtoInfo().ExtParameterInfos.
4082  const ExtParameterInfo *getExtParameterInfosOrNull() const {
4083    if (!hasExtParameterInfos())
4084      return nullptr;
4085    return getTrailingObjects<ExtParameterInfo>();
4086  }
4087
4088  ExtParameterInfo getExtParameterInfo(unsigned Iconst {
4089     (0) . __assert_fail ("I < getNumParams() && \"parameter index out of range\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/Type.h", 4089, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert(I < getNumParams() && "parameter index out of range");
4090    if (hasExtParameterInfos())
4091      return getTrailingObjects<ExtParameterInfo>()[I];
4092    return ExtParameterInfo();
4093  }
4094
4095  ParameterABI getParameterABI(unsigned Iconst {
4096     (0) . __assert_fail ("I < getNumParams() && \"parameter index out of range\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/Type.h", 4096, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert(I < getNumParams() && "parameter index out of range");
4097    if (hasExtParameterInfos())
4098      return getTrailingObjects<ExtParameterInfo>()[I].getABI();
4099    return ParameterABI::Ordinary;
4100  }
4101
4102  bool isParamConsumed(unsigned Iconst {
4103     (0) . __assert_fail ("I < getNumParams() && \"parameter index out of range\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/Type.h", 4103, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert(I < getNumParams() && "parameter index out of range");
4104    if (hasExtParameterInfos())
4105      return getTrailingObjects<ExtParameterInfo>()[I].isConsumed();
4106    return false;
4107  }
4108
4109  bool isSugared() const { return false; }
4110  QualType desugar() const { return QualType(this0); }
4111
4112  void printExceptionSpecification(raw_ostream &OS,
4113                                   const PrintingPolicy &Policyconst;
4114
4115  static bool classof(const Type *T) {
4116    return T->getTypeClass() == FunctionProto;
4117  }
4118
4119  void Profile(llvm::FoldingSetNodeID &IDconst ASTContext &Ctx);
4120  static void Profile(llvm::FoldingSetNodeID &IDQualType Result,
4121                      param_type_iterator ArgTysunsigned NumArgs,
4122                      const ExtProtoInfo &EPIconst ASTContext &Context,
4123                      bool Canonical);
4124};
4125
4126/// Represents the dependent type named by a dependently-scoped
4127/// typename using declaration, e.g.
4128///   using typename Base<T>::foo;
4129///
4130/// Template instantiation turns these into the underlying type.
4131class UnresolvedUsingType : public Type {
4132  friend class ASTContext// ASTContext creates these.
4133
4134  UnresolvedUsingTypenameDecl *Decl;
4135
4136  UnresolvedUsingType(const UnresolvedUsingTypenameDecl *D)
4137      : Type(UnresolvedUsingQualType(), truetruefalse,
4138             /*ContainsUnexpandedParameterPack=*/false),
4139        Decl(const_cast<UnresolvedUsingTypenameDecl*>(D)) {}
4140
4141public:
4142  UnresolvedUsingTypenameDecl *getDecl() const { return Decl; }
4143
4144  bool isSugared() const { return false; }
4145  QualType desugar() const { return QualType(this0); }
4146
4147  static bool classof(const Type *T) {
4148    return T->getTypeClass() == UnresolvedUsing;
4149  }
4150
4151  void Profile(llvm::FoldingSetNodeID &ID) {
4152    return Profile(IDDecl);
4153  }
4154
4155  static void Profile(llvm::FoldingSetNodeID &ID,
4156                      UnresolvedUsingTypenameDecl *D) {
4157    ID.AddPointer(D);
4158  }
4159};
4160
4161class TypedefType : public Type {
4162  TypedefNameDecl *Decl;
4163
4164protected:
4165  friend class ASTContext// ASTContext creates these.
4166
4167  TypedefType(TypeClass tcconst TypedefNameDecl *DQualType can)
4168      : Type(tccancan->isDependentType(),
4169             can->isInstantiationDependentType(),
4170             can->isVariablyModifiedType(),
4171             /*ContainsUnexpandedParameterPack=*/false),
4172        Decl(const_cast<TypedefNameDecl*>(D)) {
4173     (0) . __assert_fail ("!isa(can) && \"Invalid canonical type\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/Type.h", 4173, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert(!isa<TypedefType>(can) && "Invalid canonical type");
4174  }
4175
4176public:
4177  TypedefNameDecl *getDecl() const { return Decl; }
4178
4179  bool isSugared() const { return true; }
4180  QualType desugar() const;
4181
4182  static bool classof(const Type *T) { return T->getTypeClass() == Typedef; }
4183};
4184
4185/// Represents a `typeof` (or __typeof__) expression (a GCC extension).
4186class TypeOfExprType : public Type {
4187  Expr *TOExpr;
4188
4189protected:
4190  friend class ASTContext// ASTContext creates these.
4191
4192  TypeOfExprType(Expr *EQualType can = QualType());
4193
4194public:
4195  Expr *getUnderlyingExpr() const { return TOExpr; }
4196
4197  /// Remove a single level of sugar.
4198  QualType desugar() const;
4199
4200  /// Returns whether this type directly provides sugar.
4201  bool isSugared() const;
4202
4203  static bool classof(const Type *T) { return T->getTypeClass() == TypeOfExpr; }
4204};
4205
4206/// Internal representation of canonical, dependent
4207/// `typeof(expr)` types.
4208///
4209/// This class is used internally by the ASTContext to manage
4210/// canonical, dependent types, only. Clients will only see instances
4211/// of this class via TypeOfExprType nodes.
4212class DependentTypeOfExprType
4213  : public TypeOfExprTypepublic llvm::FoldingSetNode {
4214  const ASTContext &Context;
4215
4216public:
4217  DependentTypeOfExprType(const ASTContext &ContextExpr *E)
4218      : TypeOfExprType(E), Context(Context) {}
4219
4220  void Profile(llvm::FoldingSetNodeID &ID) {
4221    Profile(IDContextgetUnderlyingExpr());
4222  }
4223
4224  static void Profile(llvm::FoldingSetNodeID &IDconst ASTContext &Context,
4225                      Expr *E);
4226};
4227
4228/// Represents `typeof(type)`, a GCC extension.
4229class TypeOfType : public Type {
4230  friend class ASTContext// ASTContext creates these.
4231
4232  QualType TOType;
4233
4234  TypeOfType(QualType TQualType can)
4235      : Type(TypeOfcanT->isDependentType(),
4236             T->isInstantiationDependentType(),
4237             T->isVariablyModifiedType(),
4238             T->containsUnexpandedParameterPack()),
4239        TOType(T) {
4240     (0) . __assert_fail ("!isa(can) && \"Invalid canonical type\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/Type.h", 4240, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert(!isa<TypedefType>(can) && "Invalid canonical type");
4241  }
4242
4243public:
4244  QualType getUnderlyingType() const { return TOType; }
4245
4246  /// Remove a single level of sugar.
4247  QualType desugar() const { return getUnderlyingType(); }
4248
4249  /// Returns whether this type directly provides sugar.
4250  bool isSugared() const { return true; }
4251
4252  static bool classof(const Type *T) { return T->getTypeClass() == TypeOf; }
4253};
4254
4255/// Represents the type `decltype(expr)` (C++11).
4256class DecltypeType : public Type {
4257  Expr *E;
4258  QualType UnderlyingType;
4259
4260protected:
4261  friend class ASTContext// ASTContext creates these.
4262
4263  DecltypeType(Expr *EQualType underlyingTypeQualType can = QualType());
4264
4265public:
4266  Expr *getUnderlyingExpr() const { return E; }
4267  QualType getUnderlyingType() const { return UnderlyingType; }
4268
4269  /// Remove a single level of sugar.
4270  QualType desugar() const;
4271
4272  /// Returns whether this type directly provides sugar.
4273  bool isSugared() const;
4274
4275  static bool classof(const Type *T) { return T->getTypeClass() == Decltype; }
4276};
4277
4278/// Internal representation of canonical, dependent
4279/// decltype(expr) types.
4280///
4281/// This class is used internally by the ASTContext to manage
4282/// canonical, dependent types, only. Clients will only see instances
4283/// of this class via DecltypeType nodes.
4284class DependentDecltypeType : public DecltypeTypepublic llvm::FoldingSetNode {
4285  const ASTContext &Context;
4286
4287public:
4288  DependentDecltypeType(const ASTContext &ContextExpr *E);
4289
4290  void Profile(llvm::FoldingSetNodeID &ID) {
4291    Profile(IDContextgetUnderlyingExpr());
4292  }
4293
4294  static void Profile(llvm::FoldingSetNodeID &IDconst ASTContext &Context,
4295                      Expr *E);
4296};
4297
4298/// A unary type transform, which is a type constructed from another.
4299class UnaryTransformType : public Type {
4300public:
4301  enum UTTKind {
4302    EnumUnderlyingType
4303  };
4304
4305private:
4306  /// The untransformed type.
4307  QualType BaseType;
4308
4309  /// The transformed type if not dependent, otherwise the same as BaseType.
4310  QualType UnderlyingType;
4311
4312  UTTKind UKind;
4313
4314protected:
4315  friend class ASTContext;
4316
4317  UnaryTransformType(QualType BaseTyQualType UnderlyingTyUTTKind UKind,
4318                     QualType CanonicalTy);
4319
4320public:
4321  bool isSugared() const { return !isDependentType(); }
4322  QualType desugar() const { return UnderlyingType; }
4323
4324  QualType getUnderlyingType() const { return UnderlyingType; }
4325  QualType getBaseType() const { return BaseType; }
4326
4327  UTTKind getUTTKind() const { return UKind; }
4328
4329  static bool classof(const Type *T) {
4330    return T->getTypeClass() == UnaryTransform;
4331  }
4332};
4333
4334/// Internal representation of canonical, dependent
4335/// __underlying_type(type) types.
4336///
4337/// This class is used internally by the ASTContext to manage
4338/// canonical, dependent types, only. Clients will only see instances
4339/// of this class via UnaryTransformType nodes.
4340class DependentUnaryTransformType : public UnaryTransformType,
4341                                    public llvm::FoldingSetNode {
4342public:
4343  DependentUnaryTransformType(const ASTContext &CQualType BaseType,
4344                              UTTKind UKind);
4345
4346  void Profile(llvm::FoldingSetNodeID &ID) {
4347    Profile(IDgetBaseType(), getUTTKind());
4348  }
4349
4350  static void Profile(llvm::FoldingSetNodeID &IDQualType BaseType,
4351                      UTTKind UKind) {
4352    ID.AddPointer(BaseType.getAsOpaquePtr());
4353    ID.AddInteger((unsigned)UKind);
4354  }
4355};
4356
4357class TagType : public Type {
4358  friend class ASTReader;
4359
4360  /// Stores the TagDecl associated with this type. The decl may point to any
4361  /// TagDecl that declares the entity.
4362  TagDecl *decl;
4363
4364protected:
4365  TagType(TypeClass TCconst TagDecl *DQualType can);
4366
4367public:
4368  TagDecl *getDecl() const;
4369
4370  /// Determines whether this type is in the process of being defined.
4371  bool isBeingDefined() const;
4372
4373  static bool classof(const Type *T) {
4374    return T->getTypeClass() >= TagFirst && T->getTypeClass() <= TagLast;
4375  }
4376};
4377
4378/// A helper class that allows the use of isa/cast/dyncast
4379/// to detect TagType objects of structs/unions/classes.
4380class RecordType : public TagType {
4381protected:
4382  friend class ASTContext// ASTContext creates these.
4383
4384  explicit RecordType(const RecordDecl *D)
4385      : TagType(Recordreinterpret_cast<const TagDecl*>(D), QualType()) {}
4386  explicit RecordType(TypeClass TCRecordDecl *D)
4387      : TagType(TCreinterpret_cast<const TagDecl*>(D), QualType()) {}
4388
4389public:
4390  RecordDecl *getDecl() const {
4391    return reinterpret_cast<RecordDecl*>(TagType::getDecl());
4392  }
4393
4394  /// Recursively check all fields in the record for const-ness. If any field
4395  /// is declared const, return true. Otherwise, return false.
4396  bool hasConstFields() const;
4397
4398  bool isSugared() const { return false; }
4399  QualType desugar() const { return QualType(this0); }
4400
4401  static bool classof(const Type *T) { return T->getTypeClass() == Record; }
4402};
4403
4404/// A helper class that allows the use of isa/cast/dyncast
4405/// to detect TagType objects of enums.
4406class EnumType : public TagType {
4407  friend class ASTContext// ASTContext creates these.
4408
4409  explicit EnumType(const EnumDecl *D)
4410      : TagType(Enumreinterpret_cast<const TagDecl*>(D), QualType()) {}
4411
4412public:
4413  EnumDecl *getDecl() const {
4414    return reinterpret_cast<EnumDecl*>(TagType::getDecl());
4415  }
4416
4417  bool isSugared() const { return false; }
4418  QualType desugar() const { return QualType(this0); }
4419
4420  static bool classof(const Type *T) { return T->getTypeClass() == Enum; }
4421};
4422
4423/// An attributed type is a type to which a type attribute has been applied.
4424///
4425/// The "modified type" is the fully-sugared type to which the attributed
4426/// type was applied; generally it is not canonically equivalent to the
4427/// attributed type. The "equivalent type" is the minimally-desugared type
4428/// which the type is canonically equivalent to.
4429///
4430/// For example, in the following attributed type:
4431///     int32_t __attribute__((vector_size(16)))
4432///   - the modified type is the TypedefType for int32_t
4433///   - the equivalent type is VectorType(16, int32_t)
4434///   - the canonical type is VectorType(16, int)
4435class AttributedType : public Typepublic llvm::FoldingSetNode {
4436public:
4437  using Kind = attr::Kind;
4438
4439private:
4440  friend class ASTContext// ASTContext creates these
4441
4442  QualType ModifiedType;
4443  QualType EquivalentType;
4444
4445  AttributedType(QualType canonattr::Kind attrKindQualType modified,
4446                 QualType equivalent)
4447      : Type(Attributedcanonequivalent->isDependentType(),
4448             equivalent->isInstantiationDependentType(),
4449             equivalent->isVariablyModifiedType(),
4450             equivalent->containsUnexpandedParameterPack()),
4451        ModifiedType(modified), EquivalentType(equivalent) {
4452    AttributedTypeBits.AttrKind = attrKind;
4453  }
4454
4455public:
4456  Kind getAttrKind() const {
4457    return static_cast<Kind>(AttributedTypeBits.AttrKind);
4458  }
4459
4460  QualType getModifiedType() const { return ModifiedType; }
4461  QualType getEquivalentType() const { return EquivalentType; }
4462
4463  bool isSugared() const { return true; }
4464  QualType desugar() const { return getEquivalentType(); }
4465
4466  /// Does this attribute behave like a type qualifier?
4467  ///
4468  /// A type qualifier adjusts a type to provide specialized rules for
4469  /// a specific object, like the standard const and volatile qualifiers.
4470  /// This includes attributes controlling things like nullability,
4471  /// address spaces, and ARC ownership.  The value of the object is still
4472  /// largely described by the modified type.
4473  ///
4474  /// In contrast, many type attributes "rewrite" their modified type to
4475  /// produce a fundamentally different type, not necessarily related in any
4476  /// formalizable way to the original type.  For example, calling convention
4477  /// and vector attributes are not simple type qualifiers.
4478  ///
4479  /// Type qualifiers are often, but not always, reflected in the canonical
4480  /// type.
4481  bool isQualifier() const;
4482
4483  bool isMSTypeSpec() const;
4484
4485  bool isCallingConv() const;
4486
4487  llvm::Optional<NullabilityKindgetImmediateNullability() const;
4488
4489  /// Retrieve the attribute kind corresponding to the given
4490  /// nullability kind.
4491  static Kind getNullabilityAttrKind(NullabilityKind kind) {
4492    switch (kind) {
4493    case NullabilityKind::NonNull:
4494      return attr::TypeNonNull;
4495
4496    case NullabilityKind::Nullable:
4497      return attr::TypeNullable;
4498
4499    case NullabilityKind::Unspecified:
4500      return attr::TypeNullUnspecified;
4501    }
4502    llvm_unreachable("Unknown nullability kind.");
4503  }
4504
4505  /// Strip off the top-level nullability annotation on the given
4506  /// type, if it's there.
4507  ///
4508  /// \param T The type to strip. If the type is exactly an
4509  /// AttributedType specifying nullability (without looking through
4510  /// type sugar), the nullability is returned and this type changed
4511  /// to the underlying modified type.
4512  ///
4513  /// \returns the top-level nullability, if present.
4514  static Optional<NullabilityKindstripOuterNullability(QualType &T);
4515
4516  void Profile(llvm::FoldingSetNodeID &ID) {
4517    Profile(IDgetAttrKind(), ModifiedTypeEquivalentType);
4518  }
4519
4520  static void Profile(llvm::FoldingSetNodeID &IDKind attrKind,
4521                      QualType modifiedQualType equivalent) {
4522    ID.AddInteger(attrKind);
4523    ID.AddPointer(modified.getAsOpaquePtr());
4524    ID.AddPointer(equivalent.getAsOpaquePtr());
4525  }
4526
4527  static bool classof(const Type *T) {
4528    return T->getTypeClass() == Attributed;
4529  }
4530};
4531
4532class TemplateTypeParmType : public Typepublic llvm::FoldingSetNode {
4533  friend class ASTContext// ASTContext creates these
4534
4535  // Helper data collector for canonical types.
4536  struct CanonicalTTPTInfo {
4537    unsigned Depth : 15;
4538    unsigned ParameterPack : 1;
4539    unsigned Index : 16;
4540  };
4541
4542  union {
4543    // Info for the canonical type.
4544    CanonicalTTPTInfo CanTTPTInfo;
4545
4546    // Info for the non-canonical type.
4547    TemplateTypeParmDecl *TTPDecl;
4548  };
4549
4550  /// Build a non-canonical type.
4551  TemplateTypeParmType(TemplateTypeParmDecl *TTPDeclQualType Canon)
4552      : Type(TemplateTypeParmCanon/*Dependent=*/true,
4553             /*InstantiationDependent=*/true,
4554             /*VariablyModified=*/false,
4555             Canon->containsUnexpandedParameterPack()),
4556        TTPDecl(TTPDecl) {}
4557
4558  /// Build the canonical type.
4559  TemplateTypeParmType(unsigned Dunsigned Ibool PP)
4560      : Type(TemplateTypeParmQualType(this0),
4561             /*Dependent=*/true,
4562             /*InstantiationDependent=*/true,
4563             /*VariablyModified=*/falsePP) {
4564    CanTTPTInfo.Depth = D;
4565    CanTTPTInfo.Index = I;
4566    CanTTPTInfo.ParameterPack = PP;
4567  }
4568
4569  const CanonicalTTPTInfogetCanTTPTInfo() const {
4570    QualType Can = getCanonicalTypeInternal();
4571    return Can->castAs<TemplateTypeParmType>()->CanTTPTInfo;
4572  }
4573
4574public:
4575  unsigned getDepth() const { return getCanTTPTInfo().Depth; }
4576  unsigned getIndex() const { return getCanTTPTInfo().Index; }
4577  bool isParameterPack() const { return getCanTTPTInfo().ParameterPack; }
4578
4579  TemplateTypeParmDecl *getDecl() const {
4580    return isCanonicalUnqualified() ? nullptr : TTPDecl;
4581  }
4582
4583  IdentifierInfo *getIdentifier() const;
4584
4585  bool isSugared() const { return false; }
4586  QualType desugar() const { return QualType(this0); }
4587
4588  void Profile(llvm::FoldingSetNodeID &ID) {
4589    Profile(IDgetDepth(), getIndex(), isParameterPack(), getDecl());
4590  }
4591
4592  static void Profile(llvm::FoldingSetNodeID &IDunsigned Depth,
4593                      unsigned Indexbool ParameterPack,
4594                      TemplateTypeParmDecl *TTPDecl) {
4595    ID.AddInteger(Depth);
4596    ID.AddInteger(Index);
4597    ID.AddBoolean(ParameterPack);
4598    ID.AddPointer(TTPDecl);
4599  }
4600
4601  static bool classof(const Type *T) {
4602    return T->getTypeClass() == TemplateTypeParm;
4603  }
4604};
4605
4606/// Represents the result of substituting a type for a template
4607/// type parameter.
4608///
4609/// Within an instantiated template, all template type parameters have
4610/// been replaced with these.  They are used solely to record that a
4611/// type was originally written as a template type parameter;
4612/// therefore they are never canonical.
4613class SubstTemplateTypeParmType : public Typepublic llvm::FoldingSetNode {
4614  friend class ASTContext;
4615
4616  // The original type parameter.
4617  const TemplateTypeParmType *Replaced;
4618
4619  SubstTemplateTypeParmType(const TemplateTypeParmType *ParamQualType Canon)
4620      : Type(SubstTemplateTypeParmCanonCanon->isDependentType(),
4621             Canon->isInstantiationDependentType(),
4622             Canon->isVariablyModifiedType(),
4623             Canon->containsUnexpandedParameterPack()),
4624        Replaced(Param) {}
4625
4626public:
4627  /// Gets the template parameter that was substituted for.
4628  const TemplateTypeParmType *getReplacedParameter() const {
4629    return Replaced;
4630  }
4631
4632  /// Gets the type that was substituted for the template
4633  /// parameter.
4634  QualType getReplacementType() const {
4635    return getCanonicalTypeInternal();
4636  }
4637
4638  bool isSugared() const { return true; }
4639  QualType desugar() const { return getReplacementType(); }
4640
4641  void Profile(llvm::FoldingSetNodeID &ID) {
4642    Profile(IDgetReplacedParameter(), getReplacementType());
4643  }
4644
4645  static void Profile(llvm::FoldingSetNodeID &ID,
4646                      const TemplateTypeParmType *Replaced,
4647                      QualType Replacement) {
4648    ID.AddPointer(Replaced);
4649    ID.AddPointer(Replacement.getAsOpaquePtr());
4650  }
4651
4652  static bool classof(const Type *T) {
4653    return T->getTypeClass() == SubstTemplateTypeParm;
4654  }
4655};
4656
4657/// Represents the result of substituting a set of types for a template
4658/// type parameter pack.
4659///
4660/// When a pack expansion in the source code contains multiple parameter packs
4661/// and those parameter packs correspond to different levels of template
4662/// parameter lists, this type node is used to represent a template type
4663/// parameter pack from an outer level, which has already had its argument pack
4664/// substituted but that still lives within a pack expansion that itself
4665/// could not be instantiated. When actually performing a substitution into
4666/// that pack expansion (e.g., when all template parameters have corresponding
4667/// arguments), this type will be replaced with the \c SubstTemplateTypeParmType
4668/// at the current pack substitution index.
4669class SubstTemplateTypeParmPackType : public Typepublic llvm::FoldingSetNode {
4670  friend class ASTContext;
4671
4672  /// The original type parameter.
4673  const TemplateTypeParmType *Replaced;
4674
4675  /// A pointer to the set of template arguments that this
4676  /// parameter pack is instantiated with.
4677  const TemplateArgument *Arguments;
4678
4679  SubstTemplateTypeParmPackType(const TemplateTypeParmType *Param,
4680                                QualType Canon,
4681                                const TemplateArgument &ArgPack);
4682
4683public:
4684  IdentifierInfo *getIdentifier() const { return Replaced->getIdentifier(); }
4685
4686  /// Gets the template parameter that was substituted for.
4687  const TemplateTypeParmType *getReplacedParameter() const {
4688    return Replaced;
4689  }
4690
4691  unsigned getNumArgs() const {
4692    return SubstTemplateTypeParmPackTypeBits.NumArgs;
4693  }
4694
4695  bool isSugared() const { return false; }
4696  QualType desugar() const { return QualType(this0); }
4697
4698  TemplateArgument getArgumentPack() const;
4699
4700  void Profile(llvm::FoldingSetNodeID &ID);
4701  static void Profile(llvm::FoldingSetNodeID &ID,
4702                      const TemplateTypeParmType *Replaced,
4703                      const TemplateArgument &ArgPack);
4704
4705  static bool classof(const Type *T) {
4706    return T->getTypeClass() == SubstTemplateTypeParmPack;
4707  }
4708};
4709
4710/// Common base class for placeholders for types that get replaced by
4711/// placeholder type deduction: C++11 auto, C++14 decltype(auto), C++17 deduced
4712/// class template types, and (eventually) constrained type names from the C++
4713/// Concepts TS.
4714///
4715/// These types are usually a placeholder for a deduced type. However, before
4716/// the initializer is attached, or (usually) if the initializer is
4717/// type-dependent, there is no deduced type and the type is canonical. In
4718/// the latter case, it is also a dependent type.
4719class DeducedType : public Type {
4720protected:
4721  DeducedType(TypeClass TCQualType DeducedAsTypebool IsDependent,
4722              bool IsInstantiationDependentbool ContainsParameterPack)
4723      : Type(TC,
4724             // FIXME: Retain the sugared deduced type?
4725             DeducedAsType.isNull() ? QualType(this0)
4726                                    : DeducedAsType.getCanonicalType(),
4727             IsDependentIsInstantiationDependent,
4728             /*VariablyModified=*/falseContainsParameterPack) {
4729    if (!DeducedAsType.isNull()) {
4730      if (DeducedAsType->isDependentType())
4731        setDependent();
4732      if (DeducedAsType->isInstantiationDependentType())
4733        setInstantiationDependent();
4734      if (DeducedAsType->containsUnexpandedParameterPack())
4735        setContainsUnexpandedParameterPack();
4736    }
4737  }
4738
4739public:
4740  bool isSugared() const { return !isCanonicalUnqualified(); }
4741  QualType desugar() const { return getCanonicalTypeInternal(); }
4742
4743  /// Get the type deduced for this placeholder type, or null if it's
4744  /// either not been deduced or was deduced to a dependent type.
4745  QualType getDeducedType() const {
4746    return !isCanonicalUnqualified() ? getCanonicalTypeInternal() : QualType();
4747  }
4748  bool isDeduced() const {
4749    return !isCanonicalUnqualified() || isDependentType();
4750  }
4751
4752  static bool classof(const Type *T) {
4753    return T->getTypeClass() == Auto ||
4754           T->getTypeClass() == DeducedTemplateSpecialization;
4755  }
4756};
4757
4758/// Represents a C++11 auto or C++14 decltype(auto) type.
4759class AutoType : public DeducedTypepublic llvm::FoldingSetNode {
4760  friend class ASTContext// ASTContext creates these
4761
4762  AutoType(QualType DeducedAsTypeAutoTypeKeyword Keyword,
4763           bool IsDeducedAsDependent)
4764      : DeducedType(AutoDeducedAsTypeIsDeducedAsDependent,
4765                    IsDeducedAsDependent/*ContainsPack=*/false) {
4766    AutoTypeBits.Keyword = (unsigned)Keyword;
4767  }
4768
4769public:
4770  bool isDecltypeAuto() const {
4771    return getKeyword() == AutoTypeKeyword::DecltypeAuto;
4772  }
4773
4774  AutoTypeKeyword getKeyword() const {
4775    return (AutoTypeKeyword)AutoTypeBits.Keyword;
4776  }
4777
4778  void Profile(llvm::FoldingSetNodeID &ID) {
4779    Profile(IDgetDeducedType(), getKeyword(), isDependentType());
4780  }
4781
4782  static void Profile(llvm::FoldingSetNodeID &IDQualType Deduced,
4783                      AutoTypeKeyword Keywordbool IsDependent) {
4784    ID.AddPointer(Deduced.getAsOpaquePtr());
4785    ID.AddInteger((unsigned)Keyword);
4786    ID.AddBoolean(IsDependent);
4787  }
4788
4789  static bool classof(const Type *T) {
4790    return T->getTypeClass() == Auto;
4791  }
4792};
4793
4794/// Represents a C++17 deduced template specialization type.
4795class DeducedTemplateSpecializationType : public DeducedType,
4796                                          public llvm::FoldingSetNode {
4797  friend class ASTContext// ASTContext creates these
4798
4799  /// The name of the template whose arguments will be deduced.
4800  TemplateName Template;
4801
4802  DeducedTemplateSpecializationType(TemplateName Template,
4803                                    QualType DeducedAsType,
4804                                    bool IsDeducedAsDependent)
4805      : DeducedType(DeducedTemplateSpecializationDeducedAsType,
4806                    IsDeducedAsDependent || Template.isDependent(),
4807                    IsDeducedAsDependent || Template.isInstantiationDependent(),
4808                    Template.containsUnexpandedParameterPack()),
4809        Template(Template) {}
4810
4811public:
4812  /// Retrieve the name of the template that we are deducing.
4813  TemplateName getTemplateName() const { return Template;}
4814
4815  void Profile(llvm::FoldingSetNodeID &ID) {
4816    Profile(IDgetTemplateName(), getDeducedType(), isDependentType());
4817  }
4818
4819  static void Profile(llvm::FoldingSetNodeID &IDTemplateName Template,
4820                      QualType Deducedbool IsDependent) {
4821    Template.Profile(ID);
4822    ID.AddPointer(Deduced.getAsOpaquePtr());
4823    ID.AddBoolean(IsDependent);
4824  }
4825
4826  static bool classof(const Type *T) {
4827    return T->getTypeClass() == DeducedTemplateSpecialization;
4828  }
4829};
4830
4831/// Represents a type template specialization; the template
4832/// must be a class template, a type alias template, or a template
4833/// template parameter.  A template which cannot be resolved to one of
4834/// these, e.g. because it is written with a dependent scope
4835/// specifier, is instead represented as a
4836/// @c DependentTemplateSpecializationType.
4837///
4838/// A non-dependent template specialization type is always "sugar",
4839/// typically for a \c RecordType.  For example, a class template
4840/// specialization type of \c vector<int> will refer to a tag type for
4841/// the instantiation \c std::vector<int, std::allocator<int>>
4842///
4843/// Template specializations are dependent if either the template or
4844/// any of the template arguments are dependent, in which case the
4845/// type may also be canonical.
4846///
4847/// Instances of this type are allocated with a trailing array of
4848/// TemplateArguments, followed by a QualType representing the
4849/// non-canonical aliased type when the template is a type alias
4850/// template.
4851class alignas(8TemplateSpecializationType
4852    : public Type,
4853      public llvm::FoldingSetNode {
4854  friend class ASTContext// ASTContext creates these
4855
4856  /// The name of the template being specialized.  This is
4857  /// either a TemplateName::Template (in which case it is a
4858  /// ClassTemplateDecl*, a TemplateTemplateParmDecl*, or a
4859  /// TypeAliasTemplateDecl*), a
4860  /// TemplateName::SubstTemplateTemplateParmPack, or a
4861  /// TemplateName::SubstTemplateTemplateParm (in which case the
4862  /// replacement must, recursively, be one of these).
4863  TemplateName Template;
4864
4865  TemplateSpecializationType(TemplateName T,
4866                             ArrayRef<TemplateArgumentArgs,
4867                             QualType Canon,
4868                             QualType Aliased);
4869
4870public:
4871  /// Determine whether any of the given template arguments are dependent.
4872  static bool anyDependentTemplateArguments(ArrayRef<TemplateArgumentLocArgs,
4873                                            bool &InstantiationDependent);
4874
4875  static bool anyDependentTemplateArguments(const TemplateArgumentListInfo &,
4876                                            bool &InstantiationDependent);
4877
4878  /// True if this template specialization type matches a current
4879  /// instantiation in the context in which it is found.
4880  bool isCurrentInstantiation() const {
4881    return isa<InjectedClassNameType>(getCanonicalTypeInternal());
4882  }
4883
4884  /// Determine if this template specialization type is for a type alias
4885  /// template that has been substituted.
4886  ///
4887  /// Nearly every template specialization type whose template is an alias
4888  /// template will be substituted. However, this is not the case when
4889  /// the specialization contains a pack expansion but the template alias
4890  /// does not have a corresponding parameter pack, e.g.,
4891  ///
4892  /// \code
4893  /// template<typename T, typename U, typename V> struct S;
4894  /// template<typename T, typename U> using A = S<T, int, U>;
4895  /// template<typename... Ts> struct X {
4896  ///   typedef A<Ts...> type; // not a type alias
4897  /// };
4898  /// \endcode
4899  bool isTypeAlias() const { return TemplateSpecializationTypeBits.TypeAlias; }
4900
4901  /// Get the aliased type, if this is a specialization of a type alias
4902  /// template.
4903  QualType getAliasedType() const {
4904     (0) . __assert_fail ("isTypeAlias() && \"not a type alias template specialization\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/Type.h", 4904, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert(isTypeAlias() && "not a type alias template specialization");
4905    return *reinterpret_cast<const QualType*>(end());
4906  }
4907
4908  using iterator = const TemplateArgument *;
4909
4910  iterator begin() const { return getArgs(); }
4911  iterator end() const// defined inline in TemplateBase.h
4912
4913  /// Retrieve the name of the template that we are specializing.
4914  TemplateName getTemplateName() const { return Template; }
4915
4916  /// Retrieve the template arguments.
4917  const TemplateArgument *getArgs() const {
4918    return reinterpret_cast<const TemplateArgument *>(this + 1);
4919  }
4920
4921  /// Retrieve the number of template arguments.
4922  unsigned getNumArgs() const {
4923    return TemplateSpecializationTypeBits.NumArgs;
4924  }
4925
4926  /// Retrieve a specific template argument as a type.
4927  /// \pre \c isArgType(Arg)
4928  const TemplateArgument &getArg(unsigned Idxconst// in TemplateBase.h
4929
4930  ArrayRef<TemplateArgumenttemplate_arguments() const {
4931    return {getArgs(), getNumArgs()};
4932  }
4933
4934  bool isSugared() const {
4935    return !isDependentType() || isCurrentInstantiation() || isTypeAlias();
4936  }
4937
4938  QualType desugar() const {
4939    return isTypeAlias() ? getAliasedType() : getCanonicalTypeInternal();
4940  }
4941
4942  void Profile(llvm::FoldingSetNodeID &IDconst ASTContext &Ctx) {
4943    Profile(ID, Template, template_arguments(), Ctx);
4944    if (isTypeAlias())
4945      getAliasedType().Profile(ID);
4946  }
4947
4948  static void Profile(llvm::FoldingSetNodeID &IDTemplateName T,
4949                      ArrayRef<TemplateArgumentArgs,
4950                      const ASTContext &Context);
4951
4952  static bool classof(const Type *T) {
4953    return T->getTypeClass() == TemplateSpecialization;
4954  }
4955};
4956
4957/// Print a template argument list, including the '<' and '>'
4958/// enclosing the template arguments.
4959void printTemplateArgumentList(raw_ostream &OS,
4960                               ArrayRef<TemplateArgumentArgs,
4961                               const PrintingPolicy &Policy);
4962
4963void printTemplateArgumentList(raw_ostream &OS,
4964                               ArrayRef<TemplateArgumentLocArgs,
4965                               const PrintingPolicy &Policy);
4966
4967void printTemplateArgumentList(raw_ostream &OS,
4968                               const TemplateArgumentListInfo &Args,
4969                               const PrintingPolicy &Policy);
4970
4971/// The injected class name of a C++ class template or class
4972/// template partial specialization.  Used to record that a type was
4973/// spelled with a bare identifier rather than as a template-id; the
4974/// equivalent for non-templated classes is just RecordType.
4975///
4976/// Injected class name types are always dependent.  Template
4977/// instantiation turns these into RecordTypes.
4978///
4979/// Injected class name types are always canonical.  This works
4980/// because it is impossible to compare an injected class name type
4981/// with the corresponding non-injected template type, for the same
4982/// reason that it is impossible to directly compare template
4983/// parameters from different dependent contexts: injected class name
4984/// types can only occur within the scope of a particular templated
4985/// declaration, and within that scope every template specialization
4986/// will canonicalize to the injected class name (when appropriate
4987/// according to the rules of the language).
4988class InjectedClassNameType : public Type {
4989  friend class ASTContext// ASTContext creates these.
4990  friend class ASTNodeImporter;
4991  friend class ASTReader// FIXME: ASTContext::getInjectedClassNameType is not
4992                          // currently suitable for AST reading, too much
4993                          // interdependencies.
4994
4995  CXXRecordDecl *Decl;
4996
4997  /// The template specialization which this type represents.
4998  /// For example, in
4999  ///   template <class T> class A { ... };
5000  /// this is A<T>, whereas in
5001  ///   template <class X, class Y> class A<B<X,Y> > { ... };
5002  /// this is A<B<X,Y> >.
5003  ///
5004  /// It is always unqualified, always a template specialization type,
5005  /// and always dependent.
5006  QualType InjectedType;
5007
5008  InjectedClassNameType(CXXRecordDecl *DQualType TST)
5009      : Type(InjectedClassNameQualType(), /*Dependent=*/true,
5010             /*InstantiationDependent=*/true,
5011             /*VariablyModified=*/false,
5012             /*ContainsUnexpandedParameterPack=*/false),
5013        Decl(D), InjectedType(TST) {
5014    (TST)", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/Type.h", 5014, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert(isa<TemplateSpecializationType>(TST));
5015    assert(!TST.hasQualifiers());
5016    isDependentType()", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/Type.h", 5016, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert(TST->isDependentType());
5017  }
5018
5019public:
5020  QualType getInjectedSpecializationType() const { return InjectedType; }
5021
5022  const TemplateSpecializationType *getInjectedTST() const {
5023    return cast<TemplateSpecializationType>(InjectedType.getTypePtr());
5024  }
5025
5026  TemplateName getTemplateName() const {
5027    return getInjectedTST()->getTemplateName();
5028  }
5029
5030  CXXRecordDecl *getDecl() const;
5031
5032  bool isSugared() const { return false; }
5033  QualType desugar() const { return QualType(this0); }
5034
5035  static bool classof(const Type *T) {
5036    return T->getTypeClass() == InjectedClassName;
5037  }
5038};
5039
5040/// The kind of a tag type.
5041enum TagTypeKind {
5042  /// The "struct" keyword.
5043  TTK_Struct,
5044
5045  /// The "__interface" keyword.
5046  TTK_Interface,
5047
5048  /// The "union" keyword.
5049  TTK_Union,
5050
5051  /// The "class" keyword.
5052  TTK_Class,
5053
5054  /// The "enum" keyword.
5055  TTK_Enum
5056};
5057
5058/// The elaboration keyword that precedes a qualified type name or
5059/// introduces an elaborated-type-specifier.
5060enum ElaboratedTypeKeyword {
5061  /// The "struct" keyword introduces the elaborated-type-specifier.
5062  ETK_Struct,
5063
5064  /// The "__interface" keyword introduces the elaborated-type-specifier.
5065  ETK_Interface,
5066
5067  /// The "union" keyword introduces the elaborated-type-specifier.
5068  ETK_Union,
5069
5070  /// The "class" keyword introduces the elaborated-type-specifier.
5071  ETK_Class,
5072
5073  /// The "enum" keyword introduces the elaborated-type-specifier.
5074  ETK_Enum,
5075
5076  /// The "typename" keyword precedes the qualified type name, e.g.,
5077  /// \c typename T::type.
5078  ETK_Typename,
5079
5080  /// No keyword precedes the qualified type name.
5081  ETK_None
5082};
5083
5084/// A helper class for Type nodes having an ElaboratedTypeKeyword.
5085/// The keyword in stored in the free bits of the base class.
5086/// Also provides a few static helpers for converting and printing
5087/// elaborated type keyword and tag type kind enumerations.
5088class TypeWithKeyword : public Type {
5089protected:
5090  TypeWithKeyword(ElaboratedTypeKeyword KeywordTypeClass tc,
5091                  QualType Canonicalbool Dependent,
5092                  bool InstantiationDependentbool VariablyModified,
5093                  bool ContainsUnexpandedParameterPack)
5094      : Type(tcCanonicalDependentInstantiationDependentVariablyModified,
5095             ContainsUnexpandedParameterPack) {
5096    TypeWithKeywordBits.Keyword = Keyword;
5097  }
5098
5099public:
5100  ElaboratedTypeKeyword getKeyword() const {
5101    return static_cast<ElaboratedTypeKeyword>(TypeWithKeywordBits.Keyword);
5102  }
5103
5104  /// Converts a type specifier (DeclSpec::TST) into an elaborated type keyword.
5105  static ElaboratedTypeKeyword getKeywordForTypeSpec(unsigned TypeSpec);
5106
5107  /// Converts a type specifier (DeclSpec::TST) into a tag type kind.
5108  /// It is an error to provide a type specifier which *isn't* a tag kind here.
5109  static TagTypeKind getTagTypeKindForTypeSpec(unsigned TypeSpec);
5110
5111  /// Converts a TagTypeKind into an elaborated type keyword.
5112  static ElaboratedTypeKeyword getKeywordForTagTypeKind(TagTypeKind Tag);
5113
5114  /// Converts an elaborated type keyword into a TagTypeKind.
5115  /// It is an error to provide an elaborated type keyword
5116  /// which *isn't* a tag kind here.
5117  static TagTypeKind getTagTypeKindForKeyword(ElaboratedTypeKeyword Keyword);
5118
5119  static bool KeywordIsTagTypeKind(ElaboratedTypeKeyword Keyword);
5120
5121  static StringRef getKeywordName(ElaboratedTypeKeyword Keyword);
5122
5123  static StringRef getTagTypeKindName(TagTypeKind Kind) {
5124    return getKeywordName(getKeywordForTagTypeKind(Kind));
5125  }
5126
5127  class CannotCastToThisType {};
5128  static CannotCastToThisType classof(const Type *);
5129};
5130
5131/// Represents a type that was referred to using an elaborated type
5132/// keyword, e.g., struct S, or via a qualified name, e.g., N::M::type,
5133/// or both.
5134///
5135/// This type is used to keep track of a type name as written in the
5136/// source code, including tag keywords and any nested-name-specifiers.
5137/// The type itself is always "sugar", used to express what was written
5138/// in the source code but containing no additional semantic information.
5139class ElaboratedType final
5140    : public TypeWithKeyword,
5141      public llvm::FoldingSetNode,
5142      private llvm::TrailingObjects<ElaboratedType, TagDecl *> {
5143  friend class ASTContext// ASTContext creates these
5144  friend TrailingObjects;
5145
5146  /// The nested name specifier containing the qualifier.
5147  NestedNameSpecifier *NNS;
5148
5149  /// The type that this qualified name refers to.
5150  QualType NamedType;
5151
5152  /// The (re)declaration of this tag type owned by this occurrence is stored
5153  /// as a trailing object if there is one. Use getOwnedTagDecl to obtain
5154  /// it, or obtain a null pointer if there is none.
5155
5156  ElaboratedType(ElaboratedTypeKeyword KeywordNestedNameSpecifier *NNS,
5157                 QualType NamedTypeQualType CanonTypeTagDecl *OwnedTagDecl)
5158      : TypeWithKeyword(KeywordElaboratedCanonType,
5159                        NamedType->isDependentType(),
5160                        NamedType->isInstantiationDependentType(),
5161                        NamedType->isVariablyModifiedType(),
5162                        NamedType->containsUnexpandedParameterPack()),
5163        NNS(NNS), NamedType(NamedType) {
5164    ElaboratedTypeBits.HasOwnedTagDecl = false;
5165    if (OwnedTagDecl) {
5166      ElaboratedTypeBits.HasOwnedTagDecl = true;
5167      *getTrailingObjects<TagDecl *>() = OwnedTagDecl;
5168    }
5169     (0) . __assert_fail ("!(Keyword == ETK_None && NNS == nullptr) && \"ElaboratedType cannot have elaborated type keyword \" \"and name qualifier both null.\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/Type.h", 5171, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert(!(Keyword == ETK_None && NNS == nullptr) &&
5170 (0) . __assert_fail ("!(Keyword == ETK_None && NNS == nullptr) && \"ElaboratedType cannot have elaborated type keyword \" \"and name qualifier both null.\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/Type.h", 5171, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">           "ElaboratedType cannot have elaborated type keyword "
5171 (0) . __assert_fail ("!(Keyword == ETK_None && NNS == nullptr) && \"ElaboratedType cannot have elaborated type keyword \" \"and name qualifier both null.\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/Type.h", 5171, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">           "and name qualifier both null.");
5172  }
5173
5174public:
5175  /// Retrieve the qualification on this type.
5176  NestedNameSpecifier *getQualifier() const { return NNS; }
5177
5178  /// Retrieve the type named by the qualified-id.
5179  QualType getNamedType() const { return NamedType; }
5180
5181  /// Remove a single level of sugar.
5182  QualType desugar() const { return getNamedType(); }
5183
5184  /// Returns whether this type directly provides sugar.
5185  bool isSugared() const { return true; }
5186
5187  /// Return the (re)declaration of this type owned by this occurrence of this
5188  /// type, or nullptr if there is none.
5189  TagDecl *getOwnedTagDecl() const {
5190    return ElaboratedTypeBits.HasOwnedTagDecl ? *getTrailingObjects<TagDecl *>()
5191                                              : nullptr;
5192  }
5193
5194  void Profile(llvm::FoldingSetNodeID &ID) {
5195    Profile(IDgetKeyword(), NNSNamedTypegetOwnedTagDecl());
5196  }
5197
5198  static void Profile(llvm::FoldingSetNodeID &IDElaboratedTypeKeyword Keyword,
5199                      NestedNameSpecifier *NNSQualType NamedType,
5200                      TagDecl *OwnedTagDecl) {
5201    ID.AddInteger(Keyword);
5202    ID.AddPointer(NNS);
5203    NamedType.Profile(ID);
5204    ID.AddPointer(OwnedTagDecl);
5205  }
5206
5207  static bool classof(const Type *T) { return T->getTypeClass() == Elaborated; }
5208};
5209
5210/// Represents a qualified type name for which the type name is
5211/// dependent.
5212///
5213/// DependentNameType represents a class of dependent types that involve a
5214/// possibly dependent nested-name-specifier (e.g., "T::") followed by a
5215/// name of a type. The DependentNameType may start with a "typename" (for a
5216/// typename-specifier), "class", "struct", "union", or "enum" (for a
5217/// dependent elaborated-type-specifier), or nothing (in contexts where we
5218/// know that we must be referring to a type, e.g., in a base class specifier).
5219/// Typically the nested-name-specifier is dependent, but in MSVC compatibility
5220/// mode, this type is used with non-dependent names to delay name lookup until
5221/// instantiation.
5222class DependentNameType : public TypeWithKeywordpublic llvm::FoldingSetNode {
5223  friend class ASTContext// ASTContext creates these
5224
5225  /// The nested name specifier containing the qualifier.
5226  NestedNameSpecifier *NNS;
5227
5228  /// The type that this typename specifier refers to.
5229  const IdentifierInfo *Name;
5230
5231  DependentNameType(ElaboratedTypeKeyword KeywordNestedNameSpecifier *NNS,
5232                    const IdentifierInfo *NameQualType CanonType)
5233      : TypeWithKeyword(KeywordDependentNameCanonType/*Dependent=*/true,
5234                        /*InstantiationDependent=*/true,
5235                        /*VariablyModified=*/false,
5236                        NNS->containsUnexpandedParameterPack()),
5237        NNS(NNS), Name(Name) {}
5238
5239public:
5240  /// Retrieve the qualification on this type.
5241  NestedNameSpecifier *getQualifier() const { return NNS; }
5242
5243  /// Retrieve the type named by the typename specifier as an identifier.
5244  ///
5245  /// This routine will return a non-NULL identifier pointer when the
5246  /// form of the original typename was terminated by an identifier,
5247  /// e.g., "typename T::type".
5248  const IdentifierInfo *getIdentifier() const {
5249    return Name;
5250  }
5251
5252  bool isSugared() const { return false; }
5253  QualType desugar() const { return QualType(this0); }
5254
5255  void Profile(llvm::FoldingSetNodeID &ID) {
5256    Profile(IDgetKeyword(), NNSName);
5257  }
5258
5259  static void Profile(llvm::FoldingSetNodeID &IDElaboratedTypeKeyword Keyword,
5260                      NestedNameSpecifier *NNSconst IdentifierInfo *Name) {
5261    ID.AddInteger(Keyword);
5262    ID.AddPointer(NNS);
5263    ID.AddPointer(Name);
5264  }
5265
5266  static bool classof(const Type *T) {
5267    return T->getTypeClass() == DependentName;
5268  }
5269};
5270
5271/// Represents a template specialization type whose template cannot be
5272/// resolved, e.g.
5273///   A<T>::template B<T>
5274class alignas(8DependentTemplateSpecializationType
5275    : public TypeWithKeyword,
5276      public llvm::FoldingSetNode {
5277  friend class ASTContext// ASTContext creates these
5278
5279  /// The nested name specifier containing the qualifier.
5280  NestedNameSpecifier *NNS;
5281
5282  /// The identifier of the template.
5283  const IdentifierInfo *Name;
5284
5285  DependentTemplateSpecializationType(ElaboratedTypeKeyword Keyword,
5286                                      NestedNameSpecifier *NNS,
5287                                      const IdentifierInfo *Name,
5288                                      ArrayRef<TemplateArgumentArgs,
5289                                      QualType Canon);
5290
5291  const TemplateArgument *getArgBuffer() const {
5292    return reinterpret_cast<const TemplateArgument*>(this+1);
5293  }
5294
5295  TemplateArgument *getArgBuffer() {
5296    return reinterpret_cast<TemplateArgument*>(this+1);
5297  }
5298
5299public:
5300  NestedNameSpecifier *getQualifier() const { return NNS; }
5301  const IdentifierInfo *getIdentifier() const { return Name; }
5302
5303  /// Retrieve the template arguments.
5304  const TemplateArgument *getArgs() const {
5305    return getArgBuffer();
5306  }
5307
5308  /// Retrieve the number of template arguments.
5309  unsigned getNumArgs() const {
5310    return DependentTemplateSpecializationTypeBits.NumArgs;
5311  }
5312
5313  const TemplateArgument &getArg(unsigned Idxconst// in TemplateBase.h
5314
5315  ArrayRef<TemplateArgumenttemplate_arguments() const {
5316    return {getArgs(), getNumArgs()};
5317  }
5318
5319  using iterator = const TemplateArgument *;
5320
5321  iterator begin() const { return getArgs(); }
5322  iterator end() const// inline in TemplateBase.h
5323
5324  bool isSugared() const { return false; }
5325  QualType desugar() const { return QualType(this0); }
5326
5327  void Profile(llvm::FoldingSetNodeID &IDconst ASTContext &Context) {
5328    Profile(IDContextgetKeyword(), NNSName, {getArgs(), getNumArgs()});
5329  }
5330
5331  static void Profile(llvm::FoldingSetNodeID &ID,
5332                      const ASTContext &Context,
5333                      ElaboratedTypeKeyword Keyword,
5334                      NestedNameSpecifier *Qualifier,
5335                      const IdentifierInfo *Name,
5336                      ArrayRef<TemplateArgumentArgs);
5337
5338  static bool classof(const Type *T) {
5339    return T->getTypeClass() == DependentTemplateSpecialization;
5340  }
5341};
5342
5343/// Represents a pack expansion of types.
5344///
5345/// Pack expansions are part of C++11 variadic templates. A pack
5346/// expansion contains a pattern, which itself contains one or more
5347/// "unexpanded" parameter packs. When instantiated, a pack expansion
5348/// produces a series of types, each instantiated from the pattern of
5349/// the expansion, where the Ith instantiation of the pattern uses the
5350/// Ith arguments bound to each of the unexpanded parameter packs. The
5351/// pack expansion is considered to "expand" these unexpanded
5352/// parameter packs.
5353///
5354/// \code
5355/// template<typename ...Types> struct tuple;
5356///
5357/// template<typename ...Types>
5358/// struct tuple_of_references {
5359///   typedef tuple<Types&...> type;
5360/// };
5361/// \endcode
5362///
5363/// Here, the pack expansion \c Types&... is represented via a
5364/// PackExpansionType whose pattern is Types&.
5365class PackExpansionType : public Typepublic llvm::FoldingSetNode {
5366  friend class ASTContext// ASTContext creates these
5367
5368  /// The pattern of the pack expansion.
5369  QualType Pattern;
5370
5371  PackExpansionType(QualType PatternQualType Canon,
5372                    Optional<unsignedNumExpansions)
5373      : Type(PackExpansionCanon/*Dependent=*/Pattern->isDependentType(),
5374             /*InstantiationDependent=*/true,
5375             /*VariablyModified=*/Pattern->isVariablyModifiedType(),
5376             /*ContainsUnexpandedParameterPack=*/false),
5377        Pattern(Pattern) {
5378    PackExpansionTypeBits.NumExpansions =
5379        NumExpansions ? *NumExpansions + 1 : 0;
5380  }
5381
5382public:
5383  /// Retrieve the pattern of this pack expansion, which is the
5384  /// type that will be repeatedly instantiated when instantiating the
5385  /// pack expansion itself.
5386  QualType getPattern() const { return Pattern; }
5387
5388  /// Retrieve the number of expansions that this pack expansion will
5389  /// generate, if known.
5390  Optional<unsignedgetNumExpansions() const {
5391    if (PackExpansionTypeBits.NumExpansions)
5392      return PackExpansionTypeBits.NumExpansions - 1;
5393    return None;
5394  }
5395
5396  bool isSugared() const { return !Pattern->isDependentType(); }
5397  QualType desugar() const { return isSugared() ? Pattern : QualType(this0); }
5398
5399  void Profile(llvm::FoldingSetNodeID &ID) {
5400    Profile(ID, getPattern(), getNumExpansions());
5401  }
5402
5403  static void Profile(llvm::FoldingSetNodeID &IDQualType Pattern,
5404                      Optional<unsignedNumExpansions) {
5405    ID.AddPointer(Pattern.getAsOpaquePtr());
5406    ID.AddBoolean(NumExpansions.hasValue());
5407    if (NumExpansions)
5408      ID.AddInteger(*NumExpansions);
5409  }
5410
5411  static bool classof(const Type *T) {
5412    return T->getTypeClass() == PackExpansion;
5413  }
5414};
5415
5416/// This class wraps the list of protocol qualifiers. For types that can
5417/// take ObjC protocol qualifers, they can subclass this class.
5418template <class T>
5419class ObjCProtocolQualifiers {
5420protected:
5421  ObjCProtocolQualifiers() = default;
5422
5423  ObjCProtocolDecl * const *getProtocolStorage() const {
5424    return const_cast<ObjCProtocolQualifiers*>(this)->getProtocolStorage();
5425  }
5426
5427  ObjCProtocolDecl **getProtocolStorage() {
5428    return static_cast<T*>(this)->getProtocolStorageImpl();
5429  }
5430
5431  void setNumProtocols(unsigned N) {
5432    static_cast<T*>(this)->setNumProtocolsImpl(N);
5433  }
5434
5435  void initialize(ArrayRef<ObjCProtocolDecl *> protocols) {
5436    setNumProtocols(protocols.size());
5437     (0) . __assert_fail ("getNumProtocols() == protocols.size() && \"bitfield overflow in protocol count\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/Type.h", 5438, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert(getNumProtocols() == protocols.size() &&
5438 (0) . __assert_fail ("getNumProtocols() == protocols.size() && \"bitfield overflow in protocol count\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/Type.h", 5438, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">           "bitfield overflow in protocol count");
5439    if (!protocols.empty())
5440      memcpy(getProtocolStorage(), protocols.data(),
5441             protocols.size() * sizeof(ObjCProtocolDecl*));
5442  }
5443
5444public:
5445  using qual_iterator = ObjCProtocolDecl * const *;
5446  using qual_range = llvm::iterator_range<qual_iterator>;
5447
5448  qual_range quals() const { return qual_range(qual_begin(), qual_end()); }
5449  qual_iterator qual_begin() const { return getProtocolStorage(); }
5450  qual_iterator qual_end() const { return qual_begin() + getNumProtocols(); }
5451
5452  bool qual_empty() const { return getNumProtocols() == 0; }
5453
5454  /// Return the number of qualifying protocols in this type, or 0 if
5455  /// there are none.
5456  unsigned getNumProtocols() const {
5457    return static_cast<const T*>(this)->getNumProtocolsImpl();
5458  }
5459
5460  /// Fetch a protocol by index.
5461  ObjCProtocolDecl *getProtocol(unsigned Iconst {
5462     (0) . __assert_fail ("I < getNumProtocols() && \"Out-of-range protocol access\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/Type.h", 5462, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert(I < getNumProtocols() && "Out-of-range protocol access");
5463    return qual_begin()[I];
5464  }
5465
5466  /// Retrieve all of the protocol qualifiers.
5467  ArrayRef<ObjCProtocolDecl *> getProtocols() const {
5468    return ArrayRef<ObjCProtocolDecl *>(qual_begin(), getNumProtocols());
5469  }
5470};
5471
5472/// Represents a type parameter type in Objective C. It can take
5473/// a list of protocols.
5474class ObjCTypeParamType : public Type,
5475                          public ObjCProtocolQualifiers<ObjCTypeParamType>,
5476                          public llvm::FoldingSetNode {
5477  friend class ASTContext;
5478  friend class ObjCProtocolQualifiers<ObjCTypeParamType>;
5479
5480  /// The number of protocols stored on this type.
5481  unsigned NumProtocols : 6;
5482
5483  ObjCTypeParamDecl *OTPDecl;
5484
5485  /// The protocols are stored after the ObjCTypeParamType node. In the
5486  /// canonical type, the list of protocols are sorted alphabetically
5487  /// and uniqued.
5488  ObjCProtocolDecl **getProtocolStorageImpl();
5489
5490  /// Return the number of qualifying protocols in this interface type,
5491  /// or 0 if there are none.
5492  unsigned getNumProtocolsImpl() const {
5493    return NumProtocols;
5494  }
5495
5496  void setNumProtocolsImpl(unsigned N) {
5497    NumProtocols = N;
5498  }
5499
5500  ObjCTypeParamType(const ObjCTypeParamDecl *D,
5501                    QualType can,
5502                    ArrayRef<ObjCProtocolDecl *> protocols);
5503
5504public:
5505  bool isSugared() const { return true; }
5506  QualType desugar() const { return getCanonicalTypeInternal(); }
5507
5508  static bool classof(const Type *T) {
5509    return T->getTypeClass() == ObjCTypeParam;
5510  }
5511
5512  void Profile(llvm::FoldingSetNodeID &ID);
5513  static void Profile(llvm::FoldingSetNodeID &ID,
5514                      const ObjCTypeParamDecl *OTPDecl,
5515                      ArrayRef<ObjCProtocolDecl *> protocols);
5516
5517  ObjCTypeParamDecl *getDecl() const { return OTPDecl; }
5518};
5519
5520/// Represents a class type in Objective C.
5521///
5522/// Every Objective C type is a combination of a base type, a set of
5523/// type arguments (optional, for parameterized classes) and a list of
5524/// protocols.
5525///
5526/// Given the following declarations:
5527/// \code
5528///   \@class C<T>;
5529///   \@protocol P;
5530/// \endcode
5531///
5532/// 'C' is an ObjCInterfaceType C.  It is sugar for an ObjCObjectType
5533/// with base C and no protocols.
5534///
5535/// 'C<P>' is an unspecialized ObjCObjectType with base C and protocol list [P].
5536/// 'C<C*>' is a specialized ObjCObjectType with type arguments 'C*' and no
5537/// protocol list.
5538/// 'C<C*><P>' is a specialized ObjCObjectType with base C, type arguments 'C*',
5539/// and protocol list [P].
5540///
5541/// 'id' is a TypedefType which is sugar for an ObjCObjectPointerType whose
5542/// pointee is an ObjCObjectType with base BuiltinType::ObjCIdType
5543/// and no protocols.
5544///
5545/// 'id<P>' is an ObjCObjectPointerType whose pointee is an ObjCObjectType
5546/// with base BuiltinType::ObjCIdType and protocol list [P].  Eventually
5547/// this should get its own sugar class to better represent the source.
5548class ObjCObjectType : public Type,
5549                       public ObjCProtocolQualifiers<ObjCObjectType> {
5550  friend class ObjCProtocolQualifiers<ObjCObjectType>;
5551
5552  // ObjCObjectType.NumTypeArgs - the number of type arguments stored
5553  // after the ObjCObjectPointerType node.
5554  // ObjCObjectType.NumProtocols - the number of protocols stored
5555  // after the type arguments of ObjCObjectPointerType node.
5556  //
5557  // These protocols are those written directly on the type.  If
5558  // protocol qualifiers ever become additive, the iterators will need
5559  // to get kindof complicated.
5560  //
5561  // In the canonical object type, these are sorted alphabetically
5562  // and uniqued.
5563
5564  /// Either a BuiltinType or an InterfaceType or sugar for either.
5565  QualType BaseType;
5566
5567  /// Cached superclass type.
5568  mutable llvm::PointerIntPair<const ObjCObjectType *, 1bool>
5569    CachedSuperClassType;
5570
5571  QualType *getTypeArgStorage();
5572  const QualType *getTypeArgStorage() const {
5573    return const_cast<ObjCObjectType *>(this)->getTypeArgStorage();
5574  }
5575
5576  ObjCProtocolDecl **getProtocolStorageImpl();
5577  /// Return the number of qualifying protocols in this interface type,
5578  /// or 0 if there are none.
5579  unsigned getNumProtocolsImpl() const {
5580    return ObjCObjectTypeBits.NumProtocols;
5581  }
5582  void setNumProtocolsImpl(unsigned N) {
5583    ObjCObjectTypeBits.NumProtocols = N;
5584  }
5585
5586protected:
5587  enum Nonce_ObjCInterface { Nonce_ObjCInterface };
5588
5589  ObjCObjectType(QualType CanonicalQualType Base,
5590                 ArrayRef<QualTypetypeArgs,
5591                 ArrayRef<ObjCProtocolDecl *> protocols,
5592                 bool isKindOf);
5593
5594  ObjCObjectType(enum Nonce_ObjCInterface)
5595        : Type(ObjCInterfaceQualType(), falsefalsefalsefalse),
5596          BaseType(QualType(this_(), 0)) {
5597    ObjCObjectTypeBits.NumProtocols = 0;
5598    ObjCObjectTypeBits.NumTypeArgs = 0;
5599    ObjCObjectTypeBits.IsKindOf = 0;
5600  }
5601
5602  void computeSuperClassTypeSlow() const;
5603
5604public:
5605  /// Gets the base type of this object type.  This is always (possibly
5606  /// sugar for) one of:
5607  ///  - the 'id' builtin type (as opposed to the 'id' type visible to the
5608  ///    user, which is a typedef for an ObjCObjectPointerType)
5609  ///  - the 'Class' builtin type (same caveat)
5610  ///  - an ObjCObjectType (currently always an ObjCInterfaceType)
5611  QualType getBaseType() const { return BaseType; }
5612
5613  bool isObjCId() const {
5614    return getBaseType()->isSpecificBuiltinType(BuiltinType::ObjCId);
5615  }
5616
5617  bool isObjCClass() const {
5618    return getBaseType()->isSpecificBuiltinType(BuiltinType::ObjCClass);
5619  }
5620
5621  bool isObjCUnqualifiedId() const { return qual_empty() && isObjCId(); }
5622  bool isObjCUnqualifiedClass() const { return qual_empty() && isObjCClass(); }
5623  bool isObjCUnqualifiedIdOrClass() const {
5624    if (!qual_empty()) return false;
5625    if (const BuiltinType *T = getBaseType()->getAs<BuiltinType>())
5626      return T->getKind() == BuiltinType::ObjCId ||
5627             T->getKind() == BuiltinType::ObjCClass;
5628    return false;
5629  }
5630  bool isObjCQualifiedId() const { return !qual_empty() && isObjCId(); }
5631  bool isObjCQualifiedClass() const { return !qual_empty() && isObjCClass(); }
5632
5633  /// Gets the interface declaration for this object type, if the base type
5634  /// really is an interface.
5635  ObjCInterfaceDecl *getInterface() const;
5636
5637  /// Determine whether this object type is "specialized", meaning
5638  /// that it has type arguments.
5639  bool isSpecialized() const;
5640
5641  /// Determine whether this object type was written with type arguments.
5642  bool isSpecializedAsWritten() const {
5643    return ObjCObjectTypeBits.NumTypeArgs > 0;
5644  }
5645
5646  /// Determine whether this object type is "unspecialized", meaning
5647  /// that it has no type arguments.
5648  bool isUnspecialized() const { return !isSpecialized(); }
5649
5650  /// Determine whether this object type is "unspecialized" as
5651  /// written, meaning that it has no type arguments.
5652  bool isUnspecializedAsWritten() const { return !isSpecializedAsWritten(); }
5653
5654  /// Retrieve the type arguments of this object type (semantically).
5655  ArrayRef<QualTypegetTypeArgs() const;
5656
5657  /// Retrieve the type arguments of this object type as they were
5658  /// written.
5659  ArrayRef<QualTypegetTypeArgsAsWritten() const {
5660    return llvm::makeArrayRef(getTypeArgStorage(),
5661                              ObjCObjectTypeBits.NumTypeArgs);
5662  }
5663
5664  /// Whether this is a "__kindof" type as written.
5665  bool isKindOfTypeAsWritten() const { return ObjCObjectTypeBits.IsKindOf; }
5666
5667  /// Whether this ia a "__kindof" type (semantically).
5668  bool isKindOfType() const;
5669
5670  /// Retrieve the type of the superclass of this object type.
5671  ///
5672  /// This operation substitutes any type arguments into the
5673  /// superclass of the current class type, potentially producing a
5674  /// specialization of the superclass type. Produces a null type if
5675  /// there is no superclass.
5676  QualType getSuperClassType() const {
5677    if (!CachedSuperClassType.getInt())
5678      computeSuperClassTypeSlow();
5679
5680     (0) . __assert_fail ("CachedSuperClassType.getInt() && \"Superclass not set?\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/Type.h", 5680, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert(CachedSuperClassType.getInt() && "Superclass not set?");
5681    return QualType(CachedSuperClassType.getPointer(), 0);
5682  }
5683
5684  /// Strip off the Objective-C "kindof" type and (with it) any
5685  /// protocol qualifiers.
5686  QualType stripObjCKindOfTypeAndQuals(const ASTContext &ctxconst;
5687
5688  bool isSugared() const { return false; }
5689  QualType desugar() const { return QualType(this0); }
5690
5691  static bool classof(const Type *T) {
5692    return T->getTypeClass() == ObjCObject ||
5693           T->getTypeClass() == ObjCInterface;
5694  }
5695};
5696
5697/// A class providing a concrete implementation
5698/// of ObjCObjectType, so as to not increase the footprint of
5699/// ObjCInterfaceType.  Code outside of ASTContext and the core type
5700/// system should not reference this type.
5701class ObjCObjectTypeImpl : public ObjCObjectTypepublic llvm::FoldingSetNode {
5702  friend class ASTContext;
5703
5704  // If anyone adds fields here, ObjCObjectType::getProtocolStorage()
5705  // will need to be modified.
5706
5707  ObjCObjectTypeImpl(QualType CanonicalQualType Base,
5708                     ArrayRef<QualTypetypeArgs,
5709                     ArrayRef<ObjCProtocolDecl *> protocols,
5710                     bool isKindOf)
5711      : ObjCObjectType(Canonical, Base, typeArgs, protocols, isKindOf) {}
5712
5713public:
5714  void Profile(llvm::FoldingSetNodeID &ID);
5715  static void Profile(llvm::FoldingSetNodeID &ID,
5716                      QualType Base,
5717                      ArrayRef<QualTypetypeArgs,
5718                      ArrayRef<ObjCProtocolDecl *> protocols,
5719                      bool isKindOf);
5720};
5721
5722inline QualType *ObjCObjectType::getTypeArgStorage() {
5723  return reinterpret_cast<QualType *>(static_cast<ObjCObjectTypeImpl*>(this)+1);
5724}
5725
5726inline ObjCProtocolDecl **ObjCObjectType::getProtocolStorageImpl() {
5727    return reinterpret_cast<ObjCProtocolDecl**>(
5728             getTypeArgStorage() + ObjCObjectTypeBits.NumTypeArgs);
5729}
5730
5731inline ObjCProtocolDecl **ObjCTypeParamType::getProtocolStorageImpl() {
5732    return reinterpret_cast<ObjCProtocolDecl**>(
5733             static_cast<ObjCTypeParamType*>(this)+1);
5734}
5735
5736/// Interfaces are the core concept in Objective-C for object oriented design.
5737/// They basically correspond to C++ classes.  There are two kinds of interface
5738/// types: normal interfaces like `NSString`, and qualified interfaces, which
5739/// are qualified with a protocol list like `NSString<NSCopyable, NSAmazing>`.
5740///
5741/// ObjCInterfaceType guarantees the following properties when considered
5742/// as a subtype of its superclass, ObjCObjectType:
5743///   - There are no protocol qualifiers.  To reinforce this, code which
5744///     tries to invoke the protocol methods via an ObjCInterfaceType will
5745///     fail to compile.
5746///   - It is its own base type.  That is, if T is an ObjCInterfaceType*,
5747///     T->getBaseType() == QualType(T, 0).
5748class ObjCInterfaceType : public ObjCObjectType {
5749  friend class ASTContext// ASTContext creates these.
5750  friend class ASTReader;
5751  friend class ObjCInterfaceDecl;
5752
5753  mutable ObjCInterfaceDecl *Decl;
5754
5755  ObjCInterfaceType(const ObjCInterfaceDecl *D)
5756      : ObjCObjectType(Nonce_ObjCInterface),
5757        Decl(const_cast<ObjCInterfaceDecl*>(D)) {}
5758
5759public:
5760  /// Get the declaration of this interface.
5761  ObjCInterfaceDecl *getDecl() const { return Decl; }
5762
5763  bool isSugared() const { return false; }
5764  QualType desugar() const { return QualType(this0); }
5765
5766  static bool classof(const Type *T) {
5767    return T->getTypeClass() == ObjCInterface;
5768  }
5769
5770  // Nonsense to "hide" certain members of ObjCObjectType within this
5771  // class.  People asking for protocols on an ObjCInterfaceType are
5772  // not going to get what they want: ObjCInterfaceTypes are
5773  // guaranteed to have no protocols.
5774  enum {
5775    qual_iterator,
5776    qual_begin,
5777    qual_end,
5778    getNumProtocols,
5779    getProtocol
5780  };
5781};
5782
5783inline ObjCInterfaceDecl *ObjCObjectType::getInterface() const {
5784  QualType baseType = getBaseType();
5785  while (const auto *ObjT = baseType->getAs<ObjCObjectType>()) {
5786    if (const auto *T = dyn_cast<ObjCInterfaceType>(ObjT))
5787      return T->getDecl();
5788
5789    baseType = ObjT->getBaseType();
5790  }
5791
5792  return nullptr;
5793}
5794
5795/// Represents a pointer to an Objective C object.
5796///
5797/// These are constructed from pointer declarators when the pointee type is
5798/// an ObjCObjectType (or sugar for one).  In addition, the 'id' and 'Class'
5799/// types are typedefs for these, and the protocol-qualified types 'id<P>'
5800/// and 'Class<P>' are translated into these.
5801///
5802/// Pointers to pointers to Objective C objects are still PointerTypes;
5803/// only the first level of pointer gets it own type implementation.
5804class ObjCObjectPointerType : public Typepublic llvm::FoldingSetNode {
5805  friend class ASTContext// ASTContext creates these.
5806
5807  QualType PointeeType;
5808
5809  ObjCObjectPointerType(QualType CanonicalQualType Pointee)
5810      : Type(ObjCObjectPointerCanonical,
5811             Pointee->isDependentType(),
5812             Pointee->isInstantiationDependentType(),
5813             Pointee->isVariablyModifiedType(),
5814             Pointee->containsUnexpandedParameterPack()),
5815        PointeeType(Pointee) {}
5816
5817public:
5818  /// Gets the type pointed to by this ObjC pointer.
5819  /// The result will always be an ObjCObjectType or sugar thereof.
5820  QualType getPointeeType() const { return PointeeType; }
5821
5822  /// Gets the type pointed to by this ObjC pointer.  Always returns non-null.
5823  ///
5824  /// This method is equivalent to getPointeeType() except that
5825  /// it discards any typedefs (or other sugar) between this
5826  /// type and the "outermost" object type.  So for:
5827  /// \code
5828  ///   \@class A; \@protocol P; \@protocol Q;
5829  ///   typedef A<P> AP;
5830  ///   typedef A A1;
5831  ///   typedef A1<P> A1P;
5832  ///   typedef A1P<Q> A1PQ;
5833  /// \endcode
5834  /// For 'A*', getObjectType() will return 'A'.
5835  /// For 'A<P>*', getObjectType() will return 'A<P>'.
5836  /// For 'AP*', getObjectType() will return 'A<P>'.
5837  /// For 'A1*', getObjectType() will return 'A'.
5838  /// For 'A1<P>*', getObjectType() will return 'A1<P>'.
5839  /// For 'A1P*', getObjectType() will return 'A1<P>'.
5840  /// For 'A1PQ*', getObjectType() will return 'A1<Q>', because
5841  ///   adding protocols to a protocol-qualified base discards the
5842  ///   old qualifiers (for now).  But if it didn't, getObjectType()
5843  ///   would return 'A1P<Q>' (and we'd have to make iterating over
5844  ///   qualifiers more complicated).
5845  const ObjCObjectType *getObjectType() const {
5846    return PointeeType->castAs<ObjCObjectType>();
5847  }
5848
5849  /// If this pointer points to an Objective C
5850  /// \@interface type, gets the type for that interface.  Any protocol
5851  /// qualifiers on the interface are ignored.
5852  ///
5853  /// \return null if the base type for this pointer is 'id' or 'Class'
5854  const ObjCInterfaceType *getInterfaceType() const;
5855
5856  /// If this pointer points to an Objective \@interface
5857  /// type, gets the declaration for that interface.
5858  ///
5859  /// \return null if the base type for this pointer is 'id' or 'Class'
5860  ObjCInterfaceDecl *getInterfaceDecl() const {
5861    return getObjectType()->getInterface();
5862  }
5863
5864  /// True if this is equivalent to the 'id' type, i.e. if
5865  /// its object type is the primitive 'id' type with no protocols.
5866  bool isObjCIdType() const {
5867    return getObjectType()->isObjCUnqualifiedId();
5868  }
5869
5870  /// True if this is equivalent to the 'Class' type,
5871  /// i.e. if its object tive is the primitive 'Class' type with no protocols.
5872  bool isObjCClassType() const {
5873    return getObjectType()->isObjCUnqualifiedClass();
5874  }
5875
5876  /// True if this is equivalent to the 'id' or 'Class' type,
5877  bool isObjCIdOrClassType() const {
5878    return getObjectType()->isObjCUnqualifiedIdOrClass();
5879  }
5880
5881  /// True if this is equivalent to 'id<P>' for some non-empty set of
5882  /// protocols.
5883  bool isObjCQualifiedIdType() const {
5884    return getObjectType()->isObjCQualifiedId();
5885  }
5886
5887  /// True if this is equivalent to 'Class<P>' for some non-empty set of
5888  /// protocols.
5889  bool isObjCQualifiedClassType() const {
5890    return getObjectType()->isObjCQualifiedClass();
5891  }
5892
5893  /// Whether this is a "__kindof" type.
5894  bool isKindOfType() const { return getObjectType()->isKindOfType(); }
5895
5896  /// Whether this type is specialized, meaning that it has type arguments.
5897  bool isSpecialized() const { return getObjectType()->isSpecialized(); }
5898
5899  /// Whether this type is specialized, meaning that it has type arguments.
5900  bool isSpecializedAsWritten() const {
5901    return getObjectType()->isSpecializedAsWritten();
5902  }
5903
5904  /// Whether this type is unspecialized, meaning that is has no type arguments.
5905  bool isUnspecialized() const { return getObjectType()->isUnspecialized(); }
5906
5907  /// Determine whether this object type is "unspecialized" as
5908  /// written, meaning that it has no type arguments.
5909  bool isUnspecializedAsWritten() const { return !isSpecializedAsWritten(); }
5910
5911  /// Retrieve the type arguments for this type.
5912  ArrayRef<QualTypegetTypeArgs() const {
5913    return getObjectType()->getTypeArgs();
5914  }
5915
5916  /// Retrieve the type arguments for this type.
5917  ArrayRef<QualTypegetTypeArgsAsWritten() const {
5918    return getObjectType()->getTypeArgsAsWritten();
5919  }
5920
5921  /// An iterator over the qualifiers on the object type.  Provided
5922  /// for convenience.  This will always iterate over the full set of
5923  /// protocols on a type, not just those provided directly.
5924  using qual_iterator = ObjCObjectType::qual_iterator;
5925  using qual_range = llvm::iterator_range<qual_iterator>;
5926
5927  qual_range quals() const { return qual_range(qual_begin(), qual_end()); }
5928
5929  qual_iterator qual_begin() const {
5930    return getObjectType()->qual_begin();
5931  }
5932
5933  qual_iterator qual_end() const {
5934    return getObjectType()->qual_end();
5935  }
5936
5937  bool qual_empty() const { return getObjectType()->qual_empty(); }
5938
5939  /// Return the number of qualifying protocols on the object type.
5940  unsigned getNumProtocols() const {
5941    return getObjectType()->getNumProtocols();
5942  }
5943
5944  /// Retrieve a qualifying protocol by index on the object type.
5945  ObjCProtocolDecl *getProtocol(unsigned Iconst {
5946    return getObjectType()->getProtocol(I);
5947  }
5948
5949  bool isSugared() const { return false; }
5950  QualType desugar() const { return QualType(this0); }
5951
5952  /// Retrieve the type of the superclass of this object pointer type.
5953  ///
5954  /// This operation substitutes any type arguments into the
5955  /// superclass of the current class type, potentially producing a
5956  /// pointer to a specialization of the superclass type. Produces a
5957  /// null type if there is no superclass.
5958  QualType getSuperClassType() const;
5959
5960  /// Strip off the Objective-C "kindof" type and (with it) any
5961  /// protocol qualifiers.
5962  const ObjCObjectPointerType *stripObjCKindOfTypeAndQuals(
5963                                 const ASTContext &ctxconst;
5964
5965  void Profile(llvm::FoldingSetNodeID &ID) {
5966    Profile(IDgetPointeeType());
5967  }
5968
5969  static void Profile(llvm::FoldingSetNodeID &IDQualType T) {
5970    ID.AddPointer(T.getAsOpaquePtr());
5971  }
5972
5973  static bool classof(const Type *T) {
5974    return T->getTypeClass() == ObjCObjectPointer;
5975  }
5976};
5977
5978class AtomicType : public Typepublic llvm::FoldingSetNode {
5979  friend class ASTContext// ASTContext creates these.
5980
5981  QualType ValueType;
5982
5983  AtomicType(QualType ValTyQualType Canonical)
5984      : Type(AtomicCanonicalValTy->isDependentType(),
5985             ValTy->isInstantiationDependentType(),
5986             ValTy->isVariablyModifiedType(),
5987             ValTy->containsUnexpandedParameterPack()),
5988        ValueType(ValTy) {}
5989
5990public:
5991  /// Gets the type contained by this atomic type, i.e.
5992  /// the type returned by performing an atomic load of this atomic type.
5993  QualType getValueType() const { return ValueType; }
5994
5995  bool isSugared() const { return false; }
5996  QualType desugar() const { return QualType(this0); }
5997
5998  void Profile(llvm::FoldingSetNodeID &ID) {
5999    Profile(IDgetValueType());
6000  }
6001
6002  static void Profile(llvm::FoldingSetNodeID &IDQualType T) {
6003    ID.AddPointer(T.getAsOpaquePtr());
6004  }
6005
6006  static bool classof(const Type *T) {
6007    return T->getTypeClass() == Atomic;
6008  }
6009};
6010
6011/// PipeType - OpenCL20.
6012class PipeType : public Typepublic llvm::FoldingSetNode {
6013  friend class ASTContext// ASTContext creates these.
6014
6015  QualType ElementType;
6016  bool isRead;
6017
6018  PipeType(QualType elemTypeQualType CanonicalPtrbool isRead)
6019      : Type(PipeCanonicalPtrelemType->isDependentType(),
6020             elemType->isInstantiationDependentType(),
6021             elemType->isVariablyModifiedType(),
6022             elemType->containsUnexpandedParameterPack()),
6023        ElementType(elemType), isRead(isRead) {}
6024
6025public:
6026  QualType getElementType() const { return ElementType; }
6027
6028  bool isSugared() const { return false; }
6029
6030  QualType desugar() const { return QualType(this0); }
6031
6032  void Profile(llvm::FoldingSetNodeID &ID) {
6033    Profile(IDgetElementType(), isReadOnly());
6034  }
6035
6036  static void Profile(llvm::FoldingSetNodeID &IDQualType Tbool isRead) {
6037    ID.AddPointer(T.getAsOpaquePtr());
6038    ID.AddBoolean(isRead);
6039  }
6040
6041  static bool classof(const Type *T) {
6042    return T->getTypeClass() == Pipe;
6043  }
6044
6045  bool isReadOnly() const { return isRead; }
6046};
6047
6048/// A qualifier set is used to build a set of qualifiers.
6049class QualifierCollector : public Qualifiers {
6050public:
6051  QualifierCollector(Qualifiers Qs = Qualifiers()) : Qualifiers(Qs) {}
6052
6053  /// Collect any qualifiers on the given type and return an
6054  /// unqualified type.  The qualifiers are assumed to be consistent
6055  /// with those already in the type.
6056  const Type *strip(QualType type) {
6057    addFastQualifiers(type.getLocalFastQualifiers());
6058    if (!type.hasLocalNonFastQualifiers())
6059      return type.getTypePtrUnsafe();
6060
6061    const ExtQuals *extQuals = type.getExtQualsUnsafe();
6062    addConsistentQualifiers(extQuals->getQualifiers());
6063    return extQuals->getBaseType();
6064  }
6065
6066  /// Apply the collected qualifiers to the given type.
6067  QualType apply(const ASTContext &ContextQualType QTconst;
6068
6069  /// Apply the collected qualifiers to the given type.
6070  QualType apply(const ASTContext &Contextconst TypeTconst;
6071};
6072
6073// Inline function definitions.
6074
6075inline SplitQualType SplitQualType::getSingleStepDesugaredType() const {
6076  SplitQualType desugar =
6077    Ty->getLocallyUnqualifiedSingleStepDesugaredType().split();
6078  desugar.Quals.addConsistentQualifiers(Quals);
6079  return desugar;
6080}
6081
6082inline const Type *QualType::getTypePtr() const {
6083  return getCommonPtr()->BaseType;
6084}
6085
6086inline const Type *QualType::getTypePtrOrNull() const {
6087  return (isNull() ? nullptr : getCommonPtr()->BaseType);
6088}
6089
6090inline SplitQualType QualType::split() const {
6091  if (!hasLocalNonFastQualifiers())
6092    return SplitQualType(getTypePtrUnsafe(),
6093                         Qualifiers::fromFastMask(getLocalFastQualifiers()));
6094
6095  const ExtQuals *eq = getExtQualsUnsafe();
6096  Qualifiers qs = eq->getQualifiers();
6097  qs.addFastQualifiers(getLocalFastQualifiers());
6098  return SplitQualType(eq->getBaseType(), qs);
6099}
6100
6101inline Qualifiers QualType::getLocalQualifiers() const {
6102  Qualifiers Quals;
6103  if (hasLocalNonFastQualifiers())
6104    Quals = getExtQualsUnsafe()->getQualifiers();
6105  Quals.addFastQualifiers(getLocalFastQualifiers());
6106  return Quals;
6107}
6108
6109inline Qualifiers QualType::getQualifiers() const {
6110  Qualifiers quals = getCommonPtr()->CanonicalType.getLocalQualifiers();
6111  quals.addFastQualifiers(getLocalFastQualifiers());
6112  return quals;
6113}
6114
6115inline unsigned QualType::getCVRQualifiers() const {
6116  unsigned cvr = getCommonPtr()->CanonicalType.getLocalCVRQualifiers();
6117  cvr |= getLocalCVRQualifiers();
6118  return cvr;
6119}
6120
6121inline QualType QualType::getCanonicalType() const {
6122  QualType canon = getCommonPtr()->CanonicalType;
6123  return canon.withFastQualifiers(getLocalFastQualifiers());
6124}
6125
6126inline bool QualType::isCanonical() const {
6127  return getTypePtr()->isCanonicalUnqualified();
6128}
6129
6130inline bool QualType::isCanonicalAsParam() const {
6131  if (!isCanonical()) return false;
6132  if (hasLocalQualifiers()) return false;
6133
6134  const Type *T = getTypePtr();
6135  if (T->isVariablyModifiedType() && T->hasSizedVLAType())
6136    return false;
6137
6138  return !isa<FunctionType>(T) && !isa<ArrayType>(T);
6139}
6140
6141inline bool QualType::isConstQualified() const {
6142  return isLocalConstQualified() ||
6143         getCommonPtr()->CanonicalType.isLocalConstQualified();
6144}
6145
6146inline bool QualType::isRestrictQualified() const {
6147  return isLocalRestrictQualified() ||
6148         getCommonPtr()->CanonicalType.isLocalRestrictQualified();
6149}
6150
6151
6152inline bool QualType::isVolatileQualified() const {
6153  return isLocalVolatileQualified() ||
6154         getCommonPtr()->CanonicalType.isLocalVolatileQualified();
6155}
6156
6157inline bool QualType::hasQualifiers() const {
6158  return hasLocalQualifiers() ||
6159         getCommonPtr()->CanonicalType.hasLocalQualifiers();
6160}
6161
6162inline QualType QualType::getUnqualifiedType() const {
6163  if (!getTypePtr()->getCanonicalTypeInternal().hasLocalQualifiers())
6164    return QualType(getTypePtr(), 0);
6165
6166  return QualType(getSplitUnqualifiedTypeImpl(*this).Ty0);
6167}
6168
6169inline SplitQualType QualType::getSplitUnqualifiedType() const {
6170  if (!getTypePtr()->getCanonicalTypeInternal().hasLocalQualifiers())
6171    return split();
6172
6173  return getSplitUnqualifiedTypeImpl(*this);
6174}
6175
6176inline void QualType::removeLocalConst() {
6177  removeLocalFastQualifiers(Qualifiers::Const);
6178}
6179
6180inline void QualType::removeLocalRestrict() {
6181  removeLocalFastQualifiers(Qualifiers::Restrict);
6182}
6183
6184inline void QualType::removeLocalVolatile() {
6185  removeLocalFastQualifiers(Qualifiers::Volatile);
6186}
6187
6188inline void QualType::removeLocalCVRQualifiers(unsigned Mask) {
6189   (0) . __assert_fail ("!(Mask & ~Qualifiers..CVRMask) && \"mask has non-CVR bits\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/Type.h", 6189, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert(!(Mask & ~Qualifiers::CVRMask) && "mask has non-CVR bits");
6190  static_assert((int)Qualifiers::CVRMask == (int)Qualifiers::FastMask,
6191                "Fast bits differ from CVR bits!");
6192
6193  // Fast path: we don't need to touch the slow qualifiers.
6194  removeLocalFastQualifiers(Mask);
6195}
6196
6197/// Return the address space of this type.
6198inline LangAS QualType::getAddressSpace() const {
6199  return getQualifiers().getAddressSpace();
6200}
6201
6202/// Return the gc attribute of this type.
6203inline Qualifiers::GC QualType::getObjCGCAttr() const {
6204  return getQualifiers().getObjCGCAttr();
6205}
6206
6207inline FunctionType::ExtInfo getFunctionExtInfo(const Type &t) {
6208  if (const auto *PT = t.getAs<PointerType>()) {
6209    if (const auto *FT = PT->getPointeeType()->getAs<FunctionType>())
6210      return FT->getExtInfo();
6211  } else if (const auto *FT = t.getAs<FunctionType>())
6212    return FT->getExtInfo();
6213
6214  return FunctionType::ExtInfo();
6215}
6216
6217inline FunctionType::ExtInfo getFunctionExtInfo(QualType t) {
6218  return getFunctionExtInfo(*t);
6219}
6220
6221/// Determine whether this type is more
6222/// qualified than the Other type. For example, "const volatile int"
6223/// is more qualified than "const int", "volatile int", and
6224/// "int". However, it is not more qualified than "const volatile
6225/// int".
6226inline bool QualType::isMoreQualifiedThan(QualType otherconst {
6227  Qualifiers MyQuals = getQualifiers();
6228  Qualifiers OtherQuals = other.getQualifiers();
6229  return (MyQuals != OtherQuals && MyQuals.compatiblyIncludes(OtherQuals));
6230}
6231
6232/// Determine whether this type is at last
6233/// as qualified as the Other type. For example, "const volatile
6234/// int" is at least as qualified as "const int", "volatile int",
6235/// "int", and "const volatile int".
6236inline bool QualType::isAtLeastAsQualifiedAs(QualType otherconst {
6237  Qualifiers OtherQuals = other.getQualifiers();
6238
6239  // Ignore __unaligned qualifier if this type is a void.
6240  if (getUnqualifiedType()->isVoidType())
6241    OtherQuals.removeUnaligned();
6242
6243  return getQualifiers().compatiblyIncludes(OtherQuals);
6244}
6245
6246/// If Type is a reference type (e.g., const
6247/// int&), returns the type that the reference refers to ("const
6248/// int"). Otherwise, returns the type itself. This routine is used
6249/// throughout Sema to implement C++ 5p6:
6250///
6251///   If an expression initially has the type "reference to T" (8.3.2,
6252///   8.5.3), the type is adjusted to "T" prior to any further
6253///   analysis, the expression designates the object or function
6254///   denoted by the reference, and the expression is an lvalue.
6255inline QualType QualType::getNonReferenceType() const {
6256  if (const auto *RefType = (*this)->getAs<ReferenceType>())
6257    return RefType->getPointeeType();
6258  else
6259    return *this;
6260}
6261
6262inline bool QualType::isCForbiddenLValueType() const {
6263  return ((getTypePtr()->isVoidType() && !hasQualifiers()) ||
6264          getTypePtr()->isFunctionType());
6265}
6266
6267/// Tests whether the type is categorized as a fundamental type.
6268///
6269/// \returns True for types specified in C++0x [basic.fundamental].
6270inline bool Type::isFundamentalType() const {
6271  return isVoidType() ||
6272         // FIXME: It's really annoying that we don't have an
6273         // 'isArithmeticType()' which agrees with the standard definition.
6274         (isArithmeticType() && !isEnumeralType());
6275}
6276
6277/// Tests whether the type is categorized as a compound type.
6278///
6279/// \returns True for types specified in C++0x [basic.compound].
6280inline bool Type::isCompoundType() const {
6281  // C++0x [basic.compound]p1:
6282  //   Compound types can be constructed in the following ways:
6283  //    -- arrays of objects of a given type [...];
6284  return isArrayType() ||
6285  //    -- functions, which have parameters of given types [...];
6286         isFunctionType() ||
6287  //    -- pointers to void or objects or functions [...];
6288         isPointerType() ||
6289  //    -- references to objects or functions of a given type. [...]
6290         isReferenceType() ||
6291  //    -- classes containing a sequence of objects of various types, [...];
6292         isRecordType() ||
6293  //    -- unions, which are classes capable of containing objects of different
6294  //               types at different times;
6295         isUnionType() ||
6296  //    -- enumerations, which comprise a set of named constant values. [...];
6297         isEnumeralType() ||
6298  //    -- pointers to non-static class members, [...].
6299         isMemberPointerType();
6300}
6301
6302inline bool Type::isFunctionType() const {
6303  return isa<FunctionType>(CanonicalType);
6304}
6305
6306inline bool Type::isPointerType() const {
6307  return isa<PointerType>(CanonicalType);
6308}
6309
6310inline bool Type::isAnyPointerType() const {
6311  return isPointerType() || isObjCObjectPointerType();
6312}
6313
6314inline bool Type::isBlockPointerType() const {
6315  return isa<BlockPointerType>(CanonicalType);
6316}
6317
6318inline bool Type::isReferenceType() const {
6319  return isa<ReferenceType>(CanonicalType);
6320}
6321
6322inline bool Type::isLValueReferenceType() const {
6323  return isa<LValueReferenceType>(CanonicalType);
6324}
6325
6326inline bool Type::isRValueReferenceType() const {
6327  return isa<RValueReferenceType>(CanonicalType);
6328}
6329
6330inline bool Type::isFunctionPointerType() const {
6331  if (const auto *T = getAs<PointerType>())
6332    return T->getPointeeType()->isFunctionType();
6333  else
6334    return false;
6335}
6336
6337inline bool Type::isMemberPointerType() const {
6338  return isa<MemberPointerType>(CanonicalType);
6339}
6340
6341inline bool Type::isMemberFunctionPointerType() const {
6342  if (const auto *T = getAs<MemberPointerType>())
6343    return T->isMemberFunctionPointer();
6344  else
6345    return false;
6346}
6347
6348inline bool Type::isMemberDataPointerType() const {
6349  if (const auto *T = getAs<MemberPointerType>())
6350    return T->isMemberDataPointer();
6351  else
6352    return false;
6353}
6354
6355inline bool Type::isArrayType() const {
6356  return isa<ArrayType>(CanonicalType);
6357}
6358
6359inline bool Type::isConstantArrayType() const {
6360  return isa<ConstantArrayType>(CanonicalType);
6361}
6362
6363inline bool Type::isIncompleteArrayType() const {
6364  return isa<IncompleteArrayType>(CanonicalType);
6365}
6366
6367inline bool Type::isVariableArrayType() const {
6368  return isa<VariableArrayType>(CanonicalType);
6369}
6370
6371inline bool Type::isDependentSizedArrayType() const {
6372  return isa<DependentSizedArrayType>(CanonicalType);
6373}
6374
6375inline bool Type::isBuiltinType() const {
6376  return isa<BuiltinType>(CanonicalType);
6377}
6378
6379inline bool Type::isRecordType() const {
6380  return isa<RecordType>(CanonicalType);
6381}
6382
6383inline bool Type::isEnumeralType() const {
6384  return isa<EnumType>(CanonicalType);
6385}
6386
6387inline bool Type::isAnyComplexType() const {
6388  return isa<ComplexType>(CanonicalType);
6389}
6390
6391inline bool Type::isVectorType() const {
6392  return isa<VectorType>(CanonicalType);
6393}
6394
6395inline bool Type::isExtVectorType() const {
6396  return isa<ExtVectorType>(CanonicalType);
6397}
6398
6399inline bool Type::isDependentAddressSpaceType() const {
6400  return isa<DependentAddressSpaceType>(CanonicalType);
6401}
6402
6403inline bool Type::isObjCObjectPointerType() const {
6404  return isa<ObjCObjectPointerType>(CanonicalType);
6405}
6406
6407inline bool Type::isObjCObjectType() const {
6408  return isa<ObjCObjectType>(CanonicalType);
6409}
6410
6411inline bool Type::isObjCObjectOrInterfaceType() const {
6412  return isa<ObjCInterfaceType>(CanonicalType) ||
6413    isa<ObjCObjectType>(CanonicalType);
6414}
6415
6416inline bool Type::isAtomicType() const {
6417  return isa<AtomicType>(CanonicalType);
6418}
6419
6420inline bool Type::isObjCQualifiedIdType() const {
6421  if (const auto *OPT = getAs<ObjCObjectPointerType>())
6422    return OPT->isObjCQualifiedIdType();
6423  return false;
6424}
6425
6426inline bool Type::isObjCQualifiedClassType() const {
6427  if (const auto *OPT = getAs<ObjCObjectPointerType>())
6428    return OPT->isObjCQualifiedClassType();
6429  return false;
6430}
6431
6432inline bool Type::isObjCIdType() const {
6433  if (const auto *OPT = getAs<ObjCObjectPointerType>())
6434    return OPT->isObjCIdType();
6435  return false;
6436}
6437
6438inline bool Type::isObjCClassType() const {
6439  if (const auto *OPT = getAs<ObjCObjectPointerType>())
6440    return OPT->isObjCClassType();
6441  return false;
6442}
6443
6444inline bool Type::isObjCSelType() const {
6445  if (const auto *OPT = getAs<PointerType>())
6446    return OPT->getPointeeType()->isSpecificBuiltinType(BuiltinType::ObjCSel);
6447  return false;
6448}
6449
6450inline bool Type::isObjCBuiltinType() const {
6451  return isObjCIdType() || isObjCClassType() || isObjCSelType();
6452}
6453
6454inline bool Type::isDecltypeType() const {
6455  return isa<DecltypeType>(this);
6456}
6457
6458#define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \
6459  inline bool Type::is##Id##Type() const { \
6460    return isSpecificBuiltinType(BuiltinType::Id); \
6461  }
6462#include "clang/Basic/OpenCLImageTypes.def"
6463
6464inline bool Type::isSamplerT() const {
6465  return isSpecificBuiltinType(BuiltinType::OCLSampler);
6466}
6467
6468inline bool Type::isEventT() const {
6469  return isSpecificBuiltinType(BuiltinType::OCLEvent);
6470}
6471
6472inline bool Type::isClkEventT() const {
6473  return isSpecificBuiltinType(BuiltinType::OCLClkEvent);
6474}
6475
6476inline bool Type::isQueueT() const {
6477  return isSpecificBuiltinType(BuiltinType::OCLQueue);
6478}
6479
6480inline bool Type::isReserveIDT() const {
6481  return isSpecificBuiltinType(BuiltinType::OCLReserveID);
6482}
6483
6484inline bool Type::isImageType() const {
6485#define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) is##Id##Type() ||
6486  return
6487#include "clang/Basic/OpenCLImageTypes.def"
6488      false// end boolean or operation
6489}
6490
6491inline bool Type::isPipeType() const {
6492  return isa<PipeType>(CanonicalType);
6493}
6494
6495#define EXT_OPAQUE_TYPE(ExtType, Id, Ext) \
6496  inline bool Type::is##Id##Type() const { \
6497    return isSpecificBuiltinType(BuiltinType::Id); \
6498  }
6499#include "clang/Basic/OpenCLExtensionTypes.def"
6500
6501inline bool Type::isOCLIntelSubgroupAVCType() const {
6502#define INTEL_SUBGROUP_AVC_TYPE(ExtType, Id) \
6503  isOCLIntelSubgroupAVC##Id##Type() ||
6504  return
6505#include "clang/Basic/OpenCLExtensionTypes.def"
6506    false// end of boolean or operation
6507}
6508
6509inline bool Type::isOCLExtOpaqueType() const {
6510#define EXT_OPAQUE_TYPE(ExtType, Id, Ext) is##Id##Type() ||
6511  return
6512#include "clang/Basic/OpenCLExtensionTypes.def"
6513    false// end of boolean or operation
6514}
6515
6516inline bool Type::isOpenCLSpecificType() const {
6517  return isSamplerT() || isEventT() || isImageType() || isClkEventT() ||
6518         isQueueT() || isReserveIDT() || isPipeType() || isOCLExtOpaqueType();
6519}
6520
6521inline bool Type::isTemplateTypeParmType() const {
6522  return isa<TemplateTypeParmType>(CanonicalType);
6523}
6524
6525inline bool Type::isSpecificBuiltinType(unsigned Kconst {
6526  if (const BuiltinType *BT = getAs<BuiltinType>())
6527    if (BT->getKind() == (BuiltinType::KindK)
6528      return true;
6529  return false;
6530}
6531
6532inline bool Type::isPlaceholderType() const {
6533  if (const auto *BT = dyn_cast<BuiltinType>(this))
6534    return BT->isPlaceholderType();
6535  return false;
6536}
6537
6538inline const BuiltinType *Type::getAsPlaceholderType() const {
6539  if (const auto *BT = dyn_cast<BuiltinType>(this))
6540    if (BT->isPlaceholderType())
6541      return BT;
6542  return nullptr;
6543}
6544
6545inline bool Type::isSpecificPlaceholderType(unsigned Kconst {
6546  assert(BuiltinType::isPlaceholderTypeKind((BuiltinType::Kind) K));
6547  if (const auto *BT = dyn_cast<BuiltinType>(this))
6548    return (BT->getKind() == (BuiltinType::Kind) K);
6549  return false;
6550}
6551
6552inline bool Type::isNonOverloadPlaceholderType() const {
6553  if (const auto *BT = dyn_cast<BuiltinType>(this))
6554    return BT->isNonOverloadPlaceholderType();
6555  return false;
6556}
6557
6558inline bool Type::isVoidType() const {
6559  if (const auto *BT = dyn_cast<BuiltinType>(CanonicalType))
6560    return BT->getKind() == BuiltinType::Void;
6561  return false;
6562}
6563
6564inline bool Type::isHalfType() const {
6565  if (const auto *BT = dyn_cast<BuiltinType>(CanonicalType))
6566    return BT->getKind() == BuiltinType::Half;
6567  // FIXME: Should we allow complex __fp16? Probably not.
6568  return false;
6569}
6570
6571inline bool Type::isFloat16Type() const {
6572  if (const auto *BT = dyn_cast<BuiltinType>(CanonicalType))
6573    return BT->getKind() == BuiltinType::Float16;
6574  return false;
6575}
6576
6577inline bool Type::isFloat128Type() const {
6578  if (const auto *BT = dyn_cast<BuiltinType>(CanonicalType))
6579    return BT->getKind() == BuiltinType::Float128;
6580  return false;
6581}
6582
6583inline bool Type::isNullPtrType() const {
6584  if (const auto *BT = getAs<BuiltinType>())
6585    return BT->getKind() == BuiltinType::NullPtr;
6586  return false;
6587}
6588
6589bool IsEnumDeclComplete(EnumDecl *);
6590bool IsEnumDeclScoped(EnumDecl *);
6591
6592inline bool Type::isIntegerType() const {
6593  if (const auto *BT = dyn_cast<BuiltinType>(CanonicalType))
6594    return BT->getKind() >= BuiltinType::Bool &&
6595           BT->getKind() <= BuiltinType::Int128;
6596  if (const EnumType *ET = dyn_cast<EnumType>(CanonicalType)) {
6597    // Incomplete enum types are not treated as integer types.
6598    // FIXME: In C++, enum types are never integer types.
6599    return IsEnumDeclComplete(ET->getDecl()) &&
6600      !IsEnumDeclScoped(ET->getDecl());
6601  }
6602  return false;
6603}
6604
6605inline bool Type::isFixedPointType() const {
6606  if (const auto *BT = dyn_cast<BuiltinType>(CanonicalType)) {
6607    return BT->getKind() >= BuiltinType::ShortAccum &&
6608           BT->getKind() <= BuiltinType::SatULongFract;
6609  }
6610  return false;
6611}
6612
6613inline bool Type::isFixedPointOrIntegerType() const {
6614  return isFixedPointType() || isIntegerType();
6615}
6616
6617inline bool Type::isSaturatedFixedPointType() const {
6618  if (const auto *BT = dyn_cast<BuiltinType>(CanonicalType)) {
6619    return BT->getKind() >= BuiltinType::SatShortAccum &&
6620           BT->getKind() <= BuiltinType::SatULongFract;
6621  }
6622  return false;
6623}
6624
6625inline bool Type::isUnsaturatedFixedPointType() const {
6626  return isFixedPointType() && !isSaturatedFixedPointType();
6627}
6628
6629inline bool Type::isSignedFixedPointType() const {
6630  if (const auto *BT = dyn_cast<BuiltinType>(CanonicalType)) {
6631    return ((BT->getKind() >= BuiltinType::ShortAccum &&
6632             BT->getKind() <= BuiltinType::LongAccum) ||
6633            (BT->getKind() >= BuiltinType::ShortFract &&
6634             BT->getKind() <= BuiltinType::LongFract) ||
6635            (BT->getKind() >= BuiltinType::SatShortAccum &&
6636             BT->getKind() <= BuiltinType::SatLongAccum) ||
6637            (BT->getKind() >= BuiltinType::SatShortFract &&
6638             BT->getKind() <= BuiltinType::SatLongFract));
6639  }
6640  return false;
6641}
6642
6643inline bool Type::isUnsignedFixedPointType() const {
6644  return isFixedPointType() && !isSignedFixedPointType();
6645}
6646
6647inline bool Type::isScalarType() const {
6648  if (const auto *BT = dyn_cast<BuiltinType>(CanonicalType))
6649    return BT->getKind() > BuiltinType::Void &&
6650           BT->getKind() <= BuiltinType::NullPtr;
6651  if (const EnumType *ET = dyn_cast<EnumType>(CanonicalType))
6652    // Enums are scalar types, but only if they are defined.  Incomplete enums
6653    // are not treated as scalar types.
6654    return IsEnumDeclComplete(ET->getDecl());
6655  return isa<PointerType>(CanonicalType) ||
6656         isa<BlockPointerType>(CanonicalType) ||
6657         isa<MemberPointerType>(CanonicalType) ||
6658         isa<ComplexType>(CanonicalType) ||
6659         isa<ObjCObjectPointerType>(CanonicalType);
6660}
6661
6662inline bool Type::isIntegralOrEnumerationType() const {
6663  if (const auto *BT = dyn_cast<BuiltinType>(CanonicalType))
6664    return BT->getKind() >= BuiltinType::Bool &&
6665           BT->getKind() <= BuiltinType::Int128;
6666
6667  // Check for a complete enum type; incomplete enum types are not properly an
6668  // enumeration type in the sense required here.
6669  if (const auto *ET = dyn_cast<EnumType>(CanonicalType))
6670    return IsEnumDeclComplete(ET->getDecl());
6671
6672  return false;
6673}
6674
6675inline bool Type::isBooleanType() const {
6676  if (const auto *BT = dyn_cast<BuiltinType>(CanonicalType))
6677    return BT->getKind() == BuiltinType::Bool;
6678  return false;
6679}
6680
6681inline bool Type::isUndeducedType() const {
6682  auto *DT = getContainedDeducedType();
6683  return DT && !DT->isDeduced();
6684}
6685
6686/// Determines whether this is a type for which one can define
6687/// an overloaded operator.
6688inline bool Type::isOverloadableType() const {
6689  return isDependentType() || isRecordType() || isEnumeralType();
6690}
6691
6692/// Determines whether this type can decay to a pointer type.
6693inline bool Type::canDecayToPointerType() const {
6694  return isFunctionType() || isArrayType();
6695}
6696
6697inline bool Type::hasPointerRepresentation() const {
6698  return (isPointerType() || isReferenceType() || isBlockPointerType() ||
6699          isObjCObjectPointerType() || isNullPtrType());
6700}
6701
6702inline bool Type::hasObjCPointerRepresentation() const {
6703  return isObjCObjectPointerType();
6704}
6705
6706inline const Type *Type::getBaseElementTypeUnsafe() const {
6707  const Type *type = this;
6708  while (const ArrayType *arrayType = type->getAsArrayTypeUnsafe())
6709    type = arrayType->getElementType().getTypePtr();
6710  return type;
6711}
6712
6713inline const Type *Type::getPointeeOrArrayElementType() const {
6714  const Type *type = this;
6715  if (type->isAnyPointerType())
6716    return type->getPointeeType().getTypePtr();
6717  else if (type->isArrayType())
6718    return type->getBaseElementTypeUnsafe();
6719  return type;
6720}
6721
6722/// Insertion operator for diagnostics. This allows sending Qualifiers into a
6723/// diagnostic with <<.
6724inline const DiagnosticBuilder &operator<<(const DiagnosticBuilder &DB,
6725                                           Qualifiers Q) {
6726  DB.AddTaggedVal(Q.getAsOpaqueValue(),
6727                  DiagnosticsEngine::ArgumentKind::ak_qual);
6728  return DB;
6729}
6730
6731/// Insertion operator for partial diagnostics. This allows sending Qualifiers
6732/// into a diagnostic with <<.
6733inline const PartialDiagnostic &operator<<(const PartialDiagnostic &PD,
6734                                           Qualifiers Q) {
6735  PD.AddTaggedVal(Q.getAsOpaqueValue(),
6736                  DiagnosticsEngine::ArgumentKind::ak_qual);
6737  return PD;
6738}
6739
6740/// Insertion operator for diagnostics.  This allows sending QualType's into a
6741/// diagnostic with <<.
6742inline const DiagnosticBuilder &operator<<(const DiagnosticBuilder &DB,
6743                                           QualType T) {
6744  DB.AddTaggedVal(reinterpret_cast<intptr_t>(T.getAsOpaquePtr()),
6745                  DiagnosticsEngine::ak_qualtype);
6746  return DB;
6747}
6748
6749/// Insertion operator for partial diagnostics.  This allows sending QualType's
6750/// into a diagnostic with <<.
6751inline const PartialDiagnostic &operator<<(const PartialDiagnostic &PD,
6752                                           QualType T) {
6753  PD.AddTaggedVal(reinterpret_cast<intptr_t>(T.getAsOpaquePtr()),
6754                  DiagnosticsEngine::ak_qualtype);
6755  return PD;
6756}
6757
6758// Helper class template that is used by Type::getAs to ensure that one does
6759// not try to look through a qualified type to get to an array type.
6760template <typename T>
6761using TypeIsArrayType =
6762    std::integral_constant<boolstd::is_same<T, ArrayType>::value ||
6763                                     std::is_base_of<ArrayType, T>::value>;
6764
6765// Member-template getAs<specific type>'.
6766template <typename T> const T *Type::getAs() const {
6767  static_assert(!TypeIsArrayType<T>::value,
6768                "ArrayType cannot be used with getAs!");
6769
6770  // If this is directly a T type, return it.
6771  if (const auto *Ty = dyn_cast<T>(this))
6772    return Ty;
6773
6774  // If the canonical form of this type isn't the right kind, reject it.
6775  if (!isa<T>(CanonicalType))
6776    return nullptr;
6777
6778  // If this is a typedef for the type, strip the typedef off without
6779  // losing all typedef information.
6780  return cast<T>(getUnqualifiedDesugaredType());
6781}
6782
6783template <typename T> const T *Type::getAsAdjusted() const {
6784  static_assert(!TypeIsArrayType<T>::value, "ArrayType cannot be used with getAsAdjusted!");
6785
6786  // If this is directly a T type, return it.
6787  if (const auto *Ty = dyn_cast<T>(this))
6788    return Ty;
6789
6790  // If the canonical form of this type isn't the right kind, reject it.
6791  if (!isa<T>(CanonicalType))
6792    return nullptr;
6793
6794  // Strip off type adjustments that do not modify the underlying nature of the
6795  // type.
6796  const Type *Ty = this;
6797  while (Ty) {
6798    if (const auto *A = dyn_cast<AttributedType>(Ty))
6799      Ty = A->getModifiedType().getTypePtr();
6800    else if (const auto *E = dyn_cast<ElaboratedType>(Ty))
6801      Ty = E->desugar().getTypePtr();
6802    else if (const auto *P = dyn_cast<ParenType>(Ty))
6803      Ty = P->desugar().getTypePtr();
6804    else if (const auto *A = dyn_cast<AdjustedType>(Ty))
6805      Ty = A->desugar().getTypePtr();
6806    else
6807      break;
6808  }
6809
6810  // Just because the canonical type is correct does not mean we can use cast<>,
6811  // since we may not have stripped off all the sugar down to the base type.
6812  return dyn_cast<T>(Ty);
6813}
6814
6815inline const ArrayType *Type::getAsArrayTypeUnsafe() const {
6816  // If this is directly an array type, return it.
6817  if (const auto *arr = dyn_cast<ArrayType>(this))
6818    return arr;
6819
6820  // If the canonical form of this type isn't the right kind, reject it.
6821  if (!isa<ArrayType>(CanonicalType))
6822    return nullptr;
6823
6824  // If this is a typedef for the type, strip the typedef off without
6825  // losing all typedef information.
6826  return cast<ArrayType>(getUnqualifiedDesugaredType());
6827}
6828
6829template <typename T> const T *Type::castAs() const {
6830  static_assert(!TypeIsArrayType<T>::value,
6831                "ArrayType cannot be used with castAs!");
6832
6833  if (const auto *ty = dyn_cast<T>(this)) return ty;
6834  (CanonicalType)", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/Type.h", 6834, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert(isa<T>(CanonicalType));
6835  return cast<T>(getUnqualifiedDesugaredType());
6836}
6837
6838inline const ArrayType *Type::castAsArrayTypeUnsafe() const {
6839  (CanonicalType)", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/Type.h", 6839, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert(isa<ArrayType>(CanonicalType));
6840  if (const auto *arr = dyn_cast<ArrayType>(this)) return arr;
6841  return cast<ArrayType>(getUnqualifiedDesugaredType());
6842}
6843
6844DecayedType::DecayedType(QualType OriginalTypeQualType DecayedPtr,
6845                         QualType CanonicalPtr)
6846    : AdjustedType(DecayedOriginalTypeDecayedPtrCanonicalPtr) {
6847#ifndef NDEBUG
6848  QualType Adjusted = getAdjustedType();
6849  (void)AttributedType::stripOuterNullability(Adjusted);
6850  (Adjusted)", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/Type.h", 6850, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert(isa<PointerType>(Adjusted));
6851#endif
6852}
6853
6854QualType DecayedType::getPointeeType() const {
6855  QualType Decayed = getDecayedType();
6856  (void)AttributedType::stripOuterNullability(Decayed);
6857  return cast<PointerType>(Decayed)->getPointeeType();
6858}
6859
6860// Get the decimal string representation of a fixed point type, represented
6861// as a scaled integer.
6862// TODO: At some point, we should change the arguments to instead just accept an
6863// APFixedPoint instead of APSInt and scale.
6864void FixedPointValueToString(SmallVectorImpl<char> &Strllvm::APSInt Val,
6865                             unsigned Scale);
6866
6867// namespace clang
6868
6869#endif // LLVM_CLANG_AST_TYPE_H
6870
clang::Qualifiers::TQ
clang::Qualifiers::GC
clang::Qualifiers::ObjCLifetime
clang::Qualifiers::removeCommonQualifiers
clang::Qualifiers::fromFastMask
clang::Qualifiers::fromCVRMask
clang::Qualifiers::fromCVRUMask
clang::Qualifiers::fromOpaqueValue
clang::Qualifiers::getAsOpaqueValue
clang::Qualifiers::hasConst
clang::Qualifiers::hasOnlyConst
clang::Qualifiers::removeConst
clang::Qualifiers::addConst
clang::Qualifiers::hasVolatile
clang::Qualifiers::hasOnlyVolatile
clang::Qualifiers::removeVolatile
clang::Qualifiers::addVolatile
clang::Qualifiers::hasRestrict
clang::Qualifiers::hasOnlyRestrict
clang::Qualifiers::removeRestrict
clang::Qualifiers::addRestrict
clang::Qualifiers::hasCVRQualifiers
clang::Qualifiers::getCVRQualifiers
clang::Qualifiers::getCVRUQualifiers
clang::Qualifiers::setCVRQualifiers
clang::Qualifiers::removeCVRQualifiers
clang::Qualifiers::removeCVRQualifiers
clang::Qualifiers::addCVRQualifiers
clang::Qualifiers::addCVRUQualifiers
clang::Qualifiers::hasUnaligned
clang::Qualifiers::setUnaligned
clang::Qualifiers::removeUnaligned
clang::Qualifiers::addUnaligned
clang::Qualifiers::hasObjCGCAttr
clang::Qualifiers::getObjCGCAttr
clang::Qualifiers::setObjCGCAttr
clang::Qualifiers::removeObjCGCAttr
clang::Qualifiers::addObjCGCAttr
clang::Qualifiers::withoutObjCGCAttr
clang::Qualifiers::withoutObjCLifetime
clang::Qualifiers::withoutAddressSpace
clang::Qualifiers::hasObjCLifetime
clang::Qualifiers::getObjCLifetime
clang::Qualifiers::setObjCLifetime
clang::Qualifiers::removeObjCLifetime
clang::Qualifiers::addObjCLifetime
clang::Qualifiers::hasNonTrivialObjCLifetime
clang::Qualifiers::hasStrongOrWeakObjCLifetime
clang::Qualifiers::hasAddressSpace
clang::Qualifiers::getAddressSpace
clang::Qualifiers::hasTargetSpecificAddressSpace
clang::Qualifiers::getAddressSpaceAttributePrintValue
clang::Qualifiers::setAddressSpace
clang::Qualifiers::removeAddressSpace
clang::Qualifiers::addAddressSpace
clang::Qualifiers::hasFastQualifiers
clang::Qualifiers::getFastQualifiers
clang::Qualifiers::setFastQualifiers
clang::Qualifiers::removeFastQualifiers
clang::Qualifiers::removeFastQualifiers
clang::Qualifiers::addFastQualifiers
clang::Qualifiers::hasNonFastQualifiers
clang::Qualifiers::getNonFastQualifiers
clang::Qualifiers::hasQualifiers
clang::Qualifiers::empty
clang::Qualifiers::addQualifiers
clang::Qualifiers::removeQualifiers
clang::Qualifiers::addConsistentQualifiers
clang::Qualifiers::isAddressSpaceSupersetOf
clang::Qualifiers::compatiblyIncludes
clang::Qualifiers::compatiblyIncludesObjCLifetime
clang::Qualifiers::isStrictSupersetOf
clang::Qualifiers::getAsString
clang::Qualifiers::getAsString
clang::Qualifiers::isEmptyWhenPrinted
clang::Qualifiers::print
clang::Qualifiers::Profile
clang::Qualifiers::Mask
clang::Qualifiers::UMask
clang::Qualifiers::UShift
clang::Qualifiers::GCAttrMask
clang::Qualifiers::GCAttrShift
clang::Qualifiers::LifetimeMask
clang::Qualifiers::LifetimeShift
clang::Qualifiers::AddressSpaceMask
clang::Qualifiers::AddressSpaceShift
clang::SplitQualType::Ty
clang::SplitQualType::Quals
clang::SplitQualType::getSingleStepDesugaredType
clang::SplitQualType::asPair
clang::QualType::getExtQualsUnsafe
clang::QualType::getTypePtrUnsafe
clang::QualType::getCommonPtr
clang::QualType::getLocalFastQualifiers
clang::QualType::setLocalFastQualifiers
clang::QualType::getTypePtr
clang::QualType::getTypePtrOrNull
clang::QualType::getBaseTypeIdentifier
clang::QualType::split
clang::QualType::getAsOpaquePtr
clang::QualType::getFromOpaquePtr
clang::QualType::isCanonical
clang::QualType::isCanonicalAsParam
clang::QualType::isNull
clang::QualType::isLocalConstQualified
clang::QualType::isConstQualified
clang::QualType::isLocalRestrictQualified
clang::QualType::isRestrictQualified
clang::QualType::isLocalVolatileQualified
clang::QualType::isVolatileQualified
clang::QualType::hasLocalQualifiers
clang::QualType::hasQualifiers
clang::QualType::hasLocalNonFastQualifiers
clang::QualType::getLocalQualifiers
clang::QualType::getQualifiers
clang::QualType::getLocalCVRQualifiers
clang::QualType::getCVRQualifiers
clang::QualType::isConstant
clang::QualType::isPODType
clang::QualType::isCXX98PODType
clang::QualType::isCXX11PODType
clang::QualType::isTrivialType
clang::QualType::isTriviallyCopyableType
clang::QualType::mayBeDynamicClass
clang::QualType::mayBeNotDynamicClass
clang::QualType::addConst
clang::QualType::withConst
clang::QualType::addVolatile
clang::QualType::withVolatile
clang::QualType::addRestrict
clang::QualType::withRestrict
clang::QualType::withCVRQualifiers
clang::QualType::addFastQualifiers
clang::QualType::removeLocalConst
clang::QualType::removeLocalVolatile
clang::QualType::removeLocalRestrict
clang::QualType::removeLocalCVRQualifiers
clang::QualType::removeLocalFastQualifiers
clang::QualType::removeLocalFastQualifiers
clang::QualType::withFastQualifiers
clang::QualType::withExactLocalFastQualifiers
clang::QualType::withoutLocalFastQualifiers
clang::QualType::getCanonicalType
clang::QualType::getLocalUnqualifiedType
clang::QualType::getUnqualifiedType
clang::QualType::getSplitUnqualifiedType
clang::QualType::isMoreQualifiedThan
clang::QualType::isAtLeastAsQualifiedAs
clang::QualType::getNonReferenceType
clang::QualType::getNonLValueExprType
clang::QualType::getDesugaredType
clang::QualType::getSplitDesugaredType
clang::QualType::getSingleStepDesugaredType
clang::QualType::IgnoreParens
clang::QualType::getAsString
clang::QualType::getAsString
clang::QualType::getAsString
clang::QualType::getAsString
clang::QualType::print
clang::QualType::print
clang::QualType::print
clang::QualType::getAsStringInternal
clang::QualType::getAsStringInternal
clang::QualType::getAsStringInternal
clang::QualType::StreamedQualTypeHelper
clang::QualType::StreamedQualTypeHelper::T
clang::QualType::StreamedQualTypeHelper::Policy
clang::QualType::StreamedQualTypeHelper::PlaceHolder
clang::QualType::StreamedQualTypeHelper::Indentation
clang::QualType::stream
clang::QualType::dump
clang::QualType::dump
clang::QualType::dump
clang::QualType::Profile
clang::QualType::getAddressSpace
clang::QualType::getObjCGCAttr
clang::QualType::isObjCGCWeak
clang::QualType::isObjCGCStrong
clang::QualType::getObjCLifetime
clang::QualType::hasNonTrivialObjCLifetime
clang::QualType::hasStrongOrWeakObjCLifetime
clang::QualType::isNonWeakInMRRWithObjCWeak
clang::QualType::PrimitiveDefaultInitializeKind
clang::QualType::isNonTrivialToPrimitiveDefaultInitialize
clang::QualType::PrimitiveCopyKind
clang::QualType::isNonTrivialPrimitiveCType
clang::QualType::isNonTrivialToPrimitiveCopy
clang::QualType::isNonTrivialToPrimitiveDestructiveMove
clang::QualType::DestructionKind
clang::QualType::isDestructedType
clang::QualType::isCForbiddenLValueType
clang::QualType::substObjCTypeArgs
clang::QualType::substObjCMemberType
clang::QualType::stripObjCKindOfType
clang::QualType::getAtomicUnqualifiedType
clang::QualType::isConstant
clang::QualType::getDesugaredType
clang::QualType::getSplitDesugaredType
clang::QualType::getSplitUnqualifiedTypeImpl
clang::QualType::getSingleStepDesugaredTypeImpl
clang::QualType::IgnoreParens
clang::QualType::isDestructedTypeImpl
llvm::simplify_type::getSimplifiedValue
clang::ExtQualsTypeCommonBase::BaseType
clang::ExtQualsTypeCommonBase::CanonicalType
clang::ExtQuals::Quals
clang::ExtQuals::this_
clang::ExtQuals::getQualifiers
clang::ExtQuals::hasObjCGCAttr
clang::ExtQuals::getObjCGCAttr
clang::ExtQuals::hasObjCLifetime
clang::ExtQuals::getObjCLifetime
clang::ExtQuals::hasAddressSpace
clang::ExtQuals::getAddressSpace
clang::ExtQuals::getBaseType
clang::ExtQuals::Profile
clang::ExtQuals::Profile
clang::Type::TypeClass
clang::Type::TypeBitfields
clang::Type::TypeBitfields::TC
clang::Type::TypeBitfields::Dependent
clang::Type::TypeBitfields::InstantiationDependent
clang::Type::TypeBitfields::VariablyModified
clang::Type::TypeBitfields::ContainsUnexpandedParameterPack
clang::Type::TypeBitfields::CacheValid
clang::Type::TypeBitfields::CachedLinkage
clang::Type::TypeBitfields::CachedLocalOrUnnamed
clang::Type::TypeBitfields::FromAST
clang::Type::TypeBitfields::isCacheValid
clang::Type::TypeBitfields::getLinkage
clang::Type::TypeBitfields::hasLocalOrUnnamedType
clang::Type::ArrayTypeBitfields
clang::Type::ArrayTypeBitfields::IndexTypeQuals
clang::Type::ArrayTypeBitfields::SizeModifier
clang::Type::BuiltinTypeBitfields
clang::Type::BuiltinTypeBitfields::Kind
clang::Type::FunctionTypeBitfields
clang::Type::FunctionTypeBitfields::ExtInfo
clang::Type::FunctionTypeBitfields::RefQualifier
clang::Type::FunctionTypeBitfields::FastTypeQuals
clang::Type::FunctionTypeBitfields::HasExtQuals
clang::Type::FunctionTypeBitfields::NumParams
clang::Type::FunctionTypeBitfields::ExceptionSpecType
clang::Type::FunctionTypeBitfields::HasExtParameterInfos
clang::Type::FunctionTypeBitfields::Variadic
clang::Type::FunctionTypeBitfields::HasTrailingReturn
clang::Type::ObjCObjectTypeBitfields
clang::Type::ObjCObjectTypeBitfields::NumTypeArgs
clang::Type::ObjCObjectTypeBitfields::NumProtocols
clang::Type::ObjCObjectTypeBitfields::IsKindOf
clang::Type::ReferenceTypeBitfields
clang::Type::ReferenceTypeBitfields::SpelledAsLValue
clang::Type::ReferenceTypeBitfields::InnerRef
clang::Type::TypeWithKeywordBitfields
clang::Type::TypeWithKeywordBitfields::Keyword
clang::Type::ElaboratedTypeBitfields
clang::Type::ElaboratedTypeBitfields::HasOwnedTagDecl
clang::Type::VectorTypeBitfields
clang::Type::VectorTypeBitfields::VecKind
clang::Type::VectorTypeBitfields::NumElements
clang::Type::AttributedTypeBitfields
clang::Type::AttributedTypeBitfields::AttrKind
clang::Type::AutoTypeBitfields
clang::Type::AutoTypeBitfields::Keyword
clang::Type::SubstTemplateTypeParmPackTypeBitfields
clang::Type::SubstTemplateTypeParmPackTypeBitfields::NumArgs
clang::Type::TemplateSpecializationTypeBitfields
clang::Type::TemplateSpecializationTypeBitfields::TypeAlias
clang::Type::TemplateSpecializationTypeBitfields::NumArgs
clang::Type::DependentTemplateSpecializationTypeBitfields
clang::Type::DependentTemplateSpecializationTypeBitfields::NumArgs
clang::Type::PackExpansionTypeBitfields
clang::Type::PackExpansionTypeBitfields::NumExpansions
clang::Type::(anonymous union)::TypeBits
clang::Type::(anonymous union)::ArrayTypeBits
clang::Type::(anonymous union)::AttributedTypeBits
clang::Type::(anonymous union)::AutoTypeBits
clang::Type::(anonymous union)::BuiltinTypeBits
clang::Type::(anonymous union)::FunctionTypeBits
clang::Type::(anonymous union)::ObjCObjectTypeBits
clang::Type::(anonymous union)::ReferenceTypeBits
clang::Type::(anonymous union)::TypeWithKeywordBits
clang::Type::(anonymous union)::ElaboratedTypeBits
clang::Type::(anonymous union)::VectorTypeBits
clang::Type::(anonymous union)::SubstTemplateTypeParmPackTypeBits
clang::Type::(anonymous union)::TemplateSpecializationTypeBits
clang::Type::(anonymous union)::DependentTemplateSpecializationTypeBits
clang::Type::(anonymous union)::PackExpansionTypeBits
clang::Type::setFromAST
clang::Type::this_
clang::Type::setDependent
clang::Type::setInstantiationDependent
clang::Type::setVariablyModified
clang::Type::setContainsUnexpandedParameterPack
clang::Type::getTypeClass
clang::Type::isFromAST
clang::Type::containsUnexpandedParameterPack
clang::Type::isCanonicalUnqualified
clang::Type::getLocallyUnqualifiedSingleStepDesugaredType
clang::Type::isIncompleteType
clang::Type::isIncompleteOrObjectType
clang::Type::isObjectType
clang::Type::isLiteralType
clang::Type::isStandardLayoutType
clang::Type::isBuiltinType
clang::Type::isSpecificBuiltinType
clang::Type::isPlaceholderType
clang::Type::getAsPlaceholderType
clang::Type::isSpecificPlaceholderType
clang::Type::isNonOverloadPlaceholderType
clang::Type::isIntegerType
clang::Type::isEnumeralType
clang::Type::isScopedEnumeralType
clang::Type::isBooleanType
clang::Type::isCharType
clang::Type::isWideCharType
clang::Type::isChar8Type
clang::Type::isChar16Type
clang::Type::isChar32Type
clang::Type::isAnyCharacterType
clang::Type::isIntegralType
clang::Type::isIntegralOrEnumerationType
clang::Type::isIntegralOrUnscopedEnumerationType
clang::Type::isRealFloatingType
clang::Type::isComplexType
clang::Type::isAnyComplexType
clang::Type::isFloatingType
clang::Type::isHalfType
clang::Type::isFloat16Type
clang::Type::isFloat128Type
clang::Type::isRealType
clang::Type::isArithmeticType
clang::Type::isVoidType
clang::Type::isScalarType
clang::Type::isAggregateType
clang::Type::isFundamentalType
clang::Type::isCompoundType
clang::Type::isFunctionType
clang::Type::isFunctionNoProtoType
clang::Type::isFunctionProtoType
clang::Type::isPointerType
clang::Type::isAnyPointerType
clang::Type::isBlockPointerType
clang::Type::isVoidPointerType
clang::Type::isReferenceType
clang::Type::isLValueReferenceType
clang::Type::isRValueReferenceType
clang::Type::isFunctionPointerType
clang::Type::isMemberPointerType
clang::Type::isMemberFunctionPointerType
clang::Type::isMemberDataPointerType
clang::Type::isArrayType
clang::Type::isConstantArrayType
clang::Type::isIncompleteArrayType
clang::Type::isVariableArrayType
clang::Type::isDependentSizedArrayType
clang::Type::isRecordType
clang::Type::isClassType
clang::Type::isStructureType
clang::Type::isObjCBoxableRecordType
clang::Type::isInterfaceType
clang::Type::isStructureOrClassType
clang::Type::isUnionType
clang::Type::isComplexIntegerType
clang::Type::isVectorType
clang::Type::isExtVectorType
clang::Type::isDependentAddressSpaceType
clang::Type::isObjCObjectPointerType
clang::Type::isObjCRetainableType
clang::Type::isObjCLifetimeType
clang::Type::isObjCIndirectLifetimeType
clang::Type::isObjCNSObjectType
clang::Type::isObjCIndependentClassType
clang::Type::isObjCObjectType
clang::Type::isObjCQualifiedInterfaceType
clang::Type::isObjCQualifiedIdType
clang::Type::isObjCQualifiedClassType
clang::Type::isObjCObjectOrInterfaceType
clang::Type::isObjCIdType
clang::Type::isDecltypeType
clang::Type::isObjCInertUnsafeUnretainedType
clang::Type::isObjCIdOrObjectKindOfType
clang::Type::isObjCClassType
clang::Type::isObjCClassOrClassKindOfType
clang::Type::isBlockCompatibleObjCPointerType
clang::Type::isObjCSelType
clang::Type::isObjCBuiltinType
clang::Type::isObjCARCBridgableType
clang::Type::isCARCBridgableType
clang::Type::isTemplateTypeParmType
clang::Type::isNullPtrType
clang::Type::isAlignValT
clang::Type::isStdByteType
clang::Type::isAtomicType
clang::Type::isImageType
clang::Type::isSamplerT
clang::Type::isEventT
clang::Type::isClkEventT
clang::Type::isQueueT
clang::Type::isReserveIDT
clang::Type::isOCLIntelSubgroupAVCType
clang::Type::isOCLExtOpaqueType
clang::Type::isPipeType
clang::Type::isOpenCLSpecificType
clang::Type::isObjCARCImplicitlyUnretainedType
clang::Type::getObjCARCImplicitLifetime
clang::Type::ScalarTypeKind
clang::Type::getScalarTypeKind
clang::Type::isDependentType
clang::Type::isInstantiationDependentType
clang::Type::isUndeducedType
clang::Type::isVariablyModifiedType
clang::Type::hasSizedVLAType
clang::Type::hasUnnamedOrLocalType
clang::Type::isOverloadableType
clang::Type::isElaboratedTypeSpecifier
clang::Type::canDecayToPointerType
clang::Type::hasPointerRepresentation
clang::Type::hasObjCPointerRepresentation
clang::Type::hasIntegerRepresentation
clang::Type::hasSignedIntegerRepresentation
clang::Type::hasUnsignedIntegerRepresentation
clang::Type::hasFloatingRepresentation
clang::Type::getAsStructureType
clang::Type::getAsUnionType
clang::Type::getAsComplexIntegerType
clang::Type::getAsObjCInterfaceType
clang::Type::getAsObjCInterfacePointerType
clang::Type::getAsObjCQualifiedIdType
clang::Type::getAsObjCQualifiedClassType
clang::Type::getAsObjCQualifiedInterfaceType
clang::Type::getAsCXXRecordDecl
clang::Type::getAsRecordDecl
clang::Type::getAsTagDecl
clang::Type::getPointeeCXXRecordDecl
clang::Type::getContainedDeducedType
clang::Type::getContainedAutoType
clang::Type::hasAutoForTrailingReturnType
clang::Type::getAs
clang::Type::getAsAdjusted
clang::Type::getAsArrayTypeUnsafe
clang::Type::castAs
clang::Type::castAsArrayTypeUnsafe
clang::Type::hasAttr
clang::Type::getBaseElementTypeUnsafe
clang::Type::getArrayElementTypeNoTypeQual
clang::Type::getPointeeOrArrayElementType
clang::Type::getPointeeType
clang::Type::getUnqualifiedDesugaredType
clang::Type::isPromotableIntegerType
clang::Type::isSignedIntegerType
clang::Type::isUnsignedIntegerType
clang::Type::isSignedIntegerOrEnumerationType
clang::Type::isUnsignedIntegerOrEnumerationType
clang::Type::isFixedPointType
clang::Type::isFixedPointOrIntegerType
clang::Type::isSaturatedFixedPointType
clang::Type::isUnsaturatedFixedPointType
clang::Type::isSignedFixedPointType
clang::Type::isUnsignedFixedPointType
clang::Type::isConstantSizeType
clang::Type::isSpecifierType
clang::Type::getLinkage
clang::Type::getVisibility
clang::Type::isVisibilityExplicit
clang::Type::getLinkageAndVisibility
clang::Type::isLinkageValid
clang::Type::getNullability
clang::Type::canHaveNullability
clang::Type::getObjCSubstitutions
clang::Type::acceptsObjCTypeParams
clang::Type::getTypeClassName
clang::Type::getCanonicalTypeInternal
clang::Type::getCanonicalTypeUnqualified
clang::Type::dump
clang::Type::dump
clang::BuiltinType::Kind
clang::BuiltinType::getKind
clang::BuiltinType::getName
clang::BuiltinType::getNameAsCString
clang::BuiltinType::isSugared
clang::BuiltinType::desugar
clang::BuiltinType::isInteger
clang::BuiltinType::isSignedInteger
clang::BuiltinType::isUnsignedInteger
clang::BuiltinType::isFloatingPoint
clang::BuiltinType::isPlaceholderTypeKind
clang::BuiltinType::isPlaceholderType
clang::BuiltinType::isNonOverloadPlaceholderType
clang::BuiltinType::classof
clang::ComplexType::ElementType
clang::ComplexType::getElementType
clang::ComplexType::isSugared
clang::ComplexType::desugar
clang::ComplexType::Profile
clang::ComplexType::Profile
clang::ComplexType::classof
clang::ParenType::Inner
clang::ParenType::getInnerType
clang::ParenType::isSugared
clang::ParenType::desugar
clang::ParenType::Profile
clang::ParenType::Profile
clang::ParenType::classof
clang::PointerType::PointeeType
clang::PointerType::getPointeeType
clang::PointerType::isAddressSpaceOverlapping
clang::PointerType::isSugared
clang::PointerType::desugar
clang::PointerType::Profile
clang::PointerType::Profile
clang::PointerType::classof
clang::AdjustedType::OriginalTy
clang::AdjustedType::AdjustedTy
clang::AdjustedType::getOriginalType
clang::AdjustedType::getAdjustedType
clang::AdjustedType::isSugared
clang::AdjustedType::desugar
clang::AdjustedType::Profile
clang::AdjustedType::Profile
clang::AdjustedType::classof
clang::DecayedType::getDecayedType
clang::DecayedType::getPointeeType
clang::DecayedType::classof
clang::BlockPointerType::PointeeType
clang::BlockPointerType::getPointeeType
clang::BlockPointerType::isSugared
clang::BlockPointerType::desugar
clang::BlockPointerType::Profile
clang::BlockPointerType::Profile
clang::BlockPointerType::classof
clang::ReferenceType::PointeeType
clang::ReferenceType::isSpelledAsLValue
clang::ReferenceType::isInnerRef
clang::ReferenceType::getPointeeTypeAsWritten
clang::ReferenceType::getPointeeType
clang::ReferenceType::Profile
clang::ReferenceType::Profile
clang::ReferenceType::classof
clang::LValueReferenceType::isSugared
clang::LValueReferenceType::desugar
clang::LValueReferenceType::classof
clang::RValueReferenceType::isSugared
clang::RValueReferenceType::desugar
clang::RValueReferenceType::classof
clang::MemberPointerType::PointeeType
clang::MemberPointerType::Class
clang::MemberPointerType::getPointeeType
clang::MemberPointerType::isMemberFunctionPointer
clang::MemberPointerType::isMemberDataPointer
clang::MemberPointerType::getClass
clang::MemberPointerType::getMostRecentCXXRecordDecl
clang::MemberPointerType::isSugared
clang::MemberPointerType::desugar
clang::MemberPointerType::Profile
clang::MemberPointerType::Profile
clang::MemberPointerType::classof
clang::ArrayType::ArraySizeModifier
clang::ArrayType::ElementType
clang::ArrayType::getElementType
clang::ArrayType::getSizeModifier
clang::ArrayType::getIndexTypeQualifiers
clang::ArrayType::getIndexTypeCVRQualifiers
clang::ArrayType::classof
clang::ConstantArrayType::Size
clang::ConstantArrayType::getSize
clang::ConstantArrayType::isSugared
clang::ConstantArrayType::desugar
clang::ConstantArrayType::getNumAddressingBits
clang::ConstantArrayType::getMaxSizeBits
clang::ConstantArrayType::Profile
clang::ConstantArrayType::Profile
clang::ConstantArrayType::classof
clang::IncompleteArrayType::isSugared
clang::IncompleteArrayType::desugar
clang::IncompleteArrayType::classof
clang::IncompleteArrayType::Profile
clang::IncompleteArrayType::Profile
clang::VariableArrayType::SizeExpr
clang::VariableArrayType::Brackets
clang::VariableArrayType::getSizeExpr
clang::VariableArrayType::getBracketsRange
clang::VariableArrayType::getLBracketLoc
clang::VariableArrayType::getRBracketLoc
clang::VariableArrayType::isSugared
clang::VariableArrayType::desugar
clang::VariableArrayType::classof
clang::VariableArrayType::Profile
clang::DependentSizedArrayType::Context
clang::DependentSizedArrayType::SizeExpr
clang::DependentSizedArrayType::Brackets
clang::DependentSizedArrayType::getSizeExpr
clang::DependentSizedArrayType::getBracketsRange
clang::DependentSizedArrayType::getLBracketLoc
clang::DependentSizedArrayType::getRBracketLoc
clang::DependentSizedArrayType::isSugared
clang::DependentSizedArrayType::desugar
clang::DependentSizedArrayType::classof
clang::DependentSizedArrayType::Profile
clang::DependentSizedArrayType::Profile
clang::DependentAddressSpaceType::Context
clang::DependentAddressSpaceType::AddrSpaceExpr
clang::DependentAddressSpaceType::PointeeType
clang::DependentAddressSpaceType::loc
clang::DependentAddressSpaceType::getAddrSpaceExpr
clang::DependentAddressSpaceType::getPointeeType
clang::DependentAddressSpaceType::getAttributeLoc
clang::DependentAddressSpaceType::isSugared
clang::DependentAddressSpaceType::desugar
clang::DependentAddressSpaceType::classof
clang::DependentAddressSpaceType::Profile
clang::DependentAddressSpaceType::Profile
clang::DependentSizedExtVectorType::Context
clang::DependentSizedExtVectorType::SizeExpr
clang::DependentSizedExtVectorType::ElementType
clang::DependentSizedExtVectorType::loc
clang::DependentSizedExtVectorType::getSizeExpr
clang::DependentSizedExtVectorType::getElementType
clang::DependentSizedExtVectorType::getAttributeLoc
clang::DependentSizedExtVectorType::isSugared
clang::DependentSizedExtVectorType::desugar
clang::DependentSizedExtVectorType::classof
clang::DependentSizedExtVectorType::Profile
clang::DependentSizedExtVectorType::Profile
clang::VectorType::VectorKind
clang::VectorType::ElementType
clang::VectorType::getElementType
clang::VectorType::getNumElements
clang::VectorType::isVectorSizeTooLarge
clang::VectorType::isSugared
clang::VectorType::desugar
clang::VectorType::getVectorKind
clang::VectorType::Profile
clang::VectorType::Profile
clang::VectorType::classof
clang::DependentVectorType::Context
clang::DependentVectorType::ElementType
clang::DependentVectorType::SizeExpr
clang::DependentVectorType::Loc
clang::DependentVectorType::getSizeExpr
clang::DependentVectorType::getElementType
clang::DependentVectorType::getAttributeLoc
clang::DependentVectorType::getVectorKind
clang::DependentVectorType::isSugared
clang::DependentVectorType::desugar
clang::DependentVectorType::classof
clang::DependentVectorType::Profile
clang::DependentVectorType::Profile
clang::ExtVectorType::getPointAccessorIdx
clang::ExtVectorType::getNumericAccessorIdx
clang::ExtVectorType::getAccessorIdx
clang::ExtVectorType::isAccessorWithinNumElements
clang::ExtVectorType::isSugared
clang::ExtVectorType::desugar
clang::ExtVectorType::classof
clang::FunctionType::ResultType
clang::FunctionType::ExtParameterInfo
clang::FunctionType::ExtParameterInfo::Data
clang::FunctionType::ExtParameterInfo::getABI
clang::FunctionType::ExtParameterInfo::withABI
clang::FunctionType::ExtParameterInfo::isConsumed
clang::FunctionType::ExtParameterInfo::withIsConsumed
clang::FunctionType::ExtParameterInfo::hasPassObjectSize
clang::FunctionType::ExtParameterInfo::withHasPassObjectSize
clang::FunctionType::ExtParameterInfo::isNoEscape
clang::FunctionType::ExtParameterInfo::withIsNoEscape
clang::FunctionType::ExtParameterInfo::getOpaqueValue
clang::FunctionType::ExtParameterInfo::getFromOpaqueValue
clang::FunctionType::ExtInfo
clang::FunctionType::ExtInfo::Bits
clang::FunctionType::ExtInfo::getNoReturn
clang::FunctionType::ExtInfo::getProducesResult
clang::FunctionType::ExtInfo::getNoCallerSavedRegs
clang::FunctionType::ExtInfo::getNoCfCheck
clang::FunctionType::ExtInfo::getHasRegParm
clang::FunctionType::ExtInfo::getRegParm
clang::FunctionType::ExtInfo::getCC
clang::FunctionType::ExtInfo::withNoReturn
clang::FunctionType::ExtInfo::withProducesResult
clang::FunctionType::ExtInfo::withNoCallerSavedRegs
clang::FunctionType::ExtInfo::withNoCfCheck
clang::FunctionType::ExtInfo::withRegParm
clang::FunctionType::ExtInfo::withCallingConv
clang::FunctionType::ExtInfo::Profile
clang::FunctionType::ExceptionType
clang::FunctionType::ExceptionType::Type
clang::FunctionType::FunctionTypeExtraBitfields
clang::FunctionType::FunctionTypeExtraBitfields::NumExceptionType
clang::FunctionType::getFastTypeQuals
clang::FunctionType::getReturnType
clang::FunctionType::getHasRegParm
clang::FunctionType::getRegParmType
clang::FunctionType::getNoReturnAttr
clang::FunctionType::getCallConv
clang::FunctionType::getExtInfo
clang::FunctionType::isConst
clang::FunctionType::isVolatile
clang::FunctionType::isRestrict
clang::FunctionType::getCallResultType
clang::FunctionType::getNameForCallConv
clang::FunctionType::classof
clang::FunctionNoProtoType::isSugared
clang::FunctionNoProtoType::desugar
clang::FunctionNoProtoType::Profile
clang::FunctionNoProtoType::Profile
clang::FunctionNoProtoType::classof
clang::FunctionProtoType::ExceptionSpecInfo
clang::FunctionProtoType::ExceptionSpecInfo::Type
clang::FunctionProtoType::ExceptionSpecInfo::Exceptions
clang::FunctionProtoType::ExceptionSpecInfo::NoexceptExpr
clang::FunctionProtoType::ExceptionSpecInfo::SourceDecl
clang::FunctionProtoType::ExceptionSpecInfo::SourceTemplate
clang::FunctionProtoType::ExtProtoInfo
clang::FunctionProtoType::ExtProtoInfo::ExtInfo
clang::FunctionProtoType::ExtProtoInfo::Variadic
clang::FunctionProtoType::ExtProtoInfo::HasTrailingReturn
clang::FunctionProtoType::ExtProtoInfo::TypeQuals
clang::FunctionProtoType::ExtProtoInfo::RefQualifier
clang::FunctionProtoType::ExtProtoInfo::ExceptionSpec
clang::FunctionProtoType::ExtProtoInfo::ExtParameterInfos
clang::FunctionProtoType::ExtProtoInfo::withExceptionSpec
clang::FunctionProtoType::numTrailingObjects
clang::FunctionProtoType::containsAnyUnexpandedParameterPack
clang::FunctionProtoType::ExceptionSpecSizeHolder
clang::FunctionProtoType::ExceptionSpecSizeHolder::NumExceptionType
clang::FunctionProtoType::ExceptionSpecSizeHolder::NumExprPtr
clang::FunctionProtoType::ExceptionSpecSizeHolder::NumFunctionDeclPtr
clang::FunctionProtoType::getExceptionSpecSize
clang::FunctionProtoType::getExceptionSpecSize
clang::FunctionProtoType::hasExtraBitfields
clang::FunctionProtoType::hasExtraBitfields
clang::FunctionProtoType::hasExtQualifiers
clang::FunctionProtoType::getNumParams
clang::FunctionProtoType::getParamType
clang::FunctionProtoType::getParamTypes
clang::FunctionProtoType::getExtProtoInfo
clang::FunctionProtoType::getExceptionSpecType
clang::FunctionProtoType::hasExceptionSpec
clang::FunctionProtoType::hasDynamicExceptionSpec
clang::FunctionProtoType::hasNoexceptExceptionSpec
clang::FunctionProtoType::hasDependentExceptionSpec
clang::FunctionProtoType::hasInstantiationDependentExceptionSpec
clang::FunctionProtoType::getNumExceptions
clang::FunctionProtoType::getExceptionType
clang::FunctionProtoType::getNoexceptExpr
clang::FunctionProtoType::getExceptionSpecDecl
clang::FunctionProtoType::getExceptionSpecTemplate
clang::FunctionProtoType::canThrow
clang::FunctionProtoType::isNothrow
clang::FunctionProtoType::isVariadic
clang::FunctionProtoType::isTemplateVariadic
clang::FunctionProtoType::hasTrailingReturn
clang::FunctionProtoType::getMethodQuals
clang::FunctionProtoType::getRefQualifier
clang::FunctionProtoType::param_types
clang::FunctionProtoType::param_type_begin
clang::FunctionProtoType::param_type_end
clang::FunctionProtoType::exceptions
clang::FunctionProtoType::exception_begin
clang::FunctionProtoType::exception_end
clang::FunctionProtoType::hasExtParameterInfos
clang::FunctionProtoType::getExtParameterInfos
clang::FunctionProtoType::getExtParameterInfosOrNull
clang::FunctionProtoType::getExtParameterInfo
clang::FunctionProtoType::getParameterABI
clang::FunctionProtoType::isParamConsumed
clang::FunctionProtoType::isSugared
clang::FunctionProtoType::desugar
clang::FunctionProtoType::printExceptionSpecification
clang::FunctionProtoType::classof
clang::FunctionProtoType::Profile
clang::FunctionProtoType::Profile
clang::UnresolvedUsingType::Decl
clang::UnresolvedUsingType::getDecl
clang::UnresolvedUsingType::isSugared
clang::UnresolvedUsingType::desugar
clang::UnresolvedUsingType::classof
clang::UnresolvedUsingType::Profile
clang::UnresolvedUsingType::Profile
clang::TypedefType::Decl
clang::TypedefType::getDecl
clang::TypedefType::isSugared
clang::TypedefType::desugar
clang::TypedefType::classof
clang::TypeOfExprType::TOExpr
clang::TypeOfExprType::getUnderlyingExpr
clang::TypeOfExprType::desugar
clang::TypeOfExprType::isSugared
clang::TypeOfExprType::classof
clang::DependentTypeOfExprType::Context
clang::DependentTypeOfExprType::Profile
clang::DependentTypeOfExprType::Profile
clang::TypeOfType::TOType
clang::TypeOfType::getUnderlyingType
clang::TypeOfType::desugar
clang::TypeOfType::isSugared
clang::TypeOfType::classof
clang::DecltypeType::E
clang::DecltypeType::UnderlyingType
clang::DecltypeType::getUnderlyingExpr
clang::DecltypeType::getUnderlyingType
clang::DecltypeType::desugar
clang::DecltypeType::isSugared
clang::DecltypeType::classof
clang::DependentDecltypeType::Context
clang::DependentDecltypeType::Profile
clang::DependentDecltypeType::Profile
clang::UnaryTransformType::UTTKind
clang::UnaryTransformType::BaseType
clang::UnaryTransformType::UnderlyingType
clang::UnaryTransformType::UKind
clang::UnaryTransformType::isSugared
clang::UnaryTransformType::desugar
clang::UnaryTransformType::getUnderlyingType
clang::UnaryTransformType::getBaseType
clang::UnaryTransformType::getUTTKind
clang::UnaryTransformType::classof
clang::DependentUnaryTransformType::Profile
clang::DependentUnaryTransformType::Profile
clang::TagType::decl
clang::TagType::getDecl
clang::TagType::isBeingDefined
clang::TagType::classof
clang::RecordType::getDecl
clang::RecordType::hasConstFields
clang::RecordType::isSugared
clang::RecordType::desugar
clang::RecordType::classof
clang::EnumType::getDecl
clang::EnumType::isSugared
clang::EnumType::desugar
clang::EnumType::classof
clang::AttributedType::ModifiedType
clang::AttributedType::EquivalentType
clang::AttributedType::getAttrKind
clang::AttributedType::getModifiedType
clang::AttributedType::getEquivalentType
clang::AttributedType::isSugared
clang::AttributedType::desugar
clang::AttributedType::isQualifier
clang::AttributedType::isMSTypeSpec
clang::AttributedType::isCallingConv
clang::AttributedType::getImmediateNullability
clang::AttributedType::getNullabilityAttrKind
clang::AttributedType::stripOuterNullability
clang::AttributedType::Profile
clang::AttributedType::Profile
clang::AttributedType::classof
clang::TemplateTypeParmType::CanonicalTTPTInfo
clang::TemplateTypeParmType::CanonicalTTPTInfo::Depth
clang::TemplateTypeParmType::CanonicalTTPTInfo::ParameterPack
clang::TemplateTypeParmType::CanonicalTTPTInfo::Index
clang::TemplateTypeParmType::(anonymous union)::CanTTPTInfo
clang::TemplateTypeParmType::(anonymous union)::TTPDecl
clang::TemplateTypeParmType::getCanTTPTInfo
clang::TemplateTypeParmType::getDepth
clang::TemplateTypeParmType::getIndex
clang::TemplateTypeParmType::isParameterPack
clang::TemplateTypeParmType::getDecl
clang::TemplateTypeParmType::getIdentifier
clang::TemplateTypeParmType::isSugared
clang::TemplateTypeParmType::desugar
clang::TemplateTypeParmType::Profile
clang::TemplateTypeParmType::Profile
clang::TemplateTypeParmType::classof
clang::SubstTemplateTypeParmType::Replaced
clang::SubstTemplateTypeParmType::getReplacedParameter
clang::SubstTemplateTypeParmType::getReplacementType
clang::SubstTemplateTypeParmType::isSugared
clang::SubstTemplateTypeParmType::desugar
clang::SubstTemplateTypeParmType::Profile
clang::SubstTemplateTypeParmType::Profile
clang::SubstTemplateTypeParmType::classof
clang::SubstTemplateTypeParmPackType::Replaced
clang::SubstTemplateTypeParmPackType::Arguments
clang::SubstTemplateTypeParmPackType::getIdentifier
clang::SubstTemplateTypeParmPackType::getReplacedParameter
clang::SubstTemplateTypeParmPackType::getNumArgs
clang::SubstTemplateTypeParmPackType::isSugared
clang::SubstTemplateTypeParmPackType::desugar
clang::SubstTemplateTypeParmPackType::getArgumentPack
clang::SubstTemplateTypeParmPackType::Profile
clang::SubstTemplateTypeParmPackType::Profile
clang::SubstTemplateTypeParmPackType::classof
clang::DeducedType::isSugared
clang::DeducedType::desugar
clang::DeducedType::getDeducedType
clang::DeducedType::isDeduced
clang::DeducedType::classof
clang::AutoType::isDecltypeAuto
clang::AutoType::getKeyword
clang::AutoType::Profile
clang::AutoType::Profile
clang::AutoType::classof
clang::DeducedTemplateSpecializationType::Template
clang::DeducedTemplateSpecializationType::getTemplateName
clang::DeducedTemplateSpecializationType::Profile
clang::DeducedTemplateSpecializationType::Profile
clang::DeducedTemplateSpecializationType::classof
clang::TemplateSpecializationType::Template
clang::TemplateSpecializationType::anyDependentTemplateArguments
clang::TemplateSpecializationType::anyDependentTemplateArguments
clang::TemplateSpecializationType::isCurrentInstantiation
clang::TemplateSpecializationType::isTypeAlias
clang::TemplateSpecializationType::getAliasedType
clang::TemplateSpecializationType::begin
clang::TemplateSpecializationType::end
clang::TemplateSpecializationType::getTemplateName
clang::TemplateSpecializationType::getArgs
clang::TemplateSpecializationType::getNumArgs
clang::TemplateSpecializationType::getArg
clang::TemplateSpecializationType::template_arguments
clang::TemplateSpecializationType::isSugared
clang::TemplateSpecializationType::desugar
clang::TemplateSpecializationType::Profile
clang::TemplateSpecializationType::Profile
clang::TemplateSpecializationType::classof
clang::InjectedClassNameType::Decl
clang::InjectedClassNameType::InjectedType
clang::InjectedClassNameType::getInjectedSpecializationType
clang::InjectedClassNameType::getInjectedTST
clang::InjectedClassNameType::getTemplateName
clang::InjectedClassNameType::getDecl
clang::InjectedClassNameType::isSugared
clang::InjectedClassNameType::desugar
clang::InjectedClassNameType::classof
clang::TypeWithKeyword::getKeyword
clang::TypeWithKeyword::getKeywordForTypeSpec
clang::TypeWithKeyword::getTagTypeKindForTypeSpec
clang::TypeWithKeyword::getKeywordForTagTypeKind
clang::TypeWithKeyword::getTagTypeKindForKeyword
clang::TypeWithKeyword::KeywordIsTagTypeKind
clang::TypeWithKeyword::getKeywordName
clang::TypeWithKeyword::getTagTypeKindName
clang::TypeWithKeyword::CannotCastToThisType
clang::TypeWithKeyword::classof
clang::ElaboratedType::NNS
clang::ElaboratedType::NamedType
clang::ElaboratedType::getQualifier
clang::ElaboratedType::getNamedType
clang::ElaboratedType::desugar
clang::ElaboratedType::isSugared
clang::ElaboratedType::getOwnedTagDecl
clang::ElaboratedType::Profile
clang::ElaboratedType::Profile
clang::ElaboratedType::classof
clang::DependentNameType::NNS
clang::DependentNameType::Name
clang::DependentNameType::getQualifier
clang::DependentNameType::getIdentifier
clang::DependentNameType::isSugared
clang::DependentNameType::desugar
clang::DependentNameType::Profile
clang::DependentNameType::Profile
clang::DependentNameType::classof
clang::DependentTemplateSpecializationType::NNS
clang::DependentTemplateSpecializationType::Name
clang::DependentTemplateSpecializationType::getArgBuffer
clang::DependentTemplateSpecializationType::getArgBuffer
clang::DependentTemplateSpecializationType::getQualifier
clang::DependentTemplateSpecializationType::getIdentifier
clang::DependentTemplateSpecializationType::getArgs
clang::DependentTemplateSpecializationType::getNumArgs
clang::DependentTemplateSpecializationType::getArg
clang::DependentTemplateSpecializationType::template_arguments
clang::DependentTemplateSpecializationType::begin
clang::DependentTemplateSpecializationType::end
clang::DependentTemplateSpecializationType::isSugared
clang::DependentTemplateSpecializationType::desugar
clang::DependentTemplateSpecializationType::Profile
clang::DependentTemplateSpecializationType::Profile
clang::DependentTemplateSpecializationType::classof
clang::PackExpansionType::Pattern
clang::PackExpansionType::getPattern
clang::PackExpansionType::getNumExpansions
clang::PackExpansionType::isSugared
clang::PackExpansionType::desugar
clang::PackExpansionType::Profile
clang::PackExpansionType::Profile
clang::PackExpansionType::classof
clang::ObjCProtocolQualifiers::getProtocolStorage
clang::ObjCProtocolQualifiers::getProtocolStorage
clang::ObjCProtocolQualifiers::setNumProtocols
clang::ObjCProtocolQualifiers::initialize
clang::ObjCProtocolQualifiers::quals
clang::ObjCProtocolQualifiers::qual_begin
clang::ObjCProtocolQualifiers::qual_end
clang::ObjCProtocolQualifiers::qual_empty
clang::ObjCProtocolQualifiers::getNumProtocols
clang::ObjCProtocolQualifiers::getProtocol
clang::ObjCProtocolQualifiers::getProtocols
clang::ObjCTypeParamType::NumProtocols
clang::ObjCTypeParamType::OTPDecl
clang::ObjCTypeParamType::getProtocolStorageImpl
clang::ObjCTypeParamType::getNumProtocolsImpl
clang::ObjCTypeParamType::setNumProtocolsImpl
clang::ObjCTypeParamType::isSugared
clang::ObjCTypeParamType::desugar
clang::ObjCTypeParamType::classof
clang::ObjCTypeParamType::Profile
clang::ObjCTypeParamType::Profile
clang::ObjCTypeParamType::getDecl
clang::ObjCObjectType::BaseType
clang::ObjCObjectType::CachedSuperClassType
clang::ObjCObjectType::getTypeArgStorage
clang::ObjCObjectType::getTypeArgStorage
clang::ObjCObjectType::getProtocolStorageImpl
clang::ObjCObjectType::getNumProtocolsImpl
clang::ObjCObjectType::setNumProtocolsImpl
clang::ObjCObjectType::Nonce_ObjCInterface
clang::ObjCObjectType::computeSuperClassTypeSlow
clang::ObjCObjectType::getBaseType
clang::ObjCObjectType::isObjCId
clang::ObjCObjectType::isObjCClass
clang::ObjCObjectType::isObjCUnqualifiedId
clang::ObjCObjectType::isObjCUnqualifiedClass
clang::ObjCObjectType::isObjCUnqualifiedIdOrClass
clang::ObjCObjectType::isObjCQualifiedId
clang::ObjCObjectType::isObjCQualifiedClass
clang::ObjCObjectType::getInterface
clang::ObjCObjectType::isSpecialized
clang::ObjCObjectType::isSpecializedAsWritten
clang::ObjCObjectType::isUnspecialized
clang::ObjCObjectType::isUnspecializedAsWritten
clang::ObjCObjectType::getTypeArgs
clang::ObjCObjectType::getTypeArgsAsWritten
clang::ObjCObjectType::isKindOfTypeAsWritten
clang::ObjCObjectType::isKindOfType
clang::ObjCObjectType::getSuperClassType
clang::ObjCObjectType::stripObjCKindOfTypeAndQuals
clang::ObjCObjectType::isSugared
clang::ObjCObjectType::desugar
clang::ObjCObjectType::classof
clang::ObjCObjectTypeImpl::Profile
clang::ObjCObjectTypeImpl::Profile
clang::ObjCObjectType::getTypeArgStorage
clang::ObjCObjectType::getProtocolStorageImpl
clang::ObjCTypeParamType::getProtocolStorageImpl
clang::ObjCInterfaceType::Decl
clang::ObjCInterfaceType::getDecl
clang::ObjCInterfaceType::isSugared
clang::ObjCInterfaceType::desugar
clang::ObjCInterfaceType::classof
clang::ObjCObjectType::getInterface
clang::ObjCObjectPointerType::PointeeType
clang::ObjCObjectPointerType::getPointeeType
clang::ObjCObjectPointerType::getObjectType
clang::ObjCObjectPointerType::getInterfaceType
clang::ObjCObjectPointerType::getInterfaceDecl
clang::ObjCObjectPointerType::isObjCIdType
clang::ObjCObjectPointerType::isObjCClassType
clang::ObjCObjectPointerType::isObjCIdOrClassType
clang::ObjCObjectPointerType::isObjCQualifiedIdType
clang::ObjCObjectPointerType::isObjCQualifiedClassType
clang::ObjCObjectPointerType::isKindOfType
clang::ObjCObjectPointerType::isSpecialized
clang::ObjCObjectPointerType::isSpecializedAsWritten
clang::ObjCObjectPointerType::isUnspecialized
clang::ObjCObjectPointerType::isUnspecializedAsWritten
clang::ObjCObjectPointerType::getTypeArgs
clang::ObjCObjectPointerType::getTypeArgsAsWritten
clang::ObjCObjectPointerType::quals
clang::ObjCObjectPointerType::qual_begin
clang::ObjCObjectPointerType::qual_end
clang::ObjCObjectPointerType::qual_empty
clang::ObjCObjectPointerType::getNumProtocols
clang::ObjCObjectPointerType::getProtocol
clang::ObjCObjectPointerType::isSugared
clang::ObjCObjectPointerType::desugar
clang::ObjCObjectPointerType::getSuperClassType
clang::ObjCObjectPointerType::stripObjCKindOfTypeAndQuals
clang::ObjCObjectPointerType::Profile
clang::ObjCObjectPointerType::Profile
clang::ObjCObjectPointerType::classof
clang::AtomicType::ValueType
clang::AtomicType::getValueType
clang::AtomicType::isSugared
clang::AtomicType::desugar
clang::AtomicType::Profile
clang::AtomicType::Profile
clang::AtomicType::classof
clang::PipeType::ElementType
clang::PipeType::isRead
clang::PipeType::getElementType
clang::PipeType::isSugared
clang::PipeType::desugar
clang::PipeType::Profile
clang::PipeType::Profile
clang::PipeType::classof
clang::PipeType::isReadOnly
clang::QualifierCollector::strip
clang::QualifierCollector::apply
clang::QualifierCollector::apply
clang::SplitQualType::getSingleStepDesugaredType
clang::QualType::getTypePtr
clang::QualType::getTypePtrOrNull
clang::QualType::split
clang::QualType::getLocalQualifiers
clang::QualType::getQualifiers
clang::QualType::getCVRQualifiers
clang::QualType::getCanonicalType
clang::QualType::isCanonical
clang::QualType::isCanonicalAsParam
clang::QualType::isConstQualified
clang::QualType::isRestrictQualified
clang::QualType::isVolatileQualified
clang::QualType::hasQualifiers
clang::QualType::getUnqualifiedType
clang::QualType::getSplitUnqualifiedType
clang::QualType::removeLocalConst
clang::QualType::removeLocalRestrict
clang::QualType::removeLocalVolatile
clang::QualType::removeLocalCVRQualifiers
clang::QualType::getAddressSpace
clang::QualType::getObjCGCAttr
clang::QualType::isMoreQualifiedThan
clang::QualType::isAtLeastAsQualifiedAs
clang::QualType::getNonReferenceType
clang::QualType::isCForbiddenLValueType
clang::Type::isFundamentalType
clang::Type::isCompoundType
clang::Type::isFunctionType
clang::Type::isPointerType
clang::Type::isAnyPointerType
clang::Type::isBlockPointerType
clang::Type::isReferenceType
clang::Type::isLValueReferenceType
clang::Type::isRValueReferenceType
clang::Type::isFunctionPointerType
clang::Type::isMemberPointerType
clang::Type::isMemberFunctionPointerType
clang::Type::isMemberDataPointerType
clang::Type::isArrayType
clang::Type::isConstantArrayType
clang::Type::isIncompleteArrayType
clang::Type::isVariableArrayType
clang::Type::isDependentSizedArrayType
clang::Type::isBuiltinType
clang::Type::isRecordType
clang::Type::isEnumeralType
clang::Type::isAnyComplexType
clang::Type::isVectorType
clang::Type::isExtVectorType
clang::Type::isDependentAddressSpaceType
clang::Type::isObjCObjectPointerType
clang::Type::isObjCObjectType
clang::Type::isObjCObjectOrInterfaceType
clang::Type::isAtomicType
clang::Type::isObjCQualifiedIdType
clang::Type::isObjCQualifiedClassType
clang::Type::isObjCIdType
clang::Type::isObjCClassType
clang::Type::isObjCSelType
clang::Type::isObjCBuiltinType
clang::Type::isDecltypeType
clang::Type::isSamplerT
clang::Type::isEventT
clang::Type::isClkEventT
clang::Type::isQueueT
clang::Type::isReserveIDT
clang::Type::isImageType
clang::Type::isPipeType
clang::Type::isOCLIntelSubgroupAVCType
clang::Type::isOCLExtOpaqueType
clang::Type::isOpenCLSpecificType
clang::Type::isTemplateTypeParmType
clang::Type::isSpecificBuiltinType
clang::Type::isPlaceholderType
clang::Type::getAsPlaceholderType
clang::Type::isSpecificPlaceholderType
clang::Type::isNonOverloadPlaceholderType
clang::Type::isVoidType
clang::Type::isHalfType
clang::Type::isFloat16Type
clang::Type::isFloat128Type
clang::Type::isNullPtrType
clang::Type::isIntegerType
clang::Type::isFixedPointType
clang::Type::isFixedPointOrIntegerType
clang::Type::isSaturatedFixedPointType
clang::Type::isUnsaturatedFixedPointType
clang::Type::isSignedFixedPointType
clang::Type::isUnsignedFixedPointType
clang::Type::isScalarType
clang::Type::isIntegralOrEnumerationType
clang::Type::isBooleanType
clang::Type::isUndeducedType
clang::Type::isOverloadableType
clang::Type::canDecayToPointerType
clang::Type::hasPointerRepresentation
clang::Type::hasObjCPointerRepresentation
clang::Type::getBaseElementTypeUnsafe
clang::Type::getPointeeOrArrayElementType
clang::Type::getAs
clang::Type::getAsAdjusted
clang::Type::getAsArrayTypeUnsafe
clang::Type::castAs
clang::Type::castAsArrayTypeUnsafe
clang::DecayedType::getPointeeType
llvm::PointerLikeTypeTraits::getAsVoidPointer
llvm::PointerLikeTypeTraits::getFromVoidPointer
llvm::PointerLikeTypeTraits::getAsVoidPointer
llvm::PointerLikeTypeTraits::getFromVoidPointer
clang::Qualifiers::Profile
clang::QualType::Profile
llvm::PointerLikeTypeTraits::getAsVoidPointer
llvm::PointerLikeTypeTraits::getFromVoidPointer
clang::ExtQuals::Profile
clang::ExtQuals::Profile
clang::ComplexType::Profile
clang::ComplexType::Profile
clang::ParenType::Profile
clang::ParenType::Profile
clang::PointerType::Profile
clang::PointerType::Profile
clang::AdjustedType::Profile
clang::AdjustedType::Profile
clang::BlockPointerType::Profile
clang::BlockPointerType::Profile
clang::ReferenceType::Profile
clang::ReferenceType::Profile
clang::MemberPointerType::Profile
clang::MemberPointerType::Profile
clang::ConstantArrayType::Profile
clang::ConstantArrayType::Profile
clang::IncompleteArrayType::Profile
clang::IncompleteArrayType::Profile
clang::VariableArrayType::Profile
clang::DependentSizedArrayType::Profile
clang::DependentSizedArrayType::Profile
clang::DependentAddressSpaceType::Profile
clang::DependentAddressSpaceType::Profile
clang::DependentSizedExtVectorType::Profile
clang::DependentSizedExtVectorType::Profile
clang::VectorType::Profile
clang::VectorType::Profile
clang::DependentVectorType::Profile
clang::DependentVectorType::Profile
clang::FunctionType::ExtInfo::Profile
clang::FunctionNoProtoType::Profile
clang::FunctionNoProtoType::Profile
clang::FunctionProtoType::Profile
clang::FunctionProtoType::Profile
clang::UnresolvedUsingType::Profile
clang::UnresolvedUsingType::Profile
clang::DependentTypeOfExprType::Profile
clang::DependentTypeOfExprType::Profile
clang::DependentDecltypeType::Profile
clang::DependentDecltypeType::Profile
clang::DependentUnaryTransformType::Profile
clang::DependentUnaryTransformType::Profile
clang::AttributedType::Profile
clang::AttributedType::Profile
clang::TemplateTypeParmType::Profile
clang::TemplateTypeParmType::Profile
clang::SubstTemplateTypeParmType::Profile
clang::SubstTemplateTypeParmType::Profile
clang::SubstTemplateTypeParmPackType::Profile
clang::SubstTemplateTypeParmPackType::Profile
clang::AutoType::Profile
clang::AutoType::Profile
clang::DeducedTemplateSpecializationType::Profile
clang::DeducedTemplateSpecializationType::Profile
clang::TemplateSpecializationType::Profile
clang::TemplateSpecializationType::Profile
clang::ElaboratedType::Profile
clang::ElaboratedType::Profile
clang::DependentNameType::Profile
clang::DependentNameType::Profile
clang::DependentTemplateSpecializationType::Profile
clang::DependentTemplateSpecializationType::Profile
clang::PackExpansionType::Profile
clang::PackExpansionType::Profile
clang::ObjCTypeParamType::Profile
clang::ObjCTypeParamType::Profile
clang::ObjCObjectTypeImpl::Profile
clang::ObjCObjectTypeImpl::Profile
clang::ObjCObjectPointerType::Profile
clang::ObjCObjectPointerType::Profile
clang::AtomicType::Profile
clang::AtomicType::Profile
clang::PipeType::Profile
clang::PipeType::Profile