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/ErrorHandling.h"
48#include "llvm/Support/PointerLikeTypeTraits.h"
49#include "llvm/Support/TrailingObjects.h"
50#include "llvm/Support/type_traits.h"
68class TemplateParameterList;
76namespace serialization {
77 template <
class T>
class AbstractTypeReader;
114template <
typename>
class CanQual;
119class ExtQualsTypeCommonBase;
121class FunctionEffectSet;
124class ObjCInterfaceDecl;
125class ObjCProtocolDecl;
126class ObjCTypeParamDecl;
127struct PrintingPolicy;
131class TemplateArgument;
132class TemplateArgumentListInfo;
133class TemplateArgumentLoc;
134class TemplateTypeParmDecl;
135class TypedefNameDecl;
136class UnresolvedUsingTypenameDecl;
137class UsingShadowDecl;
142#define TYPE(Class, Base) class Class##Type;
143#include "clang/AST/TypeNodes.inc"
150 EnabledMask = 1 << EnabledShift,
151 AddressDiscriminatedShift = EnabledShift + EnabledBits,
152 AddressDiscriminatedBits = 1,
153 AddressDiscriminatedMask = 1 << AddressDiscriminatedShift,
154 AuthenticationModeShift =
155 AddressDiscriminatedShift + AddressDiscriminatedBits,
156 AuthenticationModeBits = 2,
157 AuthenticationModeMask = ((1 << AuthenticationModeBits) - 1)
158 << AuthenticationModeShift,
159 IsaPointerShift = AuthenticationModeShift + AuthenticationModeBits,
161 IsaPointerMask = ((1 << IsaPointerBits) - 1) << IsaPointerShift,
162 AuthenticatesNullValuesShift = IsaPointerShift + IsaPointerBits,
163 AuthenticatesNullValuesBits = 1,
164 AuthenticatesNullValuesMask = ((1 << AuthenticatesNullValuesBits) - 1)
165 << AuthenticatesNullValuesShift,
166 KeyShift = AuthenticatesNullValuesShift + AuthenticatesNullValuesBits,
168 KeyMask = ((1 << KeyBits) - 1) << KeyShift,
169 DiscriminatorShift = KeyShift + KeyBits,
170 DiscriminatorBits = 16,
171 DiscriminatorMask = ((1u << DiscriminatorBits) - 1) << DiscriminatorShift,
182 static_assert((EnabledBits + AddressDiscriminatedBits +
183 AuthenticationModeBits + IsaPointerBits +
184 AuthenticatesNullValuesBits + KeyBits + DiscriminatorBits) ==
186 "PointerAuthQualifier should be exactly 32 bits");
187 static_assert((EnabledMask + AddressDiscriminatedMask +
188 AuthenticationModeMask + IsaPointerMask +
189 AuthenticatesNullValuesMask + KeyMask + DiscriminatorMask) ==
191 "All masks should cover the entire bits");
192 static_assert((EnabledMask ^ AddressDiscriminatedMask ^
193 AuthenticationModeMask ^ IsaPointerMask ^
194 AuthenticatesNullValuesMask ^ KeyMask ^ DiscriminatorMask) ==
196 "All masks should cover the entire bits");
199 unsigned ExtraDiscriminator,
201 bool IsIsaPointer,
bool AuthenticatesNullValues)
203 (IsAddressDiscriminated
204 ? llvm::to_underlying(AddressDiscriminatedMask)
207 (llvm::to_underlying(AuthenticationMode)
208 << AuthenticationModeShift) |
209 (ExtraDiscriminator << DiscriminatorShift) |
210 (IsIsaPointer << IsaPointerShift) |
211 (AuthenticatesNullValues << AuthenticatesNullValuesShift)) {
214 assert((
Data == 0) ==
233 Create(
unsigned Key,
bool IsAddressDiscriminated,
unsigned ExtraDiscriminator,
235 bool AuthenticatesNullValues) {
240 AuthenticationMode, IsIsaPointer,
241 AuthenticatesNullValues);
245 assert((
Data == 0) ==
254 return (
Data & KeyMask) >> KeyShift;
261 return (
Data & AddressDiscriminatedMask) >> AddressDiscriminatedShift;
266 return (
Data >> DiscriminatorShift);
271 AuthenticationModeShift);
276 return (
Data & IsaPointerMask) >> IsaPointerShift;
281 return (
Data & AuthenticatesNullValuesMask) >> AuthenticatesNullValuesShift;
289 return Lhs.Data == Rhs.Data;
292 return Lhs.Data != Rhs.Data;
305 assert((
Result.Data == 0) ==
385 Q.Mask = L.Mask & R.Mask;
479 assert(!(mask & ~
CVRMask) &&
"bitmask contains non-CVR bits");
480 Mask = (Mask & ~CVRMask) | mask;
483 assert(!(mask & ~
CVRMask) &&
"bitmask contains non-CVR bits");
484 Mask &= ~static_cast<uint64_t>(mask);
490 assert(!(mask & ~
CVRMask) &&
"bitmask contains non-CVR bits");
494 assert(!(mask & ~
CVRMask & ~UMask) &&
"bitmask contains non-CVRU bits");
500 Mask = (Mask & ~UMask) | (flag ? UMask : 0);
508 Mask = (Mask & ~GCAttrMask) | (
type << GCAttrShift);
533 return ObjCLifetime((Mask & LifetimeMask) >> LifetimeShift);
536 Mask = (Mask & ~LifetimeMask) | (
type << LifetimeShift);
542 Mask |= (
type << LifetimeShift);
559 return static_cast<LangAS>(Mask >> AddressSpaceShift);
580 Mask = (Mask & ~AddressSpaceMask)
581 | (((uint32_t) space) << AddressSpaceShift);
594 Mask = (Mask & ~PtrAuthMask) |
608 assert(!(mask & ~
FastMask) &&
"bitmask contains non-fast qualifier bits");
609 Mask = (Mask & ~FastMask) | mask;
612 assert(!(mask & ~
FastMask) &&
"bitmask contains non-fast qualifier bits");
613 Mask &= ~static_cast<uint64_t>(mask);
619 assert(!(mask & ~
FastMask) &&
"bitmask contains non-fast qualifier bits");
634 bool empty()
const {
return !Mask; }
807 bool appendSpaceIfNonEmpty =
false)
const;
809 void Profile(llvm::FoldingSetNodeID &
ID)
const {
ID.AddInteger(Mask); }
816 "PointerAuthQualifier must be 32 bits");
818 static constexpr uint64_t UMask = 0x8;
819 static constexpr uint64_t UShift = 3;
820 static constexpr uint64_t GCAttrMask = 0x30;
821 static constexpr uint64_t GCAttrShift = 4;
822 static constexpr uint64_t LifetimeMask = 0x1C0;
823 static constexpr uint64_t LifetimeShift = 6;
824 static constexpr uint64_t AddressSpaceMask =
825 ~(
CVRMask | UMask | GCAttrMask | LifetimeMask);
826 static constexpr uint64_t AddressSpaceShift = 9;
827 static constexpr uint64_t PtrAuthShift = 32;
828 static constexpr uint64_t PtrAuthMask = uint64_t(0xffffffff) << PtrAuthShift;
838 : Quals(Quals), HasAtomic(HasAtomic) {}
887 std::pair<const Type *,Qualifiers>
asPair()
const {
888 return std::pair<const Type *, Qualifiers>(
Ty,
Quals);
892 return a.
Ty ==
b.Ty && a.
Quals ==
b.Quals;
895 return a.
Ty !=
b.Ty || a.
Quals !=
b.Quals;
945 llvm::PointerIntPair<llvm::PointerUnion<const Type *, const ExtQuals *>,
948 const ExtQuals *getExtQualsUnsafe()
const {
952 const Type *getTypePtrUnsafe()
const {
953 return Value.getPointer().get<
const Type*>();
956 const ExtQualsTypeCommonBase *getCommonPtr()
const {
957 assert(!
isNull() &&
"Cannot retrieve a NULL type pointer");
958 auto CommonPtrVal =
reinterpret_cast<uintptr_t>(
Value.getOpaqueValue());
960 return reinterpret_cast<ExtQualsTypeCommonBase*
>(CommonPtrVal);
992 T.Value.setFromOpaqueValue(
const_cast<void*
>(Ptr));
1009 return Value.getPointer().isNull();
1036 std::optional<NonConstantStorageReason>
1192 &&
"non-fast qualifier bits set in mask!");
1210 T.addFastQualifiers(TQs);
1223 T.removeLocalFastQualifiers();
1317 return getSingleStepDesugaredTypeImpl(*
this, Context);
1323 if (isa<ParenType>(*
this))
1330 return LHS.Value == RHS.Value;
1333 return LHS.Value != RHS.Value;
1336 return LHS.Value < RHS.Value;
1350 const Twine &PlaceHolder = Twine(),
1351 unsigned Indentation = 0)
const;
1355 unsigned Indentation = 0) {
1361 const Twine &PlaceHolder,
1362 unsigned Indentation = 0);
1379 const Twine &PlaceHolder;
1380 unsigned Indentation;
1384 const Twine &PlaceHolder,
unsigned Indentation)
1385 :
T(
T), Policy(Policy), PlaceHolder(PlaceHolder),
1386 Indentation(Indentation) {}
1390 SQT.T.
print(OS, SQT.Policy, SQT.PlaceHolder, SQT.Indentation);
1396 const Twine &PlaceHolder = Twine(),
1397 unsigned Indentation = 0)
const {
1401 void dump(
const char *
s)
const;
1403 void dump(llvm::raw_ostream &OS,
const ASTContext &Context)
const;
1543 return isDestructedTypeImpl(*
this);
1645raw_ostream &
operator<<(raw_ostream &OS, QualType QT);
1665 return P.getAsOpaquePtr();
1673 static constexpr int NumLowBitsAvailable = 0;
1693 const Type *
const BaseType;
1699 : BaseType(baseType), CanonicalType(canon) {}
1713 public llvm::FoldingSetNode {
1736 canon.isNull() ?
QualType(this_(), 0) : canon),
1738 assert(Quals.hasNonFastQualifiers()
1739 &&
"ExtQuals created with no fast qualifiers");
1740 assert(!Quals.hasFastQualifiers()
1741 &&
"ExtQuals created with fast qualifiers");
1751 return Quals.getObjCLifetime();
1761 Profile(
ID, getBaseType(), Quals);
1765 const Type *BaseType,
1768 ID.AddPointer(BaseType);
1799enum class ArraySizeModifier;
1800enum class ElaboratedTypeKeyword;
1801enum class VectorKind;
1832#define TYPE(Class, Base) Class,
1833#define LAST_TYPE(Class) TypeLast = Class
1834#define ABSTRACT_TYPE(Class, Base)
1835#include "clang/AST/TypeNodes.inc"
1840 class TypeBitfields {
1842 template <
class T>
friend class TypePropertyCache;
1845 LLVM_PREFERRED_TYPE(TypeClass)
1850 unsigned Dependence : llvm::BitWidth<TypeDependence>;
1854 LLVM_PREFERRED_TYPE(
bool)
1855 mutable unsigned CacheValid : 1;
1859 mutable unsigned CachedLinkage : 3;
1862 LLVM_PREFERRED_TYPE(
bool)
1863 mutable unsigned CachedLocalOrUnnamed : 1;
1866 LLVM_PREFERRED_TYPE(
bool)
1867 mutable unsigned FromAST : 1;
1869 bool isCacheValid()
const {
1874 assert(isCacheValid() &&
"getting linkage from invalid cache");
1875 return static_cast<Linkage>(CachedLinkage);
1878 bool hasLocalOrUnnamedType()
const {
1879 assert(isCacheValid() &&
"getting linkage from invalid cache");
1880 return CachedLocalOrUnnamed;
1883 enum { NumTypeBits = 8 + llvm::BitWidth<TypeDependence> + 6 };
1892 LLVM_PREFERRED_TYPE(TypeBitfields)
1898 unsigned IndexTypeQuals : 3;
1903 unsigned SizeModifier : 3;
1905 enum { NumArrayTypeBits = NumTypeBits + 6 };
1914 LLVM_PREFERRED_TYPE(
bool)
1915 unsigned HasExternalSize : 1;
1917 LLVM_PREFERRED_TYPE(
unsigned)
1918 unsigned SizeWidth : 5;
1924 LLVM_PREFERRED_TYPE(TypeBitfields)
1928 static constexpr unsigned NumOfBuiltinTypeBits = 9;
1929 unsigned Kind : NumOfBuiltinTypeBits;
1939 LLVM_PREFERRED_TYPE(TypeBitfields)
1945 unsigned ExtInfo : 13;
1951 unsigned RefQualifier : 2;
1960 unsigned FastTypeQuals : Qualifiers::FastWidth;
1962 LLVM_PREFERRED_TYPE(
bool)
1963 unsigned HasExtQuals : 1;
1969 unsigned NumParams : 16;
1973 unsigned ExceptionSpecType : 4;
1976 LLVM_PREFERRED_TYPE(
bool)
1977 unsigned HasExtParameterInfos : 1;
1980 LLVM_PREFERRED_TYPE(
bool)
1981 unsigned HasExtraBitfields : 1;
1984 LLVM_PREFERRED_TYPE(
bool)
1985 unsigned Variadic : 1;
1988 LLVM_PREFERRED_TYPE(
bool)
1989 unsigned HasTrailingReturn : 1;
1995 LLVM_PREFERRED_TYPE(TypeBitfields)
1999 unsigned NumTypeArgs : 7;
2002 unsigned NumProtocols : 6;
2005 LLVM_PREFERRED_TYPE(
bool)
2006 unsigned IsKindOf : 1;
2012 LLVM_PREFERRED_TYPE(TypeBitfields)
2026 LLVM_PREFERRED_TYPE(
bool)
2027 unsigned SpelledAsLValue : 1;
2031 LLVM_PREFERRED_TYPE(
bool)
2032 unsigned InnerRef : 1;
2038 LLVM_PREFERRED_TYPE(TypeBitfields)
2043 unsigned Keyword : 8;
2046 enum { NumTypeWithKeywordBits = NumTypeBits + 8 };
2055 LLVM_PREFERRED_TYPE(
bool)
2056 unsigned HasOwnedTagDecl : 1;
2063 LLVM_PREFERRED_TYPE(TypeBitfields)
2069 unsigned VecKind : 4;
2071 uint32_t NumElements;
2077 LLVM_PREFERRED_TYPE(TypeBitfields)
2081 unsigned AttrKind : 32 - NumTypeBits;
2087 LLVM_PREFERRED_TYPE(TypeBitfields)
2093 unsigned Keyword : 2;
2109 LLVM_PREFERRED_TYPE(TypeBitfields)
2118 LLVM_PREFERRED_TYPE(TypeBitfields)
2122 LLVM_PREFERRED_TYPE(
bool)
2123 unsigned hasTypeDifferentFromDecl : 1;
2129 LLVM_PREFERRED_TYPE(TypeBitfields)
2133 LLVM_PREFERRED_TYPE(
bool)
2134 unsigned hasTypeDifferentFromDecl : 1;
2140 LLVM_PREFERRED_TYPE(TypeBitfields)
2144 unsigned Depth : 15;
2147 LLVM_PREFERRED_TYPE(
bool)
2148 unsigned ParameterPack : 1;
2151 unsigned Index : 16;
2157 LLVM_PREFERRED_TYPE(TypeBitfields)
2160 LLVM_PREFERRED_TYPE(
bool)
2161 unsigned HasNonCanonicalUnderlyingType : 1;
2164 unsigned Index : 15;
2171 unsigned PackIndex : 16;
2177 LLVM_PREFERRED_TYPE(TypeBitfields)
2181 unsigned Index : 16;
2187 unsigned NumArgs : 16;
2193 LLVM_PREFERRED_TYPE(TypeBitfields)
2197 LLVM_PREFERRED_TYPE(
bool)
2198 unsigned TypeAlias : 1;
2229 LLVM_PREFERRED_TYPE(TypeBitfields)
2243 unsigned NumExpansions;
2249 LLVM_PREFERRED_TYPE(TypeBitfields)
2252 static constexpr unsigned NumCoupledDeclsBits = 4;
2253 unsigned NumCoupledDecls : NumCoupledDeclsBits;
2254 LLVM_PREFERRED_TYPE(
bool)
2255 unsigned CountInBytes : 1;
2256 LLVM_PREFERRED_TYPE(
bool)
2257 unsigned OrNull : 1;
2291 void setFromAST(
bool V =
true)
const {
2292 TypeBits.FromAST =
V;
2300 canon.isNull() ?
QualType(this_(), 0) : canon) {
2301 static_assert(
sizeof(*this) <=
2303 "changing bitfields changed sizeof(Type)!");
2304 static_assert(
alignof(
decltype(*this)) %
TypeAlignment == 0,
2305 "Insufficient alignment!");
2307 TypeBits.Dependence =
static_cast<unsigned>(
Dependence);
2308 TypeBits.CacheValid =
false;
2309 TypeBits.CachedLocalOrUnnamed =
false;
2310 TypeBits.CachedLinkage = llvm::to_underlying(Linkage::Invalid);
2311 TypeBits.FromAST =
false;
2318 TypeBits.Dependence =
static_cast<unsigned>(
D);
2355 return getDependence() & TypeDependence::UnexpandedPack;
2361 return CanonicalType ==
QualType(
this, 0);
2367 QualType getLocallyUnqualifiedSingleStepDesugaredType()
const;
2375 bool isSizelessType()
const;
2376 bool isSizelessBuiltinType()
const;
2379 bool isSizelessVectorType()
const;
2382 bool isSVESizelessBuiltinType()
const;
2385 bool isRVVSizelessBuiltinType()
const;
2388 bool isWebAssemblyExternrefType()
const;
2393 bool isWebAssemblyTableType()
const;
2398 bool isSveVLSBuiltinType()
const;
2408 bool isRVVVLSBuiltinType()
const;
2430 bool isIncompleteType(
NamedDecl **Def =
nullptr)
const;
2435 return !isFunctionType();
2443 return !isReferenceType() && !isFunctionType() && !isVoidType();
2448 bool isLiteralType(
const ASTContext &Ctx)
const;
2451 bool isStructuralType()
const;
2455 bool isStandardLayoutType()
const;
2461 bool isBuiltinType()
const;
2464 bool isSpecificBuiltinType(
unsigned K)
const;
2469 bool isPlaceholderType()
const;
2473 bool isSpecificPlaceholderType(
unsigned K)
const;
2477 bool isNonOverloadPlaceholderType()
const;
2481 bool isIntegerType()
const;
2482 bool isEnumeralType()
const;
2485 bool isScopedEnumeralType()
const;
2487 bool isCharType()
const;
2488 bool isWideCharType()
const;
2489 bool isChar8Type()
const;
2490 bool isChar16Type()
const;
2491 bool isChar32Type()
const;
2492 bool isAnyCharacterType()
const;
2493 bool isIntegralType(
const ASTContext &Ctx)
const;
2496 bool isIntegralOrEnumerationType()
const;
2499 bool isIntegralOrUnscopedEnumerationType()
const;
2500 bool isUnscopedEnumerationType()
const;
2503 bool isRealFloatingType()
const;
2506 bool isComplexType()
const;
2507 bool isAnyComplexType()
const;
2508 bool isFloatingType()
const;
2509 bool isHalfType()
const;
2510 bool isFloat16Type()
const;
2511 bool isFloat32Type()
const;
2512 bool isDoubleType()
const;
2513 bool isBFloat16Type()
const;
2514 bool isFloat128Type()
const;
2515 bool isIbm128Type()
const;
2516 bool isRealType()
const;
2517 bool isArithmeticType()
const;
2518 bool isVoidType()
const;
2519 bool isScalarType()
const;
2520 bool isAggregateType()
const;
2521 bool isFundamentalType()
const;
2522 bool isCompoundType()
const;
2526 bool isFunctionType()
const;
2529 bool isPointerType()
const;
2530 bool isPointerOrReferenceType()
const;
2531 bool isSignableType()
const;
2532 bool isAnyPointerType()
const;
2533 bool isCountAttributedType()
const;
2534 bool isBlockPointerType()
const;
2535 bool isVoidPointerType()
const;
2536 bool isReferenceType()
const;
2537 bool isLValueReferenceType()
const;
2538 bool isRValueReferenceType()
const;
2539 bool isObjectPointerType()
const;
2540 bool isFunctionPointerType()
const;
2541 bool isFunctionReferenceType()
const;
2542 bool isMemberPointerType()
const;
2543 bool isMemberFunctionPointerType()
const;
2544 bool isMemberDataPointerType()
const;
2545 bool isArrayType()
const;
2546 bool isConstantArrayType()
const;
2547 bool isIncompleteArrayType()
const;
2548 bool isVariableArrayType()
const;
2549 bool isArrayParameterType()
const;
2550 bool isDependentSizedArrayType()
const;
2552 bool isClassType()
const;
2553 bool isStructureType()
const;
2554 bool isStructureTypeWithFlexibleArrayMember()
const;
2555 bool isObjCBoxableRecordType()
const;
2556 bool isInterfaceType()
const;
2557 bool isStructureOrClassType()
const;
2558 bool isUnionType()
const;
2559 bool isComplexIntegerType()
const;
2560 bool isVectorType()
const;
2561 bool isExtVectorType()
const;
2562 bool isExtVectorBoolType()
const;
2563 bool isSubscriptableVectorType()
const;
2564 bool isMatrixType()
const;
2565 bool isConstantMatrixType()
const;
2566 bool isDependentAddressSpaceType()
const;
2567 bool isObjCObjectPointerType()
const;
2568 bool isObjCRetainableType()
const;
2569 bool isObjCLifetimeType()
const;
2570 bool isObjCIndirectLifetimeType()
const;
2571 bool isObjCNSObjectType()
const;
2572 bool isObjCIndependentClassType()
const;
2575 bool isObjCObjectType()
const;
2576 bool isObjCQualifiedInterfaceType()
const;
2577 bool isObjCQualifiedIdType()
const;
2578 bool isObjCQualifiedClassType()
const;
2579 bool isObjCObjectOrInterfaceType()
const;
2580 bool isObjCIdType()
const;
2581 bool isDecltypeType()
const;
2589 return hasAttr(attr::ObjCInertUnsafeUnretained);
2599 bool isObjCIdOrObjectKindOfType(
const ASTContext &ctx,
2602 bool isObjCClassType()
const;
2610 bool isObjCClassOrClassKindOfType()
const;
2612 bool isBlockCompatibleObjCPointerType(
ASTContext &ctx)
const;
2613 bool isObjCSelType()
const;
2614 bool isObjCBuiltinType()
const;
2615 bool isObjCARCBridgableType()
const;
2616 bool isCARCBridgableType()
const;
2617 bool isTemplateTypeParmType()
const;
2618 bool isNullPtrType()
const;
2620 bool isNothrowT()
const;
2621 bool isAlignValT()
const;
2622 bool isStdByteType()
const;
2623 bool isAtomicType()
const;
2624 bool isUndeducedAutoType()
const;
2626 bool isTypedefNameType()
const;
2628#define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \
2629 bool is##Id##Type() const;
2630#include "clang/Basic/OpenCLImageTypes.def"
2632 bool isImageType()
const;
2634 bool isSamplerT()
const;
2635 bool isEventT()
const;
2636 bool isClkEventT()
const;
2637 bool isQueueT()
const;
2638 bool isReserveIDT()
const;
2640#define EXT_OPAQUE_TYPE(ExtType, Id, Ext) \
2641 bool is##Id##Type() const;
2642#include "clang/Basic/OpenCLExtensionTypes.def"
2644 bool isOCLIntelSubgroupAVCType()
const;
2645 bool isOCLExtOpaqueType()
const;
2647 bool isPipeType()
const;
2648 bool isBitIntType()
const;
2649 bool isOpenCLSpecificType()
const;
2651#define HLSL_INTANGIBLE_TYPE(Name, Id, SingletonId) bool is##Id##Type() const;
2652#include "clang/Basic/HLSLIntangibleTypes.def"
2653 bool isHLSLSpecificType()
const;
2658 bool isObjCARCImplicitlyUnretainedType()
const;
2661 bool isCUDADeviceBuiltinSurfaceType()
const;
2663 bool isCUDADeviceBuiltinTextureType()
const;
2682 ScalarTypeKind getScalarTypeKind()
const;
2690 return getDependence() & TypeDependence::Error;
2696 return getDependence() & TypeDependence::Dependent;
2704 return getDependence() & TypeDependence::Instantiation;
2710 bool isUndeducedType()
const;
2714 return getDependence() & TypeDependence::VariablyModified;
2719 bool hasSizedVLAType()
const;
2722 bool hasUnnamedOrLocalType()
const;
2724 bool isOverloadableType()
const;
2727 bool isElaboratedTypeSpecifier()
const;
2729 bool canDecayToPointerType()
const;
2734 bool hasPointerRepresentation()
const;
2738 bool hasObjCPointerRepresentation()
const;
2742 bool hasIntegerRepresentation()
const;
2746 bool hasSignedIntegerRepresentation()
const;
2750 bool hasUnsignedIntegerRepresentation()
const;
2754 bool hasFloatingRepresentation()
const;
2759 const RecordType *getAsStructureType()
const;
2762 const ComplexType *getAsComplexIntegerType()
const;
2783 TagDecl *getAsTagDecl()
const;
2801 return dyn_cast_or_null<AutoType>(getContainedDeducedType());
2807 bool hasAutoForTrailingReturnType()
const;
2815 template <
typename T>
const T *getAs()
const;
2822 template <
typename T>
const T *getAsAdjusted()
const;
2826 const ArrayType *getAsArrayTypeUnsafe()
const;
2834 template <
typename T>
const T *castAs()
const;
2838 const ArrayType *castAsArrayTypeUnsafe()
const;
2847 const Type *getBaseElementTypeUnsafe()
const;
2852 const Type *getArrayElementTypeNoTypeQual()
const;
2857 const Type *getPointeeOrArrayElementType()
const;
2865 const Type *getUnqualifiedDesugaredType()
const;
2870 bool isSignedIntegerType()
const;
2875 bool isUnsignedIntegerType()
const;
2879 bool isSignedIntegerOrEnumerationType()
const;
2883 bool isUnsignedIntegerOrEnumerationType()
const;
2887 bool isFixedPointType()
const;
2890 bool isFixedPointOrIntegerType()
const;
2893 bool isConvertibleToFixedPointType()
const;
2897 bool isSaturatedFixedPointType()
const;
2901 bool isUnsaturatedFixedPointType()
const;
2905 bool isSignedFixedPointType()
const;
2909 bool isUnsignedFixedPointType()
const;
2914 bool isConstantSizeType()
const;
2918 bool isSpecifierType()
const;
2925 return getLinkageAndVisibility().getVisibility();
2930 return getLinkageAndVisibility().isVisibilityExplicit();
2938 bool isLinkageValid()
const;
2945 std::optional<NullabilityKind> getNullability()
const;
2952 bool canHaveNullability(
bool ResultIfUnknown =
true)
const;
2969 std::optional<ArrayRef<QualType>>
2970 getObjCSubstitutions(
const DeclContext *dc)
const;
2974 bool acceptsObjCTypeParams()
const;
2976 const char *getTypeClassName()
const;
2979 return CanonicalType;
2984 void dump(llvm::raw_ostream &OS,
const ASTContext &Context)
const;
2989template <>
const TypedefType *Type::getAs()
const;
2990template <>
const UsingType *Type::getAs()
const;
2995template <>
const TemplateSpecializationType *Type::getAs()
const;
2999template <>
const AttributedType *Type::getAs()
const;
3003template <>
const BoundsAttributedType *Type::getAs()
const;
3007template <>
const CountAttributedType *Type::getAs()
const;
3011#define TYPE(Class, Base)
3012#define LEAF_TYPE(Class) \
3013template <> inline const Class##Type *Type::getAs() const { \
3014 return dyn_cast<Class##Type>(CanonicalType); \
3016template <> inline const Class##Type *Type::castAs() const { \
3017 return cast<Class##Type>(CanonicalType); \
3019#include "clang/AST/TypeNodes.inc"
3027#define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) Id,
3028#include "clang/Basic/OpenCLImageTypes.def"
3030#define EXT_OPAQUE_TYPE(ExtType, Id, Ext) Id,
3031#include "clang/Basic/OpenCLExtensionTypes.def"
3033#define SVE_TYPE(Name, Id, SingletonId) Id,
3034#include "clang/Basic/AArch64SVEACLETypes.def"
3036#define PPC_VECTOR_TYPE(Name, Id, Size) Id,
3037#include "clang/Basic/PPCTypes.def"
3039#define RVV_TYPE(Name, Id, SingletonId) Id,
3040#include "clang/Basic/RISCVVTypes.def"
3042#define WASM_TYPE(Name, Id, SingletonId) Id,
3043#include "clang/Basic/WebAssemblyReferenceTypes.def"
3045#define AMDGPU_TYPE(Name, Id, SingletonId) Id,
3046#include "clang/Basic/AMDGPUTypes.def"
3048#define HLSL_INTANGIBLE_TYPE(Name, Id, SingletonId) Id,
3049#include "clang/Basic/HLSLIntangibleTypes.def"
3051#define BUILTIN_TYPE(Id, SingletonId) Id,
3052#define LAST_BUILTIN_TYPE(Id) LastKind = Id
3053#include "clang/AST/BuiltinTypes.def"
3063 static_assert(Kind::LastKind <
3064 (1 << BuiltinTypeBitfields::NumOfBuiltinTypeBits) &&
3065 "Defined builtin type exceeds the allocated space for serial "
3067 BuiltinTypeBits.Kind = K;
3076 StringRef str =
getName(Policy);
3077 assert(!str.empty() && str.data()[str.size()] ==
'\0');
3106 return K >= Overload;
3113 return isPlaceholderTypeKind(
getKind());
3140 :
Type(
Complex, CanonicalPtr, Element->getDependence()),
3141 ElementType(Element) {}
3150 Profile(
ID, getElementType());
3154 ID.AddPointer(Element.getAsOpaquePtr());
3167 :
Type(
Paren, CanonType, InnerType->getDependence()), Inner(InnerType) {}
3176 Profile(
ID, getInnerType());
3193 :
Type(
Pointer, CanonicalPtr, Pointee->getDependence()),
3194 PointeeType(Pointee) {}
3217 using BaseTy = llvm::PointerIntPair<ValueDecl *, 1, unsigned>;
3232 bool isDeref()
const;
3234 unsigned getInt()
const;
3235 void *getOpaqueValue()
const;
3237 void setFromOpaqueValue(
void *
V);
3268 return decl_range(dependent_decl_begin(), dependent_decl_end());
3272 return {dependent_decl_begin(), dependent_decl_end()};
3275 bool referencesFieldDecls()
const;
3282 case CountAttributed:
3294 public llvm::TrailingObjects<CountAttributedType,
3295 TypeCoupledDeclRefInfo> {
3306 bool CountInBytes,
bool OrNull,
3309 unsigned numTrailingObjects(OverloadToken<TypeCoupledDeclRefInfo>)
const {
3310 return CountAttributedTypeBits.NumCoupledDecls;
3323 bool isOrNull()
const {
return CountAttributedTypeBits.OrNull; }
3327 return isCountInBytes() ? SizedByOrNull : CountedByOrNull;
3328 return isCountInBytes() ? SizedBy : CountedBy;
3332 Profile(
ID, desugar(), CountExpr, isCountInBytes(), isOrNull());
3335 static void Profile(llvm::FoldingSetNodeID &
ID,
QualType WrappedTy,
3336 Expr *CountExpr,
bool CountInBytes,
bool Nullable);
3355 :
Type(TC, CanonicalPtr, OriginalTy->getDependence()),
3356 OriginalTy(OriginalTy), AdjustedTy(AdjustedTy) {}
3366 Profile(
ID, OriginalTy, AdjustedTy);
3404 :
Type(BlockPointer, CanonicalCls, Pointee->getDependence()),
3405 PointeeType(Pointee) {}
3433 bool SpelledAsLValue)
3434 :
Type(tc, CanonicalRef, Referencee->getDependence()),
3435 PointeeType(Referencee) {
3436 ReferenceTypeBits.SpelledAsLValue = SpelledAsLValue;
3449 while (
T->isInnerRef())
3451 return T->PointeeType;
3455 Profile(
ID, PointeeType, isSpelledAsLValue());
3460 bool SpelledAsLValue) {
3462 ID.AddBoolean(SpelledAsLValue);
3476 bool SpelledAsLValue)
3518 :
Type(MemberPointer, CanonicalPtr,
3520 Pointee->getDependence()),
3521 PointeeType(Pointee),
Class(Cls) {}
3549 const Type *Class) {
3575 unsigned tq,
const Expr *sz =
nullptr);
3585 return Qualifiers::fromCVRMask(getIndexTypeCVRQualifiers());
3589 return ArrayTypeBits.IndexTypeQuals;
3607 struct ExternalSize {
3608 ExternalSize(
const llvm::APInt &Sz,
const Expr *SE)
3609 : Size(Sz), SizeExpr(SE) {}
3611 const Expr *SizeExpr;
3621 :
ArrayType(ConstantArray, Et, Can,
SM, TQ, nullptr), Size(Sz) {
3622 ConstantArrayTypeBits.HasExternalSize =
false;
3623 ConstantArrayTypeBits.SizeWidth = Width / 8;
3626 assert(Width < 0xFF &&
"Type width in bits must be less than 8 bits");
3629 ConstantArrayType(QualType Et, QualType Can, ExternalSize *SzPtr,
3630 ArraySizeModifier
SM,
unsigned TQ)
3631 : ArrayType(ConstantArray, Et, Can,
SM, TQ, SzPtr->SizeExpr),
3633 ConstantArrayTypeBits.HasExternalSize =
true;
3634 ConstantArrayTypeBits.SizeWidth = 0;
3636 assert((SzPtr->SizeExpr ==
nullptr || !Can.isNull()) &&
3637 "canonical constant array should not have size expression");
3640 static ConstantArrayType *
Create(
const ASTContext &Ctx, QualType ET,
3641 QualType Can,
const llvm::APInt &Sz,
3642 const Expr *SzExpr, ArraySizeModifier SzMod,
3647 :
ArrayType(Tc, ATy->getElementType(), Can, ATy->getSizeModifier(),
3648 ATy->getIndexTypeQualifiers().getAsOpaqueValue(), nullptr) {
3649 ConstantArrayTypeBits.HasExternalSize =
3651 if (!ConstantArrayTypeBits.HasExternalSize) {
3661 return ConstantArrayTypeBits.HasExternalSize
3663 : llvm::APInt(ConstantArrayTypeBits.SizeWidth * 8, Size);
3668 return ConstantArrayTypeBits.HasExternalSize
3669 ? SizePtr->Size.getBitWidth()
3670 :
static_cast<unsigned>(ConstantArrayTypeBits.SizeWidth * 8);
3675 return ConstantArrayTypeBits.HasExternalSize ? SizePtr->Size.isZero()
3681 return ConstantArrayTypeBits.HasExternalSize ? SizePtr->Size.getZExtValue()
3687 return ConstantArrayTypeBits.HasExternalSize ? SizePtr->Size.getSExtValue()
3688 :
static_cast<int64_t
>(Size);
3694 return ConstantArrayTypeBits.HasExternalSize
3695 ? SizePtr->Size.getLimitedValue()
3701 return ConstantArrayTypeBits.HasExternalSize ? SizePtr->SizeExpr :
nullptr;
3709 static unsigned getNumAddressingBits(
const ASTContext &Context,
3711 const llvm::APInt &NumElements);
3713 unsigned getNumAddressingBits(
const ASTContext &Context)
const;
3717 static unsigned getMaxSizeBits(
const ASTContext &Context);
3720 Profile(
ID, Ctx, getElementType(), getZExtSize(), getSizeExpr(),
3721 getSizeModifier(), getIndexTypeCVRQualifiers());
3724 static void Profile(llvm::FoldingSetNodeID &
ID,
const ASTContext &Ctx,
3756 :
ArrayType(IncompleteArray, et, can, sm, tq) {}
3769 Profile(
ID, getElementType(), getSizeModifier(),
3770 getIndexTypeCVRQualifiers());
3776 ID.AddInteger(llvm::to_underlying(SizeMod));
3777 ID.AddInteger(TypeQuals);
3808 :
ArrayType(VariableArray, et, can, sm, tq, e),
3809 SizeExpr((
Stmt*) e), Brackets(brackets) {}
3817 return (
Expr*) SizeExpr;
3832 llvm_unreachable(
"Cannot unique VariableArrayTypes.");
3872 return (
Expr*) SizeExpr;
3887 Profile(
ID, Context, getElementType(),
3888 getSizeModifier(), getIndexTypeCVRQualifiers(), getSizeExpr());
3891 static void Profile(llvm::FoldingSetNodeID &
ID,
const ASTContext &Context,
3893 unsigned TypeQuals,
Expr *
E);
3910 Expr *AddrSpaceExpr;
3933 static void Profile(llvm::FoldingSetNodeID &
ID,
const ASTContext &Context,
3973 Profile(
ID, Context, getElementType(), getSizeExpr());
3976 static void Profile(llvm::FoldingSetNodeID &
ID,
const ASTContext &Context,
4046 Profile(
ID, getElementType(), getNumElements(),
4047 getTypeClass(), getVectorKind());
4054 ID.AddInteger(NumElements);
4056 ID.AddInteger(llvm::to_underlying(VecKind));
4099 Profile(
ID, Context, getElementType(), getSizeExpr(), getVectorKind());
4102 static void Profile(llvm::FoldingSetNodeID &
ID,
const ASTContext &Context,
4117 :
VectorType(ExtVector, vecType, nElements, canonType,
4124 case 'x':
case 'r':
return 0;
4125 case 'y':
case 'g':
return 1;
4126 case 'z':
case 'b':
return 2;
4127 case 'w':
case 'a':
return 3;
4145 case 'a':
return 10;
4147 case 'b':
return 11;
4149 case 'c':
return 12;
4151 case 'd':
return 13;
4153 case 'e':
return 14;
4155 case 'f':
return 15;
4160 if (isNumericAccessor)
4161 return getNumericAccessorIdx(
c);
4163 return getPointAccessorIdx(
c);
4167 if (
int idx = getAccessorIdx(
c, isNumericAccessor)+1)
4168 return unsigned(idx-1) < getNumElements();
4193 const Expr *RowExpr =
nullptr,
const Expr *ColumnExpr =
nullptr);
4227 static constexpr unsigned MaxElementsPerDimension = (1 << 20) - 1;
4230 unsigned NColumns,
QualType CanonElementType);
4233 unsigned NColumns,
QualType CanonElementType);
4244 return getNumRows() * getNumColumns();
4249 return NumElements > 0 && NumElements <= MaxElementsPerDimension;
4254 return MaxElementsPerDimension;
4258 Profile(
ID, getElementType(), getNumRows(), getNumColumns(),
4263 unsigned NumRows,
unsigned NumColumns,
4266 ID.AddInteger(NumRows);
4267 ID.AddInteger(NumColumns);
4299 Profile(
ID, Context, getElementType(), getRowExpr(), getColumnExpr());
4302 static void Profile(llvm::FoldingSetNodeID &
ID,
const ASTContext &Context,
4338 HasPassObjSize = 0x20,
4341 unsigned char Data = 0;
4350 copy.Data = (copy.Data & ~ABIMask) |
unsigned(kind);
4360 copy.Data |= IsConsumed;
4362 copy.Data &= ~IsConsumed;
4369 Copy.Data |= HasPassObjSize;
4377 Copy.Data |= IsNoEscape;
4379 Copy.Data &= ~IsNoEscape;
4391 return lhs.Data == rhs.Data;
4395 return lhs.Data != rhs.Data;
4430 enum { CallConvMask = 0x1F };
4431 enum { NoReturnMask = 0x20 };
4432 enum { ProducesResultMask = 0x40 };
4433 enum { NoCallerSavedRegsMask = 0x80 };
4435 RegParmMask = 0x700,
4438 enum { NoCfCheckMask = 0x800 };
4439 enum { CmseNSCallMask = 0x1000 };
4440 uint16_t Bits =
CC_C;
4442 ExtInfo(
unsigned Bits) : Bits(static_cast<uint16_t>(Bits)) {}
4448 bool producesResult,
bool noCallerSavedRegs,
bool NoCfCheck,
4450 assert((!hasRegParm || regParm < 7) &&
"Invalid regparm value");
4451 Bits = ((
unsigned)cc) | (noReturn ? NoReturnMask : 0) |
4452 (producesResult ? ProducesResultMask : 0) |
4453 (noCallerSavedRegs ? NoCallerSavedRegsMask : 0) |
4454 (hasRegParm ? ((regParm + 1) << RegParmOffset) : 0) |
4455 (NoCfCheck ? NoCfCheckMask : 0) |
4456 (cmseNSCall ? CmseNSCallMask : 0);
4472 bool getHasRegParm()
const {
return ((Bits & RegParmMask) >> RegParmOffset) != 0; }
4475 unsigned RegParm = (Bits & RegParmMask) >> RegParmOffset;
4484 return Bits ==
Other.Bits;
4487 return Bits !=
Other.Bits;
4495 return ExtInfo(Bits | NoReturnMask);
4497 return ExtInfo(Bits & ~NoReturnMask);
4502 return ExtInfo(Bits | ProducesResultMask);
4504 return ExtInfo(Bits & ~ProducesResultMask);
4509 return ExtInfo(Bits | CmseNSCallMask);
4511 return ExtInfo(Bits & ~CmseNSCallMask);
4515 if (noCallerSavedRegs)
4516 return ExtInfo(Bits | NoCallerSavedRegsMask);
4518 return ExtInfo(Bits & ~NoCallerSavedRegsMask);
4523 return ExtInfo(Bits | NoCfCheckMask);
4525 return ExtInfo(Bits & ~NoCfCheckMask);
4529 assert(RegParm < 7 &&
"Invalid regparm value");
4530 return ExtInfo((Bits & ~RegParmMask) |
4531 ((RegParm + 1) << RegParmOffset));
4535 return ExtInfo((Bits & ~CallConvMask) | (
unsigned) cc);
4539 ID.AddInteger(Bits);
4557 LLVM_PREFERRED_TYPE(
bool)
4560 LLVM_PREFERRED_TYPE(
bool)
4561 unsigned EffectsHaveConditions : 1;
4562 unsigned NumFunctionEffects : 4;
4565 : NumExceptionType(0), HasArmTypeAttributes(
false),
4566 EffectsHaveConditions(
false), NumFunctionEffects(0) {}
4573 SME_NormalFunction = 0,
4574 SME_PStateSMEnabledMask = 1 << 0,
4575 SME_PStateSMCompatibleMask = 1 << 1,
4579 SME_ZAMask = 0b111 << SME_ZAShift,
4581 SME_ZT0Mask = 0b111 << SME_ZT0Shift,
4597 return (
ArmStateValue)((AttrBits & SME_ZAMask) >> SME_ZAShift);
4601 return (
ArmStateValue)((AttrBits & SME_ZT0Mask) >> SME_ZT0Shift);
4619 FunctionTypeBits.ExtInfo = Info.Bits;
4623 if (isFunctionProtoType())
4624 return Qualifiers::fromFastMask(FunctionTypeBits.FastTypeQuals);
4644 static_assert((
~Qualifiers::FastMask & Qualifiers::CVRMask) == 0,
4645 "Const, volatile and restrict are assumed to be a subset of "
4646 "the fast qualifiers.");
4648 bool isConst()
const {
return getFastTypeQuals().hasConst(); }
4649 bool isVolatile()
const {
return getFastTypeQuals().hasVolatile(); }
4650 bool isRestrict()
const {
return getFastTypeQuals().hasRestrict(); }
4658 static StringRef getNameForCallConv(
CallingConv CC);
4673 Result->getDependence() &
4685 Profile(
ID, getReturnType(), getExtInfo());
4720 FE_InferrableOnCallees = 0x1,
4723 FE_ExcludeThrow = 0x2,
4724 FE_ExcludeCatch = 0x4,
4725 FE_ExcludeObjCMessageSend = 0x8,
4726 FE_ExcludeStaticLocalVars = 0x10,
4727 FE_ExcludeThreadLocalVars = 0x20
4746 Kind oppositeKind()
const;
4757 case Kind::NonBlocking:
4758 return FE_InferrableOnCallees | FE_ExcludeThrow | FE_ExcludeCatch |
4759 FE_ExcludeObjCMessageSend | FE_ExcludeStaticLocalVars |
4760 FE_ExcludeThreadLocalVars;
4761 case Kind::NonAllocating:
4763 return FE_InferrableOnCallees | FE_ExcludeThrow | FE_ExcludeCatch |
4764 FE_ExcludeObjCMessageSend | FE_ExcludeThreadLocalVars;
4765 case Kind::Blocking:
4766 case Kind::Allocating:
4771 llvm_unreachable(
"unknown effect kind");
4775 StringRef name()
const;
4781 bool canInferOnFunction(
const Decl &Callee)
const;
4787 bool shouldDiagnoseFunctionCall(
bool Direct,
4791 return LHS.FKind == RHS.FKind;
4794 return !(LHS == RHS);
4797 return LHS.FKind < RHS.FKind;
4804 Expr *Cond =
nullptr;
4813 return Cond == RHS.Cond;
4827 : Effect(
E), Cond(C) {}
4830 std::string description()
const;
4838 const Container *Outer =
nullptr;
4845 return Idx ==
Other.Idx;
4848 return Idx !=
Other.Idx;
4857 assert(Outer !=
nullptr &&
"invalid FunctionEffectIterator");
4858 bool HasConds = !Outer->Conditions.empty();
4860 HasConds ? Outer->Conditions[Idx]
4899 : Effects(FX), Conditions(Conds) {}
4912 bool empty()
const {
return Effects.empty(); }
4913 size_t size()
const {
return Effects.size(); }
4925 return LHS.Effects == RHS.Effects && LHS.Conditions == RHS.Conditions;
4929 return !(LHS == RHS);
4932 void dump(llvm::raw_ostream &OS)
const;
4947 : Effects(FX.effects()), Conditions(FX.conditions()) {}
4949 bool empty()
const {
return Effects.empty(); }
4950 size_t size()
const {
return Effects.size(); }
4959 void dump(llvm::raw_ostream &OS)
const;
4996 public llvm::FoldingSetNode,
4997 private llvm::TrailingObjects<
4998 FunctionProtoType, QualType, SourceLocation,
4999 FunctionType::FunctionTypeExtraBitfields,
5000 FunctionType::FunctionTypeArmAttributes, FunctionType::ExceptionType,
5001 Expr *, FunctionDecl *, FunctionType::ExtParameterInfo, Qualifiers,
5002 FunctionEffect, EffectConditionExpr> {
5004 friend TrailingObjects;
5101 AArch64SMEAttributes(SME_NormalFunction) {}
5105 AArch64SMEAttributes(SME_NormalFunction) {}
5109 Result.ExceptionSpec = ESI;
5115 requiresFunctionProtoTypeArmAttributes() ||
5116 !FunctionEffects.
empty();
5120 return AArch64SMEAttributes != SME_NormalFunction;
5125 AArch64SMEAttributes |=
Kind;
5127 AArch64SMEAttributes &= ~Kind;
5132 unsigned numTrailingObjects(OverloadToken<QualType>)
const {
5133 return getNumParams();
5136 unsigned numTrailingObjects(OverloadToken<SourceLocation>)
const {
5137 return isVariadic();
5140 unsigned numTrailingObjects(OverloadToken<FunctionTypeArmAttributes>)
const {
5141 return hasArmTypeAttributes();
5144 unsigned numTrailingObjects(OverloadToken<FunctionTypeExtraBitfields>)
const {
5145 return hasExtraBitfields();
5148 unsigned numTrailingObjects(OverloadToken<ExceptionType>)
const {
5149 return getExceptionSpecSize().NumExceptionType;
5152 unsigned numTrailingObjects(OverloadToken<Expr *>)
const {
5153 return getExceptionSpecSize().NumExprPtr;
5156 unsigned numTrailingObjects(OverloadToken<FunctionDecl *>)
const {
5157 return getExceptionSpecSize().NumFunctionDeclPtr;
5160 unsigned numTrailingObjects(OverloadToken<ExtParameterInfo>)
const {
5161 return hasExtParameterInfos() ? getNumParams() : 0;
5164 unsigned numTrailingObjects(OverloadToken<Qualifiers>)
const {
5165 return hasExtQualifiers() ? 1 : 0;
5168 unsigned numTrailingObjects(OverloadToken<FunctionEffect>)
const {
5169 return getNumFunctionEffects();
5172 unsigned numTrailingObjects(OverloadToken<EffectConditionExpr>)
const {
5173 return getNumFunctionEffectConditions();
5178 static bool containsAnyUnexpandedParameterPack(
const QualType *ArgArray,
5180 for (
unsigned Idx = 0; Idx < numArgs; ++Idx)
5181 if (ArgArray[Idx]->containsUnexpandedParameterPack())
5187 FunctionProtoType(QualType result, ArrayRef<QualType> params,
5188 QualType canonical,
const ExtProtoInfo &epi);
5193 struct ExceptionSpecSizeHolder {
5194 unsigned NumExceptionType;
5195 unsigned NumExprPtr;
5196 unsigned NumFunctionDeclPtr;
5201 static ExceptionSpecSizeHolder
5202 getExceptionSpecSize(ExceptionSpecificationType EST,
unsigned NumExceptions) {
5213 return {NumExceptions, 0, 0};
5226 llvm_unreachable(
"bad exception specification kind");
5231 ExceptionSpecSizeHolder getExceptionSpecSize()
const {
5232 return getExceptionSpecSize(getExceptionSpecType(), getNumExceptions());
5236 bool hasExtraBitfields()
const {
5237 assert((getExceptionSpecType() != EST_Dynamic ||
5238 FunctionTypeBits.HasExtraBitfields) &&
5239 "ExtraBitfields are required for given ExceptionSpecType");
5240 return FunctionTypeBits.HasExtraBitfields;
5244 bool hasArmTypeAttributes()
const {
5245 return FunctionTypeBits.HasExtraBitfields &&
5246 getTrailingObjects<FunctionTypeExtraBitfields>()
5247 ->HasArmTypeAttributes;
5250 bool hasExtQualifiers()
const {
5251 return FunctionTypeBits.HasExtQuals;
5258 assert(i < getNumParams() &&
"invalid parameter index");
5259 return param_type_begin()[i];
5284 FunctionTypeBits.ExceptionSpecType);
5301 bool hasDependentExceptionSpec()
const;
5305 bool hasInstantiationDependentExceptionSpec()
const;
5310 Result.Type = getExceptionSpecType();
5312 Result.Exceptions = exceptions();
5314 Result.NoexceptExpr = getNoexceptExpr();
5316 Result.SourceDecl = getExceptionSpecDecl();
5317 Result.SourceTemplate = getExceptionSpecTemplate();
5319 Result.SourceDecl = getExceptionSpecDecl();
5327 ? getTrailingObjects<FunctionTypeExtraBitfields>()
5334 assert(i < getNumExceptions() &&
"Invalid exception number!");
5335 return exception_begin()[i];
5343 return *getTrailingObjects<Expr *>();
5354 return getTrailingObjects<FunctionDecl *>()[0];
5364 return getTrailingObjects<FunctionDecl *>()[1];
5375 return ResultIfDependent ? canThrow() !=
CT_Can : canThrow() ==
CT_Cannot;
5382 return isVariadic() ? *getTrailingObjects<SourceLocation>()
5392 bool isTemplateVariadic()
const;
5398 if (hasExtQualifiers())
5399 return *getTrailingObjects<Qualifiers>();
5401 return getFastTypeQuals();
5416 return getTrailingObjects<QualType>();
5420 return param_type_begin() + getNumParams();
5431 getTrailingObjects<ExceptionType>());
5435 return exception_begin() + getNumExceptions();
5441 return FunctionTypeBits.HasExtParameterInfos;
5445 assert(hasExtParameterInfos());
5454 if (!hasExtParameterInfos())
5456 return getTrailingObjects<ExtParameterInfo>();
5462 if (!hasArmTypeAttributes())
5463 return SME_NormalFunction;
5464 return getTrailingObjects<FunctionTypeArmAttributes>()
5465 ->AArch64SMEAttributes;
5469 assert(I < getNumParams() &&
"parameter index out of range");
5470 if (hasExtParameterInfos())
5471 return getTrailingObjects<ExtParameterInfo>()[I];
5476 assert(I < getNumParams() &&
"parameter index out of range");
5477 if (hasExtParameterInfos())
5478 return getTrailingObjects<ExtParameterInfo>()[I].getABI();
5479 return ParameterABI::Ordinary;
5483 assert(I < getNumParams() &&
"parameter index out of range");
5484 if (hasExtParameterInfos())
5485 return getTrailingObjects<ExtParameterInfo>()[I].isConsumed();
5490 return hasExtraBitfields()
5491 ? getTrailingObjects<FunctionTypeExtraBitfields>()
5492 ->NumFunctionEffects
5498 if (hasExtraBitfields()) {
5499 const auto *Bitfields = getTrailingObjects<FunctionTypeExtraBitfields>();
5500 if (Bitfields->NumFunctionEffects > 0)
5501 return {getTrailingObjects<FunctionEffect>(),
5502 Bitfields->NumFunctionEffects};
5508 if (hasExtraBitfields()) {
5509 const auto *Bitfields = getTrailingObjects<FunctionTypeExtraBitfields>();
5510 if (Bitfields->EffectsHaveConditions)
5511 return Bitfields->NumFunctionEffects;
5518 if (hasExtraBitfields()) {
5519 const auto *Bitfields = getTrailingObjects<FunctionTypeExtraBitfields>();
5520 if (Bitfields->EffectsHaveConditions)
5521 return {getTrailingObjects<EffectConditionExpr>(),
5522 Bitfields->NumFunctionEffects};
5529 if (hasExtraBitfields()) {
5530 const auto *Bitfields = getTrailingObjects<FunctionTypeExtraBitfields>();
5531 if (Bitfields->NumFunctionEffects > 0) {
5532 const size_t NumConds = Bitfields->EffectsHaveConditions
5533 ? Bitfields->NumFunctionEffects
5536 {getTrailingObjects<FunctionEffect>(),
5537 Bitfields->NumFunctionEffects},
5538 {NumConds ? getTrailingObjects<EffectConditionExpr>() :
nullptr,
5548 void printExceptionSpecification(raw_ostream &OS,
5555 void Profile(llvm::FoldingSetNodeID &
ID,
const ASTContext &Ctx);
5588 return Profile(
ID,
Decl);
5598 public llvm::FoldingSetNode,
5599 private llvm::TrailingObjects<UsingType, QualType> {
5602 friend TrailingObjects;
5630 public llvm::FoldingSetNode,
5631 private llvm::TrailingObjects<TypedefType, QualType> {
5634 friend TrailingObjects;
5656 if (!Underlying.
isNull())
5673 :
Type(MacroQualified, CanonTy, UnderlyingTy->getDependence()),
5674 UnderlyingTy(UnderlyingTy), MacroII(MacroII) {
5675 assert(isa<AttributedType>(UnderlyingTy) &&
5676 "Expected a macro qualified type to only wrap attributed types.");
5712 return static_cast<TypeOfKind>(TypeOfBits.Kind);
5719 bool isSugared()
const;
5731 public llvm::FoldingSetNode {
5737 Profile(
ID, Context, getUnderlyingExpr(),
5738 getKind() == TypeOfKind::Unqualified);
5741 static void Profile(llvm::FoldingSetNodeID &
ID,
const ASTContext &Context,
5742 Expr *
E,
bool IsUnqual);
5767 return static_cast<TypeOfKind>(TypeOfBits.Kind);
5791 bool isSugared()
const;
5807 Profile(
ID, Context, getUnderlyingExpr());
5810 static void Profile(llvm::FoldingSetNodeID &
ID,
const ASTContext &Context,
5816 public llvm::FoldingSetNode,
5817 private llvm::TrailingObjects<PackIndexingType, QualType> {
5818 friend TrailingObjects;
5839 if (hasSelectedType())
5840 return getSelectedType();
5845 assert(hasSelectedType() &&
"Type is dependant");
5846 return *(getExpansionsPtr() + *getSelectedIndex());
5849 std::optional<unsigned> getSelectedIndex()
const;
5854 return {getExpansionsPtr(), Size};
5862 if (hasSelectedType())
5863 getSelectedType().Profile(
ID);
5865 Profile(
ID, Context, getPattern(), getIndexExpr());
5867 static void Profile(llvm::FoldingSetNodeID &
ID,
const ASTContext &Context,
5871 const QualType *getExpansionsPtr()
const {
5872 return getTrailingObjects<QualType>();
5875 static TypeDependence computeDependence(QualType Pattern, Expr *IndexExpr,
5876 ArrayRef<QualType> Expansions = {});
5878 unsigned numTrailingObjects(OverloadToken<QualType>)
const {
return Size; }
5885#define TRANSFORM_TYPE_TRAIT_DEF(Enum, _) Enum,
5886#include "clang/Basic/TransformTypeTraits.def"
5894 QualType UnderlyingType;
5925 public llvm::FoldingSetNode {
5931 Profile(
ID, getBaseType(), getUTTKind());
5937 ID.AddInteger((
unsigned)UKind);
5956 bool isBeingDefined()
const;
5976 return reinterpret_cast<RecordDecl*
>(TagType::getDecl());
5981 bool hasConstFields()
const;
5999 return reinterpret_cast<EnumDecl*
>(TagType::getDecl());
6032 :
Type(Attributed, canon, equivalent->getDependence()),
6033 ModifiedType(modified), EquivalentType(equivalent) {
6034 AttributedTypeBits.AttrKind = attrKind;
6039 return static_cast<Kind>(AttributedTypeBits.AttrKind);
6063 bool isQualifier()
const;
6065 bool isMSTypeSpec()
const;
6067 bool isWebAssemblyFuncrefSpec()
const;
6069 bool isCallingConv()
const;
6071 std::optional<NullabilityKind> getImmediateNullability()
const;
6077 case NullabilityKind::NonNull:
6078 return attr::TypeNonNull;
6080 case NullabilityKind::Nullable:
6081 return attr::TypeNullable;
6083 case NullabilityKind::NullableResult:
6084 return attr::TypeNullableResult;
6086 case NullabilityKind::Unspecified:
6087 return attr::TypeNullUnspecified;
6089 llvm_unreachable(
"Unknown nullability kind.");
6101 static std::optional<NullabilityKind> stripOuterNullability(
QualType &T);
6104 Profile(
ID, getAttrKind(), ModifiedType, EquivalentType);
6109 ID.AddInteger(attrKind);
6124 const BTFTypeTagAttr *BTFAttr;
6127 const BTFTypeTagAttr *BTFAttr)
6128 :
Type(BTFTagAttributed, Canon, Wrapped->getDependence()),
6129 WrappedType(Wrapped), BTFAttr(BTFAttr) {}
6133 const BTFTypeTagAttr *
getAttr()
const {
return BTFAttr; }
6139 Profile(
ID, WrappedType, BTFAttr);
6143 const BTFTypeTagAttr *BTFAttr) {
6145 ID.AddPointer(BTFAttr);
6161 :
Type(TemplateTypeParm, Canon,
6165 assert(!TTPDecl == Canon.
isNull());
6166 TemplateTypeParmTypeBits.Depth =
D;
6167 TemplateTypeParmTypeBits.Index = I;
6168 TemplateTypeParmTypeBits.ParameterPack = PP;
6172 unsigned getDepth()
const {
return TemplateTypeParmTypeBits.Depth; }
6173 unsigned getIndex()
const {
return TemplateTypeParmTypeBits.Index; }
6175 return TemplateTypeParmTypeBits.ParameterPack;
6189 static void Profile(llvm::FoldingSetNodeID &
ID,
unsigned Depth,
6190 unsigned Index,
bool ParameterPack,
6192 ID.AddInteger(Depth);
6193 ID.AddInteger(Index);
6194 ID.AddBoolean(ParameterPack);
6195 ID.AddPointer(TTPDecl);
6212 public llvm::FoldingSetNode,
6213 private llvm::TrailingObjects<SubstTemplateTypeParmType, QualType> {
6217 Decl *AssociatedDecl;
6220 unsigned Index, std::optional<unsigned> PackIndex);
6226 return SubstTemplateTypeParmTypeBits.HasNonCanonicalUnderlyingType
6227 ? *getTrailingObjects<QualType>()
6228 : getCanonicalTypeInternal();
6241 unsigned getIndex()
const {
return SubstTemplateTypeParmTypeBits.Index; }
6244 if (SubstTemplateTypeParmTypeBits.PackIndex == 0)
6245 return std::nullopt;
6246 return SubstTemplateTypeParmTypeBits.PackIndex - 1;
6253 Profile(
ID, getReplacementType(), getAssociatedDecl(),
getIndex(),
6258 const Decl *AssociatedDecl,
unsigned Index,
6259 std::optional<unsigned> PackIndex) {
6260 Replacement.Profile(
ID);
6261 ID.AddPointer(AssociatedDecl);
6262 ID.AddInteger(Index);
6263 ID.AddInteger(PackIndex ? *PackIndex - 1 : 0);
6290 llvm::PointerIntPair<Decl *, 1, bool> AssociatedDeclAndFinal;
6293 unsigned Index,
bool Final,
6302 Decl *getAssociatedDecl()
const;
6309 unsigned getIndex()
const {
return SubstTemplateTypeParmPackTypeBits.Index; }
6312 bool getFinal()
const;
6315 return SubstTemplateTypeParmPackTypeBits.NumArgs;
6323 void Profile(llvm::FoldingSetNodeID &
ID);
6324 static void Profile(llvm::FoldingSetNodeID &
ID,
const Decl *AssociatedDecl,
6325 unsigned Index,
bool Final,
6348 ExtraDependence | (DeducedAsType.isNull()
6350 : DeducedAsType->getDependence() &
6352 DeducedAsType(DeducedAsType) {}
6357 return isSugared() ? DeducedAsType :
QualType(
this, 0);
6364 return !DeducedAsType.
isNull() || isDependentType();
6387 AutoTypeBits.NumArgs};
6391 return TypeConstraintConcept;
6395 return TypeConstraintConcept !=
nullptr;
6399 return getKeyword() == AutoTypeKeyword::DecltypeAuto;
6403 return getKeyword() == AutoTypeKeyword::GNUAutoType;
6410 void Profile(llvm::FoldingSetNodeID &
ID,
const ASTContext &Context);
6411 static void Profile(llvm::FoldingSetNodeID &
ID,
const ASTContext &Context,
6423 public llvm::FoldingSetNode {
6431 bool IsDeducedAsDependent,
QualType Canon)
6432 :
DeducedType(DeducedTemplateSpecialization, DeducedAsType,
6434 (IsDeducedAsDependent
6438 Template(Template) {}
6445 Profile(
ID, getTemplateName(), getDeducedType(), isDependentType());
6449 QualType Deduced,
bool IsDependent) {
6515 static bool anyInstantiationDependentTemplateArguments(
6521 return isa<InjectedClassNameType>(getCanonicalTypeInternal());
6539 bool isTypeAlias()
const {
return TemplateSpecializationTypeBits.TypeAlias; }
6550 TemplateSpecializationTypeBits.NumArgs};
6554 return !isDependentType() || isCurrentInstantiation() || isTypeAlias();
6558 return isTypeAlias() ? getAliasedType() : getCanonicalTypeInternal();
6561 void Profile(llvm::FoldingSetNodeID &
ID,
const ASTContext &Ctx);
6573void printTemplateArgumentList(raw_ostream &OS,
6574 ArrayRef<TemplateArgument> Args,
6575 const PrintingPolicy &Policy,
6576 const TemplateParameterList *TPL =
nullptr);
6578void printTemplateArgumentList(raw_ostream &OS,
6579 ArrayRef<TemplateArgumentLoc> Args,
6580 const PrintingPolicy &Policy,
6581 const TemplateParameterList *TPL =
nullptr);
6583void printTemplateArgumentList(raw_ostream &OS,
6584 const TemplateArgumentListInfo &Args,
6585 const PrintingPolicy &Policy,
6586 const TemplateParameterList *TPL =
nullptr);
6590bool isSubstitutedDefaultArgument(ASTContext &Ctx, TemplateArgument Arg,
6591 const NamedDecl *Param,
6592 ArrayRef<TemplateArgument> Args,
6636 Decl(
D), InjectedType(TST) {
6637 assert(isa<TemplateSpecializationType>(TST));
6646 return cast<TemplateSpecializationType>(InjectedType.
getTypePtr());
6650 return getInjectedTST()->getTemplateName();
6716 TypeWithKeywordBits.Keyword = llvm::to_underlying(Keyword);
6729 static TagTypeKind getTagTypeKindForTypeSpec(
unsigned TypeSpec);
6744 return getKeywordName(getKeywordForTagTypeKind(
Kind));
6761 public llvm::FoldingSetNode,
6762 private llvm::TrailingObjects<ElaboratedType, TagDecl *> {
6764 friend TrailingObjects;
6783 NamedType->getDependence() |
6787 NNS(NNS), NamedType(NamedType) {
6788 ElaboratedTypeBits.HasOwnedTagDecl =
false;
6790 ElaboratedTypeBits.HasOwnedTagDecl =
true;
6791 *getTrailingObjects<TagDecl *>() = OwnedTagDecl;
6811 return ElaboratedTypeBits.HasOwnedTagDecl ? *getTrailingObjects<TagDecl *>()
6816 Profile(
ID, getKeyword(), NNS, NamedType, getOwnedTagDecl());
6822 ID.AddInteger(llvm::to_underlying(Keyword));
6825 ID.AddPointer(OwnedTagDecl);
6857 NNS(NNS), Name(Name) {}
6876 Profile(
ID, getKeyword(), NNS, Name);
6881 ID.AddInteger(llvm::to_underlying(Keyword));
6883 ID.AddPointer(Name);
6895 public llvm::FoldingSetNode {
6916 DependentTemplateSpecializationTypeBits.NumArgs};
6923 Profile(
ID, Context, getKeyword(), NNS, Name, template_arguments());
6926 static void Profile(llvm::FoldingSetNodeID &
ID,
6934 return T->
getTypeClass() == DependentTemplateSpecialization;
6967 std::optional<unsigned> NumExpansions)
6968 :
Type(PackExpansion, Canon,
6973 PackExpansionTypeBits.NumExpansions =
6974 NumExpansions ? *NumExpansions + 1 : 0;
6986 if (PackExpansionTypeBits.NumExpansions)
6987 return PackExpansionTypeBits.NumExpansions - 1;
6988 return std::nullopt;
6995 Profile(
ID, getPattern(), getNumExpansions());
6999 std::optional<unsigned> NumExpansions) {
7001 ID.AddBoolean(NumExpansions.has_value());
7003 ID.AddInteger(*NumExpansions);
7023 return static_cast<T*
>(
this)->getProtocolStorageImpl();
7027 static_cast<T*
>(
this)->setNumProtocolsImpl(N);
7031 setNumProtocols(protocols.size());
7032 assert(getNumProtocols() == protocols.size() &&
7033 "bitfield overflow in protocol count");
7034 if (!protocols.empty())
7035 memcpy(getProtocolStorage(), protocols.data(),
7052 return static_cast<const T*
>(
this)->getNumProtocolsImpl();
7057 assert(I < getNumProtocols() &&
"Out-of-range protocol access");
7058 return qual_begin()[I];
7071 public llvm::FoldingSetNode {
7076 unsigned NumProtocols : 6;
7087 unsigned getNumProtocolsImpl()
const {
7088 return NumProtocols;
7091 void setNumProtocolsImpl(
unsigned N) {
7095 ObjCTypeParamType(
const ObjCTypeParamDecl *
D,
7097 ArrayRef<ObjCProtocolDecl *> protocols);
7107 void Profile(llvm::FoldingSetNodeID &
ID);
7108 static void Profile(llvm::FoldingSetNodeID &
ID,
7164 mutable llvm::PointerIntPair<const ObjCObjectType *, 1, bool>
7165 CachedSuperClassType;
7168 const QualType *getTypeArgStorage()
const {
7175 unsigned getNumProtocolsImpl()
const {
7176 return ObjCObjectTypeBits.NumProtocols;
7178 void setNumProtocolsImpl(
unsigned N) {
7179 ObjCObjectTypeBits.NumProtocols = N;
7193 ObjCObjectTypeBits.NumProtocols = 0;
7194 ObjCObjectTypeBits.NumTypeArgs = 0;
7195 ObjCObjectTypeBits.IsKindOf = 0;
7198 void computeSuperClassTypeSlow()
const;
7210 return getBaseType()->isSpecificBuiltinType(BuiltinType::ObjCId);
7214 return getBaseType()->isSpecificBuiltinType(BuiltinType::ObjCClass);
7220 if (!qual_empty())
return false;
7221 if (
const BuiltinType *
T = getBaseType()->getAs<BuiltinType>())
7222 return T->getKind() == BuiltinType::ObjCId ||
7223 T->getKind() == BuiltinType::ObjCClass;
7235 bool isSpecialized()
const;
7239 return ObjCObjectTypeBits.NumTypeArgs > 0;
7256 return llvm::ArrayRef(getTypeArgStorage(), ObjCObjectTypeBits.NumTypeArgs);
7263 bool isKindOfType()
const;
7272 if (!CachedSuperClassType.getInt())
7273 computeSuperClassTypeSlow();
7275 assert(CachedSuperClassType.getInt() &&
"Superclass not set?");
7276 return QualType(CachedSuperClassType.getPointer(), 0);
7309 void Profile(llvm::FoldingSetNodeID &
ID);
7310 static void Profile(llvm::FoldingSetNodeID &
ID,
7317inline QualType *ObjCObjectType::getTypeArgStorage() {
7318 return reinterpret_cast<QualType *
>(
static_cast<ObjCObjectTypeImpl*
>(
this)+1);
7321inline ObjCProtocolDecl **ObjCObjectType::getProtocolStorageImpl() {
7322 return reinterpret_cast<ObjCProtocolDecl**
>(
7323 getTypeArgStorage() + ObjCObjectTypeBits.NumTypeArgs);
7326inline ObjCProtocolDecl **ObjCTypeParamType::getProtocolStorageImpl() {
7327 return reinterpret_cast<ObjCProtocolDecl**
>(
7328 static_cast<ObjCTypeParamType*
>(
this)+1);
7381 if (
const auto *
T = dyn_cast<ObjCInterfaceType>(ObjT))
7382 return T->getDecl();
7384 baseType = ObjT->getBaseType();
7405 :
Type(ObjCObjectPointer, Canonical, Pointee->getDependence()),
7406 PointeeType(Pointee) {}
7549 QualType getSuperClassType()
const;
7561 ID.AddPointer(
T.getAsOpaquePtr());
7575 :
Type(
Atomic, Canonical, ValTy->getDependence()), ValueType(ValTy) {}
7586 Profile(
ID, getValueType());
7590 ID.AddPointer(
T.getAsOpaquePtr());
7606 :
Type(
Pipe, CanonicalPtr, elemType->getDependence()),
7617 Profile(
ID, getElementType(), isReadOnly());
7621 ID.AddPointer(
T.getAsOpaquePtr());
7635 LLVM_PREFERRED_TYPE(
bool)
7636 unsigned IsUnsigned : 1;
7637 unsigned NumBits : 24;
7654 static void Profile(llvm::FoldingSetNodeID &
ID,
bool IsUnsigned,
7656 ID.AddBoolean(IsUnsigned);
7657 ID.AddInteger(NumBits);
7665 llvm::PointerIntPair<Expr*, 1, bool> ExprAndUnsigned;
7673 Expr *getNumBitsExpr()
const;
7681 static void Profile(llvm::FoldingSetNodeID &
ID,
const ASTContext &Context,
7682 bool IsUnsigned,
Expr *NumBitsExpr);
7698 addFastQualifiers(
type.getLocalFastQualifiers());
7699 if (!
type.hasLocalNonFastQualifiers())
7700 return type.getTypePtrUnsafe();
7745 Ty->getLocallyUnqualifiedSingleStepDesugaredType().split();
7750inline const Type *QualType::getTypePtr()
const {
7751 return getCommonPtr()->BaseType;
7754inline const Type *QualType::getTypePtrOrNull()
const {
7755 return (isNull() ?
nullptr : getCommonPtr()->BaseType);
7758inline bool QualType::isReferenceable()
const {
7762 const Type &Self = **
this;
7763 if (Self.isObjectType() || Self.isReferenceType())
7766 return F->getMethodQuals().empty() && F->getRefQualifier() ==
RQ_None;
7772 if (!hasLocalNonFastQualifiers())
7774 Qualifiers::fromFastMask(getLocalFastQualifiers()));
7776 const ExtQuals *eq = getExtQualsUnsafe();
7784 if (hasLocalNonFastQualifiers())
7785 Quals = getExtQualsUnsafe()->getQualifiers();
7791 Qualifiers quals = getCommonPtr()->CanonicalType.getLocalQualifiers();
7796inline unsigned QualType::getCVRQualifiers()
const {
7797 unsigned cvr = getCommonPtr()->CanonicalType.getLocalCVRQualifiers();
7798 cvr |= getLocalCVRQualifiers();
7803 QualType canon = getCommonPtr()->CanonicalType;
7807inline bool QualType::isCanonical()
const {
7811inline bool QualType::isCanonicalAsParam()
const {
7812 if (!isCanonical())
return false;
7813 if (hasLocalQualifiers())
return false;
7815 const Type *
T = getTypePtr();
7819 return !isa<FunctionType>(
T) &&
7820 (!isa<ArrayType>(
T) || isa<ArrayParameterType>(
T));
7823inline bool QualType::isConstQualified()
const {
7824 return isLocalConstQualified() ||
7825 getCommonPtr()->CanonicalType.isLocalConstQualified();
7828inline bool QualType::isRestrictQualified()
const {
7829 return isLocalRestrictQualified() ||
7830 getCommonPtr()->CanonicalType.isLocalRestrictQualified();
7834inline bool QualType::isVolatileQualified()
const {
7835 return isLocalVolatileQualified() ||
7836 getCommonPtr()->CanonicalType.isLocalVolatileQualified();
7839inline bool QualType::hasQualifiers()
const {
7840 return hasLocalQualifiers() ||
7841 getCommonPtr()->CanonicalType.hasLocalQualifiers();
7845 if (!getTypePtr()->getCanonicalTypeInternal().hasLocalQualifiers())
7848 return QualType(getSplitUnqualifiedTypeImpl(*this).Ty, 0);
7852 if (!getTypePtr()->getCanonicalTypeInternal().hasLocalQualifiers())
7855 return getSplitUnqualifiedTypeImpl(*
this);
7858inline void QualType::removeLocalConst() {
7859 removeLocalFastQualifiers(Qualifiers::Const);
7862inline void QualType::removeLocalRestrict() {
7863 removeLocalFastQualifiers(Qualifiers::Restrict);
7866inline void QualType::removeLocalVolatile() {
7867 removeLocalFastQualifiers(Qualifiers::Volatile);
7871inline bool QualType::hasAddressSpace()
const {
7872 return getQualifiers().hasAddressSpace();
7876inline LangAS QualType::getAddressSpace()
const {
7877 return getQualifiers().getAddressSpace();
7882 return getQualifiers().getObjCGCAttr();
7885inline bool QualType::hasNonTrivialToPrimitiveDefaultInitializeCUnion()
const {
7886 if (
auto *RD = getTypePtr()->getBaseElementTypeUnsafe()->
getAsRecordDecl())
7887 return hasNonTrivialToPrimitiveDefaultInitializeCUnion(RD);
7891inline bool QualType::hasNonTrivialToPrimitiveDestructCUnion()
const {
7892 if (
auto *RD = getTypePtr()->getBaseElementTypeUnsafe()->
getAsRecordDecl())
7893 return hasNonTrivialToPrimitiveDestructCUnion(RD);
7897inline bool QualType::hasNonTrivialToPrimitiveCopyCUnion()
const {
7898 if (
auto *RD = getTypePtr()->getBaseElementTypeUnsafe()->
getAsRecordDecl())
7899 return hasNonTrivialToPrimitiveCopyCUnion(RD);
7905 if (
const auto *FT = PT->getPointeeType()->getAs<
FunctionType>())
7906 return FT->getExtInfo();
7908 return FT->getExtInfo();
7922inline bool QualType::isMoreQualifiedThan(
QualType other)
const {
7932inline bool QualType::isAtLeastAsQualifiedAs(
QualType other)
const {
7936 if (getUnqualifiedType()->isVoidType())
7939 return getQualifiers().compatiblyIncludes(OtherQuals);
7958inline bool QualType::isCForbiddenLValueType()
const {
7959 return ((getTypePtr()->isVoidType() && !hasQualifiers()) ||
7960 getTypePtr()->isFunctionType());
7966inline bool Type::isFundamentalType()
const {
7967 return isVoidType() ||
7971 (isArithmeticType() && !isEnumeralType());
7977inline bool Type::isCompoundType()
const {
7981 return isArrayType() ||
7987 isReferenceType() ||
7996 isMemberPointerType();
7999inline bool Type::isFunctionType()
const {
8000 return isa<FunctionType>(CanonicalType);
8003inline bool Type::isPointerType()
const {
8004 return isa<PointerType>(CanonicalType);
8007inline bool Type::isPointerOrReferenceType()
const {
8008 return isPointerType() || isReferenceType();
8011inline bool Type::isAnyPointerType()
const {
8012 return isPointerType() || isObjCObjectPointerType();
8015inline bool Type::isSignableType()
const {
return isPointerType(); }
8017inline bool Type::isBlockPointerType()
const {
8018 return isa<BlockPointerType>(CanonicalType);
8021inline bool Type::isReferenceType()
const {
8022 return isa<ReferenceType>(CanonicalType);
8025inline bool Type::isLValueReferenceType()
const {
8026 return isa<LValueReferenceType>(CanonicalType);
8029inline bool Type::isRValueReferenceType()
const {
8030 return isa<RValueReferenceType>(CanonicalType);
8033inline bool Type::isObjectPointerType()
const {
8037 if (
const auto *
T = getAs<PointerType>())
8043inline bool Type::isFunctionPointerType()
const {
8044 if (
const auto *
T = getAs<PointerType>())
8050inline bool Type::isFunctionReferenceType()
const {
8051 if (
const auto *
T = getAs<ReferenceType>())
8057inline bool Type::isMemberPointerType()
const {
8058 return isa<MemberPointerType>(CanonicalType);
8061inline bool Type::isMemberFunctionPointerType()
const {
8062 if (
const auto *
T = getAs<MemberPointerType>())
8063 return T->isMemberFunctionPointer();
8068inline bool Type::isMemberDataPointerType()
const {
8069 if (
const auto *
T = getAs<MemberPointerType>())
8070 return T->isMemberDataPointer();
8075inline bool Type::isArrayType()
const {
8076 return isa<ArrayType>(CanonicalType);
8079inline bool Type::isConstantArrayType()
const {
8080 return isa<ConstantArrayType>(CanonicalType);
8083inline bool Type::isIncompleteArrayType()
const {
8084 return isa<IncompleteArrayType>(CanonicalType);
8087inline bool Type::isVariableArrayType()
const {
8088 return isa<VariableArrayType>(CanonicalType);
8091inline bool Type::isArrayParameterType()
const {
8092 return isa<ArrayParameterType>(CanonicalType);
8095inline bool Type::isDependentSizedArrayType()
const {
8096 return isa<DependentSizedArrayType>(CanonicalType);
8099inline bool Type::isBuiltinType()
const {
8100 return isa<BuiltinType>(CanonicalType);
8103inline bool Type::isRecordType()
const {
8104 return isa<RecordType>(CanonicalType);
8107inline bool Type::isEnumeralType()
const {
8108 return isa<EnumType>(CanonicalType);
8111inline bool Type::isAnyComplexType()
const {
8112 return isa<ComplexType>(CanonicalType);
8115inline bool Type::isVectorType()
const {
8116 return isa<VectorType>(CanonicalType);
8119inline bool Type::isExtVectorType()
const {
8120 return isa<ExtVectorType>(CanonicalType);
8123inline bool Type::isExtVectorBoolType()
const {
8124 if (!isExtVectorType())
8126 return cast<ExtVectorType>(CanonicalType)->getElementType()->isBooleanType();
8129inline bool Type::isSubscriptableVectorType()
const {
8130 return isVectorType() || isSveVLSBuiltinType();
8133inline bool Type::isMatrixType()
const {
8134 return isa<MatrixType>(CanonicalType);
8137inline bool Type::isConstantMatrixType()
const {
8138 return isa<ConstantMatrixType>(CanonicalType);
8141inline bool Type::isDependentAddressSpaceType()
const {
8142 return isa<DependentAddressSpaceType>(CanonicalType);
8145inline bool Type::isObjCObjectPointerType()
const {
8146 return isa<ObjCObjectPointerType>(CanonicalType);
8149inline bool Type::isObjCObjectType()
const {
8150 return isa<ObjCObjectType>(CanonicalType);
8153inline bool Type::isObjCObjectOrInterfaceType()
const {
8154 return isa<ObjCInterfaceType>(CanonicalType) ||
8155 isa<ObjCObjectType>(CanonicalType);
8158inline bool Type::isAtomicType()
const {
8159 return isa<AtomicType>(CanonicalType);
8162inline bool Type::isUndeducedAutoType()
const {
8163 return isa<AutoType>(CanonicalType);
8166inline bool Type::isObjCQualifiedIdType()
const {
8167 if (
const auto *OPT = getAs<ObjCObjectPointerType>())
8168 return OPT->isObjCQualifiedIdType();
8172inline bool Type::isObjCQualifiedClassType()
const {
8173 if (
const auto *OPT = getAs<ObjCObjectPointerType>())
8174 return OPT->isObjCQualifiedClassType();
8178inline bool Type::isObjCIdType()
const {
8179 if (
const auto *OPT = getAs<ObjCObjectPointerType>())
8180 return OPT->isObjCIdType();
8184inline bool Type::isObjCClassType()
const {
8185 if (
const auto *OPT = getAs<ObjCObjectPointerType>())
8186 return OPT->isObjCClassType();
8190inline bool Type::isObjCSelType()
const {
8191 if (
const auto *OPT = getAs<PointerType>())
8192 return OPT->getPointeeType()->isSpecificBuiltinType(BuiltinType::ObjCSel);
8196inline bool Type::isObjCBuiltinType()
const {
8197 return isObjCIdType() || isObjCClassType() || isObjCSelType();
8200inline bool Type::isDecltypeType()
const {
8201 return isa<DecltypeType>(
this);
8204#define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \
8205 inline bool Type::is##Id##Type() const { \
8206 return isSpecificBuiltinType(BuiltinType::Id); \
8208#include "clang/Basic/OpenCLImageTypes.def"
8210inline bool Type::isSamplerT()
const {
8211 return isSpecificBuiltinType(BuiltinType::OCLSampler);
8214inline bool Type::isEventT()
const {
8215 return isSpecificBuiltinType(BuiltinType::OCLEvent);
8218inline bool Type::isClkEventT()
const {
8219 return isSpecificBuiltinType(BuiltinType::OCLClkEvent);
8222inline bool Type::isQueueT()
const {
8223 return isSpecificBuiltinType(BuiltinType::OCLQueue);
8226inline bool Type::isReserveIDT()
const {
8227 return isSpecificBuiltinType(BuiltinType::OCLReserveID);
8230inline bool Type::isImageType()
const {
8231#define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) is##Id##Type() ||
8233#include "clang/Basic/OpenCLImageTypes.def"
8237inline bool Type::isPipeType()
const {
8238 return isa<PipeType>(CanonicalType);
8241inline bool Type::isBitIntType()
const {
8242 return isa<BitIntType>(CanonicalType);
8245#define EXT_OPAQUE_TYPE(ExtType, Id, Ext) \
8246 inline bool Type::is##Id##Type() const { \
8247 return isSpecificBuiltinType(BuiltinType::Id); \
8249#include "clang/Basic/OpenCLExtensionTypes.def"
8251inline bool Type::isOCLIntelSubgroupAVCType()
const {
8252#define INTEL_SUBGROUP_AVC_TYPE(ExtType, Id) \
8253 isOCLIntelSubgroupAVC##Id##Type() ||
8255#include "clang/Basic/OpenCLExtensionTypes.def"
8259inline bool Type::isOCLExtOpaqueType()
const {
8260#define EXT_OPAQUE_TYPE(ExtType, Id, Ext) is##Id##Type() ||
8262#include "clang/Basic/OpenCLExtensionTypes.def"
8266inline bool Type::isOpenCLSpecificType()
const {
8267 return isSamplerT() || isEventT() || isImageType() || isClkEventT() ||
8268 isQueueT() || isReserveIDT() || isPipeType() || isOCLExtOpaqueType();
8271#define HLSL_INTANGIBLE_TYPE(Name, Id, SingletonId) \
8272 inline bool Type::is##Id##Type() const { \
8273 return isSpecificBuiltinType(BuiltinType::Id); \
8275#include "clang/Basic/HLSLIntangibleTypes.def"
8277inline bool Type::isHLSLSpecificType()
const {
8278#define HLSL_INTANGIBLE_TYPE(Name, Id, SingletonId) is##Id##Type() ||
8280#include "clang/Basic/HLSLIntangibleTypes.def"
8284inline bool Type::isTemplateTypeParmType()
const {
8285 return isa<TemplateTypeParmType>(CanonicalType);
8288inline bool Type::isSpecificBuiltinType(
unsigned K)
const {
8289 if (
const BuiltinType *BT = getAs<BuiltinType>()) {
8295inline bool Type::isPlaceholderType()
const {
8296 if (
const auto *BT = dyn_cast<BuiltinType>(
this))
8297 return BT->isPlaceholderType();
8302 if (
const auto *BT = dyn_cast<BuiltinType>(
this))
8303 if (BT->isPlaceholderType())
8308inline bool Type::isSpecificPlaceholderType(
unsigned K)
const {
8310 return isSpecificBuiltinType(K);
8313inline bool Type::isNonOverloadPlaceholderType()
const {
8314 if (
const auto *BT = dyn_cast<BuiltinType>(
this))
8315 return BT->isNonOverloadPlaceholderType();
8319inline bool Type::isVoidType()
const {
8320 return isSpecificBuiltinType(BuiltinType::Void);
8323inline bool Type::isHalfType()
const {
8325 return isSpecificBuiltinType(BuiltinType::Half);
8328inline bool Type::isFloat16Type()
const {
8329 return isSpecificBuiltinType(BuiltinType::Float16);
8332inline bool Type::isFloat32Type()
const {
8333 return isSpecificBuiltinType(BuiltinType::Float);
8336inline bool Type::isDoubleType()
const {
8337 return isSpecificBuiltinType(BuiltinType::Double);
8340inline bool Type::isBFloat16Type()
const {
8341 return isSpecificBuiltinType(BuiltinType::BFloat16);
8344inline bool Type::isFloat128Type()
const {
8345 return isSpecificBuiltinType(BuiltinType::Float128);
8348inline bool Type::isIbm128Type()
const {
8349 return isSpecificBuiltinType(BuiltinType::Ibm128);
8352inline bool Type::isNullPtrType()
const {
8353 return isSpecificBuiltinType(BuiltinType::NullPtr);
8359inline bool Type::isIntegerType()
const {
8360 if (
const auto *BT = dyn_cast<BuiltinType>(CanonicalType))
8361 return BT->getKind() >= BuiltinType::Bool &&
8362 BT->getKind() <= BuiltinType::Int128;
8363 if (
const EnumType *ET = dyn_cast<EnumType>(CanonicalType)) {
8369 return isBitIntType();
8372inline bool Type::isFixedPointType()
const {
8373 if (
const auto *BT = dyn_cast<BuiltinType>(CanonicalType)) {
8374 return BT->getKind() >= BuiltinType::ShortAccum &&
8375 BT->getKind() <= BuiltinType::SatULongFract;
8380inline bool Type::isFixedPointOrIntegerType()
const {
8381 return isFixedPointType() || isIntegerType();
8384inline bool Type::isConvertibleToFixedPointType()
const {
8385 return isRealFloatingType() || isFixedPointOrIntegerType();
8388inline bool Type::isSaturatedFixedPointType()
const {
8389 if (
const auto *BT = dyn_cast<BuiltinType>(CanonicalType)) {
8390 return BT->getKind() >= BuiltinType::SatShortAccum &&
8391 BT->getKind() <= BuiltinType::SatULongFract;
8396inline bool Type::isUnsaturatedFixedPointType()
const {
8397 return isFixedPointType() && !isSaturatedFixedPointType();
8400inline bool Type::isSignedFixedPointType()
const {
8401 if (
const auto *BT = dyn_cast<BuiltinType>(CanonicalType)) {
8402 return ((BT->getKind() >= BuiltinType::ShortAccum &&
8403 BT->getKind() <= BuiltinType::LongAccum) ||
8404 (BT->getKind() >= BuiltinType::ShortFract &&
8405 BT->getKind() <= BuiltinType::LongFract) ||
8406 (BT->getKind() >= BuiltinType::SatShortAccum &&
8407 BT->getKind() <= BuiltinType::SatLongAccum) ||
8408 (BT->getKind() >= BuiltinType::SatShortFract &&
8409 BT->getKind() <= BuiltinType::SatLongFract));
8414inline bool Type::isUnsignedFixedPointType()
const {
8415 return isFixedPointType() && !isSignedFixedPointType();
8418inline bool Type::isScalarType()
const {
8419 if (
const auto *BT = dyn_cast<BuiltinType>(CanonicalType))
8420 return BT->getKind() > BuiltinType::Void &&
8421 BT->getKind() <= BuiltinType::NullPtr;
8422 if (
const EnumType *ET = dyn_cast<EnumType>(CanonicalType))
8426 return isa<PointerType>(CanonicalType) ||
8427 isa<BlockPointerType>(CanonicalType) ||
8428 isa<MemberPointerType>(CanonicalType) ||
8429 isa<ComplexType>(CanonicalType) ||
8430 isa<ObjCObjectPointerType>(CanonicalType) ||
8434inline bool Type::isIntegralOrEnumerationType()
const {
8435 if (
const auto *BT = dyn_cast<BuiltinType>(CanonicalType))
8436 return BT->getKind() >= BuiltinType::Bool &&
8437 BT->getKind() <= BuiltinType::Int128;
8441 if (
const auto *ET = dyn_cast<EnumType>(CanonicalType))
8444 return isBitIntType();
8447inline bool Type::isBooleanType()
const {
8448 if (
const auto *BT = dyn_cast<BuiltinType>(CanonicalType))
8449 return BT->getKind() == BuiltinType::Bool;
8453inline bool Type::isUndeducedType()
const {
8454 auto *DT = getContainedDeducedType();
8455 return DT && !DT->isDeduced();
8460inline bool Type::isOverloadableType()
const {
8461 if (!isDependentType())
8463 return !isArrayType() && !isFunctionType() && !isAnyPointerType() &&
8464 !isMemberPointerType();
8468inline bool Type::isTypedefNameType()
const {
8469 if (getAs<TypedefType>())
8471 if (
auto *TST = getAs<TemplateSpecializationType>())
8472 return TST->isTypeAlias();
8477inline bool Type::canDecayToPointerType()
const {
8478 return isFunctionType() || (isArrayType() && !isArrayParameterType());
8481inline bool Type::hasPointerRepresentation()
const {
8482 return (isPointerType() || isReferenceType() || isBlockPointerType() ||
8483 isObjCObjectPointerType() || isNullPtrType());
8486inline bool Type::hasObjCPointerRepresentation()
const {
8487 return isObjCObjectPointerType();
8490inline const Type *Type::getBaseElementTypeUnsafe()
const {
8497inline const Type *Type::getPointeeOrArrayElementType()
const {
8499 if (
type->isAnyPointerType())
8500 return type->getPointeeType().getTypePtr();
8501 else if (
type->isArrayType())
8502 return type->getBaseElementTypeUnsafe();
8510 DiagnosticsEngine::ArgumentKind::ak_addrspace);
8519 DiagnosticsEngine::ArgumentKind::ak_qual);
8527 PD.
AddTaggedVal(
reinterpret_cast<uint64_t
>(
T.getAsOpaquePtr()),
8528 DiagnosticsEngine::ak_qualtype);
8534template <
typename T>
8536 std::integral_constant<bool, std::is_same<T, ArrayType>::value ||
8537 std::is_base_of<ArrayType, T>::value>;
8540template <
typename T>
const T *Type::getAs()
const {
8542 "ArrayType cannot be used with getAs!");
8545 if (
const auto *Ty = dyn_cast<T>(
this))
8549 if (!isa<T>(CanonicalType))
8554 return cast<T>(getUnqualifiedDesugaredType());
8557template <
typename T>
const T *Type::getAsAdjusted()
const {
8561 if (
const auto *Ty = dyn_cast<T>(
this))
8565 if (!isa<T>(CanonicalType))
8570 const Type *Ty =
this;
8572 if (
const auto *A = dyn_cast<AttributedType>(Ty))
8573 Ty = A->getModifiedType().getTypePtr();
8574 else if (
const auto *A = dyn_cast<BTFTagAttributedType>(Ty))
8575 Ty = A->getWrappedType().getTypePtr();
8576 else if (
const auto *
E = dyn_cast<ElaboratedType>(Ty))
8577 Ty =
E->desugar().getTypePtr();
8578 else if (
const auto *
P = dyn_cast<ParenType>(Ty))
8579 Ty =
P->desugar().getTypePtr();
8580 else if (
const auto *A = dyn_cast<AdjustedType>(Ty))
8581 Ty = A->desugar().getTypePtr();
8582 else if (
const auto *M = dyn_cast<MacroQualifiedType>(Ty))
8583 Ty = M->desugar().getTypePtr();
8590 return dyn_cast<T>(Ty);
8595 if (
const auto *arr = dyn_cast<ArrayType>(
this))
8599 if (!isa<ArrayType>(CanonicalType))
8604 return cast<ArrayType>(getUnqualifiedDesugaredType());
8607template <
typename T>
const T *Type::castAs()
const {
8609 "ArrayType cannot be used with castAs!");
8611 if (
const auto *ty = dyn_cast<T>(
this))
return ty;
8612 assert(isa<T>(CanonicalType));
8613 return cast<T>(getUnqualifiedDesugaredType());
8616inline const ArrayType *Type::castAsArrayTypeUnsafe()
const {
8617 assert(isa<ArrayType>(CanonicalType));
8618 if (
const auto *arr = dyn_cast<ArrayType>(
this))
return arr;
8619 return cast<ArrayType>(getUnqualifiedDesugaredType());
8624 :
AdjustedType(Decayed, OriginalType, DecayedPtr, CanonicalPtr) {
8626 QualType Adjusted = getAdjustedType();
8628 assert(isa<PointerType>(Adjusted));
8635 return cast<PointerType>(Decayed)->getPointeeType();
8653 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)
enum clang::sema::@1655::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)
An attributed type is a type to which a type attribute has been applied.
QualType getModifiedType() const
static bool classof(const Type *T)
static Kind getNullabilityAttrKind(NullabilityKind kind)
Retrieve the attribute kind corresponding to the given nullability kind.
static std::optional< NullabilityKind > stripOuterNullability(QualType &T)
Strip off the top-level nullability annotation on the given type, if it's there.
static void Profile(llvm::FoldingSetNodeID &ID, Kind attrKind, QualType modified, QualType equivalent)
QualType getEquivalentType() const
void Profile(llvm::FoldingSetNodeID &ID)
Represents a C++11 auto or C++14 decltype(auto) type, possibly constrained by a type-constraint.
ArrayRef< TemplateArgument > getTypeConstraintArguments() const
static bool classof(const Type *T)
bool isDecltypeAuto() const
ConceptDecl * getTypeConstraintConcept() const
AutoTypeKeyword getKeyword() const
bool isGNUAutoType() const
bool isConstrained() const
static bool classof(const Type *T)
const BTFTypeTagAttr * getAttr() const
QualType getWrappedType() const
void Profile(llvm::FoldingSetNodeID &ID)
static void Profile(llvm::FoldingSetNodeID &ID, QualType Wrapped, const BTFTypeTagAttr *BTFAttr)
A fixed int type of a specified bitwidth.
static bool classof(const Type *T)
static void Profile(llvm::FoldingSetNodeID &ID, bool IsUnsigned, unsigned NumBits)
void Profile(llvm::FoldingSetNodeID &ID) const
unsigned getNumBits() const
void Profile(llvm::FoldingSetNodeID &ID)
QualType getPointeeType() const
static bool classof(const Type *T)
static void Profile(llvm::FoldingSetNodeID &ID, QualType Pointee)
[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 type named by the typename specifier as an identifier.
void Profile(llvm::FoldingSetNodeID &ID)
static void Profile(llvm::FoldingSetNodeID &ID, ElaboratedTypeKeyword Keyword, NestedNameSpecifier *NNS, const IdentifierInfo *Name)
Represents an array type in C++ whose size is a value-dependent expression.
void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Context)
static bool classof(const Type *T)
SourceRange getBracketsRange() const
Expr * getSizeExpr() const
SourceLocation getLBracketLoc() const
SourceLocation getRBracketLoc() const
Represents an extended vector type where either the type or size is dependent.
Expr * getSizeExpr() const
static bool classof(const Type *T)
SourceLocation getAttributeLoc() const
void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Context)
QualType getElementType() const
Represents a matrix type where the type and the number of rows and columns is dependent on a template...
Expr * getColumnExpr() const
Expr * getRowExpr() const
void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Context)
SourceLocation getAttributeLoc() const
static bool classof(const Type *T)
Represents a template specialization type whose template cannot be resolved, e.g.
const IdentifierInfo * getIdentifier() const
void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Context)
ArrayRef< TemplateArgument > template_arguments() const
NestedNameSpecifier * getQualifier() const
static bool classof(const Type *T)
Internal representation of canonical, dependent typeof(expr) types.
void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Context)
DependentTypeOfExprType(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 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<(const FunctionEffect &LHS, const FunctionEffect &RHS)
friend bool operator==(const FunctionEffect &LHS, const FunctionEffect &RHS)
uint32_t toOpaqueInt32() const
For serialization.
friend bool operator!=(const FunctionEffect &LHS, const FunctionEffect &RHS)
Kind
Identifies the particular effect.
Flags flags() const
Flags describing some behaviors of the effect.
static FunctionEffect fromOpaqueInt32(uint32_t Value)
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...
One of these records is kept for each identifier that is lexed.
Represents a C array with an unspecified size.
void Profile(llvm::FoldingSetNodeID &ID)
static void Profile(llvm::FoldingSetNodeID &ID, QualType ET, ArraySizeModifier SizeMod, unsigned TypeQuals)
static bool classof(const Type *T)
The injected class name of a C++ class template or class template partial specialization.
static bool classof(const Type *T)
const TemplateSpecializationType * getInjectedTST() const
TemplateName getTemplateName() const
QualType getInjectedSpecializationType() const
An lvalue reference type, per C++11 [dcl.ref].
static bool classof(const Type *T)
Sugar type that represents a type that was qualified by a qualifier written as a macro invocation.
static bool classof(const Type *T)
QualType getUnderlyingType() const
const IdentifierInfo * getMacroIdentifier() const
Represents a matrix type, as defined in the Matrix Types clang extensions.
QualType getElementType() const
Returns type of the elements being stored in the matrix.
MatrixType(QualType ElementTy, QualType CanonElementTy)
static bool isValidElementType(QualType T)
Valid elements types are the following:
QualType ElementType
The element type of the matrix.
static bool classof(const Type *T)
A pointer to member type per C++ 8.3.3 - Pointers to members.
void Profile(llvm::FoldingSetNodeID &ID)
QualType getPointeeType() const
bool isMemberFunctionPointer() const
Returns true if the member type (i.e.
bool isMemberDataPointer() const
Returns true if the member type (i.e.
static void Profile(llvm::FoldingSetNodeID &ID, QualType Pointee, const Type *Class)
static bool classof(const Type *T)
const Type * getClass() const
This represents a decl that may have a name.
Represents a C++ nested name specifier, such as "\::std::vector<int>::".
Represents an ObjC class declaration.
Interfaces are the core concept in Objective-C for object oriented design.
static bool classof(const Type *T)
Represents a pointer to an Objective C object.
unsigned getNumProtocols() const
Return the number of qualifying protocols on the object type.
bool isSpecialized() const
Whether this type is specialized, meaning that it has type arguments.
qual_iterator qual_end() const
bool isObjCQualifiedClassType() const
True if this is equivalent to 'Class.
static void Profile(llvm::FoldingSetNodeID &ID, QualType T)
bool isObjCQualifiedIdType() const
True if this is equivalent to 'id.
bool isSpecializedAsWritten() const
Whether this type is specialized, meaning that it has type arguments.
bool isUnspecializedAsWritten() const
Determine whether this object type is "unspecialized" as written, meaning that it has no type argumen...
ArrayRef< QualType > getTypeArgsAsWritten() const
Retrieve the type arguments for this type.
void Profile(llvm::FoldingSetNodeID &ID)
const ObjCObjectType * getObjectType() const
Gets the type pointed to by this ObjC pointer.
ObjCObjectType::qual_iterator qual_iterator
An iterator over the qualifiers on the object type.
llvm::iterator_range< qual_iterator > qual_range
static bool classof(const Type *T)
bool isUnspecialized() const
Whether this type is unspecialized, meaning that is has no type arguments.
bool isObjCIdType() const
True if this is equivalent to the 'id' type, i.e.
ObjCProtocolDecl * getProtocol(unsigned I) const
Retrieve a qualifying protocol by index on the object type.
QualType getPointeeType() const
Gets the type pointed to by this ObjC pointer.
ObjCInterfaceDecl * getInterfaceDecl() const
If this pointer points to an Objective @interface type, gets the declaration for that interface.
bool isObjCClassType() const
True if this is equivalent to the 'Class' type, i.e.
bool isObjCIdOrClassType() const
True if this is equivalent to the 'id' or 'Class' type,.
ArrayRef< QualType > getTypeArgs() const
Retrieve the type arguments for this type.
qual_iterator qual_begin() const
bool isKindOfType() const
Whether this is a "__kindof" type.
A class providing a concrete implementation of ObjCObjectType, so as to not increase the footprint of...
Represents a class type in Objective C.
bool isKindOfTypeAsWritten() const
Whether this is a "__kindof" type as written.
ArrayRef< QualType > getTypeArgsAsWritten() const
Retrieve the type arguments of this object type as they were written.
bool isUnspecializedAsWritten() const
Determine whether this object type is "unspecialized" as written, meaning that it has no type argumen...
bool isObjCQualifiedClass() const
ObjCObjectType(enum Nonce_ObjCInterface)
bool isObjCUnqualifiedIdOrClass() const
QualType getBaseType() const
Gets the base type of this object type.
bool isObjCQualifiedId() const
bool isSpecializedAsWritten() const
Determine whether this object type was written with type arguments.
bool isObjCUnqualifiedId() const
bool isUnspecialized() const
Determine whether this object type is "unspecialized", meaning that it has no type arguments.
bool isObjCUnqualifiedClass() const
static bool classof(const Type *T)
QualType getSuperClassType() const
Retrieve the type of the superclass of this object type.
Represents an Objective-C protocol declaration.
This class wraps the list of protocol qualifiers.
llvm::iterator_range< qual_iterator > qual_range
void initialize(ArrayRef< ObjCProtocolDecl * > protocols)
ObjCProtocolDecl ** getProtocolStorage()
ArrayRef< ObjCProtocolDecl * > getProtocols() const
Retrieve all of the protocol qualifiers.
unsigned getNumProtocols() const
Return the number of qualifying protocols in this type, or 0 if there are none.
void setNumProtocols(unsigned N)
qual_iterator qual_end() const
ObjCProtocolDecl *const * getProtocolStorage() const
ObjCProtocolDecl * getProtocol(unsigned I) const
Fetch a protocol by index.
qual_iterator qual_begin() const
ObjCProtocolQualifiers()=default
ObjCProtocolDecl *const * qual_iterator
Represents the declaration of an Objective-C type parameter.
Represents a type parameter type in Objective C.
static bool classof(const Type *T)
ObjCTypeParamDecl * getDecl() const
Represents a pack expansion of types.
void Profile(llvm::FoldingSetNodeID &ID)
static bool classof(const Type *T)
static void Profile(llvm::FoldingSetNodeID &ID, QualType Pattern, std::optional< unsigned > NumExpansions)
QualType getPattern() const
Retrieve the pattern of this pack expansion, which is the type that will be repeatedly instantiated w...
std::optional< unsigned > getNumExpansions() const
Retrieve the number of expansions that this pack expansion will generate, if known.
bool hasSelectedType() const
QualType getPattern() const
void Profile(llvm::FoldingSetNodeID &ID)
QualType getSelectedType() const
ArrayRef< QualType > getExpansions() const
Expr * getIndexExpr() const
static bool classof(const Type *T)
Sugar for parentheses used when specifying types.
void Profile(llvm::FoldingSetNodeID &ID)
static bool classof(const Type *T)
static void Profile(llvm::FoldingSetNodeID &ID, QualType Inner)
QualType getInnerType() const
static void Profile(llvm::FoldingSetNodeID &ID, QualType T, bool isRead)
QualType getElementType() const
void Profile(llvm::FoldingSetNodeID &ID)
static bool classof(const Type *T)
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
void Profile(llvm::FoldingSetNodeID &ID) const
bool isAddressDiscriminated() const
PointerAuthQualifier withoutKeyNone() const
unsigned getExtraDiscriminator() const
PointerAuthenticationMode getAuthenticationMode() const
@ MaxDiscriminator
The maximum supported pointer-authentication discriminator.
@ MaxKey
The maximum supported pointer-authentication key.
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
QualType getDesugaredType(const ASTContext &Context) const
Return the specified type with any "sugar" removed from the type.
void removeLocalFastQualifiers(unsigned Mask)
QualType withConst() const
QualType getLocalUnqualifiedType() const
Return this type with all of the instance-specific qualifiers removed, but without removing any quali...
void addConst()
Add the const type qualifier to this QualType.
bool isAtLeastAsQualifiedAs(QualType Other) const
Determine whether this type is at least as qualified as the other given type, requiring exact equalit...
bool hasLocalQualifiers() const
Determine whether this particular QualType instance has any qualifiers, without looking through any t...
bool isTriviallyCopyConstructibleType(const ASTContext &Context) const
Return true if this is a trivially copyable type.
bool isTrivialType(const ASTContext &Context) const
Return true if this is a trivial type per (C++0x [basic.types]p9)
bool isNull() const
Return true if this QualType doesn't point to a type yet.
PrimitiveCopyKind isNonTrivialToPrimitiveCopy() const
Check if this is a non-trivial type that would cause a C struct transitively containing this type to ...
bool isTriviallyRelocatableType(const ASTContext &Context) const
Return true if this is a trivially relocatable type.
const Type * getTypePtr() const
Retrieves a pointer to the underlying (unqualified) type.
LangAS getAddressSpace() const
Return the address space of this type.
bool isConstant(const ASTContext &Ctx) const
static QualType getFromOpaquePtr(const void *Ptr)
QualType withVolatile() const
bool hasNonTrivialToPrimitiveDestructCUnion() const
Check if this is or contains a C union that is non-trivial to destruct, which is a union that has a m...
Qualifiers getQualifiers() const
Retrieve the set of qualifiers applied to this type.
const Type * operator->() const
void setLocalFastQualifiers(unsigned Quals)
bool isAddressSpaceOverlapping(QualType T) const
Returns true if address space qualifiers overlap with T address space qualifiers.
bool isCXX98PODType(const ASTContext &Context) const
Return true if this is a POD type according to the rules of the C++98 standard, regardless of the cur...
Qualifiers::ObjCLifetime getObjCLifetime() const
Returns lifetime attribute of this type.
QualType stripObjCKindOfType(const ASTContext &ctx) const
Strip Objective-C "__kindof" types from the given type.
void print(raw_ostream &OS, const PrintingPolicy &Policy, const Twine &PlaceHolder=Twine(), unsigned Indentation=0) const
void getAsStringInternal(std::string &Str, const PrintingPolicy &Policy) const
bool isReferenceable() const
QualType getNonReferenceType() const
If Type is a reference type (e.g., const int&), returns the type that the reference refers to ("const...
QualType getCanonicalType() const
QualType getUnqualifiedType() const
Retrieve the unqualified variant of the given type, removing as little sugar as possible.
void removeLocalVolatile()
QualType substObjCMemberType(QualType objectType, const DeclContext *dc, ObjCSubstitutionContext context) const
Substitute type arguments from an object type for the Objective-C type parameters used in the subject...
bool isWebAssemblyReferenceType() const
Returns true if it is a WebAssembly Reference Type.
SplitQualType getSplitDesugaredType() const
std::optional< NonConstantStorageReason > isNonConstantStorage(const ASTContext &Ctx, bool ExcludeCtor, bool ExcludeDtor)
Determine whether instances of this type can be placed in immutable storage.
QualType withCVRQualifiers(unsigned CVR) const
unsigned getLocalCVRQualifiers() const
Retrieve the set of CVR (const-volatile-restrict) qualifiers local to this particular QualType instan...
SplitQualType split() const
Divides a QualType into its unqualified type and a set of local qualifiers.
bool UseExcessPrecision(const ASTContext &Ctx)
void addVolatile()
Add the volatile type qualifier to this QualType.
bool isCForbiddenLValueType() const
Determine whether expressions of the given type are forbidden from being lvalues in C.
PrimitiveDefaultInitializeKind isNonTrivialToPrimitiveDefaultInitialize() const
Functions to query basic properties of non-trivial C struct types.
bool isObjCGCStrong() const
true when Type is objc's strong.
std::string getAsString() const
void * getAsOpaquePtr() const
static void print(SplitQualType split, raw_ostream &OS, const PrintingPolicy &policy, const Twine &PlaceHolder, unsigned Indentation=0)
bool isCanonicalAsParam() const
void removeLocalRestrict()
bool isWebAssemblyExternrefType() const
Returns true if it is a WebAssembly Externref Type.
QualType(const Type *Ptr, unsigned Quals)
QualType getNonPackExpansionType() const
Remove an outer pack expansion type (if any) from this type.
bool isMoreQualifiedThan(QualType Other) const
Determine whether this type is more qualified than the other given type, requiring exact equality for...
SplitQualType getSplitUnqualifiedType() const
Retrieve the unqualified variant of the given type, removing as little sugar as possible.
bool isCXX11PODType(const ASTContext &Context) const
Return true if this is a POD type according to the more relaxed rules of the C++11 standard,...
bool mayBeNotDynamicClass() const
Returns true if it is not a class or if the class might not be dynamic.
bool isConstQualified() const
Determine whether this type is const-qualified.
bool hasAddressSpace() const
Check if this type has any address space qualifier.
bool isObjCGCWeak() const
true when Type is objc's weak.
QualType substObjCTypeArgs(ASTContext &ctx, ArrayRef< QualType > typeArgs, ObjCSubstitutionContext context) const
Substitute type arguments for the Objective-C type parameters used in the subject type.
unsigned getLocalFastQualifiers() const
void removeLocalFastQualifiers()
QualType getAtomicUnqualifiedType() const
Remove all qualifiers including _Atomic.
DestructionKind isDestructedType() const
Returns a nonzero value if objects of this type require non-trivial work to clean up after.
friend bool operator<(const QualType &LHS, const QualType &RHS)
friend bool operator!=(const QualType &LHS, const QualType &RHS)
StreamedQualTypeHelper stream(const PrintingPolicy &Policy, const Twine &PlaceHolder=Twine(), unsigned Indentation=0) const
bool isLocalVolatileQualified() const
Determine whether this particular QualType instance has the "volatile" qualifier set,...
bool isConstantStorage(const ASTContext &Ctx, bool ExcludeCtor, bool ExcludeDtor)
unsigned getCVRQualifiers() const
Retrieve the set of CVR (const-volatile-restrict) qualifiers applied to this type.
static void getAsStringInternal(SplitQualType split, std::string &out, const PrintingPolicy &policy)
QualType getSingleStepDesugaredType(const ASTContext &Context) const
Return the specified type with one level of "sugar" removed from the type.
const Type * getTypePtrOrNull() const
static std::string getAsString(SplitQualType split, const PrintingPolicy &Policy)
bool hasNonTrivialObjCLifetime() const
bool isPODType(const ASTContext &Context) const
Determine whether this is a Plain Old Data (POD) type (C++ 3.9p10).
bool hasStrongOrWeakObjCLifetime() const
PrimitiveCopyKind isNonTrivialToPrimitiveDestructiveMove() const
Check if this is a non-trivial type that would cause a C struct transitively containing this type to ...
QualType withExactLocalFastQualifiers(unsigned TQs) const
@ NonConstNonReferenceType
@ PCK_Struct
The type is a struct containing a field whose type is neither PCK_Trivial nor PCK_VolatileTrivial.
@ PCK_Trivial
The type does not fall into any of the following categories.
@ PCK_ARCStrong
The type is an Objective-C retainable pointer type that is qualified with the ARC __strong qualifier.
@ PCK_VolatileTrivial
The type would be trivial except that it is volatile-qualified.
@ PCK_ARCWeak
The type is an Objective-C retainable pointer type that is qualified with the ARC __weak qualifier.
const Type & operator*() const
Qualifiers getLocalQualifiers() const
Retrieve the set of qualifiers local to this particular QualType instance, not including any qualifie...
bool hasNonTrivialToPrimitiveDefaultInitializeCUnion() const
Check if this is or contains a C union that is non-trivial to default-initialize, which is a union th...
A qualifier set is used to build a set of qualifiers.
const Type * strip(QualType type)
Collect any qualifiers on the given type and return an unqualified type.
QualifierCollector(Qualifiers Qs=Qualifiers())
QualifiersAndAtomic & operator+=(Qualifiers RHS)
QualifiersAndAtomic withVolatile()
QualifiersAndAtomic withAtomic()
QualifiersAndAtomic withConst()
QualifiersAndAtomic(Qualifiers Quals, bool HasAtomic)
QualifiersAndAtomic withRestrict()
The collection of all-type qualifiers we support.
unsigned getCVRQualifiers() const
void removeCVRQualifiers(unsigned mask)
friend Qualifiers operator-(Qualifiers L, Qualifiers R)
Compute the difference between two qualifier sets.
static Qualifiers fromFastMask(unsigned Mask)
void setFastQualifiers(unsigned mask)
void addAddressSpace(LangAS space)
static Qualifiers removeCommonQualifiers(Qualifiers &L, Qualifiers &R)
Returns the common set of qualifiers while removing them from the given sets.
bool hasOnlyConst() const
@ OCL_Strong
Assigning into this object requires the old value to be released and the new value to be retained.
@ OCL_ExplicitNone
This object can be modified without requiring retains or releases.
@ OCL_None
There is no lifetime qualification on this type.
@ OCL_Weak
Reading or writing from this object requires a barrier call.
@ OCL_Autoreleasing
Assigning into this object requires a lifetime extension.
void removeObjCLifetime()
bool hasTargetSpecificAddressSpace() const
bool isStrictSupersetOf(Qualifiers Other) const
Determine whether this set of qualifiers is a strict superset of another set of qualifiers,...
bool hasNonFastQualifiers() const
Return true if the set contains any qualifiers which require an ExtQuals node to be allocated.
void Profile(llvm::FoldingSetNodeID &ID) const
bool isAddressSpaceSupersetOf(Qualifiers other) const
Returns true if the address space in these qualifiers is equal to or a superset of the address space ...
bool operator!=(Qualifiers Other) const
bool hasNonTrivialObjCLifetime() const
True if the lifetime is neither None or ExplicitNone.
void addCVRQualifiers(unsigned mask)
bool hasCVRQualifiers() const
void addConsistentQualifiers(Qualifiers qs)
Add the qualifiers from the given set to this set, given that they don't conflict.
void removeFastQualifiers(unsigned mask)
Qualifiers & operator+=(Qualifiers R)
void removeFastQualifiers()
bool hasQualifiers() const
Return true if the set contains any qualifiers.
void removeCVRQualifiers()
Qualifiers withVolatile() const
void addCVRUQualifiers(unsigned mask)
Qualifiers & operator-=(Qualifiers R)
bool hasUnaligned() const
unsigned getAddressSpaceAttributePrintValue() const
Get the address space attribute value to be printed by diagnostics.
bool hasAddressSpace() const
Qualifiers withoutAddressSpace() const
unsigned getFastQualifiers() const
void print(raw_ostream &OS, const PrintingPolicy &Policy, bool appendSpaceIfNonEmpty=false) const
void removeAddressSpace()
void addQualifiers(Qualifiers Q)
Add the qualifiers from the given set to this set.
static Qualifiers fromCVRMask(unsigned CVR)
void setAddressSpace(LangAS space)
static bool isAddressSpaceSupersetOf(LangAS A, LangAS B)
Returns true if address space A is equal to or a superset of B.
unsigned getCVRUQualifiers() const
bool isEmptyWhenPrinted(const PrintingPolicy &Policy) const
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
@ FastWidth
The width of the "fast" qualifier mask.
@ MaxAddressSpace
The maximum supported address space number.
@ FastMask
The fast qualifier mask.
void addPointerAuth(PointerAuthQualifier Q)
void addObjCGCAttr(GC type)
bool hasPointerAuth() const
bool operator==(Qualifiers Other) const
bool compatiblyIncludes(Qualifiers other) const
Determines if these qualifiers compatibly include another set.
void removeQualifiers(Qualifiers Q)
Remove the qualifiers from the given set from this set.
LangAS getAddressSpace() const
bool hasOnlyVolatile() const
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
void addObjCLifetime(ObjCLifetime type)
void setObjCLifetime(ObjCLifetime type)
An rvalue reference type, per C++11 [dcl.ref].
static bool classof(const Type *T)
Represents a struct/union/class.
A helper class that allows the use of isa/cast/dyncast to detect TagType objects of structs/unions/cl...
RecordType(const RecordDecl *D)
RecordDecl * getDecl() const
RecordType(TypeClass TC, RecordDecl *D)
static bool classof(const Type *T)
Base for LValueReferenceType and RValueReferenceType.
QualType getPointeeType() const
ReferenceType(TypeClass tc, QualType Referencee, QualType CanonicalRef, bool SpelledAsLValue)
static bool classof(const Type *T)
QualType getPointeeTypeAsWritten() const
bool isSpelledAsLValue() const
void Profile(llvm::FoldingSetNodeID &ID)
static void Profile(llvm::FoldingSetNodeID &ID, QualType Referencee, bool SpelledAsLValue)
Encodes a location in the source.
A trivial tuple used to represent a source range.
SourceLocation getEnd() const
SourceLocation getBegin() const
Stmt - This represents one statement.
The streaming interface shared between DiagnosticBuilder and PartialDiagnostic.
void AddTaggedVal(uint64_t V, DiagnosticsEngine::ArgumentKind Kind) const
Represents the result of substituting a set of types for a template type parameter pack.
unsigned getIndex() const
Returns the index of the replaced parameter in the associated declaration.
static bool classof(const Type *T)
unsigned getNumArgs() const
Represents the result of substituting a type for a template type parameter.
void Profile(llvm::FoldingSetNodeID &ID)
static bool classof(const Type *T)
Decl * getAssociatedDecl() const
A template-like entity which owns the whole pattern being substituted.
std::optional< unsigned > getPackIndex() const
QualType getReplacementType() const
Gets the type that was substituted for the template parameter.
unsigned getIndex() const
Returns the index of the replaced parameter in the associated declaration.
static void Profile(llvm::FoldingSetNodeID &ID, QualType Replacement, const Decl *AssociatedDecl, unsigned Index, std::optional< unsigned > PackIndex)
Represents the declaration of a struct/union/class/enum.
static bool classof(const Type *T)
A convenient class for passing around template argument information.
Represents a template argument.
Represents a C++ template name within the type system.
void Profile(llvm::FoldingSetNodeID &ID)
bool isDependent() const
Determines whether this is a dependent template name.
Represents a type template specialization; the template must be a class template, a type alias templa...
ArrayRef< TemplateArgument > template_arguments() const
static bool classof(const Type *T)
TemplateName getTemplateName() const
Retrieve the name of the template that we are specializing.
bool isTypeAlias() const
Determine if this template specialization type is for a type alias template that has been substituted...
bool isCurrentInstantiation() const
True if this template specialization type matches a current instantiation in the context in which it ...
Declaration of a template type parameter.
TemplateTypeParmDecl * getDecl() const
bool isParameterPack() const
void Profile(llvm::FoldingSetNodeID &ID)
unsigned getIndex() const
static bool classof(const Type *T)
static void Profile(llvm::FoldingSetNodeID &ID, unsigned Depth, unsigned Index, bool ParameterPack, TemplateTypeParmDecl *TTPDecl)
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.
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< 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.
@ Create
'create' clause, allowed on Compute and Combined constructs, plus 'data', 'enter data',...
TypeDependenceScope::TypeDependence TypeDependence
AutoTypeKeyword
Which keyword(s) were used to create an AutoType.
@ GNUAutoType
__auto_type (GNU extension)
@ DecltypeAuto
decltype(auto)
bool isTargetAddressSpace(LangAS AS)
CanThrowResult
Possible results from evaluation of a noexcept expression.
FunctionType::ExtInfo getFunctionExtInfo(const Type &t)
bool isDynamicExceptionSpec(ExceptionSpecificationType ESpecType)
NullabilityKind
Describes the nullability of a particular type.
RefQualifierKind
The kind of C++11 ref-qualifier associated with a function type.
@ RQ_None
No ref-qualifier was provided.
@ RQ_LValue
An lvalue ref-qualifier was provided (&).
@ RQ_RValue
An rvalue ref-qualifier was provided (&&).
bool IsEnumDeclComplete(EnumDecl *ED)
Check if the given decl is complete.
TypeOfKind
The kind of 'typeof' expression we're after.
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)
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
bool isPtrSizeAddressSpace(LangAS AS)
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()=default
FunctionEffectWithCondition(const 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...
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)