18 #ifndef LLVM_CLANG_AST_TYPE_H 19 #define LLVM_CLANG_AST_TYPE_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" 53 #include <type_traits> 73 struct PointerLikeTypeTraits;
105 class AttributedType;
108 template <
typename>
class CanQual;
115 class ExtQualsTypeCommonBase;
117 class FunctionNoProtoType;
118 class FunctionProtoType;
119 class IdentifierInfo;
120 class InjectedClassNameType;
122 class ObjCInterfaceDecl;
123 class ObjCObjectPointerType;
124 class ObjCObjectType;
125 class ObjCProtocolDecl;
126 class ObjCTypeParamDecl;
128 struct PrintingPolicy;
133 class TemplateArgument;
134 class TemplateArgumentListInfo;
135 class TemplateArgumentLoc;
136 class TemplateSpecializationType;
137 class TemplateTypeParmDecl;
138 class TypedefNameDecl;
140 class UnresolvedUsingTypenameDecl;
145 #define TYPE(Class, Base) class Class##Type; 146 #include "clang/AST/TypeNodes.def" 160 CVRMask = Const | Volatile | Restrict
194 MaxAddressSpace = 0x7fffffu,
200 FastMask = (1 << FastWidth) - 1
207 if (!(L.Mask & ~CVRMask) && !(R.Mask & ~CVRMask)) {
209 Q.Mask = L.Mask & R.Mask;
273 Mask = (Mask & ~Const) | (flag ? Const : 0);
280 Mask = (Mask & ~Volatile) | (flag ? Volatile : 0);
287 Mask = (Mask & ~Restrict) | (flag ? Restrict : 0);
295 assert(!(mask & ~CVRMask) &&
"bitmask contains non-CVR bits");
296 Mask = (Mask & ~CVRMask) | mask;
299 assert(!(mask & ~CVRMask) &&
"bitmask contains non-CVR bits");
303 removeCVRQualifiers(CVRMask);
306 assert(!(mask & ~CVRMask) &&
"bitmask contains non-CVR bits");
310 assert(!(mask & ~CVRMask & ~UMask) &&
"bitmask contains non-CVRU bits");
316 Mask = (Mask & ~UMask) | (flag ? UMask : 0);
324 Mask = (Mask & ~GCAttrMask) | (type << GCAttrShift);
344 return ObjCLifetime((Mask & LifetimeMask) >> LifetimeShift);
347 Mask = (Mask & ~LifetimeMask) | (type << LifetimeShift);
352 assert(!hasObjCLifetime());
353 Mask |= (type << LifetimeShift);
359 return (lifetime > OCL_ExplicitNone);
365 return (lifetime == OCL_Strong || lifetime == OCL_Weak);
370 return static_cast<LangAS>(Mask >> AddressSpaceShift);
377 auto Addr = getAddressSpace();
390 assert((
unsigned)space <= MaxAddressSpace);
391 Mask = (Mask & ~AddressSpaceMask)
392 | (((uint32_t) space) << AddressSpaceShift);
397 setAddressSpace(space);
405 assert(!(mask & ~FastMask) &&
"bitmask contains non-fast qualifier bits");
406 Mask = (Mask & ~FastMask) | mask;
409 assert(!(mask & ~FastMask) &&
"bitmask contains non-fast qualifier bits");
413 removeFastQualifiers(FastMask);
416 assert(!(mask & ~FastMask) &&
"bitmask contains non-fast qualifier bits");
431 bool empty()
const {
return !Mask; }
437 if (!(Q.Mask & ~CVRMask))
440 Mask |= (Q.Mask & CVRMask);
454 if (!(Q.Mask & ~CVRMask))
457 Mask &= ~(Q.Mask & CVRMask);
461 removeObjCLifetime();
463 removeAddressSpace();
500 return isAddressSpaceSupersetOf(other) &&
503 (getObjCGCAttr() == other.
getObjCGCAttr() || !hasObjCGCAttr() ||
508 (((Mask & CVRMask) | (other.Mask & CVRMask)) == (Mask & CVRMask)) &&
524 if (getObjCLifetime() == OCL_Weak || other.
getObjCLifetime() == OCL_Weak)
527 if (getObjCLifetime() == OCL_None || other.
getObjCLifetime() == OCL_None)
535 bool isStrictSupersetOf(
Qualifiers Other)
const;
540 explicit operator bool()
const {
return hasQualifiers(); }
570 bool appendSpaceIfNonEmpty =
false)
const;
581 static const uint32_t UMask = 0x8;
582 static const uint32_t UShift = 3;
583 static const uint32_t GCAttrMask = 0x30;
584 static const uint32_t GCAttrShift = 4;
585 static const uint32_t LifetimeMask = 0x1C0;
586 static const uint32_t LifetimeShift = 6;
587 static const uint32_t AddressSpaceMask =
588 ~(CVRMask | UMask | GCAttrMask | LifetimeMask);
589 static const uint32_t AddressSpaceShift = 9;
607 std::pair<const Type *,Qualifiers>
asPair()
const {
608 return std::pair<const Type *, Qualifiers>(Ty, Quals);
659 llvm::PointerIntPair<llvm::PointerUnion<const Type *, const ExtQuals *>,
662 const ExtQuals *getExtQualsUnsafe()
const {
663 return Value.getPointer().get<
const ExtQuals*>();
666 const Type *getTypePtrUnsafe()
const {
667 return Value.getPointer().get<
const Type*>();
671 assert(!isNull() &&
"Cannot retrieve a NULL type pointer");
672 auto CommonPtrVal =
reinterpret_cast<uintptr_t>(Value.getOpaqueValue());
689 const Type *getTypePtr()
const;
691 const Type *getTypePtrOrNull()
const;
704 T.Value.setFromOpaqueValue(const_cast<void*>(Ptr));
709 return *getTypePtr();
716 bool isCanonical()
const;
717 bool isCanonicalAsParam()
const;
721 return Value.getPointer().isNull();
732 bool isConstQualified()
const;
742 bool isRestrictQualified()
const;
752 bool isVolatileQualified()
const;
758 return getLocalFastQualifiers() || hasLocalNonFastQualifiers();
762 bool hasQualifiers()
const;
768 return Value.getPointer().is<
const ExtQuals*>();
783 return getLocalFastQualifiers();
788 unsigned getCVRQualifiers()
const;
795 bool isPODType(
const ASTContext &Context)
const;
799 bool isCXX98PODType(
const ASTContext &Context)
const;
805 bool isCXX11PODType(
const ASTContext &Context)
const;
808 bool isTrivialType(
const ASTContext &Context)
const;
811 bool isTriviallyCopyableType(
const ASTContext &Context)
const;
815 bool mayBeDynamicClass()
const;
818 bool mayBeNotDynamicClass()
const;
848 return withFastQualifiers(CVR);
853 &&
"non-fast qualifier bits set in mask!");
854 Value.setInt(Value.getInt() | TQs);
857 void removeLocalConst();
858 void removeLocalVolatile();
859 void removeLocalRestrict();
860 void removeLocalCVRQualifiers(
unsigned Mask);
865 Value.setInt(Value.getInt() & ~Mask);
914 inline QualType getUnqualifiedType()
const;
929 bool isMoreQualifiedThan(
QualType Other)
const;
933 bool isAtLeastAsQualifiedAs(
QualType Other)
const;
935 QualType getNonReferenceType()
const;
956 return getDesugaredType(*
this, Context);
960 return getSplitDesugaredType(*
this);
969 return getSingleStepDesugaredTypeImpl(*
this, Context);
975 if (isa<ParenType>(*
this))
982 return LHS.Value == RHS.Value;
985 return LHS.Value != RHS.Value;
999 const Twine &PlaceHolder = Twine(),
1000 unsigned Indentation = 0)
const {
1001 print(split(), OS, Policy, PlaceHolder, Indentation);
1006 unsigned Indentation = 0) {
1007 return print(split.
Ty, split.
Quals, OS, policy, PlaceHolder, Indentation);
1012 const Twine &PlaceHolder,
1013 unsigned Indentation = 0);
1017 return getAsStringInternal(split(), Str, Policy);
1022 return getAsStringInternal(split.
Ty, split.
Quals, out, policy);
1032 const Twine &PlaceHolder;
1033 unsigned Indentation;
1037 const Twine &PlaceHolder,
unsigned Indentation)
1038 : T(T), Policy(Policy), PlaceHolder(PlaceHolder),
1039 Indentation(Indentation) {}
1043 SQT.T.
print(OS, SQT.Policy, SQT.PlaceHolder, SQT.Indentation);
1049 const Twine &PlaceHolder = Twine(),
1050 unsigned Indentation = 0)
const {
1054 void dump(
const char *s)
const;
1056 void dump(llvm::raw_ostream &OS)
const;
1059 ID.AddPointer(getAsOpaquePtr());
1063 inline LangAS getAddressSpace()
const;
1092 bool isNonWeakInMRRWithObjCWeak(
const ASTContext &Context)
const;
1118 isNonTrivialToPrimitiveDefaultInitialize()
const;
1166 DK_nontrivial_c_struct
1174 return isDestructedTypeImpl(*
this);
1187 bool isCForbiddenLValueType()
const;
1235 QualType getAtomicUnqualifiedType()
const;
1277 enum { NumLowBitsAvailable = 0 };
1297 const Type *
const BaseType;
1303 : BaseType(baseType), CanonicalType(canon) {}
1339 canon.isNull() ?
QualType(this_(), 0) : canon),
1342 &&
"ExtQuals created with no fast qualifiers");
1344 &&
"ExtQuals created with fast qualifiers");
1364 Profile(ID, getBaseType(), Quals);
1368 const Type *BaseType,
1371 ID.AddPointer(BaseType);
1431 #define TYPE(Class, Base) Class, 1432 #define LAST_TYPE(Class) TypeLast = Class, 1433 #define ABSTRACT_TYPE(Class, Base) 1434 #include "clang/AST/TypeNodes.def" 1435 TagFirst = Record, TagLast = Enum
1440 class TypeBitfields {
1448 unsigned Dependent : 1;
1452 unsigned InstantiationDependent : 1;
1455 unsigned VariablyModified : 1;
1459 unsigned ContainsUnexpandedParameterPack : 1;
1463 mutable unsigned CacheValid : 1;
1466 mutable unsigned CachedLinkage : 3;
1469 mutable unsigned CachedLocalOrUnnamed : 1;
1472 mutable unsigned FromAST : 1;
1474 bool isCacheValid()
const {
1479 assert(isCacheValid() &&
"getting linkage from invalid cache");
1480 return static_cast<Linkage>(CachedLinkage);
1483 bool hasLocalOrUnnamedType()
const {
1484 assert(isCacheValid() &&
"getting linkage from invalid cache");
1485 return CachedLocalOrUnnamed;
1488 enum { NumTypeBits = 18 };
1497 unsigned : NumTypeBits;
1501 unsigned IndexTypeQuals : 3;
1506 unsigned SizeModifier : 3;
1512 unsigned : NumTypeBits;
1522 unsigned : NumTypeBits;
1526 unsigned ExtInfo : 12;
1534 unsigned TypeQuals : 4;
1539 unsigned RefQualifier : 2;
1545 unsigned : NumTypeBits;
1548 unsigned NumTypeArgs : 7;
1551 unsigned NumProtocols : 6;
1554 unsigned IsKindOf : 1;
1557 static_assert(NumTypeBits + 7 + 6 + 1 <= 32,
"Does not fit in an unsigned");
1562 unsigned : NumTypeBits;
1575 unsigned SpelledAsLValue : 1;
1579 unsigned InnerRef : 1;
1585 unsigned : NumTypeBits;
1588 unsigned Keyword : 8;
1595 unsigned : NumTypeBits;
1599 unsigned VecKind : 3;
1602 unsigned NumElements : 29 - NumTypeBits;
1604 enum { MaxNumElements = (1 << (29 - NumTypeBits)) - 1 };
1610 unsigned : NumTypeBits;
1613 unsigned AttrKind : 32 - NumTypeBits;
1619 unsigned : NumTypeBits;
1623 unsigned Keyword : 2;
1643 void setFromAST(
bool V =
true)
const {
1644 TypeBits.FromAST = V;
1651 bool InstantiationDependent,
bool VariablyModified,
1652 bool ContainsUnexpandedParameterPack)
1654 canon.isNull() ?
QualType(this_(), 0) : canon) {
1656 TypeBits.Dependent = Dependent;
1657 TypeBits.InstantiationDependent = Dependent || InstantiationDependent;
1658 TypeBits.VariablyModified = VariablyModified;
1659 TypeBits.ContainsUnexpandedParameterPack = ContainsUnexpandedParameterPack;
1660 TypeBits.CacheValid =
false;
1661 TypeBits.CachedLocalOrUnnamed =
false;
1663 TypeBits.FromAST =
false;
1670 TypeBits.Dependent = D;
1672 TypeBits.InstantiationDependent =
true;
1676 TypeBits.InstantiationDependent = D; }
1681 TypeBits.ContainsUnexpandedParameterPack = PP;
1689 Type &operator=(
const Type &) =
delete;
1712 return TypeBits.ContainsUnexpandedParameterPack;
1718 return CanonicalType ==
QualType(
this, 0);
1724 QualType getLocallyUnqualifiedSingleStepDesugaredType()
const;
1737 bool isIncompleteType(
NamedDecl **Def =
nullptr)
const;
1742 return !isFunctionType();
1750 return !isReferenceType() && !isFunctionType() && !isVoidType();
1755 bool isLiteralType(
const ASTContext &Ctx)
const;
1759 bool isStandardLayoutType()
const;
1765 bool isBuiltinType()
const;
1768 bool isSpecificBuiltinType(
unsigned K)
const;
1773 bool isPlaceholderType()
const;
1777 bool isSpecificPlaceholderType(
unsigned K)
const;
1781 bool isNonOverloadPlaceholderType()
const;
1785 bool isIntegerType()
const;
1786 bool isEnumeralType()
const;
1789 bool isScopedEnumeralType()
const;
1792 bool isWideCharType()
const;
1793 bool isChar8Type()
const;
1794 bool isChar16Type()
const;
1795 bool isChar32Type()
const;
1796 bool isAnyCharacterType()
const;
1797 bool isIntegralType(
const ASTContext &Ctx)
const;
1800 bool isIntegralOrEnumerationType()
const;
1803 bool isIntegralOrUnscopedEnumerationType()
const;
1806 bool isRealFloatingType()
const;
1809 bool isComplexType()
const;
1810 bool isAnyComplexType()
const;
1811 bool isFloatingType()
const;
1812 bool isHalfType()
const;
1813 bool isFloat16Type()
const;
1814 bool isFloat128Type()
const;
1815 bool isRealType()
const;
1816 bool isArithmeticType()
const;
1817 bool isVoidType()
const;
1818 bool isScalarType()
const;
1819 bool isAggregateType()
const;
1820 bool isFundamentalType()
const;
1821 bool isCompoundType()
const;
1825 bool isFunctionType()
const;
1828 bool isPointerType()
const;
1829 bool isAnyPointerType()
const;
1830 bool isBlockPointerType()
const;
1831 bool isVoidPointerType()
const;
1832 bool isReferenceType()
const;
1833 bool isLValueReferenceType()
const;
1834 bool isRValueReferenceType()
const;
1835 bool isFunctionPointerType()
const;
1836 bool isMemberPointerType()
const;
1837 bool isMemberFunctionPointerType()
const;
1838 bool isMemberDataPointerType()
const;
1839 bool isArrayType()
const;
1840 bool isConstantArrayType()
const;
1841 bool isIncompleteArrayType()
const;
1842 bool isVariableArrayType()
const;
1843 bool isDependentSizedArrayType()
const;
1845 bool isClassType()
const;
1846 bool isStructureType()
const;
1847 bool isObjCBoxableRecordType()
const;
1848 bool isInterfaceType()
const;
1849 bool isStructureOrClassType()
const;
1850 bool isUnionType()
const;
1851 bool isComplexIntegerType()
const;
1852 bool isVectorType()
const;
1853 bool isExtVectorType()
const;
1854 bool isDependentAddressSpaceType()
const;
1855 bool isObjCObjectPointerType()
const;
1856 bool isObjCRetainableType()
const;
1857 bool isObjCLifetimeType()
const;
1858 bool isObjCIndirectLifetimeType()
const;
1859 bool isObjCNSObjectType()
const;
1860 bool isObjCIndependentClassType()
const;
1863 bool isObjCObjectType()
const;
1864 bool isObjCQualifiedInterfaceType()
const;
1865 bool isObjCQualifiedIdType()
const;
1866 bool isObjCQualifiedClassType()
const;
1867 bool isObjCObjectOrInterfaceType()
const;
1868 bool isObjCIdType()
const;
1869 bool isObjCInertUnsafeUnretainedType()
const;
1878 bool isObjCIdOrObjectKindOfType(
const ASTContext &ctx,
1881 bool isObjCClassType()
const;
1889 bool isObjCClassOrClassKindOfType()
const;
1891 bool isBlockCompatibleObjCPointerType(
ASTContext &ctx)
const;
1892 bool isObjCSelType()
const;
1893 bool isObjCBuiltinType()
const;
1894 bool isObjCARCBridgableType()
const;
1895 bool isCARCBridgableType()
const;
1896 bool isTemplateTypeParmType()
const;
1897 bool isNullPtrType()
const;
1898 bool isAlignValT()
const;
1899 bool isStdByteType()
const;
1900 bool isAtomicType()
const;
1902 #define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \ 1903 bool is##Id##Type() const; 1904 #include "clang/Basic/OpenCLImageTypes.def" 1906 bool isImageType()
const;
1908 bool isSamplerT()
const;
1909 bool isEventT()
const;
1910 bool isClkEventT()
const;
1911 bool isQueueT()
const;
1912 bool isReserveIDT()
const;
1914 bool isPipeType()
const;
1915 bool isOpenCLSpecificType()
const;
1920 bool isObjCARCImplicitlyUnretainedType()
const;
1949 return TypeBits.InstantiationDependent;
1955 bool isUndeducedType()
const;
1962 bool hasSizedVLAType()
const;
1965 bool hasUnnamedOrLocalType()
const;
1967 bool isOverloadableType()
const;
1970 bool isElaboratedTypeSpecifier()
const;
1972 bool canDecayToPointerType()
const;
1977 bool hasPointerRepresentation()
const;
1981 bool hasObjCPointerRepresentation()
const;
1985 bool hasIntegerRepresentation()
const;
1989 bool hasSignedIntegerRepresentation()
const;
1993 bool hasUnsignedIntegerRepresentation()
const;
1997 bool hasFloatingRepresentation()
const;
2002 const RecordType *getAsStructureType()
const;
2005 const ComplexType *getAsComplexIntegerType()
const;
2026 TagDecl *getAsTagDecl()
const;
2044 return dyn_cast_or_null<AutoType>(getContainedDeducedType());
2050 bool hasAutoForTrailingReturnType()
const;
2058 template <
typename T>
const T *getAs()
const;
2065 template <
typename T>
const T *getAsAdjusted()
const;
2069 const ArrayType *getAsArrayTypeUnsafe()
const;
2077 template <
typename T>
const T *castAs()
const;
2081 const ArrayType *castAsArrayTypeUnsafe()
const;
2086 const Type *getBaseElementTypeUnsafe()
const;
2091 const Type *getArrayElementTypeNoTypeQual()
const;
2096 const Type *getPointeeOrArrayElementType()
const;
2104 const Type *getUnqualifiedDesugaredType()
const;
2107 bool isPromotableIntegerType()
const;
2112 bool isSignedIntegerType()
const;
2117 bool isUnsignedIntegerType()
const;
2121 bool isSignedIntegerOrEnumerationType()
const;
2125 bool isUnsignedIntegerOrEnumerationType()
const;
2129 bool isFixedPointType()
const;
2133 bool isSaturatedFixedPointType()
const;
2137 bool isUnsaturatedFixedPointType()
const;
2141 bool isSignedFixedPointType()
const;
2145 bool isUnsignedFixedPointType()
const;
2150 bool isConstantSizeType()
const;
2154 bool isSpecifierType()
const;
2161 return getLinkageAndVisibility().getVisibility();
2166 return getLinkageAndVisibility().isVisibilityExplicit();
2174 bool isLinkageValid()
const;
2188 bool canHaveNullability(
bool ResultIfUnknown =
true)
const;
2206 getObjCSubstitutions(
const DeclContext *dc)
const;
2210 bool acceptsObjCTypeParams()
const;
2212 const char *getTypeClassName()
const;
2215 return CanonicalType;
2220 void dump(llvm::raw_ostream &OS)
const;
2238 #define TYPE(Class, Base) 2239 #define LEAF_TYPE(Class) \ 2240 template <> inline const Class##Type *Type::getAs() const { \ 2241 return dyn_cast<Class##Type>(CanonicalType); \ 2243 template <> inline const Class##Type *Type::castAs() const { \ 2244 return cast<Class##Type>(CanonicalType); \ 2246 #include "clang/AST/TypeNodes.def" 2254 #define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) Id, 2255 #include "clang/Basic/OpenCLImageTypes.def" 2257 #define BUILTIN_TYPE(Id, SingletonId) Id, 2258 #define LAST_BUILTIN_TYPE(Id) LastKind = Id 2259 #include "clang/AST/BuiltinTypes.def" 2270 BuiltinTypeBits.Kind = K;
2279 StringRef str =
getName(Policy);
2280 assert(!str.empty() && str.data()[str.size()] ==
'\0');
2305 return K >= Overload;
2312 return isPlaceholderTypeKind(
getKind());
2339 :
Type(
Complex, CanonicalPtr, Element->isDependentType(),
2340 Element->isInstantiationDependentType(),
2341 Element->isVariablyModifiedType(),
2342 Element->containsUnexpandedParameterPack()),
2343 ElementType(Element) {}
2352 Profile(ID, getElementType());
2369 :
Type(
Paren, CanonType, InnerType->isDependentType(),
2370 InnerType->isInstantiationDependentType(),
2371 InnerType->isVariablyModifiedType(),
2372 InnerType->containsUnexpandedParameterPack()),
2382 Profile(ID, getInnerType());
2399 :
Type(
Pointer, CanonicalPtr, Pointee->isDependentType(),
2400 Pointee->isInstantiationDependentType(),
2401 Pointee->isVariablyModifiedType(),
2402 Pointee->containsUnexpandedParameterPack()),
2403 PointeeType(Pointee) {}
2428 Profile(ID, getPointeeType());
2450 :
Type(TC, CanonicalPtr, OriginalTy->isDependentType(),
2451 OriginalTy->isInstantiationDependentType(),
2452 OriginalTy->isVariablyModifiedType(),
2453 OriginalTy->containsUnexpandedParameterPack()),
2454 OriginalTy(OriginalTy), AdjustedTy(AdjustedTy) {}
2464 Profile(ID, OriginalTy, AdjustedTy);
2487 inline QualType getPointeeType()
const;
2502 :
Type(BlockPointer, CanonicalCls, Pointee->isDependentType(),
2503 Pointee->isInstantiationDependentType(),
2504 Pointee->isVariablyModifiedType(),
2505 Pointee->containsUnexpandedParameterPack()),
2506 PointeeType(Pointee) {}
2516 Profile(ID, getPointeeType());
2534 bool SpelledAsLValue)
2535 :
Type(tc, CanonicalRef, Referencee->isDependentType(),
2536 Referencee->isInstantiationDependentType(),
2537 Referencee->isVariablyModifiedType(),
2538 Referencee->containsUnexpandedParameterPack()),
2539 PointeeType(Referencee) {
2540 ReferenceTypeBits.SpelledAsLValue = SpelledAsLValue;
2555 return T->PointeeType;
2559 Profile(ID, PointeeType, isSpelledAsLValue());
2564 bool SpelledAsLValue) {
2566 ID.AddBoolean(SpelledAsLValue);
2580 bool SpelledAsLValue)
2622 :
Type(MemberPointer, CanonicalPtr,
2623 Cls->isDependentType() || Pointee->isDependentType(),
2624 (Cls->isInstantiationDependentType() ||
2625 Pointee->isInstantiationDependentType()),
2626 Pointee->isVariablyModifiedType(),
2627 (Cls->containsUnexpandedParameterPack() ||
2628 Pointee->containsUnexpandedParameterPack())),
2629 PointeeType(Pointee), Class(Cls) {}
2653 Profile(ID, getPointeeType(), getClass());
2657 const Type *Class) {
2659 ID.AddPointer(Class);
2692 bool ContainsUnexpandedParameterPack)
2693 :
Type(tc, can, et->isDependentType() || tc == DependentSizedArray,
2694 et->isInstantiationDependentType() || tc == DependentSizedArray,
2695 (tc == VariableArray || et->isVariablyModifiedType()),
2696 ContainsUnexpandedParameterPack),
2698 ArrayTypeBits.IndexTypeQuals = tq;
2699 ArrayTypeBits.SizeModifier = sm;
2714 return ArrayTypeBits.IndexTypeQuals;
2733 :
ArrayType(ConstantArray, et, can, sm, tq,
2742 :
ArrayType(tc, et, can, sm, tq, et->containsUnexpandedParameterPack()),
2746 const llvm::APInt &
getSize()
const {
return Size; }
2752 static unsigned getNumAddressingBits(
const ASTContext &Context,
2754 const llvm::APInt &NumElements);
2758 static unsigned getMaxSizeBits(
const ASTContext &Context);
2761 Profile(ID, getElementType(), getSize(),
2762 getSizeModifier(), getIndexTypeCVRQualifiers());
2767 unsigned TypeQuals) {
2769 ID.AddInteger(ArraySize.getZExtValue());
2770 ID.AddInteger(SizeMod);
2771 ID.AddInteger(TypeQuals);
2787 :
ArrayType(IncompleteArray, et, can, sm, tq,
2788 et->containsUnexpandedParameterPack()) {}
2801 Profile(ID, getElementType(), getSizeModifier(),
2802 getIndexTypeCVRQualifiers());
2808 ID.AddInteger(SizeMod);
2809 ID.AddInteger(TypeQuals);
2840 :
ArrayType(VariableArray, et, can, sm, tq,
2841 et->containsUnexpandedParameterPack()),
2842 SizeExpr((
Stmt*) e), Brackets(brackets) {}
2850 return (
Expr*) SizeExpr;
2865 llvm_unreachable(
"Cannot unique VariableArrayTypes.");
2907 return (
Expr*) SizeExpr;
2922 Profile(ID, Context, getElementType(),
2923 getSizeModifier(), getIndexTypeCVRQualifiers(), getSizeExpr());
2926 static void Profile(llvm::FoldingSetNodeID &
ID,
const ASTContext &Context,
2928 unsigned TypeQuals,
Expr *E);
2946 Expr *AddrSpaceExpr;
2967 Profile(ID, Context, getPointeeType(), getAddrSpaceExpr());
2970 static void Profile(llvm::FoldingSetNodeID &
ID,
const ASTContext &Context,
3011 Profile(ID, Context, getElementType(), getSizeExpr());
3014 static void Profile(llvm::FoldingSetNodeID &
ID,
const ASTContext &Context,
3063 return NumElements > VectorTypeBitfields::MaxNumElements;
3074 Profile(ID, getElementType(), getNumElements(),
3075 getTypeClass(), getVectorKind());
3082 ID.AddInteger(NumElements);
3083 ID.AddInteger(TypeClass);
3084 ID.AddInteger(VecKind);
3129 Profile(ID, Context, getElementType(), getSizeExpr(), getVectorKind());
3132 static void Profile(llvm::FoldingSetNodeID &
ID,
const ASTContext &Context,
3147 :
VectorType(ExtVector, vecType, nElements, canonType, GenericVector) {}
3153 case 'x':
case 'r':
return 0;
3154 case 'y':
case 'g':
return 1;
3155 case 'z':
case 'b':
return 2;
3156 case 'w':
case 'a':
return 3;
3174 case 'a':
return 10;
3176 case 'b':
return 11;
3178 case 'c':
return 12;
3180 case 'd':
return 13;
3182 case 'e':
return 14;
3184 case 'f':
return 15;
3189 if (isNumericAccessor)
3190 return getNumericAccessorIdx(c);
3192 return getPointAccessorIdx(c);
3196 if (
int idx = getAccessorIdx(c, isNumericAccessor)+1)
3197 return unsigned(idx-1) < getNumElements();
3247 enum { CallConvMask = 0x1F };
3248 enum { NoReturnMask = 0x20 };
3249 enum { ProducesResultMask = 0x40 };
3250 enum { NoCallerSavedRegsMask = 0x80 };
3251 enum { NoCfCheckMask = 0x800 };
3253 RegParmMask = ~(CallConvMask | NoReturnMask | ProducesResultMask |
3254 NoCallerSavedRegsMask | NoCfCheckMask),
3257 uint16_t Bits =
CC_C;
3259 ExtInfo(
unsigned Bits) : Bits(static_cast<uint16_t>(Bits)) {}
3265 bool producesResult,
bool noCallerSavedRegs,
bool NoCfCheck) {
3266 assert((!hasRegParm || regParm < 7) &&
"Invalid regparm value");
3267 Bits = ((unsigned)cc) | (noReturn ? NoReturnMask : 0) |
3268 (producesResult ? ProducesResultMask : 0) |
3269 (noCallerSavedRegs ? NoCallerSavedRegsMask : 0) |
3270 (hasRegParm ? ((regParm + 1) << RegParmOffset) : 0) |
3271 (NoCfCheck ? NoCfCheckMask : 0);
3289 unsigned RegParm = (Bits & RegParmMask) >> RegParmOffset;
3298 return Bits == Other.Bits;
3301 return Bits != Other.Bits;
3309 return ExtInfo(Bits | NoReturnMask);
3311 return ExtInfo(Bits & ~NoReturnMask);
3316 return ExtInfo(Bits | ProducesResultMask);
3318 return ExtInfo(Bits & ~ProducesResultMask);
3322 if (noCallerSavedRegs)
3323 return ExtInfo(Bits | NoCallerSavedRegsMask);
3325 return ExtInfo(Bits & ~NoCallerSavedRegsMask);
3330 return ExtInfo(Bits | NoCfCheckMask);
3332 return ExtInfo(Bits & ~NoCfCheckMask);
3336 assert(RegParm < 7 &&
"Invalid regparm value");
3337 return ExtInfo((Bits & ~RegParmMask) |
3338 ((RegParm + 1) << RegParmOffset));
3342 return ExtInfo((Bits & ~CallConvMask) | (
unsigned) cc);
3346 ID.AddInteger(Bits);
3352 QualType Canonical,
bool Dependent,
3353 bool InstantiationDependent,
3354 bool VariablyModified,
bool ContainsUnexpandedParameterPack,
3356 :
Type(tc, Canonical, Dependent, InstantiationDependent, VariablyModified,
3357 ContainsUnexpandedParameterPack),
3359 FunctionTypeBits.ExtInfo = Info.Bits;
3387 static StringRef getNameForCallConv(
CallingConv CC);
3403 Result->isVariablyModifiedType(),
3413 Profile(ID, getReturnType(), getExtInfo());
3457 HasPassObjSize = 0x20,
3460 unsigned char Data = 0;
3471 copy.Data = (copy.Data & ~ABIMask) |
unsigned(kind);
3478 return (Data & IsConsumed);
3483 copy.Data |= IsConsumed;
3485 copy.Data &= ~IsConsumed;
3491 return Data & HasPassObjSize;
3495 Copy.Data |= HasPassObjSize;
3500 return Data & IsNoEscape;
3506 Copy.Data |= IsNoEscape;
3508 Copy.Data &= ~IsNoEscape;
3520 return lhs.Data == rhs.Data;
3523 return lhs.Data != rhs.Data;
3555 unsigned char TypeQuals = 0;
3561 : Variadic(
false), HasTrailingReturn(
false) {}
3564 : ExtInfo(CC), Variadic(
false), HasTrailingReturn(
false) {}
3578 static bool containsAnyUnexpandedParameterPack(
const QualType *ArgArray,
3580 for (
unsigned Idx = 0; Idx < numArgs; ++Idx)
3581 if (ArgArray[Idx]->containsUnexpandedParameterPack())
3591 unsigned NumParams : 15;
3594 unsigned NumExceptions : 9;
3597 unsigned ExceptionSpecType : 4;
3600 unsigned HasExtParameterInfos : 1;
3603 unsigned Variadic : 1;
3606 unsigned HasTrailingReturn : 1;
3628 assert(hasExtParameterInfos());
3631 const auto *ptr =
reinterpret_cast<const char *
>(exception_begin());
3632 ptr += getExceptionSpecSize();
3638 unsigned NumExceptions) {
3648 return NumExceptions *
sizeof(
QualType);
3653 return sizeof(
Expr *);
3661 llvm_unreachable(
"bad exception specification kind");
3663 size_t getExceptionSpecSize()
const {
3664 return getExceptionSpecSize(getExceptionSpecType(), getNumExceptions());
3671 assert(i < NumParams &&
"invalid parameter index");
3672 return param_type_begin()[i];
3676 return llvm::makeArrayRef(param_type_begin(), param_type_end());
3685 EPI.
TypeQuals =
static_cast<unsigned char>(getTypeQuals());
3697 if (hasExtParameterInfos())
3709 return getExceptionSpecType() !=
EST_None;
3723 bool hasDependentExceptionSpec()
const;
3727 bool hasInstantiationDependentExceptionSpec()
const;
3731 assert(i < NumExceptions &&
"Invalid exception number!");
3732 return exception_begin()[i];
3738 return *
reinterpret_cast<Expr *
const *
>(param_type_end());
3749 return reinterpret_cast<FunctionDecl *
const *
>(param_type_end())[0];
3759 return reinterpret_cast<FunctionDecl *
const *
>(param_type_end())[1];
3770 return ResultIfDependent ? canThrow() !=
CT_Can 3782 bool isTemplateVariadic()
const;
3801 return reinterpret_cast<const QualType *
>(
this+1);
3805 return param_type_begin() + NumParams;
3811 return llvm::makeArrayRef(exception_begin(), exception_end());
3816 return param_type_end();
3821 return exception_begin();
3822 return exception_begin() + NumExceptions;
3829 assert(hasExtParameterInfos());
3838 if (!hasExtParameterInfos())
3840 return getExtParameterInfosBuffer();
3844 assert(I < getNumParams() &&
"parameter index out of range");
3845 if (hasExtParameterInfos())
3846 return getExtParameterInfosBuffer()[I];
3851 assert(I < getNumParams() &&
"parameter index out of range");
3852 if (hasExtParameterInfos())
3853 return getExtParameterInfosBuffer()[I].getABI();
3858 assert(I < getNumParams() &&
"parameter index out of range");
3859 if (hasExtParameterInfos())
3860 return getExtParameterInfosBuffer()[I].isConsumed();
3867 void printExceptionSpecification(raw_ostream &OS,
3874 void Profile(llvm::FoldingSetNodeID &
ID,
const ASTContext &Ctx);
3907 return Profile(ID, Decl);
3923 :
Type(tc, can, can->isDependentType(),
3924 can->isInstantiationDependentType(),
3925 can->isVariablyModifiedType(),
3928 assert(!isa<TypedefType>(can) &&
"Invalid canonical type");
3956 bool isSugared()
const;
3976 Profile(ID, Context, getUnderlyingExpr());
3979 static void Profile(llvm::FoldingSetNodeID &
ID,
const ASTContext &Context,
3990 :
Type(TypeOf, can, T->isDependentType(),
3991 T->isInstantiationDependentType(),
3992 T->isVariablyModifiedType(),
3993 T->containsUnexpandedParameterPack()),
3995 assert(!isa<TypedefType>(can) &&
"Invalid canonical type");
4028 bool isSugared()
const;
4046 Profile(ID, Context, getUnderlyingExpr());
4049 static void Profile(llvm::FoldingSetNodeID &
ID,
const ASTContext &Context,
4096 public llvm::FoldingSetNode {
4102 Profile(ID, getBaseType(), getUTTKind());
4108 ID.AddInteger((
unsigned)UKind);
4126 bool isBeingDefined()
const;
4151 bool hasConstFields()
const;
4202 FirstExprOperandKind = attr_address_space,
4203 LastExprOperandKind = attr_neon_polyvector_type,
4211 FirstEnumOperandKind = attr_objc_gc,
4212 LastEnumOperandKind = attr_pcs_vfp,
4251 :
Type(Attributed, canon, equivalent->isDependentType(),
4252 equivalent->isInstantiationDependentType(),
4253 equivalent->isVariablyModifiedType(),
4254 equivalent->containsUnexpandedParameterPack()),
4255 ModifiedType(modified), EquivalentType(equivalent) {
4256 AttributedTypeBits.AttrKind = attrKind;
4261 return static_cast<Kind>(AttributedTypeBits.AttrKind);
4285 bool isQualifier()
const;
4287 bool isMSTypeSpec()
const;
4289 bool isCallingConv()
const;
4298 return attr_nonnull;
4301 return attr_nullable;
4304 return attr_null_unspecified;
4306 llvm_unreachable(
"Unknown nullability kind.");
4321 Profile(ID, getAttrKind(), ModifiedType, EquivalentType);
4326 ID.AddInteger(attrKind);
4340 struct CanonicalTTPTInfo {
4341 unsigned Depth : 15;
4342 unsigned ParameterPack : 1;
4343 unsigned Index : 16;
4356 :
Type(TemplateTypeParm, Canon,
true,
4359 Canon->containsUnexpandedParameterPack()),
4368 CanTTPTInfo.Depth = D;
4369 CanTTPTInfo.Index = I;
4370 CanTTPTInfo.ParameterPack = PP;
4373 const CanonicalTTPTInfo& getCanTTPTInfo()
const {
4374 QualType Can = getCanonicalTypeInternal();
4379 unsigned getDepth()
const {
return getCanTTPTInfo().Depth; }
4380 unsigned getIndex()
const {
return getCanTTPTInfo().Index; }
4384 return isCanonicalUnqualified() ? nullptr : TTPDecl;
4393 Profile(ID, getDepth(), getIndex(), isParameterPack(), getDecl());
4397 unsigned Index,
bool ParameterPack,
4399 ID.AddInteger(Depth);
4400 ID.AddInteger(Index);
4401 ID.AddBoolean(ParameterPack);
4402 ID.AddPointer(TTPDecl);
4424 :
Type(SubstTemplateTypeParm, Canon, Canon->isDependentType(),
4425 Canon->isInstantiationDependentType(),
4426 Canon->isVariablyModifiedType(),
4427 Canon->containsUnexpandedParameterPack()),
4439 return getCanonicalTypeInternal();
4446 Profile(ID, getReplacedParameter(), getReplacementType());
4452 ID.AddPointer(Replaced);
4484 unsigned NumArguments;
4503 void Profile(llvm::FoldingSetNodeID &
ID);
4504 static void Profile(llvm::FoldingSetNodeID &ID,
4525 bool IsInstantiationDependent,
bool ContainsParameterPack)
4528 DeducedAsType.isNull() ?
QualType(this, 0)
4529 : DeducedAsType.getCanonicalType(),
4530 IsDependent, IsInstantiationDependent,
4531 false, ContainsParameterPack) {
4532 if (!DeducedAsType.
isNull()) {
4536 setInstantiationDependent();
4538 setContainsUnexpandedParameterPack();
4543 bool isSugared()
const {
return !isCanonicalUnqualified(); }
4549 return !isCanonicalUnqualified() ? getCanonicalTypeInternal() :
QualType();
4552 return !isCanonicalUnqualified() || isDependentType();
4566 bool IsDeducedAsDependent)
4568 IsDeducedAsDependent,
false) {
4569 AutoTypeBits.Keyword = (unsigned)Keyword;
4582 Profile(ID, getDeducedType(), getKeyword(), isDependentType());
4588 ID.AddInteger((
unsigned)Keyword);
4589 ID.AddBoolean(IsDependent);
4599 public llvm::FoldingSetNode {
4607 bool IsDeducedAsDependent)
4608 :
DeducedType(DeducedTemplateSpecialization, DeducedAsType,
4609 IsDeducedAsDependent || Template.isDependent(),
4610 IsDeducedAsDependent || Template.isInstantiationDependent(),
4611 Template.containsUnexpandedParameterPack()),
4612 Template(Template) {}
4619 Profile(ID, getTemplateName(), getDeducedType(), isDependentType());
4623 QualType Deduced,
bool IsDependent) {
4626 ID.AddBoolean(IsDependent);
4630 return T->
getTypeClass() == DeducedTemplateSpecialization;
4656 public llvm::FoldingSetNode {
4670 unsigned NumArgs : 31;
4673 unsigned TypeAlias : 1;
4683 bool &InstantiationDependent);
4686 bool &InstantiationDependent);
4691 return isa<InjectedClassNameType>(getCanonicalTypeInternal());
4714 assert(isTypeAlias() &&
"not a type alias template specialization");
4715 return *
reinterpret_cast<const QualType*
>(end());
4739 return {getArgs(), NumArgs};
4743 return !isDependentType() || isCurrentInstantiation() || isTypeAlias();
4749 Profile(ID, Template, template_arguments(), Ctx);
4751 getAliasedType().Profile(ID);
4819 Decl(D), InjectedType(TST) {
4820 assert(isa<TemplateSpecializationType>(TST));
4829 return cast<TemplateSpecializationType>(InjectedType.
getTypePtr());
4833 return getInjectedTST()->getTemplateName();
4897 QualType Canonical,
bool Dependent,
4898 bool InstantiationDependent,
bool VariablyModified,
4899 bool ContainsUnexpandedParameterPack)
4900 :
Type(tc, Canonical, Dependent, InstantiationDependent, VariablyModified,
4901 ContainsUnexpandedParameterPack) {
4902 TypeWithKeywordBits.Keyword = Keyword;
4915 static TagTypeKind getTagTypeKindForTypeSpec(
unsigned TypeSpec);
4930 return getKeywordName(getKeywordForTagTypeKind(Kind));
4961 NamedType->isDependentType(),
4962 NamedType->isInstantiationDependentType(),
4963 NamedType->isVariablyModifiedType(),
4964 NamedType->containsUnexpandedParameterPack()),
4965 NNS(NNS), NamedType(NamedType), OwnedTagDecl(OwnedTagDecl) {
4966 assert(!(Keyword ==
ETK_None && NNS ==
nullptr) &&
4967 "ElaboratedType cannot have elaborated type keyword " 4968 "and name qualifier both null.");
4991 Profile(ID, getKeyword(), NNS, NamedType, OwnedTagDecl);
4997 ID.AddInteger(Keyword);
5000 ID.AddPointer(OwnedTagDecl);
5034 NNS->containsUnexpandedParameterPack()),
5035 NNS(NNS), Name(Name) {}
5054 Profile(ID, getKeyword(), NNS, Name);
5059 ID.AddInteger(Keyword);
5061 ID.AddPointer(Name);
5074 public llvm::FoldingSetNode {
5107 return getArgBuffer();
5116 return {getArgs(), NumArgs};
5128 Profile(ID, Context, getKeyword(), NNS, Name, {getArgs(), NumArgs});
5131 static void Profile(llvm::FoldingSetNodeID &
ID,
5139 return T->
getTypeClass() == DependentTemplateSpecialization;
5177 unsigned NumExpansions;
5181 :
Type(PackExpansion, Canon, Pattern->isDependentType(),
5183 Pattern->isVariablyModifiedType(),
5186 NumExpansions(NumExpansions ? *NumExpansions + 1 : 0) {}
5198 return NumExpansions - 1;
5207 Profile(ID, getPattern(), getNumExpansions());
5213 ID.AddBoolean(NumExpansions.hasValue());
5215 ID.AddInteger(*NumExpansions);
5235 return static_cast<T*
>(
this)->getProtocolStorageImpl();
5239 static_cast<T*
>(
this)->setNumProtocolsImpl(N);
5243 setNumProtocols(protocols.size());
5244 assert(getNumProtocols() == protocols.size() &&
5245 "bitfield overflow in protocol count");
5246 if (!protocols.empty())
5247 memcpy(getProtocolStorage(), protocols.data(),
5264 return static_cast<const T*
>(
this)->getNumProtocolsImpl();
5269 assert(I < getNumProtocols() &&
"Out-of-range protocol access");
5270 return qual_begin()[I];
5283 public llvm::FoldingSetNode {
5288 unsigned NumProtocols : 6;
5299 unsigned getNumProtocolsImpl()
const {
5300 return NumProtocols;
5303 void setNumProtocolsImpl(
unsigned N) {
5319 void Profile(llvm::FoldingSetNodeID &
ID);
5320 static void Profile(llvm::FoldingSetNodeID &ID,
5375 mutable llvm::PointerIntPair<const ObjCObjectType *, 1, bool>
5376 CachedSuperClassType;
5379 const QualType *getTypeArgStorage()
const {
5386 unsigned getNumProtocolsImpl()
const {
5387 return ObjCObjectTypeBits.NumProtocols;
5389 void setNumProtocolsImpl(
unsigned N) {
5390 ObjCObjectTypeBits.NumProtocols = N;
5404 ObjCObjectTypeBits.NumProtocols = 0;
5405 ObjCObjectTypeBits.NumTypeArgs = 0;
5406 ObjCObjectTypeBits.IsKindOf = 0;
5409 void computeSuperClassTypeSlow()
const;
5421 return getBaseType()->isSpecificBuiltinType(BuiltinType::ObjCId);
5425 return getBaseType()->isSpecificBuiltinType(BuiltinType::ObjCClass);
5431 if (!qual_empty())
return false;
5432 if (
const BuiltinType *T = getBaseType()->getAs<BuiltinType>())
5433 return T->getKind() == BuiltinType::ObjCId ||
5434 T->getKind() == BuiltinType::ObjCClass;
5446 bool isSpecialized()
const;
5450 return ObjCObjectTypeBits.NumTypeArgs > 0;
5467 return llvm::makeArrayRef(getTypeArgStorage(),
5468 ObjCObjectTypeBits.NumTypeArgs);
5475 bool isKindOfType()
const;
5484 if (!CachedSuperClassType.getInt())
5485 computeSuperClassTypeSlow();
5487 assert(CachedSuperClassType.getInt() &&
"Superclass not set?");
5488 return QualType(CachedSuperClassType.getPointer(), 0);
5518 :
ObjCObjectType(Canonical, Base, typeArgs, protocols, isKindOf) {}
5521 void Profile(llvm::FoldingSetNodeID &
ID);
5522 static void Profile(llvm::FoldingSetNodeID &
ID,
5529 inline QualType *ObjCObjectType::getTypeArgStorage() {
5535 getTypeArgStorage() + ObjCObjectTypeBits.NumTypeArgs);
5593 if (
const auto *T = dyn_cast<ObjCInterfaceType>(ObjT))
5594 return T->getDecl();
5596 baseType = ObjT->getBaseType();
5617 :
Type(ObjCObjectPointer, Canonical,
5618 Pointee->isDependentType(),
5619 Pointee->isInstantiationDependentType(),
5620 Pointee->isVariablyModifiedType(),
5621 Pointee->containsUnexpandedParameterPack()),
5622 PointeeType(Pointee) {}
5765 QualType getSuperClassType()
const;
5773 Profile(ID, getPointeeType());
5791 :
Type(Atomic, Canonical, ValTy->isDependentType(),
5792 ValTy->isInstantiationDependentType(),
5793 ValTy->isVariablyModifiedType(),
5794 ValTy->containsUnexpandedParameterPack()),
5806 Profile(ID, getValueType());
5826 :
Type(Pipe, CanonicalPtr, elemType->isDependentType(),
5827 elemType->isInstantiationDependentType(),
5828 elemType->isVariablyModifiedType(),
5829 elemType->containsUnexpandedParameterPack()),
5830 ElementType(elemType), isRead(isRead) {}
5840 Profile(ID, getElementType(), isReadOnly());
5845 ID.AddBoolean(isRead);
5866 return type.getTypePtrUnsafe();
5868 const ExtQuals *extQuals = type.getExtQualsUnsafe();
5884 Ty->getLocallyUnqualifiedSingleStepDesugaredType().split();
5890 return getCommonPtr()->BaseType;
5894 return (isNull() ?
nullptr : getCommonPtr()->BaseType);
5898 if (!hasLocalNonFastQualifiers())
5902 const ExtQuals *eq = getExtQualsUnsafe();
5910 if (hasLocalNonFastQualifiers())
5911 Quals = getExtQualsUnsafe()->getQualifiers();
5917 Qualifiers quals = getCommonPtr()->CanonicalType.getLocalQualifiers();
5923 unsigned cvr = getCommonPtr()->CanonicalType.getLocalCVRQualifiers();
5924 cvr |= getLocalCVRQualifiers();
5929 QualType canon = getCommonPtr()->CanonicalType;
5938 if (!isCanonical())
return false;
5939 if (hasLocalQualifiers())
return false;
5941 const Type *T = getTypePtr();
5945 return !isa<FunctionType>(T) && !isa<ArrayType>(T);
5949 return isLocalConstQualified() ||
5950 getCommonPtr()->CanonicalType.isLocalConstQualified();
5954 return isLocalRestrictQualified() ||
5955 getCommonPtr()->CanonicalType.isLocalRestrictQualified();
5960 return isLocalVolatileQualified() ||
5961 getCommonPtr()->CanonicalType.isLocalVolatileQualified();
5965 return hasLocalQualifiers() ||
5966 getCommonPtr()->CanonicalType.hasLocalQualifiers();
5970 if (!getTypePtr()->getCanonicalTypeInternal().hasLocalQualifiers())
5973 return QualType(getSplitUnqualifiedTypeImpl(*this).Ty, 0);
5977 if (!getTypePtr()->getCanonicalTypeInternal().hasLocalQualifiers())
5980 return getSplitUnqualifiedTypeImpl(*
this);
5998 "Fast bits differ from CVR bits!");
6001 removeLocalFastQualifiers(Mask);
6016 if (
const auto *FT = PT->getPointeeType()->getAs<
FunctionType>())
6017 return FT->getExtInfo();
6019 return FT->getExtInfo();
6047 if (getUnqualifiedType()->isVoidType())
6070 return ((getTypePtr()->isVoidType() && !hasQualifiers()) ||
6071 getTypePtr()->isFunctionType());
6078 return isVoidType() ||
6081 (isArithmeticType() && !isEnumeralType());
6091 return isArrayType() ||
6097 isReferenceType() ||
6106 isMemberPointerType();
6110 return isa<FunctionType>(CanonicalType);
6114 return isa<PointerType>(CanonicalType);
6118 return isPointerType() || isObjCObjectPointerType();
6122 return isa<BlockPointerType>(CanonicalType);
6126 return isa<ReferenceType>(CanonicalType);
6130 return isa<LValueReferenceType>(CanonicalType);
6134 return isa<RValueReferenceType>(CanonicalType);
6138 if (
const auto *T = getAs<PointerType>())
6139 return T->getPointeeType()->isFunctionType();
6145 return isa<MemberPointerType>(CanonicalType);
6149 if (
const auto *T = getAs<MemberPointerType>())
6150 return T->isMemberFunctionPointer();
6156 if (
const auto *T = getAs<MemberPointerType>())
6157 return T->isMemberDataPointer();
6163 return isa<ArrayType>(CanonicalType);
6167 return isa<ConstantArrayType>(CanonicalType);
6171 return isa<IncompleteArrayType>(CanonicalType);
6175 return isa<VariableArrayType>(CanonicalType);
6179 return isa<DependentSizedArrayType>(CanonicalType);
6183 return isa<BuiltinType>(CanonicalType);
6187 return isa<RecordType>(CanonicalType);
6191 return isa<EnumType>(CanonicalType);
6195 return isa<ComplexType>(CanonicalType);
6199 return isa<VectorType>(CanonicalType);
6203 return isa<ExtVectorType>(CanonicalType);
6207 return isa<DependentAddressSpaceType>(CanonicalType);
6211 return isa<ObjCObjectPointerType>(CanonicalType);
6215 return isa<ObjCObjectType>(CanonicalType);
6219 return isa<ObjCInterfaceType>(CanonicalType) ||
6220 isa<ObjCObjectType>(CanonicalType);
6224 return isa<AtomicType>(CanonicalType);
6228 if (
const auto *OPT = getAs<ObjCObjectPointerType>())
6229 return OPT->isObjCQualifiedIdType();
6234 if (
const auto *OPT = getAs<ObjCObjectPointerType>())
6235 return OPT->isObjCQualifiedClassType();
6240 if (
const auto *OPT = getAs<ObjCObjectPointerType>())
6241 return OPT->isObjCIdType();
6246 if (
const auto *OPT = getAs<ObjCObjectPointerType>())
6247 return OPT->isObjCClassType();
6252 if (
const auto *OPT = getAs<PointerType>())
6253 return OPT->getPointeeType()->isSpecificBuiltinType(BuiltinType::ObjCSel);
6258 return isObjCIdType() || isObjCClassType() || isObjCSelType();
6261 #define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \ 6262 inline bool Type::is##Id##Type() const { \ 6263 return isSpecificBuiltinType(BuiltinType::Id); \ 6265 #include "clang/Basic/OpenCLImageTypes.def" 6268 return isSpecificBuiltinType(BuiltinType::OCLSampler);
6272 return isSpecificBuiltinType(BuiltinType::OCLEvent);
6276 return isSpecificBuiltinType(BuiltinType::OCLClkEvent);
6280 return isSpecificBuiltinType(BuiltinType::OCLQueue);
6284 return isSpecificBuiltinType(BuiltinType::OCLReserveID);
6288 #define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) is##Id##Type() || 6290 #include "clang/Basic/OpenCLImageTypes.def" 6295 return isa<PipeType>(CanonicalType);
6299 return isSamplerT() || isEventT() || isImageType() || isClkEventT() ||
6300 isQueueT() || isReserveIDT() || isPipeType();
6304 return isa<TemplateTypeParmType>(CanonicalType);
6315 if (
const auto *BT = dyn_cast<BuiltinType>(
this))
6316 return BT->isPlaceholderType();
6321 if (
const auto *BT = dyn_cast<BuiltinType>(
this))
6322 if (BT->isPlaceholderType())
6329 if (
const auto *BT = dyn_cast<BuiltinType>(
this))
6335 if (
const auto *BT = dyn_cast<BuiltinType>(
this))
6336 return BT->isNonOverloadPlaceholderType();
6341 if (
const auto *BT = dyn_cast<BuiltinType>(CanonicalType))
6342 return BT->getKind() == BuiltinType::Void;
6347 if (
const auto *BT = dyn_cast<BuiltinType>(CanonicalType))
6348 return BT->getKind() == BuiltinType::Half;
6354 if (
const auto *BT = dyn_cast<BuiltinType>(CanonicalType))
6355 return BT->getKind() == BuiltinType::Float16;
6360 if (
const auto *BT = dyn_cast<BuiltinType>(CanonicalType))
6361 return BT->getKind() == BuiltinType::Float128;
6366 if (
const auto *BT = getAs<BuiltinType>())
6367 return BT->getKind() == BuiltinType::NullPtr;
6375 if (
const auto *BT = dyn_cast<BuiltinType>(CanonicalType))
6376 return BT->getKind() >= BuiltinType::Bool &&
6377 BT->getKind() <= BuiltinType::Int128;
6378 if (
const EnumType *ET = dyn_cast<EnumType>(CanonicalType)) {
6388 if (
const auto *BT = dyn_cast<BuiltinType>(CanonicalType)) {
6389 return BT->getKind() >= BuiltinType::ShortAccum &&
6390 BT->getKind() <= BuiltinType::SatULongFract;
6396 if (
const auto *BT = dyn_cast<BuiltinType>(CanonicalType)) {
6397 return BT->getKind() >= BuiltinType::SatShortAccum &&
6398 BT->getKind() <= BuiltinType::SatULongFract;
6404 return isFixedPointType() && !isSaturatedFixedPointType();
6408 if (
const auto *BT = dyn_cast<BuiltinType>(CanonicalType)) {
6409 return ((BT->getKind() >= BuiltinType::ShortAccum &&
6410 BT->getKind() <= BuiltinType::LongAccum) ||
6411 (BT->getKind() >= BuiltinType::ShortFract &&
6412 BT->getKind() <= BuiltinType::LongFract) ||
6413 (BT->getKind() >= BuiltinType::SatShortAccum &&
6414 BT->getKind() <= BuiltinType::SatLongAccum) ||
6415 (BT->getKind() >= BuiltinType::SatShortFract &&
6416 BT->getKind() <= BuiltinType::SatLongFract));
6422 return isFixedPointType() && !isSignedFixedPointType();
6426 if (
const auto *BT = dyn_cast<BuiltinType>(CanonicalType))
6427 return BT->getKind() > BuiltinType::Void &&
6428 BT->getKind() <= BuiltinType::NullPtr;
6429 if (
const EnumType *ET = dyn_cast<EnumType>(CanonicalType))
6433 return isa<PointerType>(CanonicalType) ||
6434 isa<BlockPointerType>(CanonicalType) ||
6435 isa<MemberPointerType>(CanonicalType) ||
6436 isa<ComplexType>(CanonicalType) ||
6437 isa<ObjCObjectPointerType>(CanonicalType);
6441 if (
const auto *BT = dyn_cast<BuiltinType>(CanonicalType))
6442 return BT->getKind() >= BuiltinType::Bool &&
6443 BT->getKind() <= BuiltinType::Int128;
6447 if (
const auto *ET = dyn_cast<EnumType>(CanonicalType))
6454 if (
const auto *BT = dyn_cast<BuiltinType>(CanonicalType))
6455 return BT->getKind() == BuiltinType::Bool;
6460 auto *DT = getContainedDeducedType();
6461 return DT && !DT->isDeduced();
6467 return isDependentType() ||
isRecordType() || isEnumeralType();
6472 return isFunctionType() || isArrayType();
6476 return (isPointerType() || isReferenceType() || isBlockPointerType() ||
6477 isObjCObjectPointerType() || isNullPtrType());
6481 return isObjCObjectPointerType();
6487 type =
arrayType->getElementType().getTypePtr();
6520 template <
typename T>
6522 std::integral_constant<bool, std::is_same<T, ArrayType>::value ||
6523 std::is_base_of<ArrayType, T>::value>;
6528 "ArrayType cannot be used with getAs!");
6531 if (
const auto *Ty = dyn_cast<T>(
this))
6535 if (!isa<T>(CanonicalType))
6540 return cast<T>(getUnqualifiedDesugaredType());
6547 if (
const auto *Ty = dyn_cast<T>(
this))
6551 if (!isa<T>(CanonicalType))
6556 const Type *Ty =
this;
6558 if (
const auto *A = dyn_cast<AttributedType>(Ty))
6559 Ty = A->getModifiedType().getTypePtr();
6560 else if (
const auto *E = dyn_cast<ElaboratedType>(Ty))
6561 Ty = E->desugar().getTypePtr();
6562 else if (
const auto *
P = dyn_cast<ParenType>(Ty))
6563 Ty =
P->desugar().getTypePtr();
6564 else if (
const auto *A = dyn_cast<AdjustedType>(Ty))
6565 Ty = A->desugar().getTypePtr();
6572 return dyn_cast<T>(Ty);
6577 if (
const auto *arr = dyn_cast<ArrayType>(
this))
6581 if (!isa<ArrayType>(CanonicalType))
6586 return cast<ArrayType>(getUnqualifiedDesugaredType());
6591 "ArrayType cannot be used with castAs!");
6593 if (
const auto *ty = dyn_cast<T>(
this))
return ty;
6594 assert(isa<T>(CanonicalType));
6595 return cast<T>(getUnqualifiedDesugaredType());
6599 assert(isa<ArrayType>(CanonicalType));
6600 if (
const auto *arr = dyn_cast<ArrayType>(
this))
return arr;
6601 return cast<ArrayType>(getUnqualifiedDesugaredType());
6606 :
AdjustedType(Decayed, OriginalType, DecayedPtr, CanonicalPtr) {
6608 QualType Adjusted = getAdjustedType();
6610 assert(isa<PointerType>(Adjusted));
6615 QualType Decayed = getDecayedType();
6617 return cast<PointerType>(Decayed)->getPointeeType();
6623 const llvm::APSInt &Val,
6624 unsigned Scale,
unsigned Radix);
6628 #endif // LLVM_CLANG_AST_TYPE_H
bool isDynamicExceptionSpec(ExceptionSpecificationType ESpecType)
Internal representation of canonical, dependent typeof(expr) types.
unsigned char getOpaqueValue() const
ParameterABI getABI() const
Return the ABI treatment of this parameter.
QualType getPattern() const
Retrieve the pattern of this pack expansion, which is the type that will be repeatedly instantiated w...
const internal::VariadicAllOfMatcher< Type > type
Matches Types in the clang AST.
bool isFloatingPoint() const
QualType getDeducedType() const
Get the type deduced for this placeholder type, or null if it's either not been deduced or was deduce...
Represents a type that was referred to using an elaborated type keyword, e.g., struct S...
const Type * Ty
The locally-unqualified type.
void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Ctx)
Represents a function declaration or definition.
static bool classof(const Type *T)
static void print(SplitQualType split, raw_ostream &OS, const PrintingPolicy &policy, const Twine &PlaceHolder, unsigned Indentation=0)
static Qualifiers fromCVRUMask(unsigned CVRU)
bool isFixedPointType() const
Return true if this is a fixed point type according to ISO/IEC JTC1 SC22 WG14 N1169.
const TemplateSpecializationType * getInjectedTST() const
bool isKindOfTypeAsWritten() const
Whether this is a "__kindof" type as written.
The "enum" keyword introduces the elaborated-type-specifier.
bool isObjCQualifiedIdType() const
True if this is equivalent to 'id.
void setDependent(bool D=true)
no exception specification
IdentifierInfo * getIdentifier() const
const Type & operator*() const
RefQualifierKind getRefQualifier() const
Retrieve the ref-qualifier associated with this function type.
PointerType - C99 6.7.5.1 - Pointer Declarators.
ArrayRef< QualType > getTypeArgsAsWritten() const
Retrieve the type arguments of this object type as they were written.
bool operator==(Qualifiers Other) const
QualType getElementType() const
void Profile(llvm::FoldingSetNodeID &ID)
QualType getPointeeType() const
Represents the dependent type named by a dependently-scoped typename using declaration, e.g.
A (possibly-)qualified type.
bool isBlockPointerType() const
static void Profile(llvm::FoldingSetNodeID &ID, QualType Pointee)
ExtProtoInfo(CallingConv CC)
bool getNoCfCheck() const
bool isMemberPointerType() const
QualType getInjectedSpecializationType() const
unsigned getNumExceptions() const
static QualType getObjectType(APValue::LValueBase B)
Retrieves the "underlying object type" of the given expression, as used by __builtin_object_size.
void print(raw_ostream &OS, const PrintingPolicy &Policy, const Twine &PlaceHolder=Twine(), unsigned Indentation=0) const
QualType getDecayedType() const
__auto_type (GNU extension)
bool isMemberDataPointerType() const
QualType getDesugaredType(const ASTContext &Context) const
Return the specified type with any "sugar" removed from the type.
bool isCForbiddenLValueType() const
Determine whether expressions of the given type are forbidden from being lvalues in C...
LangAS getAddressSpace() const
void Profile(llvm::FoldingSetNodeID &ID) const
void Profile(llvm::FoldingSetNodeID &ID) const
ExtInfo withNoCallerSavedRegs(bool noCallerSavedRegs) const
DominatorTree GraphTraits specialization so the DominatorTree can be iterable by generic graph iterat...
Expr * getUnderlyingExpr() const
ObjCProtocolDecl *const * qual_iterator
ParameterABI getParameterABI(unsigned I) const
bool IsEnumDeclScoped(EnumDecl *ED)
Check if the given decl is scoped.
AutoTypeKeyword
Which keyword(s) were used to create an AutoType.
void setInstantiationDependent(bool D=true)
Stmt - This represents one statement.
NullabilityKind
Describes the nullability of a particular type.
FunctionType - C99 6.7.5.3 - Function Declarators.
QualType getPointeeType() const
If this is a pointer, ObjC object pointer, or block pointer, this returns the respective pointee...
static void Profile(llvm::FoldingSetNodeID &ID, Kind attrKind, QualType modified, QualType equivalent)
void Profile(llvm::FoldingSetNodeID &ID)
ExtInfo withNoCfCheck(bool noCfCheck) const
bool hasExtParameterInfos() const
Is there any interesting extra information for any of the parameters of this function type...
static void Profile(llvm::FoldingSetNodeID &ID, QualType Inner)
No linkage, which means that the entity is unique and can only be referred to from within its scope...
Qualifiers::GC getObjCGCAttr() const
void Profile(llvm::FoldingSetNodeID &ID)
void addConst()
Add the const type qualifier to this QualType.
bool hasStrongOrWeakObjCLifetime() const
True if the lifetime is either strong or weak.
Represents a qualified type name for which the type name is dependent.
CanonicalTTPTInfo CanTTPTInfo
void setObjCLifetime(ObjCLifetime type)
bool isRecordType() const
friend Qualifiers operator-(Qualifiers L, Qualifiers R)
Compute the difference between two qualifier sets.
ConstantArrayType(TypeClass tc, QualType et, QualType can, const llvm::APInt &size, ArraySizeModifier sm, unsigned tq)
void FixedPointValueToString(SmallVectorImpl< char > &Str, const llvm::APSInt &Val, unsigned Scale, unsigned Radix)
static bool classof(const Type *T)
bool isSpecificPlaceholderType(unsigned K) const
Test for a specific placeholder type.
static bool classof(const Type *T)
NestedNameSpecifier * getQualifier() const
Retrieve the qualification on this type.
bool isDecltypeAuto() const
static void Profile(llvm::FoldingSetNodeID &ID, QualType T)
SourceLocation getRBracketLoc() const
Decl - This represents one declaration (or definition), e.g.
void AddTaggedVal(intptr_t V, DiagnosticsEngine::ArgumentKind Kind) const
TagDecl * getDecl() const
ObjCObjectTypeBitfields ObjCObjectTypeBits
bool isExtVectorType() const
static bool classof(const Type *T)
Represents a C++11 auto or C++14 decltype(auto) type.
A class providing a concrete implementation of ObjCObjectType, so as to not increase the footprint of...
void removeQualifiers(Qualifiers Q)
Remove the qualifiers from the given set from this set.
QualType getNonReferenceType() const
If Type is a reference type (e.g., const int&), returns the type that the reference refers to ("const...
static bool classof(const Type *T)
const DiagnosticBuilder & operator<<(const DiagnosticBuilder &DB, const Attr *At)
The base class of the type hierarchy.
ObjCObjectType(enum Nonce_ObjCInterface)
bool hasPassObjectSize() const
void setObjCGCAttr(GC type)
Represents an array type, per C99 6.7.5.2 - Array Declarators.
void Profile(llvm::FoldingSetNodeID &ID)
AdjustedType(TypeClass TC, QualType OriginalTy, QualType AdjustedTy, QualType CanonicalPtr)
bool isRestrictQualified() const
Determine whether this type is restrict-qualified.
bool isPlaceholderType() const
Determines whether this type is a placeholder type, i.e.
static bool classof(const Type *T)
void Profile(llvm::FoldingSetNodeID &ID)
QualType withConst() const
bool getNoReturnAttr() const
Determine whether this function type includes the GNU noreturn attribute.
QualType ElementType
The element type of the vector.
RefQualifierKind RefQualifier
bool getHasRegParm() const
QualType getValueType() const
Gets the type contained by this atomic type, i.e.
exception_iterator exception_end() const
SourceLocation getAttributeLoc() const
bool isUnspecialized() const
Determine whether this object type is "unspecialized", meaning that it has no type arguments...
ObjCProtocolDecl * getProtocol(unsigned I) const
Fetch a protocol by index.
bool isUnspecialized() const
Whether this type is unspecialized, meaning that is has no type arguments.
TemplateTypeParmDecl * getDecl() const
Qualifiers & operator+=(Qualifiers R)
static void Profile(llvm::FoldingSetNodeID &ID, QualType ET, const llvm::APInt &ArraySize, ArraySizeModifier SizeMod, unsigned TypeQuals)
ExtParameterInfo withIsNoEscape(bool NoEscape) const
QualType getElementType() const
bool hasLocalNonFastQualifiers() const
Determine whether this particular QualType instance has any "non-fast" qualifiers, e.g., those that are stored in an ExtQualType instance.
TemplateName getTemplateName() const
Retrieve the name of the template that we are deducing.
QualType withFastQualifiers(unsigned TQs) const
The type would be trivial except that it is volatile-qualified.
static Qualifiers fromOpaqueValue(unsigned opaque)
ArrayRef< ObjCProtocolDecl * > getProtocols() const
Retrieve all of the protocol qualifiers.
void removeObjCLifetime()
bool isParamConsumed(unsigned I) const
unsigned getNumParams() const
bool isEnumeralType() const
const T * getAs() const
Member-template getAs<specific type>'.
bool isOverloadableType() const
Determines whether this is a type for which one can define an overloaded operator.
bool hasPointerRepresentation() const
Whether this type is represented natively as a pointer.
Extra information about a function prototype.
const ArrayType * castAsArrayTypeUnsafe() const
A variant of castAs<> for array type which silently discards qualifiers from the outermost type...
LangAS
Defines the address space values used by the address space qualifier of QualType. ...
ArrayTypeBitfields ArrayTypeBits
Represents a C++17 deduced template specialization type.
The "__interface" keyword.
ExtInfo withProducesResult(bool producesResult) const
SourceLocation getLBracketLoc() const
static Qualifiers fromFastMask(unsigned Mask)
static StringRef getTagTypeKindName(TagTypeKind Kind)
QualType(const Type *Ptr, unsigned Quals)
Describes how types, statements, expressions, and declarations should be printed. ...
static void * getAsVoidPointer(::clang::Type *P)
ExtParameterInfo withIsConsumed(bool consumed) const
bool isSpecializedAsWritten() const
Whether this type is specialized, meaning that it has type arguments.
Represents the result of substituting a type for a template type parameter.
void Profile(llvm::FoldingSetNodeID &ID)
QualType getLocalUnqualifiedType() const
Return this type with all of the instance-specific qualifiers removed, but without removing any quali...
Linkage
Describes the different kinds of linkage (C++ [basic.link], C99 6.2.2) that an entity may have...
noexcept(expression), value-dependent
std::string getName(ArrayRef< StringRef > Parts) const
Get the platform-specific name separator.
QualType desugar() const
Remove a single level of sugar.
The collection of all-type qualifiers we support.
bool isVariableArrayType() const
bool isNoexceptExceptionSpec(ExceptionSpecificationType ESpecType)
bool isObjCObjectOrInterfaceType() const
bool isDependentSizedArrayType() const
The width of the "fast" qualifier mask.
void Profile(llvm::FoldingSetNodeID &ID)
SourceLocation getAttributeLoc() const
Represents a struct/union/class.
void AddTaggedVal(intptr_t V, DiagnosticsEngine::ArgumentKind Kind) const
DependentTypeOfExprType(const ASTContext &Context, Expr *E)
QualType getOriginalType() const
FunctionType::ExtInfo ExtInfo
One of these records is kept for each identifier that is lexed.
bool operator==(ExtInfo Other) const
bool isObjCQualifiedClass() const
bool isLocalRestrictQualified() const
Determine whether this particular QualType instance has the "restrict" qualifier set, without looking through typedefs that may have added "restrict" at a different level.
bool isNothrow(bool ResultIfDependent=false) const
Determine whether this function type has a non-throwing exception specification.
unsigned getRegParm() const
QualType IgnoreParens() const
Returns the specified type after dropping any outer-level parentheses.
Represents a class type in Objective C.
QualType getPointeeType() const
std::pair< const Type *, Qualifiers > asPair() const
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
ArrayRef< QualType > getParamTypes() const
ArrayRef< ExtParameterInfo > getExtParameterInfos() const
static bool classof(const Type *T)
bool isSpelledAsLValue() const
bool isObjCIdType() const
TemplateName getTemplateName() const
Retrieve the name of the template that we are specializing.
bool isCanonicalUnqualified() const
Determines if this type would be canonical if it had no further qualification.
Defines the ExceptionSpecificationType enumeration and various utility functions. ...
QualType desugar() const
Remove a single level of sugar.
void Profile(llvm::FoldingSetNodeID &ID)
static bool classof(const Type *T)
void setLocalFastQualifiers(unsigned Quals)
bool isReferenceType() const
Base class that is common to both the ExtQuals and Type classes, which allows QualType to access the ...
static bool classof(const Type *T)
Interesting information about a specific parameter that can't simply be reflected in parameter's type...
static bool classof(const Type *T)
Represents the result of substituting a set of types for a template type parameter pack...
TagDecl * getOwnedTagDecl() const
Return the (re)declaration of this type owned by this occurrence of this type, or nullptr if none...
bool isSpecialized() const
Whether this type is specialized, meaning that it has type arguments.
bool hasNonTrivialObjCLifetime() const
True if the lifetime is neither None or ExplicitNone.
bool isSpecificBuiltinType(unsigned K) const
Test for a particular builtin type.
qual_iterator qual_begin() const
static void Profile(llvm::FoldingSetNodeID &ID, QualType ElementType, unsigned NumElements, TypeClass TypeClass, VectorKind VecKind)
static int getPointAccessorIdx(char c)
bool isObjCSelType() const
static void Profile(llvm::FoldingSetNodeID &ID, QualType Referencee, bool SpelledAsLValue)
bool isObjCQualifiedClassType() const
void Profile(llvm::FoldingSetNodeID &ID)
bool isAtLeastAsQualifiedAs(QualType Other) const
Determine whether this type is at least as qualified as the other given type, requiring exact equalit...
bool isIntegralOrEnumerationType() const
Determine whether this type is an integral or enumeration type.
bool isUnspecializedAsWritten() const
Determine whether this object type is "unspecialized" as written, meaning that it has no type argumen...
static bool classof(const Type *T)
unsigned getTypeQuals() const
ReferenceType(TypeClass tc, QualType Referencee, QualType CanonicalRef, bool SpelledAsLValue)
Qualifiers getLocalQualifiers() const
Retrieve the set of qualifiers local to this particular QualType instance, not including any qualifie...
FunctionType(TypeClass tc, QualType res, QualType Canonical, bool Dependent, bool InstantiationDependent, bool VariablyModified, bool ContainsUnexpandedParameterPack, ExtInfo Info)
Values of this type can be null.
void addRestrict()
Add the restrict qualifier to this QualType.
bool getProducesResult() const
static bool classof(const Type *T)
void Profile(llvm::FoldingSetNodeID &ID)
bool isObjCUnqualifiedClass() const
Type(TypeClass tc, QualType canon, bool Dependent, bool InstantiationDependent, bool VariablyModified, bool ContainsUnexpandedParameterPack)
An rvalue reference type, per C++11 [dcl.ref].
static bool classof(const Type *T)
UnresolvedUsingTypenameDecl * getDecl() const
qual_iterator qual_end() const
static bool classof(const Type *T)
bool hasAddressSpace() const
An lvalue ref-qualifier was provided (&).
void addObjCGCAttr(GC type)
Microsoft throw(...) extension.
A convenient class for passing around template argument information.
void setRestrict(bool flag)
static bool classof(const Type *T)
TemplateName getTemplateName() const
static void dump(llvm::raw_ostream &OS, StringRef FunctionName, ArrayRef< CounterExpression > Expressions, ArrayRef< CounterMappingRegion > Regions)
QualType getExceptionType(unsigned i) const
bool hasAddressSpace() const
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified...
const ArrayType * getAsArrayTypeUnsafe() const
A variant of getAs<> for array types which silently discards qualifiers from the outermost type...
The "struct" keyword introduces the elaborated-type-specifier.
TypeWithKeyword(ElaboratedTypeKeyword Keyword, TypeClass tc, QualType Canonical, bool Dependent, bool InstantiationDependent, bool VariablyModified, bool ContainsUnexpandedParameterPack)
Whether values of this type can be null is (explicitly) unspecified.
bool isCurrentInstantiation() const
True if this template specialization type matches a current instantiation in the context in which it ...
Visibility
Describes the different kinds of visibility that a declaration may have.
bool isTypeAlias() const
Determine if this template specialization type is for a type alias template that has been substituted...
unsigned toTargetAddressSpace(LangAS AS)
Visibility getVisibility() const
Determine the visibility of this type.
llvm::iterator_range< param_type_iterator > param_type_range
Represents a typeof (or typeof) expression (a GCC extension).
bool containsUnexpandedParameterPack() const
Whether this type is or contains an unexpanded parameter pack, used to support C++0x variadic templat...
static bool isRecordType(QualType T)
QualType withExactLocalFastQualifiers(unsigned TQs) const
void addCVRQualifiers(unsigned mask)
bool isNonOverloadPlaceholderType() const
Determines whether this type is a placeholder type other than Overload.
bool isVolatileQualified() const
Determine whether this type is volatile-qualified.
LangAS getAddressSpace() const
ObjCProtocolDecl *const * getProtocolStorage() const
const Type * getClass() const
bool isRValueReferenceType() const
void Profile(llvm::FoldingSetNodeID &ID)
Defines the Diagnostic-related interfaces.
The type is an Objective-C retainable pointer type that is qualified with the ARC __strong qualifier...
QualType getPointeeType() const
Values of this type can never be null.
Expr * getSizeExpr() const
static Qualifiers removeCommonQualifiers(Qualifiers &L, Qualifiers &R)
Returns the common set of qualifiers while removing them from the given sets.
const Type * getTypePtr() const
Retrieves a pointer to the underlying (unqualified) type.
void getAsStringInternal(std::string &Str, const PrintingPolicy &Policy) const
static bool classof(const Type *T)
const TemplateArgument * getArgs() const
Retrieve the template arguments.
param_type_iterator param_type_begin() const
TemplateTypeParmDecl * TTPDecl
void addQualifiers(Qualifiers Q)
Add the qualifiers from the given set to this set.
The type is an Objective-C retainable pointer type that is qualified with the ARC __strong qualifier...
bool hasDynamicExceptionSpec() const
Return whether this function has a dynamic (throw) exception spec.
static bool isBooleanType(QualType Ty)
Defines the Linkage enumeration and various utility functions.
const T * getAsAdjusted() const
Member-template getAsAdjusted<specific type>.
Represents an Objective-C protocol declaration.
const Type * operator->() const
void setUnaligned(bool flag)
bool isFloat128Type() const
static bool classof(const Type *T)
bool isScalarType() const
void * getAsOpaquePtr() const
bool compatiblyIncludesObjCLifetime(Qualifiers other) const
Determines if these qualifiers compatibly include another set of qualifiers from the narrow perspecti...
friend Qualifiers operator+(Qualifiers L, Qualifiers R)
void addCVRUQualifiers(unsigned mask)
Represents an ObjC class declaration.
ObjCInterfaceDecl * getInterface() const
Gets the interface declaration for this object type, if the base type really is an interface...
friend bool operator==(const QualType &LHS, const QualType &RHS)
Indicate whether the specified types and qualifiers are identical.
bool isKindOfType() const
Whether this is a "__kindof" type.
PrimitiveDefaultInitializeKind
FunctionDecl * SourceDecl
The function whose exception specification this is, for EST_Unevaluated and EST_Uninstantiated.
SplitQualType getSplitDesugaredType() const
The type does not fall into any of the following categories.
void setFastQualifiers(unsigned mask)
Expr * getSizeExpr() const
bool getNoCallerSavedRegs() const
QualType getPointeeTypeAsWritten() const
Expr * getSizeExpr() const
unsigned getNumProtocols() const
Return the number of qualifying protocols in this type, or 0 if there are none.
QualType getElementType() const
bool isUnsignedFixedPointType() const
Return true if this is a fixed point type that is unsigned according to ISO/IEC JTC1 SC22 WG14 N1169...
static void Profile(llvm::FoldingSetNodeID &ID, const TemplateTypeParmType *Replaced, QualType Replacement)
Represents an extended vector type where either the type or size is dependent.
This object can be modified without requiring retains or releases.
Defines the clang::Visibility enumeration and various utility functions.
The type does not fall into any of the following categories.
Qualifiers withoutObjCGCAttr() const
static void Profile(llvm::FoldingSetNodeID &ID, ElaboratedTypeKeyword Keyword, NestedNameSpecifier *NNS, const IdentifierInfo *Name)
static bool classof(const Type *T)
ExtInfo withCallingConv(CallingConv cc) const
Represents a K&R-style 'int foo()' function, which has no information available about its arguments...
unsigned getTypeQuals() const
Expr * getAddrSpaceExpr() const
Provides definitions for the various language-specific address spaces.
bool hasObjCLifetime() const
void Profile(llvm::FoldingSetNodeID &ID)
bool isSpecializedAsWritten() const
Determine whether this object type was written with type arguments.
QualType getBaseType() const
Gets the base type of this object type.
unsigned getLocalFastQualifiers() const
void Profile(llvm::FoldingSetNodeID &ID)
A little helper class used to produce diagnostics.
ExtQuals(const Type *baseType, QualType canon, Qualifiers quals)
FunctionDecl * getExceptionSpecDecl() const
If this function type has an exception specification which hasn't been determined yet (either because...
Represents a prototype with parameter type info, e.g.
bool compatiblyIncludes(Qualifiers other) const
Determines if these qualifiers compatibly include another set.
bool isSugared() const
Returns whether this type directly provides sugar.
bool isMoreQualifiedThan(QualType Other) const
Determine whether this type is more qualified than the other given type, requiring exact equality for...
bool isNonOverloadPlaceholderType() const
Test for a placeholder type other than Overload; see BuiltinType::isNonOverloadPlaceholderType.
This class wraps the list of protocol qualifiers.
Qualifiers getQualifiers() const
ArraySizeModifier
Capture whether this is a normal array (e.g.
const Type * getPointeeOrArrayElementType() const
If this is a pointer type, return the pointee type.
bool hasQualifiers() const
Determine whether this type has any qualifiers.
void addObjCLifetime(ObjCLifetime type)
ObjCTypeParamDecl * getDecl() const
bool isSaturatedFixedPointType() const
Return true if this is a saturated fixed point type according to ISO/IEC JTC1 SC22 WG14 N1169...
ObjCProtocolDecl ** getProtocolStorage()
void Profile(llvm::FoldingSetNodeID &ID)
static void Profile(llvm::FoldingSetNodeID &ID, ElaboratedTypeKeyword Keyword, NestedNameSpecifier *NNS, QualType NamedType, TagDecl *OwnedTagDecl)
Represents an array type in C++ whose size is a value-dependent expression.
static bool classof(const Type *T)
RecordType(TypeClass TC, RecordDecl *D)
static bool classof(const Type *T)
QualType getElementType() const
IdentifierInfo * getIdentifier() const
unsigned getNumArgs() const
Retrieve the number of template arguments.
bool isObjCGCStrong() const
true when Type is objc's strong.
Expr - This represents one expression.
QualType getPointeeType() const
static void getAsStringInternal(SplitQualType split, std::string &out, const PrintingPolicy &policy)
static bool classof(const Type *T)
The "typename" keyword precedes the qualified type name, e.g., typename T::type.
bool isFunctionNoProtoType() const
llvm::StringRef getAsString(SyncScope S)
unsigned getAsOpaqueValue() const
static Kind getNullabilityAttrKind(NullabilityKind kind)
Retrieve the attribute kind corresponding to the given nullability kind.
Declaration of a template type parameter.
unsigned getIndex() const
Internal representation of canonical, dependent decltype(expr) types.
bool getHasRegParm() const
friend bool operator!=(const QualType &LHS, const QualType &RHS)
bool isObjCBuiltinType() const
const T * castAs() const
Member-template castAs<specific type>.
static bool classof(const Type *T)
ElaboratedTypeKeyword
The elaboration keyword that precedes a qualified type name or introduces an elaborated-type-specifie...
static bool classof(const Type *T)
void Profile(llvm::FoldingSetNodeID &ID)
Qualifiers::GC getObjCGCAttr() const
Returns gc attribute of this type.
const internal::VariadicAllOfMatcher< Decl > decl
Matches declarations.
ObjCSubstitutionContext
The kind of type we are substituting Objective-C type arguments into.
bool isSignedInteger() const
bool isNullPtrType() const
bool hasFastQualifiers() const
unsigned getFastQualifiers() const
ExtProtoInfo withExceptionSpec(const ExceptionSpecInfo &O)
static bool classof(const Type *T)
void Profile(llvm::FoldingSetNodeID &ID) const
ObjCLifetime getObjCLifetime() const
void removeFastQualifiers(unsigned mask)
bool isObjCClassType() const
bool canDecayToPointerType() const
Determines whether this type can decay to a pointer type.
void Profile(llvm::FoldingSetNodeID &ID)
bool isSugared() const
Returns whether this type directly provides sugar.
bool isObjCIdType() const
True if this is equivalent to the 'id' type, i.e.
bool isAnyComplexType() const
const IdentifierInfo * getIdentifier() const
Retrieve the type named by the typename specifier as an identifier.
void Profile(llvm::FoldingSetNodeID &ID)
ArrayType(TypeClass tc, QualType et, QualType can, ArraySizeModifier sm, unsigned tq, bool ContainsUnexpandedParameterPack)
Represents a C++ template name within the type system.
Represents the type decltype(expr) (C++11).
void removeLocalVolatile()
void printTemplateArgumentList(raw_ostream &OS, ArrayRef< TemplateArgument > Args, const PrintingPolicy &Policy)
Print a template argument list, including the '<' and '>' enclosing the template arguments.
ObjCProtocolDecl * getProtocol(unsigned I) const
Retrieve a qualifying protocol by index on the object type.
const AstTypeMatcher< ArrayType > arrayType
Matches all kinds of arrays.
AutoType * getContainedAutoType() const
Get the AutoType whose type will be deduced for a variable with an initializer of this type...
A std::pair-like structure for storing a qualified type split into its local qualifiers and its local...
void Profile(llvm::FoldingSetNodeID &ID)
static Optional< NullabilityKind > stripOuterNullability(QualType &T)
Strip off the top-level nullability annotation on the given type, if it's there.
The type is an Objective-C retainable pointer type that is qualified with the ARC __weak qualifier...
static bool classof(const Type *T)
Qualifiers Quals
The local qualifiers.
void setAddressSpace(LangAS space)
bool isObjCUnqualifiedId() const
static bool classof(const Type *T)
A helper class for Type nodes having an ElaboratedTypeKeyword.
SourceLocation getEnd() const
Represents a GCC generic vector type.
ArraySizeModifier getSizeModifier() const
An lvalue reference type, per C++11 [dcl.ref].
unsigned getNumProtocols() const
Return the number of qualifying protocols on the object type.
Common base class for placeholders for types that get replaced by placeholder type deduction: C++11 a...
const Type * getBaseElementTypeUnsafe() const
Get the base element type of this type, potentially discarding type qualifiers.
const BuiltinType * getAsPlaceholderType() const
bool hasTargetSpecificAddressSpace() const
ObjCObjectType::qual_iterator qual_iterator
An iterator over the qualifiers on the object type.
The result type of a method or function.
static bool classof(const Type *T)
void removeLocalCVRQualifiers(unsigned Mask)
ExtInfo(bool noReturn, bool hasRegParm, unsigned regParm, CallingConv cc, bool producesResult, bool noCallerSavedRegs, bool NoCfCheck)
QualType withoutLocalFastQualifiers() const
bool isNull() const
Return true if this QualType doesn't point to a type yet.
bool IsEnumDeclComplete(EnumDecl *ED)
Check if the given decl is complete.
static ExtParameterInfo getFromOpaqueValue(unsigned char data)
void removeCVRQualifiers(unsigned mask)
static StringRef getIdentifier(const Token &Tok)
__UINTPTR_TYPE__ uintptr_t
An unsigned integer type with the property that any valid pointer to void can be converted to this ty...
CallingConv
CallingConv - Specifies the calling convention that a function uses.
Expr * getUnderlyingExpr() const
unsigned getCVRQualifiers() const
Retrieve the set of CVR (const-volatile-restrict) qualifiers applied to this type.
bool isSignedFixedPointType() const
Return true if this is a fixed point type that is signed according to ISO/IEC JTC1 SC22 WG14 N1169...
ExtInfo withNoReturn(bool noReturn) const
bool isConstQualified() const
Determine whether this type is const-qualified.
bool hasTrailingReturn() const
bool hasQualifiers() const
Return true if the set contains any qualifiers.
SplitQualType split() const
Divides a QualType into its unqualified type and a set of local qualifiers.
RecordDecl * getDecl() const
static void Profile(llvm::FoldingSetNodeID &ID, QualType Pointee)
noexcept(expression), evals to 'false'
llvm::iterator_range< qual_iterator > qual_range
static void * getAsVoidPointer(::clang::ExtQuals *P)
bool operator!=(ExtInfo Other) const
ArrayRef< QualType > getTypeArgsAsWritten() const
Retrieve the type arguments for this type.
CanThrowResult
Possible results from evaluation of a noexcept expression.
static void * getAsVoidPointer(clang::QualType P)
bool isComputedNoexcept(ExceptionSpecificationType ESpecType)
There is no lifetime qualification on this type.
static void Profile(llvm::FoldingSetNodeID &ID, QualType ResultType, ExtInfo Info)
void setNumProtocols(unsigned N)
is AltiVec 'vector Pixel'
Assigning into this object requires the old value to be released and the new value to be retained...
QualType getCanonicalType() const
bool isBuiltinType() const
Helper methods to distinguish type categories.
not a target-specific vector type
ExceptionSpecificationType Type
The kind of exception specification this is.
static bool classof(const Type *T)
param_type_range param_types() const
static bool classof(const Type *T)
ExtParameterInfo getExtParameterInfo(unsigned I) const
ElaboratedTypeKeyword getKeyword() const
ExtProtoInfo getExtProtoInfo() const
bool isAccessorWithinNumElements(char c, bool isNumericAccessor) const
void setVolatile(bool flag)
const ExtParameterInfo * ExtParameterInfos
Encodes a location in the source.
ObjCInterfaceDecl * getDecl() const
Get the declaration of this interface.
void addVolatile()
Add the volatile type qualifier to this QualType.
Sugar for parentheses used when specifying types.
QualType getAdjustedType() const
QualType getReturnType() const
A helper class that allows the use of isa/cast/dyncast to detect TagType objects of enums...
bool isMemberDataPointer() const
Returns true if the member type (i.e.
LangAS getAddressSpace() const
Return the address space of this type.
QualType getSingleStepDesugaredType(const ASTContext &Context) const
Return the specified type with one level of "sugar" removed from the type.
Represents typeof(type), a GCC extension.
Interfaces are the core concept in Objective-C for object oriented design.
bool isVariablyModifiedType() const
Whether this type is a variably-modified type (C99 6.7.5).
static inline ::clang::ExtQuals * getFromVoidPointer(void *P)
bool isObjCQualifiedClassType() const
True if this is equivalent to 'Class.
static bool classof(const Type *T)
bool hasObjCGCAttr() const
static bool classof(const Type *T)
Represents the declaration of a struct/union/class/enum.
static bool isPlaceholderTypeKind(Kind K)
Determines whether the given kind corresponds to a placeholder type.
CallingConv getCC() const
static bool classof(const Type *T)
void Profile(llvm::FoldingSetNodeID &ID)
QualType getElementType() const
static QualType getUnderlyingType(const SubRegion *R)
static void Profile(llvm::FoldingSetNodeID &ID, QualType T)
Represents a vector type where either the type or size is dependent.
static bool classof(const Type *T)
unsigned getLocalCVRQualifiers() const
Retrieve the set of CVR (const-volatile-restrict) qualifiers local to this particular QualType instan...
void initialize(ArrayRef< ObjCProtocolDecl *> protocols)
bool hasExceptionSpec() const
Return whether this function has any kind of exception spec.
bool hasObjCPointerRepresentation() const
Whether this type can represent an objective pointer type for the purpose of GC'ability.
void Profile(llvm::FoldingSetNodeID &ID)
Represents a C++ nested name specifier, such as "\::std::vector<int>::".
static void Profile(llvm::FoldingSetNodeID &ID, const Type *BaseType, Qualifiers Quals)
No ref-qualifier was provided.
bool isConsumed() const
Is this parameter considered "consumed" by Objective-C ARC? Consumed parameters must have retainable ...
bool isParameterPack() const
const TemplateTypeParmType * getReplacedParameter() const
Gets the template parameter that was substituted for.
QualType getEquivalentType() const
Expr * getNoexceptExpr() const
CanQual< Type > CanQualType
Represents a canonical, potentially-qualified type.
void Profile(llvm::FoldingSetNodeID &ID)
AttributedTypeBitfields AttributedTypeBits
QualType getInnerType() const
Qualifiers withoutObjCLifetime() const
static void Profile(llvm::FoldingSetNodeID &ID, QualType Deduced, AutoTypeKeyword Keyword, bool IsDependent)
ExceptionSpecInfo(ExceptionSpecificationType EST)
bool isMemberFunctionPointerType() const
bool isObjCObjectPointerType() const
bool isAnyPointerType() const
is AltiVec 'vector bool ...'
RefQualifierKind
The kind of C++11 ref-qualifier associated with a function type.
SplitQualType getSplitUnqualifiedType() const
Retrieve the unqualified variant of the given type, removing as little sugar as possible.
NestedNameSpecifier * getQualifier() const
Retrieve the qualification on this type.
bool isFunctionProtoType() const
DestructionKind isDestructedType() const
Returns a nonzero value if objects of this type require non-trivial work to clean up after...
static bool classof(const Type *T)
AutoTypeKeyword getKeyword() const
bool isAddressSpaceOverlapping(const PointerType &other) const
Returns true if address spaces of pointers overlap.
Qualifiers getIndexTypeQualifiers() const
TypeClass getTypeClass() const
Qualifiers & operator-=(Qualifiers R)
ArrayRef< TemplateArgument > template_arguments() const
QualType getSuperClassType() const
Retrieve the type of the superclass of this object type.
friend bool operator!=(ExtParameterInfo lhs, ExtParameterInfo rhs)
bool isTargetAddressSpace(LangAS AS)
static bool isVectorSizeTooLarge(unsigned NumElements)
EnumDecl * getDecl() const
const char * getNameAsCString(const PrintingPolicy &Policy) const
bool isVectorType() const
__DEVICE__ void * memcpy(void *__a, const void *__b, size_t __c)
An rvalue ref-qualifier was provided (&&).
SourceRange getBracketsRange() const
void addFastQualifiers(unsigned TQs)
Optional< unsigned > getNumExpansions() const
Retrieve the number of expansions that this pack expansion will generate, if known.
static QualType getFromOpaquePtr(const void *Ptr)
void setVariablyModified(bool VM=true)
ParameterABI
Kinds of parameter ABI.
bool isLocalVolatileQualified() const
Determine whether this particular QualType instance has the "volatile" qualifier set, without looking through typedefs that may have added "volatile" at a different level.
bool isInstantiationDependentType() const
Determine whether this type is an instantiation-dependent type, meaning that the type involves a temp...
void Profile(llvm::FoldingSetNodeID &ID)
bool isTemplateTypeParmType() const
ExceptionSpecificationType getExceptionSpecType() const
Get the kind of exception specification on this function.
Represents a pointer type decayed from an array or function type.
The type is an Objective-C retainable pointer type that is qualified with the ARC __weak qualifier...
The injected class name of a C++ class template or class template partial specialization.
exception_iterator exception_begin() const
QualType getPointeeType() const
Represents a pack expansion of types.
Defines various enumerations that describe declaration and type specifiers.
bool isPlaceholderType() const
Test for a type which does not represent an actual type-system type but is instead used as a placehol...
bool isObjCGCWeak() const
true when Type is objc's weak.
Base class for declarations which introduce a typedef-name.
QualType withVolatile() const
friend bool operator!=(SplitQualType a, SplitQualType b)
Represents a template argument.
static bool classof(const Type *T)
Represents a type which was implicitly adjusted by the semantic engine for arbitrary reasons...
QualType withRestrict() const
TagTypeKind
The kind of a tag type.
StreamedQualTypeHelper stream(const PrintingPolicy &Policy, const Twine &PlaceHolder=Twine(), unsigned Indentation=0) const
Dataflow Directional Tag Classes.
bool isUnsaturatedFixedPointType() const
Return true if this is a saturated fixed point type according to ISO/IEC JTC1 SC22 WG14 N1169...
SourceLocation getRBracketLoc() const
bool isFloat16Type() const
ExtInfo getExtInfo() const
bool isObjCIdOrClassType() const
True if this is equivalent to the 'id' or 'Class' type,.
not evaluated yet, for special member function
A qualifier set is used to build a set of qualifiers.
NestedNameSpecifier * getQualifier() const
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
void setContainsUnexpandedParameterPack(bool PP=true)
static bool classof(const Type *T)
TypeWithKeywordBitfields TypeWithKeywordBits
ArrayRef< QualType > getTypeArgs() const
Retrieve the type arguments for this type.
void removeLocalFastQualifiers()
static bool classof(const Type *T)
static bool classof(const Type *T)
const TemplateArgument * getArgs() const
Retrieve the template arguments.
bool isObjCClassType() const
True if this is equivalent to the 'Class' type, i.e.
Reads an AST files chain containing the contents of a translation unit.
TypedefType(TypeClass tc, const TypedefNameDecl *D, QualType can)
bool isDependentAddressSpaceType() const
StreamedQualTypeHelper(const QualType &T, const PrintingPolicy &Policy, const Twine &PlaceHolder, unsigned Indentation)
bool hasLocalQualifiers() const
Determine whether this particular QualType instance has any qualifiers, without looking through any t...
QualType getUnderlyingType() const
const Type * getBaseType() const
Represents a dependent using declaration which was marked with typename.
Represents the declaration of an Objective-C type parameter.
VectorKind getVectorKind() const
ArrayRef< QualType > exceptions() const
static std::string getAsString(SplitQualType split, const PrintingPolicy &Policy)
The "union" keyword introduces the elaborated-type-specifier.
bool isBooleanType() const
const Type * strip(QualType type)
Collect any qualifiers on the given type and return an unqualified type.
void Profile(llvm::FoldingSetNodeID &ID)
const ObjCObjectType * getObjectType() const
Gets the type pointed to by this ObjC pointer.
The "class" keyword introduces the elaborated-type-specifier.
friend raw_ostream & operator<<(raw_ostream &OS, const StreamedQualTypeHelper &SQT)
ReferenceTypeBitfields ReferenceTypeBits
FunctionType::ExtInfo getFunctionExtInfo(const Type &t)
void Profile(llvm::FoldingSetNodeID &ID)
QualType(const ExtQuals *Ptr, unsigned Quals)
A pointer to member type per C++ 8.3.3 - Pointers to members.
QualType getCallResultType(const ASTContext &Context) const
Determine the type of an expression that calls a function of this type.
bool hasObjCLifetime() const
SplitQualType getSingleStepDesugaredType() const
void setCVRQualifiers(unsigned mask)
static void Profile(llvm::FoldingSetNodeID &ID, QualType Orig, QualType New)
static void Profile(llvm::FoldingSetNodeID &ID, QualType Pattern, Optional< unsigned > NumExpansions)
const TemplateTypeParmType * getReplacedParameter() const
Gets the template parameter that was substituted for.
void Profile(llvm::FoldingSetNodeID &ID)
bool isUndeducedType() const
Determine whether this type is an undeduced type, meaning that it somehow involves a C++11 'auto' typ...
Qualifiers::ObjCLifetime getObjCLifetime() const
static bool classof(const Type *T)
void Profile(llvm::FoldingSetNodeID &ID) const
void addConsistentQualifiers(Qualifiers qs)
Add the qualifiers from the given set to this set, given that they don't conflict.
bool hasCVRQualifiers() const
bool isObjCUnqualifiedIdOrClass() const
void removeCVRQualifiers()
QualType getModifiedType() const
static void Profile(llvm::FoldingSetNodeID &ID, QualType T, bool isRead)
Represents a pointer to an Objective C object.
static bool classof(const Type *T)
bool isUnspecializedAsWritten() const
Determine whether this object type is "unspecialized" as written, meaning that it has no type argumen...
FunctionTypeBitfields FunctionTypeBits
bool isIncompleteArrayType() const
FunctionDecl * SourceTemplate
The function template whose exception specification this is instantiated from, for EST_Uninstantiated...
A helper class that allows the use of isa/cast/dyncast to detect TagType objects of structs/unions/cl...
Complex values, per C99 6.2.5p11.
unsigned getIndexTypeCVRQualifiers() const
static bool classof(const Type *T)
unsigned getNumArgs() const
Retrieve the number of template arguments.
static bool classof(const Type *T)
bool isObjCQualifiedId() const
static bool classof(const OMPClause *T)
ObjCInterfaceDecl * getInterfaceDecl() const
If this pointer points to an Objective @interface type, gets the declaration for that interface...
QualType getCanonicalTypeInternal() const
AutoTypeBitfields AutoTypeBits
static bool classof(const Type *T)
bool isReserveIDT() const
bool isIntegerType() const
isIntegerType() does not include complex integers (a GCC extension).
bool hasNonTrivialObjCLifetime() const
bool isFromAST() const
Whether this type comes from an AST file.
void Profile(llvm::FoldingSetNodeID &ID)
static bool classof(const Type *T)
const llvm::APInt & getSize() const
bool isAtomicType() const
bool isFunctionType() const
bool hasNonFastQualifiers() const
Return true if the set contains any qualifiers which require an ExtQuals node to be allocated...
bool isAddressSpaceSupersetOf(Qualifiers other) const
Returns true if this address space is a superset of the other one.
VectorTypeBitfields VectorTypeBits
bool isObjCQualifiedIdType() const
std::integral_constant< bool, std::is_same< T, ArrayType >::value||std::is_base_of< ArrayType, T >::value > TypeIsArrayType
static bool classof(const Type *T)
llvm::iterator_range< qual_iterator > qual_range
ExtVectorType - Extended vector type.
Base for LValueReferenceType and RValueReferenceType.
SourceRange getBracketsRange() const
friend bool operator==(ExtParameterInfo lhs, ExtParameterInfo rhs)
ExceptionSpecificationType
The various types of exception specifications that exist in C++11.
QualType getUnderlyingType() const
static bool classof(const Type *T)
static bool classof(const Type *T)
Implements a partial diagnostic that can be emitted anwyhere in a DiagnosticBuilder stream...
bool isConstantArrayType() const
QualType getNonLValueExprType(const ASTContext &Context) const
Determine the type of a (typically non-lvalue) expression with the specified result type...
static clang::QualType getFromVoidPointer(void *P)
const Type * getTypePtrOrNull() const
bool isObjectType() const
Determine whether this type is an object type.
ArrayRef< QualType > Exceptions
Explicitly-specified list of exception types.
ExtParameterInfo withHasPassObjectSize() const
bool isObjCObjectType() const
bool hasObjCGCAttr() const
bool hasNoexceptExceptionSpec() const
Return whether this function has a noexcept exception spec.
QualType withCVRQualifiers(unsigned CVR) const
bool isLValueReferenceType() const
VectorType::VectorKind getVectorKind() const
TypedefNameDecl * getDecl() const
Reading or writing from this object requires a barrier call.
Expr * NoexceptExpr
Noexcept expression, if this is a computed noexcept specification.
static void Profile(llvm::FoldingSetNodeID &ID, QualType Pointee, const Type *Class)
unsigned getDepth() const
An attributed type is a type to which a type attribute has been applied.
QualType getParamType(unsigned i) const
Represents a type parameter type in Objective C.
bool isCanonicalAsParam() const
CallingConv getCallConv() const
Defines the clang::SourceLocation class and associated facilities.
void Profile(llvm::FoldingSetNodeID &ID)
QualType getAliasedType() const
Get the aliased type, if this is a specialization of a type alias template.
QualType getUnqualifiedType() const
Retrieve the unqualified variant of the given type, removing as little sugar as possible.
bool hasUnaligned() const
Represents a C++ struct/union/class.
void removeLocalRestrict()
Represents a template specialization type whose template cannot be resolved, e.g. ...
ArrayRef< TemplateArgument > template_arguments() const
bool isMemberFunctionPointer() const
Returns true if the member type (i.e.
bool isLocalConstQualified() const
Determine whether this particular QualType instance has the "const" qualifier set, without looking through typedefs that may have added "const" at a different level.
bool hasStrongOrWeakObjCLifetime() const
qual_iterator qual_end() const
static bool classof(const Type *T)
Represents a C array with an unspecified size.
SplitQualType(const Type *ty, Qualifiers qs)
void removeFastQualifiers()
static inline ::clang::Type * getFromVoidPointer(void *P)
Qualifiers getQualifiers() const
Retrieve the set of qualifiers applied to this type.
The parameter type of a method or function.
QualType getNamedType() const
Retrieve the type named by the qualified-id.
DeducedType(TypeClass TC, QualType DeducedAsType, bool IsDependent, bool IsInstantiationDependent, bool ContainsParameterPack)
QualType getReplacementType() const
Gets the type that was substituted for the template parameter.
void Profile(llvm::FoldingSetNodeID &ID)
qual_iterator qual_begin() const
unsigned kind
All of the diagnostics that can be emitted by the frontend.
This class is used for builtin types like 'int'.
Writes an AST file containing the contents of a translation unit.
unsigned getRegParmType() const
static bool isCharType(QualType T)
void Profile(llvm::FoldingSetNodeID &ID)
static bool classof(const Type *T)
Qualifiers getNonFastQualifiers() const
bool isVisibilityExplicit() const
Return true if the visibility was explicitly set is the code.
void removeLocalFastQualifiers(unsigned Mask)
unsigned getCVRQualifiers() const
static Qualifiers fromCVRMask(unsigned CVR)
SourceLocation getLBracketLoc() const
static Decl::Kind getKind(const Decl *D)
unsigned getNumElements() const
bool isFundamentalType() const
Tests whether the type is categorized as a fundamental type.
bool isDependentType() const
Whether this type is a dependent type, meaning that its definition somehow depends on a template para...
Represents an extended address space qualifier where the input address space value is dependent...
Represents a type template specialization; the template must be a class template, a type alias templa...
bool isPointerType() const
static void Profile(llvm::FoldingSetNodeID &ID, QualType Element)
unsigned getAddressSpaceAttributePrintValue() const
Get the address space attribute value to be printed by diagnostics.
void addAddressSpace(LangAS space)
RecordType(const RecordDecl *D)
static void Profile(llvm::FoldingSetNodeID &ID, QualType ET, ArraySizeModifier SizeMod, unsigned TypeQuals)
static SimpleType getSimplifiedValue(::clang::QualType Val)
We can encode up to four bits in the low bits of a type pointer, but there are many more type qualifi...
ExtParameterInfo withABI(ParameterABI kind) const
BuiltinTypeBitfields BuiltinTypeBits
static int getNumericAccessorIdx(char c)
A trivial tuple used to represent a source range.
This represents a decl that may have a name.
void addFastQualifiers(unsigned mask)
bool isOpenCLSpecificType() const
FunctionDecl * getExceptionSpecTemplate() const
If this function type has an uninstantiated exception specification, this is the function whose excep...
Represents a C array with a specified size that is not an integer-constant-expression.
No keyword precedes the qualified type name.
bool isConstant(const ASTContext &Ctx) const
static int getAccessorIdx(char c, bool isNumericAccessor)
SourceLocation getAttributeLoc() const
void Profile(llvm::FoldingSetNodeID &ID)
QualType getElementType() const
void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Context)
const ExtParameterInfo * getExtParameterInfosOrNull() const
Return a pointer to the beginning of the array of extra parameter information, if present...
bool isFunctionPointerType() const
friend bool operator==(SplitQualType a, SplitQualType b)
static void Profile(llvm::FoldingSetNodeID &ID, UnresolvedUsingTypenameDecl *D)
void removeAddressSpace()
SourceLocation getBegin() const
QualifierCollector(Qualifiers Qs=Qualifiers())
bool operator!=(Qualifiers Other) const
The "__interface" keyword introduces the elaborated-type-specifier.
The superclass of a type.
Represents the canonical version of C arrays with a specified constant size.
ExceptionSpecInfo ExceptionSpec
bool isUnsignedInteger() const
static bool classof(const Type *T)
ExtInfo withRegParm(unsigned RegParm) const
A class which abstracts out some details necessary for making a call.
static bool classof(const Type *T)
bool isIncompleteOrObjectType() const
Return true if this is an incomplete or object type, in other words, not a function type...
bool hasSizedVLAType() const
Whether this type involves a variable-length array type with a definite size.
static void Profile(llvm::FoldingSetNodeID &ID, unsigned Depth, unsigned Index, bool ParameterPack, TemplateTypeParmDecl *TTPDecl)
QualType getPointeeType() const
void Profile(llvm::FoldingSetNodeID &ID)
noexcept(expression), evals to 'true'
const IdentifierInfo * getIdentifier() const
Expr * getSizeExpr() const
Qualifiers::ObjCLifetime getObjCLifetime() const
Returns lifetime attribute of this type.
param_type_iterator param_type_end() const
static void Profile(llvm::FoldingSetNodeID &ID, TemplateName Template, QualType Deduced, bool IsDependent)
bool isCompoundType() const
Tests whether the type is categorized as a compound type.
QualType getPointeeType() const
Gets the type pointed to by this ObjC pointer.