17 #ifndef LLVM_CLANG_AST_TYPE_H 18 #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" 48 #include "llvm/Support/TrailingObjects.h" 54 #include <type_traits> 70 namespace serialization {
71 template <
class T>
class AbstractTypeReader;
108 template <
typename>
class CanQual;
113 class ExtQualsTypeCommonBase;
115 class IdentifierInfo;
117 class ObjCInterfaceDecl;
118 class ObjCProtocolDecl;
119 class ObjCTypeParamDecl;
120 struct PrintingPolicy;
124 class TemplateArgument;
125 class TemplateArgumentListInfo;
126 class TemplateArgumentLoc;
127 class TemplateTypeParmDecl;
128 class TypedefNameDecl;
129 class UnresolvedUsingTypenameDecl;
134 #define TYPE(Class, Base) class Class##Type; 135 #include "clang/AST/TypeNodes.inc" 149 CVRMask =
Const | Volatile | Restrict
183 MaxAddressSpace = 0x7fffffu,
189 FastMask = (1 << FastWidth) - 1
196 if (!(L.Mask & ~CVRMask) && !(R.Mask & ~CVRMask)) {
198 Q.Mask = L.Mask & R.Mask;
280 assert(!(mask & ~CVRMask) &&
"bitmask contains non-CVR bits");
281 Mask = (Mask & ~CVRMask) | mask;
284 assert(!(mask & ~CVRMask) &&
"bitmask contains non-CVR bits");
288 removeCVRQualifiers(CVRMask);
291 assert(!(mask & ~CVRMask) &&
"bitmask contains non-CVR bits");
295 assert(!(mask & ~CVRMask & ~UMask) &&
"bitmask contains non-CVRU bits");
301 Mask = (Mask & ~UMask) | (flag ? UMask : 0);
309 Mask = (Mask & ~GCAttrMask) | (type << GCAttrShift);
334 return ObjCLifetime((Mask & LifetimeMask) >> LifetimeShift);
337 Mask = (Mask & ~LifetimeMask) | (type << LifetimeShift);
342 assert(!hasObjCLifetime());
343 Mask |= (type << LifetimeShift);
349 return (lifetime > OCL_ExplicitNone);
355 return (lifetime == OCL_Strong || lifetime == OCL_Weak);
360 return static_cast<LangAS>(Mask >> AddressSpaceShift);
367 auto Addr = getAddressSpace();
380 assert((
unsigned)space <= MaxAddressSpace);
381 Mask = (Mask & ~AddressSpaceMask)
382 | (((uint32_t) space) << AddressSpaceShift);
387 setAddressSpace(space);
395 assert(!(mask & ~FastMask) &&
"bitmask contains non-fast qualifier bits");
396 Mask = (Mask & ~FastMask) | mask;
399 assert(!(mask & ~FastMask) &&
"bitmask contains non-fast qualifier bits");
403 removeFastQualifiers(FastMask);
406 assert(!(mask & ~FastMask) &&
"bitmask contains non-fast qualifier bits");
421 bool empty()
const {
return !Mask; }
427 if (!(Q.Mask & ~CVRMask))
430 Mask |= (Q.Mask & CVRMask);
444 if (!(Q.Mask & ~CVRMask))
447 Mask &= ~(Q.Mask & CVRMask);
451 removeObjCLifetime();
453 removeAddressSpace();
490 return isAddressSpaceSupersetOf(getAddressSpace(), other.
getAddressSpace());
497 return isAddressSpaceSupersetOf(other) &&
500 (getObjCGCAttr() == other.
getObjCGCAttr() || !hasObjCGCAttr() ||
505 (((Mask & CVRMask) | (other.Mask & CVRMask)) == (Mask & CVRMask)) &&
521 if (getObjCLifetime() == OCL_Weak || other.
getObjCLifetime() == OCL_Weak)
524 if (getObjCLifetime() == OCL_None || other.
getObjCLifetime() == OCL_None)
532 bool isStrictSupersetOf(
Qualifiers Other)
const;
537 explicit operator bool()
const {
return hasQualifiers(); }
565 static std::string getAddrSpaceAsString(
LangAS AS);
569 bool appendSpaceIfNonEmpty =
false)
const;
580 static const uint32_t UMask = 0x8;
581 static const uint32_t UShift = 3;
582 static const uint32_t GCAttrMask = 0x30;
583 static const uint32_t GCAttrShift = 4;
584 static const uint32_t LifetimeMask = 0x1C0;
585 static const uint32_t LifetimeShift = 6;
586 static const uint32_t AddressSpaceMask =
587 ~(CVRMask | UMask | GCAttrMask | LifetimeMask);
588 static const uint32_t AddressSpaceShift = 9;
606 std::pair<const Type *,Qualifiers>
asPair()
const {
607 return std::pair<const Type *, Qualifiers>(Ty, Quals);
658 llvm::PointerIntPair<llvm::PointerUnion<const Type *, const ExtQuals *>,
661 const ExtQuals *getExtQualsUnsafe()
const {
662 return Value.getPointer().get<
const ExtQuals*>();
665 const Type *getTypePtrUnsafe()
const {
666 return Value.getPointer().get<
const Type*>();
670 assert(!isNull() &&
"Cannot retrieve a NULL type pointer");
671 auto CommonPtrVal =
reinterpret_cast<uintptr_t>(Value.getOpaqueValue());
688 const Type *getTypePtr()
const;
690 const Type *getTypePtrOrNull()
const;
703 T.Value.setFromOpaqueValue(const_cast<void*>(Ptr));
708 return *getTypePtr();
715 bool isCanonical()
const;
716 bool isCanonicalAsParam()
const;
720 return Value.getPointer().isNull();
731 bool isConstQualified()
const;
741 bool isRestrictQualified()
const;
751 bool isVolatileQualified()
const;
757 return getLocalFastQualifiers() || hasLocalNonFastQualifiers();
761 bool hasQualifiers()
const;
767 return Value.getPointer().is<
const ExtQuals*>();
782 return getLocalFastQualifiers();
787 unsigned getCVRQualifiers()
const;
794 bool isPODType(
const ASTContext &Context)
const;
798 bool isCXX98PODType(
const ASTContext &Context)
const;
804 bool isCXX11PODType(
const ASTContext &Context)
const;
807 bool isTrivialType(
const ASTContext &Context)
const;
810 bool isTriviallyCopyableType(
const ASTContext &Context)
const;
814 bool mayBeDynamicClass()
const;
817 bool mayBeNotDynamicClass()
const;
847 return withFastQualifiers(CVR);
852 &&
"non-fast qualifier bits set in mask!");
853 Value.setInt(Value.getInt() | TQs);
856 void removeLocalConst();
857 void removeLocalVolatile();
858 void removeLocalRestrict();
859 void removeLocalCVRQualifiers(
unsigned Mask);
864 Value.setInt(Value.getInt() & ~Mask);
913 inline QualType getUnqualifiedType()
const;
928 bool isMoreQualifiedThan(
QualType Other)
const;
932 bool isAtLeastAsQualifiedAs(
QualType Other)
const;
934 QualType getNonReferenceType()
const;
955 return getDesugaredType(*
this, Context);
959 return getSplitDesugaredType(*
this);
968 return getSingleStepDesugaredTypeImpl(*
this, Context);
974 if (isa<ParenType>(*
this))
981 return LHS.Value == RHS.Value;
984 return LHS.Value != RHS.Value;
987 return LHS.Value < RHS.Value;
1001 const Twine &PlaceHolder = Twine(),
1002 unsigned Indentation = 0)
const;
1006 unsigned Indentation = 0) {
1007 return print(split.
Ty, split.
Quals, OS, policy, PlaceHolder, Indentation);
1012 const Twine &PlaceHolder,
1013 unsigned Indentation = 0);
1015 void getAsStringInternal(std::string &Str,
1020 return getAsStringInternal(split.
Ty, split.
Quals, out, policy);
1030 const Twine &PlaceHolder;
1031 unsigned Indentation;
1035 const Twine &PlaceHolder,
unsigned Indentation)
1036 : T(T), Policy(Policy), PlaceHolder(PlaceHolder),
1037 Indentation(Indentation) {}
1041 SQT.T.
print(OS, SQT.Policy, SQT.PlaceHolder, SQT.Indentation);
1047 const Twine &PlaceHolder = Twine(),
1048 unsigned Indentation = 0)
const {
1052 void dump(
const char *s)
const;
1054 void dump(llvm::raw_ostream &OS)
const;
1057 ID.AddPointer(getAsOpaquePtr());
1061 inline bool hasAddressSpace()
const;
1064 inline LangAS getAddressSpace()
const;
1093 bool isNonWeakInMRRWithObjCWeak(
const ASTContext &Context)
const;
1119 isNonTrivialToPrimitiveDefaultInitialize()
const;
1167 DK_nontrivial_c_struct
1175 return isDestructedTypeImpl(*
this);
1182 bool hasNonTrivialToPrimitiveDefaultInitializeCUnion()
const;
1187 bool hasNonTrivialToPrimitiveDestructCUnion()
const;
1192 bool hasNonTrivialToPrimitiveCopyCUnion()
const;
1204 bool isCForbiddenLValueType()
const;
1252 QualType getAtomicUnqualifiedType()
const;
1268 static bool hasNonTrivialToPrimitiveDefaultInitializeCUnion(
const RecordDecl *RD);
1269 static bool hasNonTrivialToPrimitiveDestructCUnion(
const RecordDecl *RD);
1270 static bool hasNonTrivialToPrimitiveCopyCUnion(
const RecordDecl *RD);
1299 enum { NumLowBitsAvailable = 0 };
1319 const Type *
const BaseType;
1325 : BaseType(baseType), CanonicalType(canon) {}
1361 canon.isNull() ?
QualType(this_(), 0) : canon),
1364 &&
"ExtQuals created with no fast qualifiers");
1366 &&
"ExtQuals created with fast qualifiers");
1386 Profile(ID, getBaseType(), Quals);
1390 const Type *BaseType,
1393 ID.AddPointer(BaseType);
1453 #define TYPE(Class, Base) Class, 1454 #define LAST_TYPE(Class) TypeLast = Class 1455 #define ABSTRACT_TYPE(Class, Base) 1456 #include "clang/AST/TypeNodes.inc" 1461 class TypeBitfields {
1463 template <
class T>
friend class TypePropertyCache;
1469 unsigned Dependent : 1;
1473 unsigned InstantiationDependent : 1;
1476 unsigned VariablyModified : 1;
1480 unsigned ContainsUnexpandedParameterPack : 1;
1484 mutable unsigned CacheValid : 1;
1487 mutable unsigned CachedLinkage : 3;
1490 mutable unsigned CachedLocalOrUnnamed : 1;
1493 mutable unsigned FromAST : 1;
1495 bool isCacheValid()
const {
1500 assert(isCacheValid() &&
"getting linkage from invalid cache");
1501 return static_cast<Linkage>(CachedLinkage);
1504 bool hasLocalOrUnnamedType()
const {
1505 assert(isCacheValid() &&
"getting linkage from invalid cache");
1506 return CachedLocalOrUnnamed;
1509 enum { NumTypeBits = 18 };
1518 unsigned : NumTypeBits;
1522 unsigned IndexTypeQuals : 3;
1527 unsigned SizeModifier : 3;
1533 unsigned : NumTypeBits + 3 + 3;
1536 unsigned HasStoredSizeExpr : 1;
1542 unsigned : NumTypeBits;
1555 unsigned : NumTypeBits;
1559 unsigned ExtInfo : 12;
1564 unsigned RefQualifier : 2;
1574 unsigned HasExtQuals : 1;
1580 unsigned NumParams : 16;
1583 unsigned ExceptionSpecType : 4;
1586 unsigned HasExtParameterInfos : 1;
1589 unsigned Variadic : 1;
1592 unsigned HasTrailingReturn : 1;
1598 unsigned : NumTypeBits;
1601 unsigned NumTypeArgs : 7;
1604 unsigned NumProtocols : 6;
1607 unsigned IsKindOf : 1;
1613 unsigned : NumTypeBits;
1626 unsigned SpelledAsLValue : 1;
1630 unsigned InnerRef : 1;
1636 unsigned : NumTypeBits;
1639 unsigned Keyword : 8;
1642 enum { NumTypeWithKeywordBits = 8 };
1647 unsigned : NumTypeBits;
1648 unsigned : NumTypeWithKeywordBits;
1651 unsigned HasOwnedTagDecl : 1;
1658 unsigned : NumTypeBits;
1662 unsigned VecKind : 3;
1665 unsigned NumElements : 29 - NumTypeBits;
1667 enum { MaxNumElements = (1 << (29 - NumTypeBits)) - 1 };
1673 unsigned : NumTypeBits;
1676 unsigned AttrKind : 32 - NumTypeBits;
1682 unsigned : NumTypeBits;
1686 unsigned Keyword : 2;
1701 unsigned : NumTypeBits;
1716 unsigned : NumTypeBits;
1719 unsigned TypeAlias : 1;
1734 unsigned : NumTypeBits;
1735 unsigned : NumTypeWithKeywordBits;
1750 unsigned : NumTypeBits;
1763 unsigned NumExpansions;
1785 static_assert(
sizeof(TypeBitfields) <= 8,
1786 "TypeBitfields is larger than 8 bytes!");
1788 "ArrayTypeBitfields is larger than 8 bytes!");
1790 "AttributedTypeBitfields is larger than 8 bytes!");
1792 "AutoTypeBitfields is larger than 8 bytes!");
1794 "BuiltinTypeBitfields is larger than 8 bytes!");
1796 "FunctionTypeBitfields is larger than 8 bytes!");
1798 "ObjCObjectTypeBitfields is larger than 8 bytes!");
1800 "ReferenceTypeBitfields is larger than 8 bytes!");
1802 "TypeWithKeywordBitfields is larger than 8 bytes!");
1804 "ElaboratedTypeBitfields is larger than 8 bytes!");
1806 "VectorTypeBitfields is larger than 8 bytes!");
1808 "SubstTemplateTypeParmPackTypeBitfields is larger" 1811 "TemplateSpecializationTypeBitfields is larger" 1814 "DependentTemplateSpecializationTypeBitfields is larger" 1817 "PackExpansionTypeBitfields is larger than 8 bytes");
1824 void setFromAST(
bool V =
true)
const {
1825 TypeBits.FromAST =
V;
1832 bool InstantiationDependent,
bool VariablyModified,
1833 bool ContainsUnexpandedParameterPack)
1835 canon.isNull() ?
QualType(this_(), 0) : canon) {
1837 TypeBits.Dependent = Dependent;
1838 TypeBits.InstantiationDependent = Dependent || InstantiationDependent;
1839 TypeBits.VariablyModified = VariablyModified;
1840 TypeBits.ContainsUnexpandedParameterPack = ContainsUnexpandedParameterPack;
1841 TypeBits.CacheValid =
false;
1842 TypeBits.CachedLocalOrUnnamed =
false;
1844 TypeBits.FromAST =
false;
1851 TypeBits.Dependent = D;
1853 TypeBits.InstantiationDependent =
true;
1857 TypeBits.InstantiationDependent = D; }
1862 TypeBits.ContainsUnexpandedParameterPack = PP;
1873 Type &operator=(
const Type &) =
delete;
1897 return TypeBits.ContainsUnexpandedParameterPack;
1903 return CanonicalType ==
QualType(
this, 0);
1909 QualType getLocallyUnqualifiedSingleStepDesugaredType()
const;
1922 bool isIncompleteType(
NamedDecl **Def =
nullptr)
const;
1927 return !isFunctionType();
1935 return !isReferenceType() && !isFunctionType() && !isVoidType();
1940 bool isLiteralType(
const ASTContext &Ctx)
const;
1944 bool isStandardLayoutType()
const;
1950 bool isBuiltinType()
const;
1953 bool isSpecificBuiltinType(
unsigned K)
const;
1958 bool isPlaceholderType()
const;
1962 bool isSpecificPlaceholderType(
unsigned K)
const;
1966 bool isNonOverloadPlaceholderType()
const;
1970 bool isIntegerType()
const;
1971 bool isEnumeralType()
const;
1974 bool isScopedEnumeralType()
const;
1977 bool isWideCharType()
const;
1978 bool isChar8Type()
const;
1979 bool isChar16Type()
const;
1980 bool isChar32Type()
const;
1981 bool isAnyCharacterType()
const;
1982 bool isIntegralType(
const ASTContext &Ctx)
const;
1985 bool isIntegralOrEnumerationType()
const;
1988 bool isIntegralOrUnscopedEnumerationType()
const;
1989 bool isUnscopedEnumerationType()
const;
1992 bool isRealFloatingType()
const;
1995 bool isComplexType()
const;
1996 bool isAnyComplexType()
const;
1997 bool isFloatingType()
const;
1998 bool isHalfType()
const;
1999 bool isFloat16Type()
const;
2000 bool isFloat128Type()
const;
2001 bool isRealType()
const;
2002 bool isArithmeticType()
const;
2003 bool isVoidType()
const;
2004 bool isScalarType()
const;
2005 bool isAggregateType()
const;
2006 bool isFundamentalType()
const;
2007 bool isCompoundType()
const;
2011 bool isFunctionType()
const;
2014 bool isPointerType()
const;
2015 bool isAnyPointerType()
const;
2016 bool isBlockPointerType()
const;
2017 bool isVoidPointerType()
const;
2018 bool isReferenceType()
const;
2019 bool isLValueReferenceType()
const;
2020 bool isRValueReferenceType()
const;
2021 bool isObjectPointerType()
const;
2022 bool isFunctionPointerType()
const;
2023 bool isFunctionReferenceType()
const;
2024 bool isMemberPointerType()
const;
2025 bool isMemberFunctionPointerType()
const;
2026 bool isMemberDataPointerType()
const;
2027 bool isArrayType()
const;
2028 bool isConstantArrayType()
const;
2029 bool isIncompleteArrayType()
const;
2030 bool isVariableArrayType()
const;
2031 bool isDependentSizedArrayType()
const;
2033 bool isClassType()
const;
2034 bool isStructureType()
const;
2035 bool isObjCBoxableRecordType()
const;
2036 bool isInterfaceType()
const;
2037 bool isStructureOrClassType()
const;
2038 bool isUnionType()
const;
2039 bool isComplexIntegerType()
const;
2040 bool isVectorType()
const;
2041 bool isExtVectorType()
const;
2042 bool isDependentAddressSpaceType()
const;
2043 bool isObjCObjectPointerType()
const;
2044 bool isObjCRetainableType()
const;
2045 bool isObjCLifetimeType()
const;
2046 bool isObjCIndirectLifetimeType()
const;
2047 bool isObjCNSObjectType()
const;
2048 bool isObjCIndependentClassType()
const;
2051 bool isObjCObjectType()
const;
2052 bool isObjCQualifiedInterfaceType()
const;
2053 bool isObjCQualifiedIdType()
const;
2054 bool isObjCQualifiedClassType()
const;
2055 bool isObjCObjectOrInterfaceType()
const;
2056 bool isObjCIdType()
const;
2057 bool isDecltypeType()
const;
2065 return hasAttr(attr::ObjCInertUnsafeUnretained);
2075 bool isObjCIdOrObjectKindOfType(
const ASTContext &ctx,
2078 bool isObjCClassType()
const;
2086 bool isObjCClassOrClassKindOfType()
const;
2088 bool isBlockCompatibleObjCPointerType(
ASTContext &ctx)
const;
2089 bool isObjCSelType()
const;
2090 bool isObjCBuiltinType()
const;
2091 bool isObjCARCBridgableType()
const;
2092 bool isCARCBridgableType()
const;
2093 bool isTemplateTypeParmType()
const;
2094 bool isNullPtrType()
const;
2095 bool isNothrowT()
const;
2096 bool isAlignValT()
const;
2097 bool isStdByteType()
const;
2098 bool isAtomicType()
const;
2099 bool isUndeducedAutoType()
const;
2102 #define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \ 2103 bool is##Id##Type() const; 2104 #include "clang/Basic/OpenCLImageTypes.def" 2106 bool isImageType()
const;
2108 bool isSamplerT()
const;
2109 bool isEventT()
const;
2110 bool isClkEventT()
const;
2111 bool isQueueT()
const;
2112 bool isReserveIDT()
const;
2114 #define EXT_OPAQUE_TYPE(ExtType, Id, Ext) \ 2115 bool is##Id##Type() const; 2116 #include "clang/Basic/OpenCLExtensionTypes.def" 2118 bool isOCLIntelSubgroupAVCType()
const;
2119 bool isOCLExtOpaqueType()
const;
2121 bool isPipeType()
const;
2122 bool isOpenCLSpecificType()
const;
2127 bool isObjCARCImplicitlyUnretainedType()
const;
2157 return TypeBits.InstantiationDependent;
2163 bool isUndeducedType()
const;
2170 bool hasSizedVLAType()
const;
2173 bool hasUnnamedOrLocalType()
const;
2175 bool isOverloadableType()
const;
2178 bool isElaboratedTypeSpecifier()
const;
2180 bool canDecayToPointerType()
const;
2185 bool hasPointerRepresentation()
const;
2189 bool hasObjCPointerRepresentation()
const;
2193 bool hasIntegerRepresentation()
const;
2197 bool hasSignedIntegerRepresentation()
const;
2201 bool hasUnsignedIntegerRepresentation()
const;
2205 bool hasFloatingRepresentation()
const;
2210 const RecordType *getAsStructureType()
const;
2213 const ComplexType *getAsComplexIntegerType()
const;
2234 TagDecl *getAsTagDecl()
const;
2252 return dyn_cast_or_null<AutoType>(getContainedDeducedType());
2258 bool hasAutoForTrailingReturnType()
const;
2266 template <
typename T>
const T *getAs()
const;
2273 template <
typename T>
const T *getAsAdjusted()
const;
2277 const ArrayType *getAsArrayTypeUnsafe()
const;
2285 template <
typename T>
const T *castAs()
const;
2289 const ArrayType *castAsArrayTypeUnsafe()
const;
2298 const Type *getBaseElementTypeUnsafe()
const;
2303 const Type *getArrayElementTypeNoTypeQual()
const;
2308 const Type *getPointeeOrArrayElementType()
const;
2316 const Type *getUnqualifiedDesugaredType()
const;
2319 bool isPromotableIntegerType()
const;
2324 bool isSignedIntegerType()
const;
2329 bool isUnsignedIntegerType()
const;
2333 bool isSignedIntegerOrEnumerationType()
const;
2337 bool isUnsignedIntegerOrEnumerationType()
const;
2341 bool isFixedPointType()
const;
2344 bool isFixedPointOrIntegerType()
const;
2348 bool isSaturatedFixedPointType()
const;
2352 bool isUnsaturatedFixedPointType()
const;
2356 bool isSignedFixedPointType()
const;
2360 bool isUnsignedFixedPointType()
const;
2365 bool isConstantSizeType()
const;
2369 bool isSpecifierType()
const;
2376 return getLinkageAndVisibility().getVisibility();
2381 return getLinkageAndVisibility().isVisibilityExplicit();
2389 bool isLinkageValid()
const;
2403 bool canHaveNullability(
bool ResultIfUnknown =
true)
const;
2421 getObjCSubstitutions(
const DeclContext *dc)
const;
2425 bool acceptsObjCTypeParams()
const;
2427 const char *getTypeClassName()
const;
2430 return CanonicalType;
2435 void dump(llvm::raw_ostream &OS)
const;
2453 #define TYPE(Class, Base) 2454 #define LEAF_TYPE(Class) \ 2455 template <> inline const Class##Type *Type::getAs() const { \ 2456 return dyn_cast<Class##Type>(CanonicalType); \ 2458 template <> inline const Class##Type *Type::castAs() const { \ 2459 return cast<Class##Type>(CanonicalType); \ 2461 #include "clang/AST/TypeNodes.inc" 2469 #define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) Id, 2470 #include "clang/Basic/OpenCLImageTypes.def" 2472 #define EXT_OPAQUE_TYPE(ExtType, Id, Ext) Id, 2473 #include "clang/Basic/OpenCLExtensionTypes.def" 2475 #define SVE_TYPE(Name, Id, SingletonId) Id, 2476 #include "clang/Basic/AArch64SVEACLETypes.def" 2478 #define BUILTIN_TYPE(Id, SingletonId) Id, 2479 #define LAST_BUILTIN_TYPE(Id) LastKind = Id 2480 #include "clang/AST/BuiltinTypes.def" 2491 BuiltinTypeBits.Kind = K;
2500 StringRef str =
getName(Policy);
2501 assert(!str.empty() && str.data()[str.size()] ==
'\0');
2526 return K >= Overload;
2533 return isPlaceholderTypeKind(
getKind());
2560 :
Type(
Complex, CanonicalPtr, Element->isDependentType(),
2561 Element->isInstantiationDependentType(),
2562 Element->isVariablyModifiedType(),
2563 Element->containsUnexpandedParameterPack()),
2564 ElementType(Element) {}
2573 Profile(ID, getElementType());
2590 :
Type(
Paren, CanonType, InnerType->isDependentType(),
2591 InnerType->isInstantiationDependentType(),
2592 InnerType->isVariablyModifiedType(),
2593 InnerType->containsUnexpandedParameterPack()),
2603 Profile(ID, getInnerType());
2620 :
Type(
Pointer, CanonicalPtr, Pointee->isDependentType(),
2621 Pointee->isInstantiationDependentType(),
2622 Pointee->isVariablyModifiedType(),
2623 Pointee->containsUnexpandedParameterPack()),
2624 PointeeType(Pointee) {}
2649 Profile(ID, getPointeeType());
2671 :
Type(TC, CanonicalPtr, OriginalTy->isDependentType(),
2672 OriginalTy->isInstantiationDependentType(),
2673 OriginalTy->isVariablyModifiedType(),
2674 OriginalTy->containsUnexpandedParameterPack()),
2675 OriginalTy(OriginalTy), AdjustedTy(AdjustedTy) {}
2685 Profile(ID, OriginalTy, AdjustedTy);
2708 inline QualType getPointeeType()
const;
2723 :
Type(BlockPointer, CanonicalCls, Pointee->isDependentType(),
2724 Pointee->isInstantiationDependentType(),
2725 Pointee->isVariablyModifiedType(),
2726 Pointee->containsUnexpandedParameterPack()),
2727 PointeeType(Pointee) {}
2737 Profile(ID, getPointeeType());
2755 bool SpelledAsLValue)
2756 :
Type(tc, CanonicalRef, Referencee->isDependentType(),
2757 Referencee->isInstantiationDependentType(),
2758 Referencee->isVariablyModifiedType(),
2759 Referencee->containsUnexpandedParameterPack()),
2760 PointeeType(Referencee) {
2761 ReferenceTypeBits.SpelledAsLValue = SpelledAsLValue;
2776 return T->PointeeType;
2780 Profile(ID, PointeeType, isSpelledAsLValue());
2785 bool SpelledAsLValue) {
2787 ID.AddBoolean(SpelledAsLValue);
2801 bool SpelledAsLValue)
2843 :
Type(MemberPointer, CanonicalPtr,
2844 Cls->isDependentType() || Pointee->isDependentType(),
2845 (Cls->isInstantiationDependentType() ||
2846 Pointee->isInstantiationDependentType()),
2847 Pointee->isVariablyModifiedType(),
2848 (Cls->containsUnexpandedParameterPack() ||
2849 Pointee->containsUnexpandedParameterPack())),
2850 PointeeType(Pointee), Class(Cls) {}
2874 Profile(ID, getPointeeType(), getClass());
2878 const Type *Class) {
2880 ID.AddPointer(Class);
2907 unsigned tq,
const Expr *sz =
nullptr);
2921 return ArrayTypeBits.IndexTypeQuals;
2945 :
ArrayType(ConstantArray, et, can, sm, tq, sz), Size(size) {
2946 ConstantArrayTypeBits.HasStoredSizeExpr = sz !=
nullptr;
2947 if (ConstantArrayTypeBits.HasStoredSizeExpr) {
2948 assert(!can.
isNull() &&
"canonical constant array should not have size");
2949 *getTrailingObjects<const Expr*>() = sz;
2953 unsigned numTrailingObjects(OverloadToken<const Expr*>)
const {
2954 return ConstantArrayTypeBits.HasStoredSizeExpr;
2960 return ConstantArrayTypeBits.HasStoredSizeExpr
2961 ? *getTrailingObjects<const Expr *>()
2969 static unsigned getNumAddressingBits(
const ASTContext &Context,
2975 static unsigned getMaxSizeBits(
const ASTContext &Context);
2978 Profile(ID, Ctx, getElementType(), getSize(), getSizeExpr(),
2979 getSizeModifier(), getIndexTypeCVRQualifiers());
2982 static void Profile(llvm::FoldingSetNodeID &
ID,
const ASTContext &Ctx,
2985 unsigned TypeQuals);
3000 :
ArrayType(IncompleteArray, et, can, sm, tq) {}
3013 Profile(ID, getElementType(), getSizeModifier(),
3014 getIndexTypeCVRQualifiers());
3020 ID.AddInteger(SizeMod);
3021 ID.AddInteger(TypeQuals);
3052 :
ArrayType(VariableArray, et, can, sm, tq, e),
3053 SizeExpr((
Stmt*) e), Brackets(brackets) {}
3061 return (
Expr*) SizeExpr;
3076 llvm_unreachable(
"Cannot unique VariableArrayTypes.");
3118 return (
Expr*) SizeExpr;
3133 Profile(ID, Context, getElementType(),
3134 getSizeModifier(), getIndexTypeCVRQualifiers(), getSizeExpr());
3137 static void Profile(llvm::FoldingSetNodeID &
ID,
const ASTContext &Context,
3139 unsigned TypeQuals,
Expr *E);
3157 Expr *AddrSpaceExpr;
3178 Profile(ID, Context, getPointeeType(), getAddrSpaceExpr());
3181 static void Profile(llvm::FoldingSetNodeID &
ID,
const ASTContext &Context,
3222 Profile(ID, Context, getElementType(), getSizeExpr());
3225 static void Profile(llvm::FoldingSetNodeID &
ID,
const ASTContext &Context,
3274 return NumElements > VectorTypeBitfields::MaxNumElements;
3285 Profile(ID, getElementType(), getNumElements(),
3286 getTypeClass(), getVectorKind());
3293 ID.AddInteger(NumElements);
3294 ID.AddInteger(TypeClass);
3295 ID.AddInteger(VecKind);
3340 Profile(ID, Context, getElementType(), getSizeExpr(), getVectorKind());
3343 static void Profile(llvm::FoldingSetNodeID &
ID,
const ASTContext &Context,
3358 :
VectorType(ExtVector, vecType, nElements, canonType, GenericVector) {}
3364 case 'x':
case 'r':
return 0;
3365 case 'y':
case 'g':
return 1;
3366 case 'z':
case 'b':
return 2;
3367 case 'w':
case 'a':
return 3;
3385 case 'a':
return 10;
3387 case 'b':
return 11;
3389 case 'c':
return 12;
3391 case 'd':
return 13;
3393 case 'e':
return 14;
3395 case 'f':
return 15;
3400 if (isNumericAccessor)
3401 return getNumericAccessorIdx(c);
3403 return getPointAccessorIdx(c);
3407 if (
int idx = getAccessorIdx(c, isNumericAccessor)+1)
3408 return unsigned(idx-1) < getNumElements();
3452 HasPassObjSize = 0x20,
3455 unsigned char Data = 0;
3464 copy.Data = (copy.Data & ~ABIMask) |
unsigned(kind);
3474 copy.Data |= IsConsumed;
3476 copy.Data &= ~IsConsumed;
3483 Copy.Data |= HasPassObjSize;
3491 Copy.Data |= IsNoEscape;
3493 Copy.Data &= ~IsNoEscape;
3505 return lhs.Data == rhs.Data;
3509 return lhs.Data != rhs.Data;
3544 enum { CallConvMask = 0x1F };
3545 enum { NoReturnMask = 0x20 };
3546 enum { ProducesResultMask = 0x40 };
3547 enum { NoCallerSavedRegsMask = 0x80 };
3548 enum { NoCfCheckMask = 0x800 };
3550 RegParmMask = ~(CallConvMask | NoReturnMask | ProducesResultMask |
3551 NoCallerSavedRegsMask | NoCfCheckMask),
3554 uint16_t Bits =
CC_C;
3556 ExtInfo(
unsigned Bits) : Bits(static_cast<uint16_t>(Bits)) {}
3562 bool producesResult,
bool noCallerSavedRegs,
bool NoCfCheck) {
3563 assert((!hasRegParm || regParm < 7) &&
"Invalid regparm value");
3564 Bits = ((unsigned)cc) | (noReturn ? NoReturnMask : 0) |
3565 (producesResult ? ProducesResultMask : 0) |
3566 (noCallerSavedRegs ? NoCallerSavedRegsMask : 0) |
3567 (hasRegParm ? ((regParm + 1) << RegParmOffset) : 0) |
3568 (NoCfCheck ? NoCfCheckMask : 0);
3586 unsigned RegParm = (Bits & RegParmMask) >> RegParmOffset;
3595 return Bits == Other.Bits;
3598 return Bits != Other.Bits;
3606 return ExtInfo(Bits | NoReturnMask);
3608 return ExtInfo(Bits & ~NoReturnMask);
3613 return ExtInfo(Bits | ProducesResultMask);
3615 return ExtInfo(Bits & ~ProducesResultMask);
3619 if (noCallerSavedRegs)
3620 return ExtInfo(Bits | NoCallerSavedRegsMask);
3622 return ExtInfo(Bits & ~NoCallerSavedRegsMask);
3627 return ExtInfo(Bits | NoCfCheckMask);
3629 return ExtInfo(Bits & ~NoCfCheckMask);
3633 assert(RegParm < 7 &&
"Invalid regparm value");
3634 return ExtInfo((Bits & ~RegParmMask) |
3635 ((RegParm + 1) << RegParmOffset));
3639 return ExtInfo((Bits & ~CallConvMask) | (
unsigned) cc);
3643 ID.AddInteger(Bits);
3665 QualType Canonical,
bool Dependent,
3666 bool InstantiationDependent,
3667 bool VariablyModified,
bool ContainsUnexpandedParameterPack,
3669 :
Type(tc, Canonical, Dependent, InstantiationDependent, VariablyModified,
3670 ContainsUnexpandedParameterPack),
3672 FunctionTypeBits.ExtInfo = Info.Bits;
3694 "Const, volatile and restrict are assumed to be a subset of " 3695 "the fast qualifiers.");
3697 bool isConst()
const {
return getFastTypeQuals().hasConst(); }
3698 bool isVolatile()
const {
return getFastTypeQuals().hasVolatile(); }
3699 bool isRestrict()
const {
return getFastTypeQuals().hasRestrict(); }
3707 static StringRef getNameForCallConv(
CallingConv CC);
3723 Result->isVariablyModifiedType(),
3733 Profile(ID, getReturnType(), getExtInfo());
3756 public llvm::FoldingSetNode,
3758 FunctionProtoType, QualType, SourceLocation,
3759 FunctionType::FunctionTypeExtraBitfields, FunctionType::ExceptionType,
3760 Expr *, FunctionDecl *, FunctionType::ExtParameterInfo, Qualifiers> {
3844 const ExtParameterInfo *ExtParameterInfos =
nullptr;
3850 : ExtInfo(CC), Variadic(
false), HasTrailingReturn(
false) {}
3860 unsigned numTrailingObjects(OverloadToken<QualType>)
const {
3861 return getNumParams();
3864 unsigned numTrailingObjects(OverloadToken<SourceLocation>)
const {
3865 return isVariadic();
3868 unsigned numTrailingObjects(OverloadToken<FunctionTypeExtraBitfields>)
const {
3869 return hasExtraBitfields();
3872 unsigned numTrailingObjects(OverloadToken<ExceptionType>)
const {
3873 return getExceptionSpecSize().NumExceptionType;
3876 unsigned numTrailingObjects(OverloadToken<Expr *>)
const {
3877 return getExceptionSpecSize().NumExprPtr;
3880 unsigned numTrailingObjects(OverloadToken<FunctionDecl *>)
const {
3881 return getExceptionSpecSize().NumFunctionDeclPtr;
3884 unsigned numTrailingObjects(OverloadToken<ExtParameterInfo>)
const {
3885 return hasExtParameterInfos() ? getNumParams() : 0;
3890 static bool containsAnyUnexpandedParameterPack(
const QualType *ArgArray,
3892 for (
unsigned Idx = 0; Idx < numArgs; ++Idx)
3893 if (ArgArray[Idx]->containsUnexpandedParameterPack())
3905 struct ExceptionSpecSizeHolder {
3906 unsigned NumExceptionType;
3907 unsigned NumExprPtr;
3908 unsigned NumFunctionDeclPtr;
3913 static ExceptionSpecSizeHolder
3925 return {NumExceptions, 0, 0};
3938 llvm_unreachable(
"bad exception specification kind");
3943 ExceptionSpecSizeHolder getExceptionSpecSize()
const {
3944 return getExceptionSpecSize(getExceptionSpecType(), getNumExceptions());
3955 bool hasExtraBitfields()
const {
3956 return hasExtraBitfields(getExceptionSpecType());
3959 bool hasExtQualifiers()
const {
3960 return FunctionTypeBits.HasExtQuals;
3967 assert(i < getNumParams() &&
"invalid parameter index");
3968 return param_type_begin()[i];
3972 return llvm::makeArrayRef(param_type_begin(), param_type_end());
3991 FunctionTypeBits.ExceptionSpecType);
4008 bool hasDependentExceptionSpec()
const;
4012 bool hasInstantiationDependentExceptionSpec()
const;
4017 Result.
Type = getExceptionSpecType();
4034 ? getTrailingObjects<FunctionTypeExtraBitfields>()
4041 assert(i < getNumExceptions() &&
"Invalid exception number!");
4042 return exception_begin()[i];
4050 return *getTrailingObjects<Expr *>();
4061 return getTrailingObjects<FunctionDecl *>()[0];
4071 return getTrailingObjects<FunctionDecl *>()[1];
4082 return ResultIfDependent ? canThrow() !=
CT_Can : canThrow() ==
CT_Cannot;
4089 return isVariadic() ? *getTrailingObjects<SourceLocation>()
4099 bool isTemplateVariadic()
const;
4105 if (hasExtQualifiers())
4106 return *getTrailingObjects<Qualifiers>();
4108 return getFastTypeQuals();
4124 return getTrailingObjects<QualType>();
4128 return param_type_begin() + getNumParams();
4134 return llvm::makeArrayRef(exception_begin(), exception_end());
4139 getTrailingObjects<ExceptionType>());
4143 return exception_begin() + getNumExceptions();
4149 return FunctionTypeBits.HasExtParameterInfos;
4153 assert(hasExtParameterInfos());
4162 if (!hasExtParameterInfos())
4164 return getTrailingObjects<ExtParameterInfo>();
4168 assert(I < getNumParams() &&
"parameter index out of range");
4169 if (hasExtParameterInfos())
4170 return getTrailingObjects<ExtParameterInfo>()[I];
4175 assert(I < getNumParams() &&
"parameter index out of range");
4176 if (hasExtParameterInfos())
4177 return getTrailingObjects<ExtParameterInfo>()[I].getABI();
4182 assert(I < getNumParams() &&
"parameter index out of range");
4183 if (hasExtParameterInfos())
4184 return getTrailingObjects<ExtParameterInfo>()[I].isConsumed();
4191 void printExceptionSpecification(raw_ostream &OS,
4198 void Profile(llvm::FoldingSetNodeID &
ID,
const ASTContext &Ctx);
4199 static void Profile(llvm::FoldingSetNodeID &ID,
QualType Result,
4231 return Profile(ID, Decl);
4247 :
Type(tc, can, can->isDependentType(),
4248 can->isInstantiationDependentType(),
4249 can->isVariablyModifiedType(),
4252 assert(!isa<TypedefType>(can) &&
"Invalid canonical type");
4274 :
Type(MacroQualified, CanonTy, UnderlyingTy->isDependentType(),
4275 UnderlyingTy->isInstantiationDependentType(),
4276 UnderlyingTy->isVariablyModifiedType(),
4277 UnderlyingTy->containsUnexpandedParameterPack()),
4278 UnderlyingTy(UnderlyingTy), MacroII(MacroII) {
4279 assert(isa<AttributedType>(UnderlyingTy) &&
4280 "Expected a macro qualified type to only wrap attributed types.");
4315 bool isSugared()
const;
4335 Profile(ID, Context, getUnderlyingExpr());
4338 static void Profile(llvm::FoldingSetNodeID &
ID,
const ASTContext &Context,
4349 :
Type(TypeOf, can, T->isDependentType(),
4350 T->isInstantiationDependentType(),
4351 T->isVariablyModifiedType(),
4352 T->containsUnexpandedParameterPack()),
4354 assert(!isa<TypedefType>(can) &&
"Invalid canonical type");
4387 bool isSugared()
const;
4405 Profile(ID, Context, getUnderlyingExpr());
4408 static void Profile(llvm::FoldingSetNodeID &
ID,
const ASTContext &Context,
4455 public llvm::FoldingSetNode {
4461 Profile(ID, getBaseType(), getUTTKind());
4467 ID.AddInteger((
unsigned)UKind);
4486 bool isBeingDefined()
const;
4511 bool hasConstFields()
const;
4562 :
Type(Attributed, canon, equivalent->isDependentType(),
4563 equivalent->isInstantiationDependentType(),
4564 equivalent->isVariablyModifiedType(),
4565 equivalent->containsUnexpandedParameterPack()),
4566 ModifiedType(modified), EquivalentType(equivalent) {
4567 AttributedTypeBits.AttrKind = attrKind;
4572 return static_cast<Kind>(AttributedTypeBits.AttrKind);
4596 bool isQualifier()
const;
4598 bool isMSTypeSpec()
const;
4600 bool isCallingConv()
const;
4609 return attr::TypeNonNull;
4612 return attr::TypeNullable;
4615 return attr::TypeNullUnspecified;
4617 llvm_unreachable(
"Unknown nullability kind.");
4632 Profile(ID, getAttrKind(), ModifiedType, EquivalentType);
4637 ID.AddInteger(attrKind);
4651 struct CanonicalTTPTInfo {
4652 unsigned Depth : 15;
4653 unsigned ParameterPack : 1;
4654 unsigned Index : 16;
4667 :
Type(TemplateTypeParm, Canon,
true,
4670 Canon->containsUnexpandedParameterPack()),
4679 CanTTPTInfo.Depth = D;
4680 CanTTPTInfo.Index = I;
4681 CanTTPTInfo.ParameterPack = PP;
4684 const CanonicalTTPTInfo& getCanTTPTInfo()
const {
4685 QualType Can = getCanonicalTypeInternal();
4690 unsigned getDepth()
const {
return getCanTTPTInfo().Depth; }
4691 unsigned getIndex()
const {
return getCanTTPTInfo().Index; }
4695 return isCanonicalUnqualified() ? nullptr : TTPDecl;
4704 Profile(ID, getDepth(), getIndex(), isParameterPack(), getDecl());
4708 unsigned Index,
bool ParameterPack,
4710 ID.AddInteger(Depth);
4711 ID.AddInteger(Index);
4712 ID.AddBoolean(ParameterPack);
4713 ID.AddPointer(TTPDecl);
4735 :
Type(SubstTemplateTypeParm, Canon, Canon->isDependentType(),
4736 Canon->isInstantiationDependentType(),
4737 Canon->isVariablyModifiedType(),
4738 Canon->containsUnexpandedParameterPack()),
4750 return getCanonicalTypeInternal();
4757 Profile(ID, getReplacedParameter(), getReplacementType());
4763 ID.AddPointer(Replaced);
4807 return SubstTemplateTypeParmPackTypeBits.NumArgs;
4815 void Profile(llvm::FoldingSetNodeID &
ID);
4816 static void Profile(llvm::FoldingSetNodeID &ID,
4836 bool IsInstantiationDependent,
bool ContainsParameterPack)
4839 DeducedAsType.isNull() ?
QualType(this, 0)
4840 : DeducedAsType.getCanonicalType(),
4841 IsDependent, IsInstantiationDependent,
4842 false, ContainsParameterPack) {
4843 if (!DeducedAsType.
isNull()) {
4847 setInstantiationDependent();
4849 setContainsUnexpandedParameterPack();
4854 bool isSugared()
const {
return !isCanonicalUnqualified(); }
4860 return !isCanonicalUnqualified() ? getCanonicalTypeInternal() :
QualType();
4863 return !isCanonicalUnqualified() || isDependentType();
4880 bool IsDeducedAsDependent,
bool IsDeducedAsPack,
ConceptDecl *CD,
4894 return getArgBuffer();
4899 return AutoTypeBits.NumArgs;
4905 return {getArgs(), getNumArgs()};
4909 return TypeConstraintConcept;
4913 return TypeConstraintConcept !=
nullptr;
4925 Profile(ID, Context, getDeducedType(), getKeyword(), isDependentType(),
4926 getTypeConstraintConcept(), getTypeConstraintArguments());
4929 static void Profile(llvm::FoldingSetNodeID &
ID,
const ASTContext &Context,
4941 public llvm::FoldingSetNode {
4949 bool IsDeducedAsDependent)
4950 :
DeducedType(DeducedTemplateSpecialization, DeducedAsType,
4951 IsDeducedAsDependent || Template.isDependent(),
4952 IsDeducedAsDependent || Template.isInstantiationDependent(),
4953 Template.containsUnexpandedParameterPack()),
4954 Template(Template) {}
4961 Profile(ID, getTemplateName(), getDeducedType(), isDependentType());
4965 QualType Deduced,
bool IsDependent) {
4968 ID.AddBoolean(IsDependent);
4972 return T->
getTypeClass() == DeducedTemplateSpecialization;
4998 public llvm::FoldingSetNode {
5018 bool &InstantiationDependent);
5021 bool &InstantiationDependent);
5026 return isa<InjectedClassNameType>(getCanonicalTypeInternal());
5044 bool isTypeAlias()
const {
return TemplateSpecializationTypeBits.TypeAlias; }
5049 assert(isTypeAlias() &&
"not a type alias template specialization");
5050 return *
reinterpret_cast<const QualType*
>(end());
5068 return TemplateSpecializationTypeBits.NumArgs;
5076 return {getArgs(), getNumArgs()};
5080 return !isDependentType() || isCurrentInstantiation() || isTypeAlias();
5084 return isTypeAlias() ? getAliasedType() : getCanonicalTypeInternal();
5088 Profile(ID, Template, template_arguments(), Ctx);
5090 getAliasedType().Profile(ID);
5159 Decl(D), InjectedType(TST) {
5160 assert(isa<TemplateSpecializationType>(TST));
5169 return cast<TemplateSpecializationType>(InjectedType.
getTypePtr());
5173 return getInjectedTST()->getTemplateName();
5237 QualType Canonical,
bool Dependent,
5238 bool InstantiationDependent,
bool VariablyModified,
5239 bool ContainsUnexpandedParameterPack)
5240 :
Type(tc, Canonical, Dependent, InstantiationDependent, VariablyModified,
5241 ContainsUnexpandedParameterPack) {
5242 TypeWithKeywordBits.Keyword = Keyword;
5255 static TagTypeKind getTagTypeKindForTypeSpec(
unsigned TypeSpec);
5270 return getKeywordName(getKeywordForTagTypeKind(Kind));
5287 public llvm::FoldingSetNode,
5305 NamedType->isDependentType(),
5306 NamedType->isInstantiationDependentType(),
5307 NamedType->isVariablyModifiedType(),
5308 NamedType->containsUnexpandedParameterPack()),
5309 NNS(NNS), NamedType(NamedType) {
5310 ElaboratedTypeBits.HasOwnedTagDecl =
false;
5312 ElaboratedTypeBits.HasOwnedTagDecl =
true;
5313 *getTrailingObjects<TagDecl *>() = OwnedTagDecl;
5315 assert(!(Keyword ==
ETK_None && NNS ==
nullptr) &&
5316 "ElaboratedType cannot have elaborated type keyword " 5317 "and name qualifier both null.");
5336 return ElaboratedTypeBits.HasOwnedTagDecl ? *getTrailingObjects<TagDecl *>()
5341 Profile(ID, getKeyword(), NNS, NamedType, getOwnedTagDecl());
5347 ID.AddInteger(Keyword);
5350 ID.AddPointer(OwnedTagDecl);
5382 NNS->containsUnexpandedParameterPack()),
5383 NNS(NNS), Name(Name) {}
5402 Profile(ID, getKeyword(), NNS, Name);
5407 ID.AddInteger(Keyword);
5409 ID.AddPointer(Name);
5422 public llvm::FoldingSetNode {
5451 return getArgBuffer();
5456 return DependentTemplateSpecializationTypeBits.NumArgs;
5462 return {getArgs(), getNumArgs()};
5474 Profile(ID, Context, getKeyword(), NNS, Name, {getArgs(), getNumArgs()});
5477 static void Profile(llvm::FoldingSetNodeID &
ID,
5485 return T->
getTypeClass() == DependentTemplateSpecialization;
5519 :
Type(PackExpansion, Canon, Pattern->isDependentType(),
5521 Pattern->isVariablyModifiedType(),
5524 PackExpansionTypeBits.NumExpansions =
5525 NumExpansions ? *NumExpansions + 1 : 0;
5537 if (PackExpansionTypeBits.NumExpansions)
5538 return PackExpansionTypeBits.NumExpansions - 1;
5546 Profile(ID, getPattern(), getNumExpansions());
5552 ID.AddBoolean(NumExpansions.hasValue());
5554 ID.AddInteger(*NumExpansions);
5574 return static_cast<T*
>(
this)->getProtocolStorageImpl();
5578 static_cast<T*
>(
this)->setNumProtocolsImpl(N);
5582 setNumProtocols(protocols.size());
5583 assert(getNumProtocols() == protocols.size() &&
5584 "bitfield overflow in protocol count");
5585 if (!protocols.empty())
5586 memcpy(getProtocolStorage(), protocols.data(),
5603 return static_cast<const T*
>(
this)->getNumProtocolsImpl();
5608 assert(I < getNumProtocols() &&
"Out-of-range protocol access");
5609 return qual_begin()[I];
5622 public llvm::FoldingSetNode {
5627 unsigned NumProtocols : 6;
5638 unsigned getNumProtocolsImpl()
const {
5639 return NumProtocols;
5642 void setNumProtocolsImpl(
unsigned N) {
5658 void Profile(llvm::FoldingSetNodeID &
ID);
5659 static void Profile(llvm::FoldingSetNodeID &ID,
5714 mutable llvm::PointerIntPair<const ObjCObjectType *, 1, bool>
5715 CachedSuperClassType;
5718 const QualType *getTypeArgStorage()
const {
5725 unsigned getNumProtocolsImpl()
const {
5726 return ObjCObjectTypeBits.NumProtocols;
5728 void setNumProtocolsImpl(
unsigned N) {
5729 ObjCObjectTypeBits.NumProtocols = N;
5743 ObjCObjectTypeBits.NumProtocols = 0;
5744 ObjCObjectTypeBits.NumTypeArgs = 0;
5745 ObjCObjectTypeBits.IsKindOf = 0;
5748 void computeSuperClassTypeSlow()
const;
5760 return getBaseType()->isSpecificBuiltinType(BuiltinType::ObjCId);
5764 return getBaseType()->isSpecificBuiltinType(BuiltinType::ObjCClass);
5770 if (!qual_empty())
return false;
5771 if (
const BuiltinType *T = getBaseType()->getAs<BuiltinType>())
5772 return T->getKind() == BuiltinType::ObjCId ||
5773 T->getKind() == BuiltinType::ObjCClass;
5785 bool isSpecialized()
const;
5789 return ObjCObjectTypeBits.NumTypeArgs > 0;
5806 return llvm::makeArrayRef(getTypeArgStorage(),
5807 ObjCObjectTypeBits.NumTypeArgs);
5814 bool isKindOfType()
const;
5823 if (!CachedSuperClassType.getInt())
5824 computeSuperClassTypeSlow();
5826 assert(CachedSuperClassType.getInt() &&
"Superclass not set?");
5827 return QualType(CachedSuperClassType.getPointer(), 0);
5857 :
ObjCObjectType(Canonical, Base, typeArgs, protocols, isKindOf) {}
5860 void Profile(llvm::FoldingSetNodeID &
ID);
5861 static void Profile(llvm::FoldingSetNodeID &
ID,
5868 inline QualType *ObjCObjectType::getTypeArgStorage() {
5874 getTypeArgStorage() + ObjCObjectTypeBits.NumTypeArgs);
5933 if (
const auto *T = dyn_cast<ObjCInterfaceType>(ObjT))
5934 return T->getDecl();
5936 baseType = ObjT->getBaseType();
5957 :
Type(ObjCObjectPointer, Canonical,
5958 Pointee->isDependentType(),
5959 Pointee->isInstantiationDependentType(),
5960 Pointee->isVariablyModifiedType(),
5961 Pointee->containsUnexpandedParameterPack()),
5962 PointeeType(Pointee) {}
6105 QualType getSuperClassType()
const;
6113 Profile(ID, getPointeeType());
6131 :
Type(Atomic, Canonical, ValTy->isDependentType(),
6132 ValTy->isInstantiationDependentType(),
6133 ValTy->isVariablyModifiedType(),
6134 ValTy->containsUnexpandedParameterPack()),
6146 Profile(ID, getValueType());
6166 :
Type(Pipe, CanonicalPtr, elemType->isDependentType(),
6167 elemType->isInstantiationDependentType(),
6168 elemType->isVariablyModifiedType(),
6169 elemType->containsUnexpandedParameterPack()),
6170 ElementType(elemType), isRead(isRead) {}
6180 Profile(ID, getElementType(), isReadOnly());
6185 ID.AddBoolean(isRead);
6206 return type.getTypePtrUnsafe();
6208 const ExtQuals *extQuals = type.getExtQualsUnsafe();
6251 Ty->getLocallyUnqualifiedSingleStepDesugaredType().split();
6257 return getCommonPtr()->BaseType;
6261 return (isNull() ?
nullptr : getCommonPtr()->BaseType);
6265 if (!hasLocalNonFastQualifiers())
6269 const ExtQuals *eq = getExtQualsUnsafe();
6277 if (hasLocalNonFastQualifiers())
6278 Quals = getExtQualsUnsafe()->getQualifiers();
6284 Qualifiers quals = getCommonPtr()->CanonicalType.getLocalQualifiers();
6290 unsigned cvr = getCommonPtr()->CanonicalType.getLocalCVRQualifiers();
6291 cvr |= getLocalCVRQualifiers();
6296 QualType canon = getCommonPtr()->CanonicalType;
6301 return getTypePtr()->isCanonicalUnqualified();
6305 if (!isCanonical())
return false;
6306 if (hasLocalQualifiers())
return false;
6308 const Type *T = getTypePtr();
6312 return !isa<FunctionType>(T) && !isa<ArrayType>(T);
6316 return isLocalConstQualified() ||
6317 getCommonPtr()->CanonicalType.isLocalConstQualified();
6321 return isLocalRestrictQualified() ||
6322 getCommonPtr()->CanonicalType.isLocalRestrictQualified();
6327 return isLocalVolatileQualified() ||
6328 getCommonPtr()->CanonicalType.isLocalVolatileQualified();
6332 return hasLocalQualifiers() ||
6333 getCommonPtr()->CanonicalType.hasLocalQualifiers();
6337 if (!getTypePtr()->getCanonicalTypeInternal().hasLocalQualifiers())
6340 return QualType(getSplitUnqualifiedTypeImpl(*this).Ty, 0);
6344 if (!getTypePtr()->getCanonicalTypeInternal().hasLocalQualifiers())
6347 return getSplitUnqualifiedTypeImpl(*
this);
6365 "Fast bits differ from CVR bits!");
6368 removeLocalFastQualifiers(Mask);
6373 return getQualifiers().hasAddressSpace();
6378 return getQualifiers().getAddressSpace();
6383 return getQualifiers().getObjCGCAttr();
6387 if (
auto *RD = getTypePtr()->getBaseElementTypeUnsafe()->getAsRecordDecl())
6388 return hasNonTrivialToPrimitiveDefaultInitializeCUnion(RD);
6393 if (
auto *RD = getTypePtr()->getBaseElementTypeUnsafe()->getAsRecordDecl())
6394 return hasNonTrivialToPrimitiveDestructCUnion(RD);
6399 if (
auto *RD = getTypePtr()->getBaseElementTypeUnsafe()->getAsRecordDecl())
6400 return hasNonTrivialToPrimitiveCopyCUnion(RD);
6406 if (
const auto *FT = PT->getPointeeType()->getAs<
FunctionType>())
6407 return FT->getExtInfo();
6409 return FT->getExtInfo();
6437 if (getUnqualifiedType()->isVoidType())
6440 return getQualifiers().compatiblyIncludes(OtherQuals);
6460 return ((getTypePtr()->isVoidType() && !hasQualifiers()) ||
6461 getTypePtr()->isFunctionType());
6468 return isVoidType() ||
6472 (isArithmeticType() && !isEnumeralType());
6482 return isArrayType() ||
6488 isReferenceType() ||
6497 isMemberPointerType();
6501 return isa<FunctionType>(CanonicalType);
6505 return isa<PointerType>(CanonicalType);
6509 return isPointerType() || isObjCObjectPointerType();
6513 return isa<BlockPointerType>(CanonicalType);
6517 return isa<ReferenceType>(CanonicalType);
6521 return isa<LValueReferenceType>(CanonicalType);
6525 return isa<RValueReferenceType>(CanonicalType);
6532 if (
const auto *T = getAs<PointerType>())
6533 return !T->getPointeeType()->isFunctionType();
6539 if (
const auto *T = getAs<PointerType>())
6540 return T->getPointeeType()->isFunctionType();
6546 if (
const auto *T = getAs<ReferenceType>())
6547 return T->getPointeeType()->isFunctionType();
6553 return isa<MemberPointerType>(CanonicalType);
6557 if (
const auto *T = getAs<MemberPointerType>())
6558 return T->isMemberFunctionPointer();
6564 if (
const auto *T = getAs<MemberPointerType>())
6565 return T->isMemberDataPointer();
6571 return isa<ArrayType>(CanonicalType);
6575 return isa<ConstantArrayType>(CanonicalType);
6579 return isa<IncompleteArrayType>(CanonicalType);
6583 return isa<VariableArrayType>(CanonicalType);
6587 return isa<DependentSizedArrayType>(CanonicalType);
6591 return isa<BuiltinType>(CanonicalType);
6595 return isa<RecordType>(CanonicalType);
6599 return isa<EnumType>(CanonicalType);
6603 return isa<ComplexType>(CanonicalType);
6607 return isa<VectorType>(CanonicalType);
6611 return isa<ExtVectorType>(CanonicalType);
6615 return isa<DependentAddressSpaceType>(CanonicalType);
6619 return isa<ObjCObjectPointerType>(CanonicalType);
6623 return isa<ObjCObjectType>(CanonicalType);
6627 return isa<ObjCInterfaceType>(CanonicalType) ||
6628 isa<ObjCObjectType>(CanonicalType);
6632 return isa<AtomicType>(CanonicalType);
6636 return isa<AutoType>(CanonicalType);
6640 if (
const auto *OPT = getAs<ObjCObjectPointerType>())
6641 return OPT->isObjCQualifiedIdType();
6646 if (
const auto *OPT = getAs<ObjCObjectPointerType>())
6647 return OPT->isObjCQualifiedClassType();
6652 if (
const auto *OPT = getAs<ObjCObjectPointerType>())
6653 return OPT->isObjCIdType();
6658 if (
const auto *OPT = getAs<ObjCObjectPointerType>())
6659 return OPT->isObjCClassType();
6664 if (
const auto *OPT = getAs<PointerType>())
6665 return OPT->getPointeeType()->isSpecificBuiltinType(BuiltinType::ObjCSel);
6670 return isObjCIdType() || isObjCClassType() || isObjCSelType();
6674 return isa<DecltypeType>(
this);
6677 #define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \ 6678 inline bool Type::is##Id##Type() const { \ 6679 return isSpecificBuiltinType(BuiltinType::Id); \ 6681 #include "clang/Basic/OpenCLImageTypes.def" 6684 return isSpecificBuiltinType(BuiltinType::OCLSampler);
6688 return isSpecificBuiltinType(BuiltinType::OCLEvent);
6692 return isSpecificBuiltinType(BuiltinType::OCLClkEvent);
6696 return isSpecificBuiltinType(BuiltinType::OCLQueue);
6700 return isSpecificBuiltinType(BuiltinType::OCLReserveID);
6704 #define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) is##Id##Type() || 6706 #include "clang/Basic/OpenCLImageTypes.def" 6711 return isa<PipeType>(CanonicalType);
6714 #define EXT_OPAQUE_TYPE(ExtType, Id, Ext) \ 6715 inline bool Type::is##Id##Type() const { \ 6716 return isSpecificBuiltinType(BuiltinType::Id); \ 6718 #include "clang/Basic/OpenCLExtensionTypes.def" 6721 #define INTEL_SUBGROUP_AVC_TYPE(ExtType, Id) \ 6722 isOCLIntelSubgroupAVC##Id##Type() || 6724 #include "clang/Basic/OpenCLExtensionTypes.def" 6729 #define EXT_OPAQUE_TYPE(ExtType, Id, Ext) is##Id##Type() || 6731 #include "clang/Basic/OpenCLExtensionTypes.def" 6736 return isSamplerT() || isEventT() || isImageType() || isClkEventT() ||
6737 isQueueT() || isReserveIDT() || isPipeType() || isOCLExtOpaqueType();
6741 return isa<TemplateTypeParmType>(CanonicalType);
6752 if (
const auto *BT = dyn_cast<BuiltinType>(
this))
6753 return BT->isPlaceholderType();
6758 if (
const auto *BT = dyn_cast<BuiltinType>(
this))
6759 if (BT->isPlaceholderType())
6766 if (
const auto *BT = dyn_cast<BuiltinType>(
this))
6772 if (
const auto *BT = dyn_cast<BuiltinType>(
this))
6773 return BT->isNonOverloadPlaceholderType();
6778 if (
const auto *BT = dyn_cast<BuiltinType>(CanonicalType))
6779 return BT->getKind() == BuiltinType::Void;
6784 if (
const auto *BT = dyn_cast<BuiltinType>(CanonicalType))
6785 return BT->getKind() == BuiltinType::Half;
6791 if (
const auto *BT = dyn_cast<BuiltinType>(CanonicalType))
6792 return BT->getKind() == BuiltinType::Float16;
6797 if (
const auto *BT = dyn_cast<BuiltinType>(CanonicalType))
6798 return BT->getKind() == BuiltinType::Float128;
6803 if (
const auto *BT = getAs<BuiltinType>())
6804 return BT->getKind() == BuiltinType::NullPtr;
6812 if (
const auto *BT = dyn_cast<BuiltinType>(CanonicalType))
6813 return BT->getKind() >= BuiltinType::Bool &&
6814 BT->getKind() <= BuiltinType::Int128;
6815 if (
const EnumType *ET = dyn_cast<EnumType>(CanonicalType)) {
6825 if (
const auto *BT = dyn_cast<BuiltinType>(CanonicalType)) {
6826 return BT->getKind() >= BuiltinType::ShortAccum &&
6827 BT->getKind() <= BuiltinType::SatULongFract;
6833 return isFixedPointType() || isIntegerType();
6837 if (
const auto *BT = dyn_cast<BuiltinType>(CanonicalType)) {
6838 return BT->getKind() >= BuiltinType::SatShortAccum &&
6839 BT->getKind() <= BuiltinType::SatULongFract;
6845 return isFixedPointType() && !isSaturatedFixedPointType();
6849 if (
const auto *BT = dyn_cast<BuiltinType>(CanonicalType)) {
6850 return ((BT->getKind() >= BuiltinType::ShortAccum &&
6851 BT->getKind() <= BuiltinType::LongAccum) ||
6852 (BT->getKind() >= BuiltinType::ShortFract &&
6853 BT->getKind() <= BuiltinType::LongFract) ||
6854 (BT->getKind() >= BuiltinType::SatShortAccum &&
6855 BT->getKind() <= BuiltinType::SatLongAccum) ||
6856 (BT->getKind() >= BuiltinType::SatShortFract &&
6857 BT->getKind() <= BuiltinType::SatLongFract));
6863 return isFixedPointType() && !isSignedFixedPointType();
6867 if (
const auto *BT = dyn_cast<BuiltinType>(CanonicalType))
6868 return BT->getKind() > BuiltinType::Void &&
6869 BT->getKind() <= BuiltinType::NullPtr;
6870 if (
const EnumType *ET = dyn_cast<EnumType>(CanonicalType))
6874 return isa<PointerType>(CanonicalType) ||
6875 isa<BlockPointerType>(CanonicalType) ||
6876 isa<MemberPointerType>(CanonicalType) ||
6877 isa<ComplexType>(CanonicalType) ||
6878 isa<ObjCObjectPointerType>(CanonicalType);
6882 if (
const auto *BT = dyn_cast<BuiltinType>(CanonicalType))
6883 return BT->getKind() >= BuiltinType::Bool &&
6884 BT->getKind() <= BuiltinType::Int128;
6888 if (
const auto *ET = dyn_cast<EnumType>(CanonicalType))
6895 if (
const auto *BT = dyn_cast<BuiltinType>(CanonicalType))
6896 return BT->getKind() == BuiltinType::Bool;
6901 auto *DT = getContainedDeducedType();
6902 return DT && !DT->isDeduced();
6908 return isDependentType() ||
isRecordType() || isEnumeralType();
6913 return isFunctionType() || isArrayType();
6917 return (isPointerType() || isReferenceType() || isBlockPointerType() ||
6918 isObjCObjectPointerType() || isNullPtrType());
6922 return isObjCObjectPointerType();
6928 type =
arrayType->getElementType().getTypePtr();
6944 DB.
AddTaggedVal(
static_cast<std::underlying_type_t<LangAS>
>(AS),
6945 DiagnosticsEngine::ArgumentKind::ak_addrspace);
6953 PD.
AddTaggedVal(
static_cast<std::underlying_type_t<LangAS>
>(AS),
6954 DiagnosticsEngine::ArgumentKind::ak_addrspace);
6963 DiagnosticsEngine::ArgumentKind::ak_qual);
6972 DiagnosticsEngine::ArgumentKind::ak_qual);
6996 template <
typename T>
6998 std::integral_constant<bool, std::is_same<T, ArrayType>::value ||
6999 std::is_base_of<ArrayType, T>::value>;
7004 "ArrayType cannot be used with getAs!");
7007 if (
const auto *Ty = dyn_cast<T>(
this))
7011 if (!isa<T>(CanonicalType))
7016 return cast<T>(getUnqualifiedDesugaredType());
7023 if (
const auto *Ty = dyn_cast<T>(
this))
7027 if (!isa<T>(CanonicalType))
7032 const Type *Ty =
this;
7034 if (
const auto *A = dyn_cast<AttributedType>(Ty))
7035 Ty = A->getModifiedType().getTypePtr();
7036 else if (
const auto *E = dyn_cast<ElaboratedType>(Ty))
7037 Ty = E->desugar().getTypePtr();
7038 else if (
const auto *
P = dyn_cast<ParenType>(Ty))
7039 Ty =
P->desugar().getTypePtr();
7040 else if (
const auto *A = dyn_cast<AdjustedType>(Ty))
7041 Ty = A->desugar().getTypePtr();
7042 else if (
const auto *M = dyn_cast<MacroQualifiedType>(Ty))
7043 Ty = M->desugar().getTypePtr();
7050 return dyn_cast<T>(Ty);
7055 if (
const auto *arr = dyn_cast<ArrayType>(
this))
7059 if (!isa<ArrayType>(CanonicalType))
7064 return cast<ArrayType>(getUnqualifiedDesugaredType());
7069 "ArrayType cannot be used with castAs!");
7071 if (
const auto *ty = dyn_cast<T>(
this))
return ty;
7072 assert(isa<T>(CanonicalType));
7073 return cast<T>(getUnqualifiedDesugaredType());
7077 assert(isa<ArrayType>(CanonicalType));
7078 if (
const auto *arr = dyn_cast<ArrayType>(
this))
return arr;
7079 return cast<ArrayType>(getUnqualifiedDesugaredType());
7084 :
AdjustedType(Decayed, OriginalType, DecayedPtr, CanonicalPtr) {
7086 QualType Adjusted = getAdjustedType();
7088 assert(isa<PointerType>(Adjusted));
7093 QualType Decayed = getDecayedType();
7095 return cast<PointerType>(Decayed)->getPointeeType();
7107 #endif // LLVM_CLANG_AST_TYPE_H
bool isDynamicExceptionSpec(ExceptionSpecificationType ESpecType)
Internal representation of canonical, dependent typeof(expr) types.
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
void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Ctx)
Represents the dependent type named by a dependently-scoped typename using declaration, e.g.
A (possibly-)qualified type.
bool isBlockPointerType() const
bool hasNonTrivialToPrimitiveCopyCUnion() const
Check if this is or contains a C union that is non-trivial to copy, which is a union that has a membe...
static void Profile(llvm::FoldingSetNodeID &ID, QualType Pointee)
ExtProtoInfo(CallingConv CC)
bool getNoCfCheck() const
bool isMemberPointerType() const
QualType getInjectedSpecializationType() const
unsigned getNumExceptions() const
Return the number of types in the exception specification.
unsigned getNumArgs() const
static QualType getObjectType(APValue::LValueBase B)
Retrieves the "underlying object type" of the given expression, as used by __builtin_object_size.
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
Specialize PointerLikeTypeTraits to allow LazyGenerationalUpdatePtr to be placed into a PointerUnion...
bool isOCLExtOpaqueType() const
ArrayRef< TemplateArgument > getTypeConstraintArguments() const
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.
Qualifiers getFastTypeQuals() const
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.
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
QualType getUnderlyingType() 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
bool isVariadic() const
Whether this function prototype is variadic.
TagDecl * getDecl() const
ObjCObjectTypeBitfields ObjCObjectTypeBits
bool isExtVectorType() const
SubstTemplateTypeParmPackTypeBitfields SubstTemplateTypeParmPackTypeBits
static bool classof(const Type *T)
Represents a C++11 auto or C++14 decltype(auto) type, possibly constrained by a type-constraint.
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)
void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Context)
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.
A container of type source information.
RefQualifierKind RefQualifier
bool getHasRegParm() const
QualType getValueType() const
Gets the type contained by this atomic type, i.e.
SourceLocation EllipsisLoc
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)
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)
ExtParameterInfo withIsConsumed(bool consumed) const
QualType(const Type *Ptr, unsigned Quals)
Describes how types, statements, expressions, and declarations should be printed. ...
void print(llvm::raw_ostream &OS, const Pointer &P, ASTContext &Ctx, QualType Ty)
static void * getAsVoidPointer(::clang::Type *P)
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
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
void Profile(llvm::FoldingSetNodeID &ID)
SourceLocation getAttributeLoc() const
ElaboratedTypeBitfields ElaboratedTypeBits
Base wrapper for a particular "section" of type source info.
Represents a struct/union/class.
The width of the "fast" qualifier mask.
void AddTaggedVal(intptr_t V, DiagnosticsEngine::ArgumentKind Kind) const
DependentTypeOfExprType(const ASTContext &Context, Expr *E)
PackExpansionTypeBitfields PackExpansionTypeBits
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 isObjCInertUnsafeUnretainedType() const
Was this type written with the special inert-in-ARC __unsafe_unretained qualifier?
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)
const IdentifierInfo * getMacroIdentifier() const
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)
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 there is...
friend bool operator!=(ExtParameterInfo lhs, ExtParameterInfo rhs)
void overrideType(QualType T)
Override the type stored in this TypeSourceInfo. Use with caution!
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)
Defines the clang::attr::Kind enum.
static int getPointAccessorIdx(char c)
bool isObjCSelType() const
unsigned char getOpaqueValue() 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)
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.
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
Return the ith exception type, where 0 <= i < getNumExceptions().
bool hasAddressSpace() const
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified...
void print(raw_ostream &OS, const PrintingPolicy &Policy, const Twine &PlaceHolder=Twine(), unsigned Indentation=0) const
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.
ConstantArrayTypeBitfields ConstantArrayTypeBits
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.
bool isConstrained() const
Sugar type that represents a type that was qualified by a qualifier written as a macro invocation...
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.
bool hasNonTrivialToPrimitiveDestructCUnion() const
Check if this is or contains a C union that is non-trivial to destruct, which is a union that has a m...
LangAS getAddressSpace() const
ObjCProtocolDecl *const * getProtocolStorage() const
FunctionTypeBitfields store various bits belonging to FunctionProtoType.
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.
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.
static bool classof(const Type *T)
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)
bool Const(InterpState &S, CodePtr OpPC, const T &Arg)
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
ExceptionSpecInfo getExceptionSpecInfo() const
Return all the available information about this type's exception spec.
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
friend bool operator==(ExtParameterInfo lhs, ExtParameterInfo rhs)
Represents a K&R-style 'int foo()' function, which has no information available about its arguments...
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 hasOnlyVolatile() const
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.
static ExtParameterInfo getFromOpaqueValue(unsigned char data)
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()
DependentTemplateSpecializationTypeBitfields DependentTemplateSpecializationTypeBits
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)
const TemplateArgument * getArgs() const
Retrieve the template arguments.
static bool classof(const Type *T)
QualType getElementType() const
static bool isRead(AccessKinds AK)
IdentifierInfo * getIdentifier() const
bool hasOnlyConst() const
ExtParameterInfo withIsNoEscape(bool NoEscape) const
unsigned getNumArgs() const
Retrieve the number of template arguments.
bool isObjCGCStrong() const
true when Type is objc's strong.
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)
__UINTPTR_TYPE__ uintptr_t
An unsigned integer type with the property that any valid pointer to void can be converted to this ty...
void Profile(llvm::FoldingSetNodeID &ID)
Qualifiers::GC getObjCGCAttr() const
Returns gc attribute of this type.
const internal::VariadicAllOfMatcher< Decl > decl
Matches declarations.
bool isFunctionReferenceType() const
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
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)
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.
bool hasNonTrivialToPrimitiveDefaultInitializeCUnion() const
Check if this is or contains a C union that is non-trivial to default-initialize, which is a union th...
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.
void removeCVRQualifiers(unsigned mask)
static StringRef getIdentifier(const Token &Tok)
CallingConv
CallingConv - Specifies the calling convention that a function uses.
Expr * getUnderlyingExpr() const
bool hasOnlyRestrict() 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
Whether this function prototype has a trailing return type.
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
bool isObjectPointerType() const
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
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)
ParameterABI getABI() const
Return the ABI treatment of this parameter.
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)
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 FixedPointValueToString(SmallVectorImpl< char > &Str, llvm::APSInt Val, unsigned Scale)
static bool hasAttr(const FunctionDecl *D, bool IgnoreImplicitAttr)
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 isParameterPack() const
Qualifiers getMethodQuals() const
const TemplateTypeParmType * getReplacedParameter() const
Gets the template parameter that was substituted for.
QualType getEquivalentType() const
Expr * getNoexceptExpr() const
Return the expression inside noexcept(expression), or a null pointer if there is none (because the ex...
CanQual< Type > CanQualType
Represents a canonical, potentially-qualified type.
void Profile(llvm::FoldingSetNodeID &ID)
AttributedTypeBitfields AttributedTypeBits
QualType getInnerType() const
Qualifiers withoutObjCLifetime() const
ExceptionSpecInfo(ExceptionSpecificationType EST)
bool isMemberFunctionPointerType() const
bool isObjCObjectPointerType() const
bool isAnyPointerType() const
bool isDecltypeType() 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.
ExtParameterInfo withHasPassObjectSize() const
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
bool isFixedPointOrIntegerType() const
Return true if this is a fixed point or integer type.
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.
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)
TemplateSpecializationTypeBitfields TemplateSpecializationTypeBits
bool hasPassObjectSize() const
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...
bool isPtrSizeAddressSpace(LangAS AS)
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 isUndeducedAutoType() const
bool isPlaceholderType() const
Test for a type which does not represent an actual type-system type but is instead used as a placehol...
unsigned getNumArgs() const
Retrieve the number of template arguments.
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.
Optional< types::ID > 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)
ExtParameterInfo withABI(ParameterABI kind) const
static bool classof(const Type *T)
TypeWithKeywordBitfields TypeWithKeywordBits
static std::string getName(const CallEvent &Call)
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
Interesting information about a specific parameter that can't simply be reflected in parameter's type...
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)
Qualifiers withoutAddressSpace() const
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)
friend bool operator<(const QualType &LHS, const QualType &RHS)
static void Profile(llvm::FoldingSetNodeID &ID, QualType Pattern, Optional< unsigned > NumExpansions)
ExtProtoInfo withExceptionSpec(const ExceptionSpecInfo &ESI)
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
unsigned getCVRUQualifiers() 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 the address space in these qualifiers is equal to or a superset of the address space ...
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
const Expr * getSizeExpr() const
ExceptionSpecificationType
The various types of exception specifications that exist in C++11.
Holds information about the various types of exception specification.
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...
bool hasAddressSpace() const
Check if this type has any address space qualifier.
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.
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)
static bool isAddressSpaceSupersetOf(LangAS A, LangAS B)
Returns true if address space A is equal to or a superset of B.
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)
SourceLocation getEllipsisLoc() const
Qualifiers getNonFastQualifiers() const
bool isVisibilityExplicit() const
Return true if the visibility was explicitly set is the code.
void removeLocalFastQualifiers(unsigned Mask)
unsigned getCVRQualifiers() const
bool isOCLIntelSubgroupAVCType() 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.
Microsoft __declspec(nothrow) extension.
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...
bool isConsumed() const
Is this parameter considered "consumed" by Objective-C ARC? Consumed parameters must have retainable ...
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.
A simple holder for a QualType representing a type in an exception specification. ...
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...
ConceptDecl * getTypeConstraintConcept() const
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
QualType getType() const
Return the type wrapped by this type source info.
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.