17#ifndef LLVM_CLANG_AST_TYPE_H
18#define LLVM_CLANG_AST_TYPE_H
35#include "llvm/ADT/APInt.h"
36#include "llvm/ADT/APSInt.h"
37#include "llvm/ADT/ArrayRef.h"
38#include "llvm/ADT/FoldingSet.h"
39#include "llvm/ADT/PointerIntPair.h"
40#include "llvm/ADT/PointerUnion.h"
41#include "llvm/ADT/STLForwardCompat.h"
42#include "llvm/ADT/StringRef.h"
43#include "llvm/ADT/Twine.h"
44#include "llvm/ADT/iterator_range.h"
45#include "llvm/Support/Casting.h"
46#include "llvm/Support/Compiler.h"
47#include "llvm/Support/DXILABI.h"
48#include "llvm/Support/ErrorHandling.h"
49#include "llvm/Support/PointerLikeTypeTraits.h"
50#include "llvm/Support/TrailingObjects.h"
51#include "llvm/Support/type_traits.h"
70class TemplateParameterList;
79namespace serialization {
80 template <
class T>
class AbstractTypeReader;
117template <
typename>
class CanQual;
122class ExtQualsTypeCommonBase;
124class FunctionEffectsRef;
125class FunctionEffectKindSet;
126class FunctionEffectSet;
129class ObjCInterfaceDecl;
130class ObjCProtocolDecl;
131class ObjCTypeParamDecl;
132struct PrintingPolicy;
136class TemplateArgument;
137class TemplateArgumentListInfo;
138class TemplateArgumentLoc;
139class TemplateTypeParmDecl;
140class TypedefNameDecl;
141class UnresolvedUsingTypenameDecl;
142class UsingShadowDecl;
147#define TYPE(Class, Base) class Class##Type;
148#include "clang/AST/TypeNodes.inc"
155 EnabledMask = 1 << EnabledShift,
156 AddressDiscriminatedShift = EnabledShift + EnabledBits,
157 AddressDiscriminatedBits = 1,
158 AddressDiscriminatedMask = 1 << AddressDiscriminatedShift,
159 AuthenticationModeShift =
160 AddressDiscriminatedShift + AddressDiscriminatedBits,
161 AuthenticationModeBits = 2,
162 AuthenticationModeMask = ((1 << AuthenticationModeBits) - 1)
163 << AuthenticationModeShift,
164 IsaPointerShift = AuthenticationModeShift + AuthenticationModeBits,
166 IsaPointerMask = ((1 << IsaPointerBits) - 1) << IsaPointerShift,
167 AuthenticatesNullValuesShift = IsaPointerShift + IsaPointerBits,
168 AuthenticatesNullValuesBits = 1,
169 AuthenticatesNullValuesMask = ((1 << AuthenticatesNullValuesBits) - 1)
170 << AuthenticatesNullValuesShift,
171 KeyShift = AuthenticatesNullValuesShift + AuthenticatesNullValuesBits,
173 KeyMask = ((1 << KeyBits) - 1) << KeyShift,
174 DiscriminatorShift = KeyShift + KeyBits,
175 DiscriminatorBits = 16,
176 DiscriminatorMask = ((1u << DiscriminatorBits) - 1) << DiscriminatorShift,
187 static_assert((EnabledBits + AddressDiscriminatedBits +
188 AuthenticationModeBits + IsaPointerBits +
189 AuthenticatesNullValuesBits + KeyBits + DiscriminatorBits) ==
191 "PointerAuthQualifier should be exactly 32 bits");
192 static_assert((EnabledMask + AddressDiscriminatedMask +
193 AuthenticationModeMask + IsaPointerMask +
194 AuthenticatesNullValuesMask + KeyMask + DiscriminatorMask) ==
196 "All masks should cover the entire bits");
197 static_assert((EnabledMask ^ AddressDiscriminatedMask ^
198 AuthenticationModeMask ^ IsaPointerMask ^
199 AuthenticatesNullValuesMask ^ KeyMask ^ DiscriminatorMask) ==
201 "All masks should cover the entire bits");
204 unsigned ExtraDiscriminator,
206 bool IsIsaPointer,
bool AuthenticatesNullValues)
208 (IsAddressDiscriminated
209 ? llvm::to_underlying(AddressDiscriminatedMask)
212 (llvm::to_underlying(AuthenticationMode)
213 << AuthenticationModeShift) |
214 (ExtraDiscriminator << DiscriminatorShift) |
215 (IsIsaPointer << IsaPointerShift) |
216 (AuthenticatesNullValues << AuthenticatesNullValuesShift)) {
219 assert((
Data == 0) ==
238 Create(
unsigned Key,
bool IsAddressDiscriminated,
unsigned ExtraDiscriminator,
240 bool AuthenticatesNullValues) {
245 AuthenticationMode, IsIsaPointer,
246 AuthenticatesNullValues);
250 assert((
Data == 0) ==
259 return (
Data & KeyMask) >> KeyShift;
266 return (
Data & AddressDiscriminatedMask) >> AddressDiscriminatedShift;
271 return (
Data >> DiscriminatorShift);
276 AuthenticationModeShift);
281 return (
Data & IsaPointerMask) >> IsaPointerShift;
286 return (
Data & AuthenticatesNullValuesMask) >> AuthenticatesNullValuesShift;
294 return Lhs.Data == Rhs.Data;
297 return Lhs.Data != Rhs.Data;
310 assert((
Result.Data == 0) ==
391 Q.Mask = L.Mask & R.Mask;
485 assert(!(mask & ~
CVRMask) &&
"bitmask contains non-CVR bits");
486 Mask = (Mask & ~CVRMask) | mask;
489 assert(!(mask & ~
CVRMask) &&
"bitmask contains non-CVR bits");
490 Mask &= ~static_cast<uint64_t>(mask);
496 assert(!(mask & ~
CVRMask) &&
"bitmask contains non-CVR bits");
500 assert(!(mask & ~
CVRMask & ~UMask) &&
"bitmask contains non-CVRU bits");
506 Mask = (Mask & ~UMask) | (flag ? UMask : 0);
514 Mask = (Mask & ~GCAttrMask) | (
type << GCAttrShift);
539 return ObjCLifetime((Mask & LifetimeMask) >> LifetimeShift);
542 Mask = (Mask & ~LifetimeMask) | (
type << LifetimeShift);
548 Mask |= (
type << LifetimeShift);
565 return static_cast<LangAS>(Mask >> AddressSpaceShift);
586 Mask = (Mask & ~AddressSpaceMask)
587 | (((uint32_t) space) << AddressSpaceShift);
600 Mask = (Mask & ~PtrAuthMask) |
614 assert(!(mask & ~
FastMask) &&
"bitmask contains non-fast qualifier bits");
615 Mask = (Mask & ~FastMask) | mask;
618 assert(!(mask & ~
FastMask) &&
"bitmask contains non-fast qualifier bits");
619 Mask &= ~static_cast<uint64_t>(mask);
625 assert(!(mask & ~
FastMask) &&
"bitmask contains non-fast qualifier bits");
640 bool empty()
const {
return !Mask; }
795 bool appendSpaceIfNonEmpty =
false)
const;
797 void Profile(llvm::FoldingSetNodeID &
ID)
const {
ID.AddInteger(Mask); }
804 "PointerAuthQualifier must be 32 bits");
806 static constexpr uint64_t UMask = 0x8;
807 static constexpr uint64_t UShift = 3;
808 static constexpr uint64_t GCAttrMask = 0x30;
809 static constexpr uint64_t GCAttrShift = 4;
810 static constexpr uint64_t LifetimeMask = 0x1C0;
811 static constexpr uint64_t LifetimeShift = 6;
812 static constexpr uint64_t AddressSpaceMask =
813 ~(
CVRMask | UMask | GCAttrMask | LifetimeMask);
814 static constexpr uint64_t AddressSpaceShift = 9;
815 static constexpr uint64_t PtrAuthShift = 32;
816 static constexpr uint64_t PtrAuthMask = uint64_t(0xffffffff) << PtrAuthShift;
826 : Quals(Quals), HasAtomic(HasAtomic) {}
875 std::pair<const Type *,Qualifiers>
asPair()
const {
876 return std::pair<const Type *, Qualifiers>(
Ty,
Quals);
880 return a.
Ty ==
b.Ty && a.
Quals ==
b.Quals;
883 return a.
Ty !=
b.Ty || a.
Quals !=
b.Quals;
933 llvm::PointerIntPair<llvm::PointerUnion<const Type *, const ExtQuals *>,
936 const ExtQuals *getExtQualsUnsafe()
const {
937 return cast<const ExtQuals *>(
Value.getPointer());
940 const Type *getTypePtrUnsafe()
const {
941 return cast<const Type *>(
Value.getPointer());
944 const ExtQualsTypeCommonBase *getCommonPtr()
const {
945 assert(!
isNull() &&
"Cannot retrieve a NULL type pointer");
946 auto CommonPtrVal =
reinterpret_cast<uintptr_t>(
Value.getOpaqueValue());
948 return reinterpret_cast<ExtQualsTypeCommonBase*
>(CommonPtrVal);
980 T.Value.setFromOpaqueValue(
const_cast<void*
>(Ptr));
997 return Value.getPointer().isNull();
1024 std::optional<NonConstantStorageReason>
1067 return isa<const ExtQuals *>(
Value.getPointer());
1180 &&
"non-fast qualifier bits set in mask!");
1198 T.addFastQualifiers(TQs);
1211 T.removeLocalFastQualifiers();
1305 return getSingleStepDesugaredTypeImpl(*
this, Context);
1311 if (isa<ParenType>(*
this))
1318 return LHS.Value == RHS.Value;
1321 return LHS.Value != RHS.Value;
1324 return LHS.Value < RHS.Value;
1338 const Twine &PlaceHolder = Twine(),
1339 unsigned Indentation = 0)
const;
1343 unsigned Indentation = 0) {
1349 const Twine &PlaceHolder,
1350 unsigned Indentation = 0);
1367 const Twine &PlaceHolder;
1368 unsigned Indentation;
1372 const Twine &PlaceHolder,
unsigned Indentation)
1373 :
T(
T), Policy(Policy), PlaceHolder(PlaceHolder),
1374 Indentation(Indentation) {}
1378 SQT.T.
print(OS, SQT.Policy, SQT.PlaceHolder, SQT.Indentation);
1384 const Twine &PlaceHolder = Twine(),
1385 unsigned Indentation = 0)
const {
1389 void dump(
const char *
s)
const;
1391 void dump(llvm::raw_ostream &OS,
const ASTContext &Context)
const;
1532 return isDestructedTypeImpl(*
this);
1634raw_ostream &
operator<<(raw_ostream &OS, QualType QT);
1654 return P.getAsOpaquePtr();
1662 static constexpr int NumLowBitsAvailable = 0;
1683 const Type *
const BaseType;
1689 : BaseType(baseType), CanonicalType(canon) {}
1703 public llvm::FoldingSetNode {
1726 canon.isNull() ?
QualType(this_(), 0) : canon),
1728 assert(Quals.hasNonFastQualifiers()
1729 &&
"ExtQuals created with no fast qualifiers");
1730 assert(!Quals.hasFastQualifiers()
1731 &&
"ExtQuals created with fast qualifiers");
1741 return Quals.getObjCLifetime();
1751 Profile(
ID, getBaseType(), Quals);
1755 const Type *BaseType,
1758 ID.AddPointer(BaseType);
1798enum class ArraySizeModifier;
1799enum class ElaboratedTypeKeyword;
1800enum class VectorKind;
1831#define TYPE(Class, Base) Class,
1832#define LAST_TYPE(Class) TypeLast = Class
1833#define ABSTRACT_TYPE(Class, Base)
1834#include "clang/AST/TypeNodes.inc"
1839 class TypeBitfields {
1841 template <
class T>
friend class TypePropertyCache;
1844 LLVM_PREFERRED_TYPE(TypeClass)
1849 unsigned Dependence : llvm::BitWidth<TypeDependence>;
1853 LLVM_PREFERRED_TYPE(
bool)
1854 mutable unsigned CacheValid : 1;
1858 mutable unsigned CachedLinkage : 3;
1861 LLVM_PREFERRED_TYPE(
bool)
1862 mutable unsigned CachedLocalOrUnnamed : 1;
1865 LLVM_PREFERRED_TYPE(
bool)
1866 mutable unsigned FromAST : 1;
1868 bool isCacheValid()
const {
1873 assert(isCacheValid() &&
"getting linkage from invalid cache");
1874 return static_cast<Linkage>(CachedLinkage);
1877 bool hasLocalOrUnnamedType()
const {
1878 assert(isCacheValid() &&
"getting linkage from invalid cache");
1879 return CachedLocalOrUnnamed;
1882 enum { NumTypeBits = 8 + llvm::BitWidth<TypeDependence> + 6 };
1891 LLVM_PREFERRED_TYPE(TypeBitfields)
1897 unsigned IndexTypeQuals : 3;
1902 unsigned SizeModifier : 3;
1904 enum { NumArrayTypeBits = NumTypeBits + 6 };
1913 LLVM_PREFERRED_TYPE(
bool)
1914 unsigned HasExternalSize : 1;
1916 LLVM_PREFERRED_TYPE(
unsigned)
1917 unsigned SizeWidth : 5;
1923 LLVM_PREFERRED_TYPE(TypeBitfields)
1927 static constexpr unsigned NumOfBuiltinTypeBits = 9;
1928 unsigned Kind : NumOfBuiltinTypeBits;
1932 static constexpr int FunctionTypeNumParamsWidth = 16;
1933 static constexpr int FunctionTypeNumParamsLimit = (1 << 16) - 1;
1943 LLVM_PREFERRED_TYPE(TypeBitfields)
1949 unsigned ExtInfo : 13;
1955 unsigned RefQualifier : 2;
1964 unsigned FastTypeQuals : Qualifiers::FastWidth;
1966 LLVM_PREFERRED_TYPE(
bool)
1967 unsigned HasExtQuals : 1;
1973 unsigned NumParams : FunctionTypeNumParamsWidth;
1977 unsigned ExceptionSpecType : 4;
1980 LLVM_PREFERRED_TYPE(
bool)
1981 unsigned HasExtParameterInfos : 1;
1984 LLVM_PREFERRED_TYPE(
bool)
1985 unsigned HasExtraBitfields : 1;
1988 LLVM_PREFERRED_TYPE(
bool)
1989 unsigned Variadic : 1;
1992 LLVM_PREFERRED_TYPE(
bool)
1993 unsigned HasTrailingReturn : 1;
1999 LLVM_PREFERRED_TYPE(TypeBitfields)
2003 unsigned NumTypeArgs : 7;
2006 unsigned NumProtocols : 6;
2009 LLVM_PREFERRED_TYPE(
bool)
2010 unsigned IsKindOf : 1;
2016 LLVM_PREFERRED_TYPE(TypeBitfields)
2030 LLVM_PREFERRED_TYPE(
bool)
2031 unsigned SpelledAsLValue : 1;
2035 LLVM_PREFERRED_TYPE(
bool)
2036 unsigned InnerRef : 1;
2042 LLVM_PREFERRED_TYPE(TypeBitfields)
2047 unsigned Keyword : 8;
2050 enum { NumTypeWithKeywordBits = NumTypeBits + 8 };
2059 LLVM_PREFERRED_TYPE(
bool)
2060 unsigned HasOwnedTagDecl : 1;
2067 LLVM_PREFERRED_TYPE(TypeBitfields)
2073 unsigned VecKind : 4;
2075 uint32_t NumElements;
2081 LLVM_PREFERRED_TYPE(TypeBitfields)
2085 unsigned AttrKind : 32 - NumTypeBits;
2091 LLVM_PREFERRED_TYPE(TypeBitfields)
2097 unsigned Keyword : 2;
2113 LLVM_PREFERRED_TYPE(TypeBitfields)
2122 LLVM_PREFERRED_TYPE(TypeBitfields)
2126 LLVM_PREFERRED_TYPE(
bool)
2127 unsigned hasTypeDifferentFromDecl : 1;
2133 LLVM_PREFERRED_TYPE(TypeBitfields)
2137 LLVM_PREFERRED_TYPE(
bool)
2138 unsigned hasTypeDifferentFromDecl : 1;
2144 LLVM_PREFERRED_TYPE(TypeBitfields)
2148 unsigned Depth : 15;
2151 LLVM_PREFERRED_TYPE(
bool)
2152 unsigned ParameterPack : 1;
2155 unsigned Index : 16;
2161 LLVM_PREFERRED_TYPE(TypeBitfields)
2164 LLVM_PREFERRED_TYPE(
bool)
2165 unsigned HasNonCanonicalUnderlyingType : 1;
2168 unsigned SubstitutionFlag : 1;
2171 unsigned Index : 15;
2178 unsigned PackIndex : 16;
2184 LLVM_PREFERRED_TYPE(TypeBitfields)
2188 unsigned Index : 16;
2194 unsigned NumArgs : 16;
2200 LLVM_PREFERRED_TYPE(TypeBitfields)
2204 LLVM_PREFERRED_TYPE(
bool)
2205 unsigned TypeAlias : 1;
2236 LLVM_PREFERRED_TYPE(TypeBitfields)
2250 unsigned NumExpansions;
2256 LLVM_PREFERRED_TYPE(TypeBitfields)
2259 static constexpr unsigned NumCoupledDeclsBits = 4;
2260 unsigned NumCoupledDecls : NumCoupledDeclsBits;
2261 LLVM_PREFERRED_TYPE(
bool)
2262 unsigned CountInBytes : 1;
2263 LLVM_PREFERRED_TYPE(
bool)
2264 unsigned OrNull : 1;
2298 void setFromAST(
bool V =
true)
const {
2299 TypeBits.FromAST =
V;
2307 canon.isNull() ?
QualType(this_(), 0) : canon) {
2308 static_assert(
sizeof(*this) <=
2310 "changing bitfields changed sizeof(Type)!");
2311 static_assert(
alignof(
decltype(*this)) %
TypeAlignment == 0,
2312 "Insufficient alignment!");
2314 TypeBits.Dependence =
static_cast<unsigned>(
Dependence);
2315 TypeBits.CacheValid =
false;
2316 TypeBits.CachedLocalOrUnnamed =
false;
2317 TypeBits.CachedLinkage = llvm::to_underlying(Linkage::Invalid);
2318 TypeBits.FromAST =
false;
2325 TypeBits.Dependence =
static_cast<unsigned>(
D);
2362 return getDependence() & TypeDependence::UnexpandedPack;
2368 return CanonicalType ==
QualType(
this, 0);
2374 QualType getLocallyUnqualifiedSingleStepDesugaredType()
const;
2382 bool isSizelessType()
const;
2383 bool isSizelessBuiltinType()
const;
2386 bool isSizelessVectorType()
const;
2389 bool isSVESizelessBuiltinType()
const;
2392 bool isRVVSizelessBuiltinType()
const;
2395 bool isWebAssemblyExternrefType()
const;
2400 bool isWebAssemblyTableType()
const;
2405 bool isSveVLSBuiltinType()
const;
2415 bool isRVVVLSBuiltinType()
const;
2437 bool isIncompleteType(
NamedDecl **Def =
nullptr)
const;
2442 return !isFunctionType();
2450 return !isReferenceType() && !isFunctionType() && !isVoidType();
2455 bool isLiteralType(
const ASTContext &Ctx)
const;
2458 bool isStructuralType()
const;
2462 bool isStandardLayoutType()
const;
2468 bool isBuiltinType()
const;
2471 bool isSpecificBuiltinType(
unsigned K)
const;
2476 bool isPlaceholderType()
const;
2480 bool isSpecificPlaceholderType(
unsigned K)
const;
2484 bool isNonOverloadPlaceholderType()
const;
2488 bool isIntegerType()
const;
2489 bool isEnumeralType()
const;
2492 bool isScopedEnumeralType()
const;
2494 bool isCharType()
const;
2495 bool isWideCharType()
const;
2496 bool isChar8Type()
const;
2497 bool isChar16Type()
const;
2498 bool isChar32Type()
const;
2499 bool isAnyCharacterType()
const;
2500 bool isIntegralType(
const ASTContext &Ctx)
const;
2503 bool isIntegralOrEnumerationType()
const;
2506 bool isIntegralOrUnscopedEnumerationType()
const;
2507 bool isUnscopedEnumerationType()
const;
2510 bool isRealFloatingType()
const;
2513 bool isComplexType()
const;
2514 bool isAnyComplexType()
const;
2515 bool isFloatingType()
const;
2516 bool isHalfType()
const;
2517 bool isFloat16Type()
const;
2518 bool isFloat32Type()
const;
2519 bool isDoubleType()
const;
2520 bool isBFloat16Type()
const;
2521 bool isMFloat8Type()
const;
2522 bool isFloat128Type()
const;
2523 bool isIbm128Type()
const;
2524 bool isRealType()
const;
2525 bool isArithmeticType()
const;
2526 bool isVoidType()
const;
2527 bool isScalarType()
const;
2528 bool isAggregateType()
const;
2529 bool isFundamentalType()
const;
2530 bool isCompoundType()
const;
2534 bool isFunctionType()
const;
2537 bool isPointerType()
const;
2538 bool isPointerOrReferenceType()
const;
2539 bool isSignableType()
const;
2540 bool isAnyPointerType()
const;
2541 bool isCountAttributedType()
const;
2542 bool isBlockPointerType()
const;
2543 bool isVoidPointerType()
const;
2544 bool isReferenceType()
const;
2545 bool isLValueReferenceType()
const;
2546 bool isRValueReferenceType()
const;
2547 bool isObjectPointerType()
const;
2548 bool isFunctionPointerType()
const;
2549 bool isFunctionReferenceType()
const;
2550 bool isMemberPointerType()
const;
2551 bool isMemberFunctionPointerType()
const;
2552 bool isMemberDataPointerType()
const;
2553 bool isArrayType()
const;
2554 bool isConstantArrayType()
const;
2555 bool isIncompleteArrayType()
const;
2556 bool isVariableArrayType()
const;
2557 bool isArrayParameterType()
const;
2558 bool isDependentSizedArrayType()
const;
2560 bool isClassType()
const;
2561 bool isStructureType()
const;
2562 bool isStructureTypeWithFlexibleArrayMember()
const;
2563 bool isObjCBoxableRecordType()
const;
2564 bool isInterfaceType()
const;
2565 bool isStructureOrClassType()
const;
2566 bool isUnionType()
const;
2567 bool isComplexIntegerType()
const;
2568 bool isVectorType()
const;
2569 bool isExtVectorType()
const;
2570 bool isExtVectorBoolType()
const;
2571 bool isSubscriptableVectorType()
const;
2572 bool isMatrixType()
const;
2573 bool isConstantMatrixType()
const;
2574 bool isDependentAddressSpaceType()
const;
2575 bool isObjCObjectPointerType()
const;
2576 bool isObjCRetainableType()
const;
2577 bool isObjCLifetimeType()
const;
2578 bool isObjCIndirectLifetimeType()
const;
2579 bool isObjCNSObjectType()
const;
2580 bool isObjCIndependentClassType()
const;
2583 bool isObjCObjectType()
const;
2584 bool isObjCQualifiedInterfaceType()
const;
2585 bool isObjCQualifiedIdType()
const;
2586 bool isObjCQualifiedClassType()
const;
2587 bool isObjCObjectOrInterfaceType()
const;
2588 bool isObjCIdType()
const;
2589 bool isDecltypeType()
const;
2597 return hasAttr(attr::ObjCInertUnsafeUnretained);
2607 bool isObjCIdOrObjectKindOfType(
const ASTContext &ctx,
2610 bool isObjCClassType()
const;
2618 bool isObjCClassOrClassKindOfType()
const;
2620 bool isBlockCompatibleObjCPointerType(
ASTContext &ctx)
const;
2621 bool isObjCSelType()
const;
2622 bool isObjCBuiltinType()
const;
2623 bool isObjCARCBridgableType()
const;
2624 bool isCARCBridgableType()
const;
2625 bool isTemplateTypeParmType()
const;
2626 bool isNullPtrType()
const;
2628 bool isNothrowT()
const;
2629 bool isAlignValT()
const;
2630 bool isStdByteType()
const;
2631 bool isAtomicType()
const;
2632 bool isUndeducedAutoType()
const;
2634 bool isTypedefNameType()
const;
2636#define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \
2637 bool is##Id##Type() const;
2638#include "clang/Basic/OpenCLImageTypes.def"
2640 bool isImageType()
const;
2642 bool isSamplerT()
const;
2643 bool isEventT()
const;
2644 bool isClkEventT()
const;
2645 bool isQueueT()
const;
2646 bool isReserveIDT()
const;
2648#define EXT_OPAQUE_TYPE(ExtType, Id, Ext) \
2649 bool is##Id##Type() const;
2650#include "clang/Basic/OpenCLExtensionTypes.def"
2652 bool isOCLIntelSubgroupAVCType()
const;
2653 bool isOCLExtOpaqueType()
const;
2655 bool isPipeType()
const;
2656 bool isBitIntType()
const;
2657 bool isOpenCLSpecificType()
const;
2659#define HLSL_INTANGIBLE_TYPE(Name, Id, SingletonId) bool is##Id##Type() const;
2660#include "clang/Basic/HLSLIntangibleTypes.def"
2661 bool isHLSLSpecificType()
const;
2662 bool isHLSLBuiltinIntangibleType()
const;
2663 bool isHLSLAttributedResourceType()
const;
2664 bool isHLSLIntangibleType()
2670 bool isObjCARCImplicitlyUnretainedType()
const;
2673 bool isCUDADeviceBuiltinSurfaceType()
const;
2675 bool isCUDADeviceBuiltinTextureType()
const;
2694 ScalarTypeKind getScalarTypeKind()
const;
2702 return getDependence() & TypeDependence::Error;
2708 return getDependence() & TypeDependence::Dependent;
2716 return getDependence() & TypeDependence::Instantiation;
2722 bool isUndeducedType()
const;
2726 return getDependence() & TypeDependence::VariablyModified;
2731 bool hasSizedVLAType()
const;
2734 bool hasUnnamedOrLocalType()
const;
2736 bool isOverloadableType()
const;
2739 bool isElaboratedTypeSpecifier()
const;
2741 bool canDecayToPointerType()
const;
2746 bool hasPointerRepresentation()
const;
2750 bool hasObjCPointerRepresentation()
const;
2754 bool hasIntegerRepresentation()
const;
2758 bool hasSignedIntegerRepresentation()
const;
2762 bool hasUnsignedIntegerRepresentation()
const;
2766 bool hasFloatingRepresentation()
const;
2771 const RecordType *getAsStructureType()
const;
2774 const ComplexType *getAsComplexIntegerType()
const;
2795 TagDecl *getAsTagDecl()
const;
2813 return dyn_cast_or_null<AutoType>(getContainedDeducedType());
2819 bool hasAutoForTrailingReturnType()
const;
2827 template <
typename T>
const T *getAs()
const;
2834 template <
typename T>
const T *getAsAdjusted()
const;
2838 const ArrayType *getAsArrayTypeUnsafe()
const;
2846 template <
typename T>
const T *castAs()
const;
2850 const ArrayType *castAsArrayTypeUnsafe()
const;
2859 const Type *getBaseElementTypeUnsafe()
const;
2864 const Type *getArrayElementTypeNoTypeQual()
const;
2869 const Type *getPointeeOrArrayElementType()
const;
2877 const Type *getUnqualifiedDesugaredType()
const;
2882 bool isSignedIntegerType()
const;
2887 bool isUnsignedIntegerType()
const;
2891 bool isSignedIntegerOrEnumerationType()
const;
2895 bool isUnsignedIntegerOrEnumerationType()
const;
2899 bool isFixedPointType()
const;
2902 bool isFixedPointOrIntegerType()
const;
2905 bool isConvertibleToFixedPointType()
const;
2909 bool isSaturatedFixedPointType()
const;
2913 bool isUnsaturatedFixedPointType()
const;
2917 bool isSignedFixedPointType()
const;
2921 bool isUnsignedFixedPointType()
const;
2926 bool isConstantSizeType()
const;
2930 bool isSpecifierType()
const;
2937 return getLinkageAndVisibility().getVisibility();
2942 return getLinkageAndVisibility().isVisibilityExplicit();
2950 bool isLinkageValid()
const;
2957 std::optional<NullabilityKind> getNullability()
const;
2964 bool canHaveNullability(
bool ResultIfUnknown =
true)
const;
2981 std::optional<ArrayRef<QualType>>
2982 getObjCSubstitutions(
const DeclContext *dc)
const;
2986 bool acceptsObjCTypeParams()
const;
2988 const char *getTypeClassName()
const;
2991 return CanonicalType;
2996 void dump(llvm::raw_ostream &OS,
const ASTContext &Context)
const;
3001template <>
const TypedefType *Type::getAs()
const;
3002template <>
const UsingType *Type::getAs()
const;
3007template <>
const TemplateSpecializationType *Type::getAs()
const;
3011template <>
const AttributedType *Type::getAs()
const;
3015template <>
const BoundsAttributedType *Type::getAs()
const;
3019template <>
const CountAttributedType *Type::getAs()
const;
3023#define TYPE(Class, Base)
3024#define LEAF_TYPE(Class) \
3025template <> inline const Class##Type *Type::getAs() const { \
3026 return dyn_cast<Class##Type>(CanonicalType); \
3028template <> inline const Class##Type *Type::castAs() const { \
3029 return cast<Class##Type>(CanonicalType); \
3031#include "clang/AST/TypeNodes.inc"
3039#define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) Id,
3040#include "clang/Basic/OpenCLImageTypes.def"
3042#define EXT_OPAQUE_TYPE(ExtType, Id, Ext) Id,
3043#include "clang/Basic/OpenCLExtensionTypes.def"
3045#define SVE_TYPE(Name, Id, SingletonId) Id,
3046#include "clang/Basic/AArch64SVEACLETypes.def"
3048#define PPC_VECTOR_TYPE(Name, Id, Size) Id,
3049#include "clang/Basic/PPCTypes.def"
3051#define RVV_TYPE(Name, Id, SingletonId) Id,
3052#include "clang/Basic/RISCVVTypes.def"
3054#define WASM_TYPE(Name, Id, SingletonId) Id,
3055#include "clang/Basic/WebAssemblyReferenceTypes.def"
3057#define AMDGPU_TYPE(Name, Id, SingletonId, Width, Align) Id,
3058#include "clang/Basic/AMDGPUTypes.def"
3060#define HLSL_INTANGIBLE_TYPE(Name, Id, SingletonId) Id,
3061#include "clang/Basic/HLSLIntangibleTypes.def"
3063#define BUILTIN_TYPE(Id, SingletonId) Id,
3064#define LAST_BUILTIN_TYPE(Id) LastKind = Id
3065#include "clang/AST/BuiltinTypes.def"
3075 static_assert(Kind::LastKind <
3076 (1 << BuiltinTypeBitfields::NumOfBuiltinTypeBits) &&
3077 "Defined builtin type exceeds the allocated space for serial "
3079 BuiltinTypeBits.Kind = K;
3088 StringRef str =
getName(Policy);
3089 assert(!str.empty() && str.data()[str.size()] ==
'\0');
3118 return K >= Overload;
3125 return isPlaceholderTypeKind(
getKind());
3152 :
Type(
Complex, CanonicalPtr, Element->getDependence()),
3153 ElementType(Element) {}
3162 Profile(
ID, getElementType());
3166 ID.AddPointer(Element.getAsOpaquePtr());
3179 :
Type(
Paren, CanonType, InnerType->getDependence()), Inner(InnerType) {}
3188 Profile(
ID, getInnerType());
3205 :
Type(
Pointer, CanonicalPtr, Pointee->getDependence()),
3206 PointeeType(Pointee) {}
3229 using BaseTy = llvm::PointerIntPair<ValueDecl *, 1, unsigned>;
3244 bool isDeref()
const;
3246 unsigned getInt()
const;
3247 void *getOpaqueValue()
const;
3249 void setFromOpaqueValue(
void *
V);
3280 return decl_range(dependent_decl_begin(), dependent_decl_end());
3284 return {dependent_decl_begin(), dependent_decl_end()};
3287 bool referencesFieldDecls()
const;
3294 case CountAttributed:
3306 public llvm::TrailingObjects<CountAttributedType,
3307 TypeCoupledDeclRefInfo> {
3318 bool CountInBytes,
bool OrNull,
3321 unsigned numTrailingObjects(OverloadToken<TypeCoupledDeclRefInfo>)
const {
3322 return CountAttributedTypeBits.NumCoupledDecls;
3335 bool isOrNull()
const {
return CountAttributedTypeBits.OrNull; }
3339 return isCountInBytes() ? SizedByOrNull : CountedByOrNull;
3340 return isCountInBytes() ? SizedBy : CountedBy;
3344 Profile(
ID, desugar(), CountExpr, isCountInBytes(), isOrNull());
3347 static void Profile(llvm::FoldingSetNodeID &
ID,
QualType WrappedTy,
3348 Expr *CountExpr,
bool CountInBytes,
bool Nullable);
3367 :
Type(TC, CanonicalPtr, OriginalTy->getDependence()),
3368 OriginalTy(OriginalTy), AdjustedTy(AdjustedTy) {}
3378 Profile(
ID, OriginalTy, AdjustedTy);
3416 :
Type(BlockPointer, CanonicalCls, Pointee->getDependence()),
3417 PointeeType(Pointee) {}
3445 bool SpelledAsLValue)
3446 :
Type(tc, CanonicalRef, Referencee->getDependence()),
3447 PointeeType(Referencee) {
3448 ReferenceTypeBits.SpelledAsLValue = SpelledAsLValue;
3461 while (
T->isInnerRef())
3463 return T->PointeeType;
3467 Profile(
ID, PointeeType, isSpelledAsLValue());
3472 bool SpelledAsLValue) {
3474 ID.AddBoolean(SpelledAsLValue);
3488 bool SpelledAsLValue)
3530 :
Type(MemberPointer, CanonicalPtr,
3532 Pointee->getDependence()),
3533 PointeeType(Pointee),
Class(Cls) {}
3561 const Type *Class) {
3587 unsigned tq,
const Expr *sz =
nullptr);
3597 return Qualifiers::fromCVRMask(getIndexTypeCVRQualifiers());
3601 return ArrayTypeBits.IndexTypeQuals;
3619 struct ExternalSize {
3620 ExternalSize(
const llvm::APInt &Sz,
const Expr *SE)
3621 : Size(Sz), SizeExpr(SE) {}
3623 const Expr *SizeExpr;
3633 :
ArrayType(ConstantArray, Et, Can,
SM, TQ, nullptr), Size(Sz) {
3634 ConstantArrayTypeBits.HasExternalSize =
false;
3635 ConstantArrayTypeBits.SizeWidth = Width / 8;
3638 assert(Width < 0xFF &&
"Type width in bits must be less than 8 bits");
3641 ConstantArrayType(QualType Et, QualType Can, ExternalSize *SzPtr,
3642 ArraySizeModifier
SM,
unsigned TQ)
3643 : ArrayType(ConstantArray, Et, Can,
SM, TQ, SzPtr->SizeExpr),
3645 ConstantArrayTypeBits.HasExternalSize =
true;
3646 ConstantArrayTypeBits.SizeWidth = 0;
3648 assert((SzPtr->SizeExpr ==
nullptr || !Can.isNull()) &&
3649 "canonical constant array should not have size expression");
3652 static ConstantArrayType *
Create(
const ASTContext &Ctx, QualType ET,
3653 QualType Can,
const llvm::APInt &Sz,
3654 const Expr *SzExpr, ArraySizeModifier SzMod,
3659 :
ArrayType(Tc, ATy->getElementType(), Can, ATy->getSizeModifier(),
3660 ATy->getIndexTypeQualifiers().getAsOpaqueValue(), nullptr) {
3661 ConstantArrayTypeBits.HasExternalSize =
3663 if (!ConstantArrayTypeBits.HasExternalSize) {
3673 return ConstantArrayTypeBits.HasExternalSize
3675 : llvm::APInt(ConstantArrayTypeBits.SizeWidth * 8, Size);
3680 return ConstantArrayTypeBits.HasExternalSize
3681 ? SizePtr->Size.getBitWidth()
3682 :
static_cast<unsigned>(ConstantArrayTypeBits.SizeWidth * 8);
3687 return ConstantArrayTypeBits.HasExternalSize ? SizePtr->Size.isZero()
3693 return ConstantArrayTypeBits.HasExternalSize ? SizePtr->Size.getZExtValue()
3699 return ConstantArrayTypeBits.HasExternalSize ? SizePtr->Size.getSExtValue()
3700 :
static_cast<int64_t
>(Size);
3706 return ConstantArrayTypeBits.HasExternalSize
3707 ? SizePtr->Size.getLimitedValue()
3713 return ConstantArrayTypeBits.HasExternalSize ? SizePtr->SizeExpr :
nullptr;
3721 static unsigned getNumAddressingBits(
const ASTContext &Context,
3723 const llvm::APInt &NumElements);
3725 unsigned getNumAddressingBits(
const ASTContext &Context)
const;
3729 static unsigned getMaxSizeBits(
const ASTContext &Context);
3732 Profile(
ID, Ctx, getElementType(), getZExtSize(), getSizeExpr(),
3733 getSizeModifier(), getIndexTypeCVRQualifiers());
3736 static void Profile(llvm::FoldingSetNodeID &
ID,
const ASTContext &Ctx,
3770 :
ArrayType(IncompleteArray, et, can, sm, tq) {}
3783 Profile(
ID, getElementType(), getSizeModifier(),
3784 getIndexTypeCVRQualifiers());
3790 ID.AddInteger(llvm::to_underlying(SizeMod));
3791 ID.AddInteger(TypeQuals);
3822 :
ArrayType(VariableArray, et, can, sm, tq, e),
3823 SizeExpr((
Stmt*) e), Brackets(brackets) {}
3831 return (
Expr*) SizeExpr;
3846 llvm_unreachable(
"Cannot unique VariableArrayTypes.");
3886 return (
Expr*) SizeExpr;
3901 Profile(
ID, Context, getElementType(),
3902 getSizeModifier(), getIndexTypeCVRQualifiers(), getSizeExpr());
3905 static void Profile(llvm::FoldingSetNodeID &
ID,
const ASTContext &Context,
3907 unsigned TypeQuals,
Expr *
E);
3924 Expr *AddrSpaceExpr;
3947 static void Profile(llvm::FoldingSetNodeID &
ID,
const ASTContext &Context,
3987 Profile(
ID, Context, getElementType(), getSizeExpr());
3990 static void Profile(llvm::FoldingSetNodeID &
ID,
const ASTContext &Context,
4060 Profile(
ID, getElementType(), getNumElements(),
4061 getTypeClass(), getVectorKind());
4068 ID.AddInteger(NumElements);
4070 ID.AddInteger(llvm::to_underlying(VecKind));
4113 Profile(
ID, Context, getElementType(), getSizeExpr(), getVectorKind());
4116 static void Profile(llvm::FoldingSetNodeID &
ID,
const ASTContext &Context,
4131 :
VectorType(ExtVector, vecType, nElements, canonType,
4138 case 'x':
case 'r':
return 0;
4139 case 'y':
case 'g':
return 1;
4140 case 'z':
case 'b':
return 2;
4141 case 'w':
case 'a':
return 3;
4159 case 'a':
return 10;
4161 case 'b':
return 11;
4163 case 'c':
return 12;
4165 case 'd':
return 13;
4167 case 'e':
return 14;
4169 case 'f':
return 15;
4174 if (isNumericAccessor)
4175 return getNumericAccessorIdx(
c);
4177 return getPointAccessorIdx(
c);
4181 if (
int idx = getAccessorIdx(
c, isNumericAccessor)+1)
4182 return unsigned(idx-1) < getNumElements();
4207 const Expr *RowExpr =
nullptr,
const Expr *ColumnExpr =
nullptr);
4241 static constexpr unsigned MaxElementsPerDimension = (1 << 20) - 1;
4244 unsigned NColumns,
QualType CanonElementType);
4247 unsigned NColumns,
QualType CanonElementType);
4258 return getNumRows() * getNumColumns();
4263 return NumElements > 0 && NumElements <= MaxElementsPerDimension;
4268 return MaxElementsPerDimension;
4272 Profile(
ID, getElementType(), getNumRows(), getNumColumns(),
4277 unsigned NumRows,
unsigned NumColumns,
4280 ID.AddInteger(NumRows);
4281 ID.AddInteger(NumColumns);
4313 Profile(
ID, Context, getElementType(), getRowExpr(), getColumnExpr());
4316 static void Profile(llvm::FoldingSetNodeID &
ID,
const ASTContext &Context,
4352 HasPassObjSize = 0x20,
4355 unsigned char Data = 0;
4364 copy.Data = (copy.Data & ~ABIMask) |
unsigned(kind);
4374 copy.Data |= IsConsumed;
4376 copy.Data &= ~IsConsumed;
4383 Copy.Data |= HasPassObjSize;
4391 Copy.Data |= IsNoEscape;
4393 Copy.Data &= ~IsNoEscape;
4405 return lhs.Data == rhs.Data;
4409 return lhs.Data != rhs.Data;
4444 enum { CallConvMask = 0x1F };
4445 enum { NoReturnMask = 0x20 };
4446 enum { ProducesResultMask = 0x40 };
4447 enum { NoCallerSavedRegsMask = 0x80 };
4449 RegParmMask = 0x700,
4452 enum { NoCfCheckMask = 0x800 };
4453 enum { CmseNSCallMask = 0x1000 };
4454 uint16_t Bits =
CC_C;
4456 ExtInfo(
unsigned Bits) : Bits(static_cast<uint16_t>(Bits)) {}
4462 bool producesResult,
bool noCallerSavedRegs,
bool NoCfCheck,
4464 assert((!hasRegParm || regParm < 7) &&
"Invalid regparm value");
4465 Bits = ((
unsigned)cc) | (noReturn ? NoReturnMask : 0) |
4466 (producesResult ? ProducesResultMask : 0) |
4467 (noCallerSavedRegs ? NoCallerSavedRegsMask : 0) |
4468 (hasRegParm ? ((regParm + 1) << RegParmOffset) : 0) |
4469 (NoCfCheck ? NoCfCheckMask : 0) |
4470 (cmseNSCall ? CmseNSCallMask : 0);
4486 bool getHasRegParm()
const {
return ((Bits & RegParmMask) >> RegParmOffset) != 0; }
4489 unsigned RegParm = (Bits & RegParmMask) >> RegParmOffset;
4498 return Bits ==
Other.Bits;
4501 return Bits !=
Other.Bits;
4509 return ExtInfo(Bits | NoReturnMask);
4511 return ExtInfo(Bits & ~NoReturnMask);
4516 return ExtInfo(Bits | ProducesResultMask);
4518 return ExtInfo(Bits & ~ProducesResultMask);
4523 return ExtInfo(Bits | CmseNSCallMask);
4525 return ExtInfo(Bits & ~CmseNSCallMask);
4529 if (noCallerSavedRegs)
4530 return ExtInfo(Bits | NoCallerSavedRegsMask);
4532 return ExtInfo(Bits & ~NoCallerSavedRegsMask);
4537 return ExtInfo(Bits | NoCfCheckMask);
4539 return ExtInfo(Bits & ~NoCfCheckMask);
4543 assert(RegParm < 7 &&
"Invalid regparm value");
4544 return ExtInfo((Bits & ~RegParmMask) |
4545 ((RegParm + 1) << RegParmOffset));
4549 return ExtInfo((Bits & ~CallConvMask) | (
unsigned) cc);
4553 ID.AddInteger(Bits);
4571 LLVM_PREFERRED_TYPE(
bool)
4574 LLVM_PREFERRED_TYPE(
bool)
4575 unsigned EffectsHaveConditions : 1;
4576 unsigned NumFunctionEffects : 4;
4579 : NumExceptionType(0), HasArmTypeAttributes(
false),
4580 EffectsHaveConditions(
false), NumFunctionEffects(0) {}
4587 SME_NormalFunction = 0,
4588 SME_PStateSMEnabledMask = 1 << 0,
4589 SME_PStateSMCompatibleMask = 1 << 1,
4593 SME_ZAMask = 0b111 << SME_ZAShift,
4595 SME_ZT0Mask = 0b111 << SME_ZT0Shift,
4598 SME_AgnosticZAStateShift = 8,
4599 SME_AgnosticZAStateMask = 1 << SME_AgnosticZAStateShift,
4616 return (
ArmStateValue)((AttrBits & SME_ZAMask) >> SME_ZAShift);
4620 return (
ArmStateValue)((AttrBits & SME_ZT0Mask) >> SME_ZT0Shift);
4638 FunctionTypeBits.ExtInfo = Info.Bits;
4642 if (isFunctionProtoType())
4643 return Qualifiers::fromFastMask(FunctionTypeBits.FastTypeQuals);
4663 static_assert((
~Qualifiers::FastMask & Qualifiers::CVRMask) == 0,
4664 "Const, volatile and restrict are assumed to be a subset of "
4665 "the fast qualifiers.");
4667 bool isConst()
const {
return getFastTypeQuals().hasConst(); }
4668 bool isVolatile()
const {
return getFastTypeQuals().hasVolatile(); }
4669 bool isRestrict()
const {
return getFastTypeQuals().hasRestrict(); }
4677 static StringRef getNameForCallConv(
CallingConv CC);
4692 Result->getDependence() &
4704 Profile(
ID, getReturnType(), getExtInfo());
4732 constexpr static size_t KindCount =
static_cast<size_t>(Kind::Last) + 1;
4740 FE_InferrableOnCallees = 0x1,
4743 FE_ExcludeThrow = 0x2,
4744 FE_ExcludeCatch = 0x4,
4745 FE_ExcludeObjCMessageSend = 0x8,
4746 FE_ExcludeStaticLocalVars = 0x10,
4747 FE_ExcludeThreadLocalVars = 0x20
4764 Kind oppositeKind()
const;
4775 case Kind::NonBlocking:
4776 return FE_InferrableOnCallees | FE_ExcludeThrow | FE_ExcludeCatch |
4777 FE_ExcludeObjCMessageSend | FE_ExcludeStaticLocalVars |
4778 FE_ExcludeThreadLocalVars;
4779 case Kind::NonAllocating:
4781 return FE_InferrableOnCallees | FE_ExcludeThrow | FE_ExcludeCatch |
4782 FE_ExcludeObjCMessageSend | FE_ExcludeThreadLocalVars;
4783 case Kind::Blocking:
4784 case Kind::Allocating:
4787 llvm_unreachable(
"unknown effect kind");
4791 StringRef name()
const;
4795 OS << Effect.
name();
4805 std::optional<FunctionEffect>
4806 effectProhibitingInference(
const Decl &Callee,
4813 bool shouldDiagnoseFunctionCall(
bool Direct,
4817 return LHS.FKind == RHS.FKind;
4820 return !(LHS == RHS);
4823 return LHS.FKind < RHS.FKind;
4830 Expr *Cond =
nullptr;
4839 return Cond == RHS.Cond;
4851 : Effect(
E), Cond(C) {}
4854 std::string description()
const;
4856 friend raw_ostream &operator<<(raw_ostream &OS,
4865 const Container *Outer =
nullptr;
4872 return Idx ==
Other.Idx;
4875 return Idx !=
Other.Idx;
4884 assert(Outer !=
nullptr &&
"invalid FunctionEffectIterator");
4885 bool HasConds = !Outer->Conditions.empty();
4887 HasConds ? Outer->Conditions[Idx]
4926 : Effects(FX), Conditions(Conds) {}
4939 bool empty()
const {
return Effects.empty(); }
4940 size_t size()
const {
return Effects.size(); }
4952 return LHS.Effects == RHS.Effects && LHS.Conditions == RHS.Conditions;
4956 return !(LHS == RHS);
4959 void dump(llvm::raw_ostream &OS)
const;
4965 constexpr static size_t EndBitPos = FunctionEffect::KindCount;
4966 using KindBitsT = std::bitset<EndBitPos>;
4968 KindBitsT KindBits{};
4976 return static_cast<size_t>(K);
4990 void advanceToNextSetBit() {
4991 while (Idx < EndBitPos && !Outer->KindBits.test(Idx))
4998 advanceToNextSetBit();
5001 bool operator!=(
const iterator &
Other)
const {
return Idx !=
Other.Idx; }
5003 iterator operator++() {
5005 advanceToNextSetBit();
5010 assert(Idx < EndBitPos &&
"Dereference of end iterator");
5019 iterator
begin()
const {
return iterator(*
this, 0); }
5020 iterator
end()
const {
return iterator(*
this, EndBitPos); }
5029 bool empty()
const {
return KindBits.none(); }
5031 return KindBits.test(kindToPos(EK));
5033 void dump(llvm::raw_ostream &OS)
const;
5053 : Effects(FX.effects()), Conditions(FX.conditions()) {}
5055 bool empty()
const {
return Effects.empty(); }
5056 size_t size()
const {
return Effects.size(); }
5065 void dump(llvm::raw_ostream &OS)
const;
5102 public llvm::FoldingSetNode,
5103 private llvm::TrailingObjects<
5104 FunctionProtoType, QualType, SourceLocation,
5105 FunctionType::FunctionTypeExtraBitfields,
5106 FunctionType::FunctionTypeArmAttributes, FunctionType::ExceptionType,
5107 Expr *, FunctionDecl *, FunctionType::ExtParameterInfo, Qualifiers,
5108 FunctionEffect, EffectConditionExpr> {
5110 friend TrailingObjects;
5207 AArch64SMEAttributes(SME_NormalFunction) {}
5211 AArch64SMEAttributes(SME_NormalFunction) {}
5215 Result.ExceptionSpec = ESI;
5221 requiresFunctionProtoTypeArmAttributes() ||
5222 !FunctionEffects.
empty();
5226 return AArch64SMEAttributes != SME_NormalFunction;
5231 AArch64SMEAttributes |=
Kind;
5233 AArch64SMEAttributes &= ~Kind;
5238 unsigned numTrailingObjects(OverloadToken<QualType>)
const {
5239 return getNumParams();
5242 unsigned numTrailingObjects(OverloadToken<SourceLocation>)
const {
5243 return isVariadic();
5246 unsigned numTrailingObjects(OverloadToken<FunctionTypeArmAttributes>)
const {
5247 return hasArmTypeAttributes();
5250 unsigned numTrailingObjects(OverloadToken<FunctionTypeExtraBitfields>)
const {
5251 return hasExtraBitfields();
5254 unsigned numTrailingObjects(OverloadToken<ExceptionType>)
const {
5255 return getExceptionSpecSize().NumExceptionType;
5258 unsigned numTrailingObjects(OverloadToken<Expr *>)
const {
5259 return getExceptionSpecSize().NumExprPtr;
5262 unsigned numTrailingObjects(OverloadToken<FunctionDecl *>)
const {
5263 return getExceptionSpecSize().NumFunctionDeclPtr;
5266 unsigned numTrailingObjects(OverloadToken<ExtParameterInfo>)
const {
5267 return hasExtParameterInfos() ? getNumParams() : 0;
5270 unsigned numTrailingObjects(OverloadToken<Qualifiers>)
const {
5271 return hasExtQualifiers() ? 1 : 0;
5274 unsigned numTrailingObjects(OverloadToken<FunctionEffect>)
const {
5275 return getNumFunctionEffects();
5278 unsigned numTrailingObjects(OverloadToken<EffectConditionExpr>)
const {
5279 return getNumFunctionEffectConditions();
5284 static bool containsAnyUnexpandedParameterPack(
const QualType *ArgArray,
5286 for (
unsigned Idx = 0; Idx < numArgs; ++Idx)
5287 if (ArgArray[Idx]->containsUnexpandedParameterPack())
5293 FunctionProtoType(QualType result, ArrayRef<QualType> params,
5294 QualType canonical,
const ExtProtoInfo &epi);
5299 struct ExceptionSpecSizeHolder {
5300 unsigned NumExceptionType;
5301 unsigned NumExprPtr;
5302 unsigned NumFunctionDeclPtr;
5307 static ExceptionSpecSizeHolder
5308 getExceptionSpecSize(ExceptionSpecificationType EST,
unsigned NumExceptions) {
5319 return {NumExceptions, 0, 0};
5332 llvm_unreachable(
"bad exception specification kind");
5337 ExceptionSpecSizeHolder getExceptionSpecSize()
const {
5338 return getExceptionSpecSize(getExceptionSpecType(), getNumExceptions());
5342 bool hasExtraBitfields()
const {
5343 assert((getExceptionSpecType() != EST_Dynamic ||
5344 FunctionTypeBits.HasExtraBitfields) &&
5345 "ExtraBitfields are required for given ExceptionSpecType");
5346 return FunctionTypeBits.HasExtraBitfields;
5350 bool hasArmTypeAttributes()
const {
5351 return FunctionTypeBits.HasExtraBitfields &&
5352 getTrailingObjects<FunctionTypeExtraBitfields>()
5353 ->HasArmTypeAttributes;
5356 bool hasExtQualifiers()
const {
5357 return FunctionTypeBits.HasExtQuals;
5364 assert(i < getNumParams() &&
"invalid parameter index");
5365 return param_type_begin()[i];
5390 FunctionTypeBits.ExceptionSpecType);
5407 bool hasDependentExceptionSpec()
const;
5411 bool hasInstantiationDependentExceptionSpec()
const;
5416 Result.Type = getExceptionSpecType();
5418 Result.Exceptions = exceptions();
5420 Result.NoexceptExpr = getNoexceptExpr();
5422 Result.SourceDecl = getExceptionSpecDecl();
5423 Result.SourceTemplate = getExceptionSpecTemplate();
5425 Result.SourceDecl = getExceptionSpecDecl();
5433 ? getTrailingObjects<FunctionTypeExtraBitfields>()
5440 assert(i < getNumExceptions() &&
"Invalid exception number!");
5441 return exception_begin()[i];
5449 return *getTrailingObjects<Expr *>();
5460 return getTrailingObjects<FunctionDecl *>()[0];
5470 return getTrailingObjects<FunctionDecl *>()[1];
5481 return ResultIfDependent ? canThrow() !=
CT_Can : canThrow() ==
CT_Cannot;
5488 return isVariadic() ? *getTrailingObjects<SourceLocation>()
5498 bool isTemplateVariadic()
const;
5504 if (hasExtQualifiers())
5505 return *getTrailingObjects<Qualifiers>();
5507 return getFastTypeQuals();
5522 return getTrailingObjects<QualType>();
5526 return param_type_begin() + getNumParams();
5537 getTrailingObjects<ExceptionType>());
5541 return exception_begin() + getNumExceptions();
5547 return FunctionTypeBits.HasExtParameterInfos;
5551 assert(hasExtParameterInfos());
5560 if (!hasExtParameterInfos())
5562 return getTrailingObjects<ExtParameterInfo>();
5568 if (!hasArmTypeAttributes())
5569 return SME_NormalFunction;
5570 return getTrailingObjects<FunctionTypeArmAttributes>()
5571 ->AArch64SMEAttributes;
5575 assert(I < getNumParams() &&
"parameter index out of range");
5576 if (hasExtParameterInfos())
5577 return getTrailingObjects<ExtParameterInfo>()[I];
5582 assert(I < getNumParams() &&
"parameter index out of range");
5583 if (hasExtParameterInfos())
5584 return getTrailingObjects<ExtParameterInfo>()[I].getABI();
5585 return ParameterABI::Ordinary;
5589 assert(I < getNumParams() &&
"parameter index out of range");
5590 if (hasExtParameterInfos())
5591 return getTrailingObjects<ExtParameterInfo>()[I].isConsumed();
5596 return hasExtraBitfields()
5597 ? getTrailingObjects<FunctionTypeExtraBitfields>()
5598 ->NumFunctionEffects
5604 if (hasExtraBitfields()) {
5605 const auto *Bitfields = getTrailingObjects<FunctionTypeExtraBitfields>();
5606 if (Bitfields->NumFunctionEffects > 0)
5607 return {getTrailingObjects<FunctionEffect>(),
5608 Bitfields->NumFunctionEffects};
5614 if (hasExtraBitfields()) {
5615 const auto *Bitfields = getTrailingObjects<FunctionTypeExtraBitfields>();
5616 if (Bitfields->EffectsHaveConditions)
5617 return Bitfields->NumFunctionEffects;
5624 if (hasExtraBitfields()) {
5625 const auto *Bitfields = getTrailingObjects<FunctionTypeExtraBitfields>();
5626 if (Bitfields->EffectsHaveConditions)
5627 return {getTrailingObjects<EffectConditionExpr>(),
5628 Bitfields->NumFunctionEffects};
5635 if (hasExtraBitfields()) {
5636 const auto *Bitfields = getTrailingObjects<FunctionTypeExtraBitfields>();
5637 if (Bitfields->NumFunctionEffects > 0) {
5638 const size_t NumConds = Bitfields->EffectsHaveConditions
5639 ? Bitfields->NumFunctionEffects
5642 {getTrailingObjects<FunctionEffect>(),
5643 Bitfields->NumFunctionEffects},
5644 {NumConds ? getTrailingObjects<EffectConditionExpr>() :
nullptr,
5654 void printExceptionSpecification(raw_ostream &OS,
5661 void Profile(llvm::FoldingSetNodeID &
ID,
const ASTContext &Ctx);
5694 return Profile(
ID,
Decl);
5704 public llvm::FoldingSetNode,
5705 private llvm::TrailingObjects<UsingType, QualType> {
5708 friend TrailingObjects;
5736 public llvm::FoldingSetNode,
5737 private llvm::TrailingObjects<TypedefType, QualType> {
5740 friend TrailingObjects;
5762 if (!Underlying.
isNull())
5779 :
Type(MacroQualified, CanonTy, UnderlyingTy->getDependence()),
5780 UnderlyingTy(UnderlyingTy), MacroII(MacroII) {
5781 assert(isa<AttributedType>(UnderlyingTy) &&
5782 "Expected a macro qualified type to only wrap attributed types.");
5818 return static_cast<TypeOfKind>(TypeOfBits.Kind);
5825 bool isSugared()
const;
5837 public llvm::FoldingSetNode {
5843 Profile(
ID, Context, getUnderlyingExpr(),
5844 getKind() == TypeOfKind::Unqualified);
5847 static void Profile(llvm::FoldingSetNodeID &
ID,
const ASTContext &Context,
5848 Expr *
E,
bool IsUnqual);
5873 return static_cast<TypeOfKind>(TypeOfBits.Kind);
5897 bool isSugared()
const;
5913 Profile(
ID, Context, getUnderlyingExpr());
5916 static void Profile(llvm::FoldingSetNodeID &
ID,
const ASTContext &Context,
5922 public llvm::FoldingSetNode,
5923 private llvm::TrailingObjects<PackIndexingType, QualType> {
5924 friend TrailingObjects;
5932 LLVM_PREFERRED_TYPE(
bool)
5933 unsigned FullySubstituted : 1;
5938 QualType Pattern,
Expr *IndexExpr,
bool FullySubstituted,
5948 if (hasSelectedType())
5949 return getSelectedType();
5954 assert(hasSelectedType() &&
"Type is dependant");
5955 return *(getExpansionsPtr() + *getSelectedIndex());
5958 std::optional<unsigned> getSelectedIndex()
const;
5967 return {getExpansionsPtr(), Size};
5975 if (hasSelectedType())
5976 getSelectedType().Profile(
ID);
5978 Profile(
ID, Context, getPattern(), getIndexExpr(), isFullySubstituted());
5980 static void Profile(llvm::FoldingSetNodeID &
ID,
const ASTContext &Context,
5984 const QualType *getExpansionsPtr()
const {
5985 return getTrailingObjects<QualType>();
5988 static TypeDependence computeDependence(QualType Pattern, Expr *IndexExpr,
5989 ArrayRef<QualType> Expansions = {});
5991 unsigned numTrailingObjects(OverloadToken<QualType>)
const {
return Size; }
5998#define TRANSFORM_TYPE_TRAIT_DEF(Enum, _) Enum,
5999#include "clang/Basic/TransformTypeTraits.def"
6007 QualType UnderlyingType;
6038 public llvm::FoldingSetNode {
6044 Profile(
ID, getBaseType(), getUTTKind());
6050 ID.AddInteger((
unsigned)UKind);
6069 bool isBeingDefined()
const;
6089 return reinterpret_cast<RecordDecl*
>(TagType::getDecl());
6094 bool hasConstFields()
const;
6112 return reinterpret_cast<EnumDecl*
>(TagType::getDecl());
6140 const Attr *Attribute;
6147 :
AttributedType(canon, attrKind, nullptr, modified, equivalent) {}
6158 return static_cast<Kind>(AttributedTypeBits.AttrKind);
6184 bool isQualifier()
const;
6186 bool isMSTypeSpec()
const;
6188 bool isWebAssemblyFuncrefSpec()
const;
6190 bool isCallingConv()
const;
6192 std::optional<NullabilityKind> getImmediateNullability()
const;
6203 static std::optional<NullabilityKind> stripOuterNullability(
QualType &T);
6206 Profile(
ID, getAttrKind(), ModifiedType, EquivalentType, Attribute);
6212 ID.AddInteger(attrKind);
6228 const BTFTypeTagAttr *BTFAttr;
6231 const BTFTypeTagAttr *BTFAttr)
6232 :
Type(BTFTagAttributed, Canon, Wrapped->getDependence()),
6233 WrappedType(Wrapped), BTFAttr(BTFAttr) {}
6237 const BTFTypeTagAttr *
getAttr()
const {
return BTFAttr; }
6243 Profile(
ID, WrappedType, BTFAttr);
6247 const BTFTypeTagAttr *BTFAttr) {
6249 ID.AddPointer(BTFAttr);
6263 LLVM_PREFERRED_TYPE(
bool)
6266 LLVM_PREFERRED_TYPE(
bool)
6267 uint8_t RawBuffer : 1;
6271 : ResourceClass(ResourceClass), IsROV(IsROV), RawBuffer(RawBuffer) {}
6280 return !(LHS == RHS);
6295 : Contained->getDependence()),
6296 WrappedType(Wrapped), ContainedType(Contained), Attrs(Attrs) {}
6308 Profile(
ID, WrappedType, ContainedType, Attrs);
6326 findHandleTypeOnResource(
const Type *RT);
6337 :
Type(TemplateTypeParm, Canon,
6341 assert(!TTPDecl == Canon.
isNull());
6342 TemplateTypeParmTypeBits.Depth =
D;
6343 TemplateTypeParmTypeBits.Index = I;
6344 TemplateTypeParmTypeBits.ParameterPack = PP;
6348 unsigned getDepth()
const {
return TemplateTypeParmTypeBits.Depth; }
6349 unsigned getIndex()
const {
return TemplateTypeParmTypeBits.Index; }
6351 return TemplateTypeParmTypeBits.ParameterPack;
6365 static void Profile(llvm::FoldingSetNodeID &
ID,
unsigned Depth,
6366 unsigned Index,
bool ParameterPack,
6368 ID.AddInteger(Depth);
6369 ID.AddInteger(Index);
6370 ID.AddBoolean(ParameterPack);
6371 ID.AddPointer(TTPDecl);
6388 public llvm::FoldingSetNode,
6389 private llvm::TrailingObjects<SubstTemplateTypeParmType, QualType> {
6393 Decl *AssociatedDecl;
6396 unsigned Index, std::optional<unsigned> PackIndex,
6403 return SubstTemplateTypeParmTypeBits.HasNonCanonicalUnderlyingType
6404 ? *getTrailingObjects<QualType>()
6405 : getCanonicalTypeInternal();
6418 unsigned getIndex()
const {
return SubstTemplateTypeParmTypeBits.Index; }
6421 if (SubstTemplateTypeParmTypeBits.PackIndex == 0)
6422 return std::nullopt;
6423 return SubstTemplateTypeParmTypeBits.PackIndex - 1;
6428 SubstTemplateTypeParmTypeBits.SubstitutionFlag);
6435 Profile(
ID, getReplacementType(), getAssociatedDecl(),
getIndex(),
6436 getPackIndex(), getSubstitutionFlag());
6440 const Decl *AssociatedDecl,
unsigned Index,
6441 std::optional<unsigned> PackIndex,
6443 Replacement.Profile(
ID);
6444 ID.AddPointer(AssociatedDecl);
6445 ID.AddInteger(Index);
6446 ID.AddInteger(PackIndex ? *PackIndex - 1 : 0);
6447 ID.AddInteger(llvm::to_underlying(Flag));
6448 assert((Flag != SubstTemplateTypeParmTypeFlag::ExpandPacksInPlace ||
6450 "ExpandPacksInPlace needs a valid PackIndex");
6477 llvm::PointerIntPair<Decl *, 1, bool> AssociatedDeclAndFinal;
6480 unsigned Index,
bool Final,
6489 Decl *getAssociatedDecl()
const;
6496 unsigned getIndex()
const {
return SubstTemplateTypeParmPackTypeBits.Index; }
6499 bool getFinal()
const;
6502 return SubstTemplateTypeParmPackTypeBits.NumArgs;
6510 void Profile(llvm::FoldingSetNodeID &
ID);
6511 static void Profile(llvm::FoldingSetNodeID &
ID,
const Decl *AssociatedDecl,
6512 unsigned Index,
bool Final,
6535 ExtraDependence | (DeducedAsType.isNull()
6537 : DeducedAsType->getDependence() &
6539 DeducedAsType(DeducedAsType) {}
6544 return isSugared() ? DeducedAsType :
QualType(
this, 0);
6551 return !DeducedAsType.
isNull() || isDependentType();
6574 AutoTypeBits.NumArgs};
6578 return TypeConstraintConcept;
6582 return TypeConstraintConcept !=
nullptr;
6586 return getKeyword() == AutoTypeKeyword::DecltypeAuto;
6590 return getKeyword() == AutoTypeKeyword::GNUAutoType;
6597 void Profile(llvm::FoldingSetNodeID &
ID,
const ASTContext &Context);
6598 static void Profile(llvm::FoldingSetNodeID &
ID,
const ASTContext &Context,
6610 public llvm::FoldingSetNode {
6618 bool IsDeducedAsDependent,
QualType Canon)
6619 :
DeducedType(DeducedTemplateSpecialization, DeducedAsType,
6621 (IsDeducedAsDependent
6625 Template(Template) {}
6632 Profile(
ID, getTemplateName(), getDeducedType(), isDependentType());
6636 QualType Deduced,
bool IsDependent) {
6702 static bool anyInstantiationDependentTemplateArguments(
6708 return isa<InjectedClassNameType>(getCanonicalTypeInternal());
6726 bool isTypeAlias()
const {
return TemplateSpecializationTypeBits.TypeAlias; }
6737 TemplateSpecializationTypeBits.NumArgs};
6741 return !isDependentType() || isCurrentInstantiation() || isTypeAlias();
6745 return isTypeAlias() ? getAliasedType() : getCanonicalTypeInternal();
6748 void Profile(llvm::FoldingSetNodeID &
ID,
const ASTContext &Ctx);
6760void printTemplateArgumentList(raw_ostream &OS,
6761 ArrayRef<TemplateArgument> Args,
6762 const PrintingPolicy &Policy,
6763 const TemplateParameterList *TPL =
nullptr);
6765void printTemplateArgumentList(raw_ostream &OS,
6766 ArrayRef<TemplateArgumentLoc> Args,
6767 const PrintingPolicy &Policy,
6768 const TemplateParameterList *TPL =
nullptr);
6770void printTemplateArgumentList(raw_ostream &OS,
6771 const TemplateArgumentListInfo &Args,
6772 const PrintingPolicy &Policy,
6773 const TemplateParameterList *TPL =
nullptr);
6777bool isSubstitutedDefaultArgument(ASTContext &Ctx, TemplateArgument Arg,
6778 const NamedDecl *Param,
6779 ArrayRef<TemplateArgument> Args,
6823 Decl(
D), InjectedType(TST) {
6824 assert(isa<TemplateSpecializationType>(TST));
6833 return cast<TemplateSpecializationType>(InjectedType.
getTypePtr());
6837 return getInjectedTST()->getTemplateName();
6903 TypeWithKeywordBits.Keyword = llvm::to_underlying(Keyword);
6916 static TagTypeKind getTagTypeKindForTypeSpec(
unsigned TypeSpec);
6931 return getKeywordName(getKeywordForTagTypeKind(
Kind));
6948 public llvm::FoldingSetNode,
6949 private llvm::TrailingObjects<ElaboratedType, TagDecl *> {
6951 friend TrailingObjects;
6970 NamedType->getDependence() |
6974 NNS(NNS), NamedType(NamedType) {
6975 ElaboratedTypeBits.HasOwnedTagDecl =
false;
6977 ElaboratedTypeBits.HasOwnedTagDecl =
true;
6978 *getTrailingObjects<TagDecl *>() = OwnedTagDecl;
6998 return ElaboratedTypeBits.HasOwnedTagDecl ? *getTrailingObjects<TagDecl *>()
7003 Profile(
ID, getKeyword(), NNS, NamedType, getOwnedTagDecl());
7009 ID.AddInteger(llvm::to_underlying(Keyword));
7012 ID.AddPointer(OwnedTagDecl);
7044 NNS(NNS), Name(Name) {
7063 Profile(
ID, getKeyword(), NNS, Name);
7068 ID.AddInteger(llvm::to_underlying(Keyword));
7070 ID.AddPointer(Name);
7082 public llvm::FoldingSetNode {
7103 DependentTemplateSpecializationTypeBits.NumArgs};
7110 Profile(
ID, Context, getKeyword(), NNS, Name, template_arguments());
7113 static void Profile(llvm::FoldingSetNodeID &
ID,
7121 return T->
getTypeClass() == DependentTemplateSpecialization;
7154 std::optional<unsigned> NumExpansions)
7155 :
Type(PackExpansion, Canon,
7160 PackExpansionTypeBits.NumExpansions =
7161 NumExpansions ? *NumExpansions + 1 : 0;
7173 if (PackExpansionTypeBits.NumExpansions)
7174 return PackExpansionTypeBits.NumExpansions - 1;
7175 return std::nullopt;
7182 Profile(
ID, getPattern(), getNumExpansions());
7186 std::optional<unsigned> NumExpansions) {
7188 ID.AddBoolean(NumExpansions.has_value());
7190 ID.AddInteger(*NumExpansions);
7210 return static_cast<T*
>(
this)->getProtocolStorageImpl();
7214 static_cast<T*
>(
this)->setNumProtocolsImpl(N);
7218 setNumProtocols(protocols.size());
7219 assert(getNumProtocols() == protocols.size() &&
7220 "bitfield overflow in protocol count");
7221 if (!protocols.empty())
7222 memcpy(getProtocolStorage(), protocols.data(),
7239 return static_cast<const T*
>(
this)->getNumProtocolsImpl();
7244 assert(I < getNumProtocols() &&
"Out-of-range protocol access");
7245 return qual_begin()[I];
7258 public llvm::FoldingSetNode {
7263 unsigned NumProtocols : 6;
7274 unsigned getNumProtocolsImpl()
const {
7275 return NumProtocols;
7278 void setNumProtocolsImpl(
unsigned N) {
7282 ObjCTypeParamType(
const ObjCTypeParamDecl *
D,
7284 ArrayRef<ObjCProtocolDecl *> protocols);
7294 void Profile(llvm::FoldingSetNodeID &
ID);
7295 static void Profile(llvm::FoldingSetNodeID &
ID,
7351 mutable llvm::PointerIntPair<const ObjCObjectType *, 1, bool>
7352 CachedSuperClassType;
7355 const QualType *getTypeArgStorage()
const {
7362 unsigned getNumProtocolsImpl()
const {
7363 return ObjCObjectTypeBits.NumProtocols;
7365 void setNumProtocolsImpl(
unsigned N) {
7366 ObjCObjectTypeBits.NumProtocols = N;
7380 ObjCObjectTypeBits.NumProtocols = 0;
7381 ObjCObjectTypeBits.NumTypeArgs = 0;
7382 ObjCObjectTypeBits.IsKindOf = 0;
7385 void computeSuperClassTypeSlow()
const;
7397 return getBaseType()->isSpecificBuiltinType(BuiltinType::ObjCId);
7401 return getBaseType()->isSpecificBuiltinType(BuiltinType::ObjCClass);
7407 if (!qual_empty())
return false;
7408 if (
const BuiltinType *
T = getBaseType()->getAs<BuiltinType>())
7409 return T->getKind() == BuiltinType::ObjCId ||
7410 T->getKind() == BuiltinType::ObjCClass;
7422 bool isSpecialized()
const;
7426 return ObjCObjectTypeBits.NumTypeArgs > 0;
7443 return llvm::ArrayRef(getTypeArgStorage(), ObjCObjectTypeBits.NumTypeArgs);
7450 bool isKindOfType()
const;
7459 if (!CachedSuperClassType.getInt())
7460 computeSuperClassTypeSlow();
7462 assert(CachedSuperClassType.getInt() &&
"Superclass not set?");
7463 return QualType(CachedSuperClassType.getPointer(), 0);
7496 void Profile(llvm::FoldingSetNodeID &
ID);
7497 static void Profile(llvm::FoldingSetNodeID &
ID,
7504inline QualType *ObjCObjectType::getTypeArgStorage() {
7505 return reinterpret_cast<QualType *
>(
static_cast<ObjCObjectTypeImpl*
>(
this)+1);
7508inline ObjCProtocolDecl **ObjCObjectType::getProtocolStorageImpl() {
7509 return reinterpret_cast<ObjCProtocolDecl**
>(
7510 getTypeArgStorage() + ObjCObjectTypeBits.NumTypeArgs);
7513inline ObjCProtocolDecl **ObjCTypeParamType::getProtocolStorageImpl() {
7514 return reinterpret_cast<ObjCProtocolDecl**
>(
7515 static_cast<ObjCTypeParamType*
>(
this)+1);
7568 if (
const auto *
T = dyn_cast<ObjCInterfaceType>(ObjT))
7569 return T->getDecl();
7571 baseType = ObjT->getBaseType();
7592 :
Type(ObjCObjectPointer, Canonical, Pointee->getDependence()),
7593 PointeeType(Pointee) {}
7736 QualType getSuperClassType()
const;
7748 ID.AddPointer(
T.getAsOpaquePtr());
7762 :
Type(
Atomic, Canonical, ValTy->getDependence()), ValueType(ValTy) {}
7773 Profile(
ID, getValueType());
7777 ID.AddPointer(
T.getAsOpaquePtr());
7793 :
Type(
Pipe, CanonicalPtr, elemType->getDependence()),
7804 Profile(
ID, getElementType(), isReadOnly());
7808 ID.AddPointer(
T.getAsOpaquePtr());
7822 LLVM_PREFERRED_TYPE(
bool)
7823 unsigned IsUnsigned : 1;
7824 unsigned NumBits : 24;
7841 static void Profile(llvm::FoldingSetNodeID &
ID,
bool IsUnsigned,
7843 ID.AddBoolean(IsUnsigned);
7844 ID.AddInteger(NumBits);
7852 llvm::PointerIntPair<Expr*, 1, bool> ExprAndUnsigned;
7860 Expr *getNumBitsExpr()
const;
7868 static void Profile(llvm::FoldingSetNodeID &
ID,
const ASTContext &Context,
7869 bool IsUnsigned,
Expr *NumBitsExpr);
7885 addFastQualifiers(
type.getLocalFastQualifiers());
7886 if (!
type.hasLocalNonFastQualifiers())
7887 return type.getTypePtrUnsafe();
7932 Ty->getLocallyUnqualifiedSingleStepDesugaredType().split();
7937inline const Type *QualType::getTypePtr()
const {
7938 return getCommonPtr()->BaseType;
7941inline const Type *QualType::getTypePtrOrNull()
const {
7942 return (isNull() ?
nullptr : getCommonPtr()->BaseType);
7945inline bool QualType::isReferenceable()
const {
7949 const Type &Self = **
this;
7950 if (Self.isObjectType() || Self.isReferenceType())
7953 return F->getMethodQuals().empty() && F->getRefQualifier() ==
RQ_None;
7959 if (!hasLocalNonFastQualifiers())
7961 Qualifiers::fromFastMask(getLocalFastQualifiers()));
7963 const ExtQuals *eq = getExtQualsUnsafe();
7971 if (hasLocalNonFastQualifiers())
7972 Quals = getExtQualsUnsafe()->getQualifiers();
7978 Qualifiers quals = getCommonPtr()->CanonicalType.getLocalQualifiers();
7983inline unsigned QualType::getCVRQualifiers()
const {
7984 unsigned cvr = getCommonPtr()->CanonicalType.getLocalCVRQualifiers();
7985 cvr |= getLocalCVRQualifiers();
7990 QualType canon = getCommonPtr()->CanonicalType;
7994inline bool QualType::isCanonical()
const {
7998inline bool QualType::isCanonicalAsParam()
const {
7999 if (!isCanonical())
return false;
8000 if (hasLocalQualifiers())
return false;
8002 const Type *
T = getTypePtr();
8006 return !isa<FunctionType>(
T) &&
8007 (!isa<ArrayType>(
T) || isa<ArrayParameterType>(
T));
8010inline bool QualType::isConstQualified()
const {
8011 return isLocalConstQualified() ||
8012 getCommonPtr()->CanonicalType.isLocalConstQualified();
8015inline bool QualType::isRestrictQualified()
const {
8016 return isLocalRestrictQualified() ||
8017 getCommonPtr()->CanonicalType.isLocalRestrictQualified();
8021inline bool QualType::isVolatileQualified()
const {
8022 return isLocalVolatileQualified() ||
8023 getCommonPtr()->CanonicalType.isLocalVolatileQualified();
8026inline bool QualType::hasQualifiers()
const {
8027 return hasLocalQualifiers() ||
8028 getCommonPtr()->CanonicalType.hasLocalQualifiers();
8032 if (!getTypePtr()->getCanonicalTypeInternal().hasLocalQualifiers())
8035 return QualType(getSplitUnqualifiedTypeImpl(*this).Ty, 0);
8039 if (!getTypePtr()->getCanonicalTypeInternal().hasLocalQualifiers())
8042 return getSplitUnqualifiedTypeImpl(*
this);
8045inline void QualType::removeLocalConst() {
8046 removeLocalFastQualifiers(Qualifiers::Const);
8049inline void QualType::removeLocalRestrict() {
8050 removeLocalFastQualifiers(Qualifiers::Restrict);
8053inline void QualType::removeLocalVolatile() {
8054 removeLocalFastQualifiers(Qualifiers::Volatile);
8058inline bool QualType::hasAddressSpace()
const {
8059 return getQualifiers().hasAddressSpace();
8063inline LangAS QualType::getAddressSpace()
const {
8064 return getQualifiers().getAddressSpace();
8069 return getQualifiers().getObjCGCAttr();
8072inline bool QualType::hasNonTrivialToPrimitiveDefaultInitializeCUnion()
const {
8073 if (
auto *RD = getTypePtr()->getBaseElementTypeUnsafe()->
getAsRecordDecl())
8074 return hasNonTrivialToPrimitiveDefaultInitializeCUnion(RD);
8078inline bool QualType::hasNonTrivialToPrimitiveDestructCUnion()
const {
8079 if (
auto *RD = getTypePtr()->getBaseElementTypeUnsafe()->
getAsRecordDecl())
8080 return hasNonTrivialToPrimitiveDestructCUnion(RD);
8084inline bool QualType::hasNonTrivialToPrimitiveCopyCUnion()
const {
8085 if (
auto *RD = getTypePtr()->getBaseElementTypeUnsafe()->
getAsRecordDecl())
8086 return hasNonTrivialToPrimitiveCopyCUnion(RD);
8092 if (
const auto *FT = PT->getPointeeType()->getAs<
FunctionType>())
8093 return FT->getExtInfo();
8095 return FT->getExtInfo();
8109inline bool QualType::isMoreQualifiedThan(
QualType other,
8120inline bool QualType::isAtLeastAsQualifiedAs(
QualType other,
8125 if (getUnqualifiedType()->isVoidType())
8128 return getQualifiers().compatiblyIncludes(OtherQuals, Ctx);
8147inline bool QualType::isCForbiddenLValueType()
const {
8148 return ((getTypePtr()->isVoidType() && !hasQualifiers()) ||
8149 getTypePtr()->isFunctionType());
8155inline bool Type::isFundamentalType()
const {
8156 return isVoidType() ||
8160 (isArithmeticType() && !isEnumeralType());
8166inline bool Type::isCompoundType()
const {
8170 return isArrayType() ||
8176 isReferenceType() ||
8185 isMemberPointerType();
8188inline bool Type::isFunctionType()
const {
8189 return isa<FunctionType>(CanonicalType);
8192inline bool Type::isPointerType()
const {
8193 return isa<PointerType>(CanonicalType);
8196inline bool Type::isPointerOrReferenceType()
const {
8197 return isPointerType() || isReferenceType();
8200inline bool Type::isAnyPointerType()
const {
8201 return isPointerType() || isObjCObjectPointerType();
8204inline bool Type::isSignableType()
const {
return isPointerType(); }
8206inline bool Type::isBlockPointerType()
const {
8207 return isa<BlockPointerType>(CanonicalType);
8210inline bool Type::isReferenceType()
const {
8211 return isa<ReferenceType>(CanonicalType);
8214inline bool Type::isLValueReferenceType()
const {
8215 return isa<LValueReferenceType>(CanonicalType);
8218inline bool Type::isRValueReferenceType()
const {
8219 return isa<RValueReferenceType>(CanonicalType);
8222inline bool Type::isObjectPointerType()
const {
8226 if (
const auto *
T = getAs<PointerType>())
8232inline bool Type::isFunctionPointerType()
const {
8233 if (
const auto *
T = getAs<PointerType>())
8239inline bool Type::isFunctionReferenceType()
const {
8240 if (
const auto *
T = getAs<ReferenceType>())
8246inline bool Type::isMemberPointerType()
const {
8247 return isa<MemberPointerType>(CanonicalType);
8250inline bool Type::isMemberFunctionPointerType()
const {
8251 if (
const auto *
T = getAs<MemberPointerType>())
8252 return T->isMemberFunctionPointer();
8257inline bool Type::isMemberDataPointerType()
const {
8258 if (
const auto *
T = getAs<MemberPointerType>())
8259 return T->isMemberDataPointer();
8264inline bool Type::isArrayType()
const {
8265 return isa<ArrayType>(CanonicalType);
8268inline bool Type::isConstantArrayType()
const {
8269 return isa<ConstantArrayType>(CanonicalType);
8272inline bool Type::isIncompleteArrayType()
const {
8273 return isa<IncompleteArrayType>(CanonicalType);
8276inline bool Type::isVariableArrayType()
const {
8277 return isa<VariableArrayType>(CanonicalType);
8280inline bool Type::isArrayParameterType()
const {
8281 return isa<ArrayParameterType>(CanonicalType);
8284inline bool Type::isDependentSizedArrayType()
const {
8285 return isa<DependentSizedArrayType>(CanonicalType);
8288inline bool Type::isBuiltinType()
const {
8289 return isa<BuiltinType>(CanonicalType);
8292inline bool Type::isRecordType()
const {
8293 return isa<RecordType>(CanonicalType);
8296inline bool Type::isEnumeralType()
const {
8297 return isa<EnumType>(CanonicalType);
8300inline bool Type::isAnyComplexType()
const {
8301 return isa<ComplexType>(CanonicalType);
8304inline bool Type::isVectorType()
const {
8305 return isa<VectorType>(CanonicalType);
8308inline bool Type::isExtVectorType()
const {
8309 return isa<ExtVectorType>(CanonicalType);
8312inline bool Type::isExtVectorBoolType()
const {
8313 if (!isExtVectorType())
8315 return cast<ExtVectorType>(CanonicalType)->getElementType()->isBooleanType();
8318inline bool Type::isSubscriptableVectorType()
const {
8319 return isVectorType() || isSveVLSBuiltinType();
8322inline bool Type::isMatrixType()
const {
8323 return isa<MatrixType>(CanonicalType);
8326inline bool Type::isConstantMatrixType()
const {
8327 return isa<ConstantMatrixType>(CanonicalType);
8330inline bool Type::isDependentAddressSpaceType()
const {
8331 return isa<DependentAddressSpaceType>(CanonicalType);
8334inline bool Type::isObjCObjectPointerType()
const {
8335 return isa<ObjCObjectPointerType>(CanonicalType);
8338inline bool Type::isObjCObjectType()
const {
8339 return isa<ObjCObjectType>(CanonicalType);
8342inline bool Type::isObjCObjectOrInterfaceType()
const {
8343 return isa<ObjCInterfaceType>(CanonicalType) ||
8344 isa<ObjCObjectType>(CanonicalType);
8347inline bool Type::isAtomicType()
const {
8348 return isa<AtomicType>(CanonicalType);
8351inline bool Type::isUndeducedAutoType()
const {
8352 return isa<AutoType>(CanonicalType);
8355inline bool Type::isObjCQualifiedIdType()
const {
8356 if (
const auto *OPT = getAs<ObjCObjectPointerType>())
8357 return OPT->isObjCQualifiedIdType();
8361inline bool Type::isObjCQualifiedClassType()
const {
8362 if (
const auto *OPT = getAs<ObjCObjectPointerType>())
8363 return OPT->isObjCQualifiedClassType();
8367inline bool Type::isObjCIdType()
const {
8368 if (
const auto *OPT = getAs<ObjCObjectPointerType>())
8369 return OPT->isObjCIdType();
8373inline bool Type::isObjCClassType()
const {
8374 if (
const auto *OPT = getAs<ObjCObjectPointerType>())
8375 return OPT->isObjCClassType();
8379inline bool Type::isObjCSelType()
const {
8380 if (
const auto *OPT = getAs<PointerType>())
8381 return OPT->getPointeeType()->isSpecificBuiltinType(BuiltinType::ObjCSel);
8385inline bool Type::isObjCBuiltinType()
const {
8386 return isObjCIdType() || isObjCClassType() || isObjCSelType();
8389inline bool Type::isDecltypeType()
const {
8390 return isa<DecltypeType>(
this);
8393#define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \
8394 inline bool Type::is##Id##Type() const { \
8395 return isSpecificBuiltinType(BuiltinType::Id); \
8397#include "clang/Basic/OpenCLImageTypes.def"
8399inline bool Type::isSamplerT()
const {
8400 return isSpecificBuiltinType(BuiltinType::OCLSampler);
8403inline bool Type::isEventT()
const {
8404 return isSpecificBuiltinType(BuiltinType::OCLEvent);
8407inline bool Type::isClkEventT()
const {
8408 return isSpecificBuiltinType(BuiltinType::OCLClkEvent);
8411inline bool Type::isQueueT()
const {
8412 return isSpecificBuiltinType(BuiltinType::OCLQueue);
8415inline bool Type::isReserveIDT()
const {
8416 return isSpecificBuiltinType(BuiltinType::OCLReserveID);
8419inline bool Type::isImageType()
const {
8420#define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) is##Id##Type() ||
8422#include "clang/Basic/OpenCLImageTypes.def"
8426inline bool Type::isPipeType()
const {
8427 return isa<PipeType>(CanonicalType);
8430inline bool Type::isBitIntType()
const {
8431 return isa<BitIntType>(CanonicalType);
8434#define EXT_OPAQUE_TYPE(ExtType, Id, Ext) \
8435 inline bool Type::is##Id##Type() const { \
8436 return isSpecificBuiltinType(BuiltinType::Id); \
8438#include "clang/Basic/OpenCLExtensionTypes.def"
8440inline bool Type::isOCLIntelSubgroupAVCType()
const {
8441#define INTEL_SUBGROUP_AVC_TYPE(ExtType, Id) \
8442 isOCLIntelSubgroupAVC##Id##Type() ||
8444#include "clang/Basic/OpenCLExtensionTypes.def"
8448inline bool Type::isOCLExtOpaqueType()
const {
8449#define EXT_OPAQUE_TYPE(ExtType, Id, Ext) is##Id##Type() ||
8451#include "clang/Basic/OpenCLExtensionTypes.def"
8455inline bool Type::isOpenCLSpecificType()
const {
8456 return isSamplerT() || isEventT() || isImageType() || isClkEventT() ||
8457 isQueueT() || isReserveIDT() || isPipeType() || isOCLExtOpaqueType();
8460#define HLSL_INTANGIBLE_TYPE(Name, Id, SingletonId) \
8461 inline bool Type::is##Id##Type() const { \
8462 return isSpecificBuiltinType(BuiltinType::Id); \
8464#include "clang/Basic/HLSLIntangibleTypes.def"
8466inline bool Type::isHLSLBuiltinIntangibleType()
const {
8467#define HLSL_INTANGIBLE_TYPE(Name, Id, SingletonId) is##Id##Type() ||
8469#include "clang/Basic/HLSLIntangibleTypes.def"
8473inline bool Type::isHLSLSpecificType()
const {
8474 return isHLSLBuiltinIntangibleType() || isHLSLAttributedResourceType();
8477inline bool Type::isHLSLAttributedResourceType()
const {
8478 return isa<HLSLAttributedResourceType>(
this);
8481inline bool Type::isTemplateTypeParmType()
const {
8482 return isa<TemplateTypeParmType>(CanonicalType);
8485inline bool Type::isSpecificBuiltinType(
unsigned K)
const {
8486 if (
const BuiltinType *BT = getAs<BuiltinType>()) {
8492inline bool Type::isPlaceholderType()
const {
8493 if (
const auto *BT = dyn_cast<BuiltinType>(
this))
8494 return BT->isPlaceholderType();
8499 if (
const auto *BT = dyn_cast<BuiltinType>(
this))
8500 if (BT->isPlaceholderType())
8505inline bool Type::isSpecificPlaceholderType(
unsigned K)
const {
8507 return isSpecificBuiltinType(K);
8510inline bool Type::isNonOverloadPlaceholderType()
const {
8511 if (
const auto *BT = dyn_cast<BuiltinType>(
this))
8512 return BT->isNonOverloadPlaceholderType();
8516inline bool Type::isVoidType()
const {
8517 return isSpecificBuiltinType(BuiltinType::Void);
8520inline bool Type::isHalfType()
const {
8522 return isSpecificBuiltinType(BuiltinType::Half);
8525inline bool Type::isFloat16Type()
const {
8526 return isSpecificBuiltinType(BuiltinType::Float16);
8529inline bool Type::isFloat32Type()
const {
8530 return isSpecificBuiltinType(BuiltinType::Float);
8533inline bool Type::isDoubleType()
const {
8534 return isSpecificBuiltinType(BuiltinType::Double);
8537inline bool Type::isBFloat16Type()
const {
8538 return isSpecificBuiltinType(BuiltinType::BFloat16);
8541inline bool Type::isMFloat8Type()
const {
8542 return isSpecificBuiltinType(BuiltinType::MFloat8);
8545inline bool Type::isFloat128Type()
const {
8546 return isSpecificBuiltinType(BuiltinType::Float128);
8549inline bool Type::isIbm128Type()
const {
8550 return isSpecificBuiltinType(BuiltinType::Ibm128);
8553inline bool Type::isNullPtrType()
const {
8554 return isSpecificBuiltinType(BuiltinType::NullPtr);
8560inline bool Type::isIntegerType()
const {
8561 if (
const auto *BT = dyn_cast<BuiltinType>(CanonicalType))
8562 return BT->getKind() >= BuiltinType::Bool &&
8563 BT->getKind() <= BuiltinType::Int128;
8564 if (
const EnumType *ET = dyn_cast<EnumType>(CanonicalType)) {
8570 return isBitIntType();
8573inline bool Type::isFixedPointType()
const {
8574 if (
const auto *BT = dyn_cast<BuiltinType>(CanonicalType)) {
8575 return BT->getKind() >= BuiltinType::ShortAccum &&
8576 BT->getKind() <= BuiltinType::SatULongFract;
8581inline bool Type::isFixedPointOrIntegerType()
const {
8582 return isFixedPointType() || isIntegerType();
8585inline bool Type::isConvertibleToFixedPointType()
const {
8586 return isRealFloatingType() || isFixedPointOrIntegerType();
8589inline bool Type::isSaturatedFixedPointType()
const {
8590 if (
const auto *BT = dyn_cast<BuiltinType>(CanonicalType)) {
8591 return BT->getKind() >= BuiltinType::SatShortAccum &&
8592 BT->getKind() <= BuiltinType::SatULongFract;
8597inline bool Type::isUnsaturatedFixedPointType()
const {
8598 return isFixedPointType() && !isSaturatedFixedPointType();
8601inline bool Type::isSignedFixedPointType()
const {
8602 if (
const auto *BT = dyn_cast<BuiltinType>(CanonicalType)) {
8603 return ((BT->getKind() >= BuiltinType::ShortAccum &&
8604 BT->getKind() <= BuiltinType::LongAccum) ||
8605 (BT->getKind() >= BuiltinType::ShortFract &&
8606 BT->getKind() <= BuiltinType::LongFract) ||
8607 (BT->getKind() >= BuiltinType::SatShortAccum &&
8608 BT->getKind() <= BuiltinType::SatLongAccum) ||
8609 (BT->getKind() >= BuiltinType::SatShortFract &&
8610 BT->getKind() <= BuiltinType::SatLongFract));
8615inline bool Type::isUnsignedFixedPointType()
const {
8616 return isFixedPointType() && !isSignedFixedPointType();
8619inline bool Type::isScalarType()
const {
8620 if (
const auto *BT = dyn_cast<BuiltinType>(CanonicalType))
8621 return BT->getKind() > BuiltinType::Void &&
8622 BT->getKind() <= BuiltinType::NullPtr;
8623 if (
const EnumType *ET = dyn_cast<EnumType>(CanonicalType))
8627 return isa<PointerType>(CanonicalType) ||
8628 isa<BlockPointerType>(CanonicalType) ||
8629 isa<MemberPointerType>(CanonicalType) ||
8630 isa<ComplexType>(CanonicalType) ||
8631 isa<ObjCObjectPointerType>(CanonicalType) ||
8635inline bool Type::isIntegralOrEnumerationType()
const {
8636 if (
const auto *BT = dyn_cast<BuiltinType>(CanonicalType))
8637 return BT->getKind() >= BuiltinType::Bool &&
8638 BT->getKind() <= BuiltinType::Int128;
8642 if (
const auto *ET = dyn_cast<EnumType>(CanonicalType))
8645 return isBitIntType();
8648inline bool Type::isBooleanType()
const {
8649 if (
const auto *BT = dyn_cast<BuiltinType>(CanonicalType))
8650 return BT->getKind() == BuiltinType::Bool;
8654inline bool Type::isUndeducedType()
const {
8655 auto *DT = getContainedDeducedType();
8656 return DT && !DT->isDeduced();
8661inline bool Type::isOverloadableType()
const {
8662 if (!isDependentType())
8664 return !isArrayType() && !isFunctionType() && !isAnyPointerType() &&
8665 !isMemberPointerType();
8669inline bool Type::isTypedefNameType()
const {
8670 if (getAs<TypedefType>())
8672 if (
auto *TST = getAs<TemplateSpecializationType>())
8673 return TST->isTypeAlias();
8678inline bool Type::canDecayToPointerType()
const {
8679 return isFunctionType() || (isArrayType() && !isArrayParameterType());
8682inline bool Type::hasPointerRepresentation()
const {
8683 return (isPointerType() || isReferenceType() || isBlockPointerType() ||
8684 isObjCObjectPointerType() || isNullPtrType());
8687inline bool Type::hasObjCPointerRepresentation()
const {
8688 return isObjCObjectPointerType();
8691inline const Type *Type::getBaseElementTypeUnsafe()
const {
8698inline const Type *Type::getPointeeOrArrayElementType()
const {
8700 if (
type->isAnyPointerType())
8701 return type->getPointeeType().getTypePtr();
8702 else if (
type->isArrayType())
8703 return type->getBaseElementTypeUnsafe();
8711 DiagnosticsEngine::ArgumentKind::ak_addrspace);
8720 DiagnosticsEngine::ArgumentKind::ak_qual);
8728 PD.
AddTaggedVal(
reinterpret_cast<uint64_t
>(
T.getAsOpaquePtr()),
8729 DiagnosticsEngine::ak_qualtype);
8735template <
typename T>
8737 std::integral_constant<bool, std::is_same<T, ArrayType>::value ||
8738 std::is_base_of<ArrayType, T>::value>;
8741template <
typename T>
const T *Type::getAs()
const {
8743 "ArrayType cannot be used with getAs!");
8746 if (
const auto *Ty = dyn_cast<T>(
this))
8750 if (!isa<T>(CanonicalType))
8755 return cast<T>(getUnqualifiedDesugaredType());
8758template <
typename T>
const T *Type::getAsAdjusted()
const {
8762 if (
const auto *Ty = dyn_cast<T>(
this))
8766 if (!isa<T>(CanonicalType))
8771 const Type *Ty =
this;
8773 if (
const auto *A = dyn_cast<AttributedType>(Ty))
8774 Ty = A->getModifiedType().getTypePtr();
8775 else if (
const auto *A = dyn_cast<BTFTagAttributedType>(Ty))
8776 Ty = A->getWrappedType().getTypePtr();
8777 else if (
const auto *A = dyn_cast<HLSLAttributedResourceType>(Ty))
8778 Ty = A->getWrappedType().getTypePtr();
8779 else if (
const auto *
E = dyn_cast<ElaboratedType>(Ty))
8780 Ty =
E->desugar().getTypePtr();
8781 else if (
const auto *
P = dyn_cast<ParenType>(Ty))
8782 Ty =
P->desugar().getTypePtr();
8783 else if (
const auto *A = dyn_cast<AdjustedType>(Ty))
8784 Ty = A->desugar().getTypePtr();
8785 else if (
const auto *M = dyn_cast<MacroQualifiedType>(Ty))
8786 Ty = M->desugar().getTypePtr();
8793 return dyn_cast<T>(Ty);
8798 if (
const auto *arr = dyn_cast<ArrayType>(
this))
8802 if (!isa<ArrayType>(CanonicalType))
8807 return cast<ArrayType>(getUnqualifiedDesugaredType());
8810template <
typename T>
const T *Type::castAs()
const {
8812 "ArrayType cannot be used with castAs!");
8814 if (
const auto *ty = dyn_cast<T>(
this))
return ty;
8815 assert(isa<T>(CanonicalType));
8816 return cast<T>(getUnqualifiedDesugaredType());
8819inline const ArrayType *Type::castAsArrayTypeUnsafe()
const {
8820 assert(isa<ArrayType>(CanonicalType));
8821 if (
const auto *arr = dyn_cast<ArrayType>(
this))
return arr;
8822 return cast<ArrayType>(getUnqualifiedDesugaredType());
8827 :
AdjustedType(Decayed, OriginalType, DecayedPtr, CanonicalPtr) {
8829 QualType Adjusted = getAdjustedType();
8831 assert(isa<PointerType>(Adjusted));
8838 return cast<PointerType>(Decayed)->getPointeeType();
8852 TypePtr = Pointee.getTypePtr();
8859 return FPT->getFunctionEffects();
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 std::optional< NonLoc > getIndex(ProgramStateRef State, const ElementRegion *ER, CharKind CK)
clang::CharUnits operator*(clang::CharUnits::QuantityType Scale, const clang::CharUnits &CU)
enum clang::sema::@1727::IndirectLocalPathEntry::EntryKind Kind
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.
Defines the clang::LangOptions interface.
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 QualType getPointeeType(const MemRegion *R)
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 a constant array type that does not decay to a pointer when used as a function parameter.
static bool classof(const Type *T)
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)
Attr - This represents one attribute.
An attributed type is a type to which a type attribute has been applied.
QualType getModifiedType() const
static bool classof(const Type *T)
const Attr * getAttr() const
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, const Attr *attr)
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)
[BoundsSafety] Represents a parent type class for CountAttributedType and similar sugar types that wi...
decl_iterator dependent_decl_begin() const
decl_iterator dependent_decl_end() const
unsigned getNumCoupledDecls() const
decl_range dependent_decls() const
ArrayRef< TypeCoupledDeclRefInfo > getCoupledDecls() const
llvm::iterator_range< decl_iterator > decl_range
static bool classof(const Type *T)
ArrayRef< TypeCoupledDeclRefInfo > Decls
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.
unsigned getSizeBitWidth() const
Return the bit width of the size type.
ConstantArrayType(TypeClass Tc, const ConstantArrayType *ATy, QualType Can)
uint64_t getLimitedSize() const
Return the size zero-extended to uint64_t or UINT64_MAX if the value is larger than UINT64_MAX.
bool isZeroSize() const
Return true if the size is zero.
int64_t getSExtSize() const
Return the size sign-extended as a uint64_t.
const Expr * getSizeExpr() const
Return a pointer to the size expression.
static bool classof(const Type *T)
llvm::APInt getSize() const
Return the constant array size as an APInt.
void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Ctx)
uint64_t getZExtSize() const
Return the size zero-extended as a uint64_t.
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 sugar type with __counted_by or __sized_by annotations, including their _or_null variant...
void Profile(llvm::FoldingSetNodeID &ID)
static bool classof(const Type *T)
bool isCountInBytes() const
Expr * getCountExpr() const
DynamicCountPointerKind getKind() const
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.
void Profile(llvm::FoldingSetNodeID &ID) const
TemplateName getTemplateName() const
Retrieve the name of the template that we are deducing.
static bool classof(const Type *T)
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 identifier that terminates this type name.
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(const ASTContext &Context, 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)
Wrap a function effect's condition expression in another struct so that FunctionProtoType's TrailingO...
EffectConditionExpr(Expr *E)
Expr * getCondition() const
bool operator==(const EffectConditionExpr &RHS) const
EffectConditionExpr()=default
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.
Support iteration in parallel through a pair of FunctionEffect and EffectConditionExpr containers.
bool operator==(const FunctionEffectIterator &Other) const
bool operator!=(const FunctionEffectIterator &Other) const
FunctionEffectIterator operator++()
FunctionEffectIterator(const Container &O, size_t I)
FunctionEffectWithCondition operator*() const
A mutable set of FunctionEffect::Kind.
static FunctionEffectKindSet difference(FunctionEffectKindSet LHS, FunctionEffectKindSet RHS)
bool contains(const FunctionEffect::Kind EK) const
FunctionEffectKindSet()=default
FunctionEffectKindSet(FunctionEffectsRef FX)
void insert(FunctionEffectKindSet Set)
void insert(FunctionEffectsRef FX)
void insert(FunctionEffect Effect)
A mutable set of FunctionEffects and possibly conditions attached to them.
FunctionEffectSet(const FunctionEffectsRef &FX)
FunctionEffectSet()=default
Represents an abstract function effect, using just an enumeration describing its kind.
Kind kind() const
The kind of the effect.
friend bool operator<(FunctionEffect LHS, FunctionEffect RHS)
friend bool operator==(FunctionEffect LHS, FunctionEffect RHS)
uint32_t toOpaqueInt32() const
For serialization.
friend bool operator!=(FunctionEffect LHS, FunctionEffect RHS)
Kind
Identifies the particular effect.
Flags flags() const
Flags describing some behaviors of the effect.
StringRef name() const
The description printed in diagnostics, e.g. 'nonblocking'.
static FunctionEffect fromOpaqueInt32(uint32_t Value)
friend raw_ostream & operator<<(raw_ostream &OS, const FunctionEffect &Effect)
An immutable set of FunctionEffects and possibly conditions attached to them.
ArrayRef< FunctionEffect > effects() const
ArrayRef< EffectConditionExpr > conditions() const
FunctionEffectsRef()=default
friend bool operator==(const FunctionEffectsRef &LHS, const FunctionEffectsRef &RHS)
static FunctionEffectsRef get(QualType QT)
Extract the effects from a Type if it is a function, block, or member function pointer,...
friend bool operator!=(const FunctionEffectsRef &LHS, const FunctionEffectsRef &RHS)
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
unsigned getNumFunctionEffectConditions() const
ExtParameterInfo getExtParameterInfo(unsigned I) const
ArrayRef< EffectConditionExpr > getFunctionEffectConditions() const
ExceptionSpecificationType getExceptionSpecType() const
Get the kind of exception specification on this function.
ArrayRef< FunctionEffect > getFunctionEffectsWithoutConditions() const
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
FunctionEffectsRef getFunctionEffects() 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 getNumFunctionEffects() 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...
QualType getWrappedType() const
bool hasContainedType() const
const Attributes & getAttrs() const
static bool classof(const Type *T)
static void Profile(llvm::FoldingSetNodeID &ID, QualType Wrapped, QualType Contained, const Attributes &Attrs)
QualType getContainedType() const
void Profile(llvm::FoldingSetNodeID &ID)
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
bool isFullySubstituted() const
ArrayRef< QualType > getExpansions() const
Expr * getIndexExpr() const
static bool classof(const Type *T)
bool expandsToEmptyPack() const
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)
Pointer-authentication qualifiers.
static PointerAuthQualifier fromOpaqueValue(uint32_t Opaque)
friend bool operator==(PointerAuthQualifier Lhs, PointerAuthQualifier Rhs)
bool isIsaPointer() const
static PointerAuthQualifier Create(unsigned Key, bool IsAddressDiscriminated, unsigned ExtraDiscriminator, PointerAuthenticationMode AuthenticationMode, bool IsIsaPointer, bool AuthenticatesNullValues)
friend bool operator!=(PointerAuthQualifier Lhs, PointerAuthQualifier Rhs)
bool authenticatesNullValues() const
bool isEquivalent(PointerAuthQualifier Other) const
@ MaxDiscriminator
The maximum supported pointer-authentication discriminator.
@ MaxKey
The maximum supported pointer-authentication key.
void Profile(llvm::FoldingSetNodeID &ID) const
bool isAddressDiscriminated() const
PointerAuthQualifier withoutKeyNone() const
unsigned getExtraDiscriminator() const
PointerAuthenticationMode getAuthenticationMode() const
uint32_t getAsOpaqueValue() const
PointerAuthQualifier()=default
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...
PointerAuthQualifier getPointerAuth() const
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.
bool isBitwiseCloneableType(const ASTContext &Context) const
Return true if the type is safe to bitwise copy using memcpy/memmove.
QualType withoutLocalFastQualifiers() const
void Profile(llvm::FoldingSetNodeID &ID) const
bool isAddressSpaceOverlapping(QualType T, const ASTContext &Ctx) const
Returns true if address space qualifiers overlap with T address space qualifiers.
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 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 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.
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 isMoreQualifiedThan(QualType Other, const ASTContext &Ctx) const
Determine whether this type is more qualified than the other given type, requiring exact equality for...
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.
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 isAtLeastAsQualifiedAs(QualType Other, const ASTContext &Ctx) const
Determine whether this type is at least as qualified as the other given type, requiring exact equalit...
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
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 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)
static bool isTargetAddressSpaceSupersetOf(LangAS A, LangAS B, const ASTContext &Ctx)
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 compatiblyIncludes(Qualifiers other, const ASTContext &Ctx) const
Determines if these qualifiers compatibly include another set.
bool hasUnaligned() const
unsigned getAddressSpaceAttributePrintValue() const
Get the address space attribute value to be printed by diagnostics.
bool hasAddressSpace() const
static bool isAddressSpaceSupersetOf(LangAS A, LangAS B, const ASTContext &Ctx)
Returns true if address space A is equal to or a superset of B.
Qualifiers withoutAddressSpace() const
unsigned getFastQualifiers() const
void print(raw_ostream &OS, const PrintingPolicy &Policy, bool appendSpaceIfNonEmpty=false) const
void removeAddressSpace()
@ FastWidth
The width of the "fast" qualifier mask.
@ MaxAddressSpace
The maximum supported address space number.
@ FastMask
The fast qualifier mask.
void addQualifiers(Qualifiers Q)
Add the qualifiers from the given set to this set.
static Qualifiers fromCVRMask(unsigned CVR)
void setAddressSpace(LangAS space)
unsigned getCVRUQualifiers() const
bool isEmptyWhenPrinted(const PrintingPolicy &Policy) const
PointerAuthQualifier getPointerAuth() const
void setObjCGCAttr(GC type)
Qualifiers withConst() const
bool hasObjCGCAttr() const
uint64_t getAsOpaqueValue() 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 addPointerAuth(PointerAuthQualifier Q)
void addObjCGCAttr(GC type)
bool hasPointerAuth() const
bool operator==(Qualifiers Other) const
void removeQualifiers(Qualifiers Q)
Remove the qualifiers from the given set from this set.
LangAS getAddressSpace() const
bool hasOnlyVolatile() const
void setPointerAuth(PointerAuthQualifier Q)
bool compatiblyIncludesObjCLifetime(Qualifiers other) const
Determines if these qualifiers compatibly include another set of qualifiers from the narrow perspecti...
Qualifiers getNonFastQualifiers() const
static Qualifiers fromOpaqueValue(uint64_t opaque)
bool hasStrongOrWeakObjCLifetime() const
True if the lifetime is either strong or weak.
static std::string getAddrSpaceAsString(LangAS AS)
bool hasFastQualifiers() const
bool hasOnlyRestrict() const
bool isAddressSpaceSupersetOf(Qualifiers other, const ASTContext &Ctx) const
Returns true if the address space in these qualifiers is equal to or a superset of the address space ...
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.
SubstTemplateTypeParmTypeFlag getSubstitutionFlag() const
static void Profile(llvm::FoldingSetNodeID &ID, QualType Replacement, const Decl *AssociatedDecl, unsigned Index, std::optional< unsigned > PackIndex, SubstTemplateTypeParmTypeFlag Flag)
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)
unsigned getDepth() const
[BoundsSafety] Represents information of declarations referenced by the arguments of the counted_by a...
llvm::PointerIntPair< ValueDecl *, 1, unsigned > BaseTy
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 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)
CountAttributedTypeBitfields CountAttributedTypeBits
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.
const Type * getBaseElementTypeUnsafe() const
Get the base element type of this type, potentially discarding type qualifiers.
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)
bool isFunctionType() const
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
TemplateTypeParmTypeBitfields TemplateTypeParmTypeBits
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
Represent the declaration of a variable (in which case it is an lvalue) a function (in which case it ...
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< Attr > attr
Matches attributes.
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.
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)
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.
@ Create
'create' clause, allowed on Compute and Combined constructs, plus 'data', 'enter data',...
TypeOfKind
The kind of 'typeof' expression we're after.
bool operator==(const CallGraphNode::CallRecord &LHS, const CallGraphNode::CallRecord &RHS)
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)
SubstTemplateTypeParmTypeFlag
@ ExpandPacksInPlace
Whether to expand the pack using the stored PackIndex in place.
bool isNoexceptExceptionSpec(ExceptionSpecificationType ESpecType)
TagTypeKind
The kind of a tag type.
constexpr unsigned PointerAuthKeyNone
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
const FunctionProtoType * T
PointerAuthenticationMode
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.
Diagnostic wrappers for TextAPI types for error reporting.
__UINTPTR_TYPE__ uintptr_t
An unsigned integer type with the property that any valid pointer to void can be converted to this ty...
FunctionEffectWithCondition Rejected
FunctionEffectWithCondition Kept
A FunctionEffect plus a potential boolean expression determining whether the effect is declared (e....
FunctionEffectWithCondition(FunctionEffect E, const EffectConditionExpr &C)
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
FunctionEffectsRef FunctionEffects
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...
friend bool operator==(const Attributes &LHS, const Attributes &RHS)
llvm::dxil::ResourceClass ResourceClass
friend bool operator!=(const Attributes &LHS, const Attributes &RHS)
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)