17#ifndef LLVM_CLANG_AST_TYPE_H
18#define LLVM_CLANG_AST_TYPE_H
33#include "llvm/ADT/APInt.h"
34#include "llvm/ADT/APSInt.h"
35#include "llvm/ADT/ArrayRef.h"
36#include "llvm/ADT/FoldingSet.h"
37#include "llvm/ADT/PointerIntPair.h"
38#include "llvm/ADT/PointerUnion.h"
39#include "llvm/ADT/STLForwardCompat.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/TrailingObjects.h"
48#include "llvm/Support/type_traits.h"
65class TemplateParameterList;
73namespace serialization {
74 template <
class T>
class AbstractTypeReader;
111template <
typename>
class CanQual;
116class ExtQualsTypeCommonBase;
120class ObjCInterfaceDecl;
121class ObjCProtocolDecl;
122class ObjCTypeParamDecl;
123struct PrintingPolicy;
127class TemplateArgument;
128class TemplateArgumentListInfo;
129class TemplateArgumentLoc;
130class TemplateTypeParmDecl;
131class TypedefNameDecl;
132class UnresolvedUsingTypenameDecl;
133class UsingShadowDecl;
138#define TYPE(Class, Base) class Class##Type;
139#include "clang/AST/TypeNodes.inc"
202 Q.Mask = L.Mask & R.Mask;
299 assert(!(mask & ~
CVRMask) &&
"bitmask contains non-CVR bits");
300 Mask = (Mask & ~CVRMask) | mask;
303 assert(!(mask & ~
CVRMask) &&
"bitmask contains non-CVR bits");
310 assert(!(mask & ~
CVRMask) &&
"bitmask contains non-CVR bits");
314 assert(!(mask & ~
CVRMask & ~UMask) &&
"bitmask contains non-CVRU bits");
320 Mask = (Mask & ~UMask) | (flag ? UMask : 0);
328 Mask = (Mask & ~GCAttrMask) | (
type << GCAttrShift);
353 return ObjCLifetime((Mask & LifetimeMask) >> LifetimeShift);
356 Mask = (Mask & ~LifetimeMask) | (
type << LifetimeShift);
362 Mask |= (
type << LifetimeShift);
379 return static_cast<LangAS>(Mask >> AddressSpaceShift);
400 Mask = (Mask & ~AddressSpaceMask)
401 | (((uint32_t) space) << AddressSpaceShift);
414 assert(!(mask & ~
FastMask) &&
"bitmask contains non-fast qualifier bits");
415 Mask = (Mask & ~FastMask) | mask;
418 assert(!(mask & ~
FastMask) &&
"bitmask contains non-fast qualifier bits");
425 assert(!(mask & ~
FastMask) &&
"bitmask contains non-fast qualifier bits");
440 bool empty()
const {
return !Mask; }
605 bool appendSpaceIfNonEmpty =
false)
const;
616 static const uint32_t UMask = 0x8;
617 static const uint32_t UShift = 3;
618 static const uint32_t GCAttrMask = 0x30;
619 static const uint32_t GCAttrShift = 4;
620 static const uint32_t LifetimeMask = 0x1C0;
621 static const uint32_t LifetimeShift = 6;
622 static const uint32_t AddressSpaceMask =
623 ~(
CVRMask | UMask | GCAttrMask | LifetimeMask);
624 static const uint32_t AddressSpaceShift = 9;
634 : Quals(Quals), HasAtomic(HasAtomic) {}
683 std::pair<const Type *,Qualifiers>
asPair()
const {
684 return std::pair<const Type *, Qualifiers>(
Ty,
Quals);
688 return a.
Ty ==
b.Ty && a.
Quals ==
b.Quals;
691 return a.
Ty !=
b.Ty || a.
Quals !=
b.Quals;
741 llvm::PointerIntPair<llvm::PointerUnion<const Type *, const ExtQuals *>,
744 const ExtQuals *getExtQualsUnsafe()
const {
748 const Type *getTypePtrUnsafe()
const {
749 return Value.getPointer().get<
const Type*>();
752 const ExtQualsTypeCommonBase *getCommonPtr()
const {
753 assert(!
isNull() &&
"Cannot retrieve a NULL type pointer");
754 auto CommonPtrVal =
reinterpret_cast<uintptr_t>(
Value.getOpaqueValue());
756 return reinterpret_cast<ExtQualsTypeCommonBase*
>(CommonPtrVal);
788 T.Value.setFromOpaqueValue(
const_cast<void*
>(Ptr));
805 return Value.getPointer().isNull();
832 std::optional<NonConstantStorageReason>
977 &&
"non-fast qualifier bits set in mask!");
1102 return getSingleStepDesugaredTypeImpl(*
this, Context);
1108 if (isa<ParenType>(*
this))
1115 return LHS.Value == RHS.Value;
1118 return LHS.Value != RHS.Value;
1121 return LHS.Value < RHS.Value;
1135 const Twine &PlaceHolder = Twine(),
1136 unsigned Indentation = 0)
const;
1140 unsigned Indentation = 0) {
1146 const Twine &PlaceHolder,
1147 unsigned Indentation = 0);
1164 const Twine &PlaceHolder;
1165 unsigned Indentation;
1169 const Twine &PlaceHolder,
unsigned Indentation)
1170 : T(T), Policy(Policy), PlaceHolder(PlaceHolder),
1171 Indentation(Indentation) {}
1175 SQT.T.
print(OS, SQT.Policy, SQT.PlaceHolder, SQT.Indentation);
1181 const Twine &PlaceHolder = Twine(),
1182 unsigned Indentation = 0)
const {
1186 void dump(
const char *
s)
const;
1188 void dump(llvm::raw_ostream &OS,
const ASTContext &Context)
const;
1324 return isDestructedTypeImpl(*
this);
1422raw_ostream &
operator<<(raw_ostream &OS, QualType QT);
1442 return P.getAsOpaquePtr();
1450 static constexpr int NumLowBitsAvailable = 0;
1470 const Type *
const BaseType;
1476 : BaseType(baseType), CanonicalType(canon) {}
1490 public llvm::FoldingSetNode {
1513 canon.isNull() ?
QualType(this_(), 0) : canon),
1515 assert(Quals.hasNonFastQualifiers()
1516 &&
"ExtQuals created with no fast qualifiers");
1517 assert(!Quals.hasFastQualifiers()
1518 &&
"ExtQuals created with fast qualifiers");
1528 return Quals.getObjCLifetime();
1538 Profile(
ID, getBaseType(), Quals);
1542 const Type *BaseType,
1545 ID.AddPointer(BaseType);
1576enum class ArraySizeModifier;
1577enum class ElaboratedTypeKeyword;
1578enum class VectorKind;
1609#define TYPE(Class, Base) Class,
1610#define LAST_TYPE(Class) TypeLast = Class
1611#define ABSTRACT_TYPE(Class, Base)
1612#include "clang/AST/TypeNodes.inc"
1617 class TypeBitfields {
1619 template <
class T>
friend class TypePropertyCache;
1622 LLVM_PREFERRED_TYPE(TypeClass)
1627 unsigned Dependence : llvm::BitWidth<TypeDependence>;
1631 LLVM_PREFERRED_TYPE(
bool)
1632 mutable unsigned CacheValid : 1;
1636 mutable unsigned CachedLinkage : 3;
1639 LLVM_PREFERRED_TYPE(
bool)
1640 mutable unsigned CachedLocalOrUnnamed : 1;
1643 LLVM_PREFERRED_TYPE(
bool)
1644 mutable unsigned FromAST : 1;
1646 bool isCacheValid()
const {
1651 assert(isCacheValid() &&
"getting linkage from invalid cache");
1652 return static_cast<Linkage>(CachedLinkage);
1655 bool hasLocalOrUnnamedType()
const {
1656 assert(isCacheValid() &&
"getting linkage from invalid cache");
1657 return CachedLocalOrUnnamed;
1660 enum { NumTypeBits = 8 + llvm::BitWidth<TypeDependence> + 6 };
1669 LLVM_PREFERRED_TYPE(TypeBitfields)
1675 unsigned IndexTypeQuals : 3;
1680 unsigned SizeModifier : 3;
1682 enum { NumArrayTypeBits = NumTypeBits + 6 };
1691 LLVM_PREFERRED_TYPE(
bool)
1692 unsigned HasStoredSizeExpr : 1;
1698 LLVM_PREFERRED_TYPE(TypeBitfields)
1702 static constexpr unsigned NumOfBuiltinTypeBits = 9;
1703 unsigned Kind : NumOfBuiltinTypeBits;
1713 LLVM_PREFERRED_TYPE(TypeBitfields)
1719 unsigned ExtInfo : 13;
1725 unsigned RefQualifier : 2;
1734 unsigned FastTypeQuals : Qualifiers::FastWidth;
1736 LLVM_PREFERRED_TYPE(
bool)
1737 unsigned HasExtQuals : 1;
1743 unsigned NumParams : 16;
1747 unsigned ExceptionSpecType : 4;
1750 LLVM_PREFERRED_TYPE(
bool)
1751 unsigned HasExtParameterInfos : 1;
1754 LLVM_PREFERRED_TYPE(
bool)
1755 unsigned HasExtraBitfields : 1;
1758 LLVM_PREFERRED_TYPE(
bool)
1759 unsigned Variadic : 1;
1762 LLVM_PREFERRED_TYPE(
bool)
1763 unsigned HasTrailingReturn : 1;
1769 LLVM_PREFERRED_TYPE(TypeBitfields)
1773 unsigned NumTypeArgs : 7;
1776 unsigned NumProtocols : 6;
1779 LLVM_PREFERRED_TYPE(
bool)
1780 unsigned IsKindOf : 1;
1786 LLVM_PREFERRED_TYPE(TypeBitfields)
1800 LLVM_PREFERRED_TYPE(
bool)
1801 unsigned SpelledAsLValue : 1;
1805 LLVM_PREFERRED_TYPE(
bool)
1806 unsigned InnerRef : 1;
1812 LLVM_PREFERRED_TYPE(TypeBitfields)
1817 unsigned Keyword : 8;
1820 enum { NumTypeWithKeywordBits = NumTypeBits + 8 };
1829 LLVM_PREFERRED_TYPE(
bool)
1830 unsigned HasOwnedTagDecl : 1;
1837 LLVM_PREFERRED_TYPE(TypeBitfields)
1843 unsigned VecKind : 4;
1845 uint32_t NumElements;
1851 LLVM_PREFERRED_TYPE(TypeBitfields)
1855 unsigned AttrKind : 32 - NumTypeBits;
1861 LLVM_PREFERRED_TYPE(TypeBitfields)
1867 unsigned Keyword : 2;
1883 LLVM_PREFERRED_TYPE(TypeBitfields)
1885 LLVM_PREFERRED_TYPE(
bool)
1886 unsigned IsUnqual : 1;
1892 LLVM_PREFERRED_TYPE(TypeBitfields)
1896 LLVM_PREFERRED_TYPE(
bool)
1897 unsigned hasTypeDifferentFromDecl : 1;
1903 LLVM_PREFERRED_TYPE(TypeBitfields)
1907 LLVM_PREFERRED_TYPE(
bool)
1908 unsigned hasTypeDifferentFromDecl : 1;
1914 LLVM_PREFERRED_TYPE(TypeBitfields)
1917 LLVM_PREFERRED_TYPE(
bool)
1918 unsigned HasNonCanonicalUnderlyingType : 1;
1921 unsigned Index : 15;
1928 unsigned PackIndex : 16;
1934 LLVM_PREFERRED_TYPE(TypeBitfields)
1938 unsigned Index : 16;
1944 unsigned NumArgs : 16;
1950 LLVM_PREFERRED_TYPE(TypeBitfields)
1954 LLVM_PREFERRED_TYPE(
bool)
1955 unsigned TypeAlias : 1;
1986 LLVM_PREFERRED_TYPE(TypeBitfields)
2000 unsigned NumExpansions;
2031 void setFromAST(
bool V =
true)
const {
2032 TypeBits.FromAST =
V;
2040 canon.isNull() ?
QualType(this_(), 0) : canon) {
2041 static_assert(
sizeof(*this) <=
2043 "changing bitfields changed sizeof(Type)!");
2044 static_assert(
alignof(
decltype(*this)) %
TypeAlignment == 0,
2045 "Insufficient alignment!");
2047 TypeBits.Dependence =
static_cast<unsigned>(
Dependence);
2048 TypeBits.CacheValid =
false;
2049 TypeBits.CachedLocalOrUnnamed =
false;
2050 TypeBits.CachedLinkage = llvm::to_underlying(Linkage::Invalid);
2051 TypeBits.FromAST =
false;
2058 TypeBits.Dependence =
static_cast<unsigned>(D);
2095 return getDependence() & TypeDependence::UnexpandedPack;
2101 return CanonicalType ==
QualType(
this, 0);
2107 QualType getLocallyUnqualifiedSingleStepDesugaredType()
const;
2115 bool isSizelessType()
const;
2116 bool isSizelessBuiltinType()
const;
2119 bool isSizelessVectorType()
const;
2122 bool isSVESizelessBuiltinType()
const;
2125 bool isRVVSizelessBuiltinType()
const;
2128 bool isWebAssemblyExternrefType()
const;
2133 bool isWebAssemblyTableType()
const;
2138 bool isSveVLSBuiltinType()
const;
2148 bool isRVVVLSBuiltinType()
const;
2166 bool isIncompleteType(
NamedDecl **Def =
nullptr)
const;
2171 return !isFunctionType();
2179 return !isReferenceType() && !isFunctionType() && !isVoidType();
2184 bool isLiteralType(
const ASTContext &Ctx)
const;
2187 bool isStructuralType()
const;
2191 bool isStandardLayoutType()
const;
2197 bool isBuiltinType()
const;
2200 bool isSpecificBuiltinType(
unsigned K)
const;
2205 bool isPlaceholderType()
const;
2209 bool isSpecificPlaceholderType(
unsigned K)
const;
2213 bool isNonOverloadPlaceholderType()
const;
2217 bool isIntegerType()
const;
2218 bool isEnumeralType()
const;
2221 bool isScopedEnumeralType()
const;
2223 bool isCharType()
const;
2224 bool isWideCharType()
const;
2225 bool isChar8Type()
const;
2226 bool isChar16Type()
const;
2227 bool isChar32Type()
const;
2228 bool isAnyCharacterType()
const;
2229 bool isIntegralType(
const ASTContext &Ctx)
const;
2232 bool isIntegralOrEnumerationType()
const;
2235 bool isIntegralOrUnscopedEnumerationType()
const;
2236 bool isUnscopedEnumerationType()
const;
2239 bool isRealFloatingType()
const;
2242 bool isComplexType()
const;
2243 bool isAnyComplexType()
const;
2244 bool isFloatingType()
const;
2245 bool isHalfType()
const;
2246 bool isFloat16Type()
const;
2247 bool isFloat32Type()
const;
2248 bool isBFloat16Type()
const;
2249 bool isFloat128Type()
const;
2250 bool isIbm128Type()
const;
2251 bool isRealType()
const;
2252 bool isArithmeticType()
const;
2253 bool isVoidType()
const;
2254 bool isScalarType()
const;
2255 bool isAggregateType()
const;
2256 bool isFundamentalType()
const;
2257 bool isCompoundType()
const;
2261 bool isFunctionType()
const;
2264 bool isPointerType()
const;
2265 bool isAnyPointerType()
const;
2266 bool isBlockPointerType()
const;
2267 bool isVoidPointerType()
const;
2268 bool isReferenceType()
const;
2269 bool isLValueReferenceType()
const;
2270 bool isRValueReferenceType()
const;
2271 bool isObjectPointerType()
const;
2272 bool isFunctionPointerType()
const;
2273 bool isFunctionReferenceType()
const;
2274 bool isMemberPointerType()
const;
2275 bool isMemberFunctionPointerType()
const;
2276 bool isMemberDataPointerType()
const;
2277 bool isArrayType()
const;
2278 bool isConstantArrayType()
const;
2279 bool isIncompleteArrayType()
const;
2280 bool isVariableArrayType()
const;
2281 bool isDependentSizedArrayType()
const;
2283 bool isClassType()
const;
2284 bool isStructureType()
const;
2285 bool isObjCBoxableRecordType()
const;
2286 bool isInterfaceType()
const;
2287 bool isStructureOrClassType()
const;
2288 bool isUnionType()
const;
2289 bool isComplexIntegerType()
const;
2290 bool isVectorType()
const;
2291 bool isExtVectorType()
const;
2292 bool isExtVectorBoolType()
const;
2293 bool isMatrixType()
const;
2294 bool isConstantMatrixType()
const;
2295 bool isDependentAddressSpaceType()
const;
2296 bool isObjCObjectPointerType()
const;
2297 bool isObjCRetainableType()
const;
2298 bool isObjCLifetimeType()
const;
2299 bool isObjCIndirectLifetimeType()
const;
2300 bool isObjCNSObjectType()
const;
2301 bool isObjCIndependentClassType()
const;
2304 bool isObjCObjectType()
const;
2305 bool isObjCQualifiedInterfaceType()
const;
2306 bool isObjCQualifiedIdType()
const;
2307 bool isObjCQualifiedClassType()
const;
2308 bool isObjCObjectOrInterfaceType()
const;
2309 bool isObjCIdType()
const;
2310 bool isDecltypeType()
const;
2318 return hasAttr(attr::ObjCInertUnsafeUnretained);
2328 bool isObjCIdOrObjectKindOfType(
const ASTContext &ctx,
2331 bool isObjCClassType()
const;
2339 bool isObjCClassOrClassKindOfType()
const;
2341 bool isBlockCompatibleObjCPointerType(
ASTContext &ctx)
const;
2342 bool isObjCSelType()
const;
2343 bool isObjCBuiltinType()
const;
2344 bool isObjCARCBridgableType()
const;
2345 bool isCARCBridgableType()
const;
2346 bool isTemplateTypeParmType()
const;
2347 bool isNullPtrType()
const;
2349 bool isNothrowT()
const;
2350 bool isAlignValT()
const;
2351 bool isStdByteType()
const;
2352 bool isAtomicType()
const;
2353 bool isUndeducedAutoType()
const;
2355 bool isTypedefNameType()
const;
2357#define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \
2358 bool is##Id##Type() const;
2359#include "clang/Basic/OpenCLImageTypes.def"
2361 bool isImageType()
const;
2363 bool isSamplerT()
const;
2364 bool isEventT()
const;
2365 bool isClkEventT()
const;
2366 bool isQueueT()
const;
2367 bool isReserveIDT()
const;
2369#define EXT_OPAQUE_TYPE(ExtType, Id, Ext) \
2370 bool is##Id##Type() const;
2371#include "clang/Basic/OpenCLExtensionTypes.def"
2373 bool isOCLIntelSubgroupAVCType()
const;
2374 bool isOCLExtOpaqueType()
const;
2376 bool isPipeType()
const;
2377 bool isBitIntType()
const;
2378 bool isOpenCLSpecificType()
const;
2383 bool isObjCARCImplicitlyUnretainedType()
const;
2386 bool isCUDADeviceBuiltinSurfaceType()
const;
2388 bool isCUDADeviceBuiltinTextureType()
const;
2407 ScalarTypeKind getScalarTypeKind()
const;
2415 return getDependence() & TypeDependence::Error;
2421 return getDependence() & TypeDependence::Dependent;
2429 return getDependence() & TypeDependence::Instantiation;
2435 bool isUndeducedType()
const;
2439 return getDependence() & TypeDependence::VariablyModified;
2444 bool hasSizedVLAType()
const;
2447 bool hasUnnamedOrLocalType()
const;
2449 bool isOverloadableType()
const;
2452 bool isElaboratedTypeSpecifier()
const;
2454 bool canDecayToPointerType()
const;
2459 bool hasPointerRepresentation()
const;
2463 bool hasObjCPointerRepresentation()
const;
2467 bool hasIntegerRepresentation()
const;
2471 bool hasSignedIntegerRepresentation()
const;
2475 bool hasUnsignedIntegerRepresentation()
const;
2479 bool hasFloatingRepresentation()
const;
2484 const RecordType *getAsStructureType()
const;
2487 const ComplexType *getAsComplexIntegerType()
const;
2508 TagDecl *getAsTagDecl()
const;
2526 return dyn_cast_or_null<AutoType>(getContainedDeducedType());
2532 bool hasAutoForTrailingReturnType()
const;
2540 template <
typename T>
const T *getAs()
const;
2547 template <
typename T>
const T *getAsAdjusted()
const;
2551 const ArrayType *getAsArrayTypeUnsafe()
const;
2559 template <
typename T>
const T *castAs()
const;
2563 const ArrayType *castAsArrayTypeUnsafe()
const;
2572 const Type *getBaseElementTypeUnsafe()
const;
2577 const Type *getArrayElementTypeNoTypeQual()
const;
2582 const Type *getPointeeOrArrayElementType()
const;
2590 const Type *getUnqualifiedDesugaredType()
const;
2595 bool isSignedIntegerType()
const;
2600 bool isUnsignedIntegerType()
const;
2604 bool isSignedIntegerOrEnumerationType()
const;
2608 bool isUnsignedIntegerOrEnumerationType()
const;
2612 bool isFixedPointType()
const;
2615 bool isFixedPointOrIntegerType()
const;
2618 bool isConvertibleToFixedPointType()
const;
2622 bool isSaturatedFixedPointType()
const;
2626 bool isUnsaturatedFixedPointType()
const;
2630 bool isSignedFixedPointType()
const;
2634 bool isUnsignedFixedPointType()
const;
2639 bool isConstantSizeType()
const;
2643 bool isSpecifierType()
const;
2650 return getLinkageAndVisibility().getVisibility();
2655 return getLinkageAndVisibility().isVisibilityExplicit();
2663 bool isLinkageValid()
const;
2670 std::optional<NullabilityKind> getNullability()
const;
2677 bool canHaveNullability(
bool ResultIfUnknown =
true)
const;
2694 std::optional<ArrayRef<QualType>>
2695 getObjCSubstitutions(
const DeclContext *dc)
const;
2699 bool acceptsObjCTypeParams()
const;
2701 const char *getTypeClassName()
const;
2704 return CanonicalType;
2709 void dump(llvm::raw_ostream &OS,
const ASTContext &Context)
const;
2714template <>
const TypedefType *Type::getAs()
const;
2715template <>
const UsingType *Type::getAs()
const;
2720template <>
const TemplateSpecializationType *Type::getAs()
const;
2724template <>
const AttributedType *Type::getAs()
const;
2728#define TYPE(Class, Base)
2729#define LEAF_TYPE(Class) \
2730template <> inline const Class##Type *Type::getAs() const { \
2731 return dyn_cast<Class##Type>(CanonicalType); \
2733template <> inline const Class##Type *Type::castAs() const { \
2734 return cast<Class##Type>(CanonicalType); \
2736#include "clang/AST/TypeNodes.inc"
2744#define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) Id,
2745#include "clang/Basic/OpenCLImageTypes.def"
2747#define EXT_OPAQUE_TYPE(ExtType, Id, Ext) Id,
2748#include "clang/Basic/OpenCLExtensionTypes.def"
2750#define SVE_TYPE(Name, Id, SingletonId) Id,
2751#include "clang/Basic/AArch64SVEACLETypes.def"
2753#define PPC_VECTOR_TYPE(Name, Id, Size) Id,
2754#include "clang/Basic/PPCTypes.def"
2756#define RVV_TYPE(Name, Id, SingletonId) Id,
2757#include "clang/Basic/RISCVVTypes.def"
2759#define WASM_TYPE(Name, Id, SingletonId) Id,
2760#include "clang/Basic/WebAssemblyReferenceTypes.def"
2762#define BUILTIN_TYPE(Id, SingletonId) Id,
2763#define LAST_BUILTIN_TYPE(Id) LastKind = Id
2764#include "clang/AST/BuiltinTypes.def"
2774 static_assert(Kind::LastKind <
2775 (1 << BuiltinTypeBitfields::NumOfBuiltinTypeBits) &&
2776 "Defined builtin type exceeds the allocated space for serial "
2778 BuiltinTypeBits.Kind = K;
2787 StringRef str =
getName(Policy);
2788 assert(!str.empty() && str.data()[str.size()] ==
'\0');
2817 return K >= Overload;
2824 return isPlaceholderTypeKind(
getKind());
2851 :
Type(
Complex, CanonicalPtr, Element->getDependence()),
2852 ElementType(Element) {}
2861 Profile(
ID, getElementType());
2865 ID.AddPointer(Element.getAsOpaquePtr());
2878 :
Type(
Paren, CanonType, InnerType->getDependence()), Inner(InnerType) {}
2887 Profile(
ID, getInnerType());
2904 :
Type(
Pointer, CanonicalPtr, Pointee->getDependence()),
2905 PointeeType(Pointee) {}
2914 Profile(
ID, getPointeeType());
2936 :
Type(TC, CanonicalPtr, OriginalTy->getDependence()),
2937 OriginalTy(OriginalTy), AdjustedTy(AdjustedTy) {}
2947 Profile(
ID, OriginalTy, AdjustedTy);
2970 inline QualType getPointeeType()
const;
2985 :
Type(BlockPointer, CanonicalCls, Pointee->getDependence()),
2986 PointeeType(Pointee) {}
2996 Profile(
ID, getPointeeType());
3014 bool SpelledAsLValue)
3015 :
Type(tc, CanonicalRef, Referencee->getDependence()),
3016 PointeeType(Referencee) {
3017 ReferenceTypeBits.SpelledAsLValue = SpelledAsLValue;
3032 return T->PointeeType;
3036 Profile(
ID, PointeeType, isSpelledAsLValue());
3041 bool SpelledAsLValue) {
3043 ID.AddBoolean(SpelledAsLValue);
3057 bool SpelledAsLValue)
3099 :
Type(MemberPointer, CanonicalPtr,
3101 Pointee->getDependence()),
3102 PointeeType(Pointee),
Class(Cls) {}
3126 Profile(
ID, getPointeeType(), getClass());
3130 const Type *Class) {
3156 unsigned tq,
const Expr *sz =
nullptr);
3166 return Qualifiers::fromCVRMask(getIndexTypeCVRQualifiers());
3170 return ArrayTypeBits.IndexTypeQuals;
3186 private llvm::TrailingObjects<ConstantArrayType, const Expr *> {
3188 friend TrailingObjects;
3194 :
ArrayType(ConstantArray, et, can, sm, tq, sz), Size(size) {
3195 ConstantArrayTypeBits.HasStoredSizeExpr = sz !=
nullptr;
3196 if (ConstantArrayTypeBits.HasStoredSizeExpr) {
3197 assert(!can.
isNull() &&
"canonical constant array should not have size");
3198 *getTrailingObjects<const Expr*>() = sz;
3202 unsigned numTrailingObjects(OverloadToken<const Expr*>)
const {
3203 return ConstantArrayTypeBits.HasStoredSizeExpr;
3207 const llvm::APInt &
getSize()
const {
return Size; }
3209 return ConstantArrayTypeBits.HasStoredSizeExpr
3210 ? *getTrailingObjects<const Expr *>()
3218 static unsigned getNumAddressingBits(
const ASTContext &Context,
3220 const llvm::APInt &NumElements);
3222 unsigned getNumAddressingBits(
const ASTContext &Context)
const;
3226 static unsigned getMaxSizeBits(
const ASTContext &Context);
3229 Profile(
ID, Ctx, getElementType(), getSize(), getSizeExpr(),
3230 getSizeModifier(), getIndexTypeCVRQualifiers());
3233 static void Profile(llvm::FoldingSetNodeID &
ID,
const ASTContext &Ctx,
3234 QualType ET,
const llvm::APInt &ArraySize,
3236 unsigned TypeQuals);
3251 :
ArrayType(IncompleteArray, et, can, sm, tq) {}
3264 Profile(
ID, getElementType(), getSizeModifier(),
3265 getIndexTypeCVRQualifiers());
3271 ID.AddInteger(llvm::to_underlying(SizeMod));
3272 ID.AddInteger(TypeQuals);
3303 :
ArrayType(VariableArray, et, can, sm, tq, e),
3304 SizeExpr((
Stmt*) e), Brackets(brackets) {}
3312 return (
Expr*) SizeExpr;
3327 llvm_unreachable(
"Cannot unique VariableArrayTypes.");
3367 return (
Expr*) SizeExpr;
3382 Profile(
ID, Context, getElementType(),
3383 getSizeModifier(), getIndexTypeCVRQualifiers(), getSizeExpr());
3386 static void Profile(llvm::FoldingSetNodeID &
ID,
const ASTContext &Context,
3388 unsigned TypeQuals,
Expr *E);
3405 Expr *AddrSpaceExpr;
3425 Profile(
ID, Context, getPointeeType(), getAddrSpaceExpr());
3428 static void Profile(llvm::FoldingSetNodeID &
ID,
const ASTContext &Context,
3468 Profile(
ID, Context, getElementType(), getSizeExpr());
3471 static void Profile(llvm::FoldingSetNodeID &
ID,
const ASTContext &Context,
3537 Profile(
ID, getElementType(), getNumElements(),
3538 getTypeClass(), getVectorKind());
3545 ID.AddInteger(NumElements);
3547 ID.AddInteger(llvm::to_underlying(VecKind));
3590 Profile(
ID, Context, getElementType(), getSizeExpr(), getVectorKind());
3593 static void Profile(llvm::FoldingSetNodeID &
ID,
const ASTContext &Context,
3608 :
VectorType(ExtVector, vecType, nElements, canonType,
3615 case 'x':
case 'r':
return 0;
3616 case 'y':
case 'g':
return 1;
3617 case 'z':
case 'b':
return 2;
3618 case 'w':
case 'a':
return 3;
3636 case 'a':
return 10;
3638 case 'b':
return 11;
3640 case 'c':
return 12;
3642 case 'd':
return 13;
3644 case 'e':
return 14;
3646 case 'f':
return 15;
3651 if (isNumericAccessor)
3652 return getNumericAccessorIdx(
c);
3654 return getPointAccessorIdx(
c);
3658 if (
int idx = getAccessorIdx(
c, isNumericAccessor)+1)
3659 return unsigned(idx-1) < getNumElements();
3684 const Expr *RowExpr =
nullptr,
const Expr *ColumnExpr =
nullptr);
3718 static constexpr unsigned MaxElementsPerDimension = (1 << 20) - 1;
3721 unsigned NColumns,
QualType CanonElementType);
3724 unsigned NColumns,
QualType CanonElementType);
3735 return getNumRows() * getNumColumns();
3740 return NumElements > 0 && NumElements <= MaxElementsPerDimension;
3745 return MaxElementsPerDimension;
3749 Profile(
ID, getElementType(), getNumRows(), getNumColumns(),
3754 unsigned NumRows,
unsigned NumColumns,
3757 ID.AddInteger(NumRows);
3758 ID.AddInteger(NumColumns);
3790 Profile(
ID, Context, getElementType(), getRowExpr(), getColumnExpr());
3793 static void Profile(llvm::FoldingSetNodeID &
ID,
const ASTContext &Context,
3829 HasPassObjSize = 0x20,
3832 unsigned char Data = 0;
3841 copy.Data = (copy.Data & ~ABIMask) |
unsigned(kind);
3851 copy.Data |= IsConsumed;
3853 copy.Data &= ~IsConsumed;
3860 Copy.Data |= HasPassObjSize;
3868 Copy.Data |= IsNoEscape;
3870 Copy.Data &= ~IsNoEscape;
3882 return lhs.Data == rhs.Data;
3886 return lhs.Data != rhs.Data;
3921 enum { CallConvMask = 0x1F };
3922 enum { NoReturnMask = 0x20 };
3923 enum { ProducesResultMask = 0x40 };
3924 enum { NoCallerSavedRegsMask = 0x80 };
3926 RegParmMask = 0x700,
3929 enum { NoCfCheckMask = 0x800 };
3930 enum { CmseNSCallMask = 0x1000 };
3931 uint16_t Bits =
CC_C;
3933 ExtInfo(
unsigned Bits) : Bits(static_cast<uint16_t>(Bits)) {}
3939 bool producesResult,
bool noCallerSavedRegs,
bool NoCfCheck,
3941 assert((!hasRegParm || regParm < 7) &&
"Invalid regparm value");
3942 Bits = ((
unsigned)cc) | (noReturn ? NoReturnMask : 0) |
3943 (producesResult ? ProducesResultMask : 0) |
3944 (noCallerSavedRegs ? NoCallerSavedRegsMask : 0) |
3945 (hasRegParm ? ((regParm + 1) << RegParmOffset) : 0) |
3946 (NoCfCheck ? NoCfCheckMask : 0) |
3947 (cmseNSCall ? CmseNSCallMask : 0);
3963 bool getHasRegParm()
const {
return ((Bits & RegParmMask) >> RegParmOffset) != 0; }
3966 unsigned RegParm = (Bits & RegParmMask) >> RegParmOffset;
3975 return Bits ==
Other.Bits;
3978 return Bits !=
Other.Bits;
3986 return ExtInfo(Bits | NoReturnMask);
3988 return ExtInfo(Bits & ~NoReturnMask);
3993 return ExtInfo(Bits | ProducesResultMask);
3995 return ExtInfo(Bits & ~ProducesResultMask);
4000 return ExtInfo(Bits | CmseNSCallMask);
4002 return ExtInfo(Bits & ~CmseNSCallMask);
4006 if (noCallerSavedRegs)
4007 return ExtInfo(Bits | NoCallerSavedRegsMask);
4009 return ExtInfo(Bits & ~NoCallerSavedRegsMask);
4014 return ExtInfo(Bits | NoCfCheckMask);
4016 return ExtInfo(Bits & ~NoCfCheckMask);
4020 assert(RegParm < 7 &&
"Invalid regparm value");
4021 return ExtInfo((Bits & ~RegParmMask) |
4022 ((RegParm + 1) << RegParmOffset));
4026 return ExtInfo((Bits & ~CallConvMask) | (
unsigned) cc);
4030 ID.AddInteger(Bits);
4048 LLVM_PREFERRED_TYPE(
bool)
4052 : NumExceptionType(0), HasArmTypeAttributes(
false) {}
4059 SME_NormalFunction = 0,
4060 SME_PStateSMEnabledMask = 1 << 0,
4061 SME_PStateSMCompatibleMask = 1 << 1,
4065 SME_ZAMask = 0b111 << SME_ZAShift,
4067 SME_ZT0Mask = 0b111 << SME_ZT0Shift,
4083 return (
ArmStateValue)((AttrBits & SME_ZAMask) >> SME_ZAShift);
4087 return (
ArmStateValue)((AttrBits & SME_ZT0Mask) >> SME_ZT0Shift);
4105 FunctionTypeBits.ExtInfo = Info.Bits;
4109 if (isFunctionProtoType())
4110 return Qualifiers::fromFastMask(FunctionTypeBits.FastTypeQuals);
4130 static_assert((
~Qualifiers::FastMask & Qualifiers::CVRMask) == 0,
4131 "Const, volatile and restrict are assumed to be a subset of "
4132 "the fast qualifiers.");
4134 bool isConst()
const {
return getFastTypeQuals().hasConst(); }
4135 bool isVolatile()
const {
return getFastTypeQuals().hasVolatile(); }
4136 bool isRestrict()
const {
return getFastTypeQuals().hasRestrict(); }
4144 static StringRef getNameForCallConv(
CallingConv CC);
4159 Result->getDependence() &
4171 Profile(
ID, getReturnType(), getExtInfo());
4194 public llvm::FoldingSetNode,
4195 private llvm::TrailingObjects<
4196 FunctionProtoType, QualType, SourceLocation,
4197 FunctionType::FunctionTypeExtraBitfields,
4198 FunctionType::FunctionTypeArmAttributes, FunctionType::ExceptionType,
4199 Expr *, FunctionDecl *, FunctionType::ExtParameterInfo, Qualifiers> {
4201 friend TrailingObjects;
4291 AArch64SMEAttributes(SME_NormalFunction) {}
4295 AArch64SMEAttributes(SME_NormalFunction) {}
4299 Result.ExceptionSpec = ESI;
4305 requiresFunctionProtoTypeArmAttributes();
4309 return AArch64SMEAttributes != SME_NormalFunction;
4314 AArch64SMEAttributes |= Kind;
4316 AArch64SMEAttributes &= ~Kind;
4321 unsigned numTrailingObjects(OverloadToken<QualType>)
const {
4322 return getNumParams();
4325 unsigned numTrailingObjects(OverloadToken<SourceLocation>)
const {
4326 return isVariadic();
4329 unsigned numTrailingObjects(OverloadToken<FunctionTypeArmAttributes>)
const {
4330 return hasArmTypeAttributes();
4333 unsigned numTrailingObjects(OverloadToken<FunctionTypeExtraBitfields>)
const {
4334 return hasExtraBitfields();
4337 unsigned numTrailingObjects(OverloadToken<ExceptionType>)
const {
4338 return getExceptionSpecSize().NumExceptionType;
4341 unsigned numTrailingObjects(OverloadToken<Expr *>)
const {
4342 return getExceptionSpecSize().NumExprPtr;
4345 unsigned numTrailingObjects(OverloadToken<FunctionDecl *>)
const {
4346 return getExceptionSpecSize().NumFunctionDeclPtr;
4349 unsigned numTrailingObjects(OverloadToken<ExtParameterInfo>)
const {
4350 return hasExtParameterInfos() ? getNumParams() : 0;
4355 static bool containsAnyUnexpandedParameterPack(
const QualType *ArgArray,
4357 for (
unsigned Idx = 0; Idx < numArgs; ++Idx)
4358 if (ArgArray[Idx]->containsUnexpandedParameterPack())
4364 FunctionProtoType(QualType result, ArrayRef<QualType> params,
4365 QualType canonical,
const ExtProtoInfo &epi);
4370 struct ExceptionSpecSizeHolder {
4371 unsigned NumExceptionType;
4372 unsigned NumExprPtr;
4373 unsigned NumFunctionDeclPtr;
4378 static ExceptionSpecSizeHolder
4379 getExceptionSpecSize(ExceptionSpecificationType EST,
unsigned NumExceptions) {
4390 return {NumExceptions, 0, 0};
4403 llvm_unreachable(
"bad exception specification kind");
4408 ExceptionSpecSizeHolder getExceptionSpecSize()
const {
4409 return getExceptionSpecSize(getExceptionSpecType(), getNumExceptions());
4413 bool hasExtraBitfields()
const {
4414 assert((getExceptionSpecType() != EST_Dynamic ||
4415 FunctionTypeBits.HasExtraBitfields) &&
4416 "ExtraBitfields are required for given ExceptionSpecType");
4417 return FunctionTypeBits.HasExtraBitfields;
4421 bool hasArmTypeAttributes()
const {
4422 return FunctionTypeBits.HasExtraBitfields &&
4423 getTrailingObjects<FunctionTypeExtraBitfields>()
4424 ->HasArmTypeAttributes;
4427 bool hasExtQualifiers()
const {
4428 return FunctionTypeBits.HasExtQuals;
4435 assert(i < getNumParams() &&
"invalid parameter index");
4436 return param_type_begin()[i];
4460 FunctionTypeBits.ExceptionSpecType);
4477 bool hasDependentExceptionSpec()
const;
4481 bool hasInstantiationDependentExceptionSpec()
const;
4486 Result.Type = getExceptionSpecType();
4488 Result.Exceptions = exceptions();
4490 Result.NoexceptExpr = getNoexceptExpr();
4492 Result.SourceDecl = getExceptionSpecDecl();
4493 Result.SourceTemplate = getExceptionSpecTemplate();
4495 Result.SourceDecl = getExceptionSpecDecl();
4503 ? getTrailingObjects<FunctionTypeExtraBitfields>()
4510 assert(i < getNumExceptions() &&
"Invalid exception number!");
4511 return exception_begin()[i];
4519 return *getTrailingObjects<Expr *>();
4530 return getTrailingObjects<FunctionDecl *>()[0];
4540 return getTrailingObjects<FunctionDecl *>()[1];
4551 return ResultIfDependent ? canThrow() !=
CT_Can : canThrow() ==
CT_Cannot;
4558 return isVariadic() ? *getTrailingObjects<SourceLocation>()
4568 bool isTemplateVariadic()
const;
4574 if (hasExtQualifiers())
4575 return *getTrailingObjects<Qualifiers>();
4577 return getFastTypeQuals();
4592 return getTrailingObjects<QualType>();
4596 return param_type_begin() + getNumParams();
4607 getTrailingObjects<ExceptionType>());
4611 return exception_begin() + getNumExceptions();
4617 return FunctionTypeBits.HasExtParameterInfos;
4621 assert(hasExtParameterInfos());
4630 if (!hasExtParameterInfos())
4632 return getTrailingObjects<ExtParameterInfo>();
4638 if (!hasArmTypeAttributes())
4639 return SME_NormalFunction;
4640 return getTrailingObjects<FunctionTypeArmAttributes>()
4641 ->AArch64SMEAttributes;
4645 assert(I < getNumParams() &&
"parameter index out of range");
4646 if (hasExtParameterInfos())
4647 return getTrailingObjects<ExtParameterInfo>()[I];
4652 assert(I < getNumParams() &&
"parameter index out of range");
4653 if (hasExtParameterInfos())
4654 return getTrailingObjects<ExtParameterInfo>()[I].getABI();
4655 return ParameterABI::Ordinary;
4659 assert(I < getNumParams() &&
"parameter index out of range");
4660 if (hasExtParameterInfos())
4661 return getTrailingObjects<ExtParameterInfo>()[I].isConsumed();
4668 void printExceptionSpecification(raw_ostream &OS,
4675 void Profile(llvm::FoldingSetNodeID &
ID,
const ASTContext &Ctx);
4708 return Profile(
ID,
Decl);
4718 public llvm::FoldingSetNode,
4719 private llvm::TrailingObjects<UsingType, QualType> {
4722 friend TrailingObjects;
4743 ID.AddPointer(Found);
4750 public llvm::FoldingSetNode,
4751 private llvm::TrailingObjects<TypedefType, QualType> {
4754 friend TrailingObjects;
4776 if (!Underlying.
isNull())
4793 :
Type(MacroQualified, CanonTy, UnderlyingTy->getDependence()),
4794 UnderlyingTy(UnderlyingTy), MacroII(MacroII) {
4795 assert(isa<AttributedType>(UnderlyingTy) &&
4796 "Expected a macro qualified type to only wrap attributed types.");
4830 return TypeOfBits.IsUnqual ? TypeOfKind::Unqualified
4831 : TypeOfKind::Qualified;
4838 bool isSugared()
const;
4850 public llvm::FoldingSetNode {
4855 Profile(
ID, Context, getUnderlyingExpr(),
4856 getKind() == TypeOfKind::Unqualified);
4859 static void Profile(llvm::FoldingSetNodeID &
ID,
const ASTContext &Context,
4860 Expr *E,
bool IsUnqual);
4874 T->getDependence()),
4876 TypeOfBits.IsUnqual = Kind == TypeOfKind::Unqualified;
4893 return TypeOfBits.IsUnqual ? TypeOfKind::Unqualified
4894 : TypeOfKind::Qualified;
4918 bool isSugared()
const;
4934 Profile(
ID, Context, getUnderlyingExpr());
4937 static void Profile(llvm::FoldingSetNodeID &
ID,
const ASTContext &Context,
4943 public llvm::FoldingSetNode,
4944 private llvm::TrailingObjects<PackIndexingType, QualType> {
4945 friend TrailingObjects;
4966 if (hasSelectedType())
4967 return getSelectedType();
4972 assert(hasSelectedType() &&
"Type is dependant");
4973 return *(getExpansionsPtr() + *getSelectedIndex());
4976 std::optional<unsigned> getSelectedIndex()
const;
4981 return {getExpansionsPtr(), Size};
4989 if (hasSelectedType())
4990 getSelectedType().Profile(
ID);
4992 Profile(
ID, Context, getPattern(), getIndexExpr());
4994 static void Profile(llvm::FoldingSetNodeID &
ID,
const ASTContext &Context,
4998 const QualType *getExpansionsPtr()
const {
4999 return getTrailingObjects<QualType>();
5002 static TypeDependence computeDependence(QualType Pattern, Expr *IndexExpr,
5003 ArrayRef<QualType> Expansions = {});
5005 unsigned numTrailingObjects(OverloadToken<QualType>)
const {
return Size; }
5012#define TRANSFORM_TYPE_TRAIT_DEF(Enum, _) Enum,
5013#include "clang/Basic/TransformTypeTraits.def"
5021 QualType UnderlyingType;
5052 public llvm::FoldingSetNode {
5058 Profile(
ID, getBaseType(), getUTTKind());
5064 ID.AddInteger((
unsigned)UKind);
5083 bool isBeingDefined()
const;
5103 return reinterpret_cast<RecordDecl*
>(TagType::getDecl());
5108 bool hasConstFields()
const;
5126 return reinterpret_cast<EnumDecl*
>(TagType::getDecl());
5159 :
Type(Attributed, canon, equivalent->getDependence()),
5160 ModifiedType(modified), EquivalentType(equivalent) {
5161 AttributedTypeBits.AttrKind = attrKind;
5166 return static_cast<Kind>(AttributedTypeBits.AttrKind);
5190 bool isQualifier()
const;
5192 bool isMSTypeSpec()
const;
5194 bool isWebAssemblyFuncrefSpec()
const;
5196 bool isCallingConv()
const;
5198 std::optional<NullabilityKind> getImmediateNullability()
const;
5204 case NullabilityKind::NonNull:
5205 return attr::TypeNonNull;
5207 case NullabilityKind::Nullable:
5208 return attr::TypeNullable;
5210 case NullabilityKind::NullableResult:
5211 return attr::TypeNullableResult;
5213 case NullabilityKind::Unspecified:
5214 return attr::TypeNullUnspecified;
5216 llvm_unreachable(
"Unknown nullability kind.");
5228 static std::optional<NullabilityKind> stripOuterNullability(
QualType &T);
5231 Profile(
ID, getAttrKind(), ModifiedType, EquivalentType);
5236 ID.AddInteger(attrKind);
5251 const BTFTypeTagAttr *BTFAttr;
5254 const BTFTypeTagAttr *BTFAttr)
5255 :
Type(BTFTagAttributed, Canon, Wrapped->getDependence()),
5256 WrappedType(Wrapped), BTFAttr(BTFAttr) {}
5260 const BTFTypeTagAttr *
getAttr()
const {
return BTFAttr; }
5266 Profile(
ID, WrappedType, BTFAttr);
5270 const BTFTypeTagAttr *BTFAttr) {
5272 ID.AddPointer(BTFAttr);
5284 struct CanonicalTTPTInfo {
5285 unsigned Depth : 15;
5286 unsigned ParameterPack : 1;
5287 unsigned Index : 16;
5300 :
Type(TemplateTypeParm, Canon,
5306 TemplateTypeParmType(
unsigned D,
unsigned I,
bool PP)
5307 :
Type(TemplateTypeParm, QualType(this, 0),
5308 TypeDependence::DependentInstantiation |
5309 (PP ? TypeDependence::UnexpandedPack : TypeDependence::
None)) {
5310 CanTTPTInfo.Depth = D;
5311 CanTTPTInfo.Index = I;
5312 CanTTPTInfo.ParameterPack = PP;
5315 const CanonicalTTPTInfo& getCanTTPTInfo()
const {
5316 QualType Can = getCanonicalTypeInternal();
5317 return Can->castAs<TemplateTypeParmType>()->CanTTPTInfo;
5321 unsigned getDepth()
const {
return getCanTTPTInfo().Depth; }
5322 unsigned getIndex()
const {
return getCanTTPTInfo().Index; }
5326 return isCanonicalUnqualified() ? nullptr : TTPDecl;
5338 static void Profile(llvm::FoldingSetNodeID &
ID,
unsigned Depth,
5339 unsigned Index,
bool ParameterPack,
5341 ID.AddInteger(Depth);
5342 ID.AddInteger(Index);
5343 ID.AddBoolean(ParameterPack);
5344 ID.AddPointer(TTPDecl);
5361 public llvm::FoldingSetNode,
5362 private llvm::TrailingObjects<SubstTemplateTypeParmType, QualType> {
5366 Decl *AssociatedDecl;
5369 unsigned Index, std::optional<unsigned> PackIndex);
5375 return SubstTemplateTypeParmTypeBits.HasNonCanonicalUnderlyingType
5376 ? *getTrailingObjects<QualType>()
5377 : getCanonicalTypeInternal();
5390 unsigned getIndex()
const {
return SubstTemplateTypeParmTypeBits.Index; }
5393 if (SubstTemplateTypeParmTypeBits.PackIndex == 0)
5394 return std::nullopt;
5395 return SubstTemplateTypeParmTypeBits.PackIndex - 1;
5402 Profile(
ID, getReplacementType(), getAssociatedDecl(), getIndex(),
5407 const Decl *AssociatedDecl,
unsigned Index,
5408 std::optional<unsigned> PackIndex) {
5409 Replacement.Profile(
ID);
5410 ID.AddPointer(AssociatedDecl);
5411 ID.AddInteger(Index);
5412 ID.AddInteger(PackIndex ? *PackIndex - 1 : 0);
5439 llvm::PointerIntPair<Decl *, 1, bool> AssociatedDeclAndFinal;
5442 unsigned Index,
bool Final,
5451 Decl *getAssociatedDecl()
const;
5458 unsigned getIndex()
const {
return SubstTemplateTypeParmPackTypeBits.Index; }
5461 bool getFinal()
const;
5464 return SubstTemplateTypeParmPackTypeBits.NumArgs;
5472 void Profile(llvm::FoldingSetNodeID &
ID);
5473 static void Profile(llvm::FoldingSetNodeID &
ID,
const Decl *AssociatedDecl,
5474 unsigned Index,
bool Final,
5497 ExtraDependence | (DeducedAsType.isNull()
5499 : DeducedAsType->getDependence() &
5501 DeducedAsType(DeducedAsType) {}
5506 return isSugared() ? DeducedAsType :
QualType(
this, 0);
5513 return !DeducedAsType.
isNull() || isDependentType();
5536 AutoTypeBits.NumArgs};
5540 return TypeConstraintConcept;
5544 return TypeConstraintConcept !=
nullptr;
5548 return getKeyword() == AutoTypeKeyword::DecltypeAuto;
5552 return getKeyword() == AutoTypeKeyword::GNUAutoType;
5559 void Profile(llvm::FoldingSetNodeID &
ID,
const ASTContext &Context);
5560 static void Profile(llvm::FoldingSetNodeID &
ID,
const ASTContext &Context,
5572 public llvm::FoldingSetNode {
5580 bool IsDeducedAsDependent)
5581 :
DeducedType(DeducedTemplateSpecialization, DeducedAsType,
5583 (IsDeducedAsDependent
5586 DeducedAsType.isNull() ?
QualType(this, 0)
5587 : DeducedAsType.getCanonicalType()),
5588 Template(Template) {}
5595 Profile(
ID, getTemplateName(), getDeducedType(), isDependentType());
5599 QualType Deduced,
bool IsDependent) {
5608 return T->
getTypeClass() == DeducedTemplateSpecialization;
5667 static bool anyInstantiationDependentTemplateArguments(
5673 return isa<InjectedClassNameType>(getCanonicalTypeInternal());
5691 bool isTypeAlias()
const {
return TemplateSpecializationTypeBits.TypeAlias; }
5702 TemplateSpecializationTypeBits.NumArgs};
5706 return !isDependentType() || isCurrentInstantiation() || isTypeAlias();
5710 return isTypeAlias() ? getAliasedType() : getCanonicalTypeInternal();
5713 void Profile(llvm::FoldingSetNodeID &
ID,
const ASTContext &Ctx);
5725void printTemplateArgumentList(raw_ostream &OS,
5726 ArrayRef<TemplateArgument> Args,
5727 const PrintingPolicy &Policy,
5728 const TemplateParameterList *TPL =
nullptr);
5730void printTemplateArgumentList(raw_ostream &OS,
5731 ArrayRef<TemplateArgumentLoc> Args,
5732 const PrintingPolicy &Policy,
5733 const TemplateParameterList *TPL =
nullptr);
5735void printTemplateArgumentList(raw_ostream &OS,
5736 const TemplateArgumentListInfo &Args,
5737 const PrintingPolicy &Policy,
5738 const TemplateParameterList *TPL =
nullptr);
5742bool isSubstitutedDefaultArgument(ASTContext &Ctx, TemplateArgument Arg,
5743 const NamedDecl *Param,
5744 ArrayRef<TemplateArgument> Args,
5788 Decl(D), InjectedType(TST) {
5789 assert(isa<TemplateSpecializationType>(TST));
5798 return cast<TemplateSpecializationType>(InjectedType.
getTypePtr());
5802 return getInjectedTST()->getTemplateName();
5868 TypeWithKeywordBits.Keyword = llvm::to_underlying(Keyword);
5881 static TagTypeKind getTagTypeKindForTypeSpec(
unsigned TypeSpec);
5896 return getKeywordName(getKeywordForTagTypeKind(Kind));
5913 public llvm::FoldingSetNode,
5914 private llvm::TrailingObjects<ElaboratedType, TagDecl *> {
5916 friend TrailingObjects;
5935 NamedType->getDependence() |
5939 NNS(NNS), NamedType(NamedType) {
5940 ElaboratedTypeBits.HasOwnedTagDecl =
false;
5942 ElaboratedTypeBits.HasOwnedTagDecl =
true;
5943 *getTrailingObjects<TagDecl *>() = OwnedTagDecl;
5963 return ElaboratedTypeBits.HasOwnedTagDecl ? *getTrailingObjects<TagDecl *>()
5968 Profile(
ID, getKeyword(), NNS, NamedType, getOwnedTagDecl());
5974 ID.AddInteger(llvm::to_underlying(Keyword));
5977 ID.AddPointer(OwnedTagDecl);
6009 NNS(NNS), Name(Name) {}
6028 Profile(
ID, getKeyword(), NNS, Name);
6033 ID.AddInteger(llvm::to_underlying(Keyword));
6035 ID.AddPointer(Name);
6047 public llvm::FoldingSetNode {
6068 DependentTemplateSpecializationTypeBits.NumArgs};
6075 Profile(
ID, Context, getKeyword(), NNS, Name, template_arguments());
6078 static void Profile(llvm::FoldingSetNodeID &
ID,
6086 return T->
getTypeClass() == DependentTemplateSpecialization;
6119 std::optional<unsigned> NumExpansions)
6120 :
Type(PackExpansion, Canon,
6125 PackExpansionTypeBits.NumExpansions =
6126 NumExpansions ? *NumExpansions + 1 : 0;
6138 if (PackExpansionTypeBits.NumExpansions)
6139 return PackExpansionTypeBits.NumExpansions - 1;
6140 return std::nullopt;
6147 Profile(
ID, getPattern(), getNumExpansions());
6151 std::optional<unsigned> NumExpansions) {
6153 ID.AddBoolean(NumExpansions.has_value());
6155 ID.AddInteger(*NumExpansions);
6175 return static_cast<T*
>(
this)->getProtocolStorageImpl();
6179 static_cast<T*
>(
this)->setNumProtocolsImpl(N);
6183 setNumProtocols(protocols.size());
6184 assert(getNumProtocols() == protocols.size() &&
6185 "bitfield overflow in protocol count");
6186 if (!protocols.empty())
6187 memcpy(getProtocolStorage(), protocols.data(),
6204 return static_cast<const T*
>(
this)->getNumProtocolsImpl();
6209 assert(I < getNumProtocols() &&
"Out-of-range protocol access");
6210 return qual_begin()[I];
6223 public llvm::FoldingSetNode {
6228 unsigned NumProtocols : 6;
6239 unsigned getNumProtocolsImpl()
const {
6240 return NumProtocols;
6243 void setNumProtocolsImpl(
unsigned N) {
6247 ObjCTypeParamType(
const ObjCTypeParamDecl *D,
6249 ArrayRef<ObjCProtocolDecl *> protocols);
6259 void Profile(llvm::FoldingSetNodeID &
ID);
6260 static void Profile(llvm::FoldingSetNodeID &
ID,
6316 mutable llvm::PointerIntPair<const ObjCObjectType *, 1, bool>
6317 CachedSuperClassType;
6320 const QualType *getTypeArgStorage()
const {
6327 unsigned getNumProtocolsImpl()
const {
6328 return ObjCObjectTypeBits.NumProtocols;
6330 void setNumProtocolsImpl(
unsigned N) {
6331 ObjCObjectTypeBits.NumProtocols = N;
6345 ObjCObjectTypeBits.NumProtocols = 0;
6346 ObjCObjectTypeBits.NumTypeArgs = 0;
6347 ObjCObjectTypeBits.IsKindOf = 0;
6350 void computeSuperClassTypeSlow()
const;
6362 return getBaseType()->isSpecificBuiltinType(BuiltinType::ObjCId);
6366 return getBaseType()->isSpecificBuiltinType(BuiltinType::ObjCClass);
6372 if (!qual_empty())
return false;
6373 if (
const BuiltinType *T = getBaseType()->getAs<BuiltinType>())
6374 return T->getKind() == BuiltinType::ObjCId ||
6375 T->getKind() == BuiltinType::ObjCClass;
6387 bool isSpecialized()
const;
6391 return ObjCObjectTypeBits.NumTypeArgs > 0;
6408 return llvm::ArrayRef(getTypeArgStorage(), ObjCObjectTypeBits.NumTypeArgs);
6415 bool isKindOfType()
const;
6424 if (!CachedSuperClassType.getInt())
6425 computeSuperClassTypeSlow();
6427 assert(CachedSuperClassType.getInt() &&
"Superclass not set?");
6428 return QualType(CachedSuperClassType.getPointer(), 0);
6461 void Profile(llvm::FoldingSetNodeID &
ID);
6462 static void Profile(llvm::FoldingSetNodeID &
ID,
6469inline QualType *ObjCObjectType::getTypeArgStorage() {
6470 return reinterpret_cast<QualType *
>(
static_cast<ObjCObjectTypeImpl*
>(
this)+1);
6473inline ObjCProtocolDecl **ObjCObjectType::getProtocolStorageImpl() {
6474 return reinterpret_cast<ObjCProtocolDecl**
>(
6475 getTypeArgStorage() + ObjCObjectTypeBits.NumTypeArgs);
6478inline ObjCProtocolDecl **ObjCTypeParamType::getProtocolStorageImpl() {
6479 return reinterpret_cast<ObjCProtocolDecl**
>(
6480 static_cast<ObjCTypeParamType*
>(
this)+1);
6533 if (
const auto *T = dyn_cast<ObjCInterfaceType>(ObjT))
6534 return T->getDecl();
6536 baseType = ObjT->getBaseType();
6557 :
Type(ObjCObjectPointer, Canonical, Pointee->getDependence()),
6558 PointeeType(Pointee) {}
6701 QualType getSuperClassType()
const;
6709 Profile(
ID, getPointeeType());
6727 :
Type(
Atomic, Canonical, ValTy->getDependence()), ValueType(ValTy) {}
6738 Profile(
ID, getValueType());
6758 :
Type(
Pipe, CanonicalPtr, elemType->getDependence()),
6769 Profile(
ID, getElementType(), isReadOnly());
6787 LLVM_PREFERRED_TYPE(
bool)
6788 unsigned IsUnsigned : 1;
6789 unsigned NumBits : 24;
6806 static void Profile(llvm::FoldingSetNodeID &
ID,
bool IsUnsigned,
6808 ID.AddBoolean(IsUnsigned);
6809 ID.AddInteger(NumBits);
6817 llvm::PointerIntPair<Expr*, 1, bool> ExprAndUnsigned;
6825 Expr *getNumBitsExpr()
const;
6833 static void Profile(llvm::FoldingSetNodeID &
ID,
const ASTContext &Context,
6834 bool IsUnsigned,
Expr *NumBitsExpr);
6850 addFastQualifiers(
type.getLocalFastQualifiers());
6851 if (!
type.hasLocalNonFastQualifiers())
6852 return type.getTypePtrUnsafe();
6897 Ty->getLocallyUnqualifiedSingleStepDesugaredType().split();
6902inline const Type *QualType::getTypePtr()
const {
6903 return getCommonPtr()->BaseType;
6906inline const Type *QualType::getTypePtrOrNull()
const {
6907 return (isNull() ?
nullptr : getCommonPtr()->BaseType);
6910inline bool QualType::isReferenceable()
const {
6915 if (
Self.isObjectType() ||
Self.isReferenceType())
6918 return F->getMethodQuals().empty() && F->getRefQualifier() ==
RQ_None;
6924 if (!hasLocalNonFastQualifiers())
6926 Qualifiers::fromFastMask(getLocalFastQualifiers()));
6928 const ExtQuals *eq = getExtQualsUnsafe();
6936 if (hasLocalNonFastQualifiers())
6937 Quals = getExtQualsUnsafe()->getQualifiers();
6943 Qualifiers quals = getCommonPtr()->CanonicalType.getLocalQualifiers();
6948inline unsigned QualType::getCVRQualifiers()
const {
6949 unsigned cvr = getCommonPtr()->CanonicalType.getLocalCVRQualifiers();
6950 cvr |= getLocalCVRQualifiers();
6955 QualType canon = getCommonPtr()->CanonicalType;
6959inline bool QualType::isCanonical()
const {
6963inline bool QualType::isCanonicalAsParam()
const {
6964 if (!isCanonical())
return false;
6965 if (hasLocalQualifiers())
return false;
6967 const Type *T = getTypePtr();
6971 return !isa<FunctionType>(T) && !isa<ArrayType>(T);
6974inline bool QualType::isConstQualified()
const {
6975 return isLocalConstQualified() ||
6976 getCommonPtr()->CanonicalType.isLocalConstQualified();
6979inline bool QualType::isRestrictQualified()
const {
6980 return isLocalRestrictQualified() ||
6981 getCommonPtr()->CanonicalType.isLocalRestrictQualified();
6985inline bool QualType::isVolatileQualified()
const {
6986 return isLocalVolatileQualified() ||
6987 getCommonPtr()->CanonicalType.isLocalVolatileQualified();
6990inline bool QualType::hasQualifiers()
const {
6991 return hasLocalQualifiers() ||
6992 getCommonPtr()->CanonicalType.hasLocalQualifiers();
6996 if (!getTypePtr()->getCanonicalTypeInternal().hasLocalQualifiers())
6999 return QualType(getSplitUnqualifiedTypeImpl(*this).Ty, 0);
7003 if (!getTypePtr()->getCanonicalTypeInternal().hasLocalQualifiers())
7006 return getSplitUnqualifiedTypeImpl(*
this);
7009inline void QualType::removeLocalConst() {
7010 removeLocalFastQualifiers(Qualifiers::Const);
7013inline void QualType::removeLocalRestrict() {
7014 removeLocalFastQualifiers(Qualifiers::Restrict);
7017inline void QualType::removeLocalVolatile() {
7018 removeLocalFastQualifiers(Qualifiers::Volatile);
7022inline bool QualType::hasAddressSpace()
const {
7023 return getQualifiers().hasAddressSpace();
7027inline LangAS QualType::getAddressSpace()
const {
7028 return getQualifiers().getAddressSpace();
7033 return getQualifiers().getObjCGCAttr();
7036inline bool QualType::hasNonTrivialToPrimitiveDefaultInitializeCUnion()
const {
7037 if (
auto *RD = getTypePtr()->getBaseElementTypeUnsafe()->
getAsRecordDecl())
7038 return hasNonTrivialToPrimitiveDefaultInitializeCUnion(RD);
7042inline bool QualType::hasNonTrivialToPrimitiveDestructCUnion()
const {
7043 if (
auto *RD = getTypePtr()->getBaseElementTypeUnsafe()->
getAsRecordDecl())
7044 return hasNonTrivialToPrimitiveDestructCUnion(RD);
7048inline bool QualType::hasNonTrivialToPrimitiveCopyCUnion()
const {
7049 if (
auto *RD = getTypePtr()->getBaseElementTypeUnsafe()->
getAsRecordDecl())
7050 return hasNonTrivialToPrimitiveCopyCUnion(RD);
7056 if (
const auto *FT = PT->getPointeeType()->getAs<
FunctionType>())
7057 return FT->getExtInfo();
7059 return FT->getExtInfo();
7073inline bool QualType::isMoreQualifiedThan(
QualType other)
const {
7083inline bool QualType::isAtLeastAsQualifiedAs(
QualType other)
const {
7087 if (getUnqualifiedType()->isVoidType())
7090 return getQualifiers().compatiblyIncludes(OtherQuals);
7109inline bool QualType::isCForbiddenLValueType()
const {
7110 return ((getTypePtr()->isVoidType() && !hasQualifiers()) ||
7111 getTypePtr()->isFunctionType());
7117inline bool Type::isFundamentalType()
const {
7118 return isVoidType() ||
7122 (isArithmeticType() && !isEnumeralType());
7128inline bool Type::isCompoundType()
const {
7132 return isArrayType() ||
7138 isReferenceType() ||
7147 isMemberPointerType();
7150inline bool Type::isFunctionType()
const {
7151 return isa<FunctionType>(CanonicalType);
7154inline bool Type::isPointerType()
const {
7155 return isa<PointerType>(CanonicalType);
7158inline bool Type::isAnyPointerType()
const {
7159 return isPointerType() || isObjCObjectPointerType();
7162inline bool Type::isBlockPointerType()
const {
7163 return isa<BlockPointerType>(CanonicalType);
7166inline bool Type::isReferenceType()
const {
7167 return isa<ReferenceType>(CanonicalType);
7170inline bool Type::isLValueReferenceType()
const {
7171 return isa<LValueReferenceType>(CanonicalType);
7174inline bool Type::isRValueReferenceType()
const {
7175 return isa<RValueReferenceType>(CanonicalType);
7178inline bool Type::isObjectPointerType()
const {
7182 if (
const auto *T = getAs<PointerType>())
7183 return !T->getPointeeType()->isFunctionType();
7188inline bool Type::isFunctionPointerType()
const {
7189 if (
const auto *T = getAs<PointerType>())
7190 return T->getPointeeType()->isFunctionType();
7195inline bool Type::isFunctionReferenceType()
const {
7196 if (
const auto *T = getAs<ReferenceType>())
7197 return T->getPointeeType()->isFunctionType();
7202inline bool Type::isMemberPointerType()
const {
7203 return isa<MemberPointerType>(CanonicalType);
7206inline bool Type::isMemberFunctionPointerType()
const {
7207 if (
const auto *T = getAs<MemberPointerType>())
7208 return T->isMemberFunctionPointer();
7213inline bool Type::isMemberDataPointerType()
const {
7214 if (
const auto *T = getAs<MemberPointerType>())
7215 return T->isMemberDataPointer();
7220inline bool Type::isArrayType()
const {
7221 return isa<ArrayType>(CanonicalType);
7224inline bool Type::isConstantArrayType()
const {
7225 return isa<ConstantArrayType>(CanonicalType);
7228inline bool Type::isIncompleteArrayType()
const {
7229 return isa<IncompleteArrayType>(CanonicalType);
7232inline bool Type::isVariableArrayType()
const {
7233 return isa<VariableArrayType>(CanonicalType);
7236inline bool Type::isDependentSizedArrayType()
const {
7237 return isa<DependentSizedArrayType>(CanonicalType);
7240inline bool Type::isBuiltinType()
const {
7241 return isa<BuiltinType>(CanonicalType);
7244inline bool Type::isRecordType()
const {
7245 return isa<RecordType>(CanonicalType);
7248inline bool Type::isEnumeralType()
const {
7249 return isa<EnumType>(CanonicalType);
7252inline bool Type::isAnyComplexType()
const {
7253 return isa<ComplexType>(CanonicalType);
7256inline bool Type::isVectorType()
const {
7257 return isa<VectorType>(CanonicalType);
7260inline bool Type::isExtVectorType()
const {
7261 return isa<ExtVectorType>(CanonicalType);
7264inline bool Type::isExtVectorBoolType()
const {
7265 if (!isExtVectorType())
7267 return cast<ExtVectorType>(CanonicalType)->getElementType()->isBooleanType();
7270inline bool Type::isMatrixType()
const {
7271 return isa<MatrixType>(CanonicalType);
7274inline bool Type::isConstantMatrixType()
const {
7275 return isa<ConstantMatrixType>(CanonicalType);
7278inline bool Type::isDependentAddressSpaceType()
const {
7279 return isa<DependentAddressSpaceType>(CanonicalType);
7282inline bool Type::isObjCObjectPointerType()
const {
7283 return isa<ObjCObjectPointerType>(CanonicalType);
7286inline bool Type::isObjCObjectType()
const {
7287 return isa<ObjCObjectType>(CanonicalType);
7290inline bool Type::isObjCObjectOrInterfaceType()
const {
7291 return isa<ObjCInterfaceType>(CanonicalType) ||
7292 isa<ObjCObjectType>(CanonicalType);
7295inline bool Type::isAtomicType()
const {
7296 return isa<AtomicType>(CanonicalType);
7299inline bool Type::isUndeducedAutoType()
const {
7300 return isa<AutoType>(CanonicalType);
7303inline bool Type::isObjCQualifiedIdType()
const {
7304 if (
const auto *OPT = getAs<ObjCObjectPointerType>())
7305 return OPT->isObjCQualifiedIdType();
7309inline bool Type::isObjCQualifiedClassType()
const {
7310 if (
const auto *OPT = getAs<ObjCObjectPointerType>())
7311 return OPT->isObjCQualifiedClassType();
7315inline bool Type::isObjCIdType()
const {
7316 if (
const auto *OPT = getAs<ObjCObjectPointerType>())
7317 return OPT->isObjCIdType();
7321inline bool Type::isObjCClassType()
const {
7322 if (
const auto *OPT = getAs<ObjCObjectPointerType>())
7323 return OPT->isObjCClassType();
7327inline bool Type::isObjCSelType()
const {
7328 if (
const auto *OPT = getAs<PointerType>())
7329 return OPT->getPointeeType()->isSpecificBuiltinType(BuiltinType::ObjCSel);
7333inline bool Type::isObjCBuiltinType()
const {
7334 return isObjCIdType() || isObjCClassType() || isObjCSelType();
7337inline bool Type::isDecltypeType()
const {
7338 return isa<DecltypeType>(
this);
7341#define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \
7342 inline bool Type::is##Id##Type() const { \
7343 return isSpecificBuiltinType(BuiltinType::Id); \
7345#include "clang/Basic/OpenCLImageTypes.def"
7347inline bool Type::isSamplerT()
const {
7348 return isSpecificBuiltinType(BuiltinType::OCLSampler);
7351inline bool Type::isEventT()
const {
7352 return isSpecificBuiltinType(BuiltinType::OCLEvent);
7355inline bool Type::isClkEventT()
const {
7356 return isSpecificBuiltinType(BuiltinType::OCLClkEvent);
7359inline bool Type::isQueueT()
const {
7360 return isSpecificBuiltinType(BuiltinType::OCLQueue);
7363inline bool Type::isReserveIDT()
const {
7364 return isSpecificBuiltinType(BuiltinType::OCLReserveID);
7367inline bool Type::isImageType()
const {
7368#define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) is##Id##Type() ||
7370#include "clang/Basic/OpenCLImageTypes.def"
7374inline bool Type::isPipeType()
const {
7375 return isa<PipeType>(CanonicalType);
7378inline bool Type::isBitIntType()
const {
7379 return isa<BitIntType>(CanonicalType);
7382#define EXT_OPAQUE_TYPE(ExtType, Id, Ext) \
7383 inline bool Type::is##Id##Type() const { \
7384 return isSpecificBuiltinType(BuiltinType::Id); \
7386#include "clang/Basic/OpenCLExtensionTypes.def"
7388inline bool Type::isOCLIntelSubgroupAVCType()
const {
7389#define INTEL_SUBGROUP_AVC_TYPE(ExtType, Id) \
7390 isOCLIntelSubgroupAVC##Id##Type() ||
7392#include "clang/Basic/OpenCLExtensionTypes.def"
7396inline bool Type::isOCLExtOpaqueType()
const {
7397#define EXT_OPAQUE_TYPE(ExtType, Id, Ext) is##Id##Type() ||
7399#include "clang/Basic/OpenCLExtensionTypes.def"
7403inline bool Type::isOpenCLSpecificType()
const {
7404 return isSamplerT() || isEventT() || isImageType() || isClkEventT() ||
7405 isQueueT() || isReserveIDT() || isPipeType() || isOCLExtOpaqueType();
7408inline bool Type::isTemplateTypeParmType()
const {
7409 return isa<TemplateTypeParmType>(CanonicalType);
7412inline bool Type::isSpecificBuiltinType(
unsigned K)
const {
7413 if (
const BuiltinType *BT = getAs<BuiltinType>()) {
7419inline bool Type::isPlaceholderType()
const {
7420 if (
const auto *BT = dyn_cast<BuiltinType>(
this))
7421 return BT->isPlaceholderType();
7426 if (
const auto *BT = dyn_cast<BuiltinType>(
this))
7427 if (BT->isPlaceholderType())
7432inline bool Type::isSpecificPlaceholderType(
unsigned K)
const {
7434 return isSpecificBuiltinType(K);
7437inline bool Type::isNonOverloadPlaceholderType()
const {
7438 if (
const auto *BT = dyn_cast<BuiltinType>(
this))
7439 return BT->isNonOverloadPlaceholderType();
7443inline bool Type::isVoidType()
const {
7444 return isSpecificBuiltinType(BuiltinType::Void);
7447inline bool Type::isHalfType()
const {
7449 return isSpecificBuiltinType(BuiltinType::Half);
7452inline bool Type::isFloat16Type()
const {
7453 return isSpecificBuiltinType(BuiltinType::Float16);
7456inline bool Type::isFloat32Type()
const {
7457 return isSpecificBuiltinType(BuiltinType::Float);
7460inline bool Type::isBFloat16Type()
const {
7461 return isSpecificBuiltinType(BuiltinType::BFloat16);
7464inline bool Type::isFloat128Type()
const {
7465 return isSpecificBuiltinType(BuiltinType::Float128);
7468inline bool Type::isIbm128Type()
const {
7469 return isSpecificBuiltinType(BuiltinType::Ibm128);
7472inline bool Type::isNullPtrType()
const {
7473 return isSpecificBuiltinType(BuiltinType::NullPtr);
7479inline bool Type::isIntegerType()
const {
7480 if (
const auto *BT = dyn_cast<BuiltinType>(CanonicalType))
7481 return BT->getKind() >= BuiltinType::Bool &&
7482 BT->getKind() <= BuiltinType::Int128;
7483 if (
const EnumType *ET = dyn_cast<EnumType>(CanonicalType)) {
7489 return isBitIntType();
7492inline bool Type::isFixedPointType()
const {
7493 if (
const auto *BT = dyn_cast<BuiltinType>(CanonicalType)) {
7494 return BT->getKind() >= BuiltinType::ShortAccum &&
7495 BT->getKind() <= BuiltinType::SatULongFract;
7500inline bool Type::isFixedPointOrIntegerType()
const {
7501 return isFixedPointType() || isIntegerType();
7504inline bool Type::isConvertibleToFixedPointType()
const {
7505 return isRealFloatingType() || isFixedPointOrIntegerType();
7508inline bool Type::isSaturatedFixedPointType()
const {
7509 if (
const auto *BT = dyn_cast<BuiltinType>(CanonicalType)) {
7510 return BT->getKind() >= BuiltinType::SatShortAccum &&
7511 BT->getKind() <= BuiltinType::SatULongFract;
7516inline bool Type::isUnsaturatedFixedPointType()
const {
7517 return isFixedPointType() && !isSaturatedFixedPointType();
7520inline bool Type::isSignedFixedPointType()
const {
7521 if (
const auto *BT = dyn_cast<BuiltinType>(CanonicalType)) {
7522 return ((BT->getKind() >= BuiltinType::ShortAccum &&
7523 BT->getKind() <= BuiltinType::LongAccum) ||
7524 (BT->getKind() >= BuiltinType::ShortFract &&
7525 BT->getKind() <= BuiltinType::LongFract) ||
7526 (BT->getKind() >= BuiltinType::SatShortAccum &&
7527 BT->getKind() <= BuiltinType::SatLongAccum) ||
7528 (BT->getKind() >= BuiltinType::SatShortFract &&
7529 BT->getKind() <= BuiltinType::SatLongFract));
7534inline bool Type::isUnsignedFixedPointType()
const {
7535 return isFixedPointType() && !isSignedFixedPointType();
7538inline bool Type::isScalarType()
const {
7539 if (
const auto *BT = dyn_cast<BuiltinType>(CanonicalType))
7540 return BT->getKind() > BuiltinType::Void &&
7541 BT->getKind() <= BuiltinType::NullPtr;
7542 if (
const EnumType *ET = dyn_cast<EnumType>(CanonicalType))
7546 return isa<PointerType>(CanonicalType) ||
7547 isa<BlockPointerType>(CanonicalType) ||
7548 isa<MemberPointerType>(CanonicalType) ||
7549 isa<ComplexType>(CanonicalType) ||
7550 isa<ObjCObjectPointerType>(CanonicalType) ||
7554inline bool Type::isIntegralOrEnumerationType()
const {
7555 if (
const auto *BT = dyn_cast<BuiltinType>(CanonicalType))
7556 return BT->getKind() >= BuiltinType::Bool &&
7557 BT->getKind() <= BuiltinType::Int128;
7561 if (
const auto *ET = dyn_cast<EnumType>(CanonicalType))
7564 return isBitIntType();
7567inline bool Type::isBooleanType()
const {
7568 if (
const auto *BT = dyn_cast<BuiltinType>(CanonicalType))
7569 return BT->getKind() == BuiltinType::Bool;
7573inline bool Type::isUndeducedType()
const {
7574 auto *DT = getContainedDeducedType();
7575 return DT && !DT->isDeduced();
7580inline bool Type::isOverloadableType()
const {
7581 return isDependentType() ||
isRecordType() || isEnumeralType();
7585inline bool Type::isTypedefNameType()
const {
7586 if (getAs<TypedefType>())
7588 if (
auto *TST = getAs<TemplateSpecializationType>())
7589 return TST->isTypeAlias();
7594inline bool Type::canDecayToPointerType()
const {
7595 return isFunctionType() || isArrayType();
7598inline bool Type::hasPointerRepresentation()
const {
7599 return (isPointerType() || isReferenceType() || isBlockPointerType() ||
7600 isObjCObjectPointerType() || isNullPtrType());
7603inline bool Type::hasObjCPointerRepresentation()
const {
7604 return isObjCObjectPointerType();
7607inline const Type *Type::getBaseElementTypeUnsafe()
const {
7614inline const Type *Type::getPointeeOrArrayElementType()
const {
7616 if (
type->isAnyPointerType())
7617 return type->getPointeeType().getTypePtr();
7618 else if (
type->isArrayType())
7619 return type->getBaseElementTypeUnsafe();
7627 DiagnosticsEngine::ArgumentKind::ak_addrspace);
7636 DiagnosticsEngine::ArgumentKind::ak_qual);
7645 DiagnosticsEngine::ak_qualtype);
7651template <
typename T>
7653 std::integral_constant<bool, std::is_same<T, ArrayType>::value ||
7654 std::is_base_of<ArrayType, T>::value>;
7657template <
typename T>
const T *Type::getAs()
const {
7659 "ArrayType cannot be used with getAs!");
7662 if (
const auto *Ty = dyn_cast<T>(
this))
7666 if (!isa<T>(CanonicalType))
7671 return cast<T>(getUnqualifiedDesugaredType());
7674template <
typename T>
const T *Type::getAsAdjusted()
const {
7678 if (
const auto *Ty = dyn_cast<T>(
this))
7682 if (!isa<T>(CanonicalType))
7687 const Type *Ty =
this;
7689 if (
const auto *A = dyn_cast<AttributedType>(Ty))
7690 Ty = A->getModifiedType().getTypePtr();
7691 else if (
const auto *A = dyn_cast<BTFTagAttributedType>(Ty))
7692 Ty = A->getWrappedType().getTypePtr();
7693 else if (
const auto *E = dyn_cast<ElaboratedType>(Ty))
7694 Ty = E->desugar().getTypePtr();
7695 else if (
const auto *
P = dyn_cast<ParenType>(Ty))
7696 Ty =
P->desugar().getTypePtr();
7697 else if (
const auto *A = dyn_cast<AdjustedType>(Ty))
7698 Ty = A->desugar().getTypePtr();
7699 else if (
const auto *M = dyn_cast<MacroQualifiedType>(Ty))
7700 Ty = M->desugar().getTypePtr();
7707 return dyn_cast<T>(Ty);
7712 if (
const auto *arr = dyn_cast<ArrayType>(
this))
7716 if (!isa<ArrayType>(CanonicalType))
7721 return cast<ArrayType>(getUnqualifiedDesugaredType());
7724template <
typename T>
const T *Type::castAs()
const {
7726 "ArrayType cannot be used with castAs!");
7728 if (
const auto *ty = dyn_cast<T>(
this))
return ty;
7729 assert(isa<T>(CanonicalType));
7730 return cast<T>(getUnqualifiedDesugaredType());
7733inline const ArrayType *Type::castAsArrayTypeUnsafe()
const {
7734 assert(isa<ArrayType>(CanonicalType));
7735 if (
const auto *arr = dyn_cast<ArrayType>(
this))
return arr;
7736 return cast<ArrayType>(getUnqualifiedDesugaredType());
7741 :
AdjustedType(Decayed, OriginalType, DecayedPtr, CanonicalPtr) {
7743 QualType Adjusted = getAdjustedType();
7745 assert(isa<PointerType>(Adjusted));
7752 return cast<PointerType>(Decayed)->getPointeeType();
Provides definitions for the various language-specific address spaces.
static bool isUnsigned(SValBuilder &SVB, NonLoc Value)
Defines the clang::attr::Kind enum.
Defines the Diagnostic-related interfaces.
static bool isBooleanType(QualType Ty)
static void dump(llvm::raw_ostream &OS, StringRef FunctionName, ArrayRef< CounterExpression > Expressions, ArrayRef< CounterMappingRegion > Regions)
static Decl::Kind getKind(const Decl *D)
Defines the ExceptionSpecificationType enumeration and various utility functions.
static bool isRead(AccessKinds AK)
static QualType getObjectType(APValue::LValueBase B)
Retrieves the "underlying object type" of the given expression, as used by __builtin_object_size.
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified.
llvm::MachO::Record Record
static StringRef getIdentifier(const Token &Tok)
Implements a partial diagnostic that can be emitted anwyhere in a DiagnosticBuilder stream.
static QualType getUnderlyingType(const SubRegion *R)
static std::string getName(const CallEvent &Call)
static bool hasAttr(const Decl *D, bool IgnoreImplicitAttr)
static RecordDecl * getAsRecordDecl(QualType BaseType)
static bool isRecordType(QualType T)
static bool isParameterPack(Expr *PackExpression)
Defines the clang::SourceLocation class and associated facilities.
Defines various enumerations that describe declaration and type specifiers.
static const TemplateTypeParmDecl * getReplacedParameter(Decl *D, unsigned Index)
Defines the clang::Visibility enumeration and various utility functions.
__DEVICE__ void * memcpy(void *__a, const void *__b, size_t __c)
__device__ __2f16 float __ockl_bool s
__device__ __2f16 float c
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Reads an AST files chain containing the contents of a translation unit.
Writes an AST file containing the contents of a translation unit.
Represents a type which was implicitly adjusted by the semantic engine for arbitrary reasons.
static bool classof(const Type *T)
static void Profile(llvm::FoldingSetNodeID &ID, QualType Orig, QualType New)
AdjustedType(TypeClass TC, QualType OriginalTy, QualType AdjustedTy, QualType CanonicalPtr)
QualType getAdjustedType() const
void Profile(llvm::FoldingSetNodeID &ID)
QualType getOriginalType() const
Represents an array type, per C99 6.7.5.2 - Array Declarators.
ArraySizeModifier getSizeModifier() const
Qualifiers getIndexTypeQualifiers() const
static bool classof(const Type *T)
QualType getElementType() const
unsigned getIndexTypeCVRQualifiers() const
static void Profile(llvm::FoldingSetNodeID &ID, QualType T)
QualType getValueType() const
Gets the type contained by this atomic type, i.e.
void Profile(llvm::FoldingSetNodeID &ID)
static bool classof(const Type *T)
An attributed type is a type to which a type attribute has been applied.
QualType getModifiedType() const
static bool classof(const Type *T)
static Kind getNullabilityAttrKind(NullabilityKind kind)
Retrieve the attribute kind corresponding to the given nullability kind.
static std::optional< NullabilityKind > stripOuterNullability(QualType &T)
Strip off the top-level nullability annotation on the given type, if it's there.
static void Profile(llvm::FoldingSetNodeID &ID, Kind attrKind, QualType modified, QualType equivalent)
QualType getEquivalentType() const
void Profile(llvm::FoldingSetNodeID &ID)
Represents a C++11 auto or C++14 decltype(auto) type, possibly constrained by a type-constraint.
ArrayRef< TemplateArgument > getTypeConstraintArguments() const
static bool classof(const Type *T)
bool isDecltypeAuto() const
ConceptDecl * getTypeConstraintConcept() const
AutoTypeKeyword getKeyword() const
bool isGNUAutoType() const
bool isConstrained() const
static bool classof(const Type *T)
const BTFTypeTagAttr * getAttr() const
QualType getWrappedType() const
void Profile(llvm::FoldingSetNodeID &ID)
static void Profile(llvm::FoldingSetNodeID &ID, QualType Wrapped, const BTFTypeTagAttr *BTFAttr)
A fixed int type of a specified bitwidth.
static bool classof(const Type *T)
static void Profile(llvm::FoldingSetNodeID &ID, bool IsUnsigned, unsigned NumBits)
void Profile(llvm::FoldingSetNodeID &ID) const
unsigned getNumBits() const
void Profile(llvm::FoldingSetNodeID &ID)
QualType getPointeeType() const
static bool classof(const Type *T)
static void Profile(llvm::FoldingSetNodeID &ID, QualType Pointee)
This class is used for builtin types like 'int'.
bool isPlaceholderType() const
Determines whether this type is a placeholder type, i.e.
bool isNonOverloadPlaceholderType() const
Determines whether this type is a placeholder type other than Overload.
bool isFloatingPoint() const
static bool classof(const Type *T)
bool isSignedInteger() const
bool isUnsignedInteger() const
static bool isPlaceholderTypeKind(Kind K)
Determines whether the given kind corresponds to a placeholder type.
const char * getNameAsCString(const PrintingPolicy &Policy) const
Represents a C++ struct/union/class.
Complex values, per C99 6.2.5p11.
QualType getElementType() const
static void Profile(llvm::FoldingSetNodeID &ID, QualType Element)
static bool classof(const Type *T)
void Profile(llvm::FoldingSetNodeID &ID)
Declaration of a C++20 concept.
Represents the canonical version of C arrays with a specified constant size.
const llvm::APInt & getSize() const
const Expr * getSizeExpr() const
static bool classof(const Type *T)
void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Ctx)
Represents a concrete matrix type with constant number of rows and columns.
unsigned getNumColumns() const
Returns the number of columns in the matrix.
static void Profile(llvm::FoldingSetNodeID &ID, QualType ElementType, unsigned NumRows, unsigned NumColumns, TypeClass TypeClass)
void Profile(llvm::FoldingSetNodeID &ID)
static constexpr unsigned getMaxElementsPerDimension()
Returns the maximum number of elements per dimension.
unsigned getNumRows() const
Returns the number of rows in the matrix.
unsigned getNumElementsFlattened() const
Returns the number of elements required to embed the matrix into a vector.
static constexpr bool isDimensionValid(size_t NumElements)
Returns true if NumElements is a valid matrix dimension.
unsigned NumRows
Number of rows and columns.
static bool classof(const Type *T)
Represents a pointer type decayed from an array or function type.
QualType getPointeeType() const
static bool classof(const Type *T)
QualType getDecayedType() const
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
Decl - This represents one declaration (or definition), e.g.
Represents the type decltype(expr) (C++11).
static bool classof(const Type *T)
Expr * getUnderlyingExpr() const
QualType getUnderlyingType() const
Represents a C++17 deduced template specialization type.
TemplateName getTemplateName() const
Retrieve the name of the template that we are deducing.
static bool classof(const Type *T)
void Profile(llvm::FoldingSetNodeID &ID)
static void Profile(llvm::FoldingSetNodeID &ID, TemplateName Template, QualType Deduced, bool IsDependent)
Common base class for placeholders for types that get replaced by placeholder type deduction: C++11 a...
static bool classof(const Type *T)
QualType getDeducedType() const
Get the type deduced for this placeholder type, or null if it has not been deduced.
DeducedType(TypeClass TC, QualType DeducedAsType, TypeDependence ExtraDependence, QualType Canon)
Represents an extended address space qualifier where the input address space value is dependent.
Expr * getAddrSpaceExpr() const
void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Context)
QualType getPointeeType() const
static bool classof(const Type *T)
SourceLocation getAttributeLoc() const
void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Context)
static bool classof(const Type *T)
Internal representation of canonical, dependent decltype(expr) types.
void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Context)
Represents a qualified type name for which the type name is dependent.
NestedNameSpecifier * getQualifier() const
Retrieve the qualification on this type.
static bool classof(const Type *T)
const IdentifierInfo * getIdentifier() const
Retrieve the type named by the typename specifier as an identifier.
void Profile(llvm::FoldingSetNodeID &ID)
static void Profile(llvm::FoldingSetNodeID &ID, ElaboratedTypeKeyword Keyword, NestedNameSpecifier *NNS, const IdentifierInfo *Name)
Represents an array type in C++ whose size is a value-dependent expression.
void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Context)
static bool classof(const Type *T)
SourceRange getBracketsRange() const
Expr * getSizeExpr() const
SourceLocation getLBracketLoc() const
SourceLocation getRBracketLoc() const
Represents an extended vector type where either the type or size is dependent.
Expr * getSizeExpr() const
static bool classof(const Type *T)
SourceLocation getAttributeLoc() const
void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Context)
QualType getElementType() const
Represents a matrix type where the type and the number of rows and columns is dependent on a template...
Expr * getColumnExpr() const
Expr * getRowExpr() const
void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Context)
SourceLocation getAttributeLoc() const
static bool classof(const Type *T)
Represents a template specialization type whose template cannot be resolved, e.g.
const IdentifierInfo * getIdentifier() const
void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Context)
ArrayRef< TemplateArgument > template_arguments() const
NestedNameSpecifier * getQualifier() const
static bool classof(const Type *T)
Internal representation of canonical, dependent typeof(expr) types.
void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Context)
DependentTypeOfExprType(Expr *E, TypeOfKind Kind)
Represents a vector type where either the type or size is dependent.
Expr * getSizeExpr() const
VectorKind getVectorKind() const
SourceLocation getAttributeLoc() const
QualType getElementType() const
void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Context)
static bool classof(const Type *T)
Represents a type that was referred to using an elaborated type keyword, e.g., struct S,...
static bool classof(const Type *T)
TagDecl * getOwnedTagDecl() const
Return the (re)declaration of this type owned by this occurrence of this type, or nullptr if there is...
QualType desugar() const
Remove a single level of sugar.
NestedNameSpecifier * getQualifier() const
Retrieve the qualification on this type.
static void Profile(llvm::FoldingSetNodeID &ID, ElaboratedTypeKeyword Keyword, NestedNameSpecifier *NNS, QualType NamedType, TagDecl *OwnedTagDecl)
bool isSugared() const
Returns whether this type directly provides sugar.
void Profile(llvm::FoldingSetNodeID &ID)
QualType getNamedType() const
Retrieve the type named by the qualified-id.
A helper class that allows the use of isa/cast/dyncast to detect TagType objects of enums.
EnumDecl * getDecl() const
static bool classof(const Type *T)
This represents one expression.
Base class that is common to both the ExtQuals and Type classes, which allows QualType to access the ...
We can encode up to four bits in the low bits of a type pointer, but there are many more type qualifi...
Qualifiers::ObjCLifetime getObjCLifetime() const
static void Profile(llvm::FoldingSetNodeID &ID, const Type *BaseType, Qualifiers Quals)
void Profile(llvm::FoldingSetNodeID &ID) const
ExtQuals(const Type *baseType, QualType canon, Qualifiers quals)
bool hasObjCGCAttr() const
Qualifiers::GC getObjCGCAttr() const
bool hasAddressSpace() const
const Type * getBaseType() const
Qualifiers getQualifiers() const
LangAS getAddressSpace() const
bool hasObjCLifetime() const
ExtVectorType - Extended vector type.
bool isAccessorWithinNumElements(char c, bool isNumericAccessor) const
static int getNumericAccessorIdx(char c)
static bool classof(const Type *T)
static int getPointAccessorIdx(char c)
static int getAccessorIdx(char c, bool isNumericAccessor)
Represents a function declaration or definition.
Represents a K&R-style 'int foo()' function, which has no information available about its arguments.
static void Profile(llvm::FoldingSetNodeID &ID, QualType ResultType, ExtInfo Info)
static bool classof(const Type *T)
void Profile(llvm::FoldingSetNodeID &ID)
Represents a prototype with parameter type info, e.g.
param_type_iterator param_type_begin() const
ExtParameterInfo getExtParameterInfo(unsigned I) const
ExceptionSpecificationType getExceptionSpecType() const
Get the kind of exception specification on this function.
bool isParamConsumed(unsigned I) const
exception_iterator exception_end() const
const ExtParameterInfo * getExtParameterInfosOrNull() const
Return a pointer to the beginning of the array of extra parameter information, if present,...
unsigned getNumParams() const
bool hasTrailingReturn() const
Whether this function prototype has a trailing return type.
ExceptionSpecInfo getExceptionSpecInfo() const
Return all the available information about this type's exception spec.
Qualifiers getMethodQuals() const
static bool classof(const Type *T)
QualType getParamType(unsigned i) const
unsigned getAArch64SMEAttributes() const
Return a bitmask describing the SME attributes on the function type, see AArch64SMETypeAttributes for...
QualType getExceptionType(unsigned i) const
Return the ith exception type, where 0 <= i < getNumExceptions().
static void Profile(llvm::FoldingSetNodeID &ID, QualType Result, param_type_iterator ArgTys, unsigned NumArgs, const ExtProtoInfo &EPI, const ASTContext &Context, bool Canonical)
SourceLocation getEllipsisLoc() const
unsigned getNumExceptions() const
Return the number of types in the exception specification.
bool hasExceptionSpec() const
Return whether this function has any kind of exception spec.
bool hasDynamicExceptionSpec() const
Return whether this function has a dynamic (throw) exception spec.
bool hasNoexceptExceptionSpec() const
Return whether this function has a noexcept exception spec.
bool isVariadic() const
Whether this function prototype is variadic.
ExtProtoInfo getExtProtoInfo() const
Expr * getNoexceptExpr() const
Return the expression inside noexcept(expression), or a null pointer if there is none (because the ex...
param_type_iterator param_type_end() const
FunctionDecl * getExceptionSpecTemplate() const
If this function type has an uninstantiated exception specification, this is the function whose excep...
bool isNothrow(bool ResultIfDependent=false) const
Determine whether this function type has a non-throwing exception specification.
ArrayRef< QualType > getParamTypes() const
ArrayRef< QualType > exceptions() const
ParameterABI getParameterABI(unsigned I) const
ArrayRef< QualType > param_types() const
exception_iterator exception_begin() const
ArrayRef< ExtParameterInfo > getExtParameterInfos() const
bool hasExtParameterInfos() const
Is there any interesting extra information for any of the parameters of this function type?
RefQualifierKind getRefQualifier() const
Retrieve the ref-qualifier associated with this function type.
FunctionDecl * getExceptionSpecDecl() const
If this function type has an exception specification which hasn't been determined yet (either because...
A class which abstracts out some details necessary for making a call.
ExtInfo withNoCfCheck(bool noCfCheck) const
ExtInfo withCallingConv(CallingConv cc) const
CallingConv getCC() const
ExtInfo withProducesResult(bool producesResult) const
ExtInfo(bool noReturn, bool hasRegParm, unsigned regParm, CallingConv cc, bool producesResult, bool noCallerSavedRegs, bool NoCfCheck, bool cmseNSCall)
bool getCmseNSCall() const
bool getNoCfCheck() const
unsigned getRegParm() const
void Profile(llvm::FoldingSetNodeID &ID) const
bool getNoCallerSavedRegs() const
ExtInfo withNoReturn(bool noReturn) const
bool getHasRegParm() const
bool operator==(ExtInfo Other) const
bool getProducesResult() const
ExtInfo withNoCallerSavedRegs(bool noCallerSavedRegs) const
ExtInfo withCmseNSCall(bool cmseNSCall) const
ExtInfo withRegParm(unsigned RegParm) const
bool operator!=(ExtInfo Other) const
Interesting information about a specific parameter that can't simply be reflected in parameter's type...
friend bool operator==(ExtParameterInfo lhs, ExtParameterInfo rhs)
friend bool operator!=(ExtParameterInfo lhs, ExtParameterInfo rhs)
ExtParameterInfo()=default
bool hasPassObjectSize() const
ExtParameterInfo withHasPassObjectSize() const
unsigned char getOpaqueValue() const
bool isConsumed() const
Is this parameter considered "consumed" by Objective-C ARC? Consumed parameters must have retainable ...
ParameterABI getABI() const
Return the ABI treatment of this parameter.
ExtParameterInfo withIsConsumed(bool consumed) const
ExtParameterInfo withIsNoEscape(bool NoEscape) const
ExtParameterInfo withABI(ParameterABI kind) const
static ExtParameterInfo getFromOpaqueValue(unsigned char data)
FunctionType - C99 6.7.5.3 - Function Declarators.
ExtInfo getExtInfo() const
static ArmStateValue getArmZT0State(unsigned AttrBits)
bool getNoReturnAttr() const
Determine whether this function type includes the GNU noreturn attribute.
static ArmStateValue getArmZAState(unsigned AttrBits)
unsigned getRegParmType() const
CallingConv getCallConv() const
QualType getReturnType() const
FunctionType(TypeClass tc, QualType res, QualType Canonical, TypeDependence Dependence, ExtInfo Info)
static bool classof(const Type *T)
bool getCmseNSCallAttr() const
bool getHasRegParm() const
Qualifiers getFastTypeQuals() const
QualType getCallResultType(const ASTContext &Context) const
Determine the type of an expression that calls a function of this type.
AArch64SMETypeAttributes
The AArch64 SME ACLE (Arm C/C++ Language Extensions) define a number of function type attributes that...
One of these records is kept for each identifier that is lexed.
Represents a C array with an unspecified size.
void Profile(llvm::FoldingSetNodeID &ID)
static void Profile(llvm::FoldingSetNodeID &ID, QualType ET, ArraySizeModifier SizeMod, unsigned TypeQuals)
static bool classof(const Type *T)
The injected class name of a C++ class template or class template partial specialization.
static bool classof(const Type *T)
const TemplateSpecializationType * getInjectedTST() const
TemplateName getTemplateName() const
QualType getInjectedSpecializationType() const
An lvalue reference type, per C++11 [dcl.ref].
static bool classof(const Type *T)
Sugar type that represents a type that was qualified by a qualifier written as a macro invocation.
static bool classof(const Type *T)
QualType getUnderlyingType() const
const IdentifierInfo * getMacroIdentifier() const
Represents a matrix type, as defined in the Matrix Types clang extensions.
QualType getElementType() const
Returns type of the elements being stored in the matrix.
MatrixType(QualType ElementTy, QualType CanonElementTy)
static bool isValidElementType(QualType T)
Valid elements types are the following:
QualType ElementType
The element type of the matrix.
static bool classof(const Type *T)
A pointer to member type per C++ 8.3.3 - Pointers to members.
void Profile(llvm::FoldingSetNodeID &ID)
QualType getPointeeType() const
bool isMemberFunctionPointer() const
Returns true if the member type (i.e.
bool isMemberDataPointer() const
Returns true if the member type (i.e.
static void Profile(llvm::FoldingSetNodeID &ID, QualType Pointee, const Type *Class)
static bool classof(const Type *T)
const Type * getClass() const
This represents a decl that may have a name.
Represents a C++ nested name specifier, such as "\::std::vector<int>::".
Represents an ObjC class declaration.
Interfaces are the core concept in Objective-C for object oriented design.
static bool classof(const Type *T)
Represents a pointer to an Objective C object.
unsigned getNumProtocols() const
Return the number of qualifying protocols on the object type.
bool isSpecialized() const
Whether this type is specialized, meaning that it has type arguments.
qual_iterator qual_end() const
bool isObjCQualifiedClassType() const
True if this is equivalent to 'Class.
static void Profile(llvm::FoldingSetNodeID &ID, QualType T)
bool isObjCQualifiedIdType() const
True if this is equivalent to 'id.
bool isSpecializedAsWritten() const
Whether this type is specialized, meaning that it has type arguments.
bool isUnspecializedAsWritten() const
Determine whether this object type is "unspecialized" as written, meaning that it has no type argumen...
ArrayRef< QualType > getTypeArgsAsWritten() const
Retrieve the type arguments for this type.
void Profile(llvm::FoldingSetNodeID &ID)
const ObjCObjectType * getObjectType() const
Gets the type pointed to by this ObjC pointer.
ObjCObjectType::qual_iterator qual_iterator
An iterator over the qualifiers on the object type.
llvm::iterator_range< qual_iterator > qual_range
static bool classof(const Type *T)
bool isUnspecialized() const
Whether this type is unspecialized, meaning that is has no type arguments.
bool isObjCIdType() const
True if this is equivalent to the 'id' type, i.e.
ObjCProtocolDecl * getProtocol(unsigned I) const
Retrieve a qualifying protocol by index on the object type.
QualType getPointeeType() const
Gets the type pointed to by this ObjC pointer.
ObjCInterfaceDecl * getInterfaceDecl() const
If this pointer points to an Objective @interface type, gets the declaration for that interface.
bool isObjCClassType() const
True if this is equivalent to the 'Class' type, i.e.
bool isObjCIdOrClassType() const
True if this is equivalent to the 'id' or 'Class' type,.
ArrayRef< QualType > getTypeArgs() const
Retrieve the type arguments for this type.
qual_iterator qual_begin() const
bool isKindOfType() const
Whether this is a "__kindof" type.
A class providing a concrete implementation of ObjCObjectType, so as to not increase the footprint of...
Represents a class type in Objective C.
bool isKindOfTypeAsWritten() const
Whether this is a "__kindof" type as written.
ArrayRef< QualType > getTypeArgsAsWritten() const
Retrieve the type arguments of this object type as they were written.
bool isUnspecializedAsWritten() const
Determine whether this object type is "unspecialized" as written, meaning that it has no type argumen...
bool isObjCQualifiedClass() const
ObjCObjectType(enum Nonce_ObjCInterface)
bool isObjCUnqualifiedIdOrClass() const
QualType getBaseType() const
Gets the base type of this object type.
bool isObjCQualifiedId() const
bool isSpecializedAsWritten() const
Determine whether this object type was written with type arguments.
bool isObjCUnqualifiedId() const
bool isUnspecialized() const
Determine whether this object type is "unspecialized", meaning that it has no type arguments.
bool isObjCUnqualifiedClass() const
static bool classof(const Type *T)
QualType getSuperClassType() const
Retrieve the type of the superclass of this object type.
Represents an Objective-C protocol declaration.
This class wraps the list of protocol qualifiers.
llvm::iterator_range< qual_iterator > qual_range
void initialize(ArrayRef< ObjCProtocolDecl * > protocols)
ObjCProtocolDecl ** getProtocolStorage()
ArrayRef< ObjCProtocolDecl * > getProtocols() const
Retrieve all of the protocol qualifiers.
unsigned getNumProtocols() const
Return the number of qualifying protocols in this type, or 0 if there are none.
void setNumProtocols(unsigned N)
qual_iterator qual_end() const
ObjCProtocolDecl *const * getProtocolStorage() const
ObjCProtocolDecl * getProtocol(unsigned I) const
Fetch a protocol by index.
qual_iterator qual_begin() const
ObjCProtocolQualifiers()=default
ObjCProtocolDecl *const * qual_iterator
Represents the declaration of an Objective-C type parameter.
Represents a type parameter type in Objective C.
static bool classof(const Type *T)
ObjCTypeParamDecl * getDecl() const
Represents a pack expansion of types.
void Profile(llvm::FoldingSetNodeID &ID)
static bool classof(const Type *T)
static void Profile(llvm::FoldingSetNodeID &ID, QualType Pattern, std::optional< unsigned > NumExpansions)
QualType getPattern() const
Retrieve the pattern of this pack expansion, which is the type that will be repeatedly instantiated w...
std::optional< unsigned > getNumExpansions() const
Retrieve the number of expansions that this pack expansion will generate, if known.
bool hasSelectedType() const
QualType getPattern() const
void Profile(llvm::FoldingSetNodeID &ID)
QualType getSelectedType() const
ArrayRef< QualType > getExpansions() const
Expr * getIndexExpr() const
static bool classof(const Type *T)
Sugar for parentheses used when specifying types.
void Profile(llvm::FoldingSetNodeID &ID)
static bool classof(const Type *T)
static void Profile(llvm::FoldingSetNodeID &ID, QualType Inner)
QualType getInnerType() const
static void Profile(llvm::FoldingSetNodeID &ID, QualType T, bool isRead)
QualType getElementType() const
void Profile(llvm::FoldingSetNodeID &ID)
static bool classof(const Type *T)
PointerType - C99 6.7.5.1 - Pointer Declarators.
QualType getPointeeType() const
static bool classof(const Type *T)
void Profile(llvm::FoldingSetNodeID &ID)
static void Profile(llvm::FoldingSetNodeID &ID, QualType Pointee)
StreamedQualTypeHelper(const QualType &T, const PrintingPolicy &Policy, const Twine &PlaceHolder, unsigned Indentation)
friend raw_ostream & operator<<(raw_ostream &OS, const StreamedQualTypeHelper &SQT)
A (possibly-)qualified type.
void addRestrict()
Add the restrict qualifier to this QualType.
QualType(const ExtQuals *Ptr, unsigned Quals)
bool isLocalConstQualified() const
Determine whether this particular QualType instance has the "const" qualifier set,...
bool isLocalRestrictQualified() const
Determine whether this particular QualType instance has the "restrict" qualifier set,...
bool isVolatileQualified() const
Determine whether this type is volatile-qualified.
bool isRestrictQualified() const
Determine whether this type is restrict-qualified.
bool isTriviallyCopyableType(const ASTContext &Context) const
Return true if this is a trivially copyable type (C++0x [basic.types]p9)
QualType IgnoreParens() const
Returns the specified type after dropping any outer-level parentheses.
Qualifiers::GC getObjCGCAttr() const
Returns gc attribute of this type.
friend bool operator==(const QualType &LHS, const QualType &RHS)
Indicate whether the specified types and qualifiers are identical.
bool hasQualifiers() const
Determine whether this type has any qualifiers.
QualType withFastQualifiers(unsigned TQs) const
QualType withRestrict() 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...
void addFastQualifiers(unsigned TQs)
bool isWebAssemblyFuncrefType() const
Returns true if it is a WebAssembly Funcref Type.
QualType getNonLValueExprType(const ASTContext &Context) const
Determine the type of a (typically non-lvalue) expression with the specified result type.
@ DK_objc_strong_lifetime
PrimitiveDefaultInitializeKind
@ PDIK_ARCWeak
The type is an Objective-C retainable pointer type that is qualified with the ARC __weak qualifier.
@ PDIK_Trivial
The type does not fall into any of the following categories.
@ PDIK_ARCStrong
The type is an Objective-C retainable pointer type that is qualified with the ARC __strong qualifier.
@ PDIK_Struct
The type is a struct containing a field whose type is not PCK_Trivial.
bool mayBeDynamicClass() const
Returns true if it is a class and it might be dynamic.
bool hasLocalNonFastQualifiers() const
Determine whether this particular QualType instance has any "non-fast" qualifiers,...
bool isNonWeakInMRRWithObjCWeak(const ASTContext &Context) const
const IdentifierInfo * getBaseTypeIdentifier() const
Retrieves a pointer to the name of the base type.
QualType withoutLocalFastQualifiers() const
void Profile(llvm::FoldingSetNodeID &ID) const
QualType getDesugaredType(const ASTContext &Context) const
Return the specified type with any "sugar" removed from the type.
void removeLocalFastQualifiers(unsigned Mask)
QualType withConst() const
QualType getLocalUnqualifiedType() const
Return this type with all of the instance-specific qualifiers removed, but without removing any quali...
void addConst()
Add the const type qualifier to this QualType.
bool isAtLeastAsQualifiedAs(QualType Other) const
Determine whether this type is at least as qualified as the other given type, requiring exact equalit...
bool hasLocalQualifiers() const
Determine whether this particular QualType instance has any qualifiers, without looking through any t...
bool isTriviallyCopyConstructibleType(const ASTContext &Context) const
Return true if this is a trivially copyable type.
bool isTrivialType(const ASTContext &Context) const
Return true if this is a trivial type per (C++0x [basic.types]p9)
bool isNull() const
Return true if this QualType doesn't point to a type yet.
PrimitiveCopyKind isNonTrivialToPrimitiveCopy() const
Check if this is a non-trivial type that would cause a C struct transitively containing this type to ...
bool isTriviallyRelocatableType(const ASTContext &Context) const
Return true if this is a trivially relocatable type.
const Type * getTypePtr() const
Retrieves a pointer to the underlying (unqualified) type.
LangAS getAddressSpace() const
Return the address space of this type.
bool isConstant(const ASTContext &Ctx) const
static QualType getFromOpaquePtr(const void *Ptr)
QualType withVolatile() const
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...
Qualifiers getQualifiers() const
Retrieve the set of qualifiers applied to this type.
const Type * operator->() const
void setLocalFastQualifiers(unsigned Quals)
bool isAddressSpaceOverlapping(QualType T) const
Returns true if address space qualifiers overlap with T address space qualifiers.
bool isCXX98PODType(const ASTContext &Context) const
Return true if this is a POD type according to the rules of the C++98 standard, regardless of the cur...
Qualifiers::ObjCLifetime getObjCLifetime() const
Returns lifetime attribute of this type.
QualType stripObjCKindOfType(const ASTContext &ctx) const
Strip Objective-C "__kindof" types from the given type.
void print(raw_ostream &OS, const PrintingPolicy &Policy, const Twine &PlaceHolder=Twine(), unsigned Indentation=0) const
void getAsStringInternal(std::string &Str, const PrintingPolicy &Policy) const
bool isReferenceable() const
QualType getNonReferenceType() const
If Type is a reference type (e.g., const int&), returns the type that the reference refers to ("const...
QualType getCanonicalType() const
QualType getUnqualifiedType() const
Retrieve the unqualified variant of the given type, removing as little sugar as possible.
bool isTriviallyEqualityComparableType(const ASTContext &Context) const
Return true if this is a trivially equality comparable type.
void removeLocalVolatile()
QualType substObjCMemberType(QualType objectType, const DeclContext *dc, ObjCSubstitutionContext context) const
Substitute type arguments from an object type for the Objective-C type parameters used in the subject...
bool isWebAssemblyReferenceType() const
Returns true if it is a WebAssembly Reference Type.
SplitQualType getSplitDesugaredType() const
std::optional< NonConstantStorageReason > isNonConstantStorage(const ASTContext &Ctx, bool ExcludeCtor, bool ExcludeDtor)
Determine whether instances of this type can be placed in immutable storage.
QualType withCVRQualifiers(unsigned CVR) const
unsigned getLocalCVRQualifiers() const
Retrieve the set of CVR (const-volatile-restrict) qualifiers local to this particular QualType instan...
SplitQualType split() const
Divides a QualType into its unqualified type and a set of local qualifiers.
bool UseExcessPrecision(const ASTContext &Ctx)
void addVolatile()
Add the volatile type qualifier to this QualType.
bool isCForbiddenLValueType() const
Determine whether expressions of the given type are forbidden from being lvalues in C.
PrimitiveDefaultInitializeKind isNonTrivialToPrimitiveDefaultInitialize() const
Functions to query basic properties of non-trivial C struct types.
bool isObjCGCStrong() const
true when Type is objc's strong.
std::string getAsString() const
void * getAsOpaquePtr() const
static void print(SplitQualType split, raw_ostream &OS, const PrintingPolicy &policy, const Twine &PlaceHolder, unsigned Indentation=0)
bool isCanonicalAsParam() const
void removeLocalRestrict()
bool isWebAssemblyExternrefType() const
Returns true if it is a WebAssembly Externref Type.
QualType(const Type *Ptr, unsigned Quals)
QualType getNonPackExpansionType() const
Remove an outer pack expansion type (if any) from this type.
bool isMoreQualifiedThan(QualType Other) const
Determine whether this type is more qualified than the other given type, requiring exact equality for...
SplitQualType getSplitUnqualifiedType() const
Retrieve the unqualified variant of the given type, removing as little sugar as possible.
bool isCXX11PODType(const ASTContext &Context) const
Return true if this is a POD type according to the more relaxed rules of the C++11 standard,...
bool mayBeNotDynamicClass() const
Returns true if it is not a class or if the class might not be dynamic.
bool isConstQualified() const
Determine whether this type is const-qualified.
bool hasAddressSpace() const
Check if this type has any address space qualifier.
bool isObjCGCWeak() const
true when Type is objc's weak.
QualType substObjCTypeArgs(ASTContext &ctx, ArrayRef< QualType > typeArgs, ObjCSubstitutionContext context) const
Substitute type arguments for the Objective-C type parameters used in the subject type.
unsigned getLocalFastQualifiers() const
void removeLocalFastQualifiers()
QualType getAtomicUnqualifiedType() const
Remove all qualifiers including _Atomic.
DestructionKind isDestructedType() const
Returns a nonzero value if objects of this type require non-trivial work to clean up after.
friend bool operator<(const QualType &LHS, const QualType &RHS)
friend bool operator!=(const QualType &LHS, const QualType &RHS)
StreamedQualTypeHelper stream(const PrintingPolicy &Policy, const Twine &PlaceHolder=Twine(), unsigned Indentation=0) const
bool isLocalVolatileQualified() const
Determine whether this particular QualType instance has the "volatile" qualifier set,...
bool isConstantStorage(const ASTContext &Ctx, bool ExcludeCtor, bool ExcludeDtor)
unsigned getCVRQualifiers() const
Retrieve the set of CVR (const-volatile-restrict) qualifiers applied to this type.
static void getAsStringInternal(SplitQualType split, std::string &out, const PrintingPolicy &policy)
QualType getSingleStepDesugaredType(const ASTContext &Context) const
Return the specified type with one level of "sugar" removed from the type.
const Type * getTypePtrOrNull() const
static std::string getAsString(SplitQualType split, const PrintingPolicy &Policy)
bool hasNonTrivialObjCLifetime() const
bool isPODType(const ASTContext &Context) const
Determine whether this is a Plain Old Data (POD) type (C++ 3.9p10).
bool hasStrongOrWeakObjCLifetime() const
PrimitiveCopyKind isNonTrivialToPrimitiveDestructiveMove() const
Check if this is a non-trivial type that would cause a C struct transitively containing this type to ...
QualType withExactLocalFastQualifiers(unsigned TQs) const
@ NonConstNonReferenceType
@ PCK_Struct
The type is a struct containing a field whose type is neither PCK_Trivial nor PCK_VolatileTrivial.
@ PCK_Trivial
The type does not fall into any of the following categories.
@ PCK_ARCStrong
The type is an Objective-C retainable pointer type that is qualified with the ARC __strong qualifier.
@ PCK_VolatileTrivial
The type would be trivial except that it is volatile-qualified.
@ PCK_ARCWeak
The type is an Objective-C retainable pointer type that is qualified with the ARC __weak qualifier.
const Type & operator*() const
Qualifiers getLocalQualifiers() const
Retrieve the set of qualifiers local to this particular QualType instance, not including any qualifie...
bool hasNonTrivialToPrimitiveDefaultInitializeCUnion() const
Check if this is or contains a C union that is non-trivial to default-initialize, which is a union th...
A qualifier set is used to build a set of qualifiers.
const Type * strip(QualType type)
Collect any qualifiers on the given type and return an unqualified type.
QualifierCollector(Qualifiers Qs=Qualifiers())
QualifiersAndAtomic & operator+=(Qualifiers RHS)
QualifiersAndAtomic withVolatile()
QualifiersAndAtomic withAtomic()
QualifiersAndAtomic withConst()
QualifiersAndAtomic(Qualifiers Quals, bool HasAtomic)
QualifiersAndAtomic withRestrict()
The collection of all-type qualifiers we support.
unsigned getCVRQualifiers() const
@ FastWidth
The width of the "fast" qualifier mask.
@ MaxAddressSpace
The maximum supported address space number.
@ FastMask
The fast qualifier mask.
void removeCVRQualifiers(unsigned mask)
friend Qualifiers operator-(Qualifiers L, Qualifiers R)
Compute the difference between two qualifier sets.
static Qualifiers fromFastMask(unsigned Mask)
void setFastQualifiers(unsigned mask)
void addAddressSpace(LangAS space)
static Qualifiers removeCommonQualifiers(Qualifiers &L, Qualifiers &R)
Returns the common set of qualifiers while removing them from the given sets.
bool hasOnlyConst() const
@ OCL_Strong
Assigning into this object requires the old value to be released and the new value to be retained.
@ OCL_ExplicitNone
This object can be modified without requiring retains or releases.
@ OCL_None
There is no lifetime qualification on this type.
@ OCL_Weak
Reading or writing from this object requires a barrier call.
@ OCL_Autoreleasing
Assigning into this object requires a lifetime extension.
void removeObjCLifetime()
bool hasTargetSpecificAddressSpace() const
bool isStrictSupersetOf(Qualifiers Other) const
Determine whether this set of qualifiers is a strict superset of another set of qualifiers,...
bool hasNonFastQualifiers() const
Return true if the set contains any qualifiers which require an ExtQuals node to be allocated.
void Profile(llvm::FoldingSetNodeID &ID) const
bool isAddressSpaceSupersetOf(Qualifiers other) const
Returns true if the address space in these qualifiers is equal to or a superset of the address space ...
bool operator!=(Qualifiers Other) const
bool hasNonTrivialObjCLifetime() const
True if the lifetime is neither None or ExplicitNone.
void addCVRQualifiers(unsigned mask)
bool hasCVRQualifiers() const
void addConsistentQualifiers(Qualifiers qs)
Add the qualifiers from the given set to this set, given that they don't conflict.
void removeFastQualifiers(unsigned mask)
Qualifiers & operator+=(Qualifiers R)
void removeFastQualifiers()
bool hasQualifiers() const
Return true if the set contains any qualifiers.
void removeCVRQualifiers()
Qualifiers withVolatile() const
void addCVRUQualifiers(unsigned mask)
Qualifiers & operator-=(Qualifiers R)
bool hasUnaligned() const
unsigned getAddressSpaceAttributePrintValue() const
Get the address space attribute value to be printed by diagnostics.
bool hasAddressSpace() const
Qualifiers withoutAddressSpace() const
unsigned getFastQualifiers() const
void print(raw_ostream &OS, const PrintingPolicy &Policy, bool appendSpaceIfNonEmpty=false) const
void removeAddressSpace()
void addQualifiers(Qualifiers Q)
Add the qualifiers from the given set to this set.
static Qualifiers fromCVRMask(unsigned CVR)
void setAddressSpace(LangAS space)
unsigned getAsOpaqueValue() const
static bool isAddressSpaceSupersetOf(LangAS A, LangAS B)
Returns true if address space A is equal to or a superset of B.
unsigned getCVRUQualifiers() const
bool isEmptyWhenPrinted(const PrintingPolicy &Policy) const
void setObjCGCAttr(GC type)
Qualifiers withConst() const
bool hasObjCGCAttr() const
void setCVRQualifiers(unsigned mask)
bool hasObjCLifetime() const
ObjCLifetime getObjCLifetime() const
Qualifiers withoutObjCLifetime() const
Qualifiers withoutObjCGCAttr() const
static Qualifiers fromCVRUMask(unsigned CVRU)
friend Qualifiers operator+(Qualifiers L, Qualifiers R)
void setUnaligned(bool flag)
void addFastQualifiers(unsigned mask)
std::string getAsString() const
Qualifiers withRestrict() const
void addObjCGCAttr(GC type)
bool operator==(Qualifiers Other) const
bool compatiblyIncludes(Qualifiers other) const
Determines if these qualifiers compatibly include another set.
void removeQualifiers(Qualifiers Q)
Remove the qualifiers from the given set from this set.
LangAS getAddressSpace() const
bool hasOnlyVolatile() const
static Qualifiers fromOpaqueValue(unsigned opaque)
bool compatiblyIncludesObjCLifetime(Qualifiers other) const
Determines if these qualifiers compatibly include another set of qualifiers from the narrow perspecti...
Qualifiers getNonFastQualifiers() const
bool hasStrongOrWeakObjCLifetime() const
True if the lifetime is either strong or weak.
static std::string getAddrSpaceAsString(LangAS AS)
bool hasFastQualifiers() const
bool hasOnlyRestrict() const
void addObjCLifetime(ObjCLifetime type)
void setObjCLifetime(ObjCLifetime type)
An rvalue reference type, per C++11 [dcl.ref].
static bool classof(const Type *T)
Represents a struct/union/class.
A helper class that allows the use of isa/cast/dyncast to detect TagType objects of structs/unions/cl...
RecordType(const RecordDecl *D)
RecordDecl * getDecl() const
RecordType(TypeClass TC, RecordDecl *D)
static bool classof(const Type *T)
Base for LValueReferenceType and RValueReferenceType.
QualType getPointeeType() const
ReferenceType(TypeClass tc, QualType Referencee, QualType CanonicalRef, bool SpelledAsLValue)
static bool classof(const Type *T)
QualType getPointeeTypeAsWritten() const
bool isSpelledAsLValue() const
void Profile(llvm::FoldingSetNodeID &ID)
static void Profile(llvm::FoldingSetNodeID &ID, QualType Referencee, bool SpelledAsLValue)
Encodes a location in the source.
A trivial tuple used to represent a source range.
SourceLocation getEnd() const
SourceLocation getBegin() const
Stmt - This represents one statement.
The streaming interface shared between DiagnosticBuilder and PartialDiagnostic.
void AddTaggedVal(uint64_t V, DiagnosticsEngine::ArgumentKind Kind) const
Represents the result of substituting a set of types for a template type parameter pack.
unsigned getIndex() const
Returns the index of the replaced parameter in the associated declaration.
static bool classof(const Type *T)
unsigned getNumArgs() const
Represents the result of substituting a type for a template type parameter.
void Profile(llvm::FoldingSetNodeID &ID)
static bool classof(const Type *T)
Decl * getAssociatedDecl() const
A template-like entity which owns the whole pattern being substituted.
std::optional< unsigned > getPackIndex() const
QualType getReplacementType() const
Gets the type that was substituted for the template parameter.
unsigned getIndex() const
Returns the index of the replaced parameter in the associated declaration.
static void Profile(llvm::FoldingSetNodeID &ID, QualType Replacement, const Decl *AssociatedDecl, unsigned Index, std::optional< unsigned > PackIndex)
Represents the declaration of a struct/union/class/enum.
static bool classof(const Type *T)
A convenient class for passing around template argument information.
Represents a template argument.
Represents a C++ template name within the type system.
void Profile(llvm::FoldingSetNodeID &ID)
bool isDependent() const
Determines whether this is a dependent template name.
Represents a type template specialization; the template must be a class template, a type alias templa...
ArrayRef< TemplateArgument > template_arguments() const
static bool classof(const Type *T)
TemplateName getTemplateName() const
Retrieve the name of the template that we are specializing.
bool isTypeAlias() const
Determine if this template specialization type is for a type alias template that has been substituted...
bool isCurrentInstantiation() const
True if this template specialization type matches a current instantiation in the context in which it ...
Declaration of a template type parameter.
TemplateTypeParmDecl * getDecl() const
bool isParameterPack() const
void Profile(llvm::FoldingSetNodeID &ID)
unsigned getIndex() const
static bool classof(const Type *T)
static void Profile(llvm::FoldingSetNodeID &ID, unsigned Depth, unsigned Index, bool ParameterPack, TemplateTypeParmDecl *TTPDecl)
CanonicalTTPTInfo CanTTPTInfo
TemplateTypeParmDecl * TTPDecl
unsigned getDepth() const
Base wrapper for a particular "section" of type source info.
Represents a typeof (or typeof) expression (a C23 feature and GCC extension) or a typeof_unqual expre...
static bool classof(const Type *T)
TypeOfKind getKind() const
Returns the kind of 'typeof' type this is.
Expr * getUnderlyingExpr() const
Represents typeof(type), a C23 feature and GCC extension, or `typeof_unqual(type),...
static bool classof(const Type *T)
TypeOfKind getKind() const
Returns the kind of 'typeof' type this is.
bool isSugared() const
Returns whether this type directly provides sugar.
QualType desugar() const
Remove a single level of sugar.
QualType getUnmodifiedType() const
A container of type source information.
QualType getType() const
Return the type wrapped by this type source info.
void overrideType(QualType T)
Override the type stored in this TypeSourceInfo. Use with caution!
A helper class for Type nodes having an ElaboratedTypeKeyword.
TypeWithKeyword(ElaboratedTypeKeyword Keyword, TypeClass tc, QualType Canonical, TypeDependence Dependence)
static CannotCastToThisType classof(const Type *)
static StringRef getTagTypeKindName(TagTypeKind Kind)
ElaboratedTypeKeyword getKeyword() const
FunctionTypeBitfields store various bits belonging to FunctionProtoType.
The base class of the type hierarchy.
bool isIncompleteOrObjectType() const
Return true if this is an incomplete or object type, in other words, not a function type.
TypedefBitfields TypedefBits
bool isBooleanType() const
Type(const Type &)=delete
ReferenceTypeBitfields ReferenceTypeBits
ElaboratedTypeBitfields ElaboratedTypeBits
ArrayTypeBitfields ArrayTypeBits
VectorTypeBitfields VectorTypeBits
TypeWithKeywordBitfields TypeWithKeywordBits
TypeOfBitfields TypeOfBits
const T * castAs() const
Member-template castAs<specific type>.
BuiltinTypeBitfields BuiltinTypeBits
bool isReferenceType() const
bool isEnumeralType() const
bool isVisibilityExplicit() const
Return true if the visibility was explicitly set is the code.
void addDependence(TypeDependence D)
ConstantArrayTypeBitfields ConstantArrayTypeBits
Type(TypeClass tc, QualType canon, TypeDependence Dependence)
QualType getPointeeType() const
If this is a pointer, ObjC object pointer, or block pointer, this returns the respective pointee.
Type & operator=(const Type &)=delete
AutoType * getContainedAutoType() const
Get the AutoType whose type will be deduced for a variable with an initializer of this type.
bool isInstantiationDependentType() const
Determine whether this type is an instantiation-dependent type, meaning that the type involves a temp...
bool isDependentType() const
Whether this type is a dependent type, meaning that its definition somehow depends on a template para...
DependentTemplateSpecializationTypeBitfields DependentTemplateSpecializationTypeBits
bool containsUnexpandedParameterPack() const
Whether this type is or contains an unexpanded parameter pack, used to support C++0x variadic templat...
QualType getCanonicalTypeInternal() const
bool containsErrors() const
Whether this type is an error type.
AttributedTypeBitfields AttributedTypeBits
bool isFunctionProtoType() const
PackExpansionTypeBitfields PackExpansionTypeBits
bool isVariablyModifiedType() const
Whether this type is a variably-modified type (C99 6.7.5).
bool isFromAST() const
Whether this type comes from an AST file.
bool isObjectType() const
Determine whether this type is an object type.
FunctionTypeBitfields FunctionTypeBits
void setDependence(TypeDependence D)
SubstTemplateTypeParmTypeBitfields SubstTemplateTypeParmTypeBits
TypeDependence getDependence() const
Visibility getVisibility() const
Determine the visibility of this type.
bool isObjCInertUnsafeUnretainedType() const
Was this type written with the special inert-in-ARC __unsafe_unretained qualifier?
ObjCObjectTypeBitfields ObjCObjectTypeBits
bool hasSizedVLAType() const
Whether this type involves a variable-length array type with a definite size.
TypeClass getTypeClass() const
bool isCanonicalUnqualified() const
Determines if this type would be canonical if it had no further qualification.
const T * getAs() const
Member-template getAs<specific type>'.
SubstTemplateTypeParmPackTypeBitfields SubstTemplateTypeParmPackTypeBits
TemplateSpecializationTypeBitfields TemplateSpecializationTypeBits
bool isFunctionNoProtoType() const
AutoTypeBitfields AutoTypeBits
Type & operator=(Type &&)=delete
Base class for declarations which introduce a typedef-name.
TypedefNameDecl * getDecl() const
void Profile(llvm::FoldingSetNodeID &ID)
static bool classof(const Type *T)
bool typeMatchesDecl() const
static void Profile(llvm::FoldingSetNodeID &ID, const TypedefNameDecl *Decl, QualType Underlying)
Represents the dependent type named by a dependently-scoped typename using declaration,...
void Profile(llvm::FoldingSetNodeID &ID)
static void Profile(llvm::FoldingSetNodeID &ID, UnresolvedUsingTypenameDecl *D)
UnresolvedUsingTypenameDecl * getDecl() const
static bool classof(const Type *T)
Represents a dependent using declaration which was marked with typename.
Represents a shadow declaration implicitly introduced into a scope by a (resolved) using-declaration ...
void Profile(llvm::FoldingSetNodeID &ID)
static void Profile(llvm::FoldingSetNodeID &ID, const UsingShadowDecl *Found, QualType Underlying)
static bool classof(const Type *T)
UsingShadowDecl * getFoundDecl() const
bool typeMatchesDecl() const
Represents a C array with a specified size that is not an integer-constant-expression.
SourceRange getBracketsRange() const
SourceLocation getLBracketLoc() const
static bool classof(const Type *T)
void Profile(llvm::FoldingSetNodeID &ID)
Expr * getSizeExpr() const
SourceLocation getRBracketLoc() const
Represents a GCC generic vector type.
unsigned getNumElements() const
void Profile(llvm::FoldingSetNodeID &ID)
static void Profile(llvm::FoldingSetNodeID &ID, QualType ElementType, unsigned NumElements, TypeClass TypeClass, VectorKind VecKind)
VectorKind getVectorKind() const
QualType ElementType
The element type of the vector.
QualType getElementType() const
static bool classof(const Type *T)
Defines the Linkage enumeration and various utility functions.
const internal::VariadicAllOfMatcher< Type > type
Matches Types in the clang AST.
const AstTypeMatcher< ArrayType > arrayType
Matches all kinds of arrays.
const internal::VariadicAllOfMatcher< Decl > decl
Matches declarations.
The JSON file list parser is used to communicate input to InstallAPI.
@ Self
'self' clause, allowed on Compute and Combined Constructs, plus 'update'.
TypeDependenceScope::TypeDependence TypeDependence
AutoTypeKeyword
Which keyword(s) were used to create an AutoType.
@ GNUAutoType
__auto_type (GNU extension)
@ DecltypeAuto
decltype(auto)
bool isTargetAddressSpace(LangAS AS)
CanThrowResult
Possible results from evaluation of a noexcept expression.
FunctionType::ExtInfo getFunctionExtInfo(const Type &t)
bool isDynamicExceptionSpec(ExceptionSpecificationType ESpecType)
NullabilityKind
Describes the nullability of a particular type.
RefQualifierKind
The kind of C++11 ref-qualifier associated with a function type.
@ RQ_None
No ref-qualifier was provided.
@ RQ_LValue
An lvalue ref-qualifier was provided (&).
@ RQ_RValue
An rvalue ref-qualifier was provided (&&).
bool IsEnumDeclComplete(EnumDecl *ED)
Check if the given decl is complete.
TypeOfKind
The kind of 'typeof' expression we're after.
CanQual< Type > CanQualType
Represents a canonical, potentially-qualified type.
TypeDependence toTypeDependence(ExprDependence D)
const StreamingDiagnostic & operator<<(const StreamingDiagnostic &DB, const ASTContext::SectionInfo &Section)
Insertion operator for diagnostics.
unsigned toTargetAddressSpace(LangAS AS)
Linkage
Describes the different kinds of linkage (C++ [basic.link], C99 6.2.2) that an entity may have.
ObjCSubstitutionContext
The kind of type we are substituting Objective-C type arguments into.
@ Superclass
The superclass of a type.
@ Property
The type of a property.
@ Parameter
The parameter type of a method or function.
@ Result
The result type of a method or function.
ArraySizeModifier
Capture whether this is a normal array (e.g.
ParameterABI
Kinds of parameter ABI.
bool isComputedNoexcept(ExceptionSpecificationType ESpecType)
bool isNoexceptExceptionSpec(ExceptionSpecificationType ESpecType)
TagTypeKind
The kind of a tag type.
bool IsEnumDeclScoped(EnumDecl *ED)
Check if the given decl is scoped.
LangAS
Defines the address space values used by the address space qualifier of QualType.
void FixedPointValueToString(SmallVectorImpl< char > &Str, llvm::APSInt Val, unsigned Scale)
std::integral_constant< bool, std::is_same< T, ArrayType >::value||std::is_base_of< ArrayType, T >::value > TypeIsArrayType
bool isPtrSizeAddressSpace(LangAS AS)
CallingConv
CallingConv - Specifies the calling convention that a function uses.
@ AltiVecBool
is AltiVec 'vector bool ...'
@ SveFixedLengthData
is AArch64 SVE fixed-length data vector
@ AltiVecVector
is AltiVec vector
@ AltiVecPixel
is AltiVec 'vector Pixel'
@ Generic
not a target-specific vector type
@ RVVFixedLengthData
is RISC-V RVV fixed-length data vector
@ RVVFixedLengthMask
is RISC-V RVV fixed-length mask vector
@ NeonPoly
is ARM Neon polynomial vector
@ SveFixedLengthPredicate
is AArch64 SVE fixed-length predicate vector
ElaboratedTypeKeyword
The elaboration keyword that precedes a qualified type name or introduces an elaborated-type-specifie...
@ Interface
The "__interface" keyword introduces the elaborated-type-specifier.
@ Class
The "class" keyword introduces the elaborated-type-specifier.
@ Typename
The "typename" keyword precedes the qualified type name, e.g., typename T::type.
TypeDependence toSyntacticDependence(TypeDependence D)
@ Other
Other implicit parameter.
ExceptionSpecificationType
The various types of exception specifications that exist in C++11.
@ EST_DependentNoexcept
noexcept(expression), value-dependent
@ EST_Uninstantiated
not instantiated yet
@ EST_Unparsed
not parsed yet
@ EST_NoThrow
Microsoft __declspec(nothrow) extension.
@ EST_None
no exception specification
@ EST_MSAny
Microsoft throw(...) extension.
@ EST_BasicNoexcept
noexcept
@ EST_NoexceptFalse
noexcept(expression), evals to 'false'
@ EST_Unevaluated
not evaluated yet, for special member function
@ EST_NoexceptTrue
noexcept(expression), evals to 'true'
@ EST_Dynamic
throw(T1, T2)
Visibility
Describes the different kinds of visibility that a declaration may have.
YAML serialization mapping.
__UINTPTR_TYPE__ uintptr_t
An unsigned integer type with the property that any valid pointer to void can be converted to this ty...
Holds information about the various types of exception specification.
ExceptionSpecInfo(ExceptionSpecificationType EST)
ExceptionSpecificationType Type
The kind of exception specification this is.
ArrayRef< QualType > Exceptions
Explicitly-specified list of exception types.
ExceptionSpecInfo()=default
Extra information about a function prototype.
ExceptionSpecInfo ExceptionSpec
bool requiresFunctionProtoTypeArmAttributes() const
unsigned AArch64SMEAttributes
SourceLocation EllipsisLoc
const ExtParameterInfo * ExtParameterInfos
RefQualifierKind RefQualifier
ExtProtoInfo(CallingConv CC)
unsigned HasTrailingReturn
bool requiresFunctionProtoTypeExtraBitfields() const
void setArmSMEAttribute(AArch64SMETypeAttributes Kind, bool Enable=true)
ExtProtoInfo withExceptionSpec(const ExceptionSpecInfo &ESI)
FunctionType::ExtInfo ExtInfo
A simple holder for a QualType representing a type in an exception specification.
A holder for Arm type attributes as described in the Arm C/C++ Language extensions which are not part...
FunctionTypeArmAttributes()
unsigned AArch64SMEAttributes
Any AArch64 SME ACLE type attributes that need to be propagated on declarations and function pointers...
Describes how types, statements, expressions, and declarations should be printed.
A std::pair-like structure for storing a qualified type split into its local qualifiers and its local...
SplitQualType(const Type *ty, Qualifiers qs)
SplitQualType getSingleStepDesugaredType() const
friend bool operator==(SplitQualType a, SplitQualType b)
const Type * Ty
The locally-unqualified type.
friend bool operator!=(SplitQualType a, SplitQualType b)
std::pair< const Type *, Qualifiers > asPair() const
Qualifiers Quals
The local qualifiers.
static inline ::clang::ExtQuals * getFromVoidPointer(void *P)
static void * getAsVoidPointer(::clang::ExtQuals *P)
static void * getAsVoidPointer(::clang::Type *P)
static inline ::clang::Type * getFromVoidPointer(void *P)
static void * getAsVoidPointer(clang::QualType P)
static clang::QualType getFromVoidPointer(void *P)
static SimpleType getSimplifiedValue(::clang::QualType Val)