17#ifndef LLVM_CLANG_AST_TYPE_BASE_H
18#define LLVM_CLANG_AST_TYPE_BASE_H
35#include "llvm/ADT/APInt.h"
36#include "llvm/ADT/APSInt.h"
37#include "llvm/ADT/ArrayRef.h"
38#include "llvm/ADT/FoldingSet.h"
39#include "llvm/ADT/PointerIntPair.h"
40#include "llvm/ADT/PointerUnion.h"
41#include "llvm/ADT/STLForwardCompat.h"
42#include "llvm/ADT/StringRef.h"
43#include "llvm/ADT/Twine.h"
44#include "llvm/ADT/iterator_range.h"
45#include "llvm/Support/Casting.h"
46#include "llvm/Support/Compiler.h"
47#include "llvm/Support/DXILABI.h"
48#include "llvm/Support/ErrorHandling.h"
49#include "llvm/Support/PointerLikeTypeTraits.h"
50#include "llvm/Support/TrailingObjects.h"
51#include "llvm/Support/type_traits.h"
80namespace serialization {
81 template <
class T>
class AbstractTypeReader;
118template <
typename>
class CanQual;
123class ExtQualsTypeCommonBase;
125class FunctionEffectsRef;
126class FunctionEffectKindSet;
127class FunctionEffectSet;
130class ObjCInterfaceDecl;
131class ObjCProtocolDecl;
132class ObjCTypeParamDecl;
133struct PrintingPolicy;
137class ClassTemplateDecl;
138class TemplateArgument;
139class TemplateArgumentListInfo;
140class TemplateArgumentLoc;
141class TemplateTypeParmDecl;
142class TypedefNameDecl;
143class UnresolvedUsingTypenameDecl;
144class UsingShadowDecl;
149#define TYPE(Class, Base) class Class##Type;
150#include "clang/AST/TypeNodes.inc"
153class PointerAuthQualifier {
157 EnabledMask = 1 << EnabledShift,
158 AddressDiscriminatedShift = EnabledShift + EnabledBits,
159 AddressDiscriminatedBits = 1,
160 AddressDiscriminatedMask = 1 << AddressDiscriminatedShift,
161 AuthenticationModeShift =
162 AddressDiscriminatedShift + AddressDiscriminatedBits,
163 AuthenticationModeBits = 2,
164 AuthenticationModeMask = ((1 << AuthenticationModeBits) - 1)
165 << AuthenticationModeShift,
166 IsaPointerShift = AuthenticationModeShift + AuthenticationModeBits,
168 IsaPointerMask = ((1 << IsaPointerBits) - 1) << IsaPointerShift,
169 AuthenticatesNullValuesShift = IsaPointerShift + IsaPointerBits,
170 AuthenticatesNullValuesBits = 1,
171 AuthenticatesNullValuesMask = ((1 << AuthenticatesNullValuesBits) - 1)
172 << AuthenticatesNullValuesShift,
173 KeyShift = AuthenticatesNullValuesShift + AuthenticatesNullValuesBits,
175 KeyMask = ((1 << KeyBits) - 1) << KeyShift,
176 DiscriminatorShift = KeyShift + KeyBits,
177 DiscriminatorBits = 16,
178 DiscriminatorMask = ((1u << DiscriminatorBits) - 1) << DiscriminatorShift,
189 static_assert((EnabledBits + AddressDiscriminatedBits +
190 AuthenticationModeBits + IsaPointerBits +
191 AuthenticatesNullValuesBits + KeyBits + DiscriminatorBits) ==
193 "PointerAuthQualifier should be exactly 32 bits");
194 static_assert((EnabledMask + AddressDiscriminatedMask +
195 AuthenticationModeMask + IsaPointerMask +
196 AuthenticatesNullValuesMask + KeyMask + DiscriminatorMask) ==
198 "All masks should cover the entire bits");
199 static_assert((EnabledMask ^ AddressDiscriminatedMask ^
200 AuthenticationModeMask ^ IsaPointerMask ^
201 AuthenticatesNullValuesMask ^ KeyMask ^ DiscriminatorMask) ==
203 "All masks should cover the entire bits");
206 unsigned ExtraDiscriminator,
208 bool IsIsaPointer,
bool AuthenticatesNullValues)
210 (IsAddressDiscriminated
211 ? llvm::to_underlying(AddressDiscriminatedMask)
214 (llvm::to_underlying(AuthenticationMode)
215 << AuthenticationModeShift) |
216 (ExtraDiscriminator << DiscriminatorShift) |
217 (IsIsaPointer << IsaPointerShift) |
218 (AuthenticatesNullValues << AuthenticatesNullValuesShift)) {
221 assert((Data == 0) ==
239 static PointerAuthQualifier
240 Create(
unsigned Key,
bool IsAddressDiscriminated,
unsigned ExtraDiscriminator,
242 bool AuthenticatesNullValues) {
247 AuthenticationMode, IsIsaPointer,
248 AuthenticatesNullValues);
252 assert((Data == 0) ==
261 return (Data & KeyMask) >> KeyShift;
268 return (Data & AddressDiscriminatedMask) >> AddressDiscriminatedShift;
273 return (Data >> DiscriminatorShift);
278 AuthenticationModeShift);
283 return (Data & IsaPointerMask) >> IsaPointerShift;
288 return (Data & AuthenticatesNullValuesMask) >> AuthenticatesNullValuesShift;
295 friend bool operator==(PointerAuthQualifier Lhs, PointerAuthQualifier Rhs) {
296 return Lhs.Data == Rhs.Data;
298 friend bool operator!=(PointerAuthQualifier Lhs, PointerAuthQualifier Rhs) {
299 return Lhs.Data != Rhs.Data;
310 PointerAuthQualifier
Result;
312 assert((
Result.Data == 0) ==
323 void Profile(llvm::FoldingSetNodeID &ID)
const { ID.AddInteger(Data); }
390 LPtrAuth == R.getPointerAuth()) {
394 R.setPointerAuth(
Empty);
399 Q.Mask = L.Mask & R.Mask;
408 R.removeCVRQualifiers(CommonCRV);
413 R.removeObjCGCAttr();
419 R.removeObjCLifetime();
425 R.removeAddressSpace();
493 assert(!(mask & ~
CVRMask) &&
"bitmask contains non-CVR bits");
497 assert(!(mask & ~
CVRMask) &&
"bitmask contains non-CVR bits");
498 Mask &= ~static_cast<uint64_t>(mask);
504 assert(!(mask & ~
CVRMask) &&
"bitmask contains non-CVR bits");
508 assert(!(mask & ~
CVRMask & ~UMask) &&
"bitmask contains non-CVRU bits");
514 Mask = (Mask & ~UMask) | (flag ? UMask : 0);
522 Mask = (Mask & ~GCAttrMask) | (
type << GCAttrShift);
547 return ObjCLifetime((Mask & LifetimeMask) >> LifetimeShift);
550 Mask = (Mask & ~LifetimeMask) | (
type << LifetimeShift);
556 Mask |= (
type << LifetimeShift);
573 return static_cast<LangAS>((Mask & AddressSpaceMask) >> AddressSpaceShift);
594 Mask = (Mask & ~AddressSpaceMask)
595 | (((
uint32_t) space) << AddressSpaceShift);
608 Mask = (Mask & ~PtrAuthMask) |
622 assert(!(mask & ~
FastMask) &&
"bitmask contains non-fast qualifier bits");
626 assert(!(mask & ~
FastMask) &&
"bitmask contains non-fast qualifier bits");
627 Mask &= ~static_cast<uint64_t>(mask);
633 assert(!(mask & ~
FastMask) &&
"bitmask contains non-fast qualifier bits");
648 bool empty()
const {
return !Mask; }
803 bool appendSpaceIfNonEmpty =
false)
const;
805 void Profile(llvm::FoldingSetNodeID &ID)
const { ID.AddInteger(Mask); }
812 "PointerAuthQualifier must be 32 bits");
814 static constexpr uint64_t PtrAuthShift = 32;
815 static constexpr uint64_t PtrAuthMask = UINT64_C(0xffffffff) << PtrAuthShift;
817 static constexpr uint64_t UMask = 0x8;
818 static constexpr uint64_t UShift = 3;
819 static constexpr uint64_t GCAttrMask = 0x30;
820 static constexpr uint64_t GCAttrShift = 4;
821 static constexpr uint64_t LifetimeMask = 0x1C0;
822 static constexpr uint64_t LifetimeShift = 6;
823 static constexpr uint64_t AddressSpaceMask =
824 ~(
CVRMask | UMask | GCAttrMask | LifetimeMask | PtrAuthMask);
825 static constexpr uint64_t AddressSpaceShift = 9;
835 : Quals(Quals), HasAtomic(HasAtomic) {}
855 return {Quals.withVolatile(), HasAtomic};
859 return {Quals.withRestrict(), HasAtomic};
884 std::pair<const Type *,Qualifiers>
asPair()
const {
885 return std::pair<const Type *, Qualifiers>(
Ty,
Quals);
942 llvm::PointerIntPair<llvm::PointerUnion<const Type *, const ExtQuals *>,
945 const ExtQuals *getExtQualsUnsafe()
const {
949 const Type *getTypePtrUnsafe()
const {
953 const ExtQualsTypeCommonBase *getCommonPtr()
const {
954 assert(!
isNull() &&
"Cannot retrieve a NULL type pointer");
955 auto CommonPtrVal =
reinterpret_cast<uintptr_t>(
Value.getOpaqueValue());
957 return reinterpret_cast<ExtQualsTypeCommonBase*
>(CommonPtrVal);
989 T.Value.setFromOpaqueValue(
const_cast<void*
>(Ptr));
1006 return Value.getPointer().isNull();
1033 std::optional<NonConstantStorageReason>
1201 &&
"non-fast qualifier bits set in mask!");
1202 Value.setInt(Value.getInt() | TQs);
1212 Value.setInt(Value.getInt() & ~Mask);
1219 T.addFastQualifiers(TQs);
1232 T.removeLocalFastQualifiers();
1326 return getSingleStepDesugaredTypeImpl(*
this, Context);
1339 return LHS.Value == RHS.Value;
1342 return LHS.Value != RHS.Value;
1345 return LHS.Value < RHS.Value;
1359 const Twine &PlaceHolder = Twine(),
1360 unsigned Indentation = 0)
const;
1364 unsigned Indentation = 0) {
1365 return print(
split.Ty,
split.Quals, OS, policy, PlaceHolder, Indentation);
1370 const Twine &PlaceHolder,
1371 unsigned Indentation = 0);
1388 const Twine &PlaceHolder;
1389 unsigned Indentation;
1393 const Twine &PlaceHolder,
unsigned Indentation)
1394 : T(T), Policy(Policy), PlaceHolder(PlaceHolder),
1395 Indentation(Indentation) {}
1399 SQT.T.
print(OS, SQT.Policy, SQT.PlaceHolder, SQT.Indentation);
1405 const Twine &PlaceHolder = Twine(),
1406 unsigned Indentation = 0)
const {
1410 void dump(
const char *s)
const;
1412 void dump(llvm::raw_ostream &OS,
const ASTContext &Context)
const;
1475 return PtrAuth.isAddressDiscriminated();
1562 return isDestructedTypeImpl(*
this);
1667raw_ostream &
operator<<(raw_ostream &OS, QualType QT);
1705class ExtQualsTypeCommonBase {
1716 const Type *
const BaseType;
1721 ExtQualsTypeCommonBase(
const Type *baseType,
QualType canon)
1722 : BaseType(baseType), CanonicalType(canon) {}
1735class alignas(TypeAlignment)
ExtQuals :
public ExtQualsTypeCommonBase,
1736 public llvm::FoldingSetNode {
1758 : ExtQualsTypeCommonBase(baseType,
1759 canon.isNull() ?
QualType(this_(), 0) : canon),
1761 assert(Quals.hasNonFastQualifiers()
1762 &&
"ExtQuals created with no fast qualifiers");
1763 assert(!Quals.hasFastQualifiers()
1764 &&
"ExtQuals created with fast qualifiers");
1774 return Quals.getObjCLifetime();
1788 const Type *BaseType,
1790 assert(!Quals.hasFastQualifiers() &&
"fast qualifiers in ExtQuals hash!");
1791 ID.AddPointer(BaseType);
1849enum class ArraySizeModifier;
1850enum class ElaboratedTypeKeyword;
1851enum class VectorKind;
1879class alignas(TypeAlignment)
Type :
public ExtQualsTypeCommonBase {
1882#define TYPE(Class, Base) Class,
1883#define LAST_TYPE(Class) TypeLast = Class
1884#define ABSTRACT_TYPE(Class, Base)
1885#include "clang/AST/TypeNodes.inc"
1890 class TypeBitfields {
1892 template <
class T>
friend class TypePropertyCache;
1895 LLVM_PREFERRED_TYPE(TypeClass)
1900 unsigned Dependence : llvm::BitWidth<TypeDependence>;
1904 LLVM_PREFERRED_TYPE(
bool)
1905 mutable unsigned CacheValid : 1;
1909 mutable unsigned CachedLinkage : 3;
1912 LLVM_PREFERRED_TYPE(
bool)
1913 mutable unsigned CachedLocalOrUnnamed : 1;
1916 LLVM_PREFERRED_TYPE(
bool)
1917 mutable unsigned FromAST : 1;
1919 bool isCacheValid()
const {
1924 assert(isCacheValid() &&
"getting linkage from invalid cache");
1925 return static_cast<Linkage>(CachedLinkage);
1928 bool hasLocalOrUnnamedType()
const {
1929 assert(isCacheValid() &&
"getting linkage from invalid cache");
1930 return CachedLocalOrUnnamed;
1933 enum { NumTypeBits = 8 + llvm::BitWidth<TypeDependence> + 6 };
1942 LLVM_PREFERRED_TYPE(TypeBitfields)
1948 unsigned IndexTypeQuals : 3;
1953 unsigned SizeModifier : 3;
1964 LLVM_PREFERRED_TYPE(
bool)
1965 unsigned HasExternalSize : 1;
1967 LLVM_PREFERRED_TYPE(
unsigned)
1968 unsigned SizeWidth : 5;
1974 LLVM_PREFERRED_TYPE(TypeBitfields)
1978 static constexpr unsigned NumOfBuiltinTypeBits = 10;
1979 unsigned Kind : NumOfBuiltinTypeBits;
1994 LLVM_PREFERRED_TYPE(TypeBitfields)
2001 unsigned RefQualifier : 2;
2012 LLVM_PREFERRED_TYPE(
bool)
2013 unsigned HasExtQuals : 1;
2017 unsigned ExceptionSpecType : 4;
2020 LLVM_PREFERRED_TYPE(
bool)
2021 unsigned HasExtParameterInfos : 1;
2024 LLVM_PREFERRED_TYPE(
bool)
2025 unsigned HasExtraBitfields : 1;
2028 LLVM_PREFERRED_TYPE(
bool)
2029 unsigned Variadic : 1;
2032 LLVM_PREFERRED_TYPE(
bool)
2033 unsigned HasTrailingReturn : 1;
2036 LLVM_PREFERRED_TYPE(
bool)
2037 unsigned CFIUncheckedCallee : 1;
2042 unsigned ExtInfo : 14;
2054 LLVM_PREFERRED_TYPE(TypeBitfields)
2058 unsigned NumTypeArgs : 7;
2061 unsigned NumProtocols : 6;
2064 LLVM_PREFERRED_TYPE(
bool)
2065 unsigned IsKindOf : 1;
2071 LLVM_PREFERRED_TYPE(TypeBitfields)
2085 LLVM_PREFERRED_TYPE(
bool)
2086 unsigned SpelledAsLValue : 1;
2090 LLVM_PREFERRED_TYPE(
bool)
2091 unsigned InnerRef : 1;
2097 LLVM_PREFERRED_TYPE(TypeBitfields)
2102 unsigned Keyword : 8;
2114 LLVM_PREFERRED_TYPE(
bool)
2115 unsigned HasQualifier : 1;
2118 LLVM_PREFERRED_TYPE(
bool)
2119 unsigned OwnsTag : 1;
2122 LLVM_PREFERRED_TYPE(
bool)
2123 unsigned IsInjected : 1;
2130 LLVM_PREFERRED_TYPE(TypeBitfields)
2136 unsigned VecKind : 6;
2144 LLVM_PREFERRED_TYPE(TypeBitfields)
2148 unsigned AttrKind : 32 - NumTypeBits;
2174 unsigned Keyword : 2;
2190 LLVM_PREFERRED_TYPE(TypeBitfields)
2203 LLVM_PREFERRED_TYPE(
bool)
2204 unsigned hasQualifier : 1;
2214 LLVM_PREFERRED_TYPE(
bool)
2215 unsigned hasQualifier : 1;
2225 LLVM_PREFERRED_TYPE(
bool)
2226 unsigned hasQualifier : 1;
2229 LLVM_PREFERRED_TYPE(
bool)
2230 unsigned hasTypeDifferentFromDecl : 1;
2239 LLVM_PREFERRED_TYPE(TypeBitfields)
2246 LLVM_PREFERRED_TYPE(
bool)
2247 unsigned ParameterPack : 1;
2256 LLVM_PREFERRED_TYPE(TypeBitfields)
2259 LLVM_PREFERRED_TYPE(
bool)
2260 unsigned HasNonCanonicalUnderlyingType : 1;
2263 unsigned Index : 15;
2265 LLVM_PREFERRED_TYPE(
bool)
2273 unsigned PackIndex : 16;
2280 LLVM_PREFERRED_TYPE(TypeBitfields)
2287 unsigned NumArgs : 16;
2293 unsigned SubstTemplTypeParmPackIndex : 16;
2303 LLVM_PREFERRED_TYPE(
bool)
2304 unsigned TypeAlias : 1;
2319 LLVM_PREFERRED_TYPE(TypeBitfields)
2333 unsigned NumExpansions;
2353 LLVM_PREFERRED_TYPE(TypeBitfields)
2363 LLVM_PREFERRED_TYPE(TypeBitfields)
2366 static constexpr unsigned NumCoupledDeclsBits = 4;
2367 unsigned NumCoupledDecls : NumCoupledDeclsBits;
2368 LLVM_PREFERRED_TYPE(
bool)
2369 unsigned CountInBytes : 1;
2370 LLVM_PREFERRED_TYPE(
bool)
2371 unsigned OrNull : 1;
2406 void setFromAST(
bool V =
true)
const {
2414 : ExtQualsTypeCommonBase(this,
2416 static_assert(
sizeof(*this) <=
2417 alignof(
decltype(*this)) +
sizeof(ExtQualsTypeCommonBase),
2418 "changing bitfields changed sizeof(Type)!");
2419 static_assert(
alignof(
decltype(*this)) %
TypeAlignment == 0,
2420 "Insufficient alignment!");
2424 TypeBits.CachedLocalOrUnnamed =
false;
2433 TypeBits.Dependence =
static_cast<unsigned>(D);
2476 return CanonicalType ==
QualType(
this, 0);
2482 QualType getLocallyUnqualifiedSingleStepDesugaredType()
const;
2490 bool isSizelessType()
const;
2491 bool isSizelessBuiltinType()
const;
2494 bool isSizelessVectorType()
const;
2497 bool isSVESizelessBuiltinType()
const;
2500 bool isRVVSizelessBuiltinType()
const;
2503 bool isWebAssemblyExternrefType()
const;
2508 bool isWebAssemblyTableType()
const;
2513 bool isSveVLSBuiltinType()
const;
2523 bool isRVVVLSBuiltinType()
const;
2545 bool isIncompleteType(
NamedDecl **Def =
nullptr)
const;
2571 bool isAlwaysIncompleteType()
const;
2583 bool isLiteralType(
const ASTContext &Ctx)
const;
2586 bool isStructuralType()
const;
2590 bool isStandardLayoutType()
const;
2596 bool isBuiltinType()
const;
2599 bool isSpecificBuiltinType(
unsigned K)
const;
2604 bool isPlaceholderType()
const;
2608 bool isSpecificPlaceholderType(
unsigned K)
const;
2612 bool isNonOverloadPlaceholderType()
const;
2616 bool isIntegerType()
const;
2617 bool isEnumeralType()
const;
2620 bool isScopedEnumeralType()
const;
2622 bool isCharType()
const;
2623 bool isWideCharType()
const;
2624 bool isChar8Type()
const;
2625 bool isChar16Type()
const;
2626 bool isChar32Type()
const;
2627 bool isAnyCharacterType()
const;
2628 bool isUnicodeCharacterType()
const;
2629 bool isIntegralType(
const ASTContext &Ctx)
const;
2632 bool isIntegralOrEnumerationType()
const;
2635 bool isIntegralOrUnscopedEnumerationType()
const;
2636 bool isUnscopedEnumerationType()
const;
2639 bool isRealFloatingType()
const;
2642 bool isComplexType()
const;
2643 bool isAnyComplexType()
const;
2644 bool isFloatingType()
const;
2645 bool isHalfType()
const;
2646 bool isFloat16Type()
const;
2647 bool isFloat32Type()
const;
2648 bool isDoubleType()
const;
2649 bool isBFloat16Type()
const;
2650 bool isMFloat8Type()
const;
2651 bool isFloat128Type()
const;
2652 bool isIbm128Type()
const;
2653 bool isRealType()
const;
2654 bool isArithmeticType()
const;
2655 bool isVoidType()
const;
2656 bool isScalarType()
const;
2657 bool isAggregateType()
const;
2658 bool isFundamentalType()
const;
2659 bool isCompoundType()
const;
2663 bool isFunctionType()
const;
2666 bool isPointerType()
const;
2667 bool isPointerOrReferenceType()
const;
2668 bool isSignableType(
const ASTContext &Ctx)
const;
2669 bool isSignablePointerType()
const;
2670 bool isSignableIntegerType(
const ASTContext &Ctx)
const;
2671 bool isAnyPointerType()
const;
2672 bool isCountAttributedType()
const;
2673 bool isCFIUncheckedCalleeFunctionType()
const;
2674 bool hasPointeeToCFIUncheckedCalleeFunctionType()
const;
2675 bool isBlockPointerType()
const;
2676 bool isVoidPointerType()
const;
2677 bool isReferenceType()
const;
2678 bool isLValueReferenceType()
const;
2679 bool isRValueReferenceType()
const;
2680 bool isObjectPointerType()
const;
2681 bool isFunctionPointerType()
const;
2682 bool isFunctionReferenceType()
const;
2683 bool isMemberPointerType()
const;
2684 bool isMemberFunctionPointerType()
const;
2685 bool isMemberDataPointerType()
const;
2686 bool isArrayType()
const;
2687 bool isConstantArrayType()
const;
2688 bool isIncompleteArrayType()
const;
2689 bool isVariableArrayType()
const;
2690 bool isArrayParameterType()
const;
2691 bool isDependentSizedArrayType()
const;
2693 bool isClassType()
const;
2694 bool isStructureType()
const;
2695 bool isStructureTypeWithFlexibleArrayMember()
const;
2696 bool isObjCBoxableRecordType()
const;
2697 bool isInterfaceType()
const;
2698 bool isStructureOrClassType()
const;
2699 bool isUnionType()
const;
2700 bool isComplexIntegerType()
const;
2701 bool isVectorType()
const;
2702 bool isExtVectorType()
const;
2703 bool isExtVectorBoolType()
const;
2704 bool isConstantMatrixBoolType()
const;
2707 bool isPackedVectorBoolType(
const ASTContext &ctx)
const;
2708 bool isSubscriptableVectorType()
const;
2710 bool isConstantMatrixType()
const;
2711 bool isCooperativeMatrixType()
const;
2712 bool isOverflowBehaviorType()
const;
2713 bool isDependentAddressSpaceType()
const;
2714 bool isObjCObjectPointerType()
const;
2715 bool isObjCRetainableType()
const;
2716 bool isObjCLifetimeType()
const;
2717 bool isObjCIndirectLifetimeType()
const;
2718 bool isObjCNSObjectType()
const;
2719 bool isObjCIndependentClassType()
const;
2722 bool isObjCObjectType()
const;
2723 bool isObjCQualifiedInterfaceType()
const;
2724 bool isObjCQualifiedIdType()
const;
2725 bool isObjCQualifiedClassType()
const;
2726 bool isObjCObjectOrInterfaceType()
const;
2727 bool isObjCIdType()
const;
2728 bool isDecltypeType()
const;
2736 return hasAttr(attr::ObjCInertUnsafeUnretained);
2746 bool isObjCIdOrObjectKindOfType(
const ASTContext &ctx,
2749 bool isObjCClassType()
const;
2757 bool isObjCClassOrClassKindOfType()
const;
2759 bool isBlockCompatibleObjCPointerType(
ASTContext &ctx)
const;
2760 bool isObjCSelType()
const;
2761 bool isObjCBuiltinType()
const;
2762 bool isObjCARCBridgableType()
const;
2763 bool isCARCBridgableType()
const;
2764 bool isTemplateTypeParmType()
const;
2765 bool isNullPtrType()
const;
2767 bool isNothrowT()
const;
2768 bool isAlignValT()
const;
2769 bool isStdByteType()
const;
2770 bool isAtomicType()
const;
2771 bool isUndeducedAutoType()
const;
2773 bool isTypedefNameType()
const;
2774 bool isMetaInfoType()
const;
2776#define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \
2777 bool is##Id##Type() const;
2778#include "clang/Basic/OpenCLImageTypes.def"
2780 bool isImageType()
const;
2782 bool isSamplerT()
const;
2783 bool isEventT()
const;
2784 bool isClkEventT()
const;
2785 bool isQueueT()
const;
2786 bool isReserveIDT()
const;
2788#define EXT_OPAQUE_TYPE(ExtType, Id, Ext) \
2789 bool is##Id##Type() const;
2790#include "clang/Basic/OpenCLExtensionTypes.def"
2792 bool isOCLIntelSubgroupAVCType()
const;
2793 bool isOCLExtOpaqueType()
const;
2795 bool isPipeType()
const;
2796 bool isBitIntType()
const;
2797 bool isOpenCLSpecificType()
const;
2799#define HLSL_INTANGIBLE_TYPE(Name, Id, SingletonId) bool is##Id##Type() const;
2800#include "clang/Basic/HLSLIntangibleTypes.def"
2801#define HLSL_PACKED_TYPE(Name, Id, SingletonId) bool is##Id##Type() const;
2802#include "clang/Basic/HLSLPackedTypes.def"
2803 bool isHLSLSpecificType()
const;
2804 bool isHLSLBuiltinIntangibleType()
const;
2805 bool isHLSLBuiltinPackedType()
const;
2806 bool isHLSLAttributedResourceType()
const;
2807 bool isHLSLInlineSpirvType()
const;
2808 bool isHLSLResourceRecord()
const;
2809 bool isHLSLResourceRecordArray()
const;
2811 bool isHLSLIntangibleType()
const;
2813 bool isHLSLStandardLayoutRecordOrArrayOf()
const;
2815#define SPIRV_TYPE(Name, Id, SingletonId) bool is##Id##Type() const;
2816#include "clang/Basic/SPIRVTypes.def"
2821 bool isObjCARCImplicitlyUnretainedType()
const;
2824 bool isCUDADeviceBuiltinSurfaceType()
const;
2826 bool isCUDADeviceBuiltinTextureType()
const;
2829 bool isAMDGPUNamedBarrierType()
const;
2832 bool isAMDGPUNamedBarrierTypeOrWrapper()
const;
2835 Qualifiers::ObjCLifetime getObjCARCImplicitLifetime()
const;
2851 ScalarTypeKind getScalarTypeKind()
const;
2879 bool isUndeducedType()
const;
2888 bool hasSizedVLAType()
const;
2891 bool hasUnnamedOrLocalType()
const;
2893 bool isOverloadableType()
const;
2896 bool isElaboratedTypeSpecifier()
const;
2898 bool canDecayToPointerType()
const;
2903 bool hasPointerRepresentation()
const;
2907 bool hasObjCPointerRepresentation()
const;
2911 bool hasIntegerRepresentation()
const;
2915 bool hasSignedIntegerRepresentation()
const;
2919 bool hasUnsignedIntegerRepresentation()
const;
2923 bool hasFloatingRepresentation()
const;
2928 bool hasBooleanRepresentation()
const;
2933 const RecordType *getAsStructureType()
const;
2935 const RecordType *getAsUnionType()
const;
2936 const ComplexType *getAsComplexIntegerType()
const;
2957 inline EnumDecl *getAsEnumDecl()
const;
2958 inline EnumDecl *castAsEnumDecl()
const;
2963 inline TagDecl *getAsTagDecl()
const;
2964 inline TagDecl *castAsTagDecl()
const;
2976 DeducedType *getContainedDeducedType()
const;
2988 bool hasAutoForTrailingReturnType()
const;
2999 template <
typename T>
const T *getAs()
const;
3004 return dyn_cast<T>(CanonicalType);
3011 return cast<T>(CanonicalType);
3015#define TYPE(Class, Base)
3016#define NEVER_CANONICAL_TYPE(Class) \
3017 template <> inline const Class##Type *Type::getAsCanonical() const = delete; \
3018 template <> inline const Class##Type *Type::castAsCanonical() const = delete;
3019#include "clang/AST/TypeNodes.inc"
3025 const TemplateSpecializationType *
3026 getAsNonAliasTemplateSpecializationType()
const;
3028 const TemplateSpecializationType *
3031 assert(TST &&
"not a TemplateSpecializationType");
3040 template <
typename T>
const T *getAsAdjusted()
const;
3044 const ArrayType *getAsArrayTypeUnsafe()
const;
3052 template <
typename T>
const T *castAs()
const;
3056 const ArrayType *castAsArrayTypeUnsafe()
const;
3070 const Type *getBaseElementTypeUnsafe()
const;
3075 const Type *getArrayElementTypeNoTypeQual()
const;
3080 const Type *getPointeeOrArrayElementType()
const;
3088 const Type *getUnqualifiedDesugaredType()
const;
3093 bool isSignedIntegerType()
const;
3098 bool isUnsignedIntegerType()
const;
3102 bool isSignedIntegerOrEnumerationType()
const;
3106 bool isUnsignedIntegerOrEnumerationType()
const;
3110 bool isFixedPointType()
const;
3113 bool isFixedPointOrIntegerType()
const;
3116 bool isConvertibleToFixedPointType()
const;
3120 bool isSaturatedFixedPointType()
const;
3124 bool isUnsaturatedFixedPointType()
const;
3128 bool isSignedFixedPointType()
const;
3132 bool isUnsignedFixedPointType()
const;
3137 bool isConstantSizeType()
const;
3141 bool isSpecifierType()
const;
3161 bool isLinkageValid()
const;
3175 bool canHaveNullability(
bool ResultIfUnknown =
true)
const;
3192 std::optional<ArrayRef<QualType>>
3193 getObjCSubstitutions(
const DeclContext *dc)
const;
3197 bool acceptsObjCTypeParams()
const;
3199 const char *getTypeClassName()
const;
3202 return CanonicalType;
3207 void dump(llvm::raw_ostream &OS,
const ASTContext &Context)
const;
3234#define TYPE(Class, Base)
3235#define ALWAYS_CANONICAL_TYPE(Class) \
3236 template <> inline const Class##Type *Type::getAs() const { \
3237 return dyn_cast<Class##Type>(CanonicalType); \
3239 template <> inline const Class##Type *Type::castAs() const { \
3240 return cast<Class##Type>(CanonicalType); \
3242#include "clang/AST/TypeNodes.inc"
3250#define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) Id,
3251#include "clang/Basic/OpenCLImageTypes.def"
3253#define EXT_OPAQUE_TYPE(ExtType, Id, Ext) Id,
3254#include "clang/Basic/OpenCLExtensionTypes.def"
3256#define SVE_TYPE(Name, Id, SingletonId) Id,
3257#include "clang/Basic/AArch64ACLETypes.def"
3259#define PPC_VECTOR_TYPE(Name, Id, Size) Id,
3260#include "clang/Basic/PPCTypes.def"
3262#define RVV_TYPE(Name, Id, SingletonId) Id,
3263#include "clang/Basic/RISCVVTypes.def"
3265#define WASM_TYPE(Name, Id, SingletonId) Id,
3266#include "clang/Basic/WebAssemblyReferenceTypes.def"
3268#define AMDGPU_TYPE(Name, Id, SingletonId, Width, Align) Id,
3269#include "clang/Basic/AMDGPUTypes.def"
3271#define HLSL_INTANGIBLE_TYPE(Name, Id, SingletonId) Id,
3272#include "clang/Basic/HLSLIntangibleTypes.def"
3274#define HLSL_PACKED_TYPE(Name, Id, SingletonId) Id,
3275#include "clang/Basic/HLSLPackedTypes.def"
3277#define SPIRV_TYPE(Name, Id, SingletonId) Id,
3278#include "clang/Basic/SPIRVTypes.def"
3280#define BUILTIN_TYPE(Id, SingletonId) Id,
3281#define LAST_BUILTIN_TYPE(Id) LastKind = Id
3282#include "clang/AST/BuiltinTypes.def"
3292 static_assert(Kind::LastKind <
3293 (1 << BuiltinTypeBitfields::NumOfBuiltinTypeBits) &&
3294 "Defined builtin type exceeds the allocated space for serial "
3305 StringRef str =
getName(Policy);
3306 assert(!str.empty() && str.data()[str.size()] ==
'\0');
3363class ComplexType :
public Type,
public llvm::FoldingSetNode {
3370 ElementType(Element) {}
3384class ParenType :
public Type,
public llvm::FoldingSetNode {
3404class PointerType :
public Type,
public llvm::FoldingSetNode {
3411 PointeeType(Pointee) {}
3428 using BaseTy = llvm::PointerIntPair<ValueDecl *, 1, unsigned>;
3443 bool isDeref()
const;
3445 unsigned getInt()
const;
3446 void *getOpaqueValue()
const;
3448 void setFromOpaqueValue(
void *
V);
3493 bool referencesFieldDecls()
const;
3499 switch (T->getTypeClass()) {
3500 case CountAttributed:
3526 bool CountInBytes,
bool OrNull,
3533 static CountAttributedType *
3535 Expr *CountExpr,
bool CountInBytes,
bool OrNull,
3559 static void Profile(llvm::FoldingSetNodeID &ID,
QualType WrappedTy,
3563 return T->getTypeClass() == CountAttributed;
3566 StringRef getAttributeName(
bool WithMacroPrefix)
const;
3578class LateParsedAttrType :
public Type {
3587 WrappedTy(Wrapped), LateParsedTypeAttr(
Attr) {}
3592 return LateParsedTypeAttr;
3599 return T->getTypeClass() == LateParsedAttr;
3615 :
Type(TC, CanonicalPtr,
3618 OriginalTy(OriginalTy), AdjustedTy(AdjustedTy) {}
3627 std::pair<QualType, QualType>
getKey()
const {
3628 return {OriginalTy, AdjustedTy};
3632 return T->getTypeClass() == Adjusted || T->getTypeClass() == Decayed;
3648 static bool classof(
const Type *T) {
return T->getTypeClass() == Decayed; }
3654class BlockPointerType :
public Type,
public llvm::FoldingSetNode {
3662 PointeeType(Pointee) {}
3674 return T->getTypeClass() == BlockPointer;
3684 bool SpelledAsLValue)
3686 PointeeType(Referencee) {
3704 while (T->isInnerRef())
3706 return T->PointeeType;
3710 return T->getTypeClass() == LValueReference ||
3711 T->getTypeClass() == RValueReference;
3720 bool SpelledAsLValue)
3729 return T->getTypeClass() == LValueReference;
3745 return T->getTypeClass() == RValueReference;
3752class MemberPointerType :
public Type,
public llvm::FoldingSetNode {
3763 :
Type(MemberPointer, CanonicalPtr,
3767 PointeeType(Pointee), Qualifier(Qualifier) {}
3775 return PointeeType->isFunctionProtoType();
3781 return !PointeeType->isFunctionProtoType();
3790 bool isSugared()
const;
3802 static void Profile(llvm::FoldingSetNodeID &ID,
QualType Pointee,
3807 return T->getTypeClass() == MemberPointer;
3830 unsigned tq,
const Expr *sz =
nullptr);
3848 return T->getTypeClass() == ConstantArray ||
3849 T->getTypeClass() == VariableArray ||
3850 T->getTypeClass() == IncompleteArray ||
3851 T->getTypeClass() == DependentSizedArray ||
3852 T->getTypeClass() == ArrayParameter;
3862 struct ExternalSize {
3863 ExternalSize(
const llvm::APInt &Sz,
const Expr *SE)
3864 :
Size(Sz), SizeExpr(SE) {}
3866 const Expr *SizeExpr;
3877 ConstantArrayTypeBits.HasExternalSize =
false;
3878 ConstantArrayTypeBits.SizeWidth = Width / 8;
3881 assert(Width < 0xFF &&
"Type width in bits must be less than 8 bits");
3884 ConstantArrayType(QualType Et, QualType Can, ExternalSize *SzPtr,
3885 ArraySizeModifier SM,
unsigned TQ)
3886 : ArrayType(ConstantArray, Et, Can, SM, TQ, SzPtr->SizeExpr),
3888 ConstantArrayTypeBits.HasExternalSize =
true;
3889 ConstantArrayTypeBits.SizeWidth = 0;
3891 assert((SzPtr->SizeExpr ==
nullptr || !Can.isNull()) &&
3892 "canonical constant array should not have size expression");
3895 static ConstantArrayType *
Create(
const ASTContext &Ctx, QualType ET,
3896 QualType Can,
const llvm::APInt &Sz,
3897 const Expr *SzExpr, ArraySizeModifier SzMod,
3907 ConstantArrayTypeBits.SizeWidth = ATy->ConstantArrayTypeBits.SizeWidth;
3950 ?
SizePtr->Size.getLimitedValue()
3964 static unsigned getNumAddressingBits(
const ASTContext &Context,
3966 const llvm::APInt &NumElements);
3968 unsigned getNumAddressingBits(
const ASTContext &Context)
const;
3972 static unsigned getMaxSizeBits(
const ASTContext &Context);
3979 static void Profile(llvm::FoldingSetNodeID &ID,
const ASTContext &Ctx,
3984 return T->getTypeClass() == ConstantArray ||
3985 T->getTypeClass() == ArrayParameter;
3991class ArrayParameterType :
public ConstantArrayType {
3994 ArrayParameterType(
const ConstantArrayType *ATy,
QualType CanTy)
3995 : ConstantArrayType(ArrayParameter, ATy, CanTy) {}
3999 return T->getTypeClass() == ArrayParameter;
4013 :
ArrayType(IncompleteArray, et, can, sm, tq) {}
4022 return T->getTypeClass() == IncompleteArray;
4033 ID.AddInteger(llvm::to_underlying(SizeMod));
4034 ID.AddInteger(TypeQuals);
4074 :
ArrayType(VariableArray, et, can, sm, tq, e), SizeExpr((
Stmt *)e) {}
4082 return (
Expr*) SizeExpr;
4089 return T->getTypeClass() == VariableArray;
4093 llvm_unreachable(
"Cannot unique VariableArrayTypes.");
4129 return (
Expr*) SizeExpr;
4136 return T->getTypeClass() == DependentSizedArray;
4144 static void Profile(llvm::FoldingSetNodeID &ID,
const ASTContext &Context,
4146 unsigned TypeQuals,
Expr *E);
4160class DependentAddressSpaceType :
public Type,
public llvm::FoldingSetNode {
4163 Expr *AddrSpaceExpr;
4179 return T->getTypeClass() == DependentAddressSpace;
4186 static void Profile(llvm::FoldingSetNodeID &ID,
const ASTContext &Context,
4200class DependentSizedExtVectorType :
public Type,
public llvm::FoldingSetNode {
4222 return T->getTypeClass() == DependentSizedExtVector;
4229 static void Profile(llvm::FoldingSetNodeID &ID,
const ASTContext &Context,
4302static_assert(
unsigned(VectorKind::RVVFixedLengthData_M1) ==
4303 unsigned(VectorKind::RVVFixedLengthData_MF8) + 3 &&
4304 unsigned(VectorKind::RVVFixedLengthData_M8) ==
4305 unsigned(VectorKind::RVVFixedLengthData_MF8) + 6,
4306 "unexpected order of the RVV fixed-length data vector kinds");
4307static_assert(
unsigned(VectorKind::RVVFixedLengthMaskRatio1_4) ==
4308 unsigned(VectorKind::RVVFixedLengthMaskRatio1) + 3 &&
4309 unsigned(VectorKind::RVVFixedLengthMaskRatio2) ==
4310 unsigned(VectorKind::RVVFixedLengthMaskRatio1) + 4 &&
4311 unsigned(VectorKind::RVVFixedLengthMaskRatio64_4) ==
4312 unsigned(VectorKind::RVVFixedLengthMaskRatio1) + 27,
4313 "unexpected order of the RVV fixed-length mask vector kinds");
4326 "not an RVV fixed-length data vector kind");
4332 assert(LMulLog2 >= -3 && LMulLog2 <= 3 &&
4333 "LMUL out of range for an RVV type");
4348 "not an RVV fixed-length mask vector kind");
4362 static constexpr const char *LMuls[] = {
"mf8",
"mf4",
"mf2",
"m1",
4366 static constexpr const char *Ratios[] = {
"1",
"2",
"4",
"8",
4375 "not an RVV fixed-length mask vector kind");
4378 return Col ? 1u << (Col - 1) : 0;
4384 unsigned SubByteLanes) {
4385 assert(RatioLog2 < 7 &&
"ratio out of range for an RVV mask type");
4386 assert((SubByteLanes == 0 || SubByteLanes == 1 || SubByteLanes == 2 ||
4387 SubByteLanes == 4) &&
4388 "unexpected sub-byte lane count");
4389 unsigned Col = SubByteLanes == 0 ? 0 : llvm::Log2_32(SubByteLanes) + 1;
4391 RatioLog2 * 4 + Col);
4439 ID.AddInteger(NumElements);
4441 ID.AddInteger(llvm::to_underlying(VecKind));
4445 return T->getTypeClass() ==
Vector || T->getTypeClass() == ExtVector;
4458class DependentVectorType :
public Type,
public llvm::FoldingSetNode {
4480 return T->getTypeClass() == DependentVector;
4487 static void Profile(llvm::FoldingSetNodeID &ID,
const ASTContext &Context,
4502 :
VectorType(ExtVector, vecType, nElements, canonType,
4509 case 'x':
case 'r':
return 0;
4510 case 'y':
case 'g':
return 1;
4511 case 'z':
case 'b':
return 2;
4512 case 'w':
case 'a':
return 3;
4530 case 'a':
return 10;
4532 case 'b':
return 11;
4534 case 'c':
return 12;
4536 case 'd':
return 13;
4538 case 'e':
return 14;
4540 case 'f':
return 15;
4545 if (isNumericAccessor)
4561 return T->getTypeClass() == ExtVector;
4583 const Expr *RowExpr =
nullptr,
const Expr *ColumnExpr =
nullptr);
4596 if (T->isDependentType())
4600 if (T->isEnumeralType())
4606 return T->isRealType();
4610 return T->isRealType() && !T->isBooleanType();
4617 return T->getTypeClass() == ConstantMatrix ||
4618 T->getTypeClass() == DependentSizedMatrix;
4633 unsigned NColumns,
QualType CanonElementType,
4634 std::optional<LayoutKind>
Layout);
4637 unsigned NColumns,
QualType CanonElementType,
4638 std::optional<LayoutKind>
Layout);
4671 bool IsRowMajor =
false)
const {
4681 unsigned Row = ColumnMajorIdx %
NumRows;
4701 ID.AddPointer(ElementType.getAsOpaquePtr());
4704 ID.AddInteger(
Layout ? llvm::to_underlying(*
Layout) + 1 : 0);
4709 return T->getTypeClass() == ConstantMatrix;
4736 :
Type(
Type::CooperativeMatrix, CanonicalType,
4780 ID.AddInteger(
Scope);
4810 return T->getTypeClass() == CooperativeMatrix;
4833 return T->getTypeClass() == DependentSizedMatrix;
4840 static void Profile(llvm::FoldingSetNodeID &ID,
const ASTContext &Context,
4876 HasPassObjSize = 0x20,
4879 unsigned char Data = 0;
4888 copy.Data = (copy.Data & ~ABIMask) |
unsigned(
kind);
4898 copy.Data |= IsConsumed;
4900 copy.Data &= ~IsConsumed;
4907 Copy.Data |= HasPassObjSize;
4915 Copy.Data |= IsNoEscape;
4917 Copy.Data &= ~IsNoEscape;
4929 return lhs.Data == rhs.Data;
4933 return lhs.Data != rhs.Data;
4968 enum { CallConvMask = 0x3F };
4969 enum { NoReturnMask = 0x40 };
4970 enum { ProducesResultMask = 0x80 };
4971 enum { NoCallerSavedRegsMask = 0x100 };
4972 enum { RegParmMask = 0xe00, RegParmOffset = 9 };
4973 enum { NoCfCheckMask = 0x1000 };
4974 enum { CmseNSCallMask = 0x2000 };
4977 ExtInfo(
unsigned Bits) : Bits(static_cast<
uint16_t>(Bits)) {}
4983 bool producesResult,
bool noCallerSavedRegs,
bool NoCfCheck,
4985 assert((!hasRegParm || regParm < 7) &&
"Invalid regparm value");
4986 Bits = ((
unsigned)cc) | (noReturn ? NoReturnMask : 0) |
4987 (producesResult ? ProducesResultMask : 0) |
4988 (noCallerSavedRegs ? NoCallerSavedRegsMask : 0) |
4989 (hasRegParm ? ((regParm + 1) << RegParmOffset) : 0) |
4990 (NoCfCheck ? NoCfCheckMask : 0) |
4991 (cmseNSCall ? CmseNSCallMask : 0);
5007 bool getHasRegParm()
const {
return ((Bits & RegParmMask) >> RegParmOffset) != 0; }
5010 unsigned RegParm = (Bits & RegParmMask) >> RegParmOffset;
5019 return Bits ==
Other.Bits;
5022 return Bits !=
Other.Bits;
5030 return ExtInfo(Bits | NoReturnMask);
5032 return ExtInfo(Bits & ~NoReturnMask);
5037 return ExtInfo(Bits | ProducesResultMask);
5039 return ExtInfo(Bits & ~ProducesResultMask);
5044 return ExtInfo(Bits | CmseNSCallMask);
5046 return ExtInfo(Bits & ~CmseNSCallMask);
5050 if (noCallerSavedRegs)
5051 return ExtInfo(Bits | NoCallerSavedRegsMask);
5053 return ExtInfo(Bits & ~NoCallerSavedRegsMask);
5058 return ExtInfo(Bits | NoCfCheckMask);
5060 return ExtInfo(Bits & ~NoCfCheckMask);
5064 assert(RegParm < 7 &&
"Invalid regparm value");
5065 return ExtInfo((Bits & ~RegParmMask) |
5066 ((RegParm + 1) << RegParmOffset));
5070 return ExtInfo((Bits & ~CallConvMask) | (
unsigned) cc);
5074 ID.AddInteger(Bits);
5092 LLVM_PREFERRED_TYPE(
bool)
5095 LLVM_PREFERRED_TYPE(
bool)
5098 LLVM_PREFERRED_TYPE(
bool)
5198 bool getCFIUncheckedCalleeAttr()
const;
5205 "Const, volatile and restrict are assumed to be a subset of "
5206 "the fast qualifiers.");
5218 static StringRef getNameForCallConv(
CallingConv CC);
5221 return T->getTypeClass() == FunctionNoProto ||
5222 T->getTypeClass() == FunctionProto;
5228class FunctionNoProtoType :
public FunctionType,
public llvm::FoldingSetNode {
5251 ID.AddPointer(ResultType.getAsOpaquePtr());
5255 return T->getTypeClass() == FunctionNoProto;
5305 Kind oppositeKind()
const;
5328 llvm_unreachable(
"unknown effect kind");
5332 StringRef name()
const;
5336 OS << Effect.
name();
5346 std::optional<FunctionEffect>
5347 effectProhibitingInference(
const Decl &Callee,
5354 bool shouldDiagnoseFunctionCall(
bool Direct,
5358 return LHS.FKind == RHS.FKind;
5361 return !(LHS == RHS);
5364 return LHS.FKind < RHS.FKind;
5371 Expr *Cond =
nullptr;
5380 return Cond == RHS.Cond;
5395 std::string description()
const;
5397 friend raw_ostream &
operator<<(raw_ostream &OS,
5406 const Container *Outer =
nullptr;
5413 return Idx ==
Other.Idx;
5416 return Idx !=
Other.Idx;
5425 assert(Outer !=
nullptr &&
"invalid FunctionEffectIterator");
5426 bool HasConds = !Outer->Conditions.empty();
5428 HasConds ? Outer->Conditions[Idx]
5450class FunctionEffectsRef {
5455 friend FunctionProtoType;
5456 friend FunctionEffectSet;
5467 : Effects(FX), Conditions(Conds) {}
5480 bool empty()
const {
return Effects.empty(); }
5481 size_t size()
const {
return Effects.size(); }
5492 const FunctionEffectsRef &RHS) {
5493 return LHS.Effects == RHS.Effects && LHS.Conditions == RHS.Conditions;
5496 const FunctionEffectsRef &RHS) {
5497 return !(LHS == RHS);
5500 void dump(llvm::raw_ostream &OS)
const;
5504class FunctionEffectKindSet {
5507 using KindBitsT = std::bitset<EndBitPos>;
5509 KindBitsT KindBits{};
5511 explicit FunctionEffectKindSet(KindBitsT KB) : KindBits(KB) {}
5517 return static_cast<size_t>(K);
5526 const FunctionEffectKindSet *Outer =
nullptr;
5531 void advanceToNextSetBit() {
5532 while (Idx < EndBitPos && !Outer->KindBits.test(Idx))
5537 iterator() =
delete;
5538 iterator(
const FunctionEffectKindSet &O,
size_t I) : Outer(&O), Idx(I) {
5539 advanceToNextSetBit();
5544 iterator operator++() {
5546 advanceToNextSetBit();
5551 assert(Idx < EndBitPos &&
"Dereference of end iterator");
5560 iterator
begin()
const {
return iterator(*
this, 0); }
5561 iterator
end()
const {
return iterator(*
this, EndBitPos); }
5570 bool empty()
const {
return KindBits.none(); }
5572 return KindBits.test(kindToPos(EK));
5574 void dump(llvm::raw_ostream &OS)
const;
5576 static FunctionEffectKindSet
difference(FunctionEffectKindSet LHS,
5577 FunctionEffectKindSet RHS) {
5578 return FunctionEffectKindSet(LHS.KindBits & ~RHS.KindBits);
5594 : Effects(FX.effects()), Conditions(FX.conditions()) {}
5596 bool empty()
const {
return Effects.empty(); }
5597 size_t size()
const {
return Effects.size(); }
5606 void dump(llvm::raw_ostream &OS)
const;
5641class FunctionProtoType final
5643 public llvm::FoldingSetNode,
5644 private llvm::TrailingObjects<
5645 FunctionProtoType, QualType, SourceLocation,
5646 FunctionType::FunctionTypeExtraBitfields,
5647 FunctionType::FunctionTypeExtraAttributeInfo,
5648 FunctionType::FunctionTypeArmAttributes, FunctionType::ExceptionType,
5649 Expr *, FunctionDecl *, FunctionType::ExtParameterInfo, Qualifiers,
5650 FunctionEffect, EffectConditionExpr> {
5652 friend TrailingObjects;
5745 LLVM_PREFERRED_TYPE(
bool)
5747 LLVM_PREFERRED_TYPE(
bool)
5749 LLVM_PREFERRED_TYPE(
bool)
5764 Result.ExceptionSpec = ESI;
5798 unsigned numTrailingObjects(OverloadToken<QualType>)
const {
5799 return getNumParams();
5802 unsigned numTrailingObjects(OverloadToken<SourceLocation>)
const {
5803 return isVariadic();
5806 unsigned numTrailingObjects(OverloadToken<FunctionTypeArmAttributes>)
const {
5807 return hasArmTypeAttributes();
5810 unsigned numTrailingObjects(OverloadToken<FunctionTypeExtraBitfields>)
const {
5811 return hasExtraBitfields();
5815 numTrailingObjects(OverloadToken<FunctionTypeExtraAttributeInfo>)
const {
5816 return hasExtraAttributeInfo();
5819 unsigned numTrailingObjects(OverloadToken<ExceptionType>)
const {
5820 return getExceptionSpecSize().NumExceptionType;
5823 unsigned numTrailingObjects(OverloadToken<Expr *>)
const {
5824 return getExceptionSpecSize().NumExprPtr;
5827 unsigned numTrailingObjects(OverloadToken<FunctionDecl *>)
const {
5828 return getExceptionSpecSize().NumFunctionDeclPtr;
5831 unsigned numTrailingObjects(OverloadToken<ExtParameterInfo>)
const {
5832 return hasExtParameterInfos() ? getNumParams() : 0;
5835 unsigned numTrailingObjects(OverloadToken<Qualifiers>)
const {
5836 return hasExtQualifiers() ? 1 : 0;
5839 unsigned numTrailingObjects(OverloadToken<FunctionEffect>)
const {
5840 return getNumFunctionEffects();
5845 static bool containsAnyUnexpandedParameterPack(
const QualType *ArgArray,
5847 for (
unsigned Idx = 0; Idx < numArgs; ++Idx)
5848 if (ArgArray[Idx]->containsUnexpandedParameterPack())
5854 FunctionProtoType(QualType result, ArrayRef<QualType> params,
5855 QualType canonical,
const ExtProtoInfo &epi);
5860 struct ExceptionSpecSizeHolder {
5861 unsigned NumExceptionType;
5862 unsigned NumExprPtr;
5863 unsigned NumFunctionDeclPtr;
5868 static ExceptionSpecSizeHolder
5869 getExceptionSpecSize(ExceptionSpecificationType EST,
unsigned NumExceptions) {
5880 return {NumExceptions, 0, 0};
5893 llvm_unreachable(
"bad exception specification kind");
5898 ExceptionSpecSizeHolder getExceptionSpecSize()
const {
5899 return getExceptionSpecSize(getExceptionSpecType(), getNumExceptions());
5903 bool hasExtraBitfields()
const {
5904 assert((getExceptionSpecType() != EST_Dynamic ||
5905 FunctionTypeBits.HasExtraBitfields) &&
5906 "ExtraBitfields are required for given ExceptionSpecType");
5907 return FunctionTypeBits.HasExtraBitfields;
5911 bool hasExtraAttributeInfo()
const {
5912 return FunctionTypeBits.HasExtraBitfields &&
5913 getTrailingObjects<FunctionTypeExtraBitfields>()
5914 ->HasExtraAttributeInfo;
5917 bool hasArmTypeAttributes()
const {
5918 return FunctionTypeBits.HasExtraBitfields &&
5919 getTrailingObjects<FunctionTypeExtraBitfields>()
5920 ->HasArmTypeAttributes;
5923 bool hasExtQualifiers()
const {
5924 return FunctionTypeBits.HasExtQuals;
5931 assert(i <
getNumParams() &&
"invalid parameter index");
5976 bool hasDependentExceptionSpec()
const;
5980 bool hasInstantiationDependentExceptionSpec()
const;
6002 ? getTrailingObjects<FunctionTypeExtraBitfields>()
6018 return *getTrailingObjects<Expr *>();
6029 return getTrailingObjects<FunctionDecl *>()[0];
6039 return getTrailingObjects<FunctionDecl *>()[1];
6057 return isVariadic() ? *getTrailingObjects<SourceLocation>()
6067 bool isTemplateVariadic()
const;
6077 if (hasExtQualifiers())
6078 return *getTrailingObjects<Qualifiers>();
6095 return getTrailingObjects<QualType>();
6110 getTrailingObjects<ExceptionType>());
6135 return getTrailingObjects<ExtParameterInfo>();
6140 if (hasExtraAttributeInfo())
6141 return *getTrailingObjects<FunctionTypeExtraAttributeInfo>();
6148 if (!hasArmTypeAttributes())
6150 return getTrailingObjects<FunctionTypeArmAttributes>()
6151 ->AArch64SMEAttributes;
6155 assert(I <
getNumParams() &&
"parameter index out of range");
6157 return getTrailingObjects<ExtParameterInfo>()[I];
6162 assert(I <
getNumParams() &&
"parameter index out of range");
6164 return getTrailingObjects<ExtParameterInfo>()[I].getABI();
6169 assert(I <
getNumParams() &&
"parameter index out of range");
6171 return getTrailingObjects<ExtParameterInfo>()[I].isConsumed();
6176 return hasExtraBitfields()
6177 ? getTrailingObjects<FunctionTypeExtraBitfields>()
6178 ->NumFunctionEffects
6184 if (hasExtraBitfields()) {
6185 const auto *Bitfields = getTrailingObjects<FunctionTypeExtraBitfields>();
6186 if (Bitfields->NumFunctionEffects > 0)
6187 return getTrailingObjects<FunctionEffect>(
6188 Bitfields->NumFunctionEffects);
6194 if (hasExtraBitfields()) {
6195 const auto *Bitfields = getTrailingObjects<FunctionTypeExtraBitfields>();
6196 if (Bitfields->EffectsHaveConditions)
6197 return Bitfields->NumFunctionEffects;
6204 if (hasExtraBitfields()) {
6205 const auto *Bitfields = getTrailingObjects<FunctionTypeExtraBitfields>();
6206 if (Bitfields->EffectsHaveConditions)
6207 return getTrailingObjects<EffectConditionExpr>(
6208 Bitfields->NumFunctionEffects);
6215 if (hasExtraBitfields()) {
6216 const auto *Bitfields = getTrailingObjects<FunctionTypeExtraBitfields>();
6217 if (Bitfields->NumFunctionEffects > 0) {
6218 const size_t NumConds = Bitfields->EffectsHaveConditions
6219 ? Bitfields->NumFunctionEffects
6222 getTrailingObjects<FunctionEffect>(Bitfields->NumFunctionEffects),
6223 {NumConds ? getTrailingObjects<EffectConditionExpr>() : nullptr,
6233 void printExceptionSpecification(raw_ostream &OS,
6237 return T->getTypeClass() == FunctionProto;
6240 void Profile(llvm::FoldingSetNodeID &ID,
const ASTContext &Ctx);
6319 template <
class... As>
6322 this->KeywordWrapperBits.Keyword = llvm::to_underlying(
Keyword);
6347 constexpr unsigned long Offset =
6349 const auto *
Addr =
reinterpret_cast<const T *
>(
6350 reinterpret_cast<const char *
>(
this) - Offset);
6351 assert(llvm::isAddrAligned(llvm::Align(
alignof(T)),
Addr));
6361class UnresolvedUsingType final
6363 private llvm::TrailingObjects<UnresolvedUsingType,
6364 FoldingSetPlaceholder<UnresolvedUsingType>,
6365 NestedNameSpecifier> {
6367 friend TrailingObjects;
6371 unsigned numTrailingObjects(
6379 assert(numTrailingObjects(
6382 return getTrailingObjects<FoldingSetPlaceholder<UnresolvedUsingType>>();
6385 UnresolvedUsingType(ElaboratedTypeKeyword Keyword,
6386 NestedNameSpecifier Qualifier,
6387 const UnresolvedUsingTypenameDecl *D,
6388 const Type *CanonicalType);
6393 ? *getTrailingObjects<NestedNameSpecifier>()
6408 Qualifier.Profile(ID);
6416 return T->getTypeClass() == UnresolvedUsing;
6421 public llvm::FoldingSetNode,
6422 llvm::TrailingObjects<UsingType, NestedNameSpecifier> {
6427 friend TrailingObjects;
6434 return UsingBits.hasQualifier ? *getTrailingObjects() : std::nullopt;
6447 UnderlyingType.Profile(ID);
6449 Qualifier.Profile(ID);
6455 static bool classof(
const Type *T) {
return T->getTypeClass() == Using; }
6458class TypedefType final
6460 private llvm::TrailingObjects<TypedefType,
6461 FoldingSetPlaceholder<TypedefType>,
6462 NestedNameSpecifier, QualType> {
6465 friend TrailingObjects;
6474 unsigned numTrailingObjects(OverloadToken<NestedNameSpecifier>)
const {
6475 return TypedefBits.hasQualifier;
6478 TypedefType(TypeClass TC, ElaboratedTypeKeyword Keyword,
6479 NestedNameSpecifier Qualifier,
const TypedefNameDecl *D,
6480 QualType UnderlyingType,
bool HasTypeDifferentFromDecl);
6482 FoldingSetPlaceholder<TypedefType> *getFoldingSetPlaceholder() {
6483 assert(numTrailingObjects(
6484 OverloadToken<FoldingSetPlaceholder<TypedefType>>{}) == 1);
6485 return getTrailingObjects<FoldingSetPlaceholder<TypedefType>>();
6490 return TypedefBits.hasQualifier ? *getTrailingObjects<NestedNameSpecifier>()
6511 ID.AddInteger(llvm::to_underlying(
Keyword));
6513 Qualifier.Profile(ID);
6514 if (!Underlying.
isNull())
6528class MacroQualifiedType :
public Type {
6537 UnderlyingTy(UnderlyingTy), MacroII(MacroII) {
6539 "Expected a macro qualified type to only wrap attributed types.");
6554 return T->getTypeClass() == MacroQualified;
6582 bool isSugared()
const;
6584 static bool classof(
const Type *T) {
return T->getTypeClass() == TypeOfExpr; }
6594 public llvm::FoldingSetNode {
6604 static void Profile(llvm::FoldingSetNodeID &ID,
const ASTContext &Context,
6605 Expr *E,
bool IsUnqual);
6610class TypeOfType :
public Type {
6616 TypeOfType(
const ASTContext &Context, QualType T, QualType Can,
6620 QualType getUnmodifiedType()
const {
return TOType; }
6623 QualType desugar()
const;
6626 bool isSugared()
const {
return true; }
6630 return static_cast<TypeOfKind>(TypeOfBits.Kind);
6633 static bool classof(
const Type *T) {
return T->getTypeClass() == TypeOf; }
6637class DecltypeType :
public Type {
6639 QualType UnderlyingType;
6642 friend class ASTContext;
6644 DecltypeType(Expr *E, QualType underlyingType, QualType can = QualType());
6647 Expr *getUnderlyingExpr()
const {
return E; }
6651 QualType desugar()
const;
6654 bool isSugared()
const;
6656 static bool classof(
const Type *T) {
return T->getTypeClass() == Decltype; }
6665class DependentDecltypeType :
public DecltypeType,
public llvm::FoldingSetNode {
6667 DependentDecltypeType(Expr *E);
6669 void Profile(llvm::FoldingSetNodeID &ID,
const ASTContext &Context) {
6670 Profile(ID, Context, getUnderlyingExpr());
6673 static void Profile(llvm::FoldingSetNodeID &ID,
const ASTContext &Context,
6677class PackIndexingType final
6679 public llvm::FoldingSetNode,
6680 private llvm::TrailingObjects<PackIndexingType, QualType> {
6681 friend TrailingObjects;
6688 LLVM_PREFERRED_TYPE(
bool)
6689 unsigned FullySubstituted : 1;
6692 friend class ASTContext;
6693 PackIndexingType(QualType Canonical, QualType Pattern, Expr *IndexExpr,
6694 bool FullySubstituted, ArrayRef<QualType> Expansions = {});
6697 Expr *getIndexExpr()
const {
return IndexExpr; }
6698 QualType getPattern()
const {
return Pattern; }
6700 bool isSugared()
const {
return hasSelectedType(); }
6702 QualType desugar()
const {
6703 if (hasSelectedType())
6704 return getSelectedType();
6705 return QualType(
this, 0);
6708 QualType getSelectedType()
const {
6709 assert(hasSelectedType() &&
"Type is dependant");
6710 return *(getExpansionsPtr() + *getSelectedIndex());
6715 bool hasSelectedType()
const {
return getSelectedIndex() != std::nullopt; }
6717 bool isFullySubstituted()
const {
return FullySubstituted; }
6719 bool expandsToEmptyPack()
const {
return isFullySubstituted() &&
Size == 0; }
6721 ArrayRef<QualType> getExpansions()
const {
6722 return {getExpansionsPtr(),
Size};
6725 static bool classof(
const Type *T) {
6726 return T->getTypeClass() == PackIndexing;
6729 void Profile(llvm::FoldingSetNodeID &ID,
const ASTContext &Context);
6730 static void Profile(llvm::FoldingSetNodeID &ID,
const ASTContext &Context,
6731 QualType Pattern, Expr *E,
bool FullySubstituted,
6732 ArrayRef<QualType> Expansions);
6735 const QualType *getExpansionsPtr()
const {
return getTrailingObjects(); }
6738 ArrayRef<QualType> Expansions = {});
6742class UnaryTransformType :
public Type,
public llvm::FoldingSetNode {
6745#define TRANSFORM_TYPE_TRAIT_DEF(Enum, _) Enum,
6746#include "clang/Basic/BuiltinTraits.inc"
6754 QualType UnderlyingType;
6759 friend class ASTContext;
6761 UnaryTransformType(QualType BaseTy, QualType UnderlyingTy, UTTKind UKind,
6762 QualType CanonicalTy);
6765 bool isSugared()
const {
return !isDependentType(); }
6766 QualType desugar()
const {
return UnderlyingType; }
6771 UTTKind getUTTKind()
const {
return UKind; }
6773 static bool classof(
const Type *T) {
6774 return T->getTypeClass() == UnaryTransform;
6777 std::tuple<QualType, QualType, UTTKind> getKey()
const {
6782class TagType :
public TypeWithKeyword {
6783 friend class ASTContext;
6789 void *getTrailingPointer()
const;
6790 NestedNameSpecifier &getTrailingQualifier()
const;
6793 TagType(TypeClass TC, ElaboratedTypeKeyword Keyword,
6794 NestedNameSpecifier Qualifier,
const TagDecl *TD,
bool OwnsTag,
6795 bool IsInjected,
const Type *CanonicalType);
6798 TagDecl *getDecl()
const {
return decl; }
6799 [[deprecated(
"Use getDecl instead")]] TagDecl *getOriginalDecl()
const {
6803 NestedNameSpecifier getQualifier()
const;
6806 bool isTagOwned()
const {
return TagTypeBits.OwnsTag; }
6808 bool isInjected()
const {
return TagTypeBits.IsInjected; }
6810 ClassTemplateDecl *getTemplateDecl()
const;
6811 TemplateName getTemplateName(
const ASTContext &Ctx)
const;
6812 ArrayRef<TemplateArgument> getTemplateArgs(
const ASTContext &Ctx)
const;
6814 bool isSugared()
const {
return false; }
6815 QualType desugar()
const {
return getCanonicalTypeInternal(); }
6817 static bool classof(
const Type *T) {
6818 return T->getTypeClass() ==
Enum || T->getTypeClass() ==
Record ||
6819 T->getTypeClass() == InjectedClassName;
6823struct TagTypeFoldingSetPlaceholder :
public llvm::FoldingSetNode {
6824 static constexpr size_t getOffset() {
6825 return alignof(TagType) -
6826 (
sizeof(TagTypeFoldingSetPlaceholder) %
alignof(TagType));
6829 static void Profile(llvm::FoldingSetNodeID &ID, ElaboratedTypeKeyword Keyword,
6830 NestedNameSpecifier Qualifier,
const TagDecl *Tag,
6831 bool OwnsTag,
bool IsInjected) {
6832 ID.AddInteger(
uintptr_t(Tag) | OwnsTag | (IsInjected << 1) |
6833 ((Keyword != ElaboratedTypeKeyword::None) << 2));
6834 if (Keyword != ElaboratedTypeKeyword::None)
6835 ID.AddInteger(llvm::to_underlying(Keyword));
6840 void Profile(llvm::FoldingSetNodeID &ID)
const {
6841 const TagType *T = getTagType();
6842 Profile(ID, T->getKeyword(), T->getQualifier(), T->getDecl(),
6843 T->isTagOwned(), T->isInjected());
6846 TagType *getTagType() {
6847 return reinterpret_cast<TagType *
>(
reinterpret_cast<char *
>(
this + 1) +
6850 const TagType *getTagType()
const {
6851 return const_cast<TagTypeFoldingSetPlaceholder *
>(
this)->getTagType();
6853 static TagTypeFoldingSetPlaceholder *fromTagType(TagType *T) {
6854 return reinterpret_cast<TagTypeFoldingSetPlaceholder *
>(
6855 reinterpret_cast<char *
>(T) - getOffset()) -
6862class RecordType final :
public TagType {
6863 using TagType::TagType;
6866 RecordDecl *getDecl()
const {
6867 return reinterpret_cast<RecordDecl *
>(TagType::getDecl());
6869 [[deprecated(
"Use getDecl instead")]] RecordDecl *getOriginalDecl()
const {
6875 bool hasConstFields()
const;
6877 static bool classof(
const Type *T) {
return T->getTypeClass() ==
Record; }
6882class EnumType final :
public TagType {
6883 using TagType::TagType;
6886 EnumDecl *getDecl()
const {
6887 return reinterpret_cast<EnumDecl *
>(TagType::getDecl());
6889 [[deprecated(
"Use getDecl instead")]] EnumDecl *getOriginalDecl()
const {
6893 static bool classof(
const Type *T) {
return T->getTypeClass() ==
Enum; }
6913class InjectedClassNameType final :
public TagType {
6914 friend class ASTContext;
6916 InjectedClassNameType(ElaboratedTypeKeyword Keyword,
6917 NestedNameSpecifier Qualifier,
const TagDecl *TD,
6918 bool IsInjected,
const Type *CanonicalType);
6921 CXXRecordDecl *getDecl()
const {
6922 return reinterpret_cast<CXXRecordDecl *
>(TagType::getDecl());
6924 [[deprecated(
"Use getDecl instead")]] CXXRecordDecl *getOriginalDecl()
const {
6928 static bool classof(
const Type *T) {
6929 return T->getTypeClass() == InjectedClassName;
6947 using Kind = attr::Kind;
6950 friend class ASTContext;
6952 const Attr *Attribute;
6954 QualType ModifiedType;
6955 QualType EquivalentType;
6957 AttributedType(QualType canon, attr::Kind attrKind, QualType modified,
6958 QualType equivalent)
6961 AttributedType(QualType canon,
const Attr *attr, QualType modified,
6962 QualType equivalent);
6965 AttributedType(QualType canon, attr::Kind attrKind,
const Attr *attr,
6966 QualType modified, QualType equivalent);
6969 Kind getAttrKind()
const {
6970 return static_cast<Kind>(AttributedTypeBits.AttrKind);
6973 const Attr *getAttr()
const {
return Attribute; }
6975 QualType getModifiedType()
const {
return ModifiedType; }
6976 QualType getEquivalentType()
const {
return EquivalentType; }
6978 bool isSugared()
const {
return true; }
6979 QualType desugar()
const {
return getEquivalentType(); }
6996 bool isQualifier()
const;
6998 bool isMSTypeSpec()
const;
7000 bool isWebAssemblyFuncrefSpec()
const;
7002 bool isCallingConv()
const;
7017 void Profile(llvm::FoldingSetNodeID &ID,
const ASTContext &Ctx) {
7018 Profile(ID, Ctx, getAttrKind(), ModifiedType, EquivalentType, Attribute);
7021 static void Profile(llvm::FoldingSetNodeID &ID,
const ASTContext &Ctx,
7022 Kind attrKind, QualType modified, QualType equivalent,
7025 static bool classof(
const Type *T) {
7026 return T->getTypeClass() == Attributed;
7030class BTFTagAttributedType :
public Type,
public llvm::FoldingSetNode {
7032 friend class ASTContext;
7034 QualType WrappedType;
7035 const BTFTypeTagAttr *BTFAttr;
7037 BTFTagAttributedType(QualType Canon, QualType Wrapped,
7038 const BTFTypeTagAttr *BTFAttr)
7039 : Type(BTFTagAttributed, Canon, Wrapped->getDependence()),
7040 WrappedType(Wrapped), BTFAttr(BTFAttr) {}
7043 QualType getWrappedType()
const {
return WrappedType; }
7044 const BTFTypeTagAttr *getAttr()
const {
return BTFAttr; }
7046 bool isSugared()
const {
return true; }
7047 QualType desugar()
const {
return getWrappedType(); }
7049 void Profile(llvm::FoldingSetNodeID &ID) {
7050 Profile(ID, WrappedType, BTFAttr);
7053 static void Profile(llvm::FoldingSetNodeID &ID, QualType Wrapped,
7054 const BTFTypeTagAttr *BTFAttr) {
7055 ID.AddPointer(Wrapped.getAsOpaquePtr());
7056 ID.AddPointer(BTFAttr);
7059 static bool classof(
const Type *T) {
7060 return T->getTypeClass() == BTFTagAttributed;
7064class OverflowBehaviorType :
public Type,
public llvm::FoldingSetNode {
7066 enum OverflowBehaviorKind { Wrap, Trap };
7069 friend class ASTContext;
7071 QualType UnderlyingType;
7072 OverflowBehaviorKind BehaviorKind;
7073 const ASTContext &Context;
7075 OverflowBehaviorType(
const ASTContext &Context, QualType Canon,
7076 QualType Underlying, OverflowBehaviorKind Kind);
7080 OverflowBehaviorKind getBehaviorKind()
const {
return BehaviorKind; }
7082 bool isWrapKind()
const {
return BehaviorKind == OverflowBehaviorKind::Wrap; }
7083 bool isTrapKind()
const {
return BehaviorKind == OverflowBehaviorKind::Trap; }
7085 bool isSugared()
const {
return false; }
7088 SplitQualType getSplitUnqualifiedType()
const;
7090 std::pair<QualType, OverflowBehaviorKind> getKey()
const {
7091 return {UnderlyingType, BehaviorKind};
7094 static bool classof(
const Type *T) {
7095 return T->getTypeClass() == OverflowBehavior;
7099class HLSLAttributedResourceType :
public Type,
public llvm::FoldingSetNode {
7104 llvm::dxil::ResourceDimension ResourceDimension;
7106 LLVM_PREFERRED_TYPE(
bool)
7109 LLVM_PREFERRED_TYPE(
bool)
7112 LLVM_PREFERRED_TYPE(
bool)
7115 LLVM_PREFERRED_TYPE(
bool)
7122 Expr *SampleCountExpr;
7125 llvm::dxil::ResourceDimension ResourceDimension,
7126 bool IsROV =
false,
bool RawBuffer =
false,
7127 bool IsCounter =
false,
bool IsArray =
false,
7128 Expr *SampleCountExpr =
nullptr)
7130 IsROV(IsROV), RawBuffer(RawBuffer), IsCounter(IsCounter),
7131 IsArray(IsArray), SampleCountExpr(SampleCountExpr) {}
7138 llvm::dxil::ResourceDimension::
Unknown) {}
7140 bool isMultiSampled()
const {
return SampleCountExpr !=
nullptr; }
7142 friend bool operator==(
const Attributes &LHS,
const Attributes &RHS) {
7143 return std::tie(LHS.ResourceClass, LHS.ResourceDimension, LHS.IsROV,
7144 LHS.RawBuffer, LHS.IsCounter, LHS.IsArray,
7145 LHS.SampleCountExpr) ==
7146 std::tie(RHS.ResourceClass, RHS.ResourceDimension, RHS.IsROV,
7147 RHS.RawBuffer, RHS.IsCounter, RHS.IsArray,
7148 RHS.SampleCountExpr);
7150 friend bool operator!=(
const Attributes &LHS,
const Attributes &RHS) {
7151 return !(LHS == RHS);
7156 friend class ASTContext;
7158 QualType WrappedType;
7159 QualType ContainedType;
7160 const Attributes Attrs;
7162 HLSLAttributedResourceType(QualType Wrapped, QualType Contained,
7163 const Attributes &Attrs);
7167 const Attributes &Attrs);
7170 QualType getWrappedType()
const {
return WrappedType; }
7171 QualType getContainedType()
const {
return ContainedType; }
7172 bool hasContainedType()
const {
return !ContainedType.isNull(); }
7173 Expr *getSampleCountExpr()
const {
return Attrs.SampleCountExpr; }
7174 bool isMultiSampled()
const {
return Attrs.isMultiSampled(); }
7175 const Attributes &getAttrs()
const {
return Attrs; }
7176 bool isRaw()
const {
return Attrs.RawBuffer; }
7177 bool isStructured()
const {
return !ContainedType->isChar8Type(); }
7179 bool isSugared()
const {
return false; }
7180 QualType desugar()
const {
return QualType(
this, 0); }
7182 void Profile(llvm::FoldingSetNodeID &ID,
const ASTContext &Ctx) {
7183 Profile(ID, Ctx, WrappedType, ContainedType, Attrs);
7186 static void Profile(llvm::FoldingSetNodeID &ID,
const ASTContext &Ctx,
7187 QualType Wrapped, QualType Contained,
7188 const Attributes &Attrs);
7190 static bool classof(
const Type *T) {
7191 return T->getTypeClass() == HLSLAttributedResource;
7195 static const HLSLAttributedResourceType *
7196 findHandleTypeOnResource(
const Type *RT);
7202 enum SpirvOperandKind :
unsigned char {
7215 QualType ResultType;
7221 SpirvOperand(SpirvOperandKind Kind, QualType ResultType, llvm::APInt
Value)
7224 SpirvOperand(
const SpirvOperand &Other) =
default;
7225 ~SpirvOperand() =
default;
7226 SpirvOperand &operator=(
const SpirvOperand &Other) =
default;
7228 bool operator==(
const SpirvOperand &Other)
const {
7233 bool operator!=(
const SpirvOperand &Other)
const {
return !(*
this ==
Other); }
7238 bool isConstant()
const {
return Kind == ConstantId; }
7240 bool isType()
const {
return Kind == TypeId; }
7242 llvm::APInt getValue()
const {
7244 "This is not an operand with a value!");
7248 QualType getResultType()
const {
7249 assert((isConstant() || isType()) &&
7250 "This is not an operand with a result type!");
7254 static SpirvOperand createConstant(QualType ResultType, llvm::APInt Val) {
7255 return SpirvOperand(ConstantId, ResultType, std::move(Val));
7258 static SpirvOperand createLiteral(llvm::APInt Val) {
7259 return SpirvOperand(Literal, QualType(), std::move(Val));
7262 static SpirvOperand createType(QualType T) {
7263 return SpirvOperand(TypeId, T, llvm::APSInt());
7266 void Profile(llvm::FoldingSetNodeID &ID)
const {
7267 ID.AddInteger(Kind);
7268 ID.AddPointer(ResultType.getAsOpaquePtr());
7274class HLSLInlineSpirvType final
7276 public llvm::FoldingSetNode,
7277 private llvm::TrailingObjects<HLSLInlineSpirvType, SpirvOperand> {
7278 friend class ASTContext;
7279 friend TrailingObjects;
7288 ArrayRef<SpirvOperand> Operands)
7290 Size(
Size), Alignment(Alignment), NumOperands(Operands.size()) {
7291 for (
size_t I = 0; I < NumOperands; I++) {
7294 auto *
Operand =
new (&getTrailingObjects()[I]) SpirvOperand();
7302 uint32_t getAlignment()
const {
return Alignment; }
7303 ArrayRef<SpirvOperand> getOperands()
const {
7304 return getTrailingObjects(NumOperands);
7307 bool isSugared()
const {
return false; }
7308 QualType desugar()
const {
return QualType(
this, 0); }
7310 void Profile(llvm::FoldingSetNodeID &ID) {
7311 Profile(ID, Opcode, Size, Alignment, getOperands());
7314 static void Profile(llvm::FoldingSetNodeID &ID,
uint32_t Opcode,
7316 ArrayRef<SpirvOperand> Operands) {
7317 ID.AddInteger(Opcode);
7318 ID.AddInteger(Size);
7319 ID.AddInteger(Alignment);
7320 for (
auto &Operand : Operands)
7324 static bool classof(
const Type *T) {
7325 return T->getTypeClass() == HLSLInlineSpirv;
7329class TemplateTypeParmType :
public Type,
public llvm::FoldingSetNode {
7330 friend class ASTContext;
7333 TemplateTypeParmDecl *TTPDecl;
7335 TemplateTypeParmType(
unsigned D,
unsigned I,
bool PP,
7336 TemplateTypeParmDecl *TTPDecl, QualType Canon)
7341 assert(!TTPDecl == Canon.isNull());
7342 assert(D < (1 << TemplateTypeParmTypeDepthBits) &&
"Depth too large");
7343 assert(I < (1 << TemplateTypeParmTypeIndexBits) &&
"Index too large");
7344 TemplateTypeParmTypeBits.Depth = D;
7345 TemplateTypeParmTypeBits.Index = I;
7346 TemplateTypeParmTypeBits.ParameterPack = PP;
7350 unsigned getDepth()
const {
return TemplateTypeParmTypeBits.Depth; }
7351 unsigned getIndex()
const {
return TemplateTypeParmTypeBits.Index; }
7353 return TemplateTypeParmTypeBits.ParameterPack;
7356 TemplateTypeParmDecl *getDecl()
const {
return TTPDecl; }
7360 bool isSugared()
const {
return false; }
7361 QualType desugar()
const {
return QualType(
this, 0); }
7363 std::tuple<unsigned, unsigned, unsigned, TemplateTypeParmDecl *>
7368 static bool classof(
const Type *T) {
7380class SubstTemplateTypeParmType final
7382 public llvm::FoldingSetNode,
7383 private llvm::TrailingObjects<SubstTemplateTypeParmType, QualType> {
7384 friend class ASTContext;
7385 friend class llvm::TrailingObjects<SubstTemplateTypeParmType, QualType>;
7387 Decl *AssociatedDecl;
7389 SubstTemplateTypeParmType(QualType Replacement, Decl *AssociatedDecl,
7390 unsigned Index, UnsignedOrNone PackIndex,
7396 QualType getReplacementType()
const {
7397 return SubstTemplateTypeParmTypeBits.HasNonCanonicalUnderlyingType
7398 ? *getTrailingObjects()
7399 : getCanonicalTypeInternal();
7405 Decl *getAssociatedDecl()
const {
return AssociatedDecl; }
7408 const TemplateTypeParmDecl *getReplacedParameter()
const;
7412 unsigned getIndex()
const {
return SubstTemplateTypeParmTypeBits.Index; }
7416 unsigned getFinal()
const {
return SubstTemplateTypeParmTypeBits.Final; }
7419 return UnsignedOrNone::fromInternalRepresentation(
7420 SubstTemplateTypeParmTypeBits.PackIndex);
7423 bool isSugared()
const {
return true; }
7424 QualType desugar()
const {
return getReplacementType(); }
7426 std::tuple<QualType, Decl *, unsigned, unsigned, unsigned> getKey()
const {
7427 return {getReplacementType(), getAssociatedDecl(),
getIndex(),
7428 SubstTemplateTypeParmTypeBits.PackIndex,
7429 SubstTemplateTypeParmTypeBits.Final};
7432 static bool classof(
const Type *T) {
7433 return T->getTypeClass() == SubstTemplateTypeParm;
7443class SubstPackType :
public Type,
public llvm::FoldingSetNode {
7444 friend class ASTContext;
7451 SubstPackType(TypeClass Derived, QualType Canon,
7452 const TemplateArgument &ArgPack);
7455 unsigned getNumArgs()
const {
return SubstPackTypeBits.NumArgs; }
7457 TemplateArgument getArgumentPack()
const;
7459 void Profile(llvm::FoldingSetNodeID &ID);
7460 static void Profile(llvm::FoldingSetNodeID &ID,
7461 const TemplateArgument &ArgPack);
7463 static bool classof(
const Type *T) {
7464 return T->getTypeClass() == SubstTemplateTypeParmPack ||
7465 T->getTypeClass() == SubstBuiltinTemplatePack;
7470class SubstBuiltinTemplatePackType :
public SubstPackType {
7471 friend class ASTContext;
7473 SubstBuiltinTemplatePackType(QualType Canon,
const TemplateArgument &ArgPack);
7476 bool isSugared()
const {
return false; }
7477 QualType desugar()
const {
return QualType(
this, 0); }
7480 using SubstPackType::Profile;
7482 static bool classof(
const Type *T) {
7483 return T->getTypeClass() == SubstBuiltinTemplatePack;
7499class SubstTemplateTypeParmPackType :
public SubstPackType {
7500 friend class ASTContext;
7502 llvm::PointerIntPair<Decl *, 1, bool> AssociatedDeclAndFinal;
7504 SubstTemplateTypeParmPackType(QualType Canon, Decl *AssociatedDecl,
7505 unsigned Index,
bool Final,
7506 const TemplateArgument &ArgPack);
7514 Decl *getAssociatedDecl()
const;
7517 const TemplateTypeParmDecl *getReplacedParameter()
const;
7522 return SubstPackTypeBits.SubstTemplTypeParmPackIndex;
7527 bool getFinal()
const;
7529 bool isSugared()
const {
return false; }
7530 QualType desugar()
const {
return QualType(
this, 0); }
7532 void Profile(llvm::FoldingSetNodeID &ID);
7533 static void Profile(llvm::FoldingSetNodeID &ID,
const Decl *AssociatedDecl,
7534 unsigned Index,
bool Final,
7535 const TemplateArgument &ArgPack);
7537 static bool classof(
const Type *T) {
7538 return T->getTypeClass() == SubstTemplateTypeParmPack;
7550class DeducedType :
public Type {
7551 QualType DeducedAsType;
7554 DeducedType(TypeClass TC, DeducedKind DK, QualType DeducedAsTypeOrCanon);
7556 static void Profile(llvm::FoldingSetNodeID &ID, DeducedKind DK,
7558 ID.AddInteger(llvm::to_underlying(DK));
7564 return static_cast<DeducedKind>(DeducedTypeBits.Kind);
7567 bool isSugared()
const {
return getDeducedKind() == DeducedKind::Deduced; }
7568 QualType desugar()
const {
7569 return isSugared() ? DeducedAsType : QualType(
this, 0);
7574 QualType getDeducedType()
const {
return DeducedAsType; }
7575 bool isDeduced()
const {
return getDeducedKind() != DeducedKind::Undeduced; }
7577 static bool classof(
const Type *T) {
7578 return T->getTypeClass() ==
Auto ||
7579 T->getTypeClass() == DeducedTemplateSpecialization;
7585class AutoType :
public DeducedType,
public llvm::FoldingSetNode {
7586 friend class ASTContext;
7590 AutoType(DeducedKind DK, QualType DeducedAsTypeOrCanon,
7591 AutoTypeKeyword Keyword, TemplateName TypeConstraintConcept,
7592 ArrayRef<TemplateArgument> TypeConstraintArgs);
7595 ArrayRef<TemplateArgument> getTypeConstraintArguments()
const {
7596 return {
reinterpret_cast<const TemplateArgument *
>(
this + 1),
7597 AutoTypeBits.NumArgs};
7601 return TypeConstraintConcept;
7604 bool isConstrained()
const {
return !TypeConstraintConcept.isNull(); }
7606 bool isDecltypeAuto()
const {
7607 return getKeyword() == AutoTypeKeyword::DecltypeAuto;
7610 bool isGNUAutoType()
const {
7611 return getKeyword() == AutoTypeKeyword::GNUAutoType;
7615 return (AutoTypeKeyword)AutoTypeBits.Keyword;
7618 void Profile(llvm::FoldingSetNodeID &ID,
const ASTContext &Context);
7619 static void Profile(llvm::FoldingSetNodeID &ID,
const ASTContext &Context,
7620 DeducedKind DK, QualType Deduced, AutoTypeKeyword Keyword,
7621 TemplateName CD, ArrayRef<TemplateArgument> Arguments);
7623 static bool classof(
const Type *T) {
7624 return T->getTypeClass() ==
Auto;
7629class DeducedTemplateSpecializationType :
public KeywordWrapper<DeducedType>,
7630 public llvm::FoldingSetNode {
7631 friend class ASTContext;
7636 DeducedTemplateSpecializationType(DeducedKind DK,
7637 QualType DeducedAsTypeOrCanon,
7638 ElaboratedTypeKeyword Keyword,
7639 TemplateName Template)
7640 : KeywordWrapper(
Keyword, DeducedTemplateSpecialization, DK,
7641 DeducedAsTypeOrCanon),
7648 if (DK == DeducedKind::Deduced)
7657 void Profile(llvm::FoldingSetNodeID &ID)
const {
7658 Profile(ID, getDeducedKind(), getDeducedType(), getKeyword(),
7662 static void Profile(llvm::FoldingSetNodeID &ID, DeducedKind DK,
7663 QualType Deduced, ElaboratedTypeKeyword Keyword,
7664 TemplateName Template) {
7665 DeducedType::Profile(ID, DK, Deduced);
7666 ID.AddInteger(llvm::to_underlying(Keyword));
7670 static bool classof(
const Type *T) {
7671 return T->getTypeClass() == DeducedTemplateSpecialization;
7695class TemplateSpecializationType :
public TypeWithKeyword,
7696 public llvm::FoldingSetNode {
7697 friend class ASTContext;
7708 TemplateSpecializationType(ElaboratedTypeKeyword Keyword, TemplateName T,
7709 bool IsAlias, ArrayRef<TemplateArgument> Args,
7710 QualType Underlying);
7725 anyDependentTemplateArguments(ArrayRef<TemplateArgumentLoc> Args,
7726 ArrayRef<TemplateArgument> Converted);
7728 anyDependentTemplateArguments(
const TemplateArgumentListInfo &,
7729 ArrayRef<TemplateArgument> Converted);
7730 static bool anyInstantiationDependentTemplateArguments(
7731 ArrayRef<TemplateArgumentLoc> Args);
7735 bool isCurrentInstantiation()
const {
7736 return isa<InjectedClassNameType>(getCanonicalTypeInternal());
7754 bool isTypeAlias()
const {
return TemplateSpecializationTypeBits.TypeAlias; }
7758 QualType getAliasedType()
const;
7763 ArrayRef<TemplateArgument> template_arguments()
const {
7764 return {
reinterpret_cast<const TemplateArgument *
>(
this + 1),
7765 TemplateSpecializationTypeBits.NumArgs};
7768 bool isSugared()
const;
7770 QualType desugar()
const {
7771 return isTypeAlias() ? getAliasedType() : getCanonicalTypeInternal();
7774 void Profile(llvm::FoldingSetNodeID &ID,
const ASTContext &Ctx);
7775 static void Profile(llvm::FoldingSetNodeID &ID, ElaboratedTypeKeyword Keyword,
7776 TemplateName T, ArrayRef<TemplateArgument> Args,
7777 QualType Underlying,
const ASTContext &Context);
7779 static bool classof(
const Type *T) {
7786void printTemplateArgumentList(raw_ostream &OS,
7787 ArrayRef<TemplateArgument> Args,
7788 const PrintingPolicy &Policy,
7789 const TemplateParameterList *TPL =
nullptr);
7791void printTemplateArgumentList(raw_ostream &OS,
7792 ArrayRef<TemplateArgumentLoc> Args,
7793 const PrintingPolicy &Policy,
7794 const TemplateParameterList *TPL =
nullptr);
7796void printTemplateArgumentList(raw_ostream &OS,
7797 const TemplateArgumentListInfo &Args,
7798 const PrintingPolicy &Policy,
7799 const TemplateParameterList *TPL =
nullptr);
7803bool isSubstitutedDefaultArgument(ASTContext &Ctx, TemplateArgument Arg,
7804 const NamedDecl *Param,
7805 ArrayRef<TemplateArgument> Args,
7820class DependentNameType :
public TypeWithKeyword,
public llvm::FoldingSetNode {
7821 friend class ASTContext;
7824 NestedNameSpecifier NNS;
7827 const IdentifierInfo *Name;
7829 DependentNameType(ElaboratedTypeKeyword Keyword, NestedNameSpecifier NNS,
7830 const IdentifierInfo *Name, QualType CanonType)
7831 : TypeWithKeyword(
Keyword, DependentName, CanonType,
7835 NNS(NNS), Name(Name) {
7841 NestedNameSpecifier getQualifier()
const {
return NNS; }
7849 bool isSugared()
const {
return false; }
7850 QualType desugar()
const {
return QualType(
this, 0); }
7852 void Profile(llvm::FoldingSetNodeID &ID) {
7853 Profile(ID, getKeyword(), NNS, Name);
7856 static void Profile(llvm::FoldingSetNodeID &ID, ElaboratedTypeKeyword Keyword,
7857 NestedNameSpecifier NNS,
const IdentifierInfo *Name) {
7858 ID.AddInteger(llvm::to_underlying(Keyword));
7860 ID.AddPointer(Name);
7863 static bool classof(
const Type *T) {
7864 return T->getTypeClass() == DependentName;
7890class PackExpansionType :
public Type,
public llvm::FoldingSetNode {
7891 friend class ASTContext;
7896 PackExpansionType(QualType Pattern, QualType Canon,
7897 UnsignedOrNone NumExpansions)
7898 : Type(PackExpansion, Canon,
7903 PackExpansionTypeBits.NumExpansions =
7904 NumExpansions ? *NumExpansions + 1 : 0;
7911 QualType getPattern()
const {
return Pattern; }
7916 if (PackExpansionTypeBits.NumExpansions)
7917 return PackExpansionTypeBits.NumExpansions - 1;
7918 return std::nullopt;
7921 bool isSugared()
const {
return false; }
7922 QualType desugar()
const {
return QualType(
this, 0); }
7924 std::pair<QualType, unsigned> getKey()
const {
7925 return {getPattern(), getNumExpansions().toInternalRepresentation()};
7928 static bool classof(
const Type *T) {
7929 return T->getTypeClass() == PackExpansion;
7936class ObjCProtocolQualifiers {
7938 ObjCProtocolQualifiers() =
default;
7940 ObjCProtocolDecl *
const *getProtocolStorage()
const {
7941 return const_cast<ObjCProtocolQualifiers*
>(
this)->getProtocolStorage();
7944 ObjCProtocolDecl **getProtocolStorage() {
7945 return static_cast<T*
>(
this)->getProtocolStorageImpl();
7948 void setNumProtocols(
unsigned N) {
7949 static_cast<T*
>(
this)->setNumProtocolsImpl(N);
7952 void initialize(ArrayRef<ObjCProtocolDecl *> protocols) {
7953 setNumProtocols(protocols.size());
7954 assert(getNumProtocols() == protocols.size() &&
7955 "bitfield overflow in protocol count");
7956 if (!protocols.empty())
7957 memcpy(getProtocolStorage(), protocols.data(),
7958 protocols.size() *
sizeof(ObjCProtocolDecl*));
7962 using qual_iterator = ObjCProtocolDecl *
const *;
7963 using qual_range = llvm::iterator_range<qual_iterator>;
7965 qual_range quals()
const {
return qual_range(qual_begin(), qual_end()); }
7966 qual_iterator qual_begin()
const {
return getProtocolStorage(); }
7967 qual_iterator qual_end()
const {
return qual_begin() + getNumProtocols(); }
7969 bool qual_empty()
const {
return getNumProtocols() == 0; }
7973 unsigned getNumProtocols()
const {
7974 return static_cast<const T*
>(
this)->getNumProtocolsImpl();
7978 ObjCProtocolDecl *getProtocol(
unsigned I)
const {
7979 assert(I < getNumProtocols() &&
"Out-of-range protocol access");
7980 return qual_begin()[I];
7984 ArrayRef<ObjCProtocolDecl *> getProtocols()
const {
7985 return ArrayRef<ObjCProtocolDecl *>(qual_begin(), getNumProtocols());
7991class ObjCTypeParamType :
public Type,
7992 public ObjCProtocolQualifiers<ObjCTypeParamType>,
7993 public llvm::FoldingSetNode {
7994 friend class ASTContext;
7995 friend class ObjCProtocolQualifiers<ObjCTypeParamType>;
7998 unsigned NumProtocols : 6;
8000 ObjCTypeParamDecl *OTPDecl;
8005 ObjCProtocolDecl **getProtocolStorageImpl();
8009 unsigned getNumProtocolsImpl()
const {
8010 return NumProtocols;
8013 void setNumProtocolsImpl(
unsigned N) {
8017 ObjCTypeParamType(
const ObjCTypeParamDecl *D,
8019 ArrayRef<ObjCProtocolDecl *> protocols);
8022 bool isSugared()
const {
return true; }
8023 QualType desugar()
const {
return getCanonicalTypeInternal(); }
8025 static bool classof(
const Type *T) {
8026 return T->getTypeClass() == ObjCTypeParam;
8029 ObjCTypeParamDecl *getDecl()
const {
return OTPDecl; }
8031 std::tuple<const ObjCTypeParamDecl *, QualType, ArrayRef<ObjCProtocolDecl *>>
8033 return {getDecl(), getCanonicalTypeInternal(),
8034 llvm::ArrayRef(qual_begin(), getNumProtocols())};
8066class ObjCObjectType :
public Type,
8067 public ObjCProtocolQualifiers<ObjCObjectType> {
8068 friend class ObjCProtocolQualifiers<ObjCObjectType>;
8086 mutable llvm::PointerIntPair<const ObjCObjectType *, 1, bool>
8087 CachedSuperClassType;
8089 QualType *getTypeArgStorage();
8090 const QualType *getTypeArgStorage()
const {
8091 return const_cast<ObjCObjectType *
>(
this)->getTypeArgStorage();
8094 ObjCProtocolDecl **getProtocolStorageImpl();
8097 unsigned getNumProtocolsImpl()
const {
8098 return ObjCObjectTypeBits.NumProtocols;
8100 void setNumProtocolsImpl(
unsigned N) {
8101 ObjCObjectTypeBits.NumProtocols = N;
8105 enum Nonce_ObjCInterface { Nonce_ObjCInterface };
8107 ObjCObjectType(QualType Canonical, QualType Base,
8108 ArrayRef<QualType> typeArgs,
8109 ArrayRef<ObjCProtocolDecl *> protocols,
8112 ObjCObjectType(
enum Nonce_ObjCInterface)
8114 BaseType(QualType(this_(), 0)) {
8115 ObjCObjectTypeBits.NumProtocols = 0;
8116 ObjCObjectTypeBits.NumTypeArgs = 0;
8117 ObjCObjectTypeBits.IsKindOf = 0;
8120 void computeSuperClassTypeSlow()
const;
8131 bool isObjCId()
const {
8132 return getBaseType()->isSpecificBuiltinType(BuiltinType::ObjCId);
8135 bool isObjCClass()
const {
8136 return getBaseType()->isSpecificBuiltinType(BuiltinType::ObjCClass);
8139 bool isObjCUnqualifiedId()
const {
return qual_empty() && isObjCId(); }
8140 bool isObjCUnqualifiedClass()
const {
return qual_empty() && isObjCClass(); }
8141 bool isObjCUnqualifiedIdOrClass()
const {
8142 if (!qual_empty())
return false;
8143 if (
const BuiltinType *T =
getBaseType()->getAs<BuiltinType>())
8144 return T->getKind() == BuiltinType::ObjCId ||
8145 T->getKind() == BuiltinType::ObjCClass;
8148 bool isObjCQualifiedId()
const {
return !qual_empty() && isObjCId(); }
8149 bool isObjCQualifiedClass()
const {
return !qual_empty() && isObjCClass(); }
8153 ObjCInterfaceDecl *getInterface()
const;
8157 bool isSpecialized()
const;
8160 bool isSpecializedAsWritten()
const {
8161 return ObjCObjectTypeBits.NumTypeArgs > 0;
8166 bool isUnspecialized()
const {
return !isSpecialized(); }
8170 bool isUnspecializedAsWritten()
const {
return !isSpecializedAsWritten(); }
8173 ArrayRef<QualType> getTypeArgs()
const;
8177 ArrayRef<QualType> getTypeArgsAsWritten()
const {
8178 return {getTypeArgStorage(), ObjCObjectTypeBits.NumTypeArgs};
8182 bool isKindOfTypeAsWritten()
const {
return ObjCObjectTypeBits.IsKindOf; }
8185 bool isKindOfType()
const;
8193 QualType getSuperClassType()
const {
8194 if (!CachedSuperClassType.getInt())
8195 computeSuperClassTypeSlow();
8197 assert(CachedSuperClassType.getInt() &&
"Superclass not set?");
8198 return QualType(CachedSuperClassType.getPointer(), 0);
8203 QualType stripObjCKindOfTypeAndQuals(
const ASTContext &ctx)
const;
8205 bool isSugared()
const {
return false; }
8206 QualType desugar()
const {
return QualType(
this, 0); }
8208 static bool classof(
const Type *T) {
8209 return T->getTypeClass() == ObjCObject ||
8210 T->getTypeClass() == ObjCInterface;
8218class ObjCObjectTypeImpl :
public ObjCObjectType,
public llvm::FoldingSetNode {
8219 friend class ASTContext;
8224 ObjCObjectTypeImpl(QualType Canonical, QualType Base,
8225 ArrayRef<QualType> typeArgs,
8226 ArrayRef<ObjCProtocolDecl *> protocols,
8228 : ObjCObjectType(Canonical,
Base, typeArgs, protocols, isKindOf) {}
8231 void Profile(llvm::FoldingSetNodeID &ID);
8232 static void Profile(llvm::FoldingSetNodeID &ID,
8234 ArrayRef<QualType> typeArgs,
8235 ArrayRef<ObjCProtocolDecl *> protocols,
8239inline QualType *ObjCObjectType::getTypeArgStorage() {
8240 return reinterpret_cast<QualType *
>(
static_cast<ObjCObjectTypeImpl*
>(
this)+1);
8243inline ObjCProtocolDecl **ObjCObjectType::getProtocolStorageImpl() {
8244 return reinterpret_cast<ObjCProtocolDecl**
>(
8245 getTypeArgStorage() + ObjCObjectTypeBits.NumTypeArgs);
8248inline ObjCProtocolDecl **ObjCTypeParamType::getProtocolStorageImpl() {
8249 return reinterpret_cast<ObjCProtocolDecl**
>(
8250 static_cast<ObjCTypeParamType*
>(
this)+1);
8284 return T->getTypeClass() == ObjCInterface;
8300inline ObjCInterfaceDecl *ObjCObjectType::getInterface()
const {
8301 QualType baseType = getBaseType();
8303 if (
const auto *T = dyn_cast<ObjCInterfaceType>(ObjT))
8304 return T->getDecl();
8306 baseType = ObjT->getBaseType();
8321class ObjCObjectPointerType :
public Type,
public llvm::FoldingSetNode {
8328 PointeeType(Pointee) {}
8471 QualType getSuperClassType()
const;
8481 return T->getTypeClass() == ObjCObjectPointer;
8485class AtomicType :
public Type,
public llvm::FoldingSetNode {
8504 return T->getTypeClass() ==
Atomic;
8509class PipeType :
public Type,
public llvm::FoldingSetNode {
8517 ElementType(elemType), isRead(isRead) {}
8531 return T->getTypeClass() ==
Pipe;
8540 LLVM_PREFERRED_TYPE(
bool)
8541 unsigned IsUnsigned : 1;
8542 unsigned NumBits : 24;
8555 std::pair<unsigned, unsigned>
getKey()
const {
8564 llvm::PointerIntPair<Expr*, 1, bool> ExprAndUnsigned;
8572 Expr *getNumBitsExpr()
const;
8580 static void Profile(llvm::FoldingSetNodeID &ID,
const ASTContext &Context,
8581 bool IsUnsigned,
Expr *NumBitsExpr);
8584 return T->getTypeClass() == DependentBitInt;
8588class PredefinedSugarType final :
public Type {
8601 static StringRef getName(Kind KD);
8615 return T->getTypeClass() == PredefinedSugar;
8629 if (!
type.hasLocalNonFastQualifiers())
8630 return type.getTypePtrUnsafe();
8651class alignas(8) TypeSourceInfo {
8658 TypeSourceInfo(
QualType ty,
size_t DataSize);
8675 Ty->getLocallyUnqualifiedSingleStepDesugaredType().split();
8681 return getCommonPtr()->BaseType;
8685 return (
isNull() ?
nullptr : getCommonPtr()->BaseType);
8693 if (
Self.isObjectType() ||
Self.isReferenceType())
8696 return F->getMethodQuals().empty() && F->getRefQualifier() ==
RQ_None;
8706 const ExtQuals *eq = getExtQualsUnsafe();
8715 Quals = getExtQualsUnsafe()->getQualifiers();
8721 Qualifiers quals = getCommonPtr()->CanonicalType.getLocalQualifiers();
8727 unsigned cvr = getCommonPtr()->CanonicalType.getLocalCVRQualifiers();
8733 QualType canon = getCommonPtr()->CanonicalType;
8738 return getTypePtr()->isCanonicalUnqualified();
8746 if (T->isVariablyModifiedType() && T->hasSizedVLAType())
8755 getCommonPtr()->CanonicalType.isLocalConstQualified();
8760 getCommonPtr()->CanonicalType.isLocalRestrictQualified();
8766 getCommonPtr()->CanonicalType.isLocalVolatileQualified();
8771 getCommonPtr()->CanonicalType.hasLocalQualifiers();
8778 return QualType(getSplitUnqualifiedTypeImpl(*this).Ty, 0);
8785 return getSplitUnqualifiedTypeImpl(*
this);
8817 if (
const auto *FT = PT->getPointeeType()->getAs<
FunctionType>())
8818 return FT->getExtInfo();
8820 return FT->getExtInfo();
8867 return RefType->getPointeeType();
8958 return !T->getPointeeType()->isFunctionType();
8965 return Fn->hasCFIUncheckedCallee();
8986 return T->getPointeeType()->isFunctionType();
8993 return T->getPointeeType()->isFunctionType();
9004 return T->isMemberFunctionPointer();
9011 return T->isMemberDataPointer();
9071 if (
auto *CMT = dyn_cast<ConstantMatrixType>(CanonicalType))
9072 return CMT->getElementType()->isBooleanType();
9123 return OPT->isObjCQualifiedIdType();
9129 return OPT->isObjCQualifiedClassType();
9135 return OPT->isObjCIdType();
9141 return OPT->isObjCClassType();
9147 return OPT->getPointeeType()->isSpecificBuiltinType(BuiltinType::ObjCSel);
9159#define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \
9160 inline bool Type::is##Id##Type() const { \
9161 return isSpecificBuiltinType(BuiltinType::Id); \
9163#include "clang/Basic/OpenCLImageTypes.def"
9186#define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) is##Id##Type() ||
9188#include "clang/Basic/OpenCLImageTypes.def"
9200#define EXT_OPAQUE_TYPE(ExtType, Id, Ext) \
9201 inline bool Type::is##Id##Type() const { \
9202 return isSpecificBuiltinType(BuiltinType::Id); \
9204#include "clang/Basic/OpenCLExtensionTypes.def"
9207#define INTEL_SUBGROUP_AVC_TYPE(ExtType, Id) \
9208 isOCLIntelSubgroupAVC##Id##Type() ||
9210#include "clang/Basic/OpenCLExtensionTypes.def"
9215#define EXT_OPAQUE_TYPE(ExtType, Id, Ext) is##Id##Type() ||
9217#include "clang/Basic/OpenCLExtensionTypes.def"
9226#define HLSL_INTANGIBLE_TYPE(Name, Id, SingletonId) \
9227 inline bool Type::is##Id##Type() const { \
9228 return isSpecificBuiltinType(BuiltinType::Id); \
9230#include "clang/Basic/HLSLIntangibleTypes.def"
9232#define HLSL_PACKED_TYPE(Name, Id, SingletonId) \
9233 inline bool Type::is##Id##Type() const { \
9234 return isSpecificBuiltinType(BuiltinType::Id); \
9236#include "clang/Basic/HLSLPackedTypes.def"
9238#define SPIRV_TYPE(Name, Id, SingletonId) \
9239 inline bool Type::is##Id##Type() const { \
9240 return isSpecificBuiltinType(BuiltinType::Id); \
9242#include "clang/Basic/SPIRVTypes.def"
9245#define HLSL_INTANGIBLE_TYPE(Name, Id, SingletonId) is##Id##Type() ||
9247#include "clang/Basic/HLSLIntangibleTypes.def"
9252#define HLSL_PACKED_TYPE(Name, Id, SingletonId) is##Id##Type() ||
9254#include "clang/Basic/HLSLPackedTypes.def"
9283 if (
const auto *BT = dyn_cast<BuiltinType>(
this))
9284 return BT->isPlaceholderType();
9289 if (
const auto *BT = dyn_cast<BuiltinType>(
this))
9290 if (BT->isPlaceholderType())
9301 if (
const auto *BT = dyn_cast<BuiltinType>(
this))
9302 return BT->isNonOverloadPlaceholderType();
9355 if (
const auto *BT = dyn_cast<BuiltinType>(CanonicalType))
9356 return BT->isInteger();
9357 if (
const EnumType *ET = dyn_cast<EnumType>(CanonicalType)) {
9364 if (
const auto *OT = dyn_cast<OverflowBehaviorType>(CanonicalType))
9365 return OT->getUnderlyingType()->isIntegerType();
9371 if (
const auto *BT = dyn_cast<BuiltinType>(CanonicalType)) {
9372 return BT->getKind() >= BuiltinType::ShortAccum &&
9373 BT->getKind() <= BuiltinType::SatULongFract;
9387 if (
const auto *BT = dyn_cast<BuiltinType>(CanonicalType)) {
9388 return BT->getKind() >= BuiltinType::SatShortAccum &&
9389 BT->getKind() <= BuiltinType::SatULongFract;
9399 if (
const auto *BT = dyn_cast<BuiltinType>(CanonicalType)) {
9400 return ((BT->getKind() >= BuiltinType::ShortAccum &&
9401 BT->getKind() <= BuiltinType::LongAccum) ||
9402 (BT->getKind() >= BuiltinType::ShortFract &&
9403 BT->getKind() <= BuiltinType::LongFract) ||
9404 (BT->getKind() >= BuiltinType::SatShortAccum &&
9405 BT->getKind() <= BuiltinType::SatLongAccum) ||
9406 (BT->getKind() >= BuiltinType::SatShortFract &&
9407 BT->getKind() <= BuiltinType::SatLongFract));
9417 if (
const auto *BT = dyn_cast<BuiltinType>(CanonicalType))
9418 return BT->getKind() > BuiltinType::Void &&
9419 BT->getKind() <= BuiltinType::NullPtr;
9420 if (
const EnumType *ET = dyn_cast<EnumType>(CanonicalType))
9433 if (
const auto *BT = dyn_cast<BuiltinType>(CanonicalType))
9434 return BT->isInteger();
9438 if (
const auto *ET = dyn_cast<EnumType>(CanonicalType))
9441 if (
const auto *OBT = dyn_cast<OverflowBehaviorType>(CanonicalType))
9442 return OBT->getUnderlyingType()->isIntegralOrEnumerationType();
9448 if (
const auto *BT = dyn_cast<BuiltinType>(CanonicalType))
9449 return BT->getKind() == BuiltinType::Bool;
9455 return DT && !DT->isDeduced();
9472 return TST->isTypeAlias();
9499 if (
type->isAnyPointerType())
9500 return type->getPointeeType().getTypePtr();
9501 else if (
type->isArrayType())
9502 return type->getBaseElementTypeUnsafe();
9539 "ArrayType cannot be used with getAs!");
9542 if (
const auto *Ty = dyn_cast<T>(
this))
9546 if (!
isa<T>(CanonicalType))
9558 if (
const auto *Ty = dyn_cast<T>(
this))
9562 if (!
isa<T>(CanonicalType))
9567 const Type *Ty =
this;
9569 if (
const auto *A = dyn_cast<AttributedType>(Ty))
9570 Ty = A->getModifiedType().getTypePtr();
9571 else if (
const auto *A = dyn_cast<BTFTagAttributedType>(Ty))
9572 Ty = A->getWrappedType().getTypePtr();
9573 else if (
const auto *A = dyn_cast<HLSLAttributedResourceType>(Ty))
9574 Ty = A->getWrappedType().getTypePtr();
9575 else if (
const auto *P = dyn_cast<ParenType>(Ty))
9576 Ty = P->desugar().getTypePtr();
9577 else if (
const auto *A = dyn_cast<AdjustedType>(Ty))
9578 Ty = A->desugar().getTypePtr();
9579 else if (
const auto *M = dyn_cast<MacroQualifiedType>(Ty))
9580 Ty = M->desugar().getTypePtr();
9587 return dyn_cast<T>(Ty);
9592 if (
const auto *arr = dyn_cast<ArrayType>(
this))
9606 "ArrayType cannot be used with castAs!");
9608 if (
const auto *ty = dyn_cast<T>(
this))
return ty;
9609 assert(
isa<T>(CanonicalType));
9615 if (
const auto *arr = dyn_cast<ArrayType>(
this))
return arr;
9621 :
AdjustedType(Decayed, OriginalType, DecayedPtr, CanonicalPtr) {
9623 QualType Adjusted = getAdjustedType();
9624 (void)AttributedType::stripOuterNullability(Adjusted);
9631 (void)AttributedType::stripOuterNullability(Decayed);
9646 TypePtr = Pointee.getTypePtr();
9652 if (
const auto *FPT = TypePtr->
getAs<FunctionProtoType>())
9653 return FPT->getFunctionEffects();
Provides definitions for the various language-specific address spaces.
Defines the clang::attr::Kind enum.
Defines the Diagnostic-related interfaces.
static bool isBooleanType(QualType Ty)
static bool isUnsigned(SValBuilder &SVB, NonLoc Value)
llvm::dxil::ResourceClass ResourceClass
static std::optional< NonLoc > getIndex(ProgramStateRef State, const ElementRegion *ER, CharKind CK)
clang::CharUnits operator*(clang::CharUnits::QuantityType Scale, clang::CharUnits CU)
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 QualType getObjectType(APValue::LValueBase B)
Retrieves the "underlying object type" of the given expression, as used by __builtin_object_size.
Result
Implement __builtin_bit_cast and related operations.
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified.
Defines the clang::LangOptions interface.
llvm::MachO::Record Record
*collection of selector each with an associated kind and an ordered *collection of selectors A selector has a kind
llvm::raw_ostream & operator<<(llvm::raw_ostream &OS, const OMPTraitInfo &TI)
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 bool hasAttr(const Decl *D, bool IgnoreImplicitAttr)
static RecordDecl * getAsRecordDecl(QualType BaseType, HeuristicResolver &Resolver)
static bool isRecordType(QualType T)
static bool isMatrixType(QualType QT)
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)
Defines the clang::Visibility enumeration and various utility functions.
__DEVICE__ void * memcpy(void *__a, const void *__b, size_t __c)
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Represents a type which was implicitly adjusted by the semantic engine for arbitrary reasons.
static bool classof(const Type *T)
AdjustedType(TypeClass TC, QualType OriginalTy, QualType AdjustedTy, QualType CanonicalPtr)
QualType getAdjustedType() const
QualType getOriginalType() const
std::pair< QualType, QualType > getKey() const
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
ArrayType(TypeClass tc, QualType et, QualType can, ArraySizeModifier sm, unsigned tq, const Expr *sz=nullptr)
unsigned getIndexTypeCVRQualifiers() const
QualType getValueType() const
Gets the type contained by this atomic type, i.e.
static bool classof(const Type *T)
Attr - This represents one attribute.
static bool classof(const Type *T)
BitIntType(bool isUnsigned, unsigned NumBits)
std::pair< unsigned, unsigned > getKey() const
unsigned getNumBits() const
QualType getPointeeType() const
static bool classof(const Type *T)
[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
BoundsAttributedType(TypeClass TC, QualType Wrapped, QualType Canon)
const TypeCoupledDeclRefInfo * decl_iterator
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.
StringRef getName(const PrintingPolicy &Policy) const
const char * getNameAsCString(const PrintingPolicy &Policy) const
Represents a C++ struct/union/class.
Complex values, per C99 6.2.5p11.
QualType getElementType() const
static bool classof(const Type *T)
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.
unsigned getNumColumns() const
Returns the number of columns in the matrix.
void Profile(llvm::FoldingSetNodeID &ID)
std::optional< LayoutKind > getLayout() const
unsigned getRowMajorFlattenedIndex(unsigned Row, unsigned Column) const
Returns the row-major flattened index of a matrix element located at row Row, and column Column.
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.
unsigned getFlattenedIndex(unsigned Row, unsigned Column, bool IsRowMajor=false) const
Returns the flattened index of a matrix element located at row Row, and column Column.
std::optional< LayoutKind > Layout
static void Profile(llvm::FoldingSetNodeID &ID, QualType ElementType, unsigned NumRows, unsigned NumColumns, std::optional< LayoutKind > Layout, TypeClass TypeClass)
unsigned mapColumnMajorToRowMajorFlattenedIndex(unsigned ColumnMajorIdx) const
Given a column-major flattened index ColumnMajorIdx, return the equivalent row-major flattened index.
unsigned mapRowMajorToColumnMajorFlattenedIndex(unsigned RowMajorIdx) const
Given a row-major flattened index RowMajorIdx, return the equivalent column-major flattened index.
unsigned getColumnMajorFlattenedIndex(unsigned Row, unsigned Column) const
Returns the column-major flattened index of a matrix element located at row Row, and column Column.
unsigned NumRows
Number of rows and columns.
static bool classof(const Type *T)
ConstantMatrixType(QualType MatrixElementType, unsigned NRows, unsigned NColumns, QualType CanonElementType, std::optional< LayoutKind > Layout)
CooperativeMatrixType(QualType ElementType, unsigned Scope, unsigned NumRows, unsigned NumColumns, unsigned Use, QualType CanonicalType)
unsigned NumRows
Number of rows and columns.
static bool isValidOpenCLScalarType(QualType ElemTy)
void Profile(llvm::FoldingSetNodeID &ID)
static constexpr bool isUseValid(size_t Use)
Returns true if Use is a valid cooperative matrix use.
unsigned getScope() const
Returns the cooperative matrix scope.
static void Profile(llvm::FoldingSetNodeID &ID, QualType ElementType, unsigned Scope, unsigned NumRows, unsigned NumColumns, unsigned Use, TypeClass TypeClass)
static constexpr bool isScopeValid(size_t Scope)
Returns true if Scope is a valid cooperative matrix scope.
unsigned getNumColumns() const
Returns the number of columns.
unsigned getUse() const
Returns the cooperative matrix use.
QualType ElementType
Element type of the cooperative matrix.
QualType getElementType() const
Returns the element type.
static bool isValidOpenCLVectorType(QualType ElemTy)
static bool classof(const Type *T)
unsigned Scope
Cooperative matrix scope and use.
unsigned getNumRows() const
Returns the number of rows.
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
BoundsAttrKind getKind() const
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.
Expr * getAddrSpaceExpr() const
void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Context)
QualType getPointeeType() const
static bool classof(const Type *T)
SourceLocation getAttributeLoc() const
Expr * getNumBitsExpr() const
void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Context)
DependentBitIntType(bool IsUnsigned, Expr *NumBits)
static bool classof(const Type *T)
friend class StmtIteratorBase
void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Context)
static bool classof(const Type *T)
Expr * getSizeExpr() const
Expr * getSizeExpr() const
static bool classof(const Type *T)
SourceLocation getAttributeLoc() const
void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Context)
QualType getElementType() const
Expr * getColumnExpr() const
Expr * getRowExpr() const
void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Context)
SourceLocation getAttributeLoc() const
static bool classof(const Type *T)
void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Context)
DependentTypeOfExprType(const ASTContext &Context, Expr *E, TypeOfKind Kind)
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)
@ ak_addrspace
address space
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
This represents one expression.
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
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.
FunctionEffectIterator()=delete
bool operator==(const FunctionEffectIterator &Other) const
bool operator!=(const FunctionEffectIterator &Other) const
FunctionEffectIterator operator++()
FunctionEffectIterator(const Container &O, size_t I)
FunctionEffectWithCondition operator*() const
A mutable set of FunctionEffect::Kind.
static FunctionEffectKindSet difference(FunctionEffectKindSet LHS, FunctionEffectKindSet RHS)
bool contains(const FunctionEffect::Kind EK) const
FunctionEffectKindSet()=default
FunctionEffectKindSet(FunctionEffectsRef FX)
void insert(FunctionEffectKindSet Set)
void insert(FunctionEffectsRef FX)
void insert(FunctionEffect Effect)
FunctionEffectSet(const FunctionEffectsRef &FX)
FunctionEffectSet()=default
FunctionEffectIterator< FunctionEffectSet > iterator
bool insert(const FunctionEffectWithCondition &NewEC, Conflicts &Errs)
SmallVector< Conflict > Conflicts
static FunctionEffectSet getIntersection(FunctionEffectsRef LHS, FunctionEffectsRef RHS)
static FunctionEffectSet getUnion(FunctionEffectsRef LHS, FunctionEffectsRef RHS, Conflicts &Errs)
Represents an abstract function effect, using just an enumeration describing its kind.
Kind kind() const
The kind of the effect.
unsigned Flags
Flags describing some behaviors of the effect.
static constexpr size_t KindCount
friend bool operator<(FunctionEffect LHS, FunctionEffect RHS)
friend bool operator==(FunctionEffect LHS, FunctionEffect RHS)
uint32_t toOpaqueInt32() const
For serialization.
@ FE_ExcludeStaticLocalVars
@ FE_ExcludeThreadLocalVars
@ FE_ExcludeObjCMessageSend
friend bool operator!=(FunctionEffect LHS, FunctionEffect RHS)
Kind
Identifies the particular effect.
Flags flags() const
Flags describing some behaviors of the effect.
StringRef name() const
The description printed in diagnostics, e.g. 'nonblocking'.
static FunctionEffect fromOpaqueInt32(uint32_t Value)
friend raw_ostream & operator<<(raw_ostream &OS, const FunctionEffect &Effect)
An immutable set of FunctionEffects and possibly conditions attached to them.
ArrayRef< FunctionEffect > effects() const
ArrayRef< EffectConditionExpr > conditions() const
static FunctionEffectsRef create(ArrayRef< FunctionEffect > FX, ArrayRef< EffectConditionExpr > Conds)
Asserts invariants.
FunctionEffectIterator< FunctionEffectsRef > iterator
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)
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,...
static void Profile(llvm::FoldingSetNodeID &ID, QualType Result, param_type_iterator ArgTys, unsigned NumArgs, const ExtProtoInfo &EPI, const ASTContext &Context)
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.
const QualType * param_type_iterator
Qualifiers getMethodQuals() const
const QualType * exception_iterator
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().
SourceLocation getEllipsisLoc() const
unsigned getNumFunctionEffects() const
bool hasCFIUncheckedCallee() 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.
CanThrowResult canThrow() const
Determine whether this function type has a non-throwing exception specification.
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...
FunctionTypeExtraAttributeInfo getExtraAttributeInfo() const
Return the extra attribute information.
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
friend class FunctionType
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?
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
AArch64SMETypeAttributes
The AArch64 SME ACLE (Arm C/C++ Language Extensions) define a number of function type attributes that...
@ SME_PStateSMEnabledMask
@ SME_PStateSMCompatibleMask
@ SME_AgnosticZAStateShift
@ SME_AgnosticZAStateMask
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.
One of these records is kept for each identifier that is lexed.
void Profile(llvm::FoldingSetNodeID &ID)
static void Profile(llvm::FoldingSetNodeID &ID, QualType ET, ArraySizeModifier SizeMod, unsigned TypeQuals)
friend class StmtIteratorBase
static bool classof(const Type *T)
KeywordWrapper(ElaboratedTypeKeyword Keyword, As &&...as)
ElaboratedTypeKeyword getKeyword() const
static CannotCastToThisType classof(const T *)
static bool classof(const Type *T)
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
QualType getWrappedType() const
LateParsedTypeAttribute * getLateParsedAttribute() const
static bool classof(const Type *T)
static bool classof(const Type *T)
QualType getUnderlyingType() const
const IdentifierInfo * getMacroIdentifier() const
static bool isValidElementType(QualType T, const LangOptions &LangOpts)
Valid elements types are the following:
QualType getElementType() const
Returns type of the elements being stored in the matrix.
MatrixType(QualType ElementTy, QualType CanonElementTy)
static bool classof(const Type *T)
NestedNameSpecifier getQualifier() const
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 bool classof(const Type *T)
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.
Represents typeof(type), a C23 feature and GCC extension, or `typeof_unqual(type),...
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.
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.
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.
Represents an Objective-C protocol declaration.
static bool classof(const Type *T)
QualType getInnerType() const
QualType getElementType() const
static bool classof(const Type *T)
std::pair< QualType, bool > getKey() const
Pointer-authentication qualifiers.
static PointerAuthQualifier fromOpaqueValue(uint32_t Opaque)
friend bool operator==(PointerAuthQualifier Lhs, PointerAuthQualifier Rhs)
bool isIsaPointer() const
static PointerAuthQualifier Create(unsigned Key, bool IsAddressDiscriminated, unsigned ExtraDiscriminator, PointerAuthenticationMode AuthenticationMode, bool IsIsaPointer, bool AuthenticatesNullValues)
friend bool operator!=(PointerAuthQualifier Lhs, PointerAuthQualifier Rhs)
bool authenticatesNullValues() const
bool isEquivalent(PointerAuthQualifier Other) const
@ MaxDiscriminator
The maximum supported pointer-authentication discriminator.
@ MaxKey
The maximum supported pointer-authentication key.
void Profile(llvm::FoldingSetNodeID &ID) const
bool isAddressDiscriminated() const
PointerAuthQualifier withoutKeyNone() const
unsigned getExtraDiscriminator() const
void print(raw_ostream &OS, const PrintingPolicy &Policy) const
PointerAuthenticationMode getAuthenticationMode() const
bool isEmptyWhenPrinted(const PrintingPolicy &Policy) const
std::string getAsString() const
uint32_t getAsOpaqueValue() const
PointerAuthQualifier()=default
PointerType - C99 6.7.5.1 - Pointer Declarators.
QualType getPointeeType() const
static bool classof(const Type *T)
static bool classof(const Type *T)
const IdentifierInfo * getIdentifier() const
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 hasAddressDiscriminatedPointerAuth() const
bool isLocalConstQualified() const
Determine whether this particular QualType instance has the "const" qualifier set,...
bool isLocalRestrictQualified() const
Determine whether this particular QualType instance has the "restrict" qualifier set,...
bool isVolatileQualified() const
Determine whether this type is volatile-qualified.
bool isRestrictQualified() const
Determine whether this type is restrict-qualified.
bool isTriviallyCopyableType(const ASTContext &Context) const
Return true if this is a trivially copyable type (C++0x [basic.types]p9)
QualType IgnoreParens() const
Returns the specified type after dropping any outer-level parentheses.
Qualifiers::GC getObjCGCAttr() const
Returns gc attribute of this type.
friend bool operator==(const QualType &LHS, const QualType &RHS)
Indicate whether the specified types and qualifiers are identical.
bool hasQualifiers() const
Determine whether this type has any qualifiers.
QualType withFastQualifiers(unsigned TQs) const
QualType withRestrict() const
bool hasNonTrivialToPrimitiveCopyCUnion() const
Check if this is or contains a C union that is non-trivial to copy, which is a union that has a membe...
PointerAuthQualifier getPointerAuth() const
void addFastQualifiers(unsigned TQs)
bool isWebAssemblyFuncrefType() const
Returns true if it is a WebAssembly Funcref Type.
QualType getNonLValueExprType(const ASTContext &Context) const
Determine the type of a (typically non-lvalue) expression with the specified result type.
@ DK_objc_strong_lifetime
PrimitiveDefaultInitializeKind
@ PDIK_ARCWeak
The type is an Objective-C retainable pointer type that is qualified with the ARC __weak qualifier.
@ PDIK_Trivial
The type does not fall into any of the following categories.
@ PDIK_ARCStrong
The type is an Objective-C retainable pointer type that is qualified with the ARC __strong qualifier.
@ PDIK_Struct
The type is a struct containing a field whose type is not PCK_Trivial.
bool mayBeDynamicClass() const
Returns true if it is a class and it might be dynamic.
bool hasLocalNonFastQualifiers() const
Determine whether this particular QualType instance has any "non-fast" qualifiers,...
bool isNonWeakInMRRWithObjCWeak(const ASTContext &Context) const
const IdentifierInfo * getBaseTypeIdentifier() const
Retrieves a pointer to the name of the base type.
bool isBitwiseCloneableType(const ASTContext &Context) const
Return true if the type is safe to bitwise copy using memcpy/memmove.
QualType withoutLocalFastQualifiers() const
void Profile(llvm::FoldingSetNodeID &ID) const
bool isAddressSpaceOverlapping(QualType T, const ASTContext &Ctx) const
Returns true if address space qualifiers overlap with T address space qualifiers.
QualType getDesugaredType(const ASTContext &Context) const
Return the specified type with any "sugar" removed from the type.
void removeLocalFastQualifiers(unsigned Mask)
QualType withConst() const
QualType getLocalUnqualifiedType() const
Return this type with all of the instance-specific qualifiers removed, but without removing any quali...
void addConst()
Add the const type qualifier to this QualType.
bool hasLocalQualifiers() const
Determine whether this particular QualType instance has any qualifiers, without looking through any t...
bool isTriviallyCopyConstructibleType(const ASTContext &Context) const
Return true if this is a trivially copyable type.
bool isTrivialType(const ASTContext &Context) const
Return true if this is a trivial type per (C++0x [basic.types]p9)
bool isNull() const
Return true if this QualType doesn't point to a type yet.
PrimitiveCopyKind isNonTrivialToPrimitiveCopy() const
Check if this is a non-trivial type that would cause a C struct transitively containing this type to ...
const Type * getTypePtr() const
Retrieves a pointer to the underlying (unqualified) type.
LangAS getAddressSpace() const
Return the address space of this type.
bool isConstant(const ASTContext &Ctx) const
static QualType getFromOpaquePtr(const void *Ptr)
QualType withVolatile() const
bool hasNonTrivialToPrimitiveDestructCUnion() const
Check if this is or contains a C union that is non-trivial to destruct, which is a union that has a m...
Qualifiers getQualifiers() const
Retrieve the set of qualifiers applied to this type.
const Type * operator->() const
void setLocalFastQualifiers(unsigned Quals)
bool isCXX98PODType(const ASTContext &Context) const
Return true if this is a POD type according to the rules of the C++98 standard, regardless of the cur...
bool hasPostfixDeclaratorSyntax() const
Returns true if the type uses postfix declarator syntax, i.e.
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
bool isTrapType() const
Returns true if it is a OverflowBehaviorType of Trap kind.
unsigned getLocalCVRQualifiers() const
Retrieve the set of CVR (const-volatile-restrict) qualifiers local to this particular QualType instan...
SplitQualType split() const
Divides a QualType into its unqualified type and a set of local qualifiers.
bool UseExcessPrecision(const ASTContext &Ctx)
void addVolatile()
Add the volatile type qualifier to this QualType.
bool isCForbiddenLValueType() const
Determine whether expressions of the given type are forbidden from being lvalues in C.
PrimitiveDefaultInitializeKind isNonTrivialToPrimitiveDefaultInitialize() const
Functions to query basic properties of non-trivial C struct types.
bool isObjCGCStrong() const
true when Type is objc's strong.
std::string getAsString() const
void * getAsOpaquePtr() const
static void print(SplitQualType split, raw_ostream &OS, const PrintingPolicy &policy, const Twine &PlaceHolder, unsigned Indentation=0)
bool isMoreQualifiedThan(QualType Other, const ASTContext &Ctx) const
Determine whether this type is more qualified than the other given type, requiring exact equality for...
bool isCanonicalAsParam() const
QualType stripNullability(const ASTContext &ctx) const
Strip nullability attributes from the given type.
void removeLocalRestrict()
bool isWebAssemblyExternrefType() const
Returns true if it is a WebAssembly Externref Type.
QualType(const Type *Ptr, unsigned Quals)
QualType getNonPackExpansionType() const
Remove an outer pack expansion type (if any) from this type.
SplitQualType getSplitUnqualifiedType() const
Retrieve the unqualified variant of the given type, removing as little sugar as possible.
bool isCXX11PODType(const ASTContext &Context) const
Return true if this is a POD type according to the more relaxed rules of the C++11 standard,...
bool mayBeNotDynamicClass() const
Returns true if it is not a class or if the class might not be dynamic.
bool isConstQualified() const
Determine whether this type is const-qualified.
bool hasAddressSpace() const
Check if this type has any address space qualifier.
bool isObjCGCWeak() const
true when Type is objc's weak.
QualType substObjCTypeArgs(ASTContext &ctx, ArrayRef< QualType > typeArgs, ObjCSubstitutionContext context) const
Substitute type arguments for the Objective-C type parameters used in the subject type.
unsigned getLocalFastQualifiers() const
void removeLocalFastQualifiers()
QualType getAtomicUnqualifiedType() const
Remove all qualifiers including _Atomic.
DestructionKind isDestructedType() const
Returns a nonzero value if objects of this type require non-trivial work to clean up after.
friend bool operator<(const QualType &LHS, const QualType &RHS)
friend bool operator!=(const QualType &LHS, const QualType &RHS)
StreamedQualTypeHelper stream(const PrintingPolicy &Policy, const Twine &PlaceHolder=Twine(), unsigned Indentation=0) const
bool isLocalVolatileQualified() const
Determine whether this particular QualType instance has the "volatile" qualifier set,...
bool isConstantStorage(const ASTContext &Ctx, bool ExcludeCtor, bool ExcludeDtor)
unsigned getCVRQualifiers() const
Retrieve the set of CVR (const-volatile-restrict) qualifiers applied to this type.
bool requiresBuiltinLaunder(const ASTContext &Context) const
Returns true if this type requires laundering by checking if it is a dynamic class 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
bool isWrapType() const
Returns true if it is a OverflowBehaviorType of Wrap kind.
static std::string getAsString(SplitQualType split, const PrintingPolicy &Policy)
bool hasNonTrivialObjCLifetime() const
bool isPODType(const ASTContext &Context) const
Determine whether this is a Plain Old Data (POD) type (C++ 3.9p10).
bool isAtLeastAsQualifiedAs(QualType Other, const ASTContext &Ctx) const
Determine whether this type is at least as qualified as the other given type, requiring exact equalit...
friend class QualifierCollector
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_PtrAuth
The type is an address-discriminated signed pointer type.
@ 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...
const Type * strip(QualType type)
Collect any qualifiers on the given type and return an unqualified type.
QualifierCollector(Qualifiers Qs=Qualifiers())
QualifiersAndAtomic & operator+=(Qualifiers RHS)
QualifiersAndAtomic withVolatile()
QualifiersAndAtomic withAtomic()
QualifiersAndAtomic withConst()
QualifiersAndAtomic(Qualifiers Quals, bool HasAtomic)
QualifiersAndAtomic withRestrict()
The collection of all-type qualifiers we support.
unsigned getCVRQualifiers() const
void removeCVRQualifiers(unsigned mask)
friend Qualifiers operator-(Qualifiers L, Qualifiers R)
Compute the difference between two qualifier sets.
static Qualifiers fromFastMask(unsigned Mask)
void setFastQualifiers(unsigned mask)
void addAddressSpace(LangAS space)
static Qualifiers removeCommonQualifiers(Qualifiers &L, Qualifiers &R)
Returns the common set of qualifiers while removing them from the given sets.
bool hasOnlyConst() const
@ OCL_Strong
Assigning into this object requires the old value to be released and the new value to be retained.
@ OCL_ExplicitNone
This object can be modified without requiring retains or releases.
@ OCL_None
There is no lifetime qualification on this type.
@ OCL_Weak
Reading or writing from this object requires a barrier call.
@ OCL_Autoreleasing
Assigning into this object requires a lifetime extension.
void removeObjCLifetime()
bool hasTargetSpecificAddressSpace() const
bool isStrictSupersetOf(Qualifiers Other) const
Determine whether this set of qualifiers is a strict superset of another set of qualifiers,...
bool hasNonFastQualifiers() const
Return true if the set contains any qualifiers which require an ExtQuals node to be allocated.
void Profile(llvm::FoldingSetNodeID &ID) const
bool operator!=(Qualifiers Other) const
bool hasNonTrivialObjCLifetime() const
True if the lifetime is neither None or ExplicitNone.
void addCVRQualifiers(unsigned mask)
bool hasCVRQualifiers() const
void addConsistentQualifiers(Qualifiers qs)
Add the qualifiers from the given set to this set, given that they don't conflict.
void removeFastQualifiers(unsigned mask)
static bool isTargetAddressSpaceSupersetOf(LangAS A, LangAS B, const ASTContext &Ctx)
Qualifiers & operator+=(Qualifiers R)
void removeFastQualifiers()
bool hasQualifiers() const
Return true if the set contains any qualifiers.
void removeCVRQualifiers()
Qualifiers withVolatile() const
void addCVRUQualifiers(unsigned mask)
Qualifiers & operator-=(Qualifiers R)
bool compatiblyIncludes(Qualifiers other, const ASTContext &Ctx) const
Determines if these qualifiers compatibly include another set.
bool hasUnaligned() const
unsigned getAddressSpaceAttributePrintValue() const
Get the address space attribute value to be printed by diagnostics.
bool hasAddressSpace() const
static bool isAddressSpaceSupersetOf(LangAS A, LangAS B, const ASTContext &Ctx)
Returns true if address space A is equal to or a superset of B.
Qualifiers withoutAddressSpace() const
unsigned getFastQualifiers() const
void print(raw_ostream &OS, const PrintingPolicy &Policy, bool appendSpaceIfNonEmpty=false) const
void removeAddressSpace()
void addQualifiers(Qualifiers Q)
Add the qualifiers from the given set to this set.
static Qualifiers fromCVRMask(unsigned CVR)
void setAddressSpace(LangAS space)
unsigned getCVRUQualifiers() const
bool isEmptyWhenPrinted(const PrintingPolicy &Policy) const
PointerAuthQualifier getPointerAuth() const
void setObjCGCAttr(GC type)
Qualifiers withConst() const
bool hasObjCGCAttr() const
uint64_t getAsOpaqueValue() const
void setCVRQualifiers(unsigned mask)
bool hasObjCLifetime() const
ObjCLifetime getObjCLifetime() const
Qualifiers withoutObjCLifetime() const
Qualifiers withoutObjCGCAttr() const
static Qualifiers fromCVRUMask(unsigned CVRU)
friend Qualifiers operator+(Qualifiers L, Qualifiers R)
void setUnaligned(bool flag)
void addFastQualifiers(unsigned mask)
std::string getAsString() const
Qualifiers withRestrict() const
void addPointerAuth(PointerAuthQualifier Q)
void addObjCGCAttr(GC type)
bool hasPointerAuth() const
bool operator==(Qualifiers Other) const
void removeQualifiers(Qualifiers Q)
Remove the qualifiers from the given set from this set.
LangAS getAddressSpace() const
bool hasOnlyVolatile() const
void setPointerAuth(PointerAuthQualifier Q)
bool compatiblyIncludesObjCLifetime(Qualifiers other) const
Determines if these qualifiers compatibly include another set of qualifiers from the narrow perspecti...
Qualifiers getNonFastQualifiers() const
static Qualifiers fromOpaqueValue(uint64_t opaque)
bool hasStrongOrWeakObjCLifetime() const
True if the lifetime is either strong or weak.
static std::string getAddrSpaceAsString(LangAS AS)
@ FastWidth
The width of the "fast" qualifier mask.
@ MaxAddressSpace
The maximum supported address space number.
@ FastMask
The fast qualifier mask.
bool hasFastQualifiers() const
bool hasOnlyRestrict() const
bool isAddressSpaceSupersetOf(Qualifiers other, const ASTContext &Ctx) const
Returns true if the address space in these qualifiers is equal to or a superset of the address space ...
void addObjCLifetime(ObjCLifetime type)
void setObjCLifetime(ObjCLifetime type)
static bool classof(const Type *T)
Represents a struct/union/class.
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
std::pair< QualType, bool > getKey() const
Encodes a location in the source.
Stmt - This represents one statement.
The streaming interface shared between DiagnosticBuilder and PartialDiagnostic.
void AddTaggedVal(uint64_t V, DiagnosticsEngine::ArgumentKind Kind) const
Represents the declaration of a struct/union/class/enum.
Stores a list of template parameters for a TemplateDecl and its derived classes.
[BoundsSafety] Represents information of declarations referenced by the arguments of the counted_by a...
TypeCoupledDeclRefInfo(ValueDecl *D=nullptr, bool Deref=false)
D is to a declaration referenced by the argument of attribute.
llvm::PointerIntPair< ValueDecl *, 1, unsigned > BaseTy
Base wrapper for a particular "section" of type source info.
static bool classof(const Type *T)
TypeOfKind getKind() const
Returns the kind of 'typeof' type this is.
TypeOfExprType(const ASTContext &Context, Expr *E, TypeOfKind Kind, QualType Can=QualType())
Expr * getUnderlyingExpr() const
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!
TypeWithKeyword(ElaboratedTypeKeyword Keyword, TypeClass tc, QualType Canonical, TypeDependence Dependence)
friend class AttributedType
friend class ConstantArrayType
friend class CountAttributedType
FunctionTypeBitfields store various bits belonging to FunctionProtoType.
friend class FunctionProtoType
friend class FunctionType
friend class KeywordWrapper
friend class ObjCObjectType
friend class PackExpansionType
friend class PredefinedSugarType
friend class ReferenceType
friend class SubstTemplateTypeParmPackType
friend class SubstPackType
friend class SubstTemplateTypeParmType
friend class TemplateSpecializationType
friend class TemplateTypeParmType
friend class TypeOfExprType
friend class UnresolvedUsingType
friend class DependentVectorType
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.
bool isDecltypeType() const
bool isDependentSizedArrayType() const
bool isFixedPointOrIntegerType() const
Return true if this is a fixed point or integer type.
bool isBlockPointerType() const
TypedefBitfields TypedefBits
bool isBooleanType() const
bool isFunctionReferenceType() const
bool isSignableType(const ASTContext &Ctx) const
Type(const Type &)=delete
bool isObjCBuiltinType() const
const TemplateSpecializationType * getAsNonAliasTemplateSpecializationType() const
Look through sugar for an instance of TemplateSpecializationType which is not a type alias,...
bool isMFloat8Type() const
const Type * getPointeeOrArrayElementType() const
If this is a pointer type, return the pointee type.
bool isIncompleteArrayType() const
bool isPlaceholderType() const
Test for a type which does not represent an actual type-system type but is instead used as a placehol...
bool isFloat16Type() const
ReferenceTypeBitfields ReferenceTypeBits
bool isSignablePointerType() const
ArrayTypeBitfields ArrayTypeBits
const ArrayType * castAsArrayTypeUnsafe() const
A variant of castAs<> for array type which silently discards qualifiers from the outermost type.
static constexpr int NumDeducedTypeBits
bool isDependentAddressSpaceType() const
bool isUndeducedAutoType() const
bool isRValueReferenceType() const
bool isFundamentalType() const
Tests whether the type is categorized as a fundamental type.
VectorTypeBitfields VectorTypeBits
SubstPackTypeBitfields SubstPackTypeBits
bool isConstantArrayType() const
bool canDecayToPointerType() const
Determines whether this type can decay to a pointer type.
bool isFunctionPointerType() const
bool isHLSLInlineSpirvType() const
bool isConvertibleToFixedPointType() const
Return true if this can be converted to (or from) a fixed point type.
bool isArithmeticType() const
PredefinedSugarTypeBitfields PredefinedSugarTypeBits
bool isConstantMatrixType() const
bool isHLSLBuiltinIntangibleType() const
bool isPointerType() const
const TemplateSpecializationType * castAsNonAliasTemplateSpecializationType() const
bool isArrayParameterType() const
TypeOfBitfields TypeOfBits
static constexpr int FunctionTypeNumParamsLimit
bool isIntegerType() const
isIntegerType() does not include complex integers (a GCC extension).
bool isObjCSelType() const
const T * castAs() const
Member-template castAs<specific type>.
BuiltinTypeBitfields BuiltinTypeBits
bool isSpecificPlaceholderType(unsigned K) const
Test for a specific placeholder type.
bool isReferenceType() const
bool isSignedFixedPointType() const
Return true if this is a fixed point type that is signed according to ISO/IEC JTC1 SC22 WG14 N1169.
bool isObjectPointerType() const
bool isEnumeralType() const
bool isVisibilityExplicit() const
Return true if the visibility was explicitly set is the code.
void addDependence(TypeDependence D)
bool isCooperativeMatrixType() const
ConstantArrayTypeBitfields ConstantArrayTypeBits
Type(TypeClass tc, QualType canon, TypeDependence Dependence)
bool isScalarType() const
bool isVariableArrayType() const
bool isFloat128Type() const
bool isSveVLSBuiltinType() const
Determines if this is a sizeless type supported by the 'arm_sve_vector_bits' type attribute,...
CountAttributedTypeBitfields CountAttributedTypeBits
bool isObjCQualifiedIdType() const
QualType getPointeeType() const
If this is a pointer, ObjC object pointer, or block pointer, this returns the respective pointee.
LinkageInfo getLinkageAndVisibility() const
Determine the linkage and visibility of this type.
bool isIntegralOrEnumerationType() const
Determine whether this type is an integral or enumeration type.
bool isExtVectorType() const
bool isExtVectorBoolType() const
Type & operator=(const Type &)=delete
bool isObjCObjectOrInterfaceType() const
bool isNonOverloadPlaceholderType() const
Test for a placeholder type other than Overload; see BuiltinType::isNonOverloadPlaceholderType.
bool isOCLIntelSubgroupAVCType() const
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 isMemberDataPointerType() const
bool isLValueReferenceType() const
bool isBitIntType() const
bool isSpecificBuiltinType(unsigned K) const
Test for a particular builtin type.
bool isBuiltinType() const
Helper methods to distinguish type categories.
bool isOpenCLSpecificType() const
bool isConstantMatrixBoolType() const
bool isDependentType() const
Whether this type is a dependent type, meaning that its definition somehow depends on a template para...
bool isSignableIntegerType(const ASTContext &Ctx) const
bool isFloat32Type() const
bool isAnyComplexType() const
bool isFixedPointType() const
Return true if this is a fixed point type according to ISO/IEC JTC1 SC22 WG14 N1169.
friend class TypePropertyCache
DeducedType * getContainedDeducedType() const
Get the DeducedType whose type will be deduced for a variable with an initializer of this type.
bool isSaturatedFixedPointType() const
Return true if this is a saturated fixed point type according to ISO/IEC JTC1 SC22 WG14 N1169.
bool containsUnexpandedParameterPack() const
Whether this type is or contains an unexpanded parameter pack, used to support C++0x variadic templat...
bool hasPointeeToCFIUncheckedCalleeFunctionType() const
const BuiltinType * getAsPlaceholderType() const
QualType getCanonicalTypeInternal() const
bool isHLSLSpecificType() const
bool isTemplateTypeParmType() const
static constexpr unsigned TemplateTypeParmTypeDepthBits
@ PtrdiffT
The "ptrdiff_t" type.
@ SizeT
The "size_t" type.
@ SignedSizeT
The signed integer type corresponding to "size_t".
bool isCompoundType() const
Tests whether the type is categorized as a compound type.
bool containsErrors() const
Whether this type is an error type.
const Type * getBaseElementTypeUnsafe() const
Get the base element type of this type, potentially discarding type qualifiers.
bool isMemberPointerType() const
bool isAtomicType() const
AttributedTypeBitfields AttributedTypeBits
bool isFunctionProtoType() const
bool isIbm128Type() const
bool isOverloadableType() const
Determines whether this is a type for which one can define an overloaded operator.
bool isObjCIdType() const
bool isMatrixType() const
TagTypeBitfields TagTypeBits
bool isOverflowBehaviorType() const
PackExpansionTypeBitfields PackExpansionTypeBits
bool isVariablyModifiedType() const
Whether this type is a variably-modified type (C99 6.7.5).
bool isUnsaturatedFixedPointType() const
Return true if this is a saturated fixed point type according to ISO/IEC JTC1 SC22 WG14 N1169.
UnresolvedUsingBitfields UnresolvedUsingBits
bool isObjCObjectType() const
bool isFromAST() const
Whether this type comes from an AST file.
const ArrayType * getAsArrayTypeUnsafe() const
A variant of getAs<> for array types which silently discards qualifiers from the outermost type.
bool isHLSLBuiltinPackedType() const
bool isUndeducedType() const
Determine whether this type is an undeduced type, meaning that it somehow involves a C++11 'auto' typ...
bool isObjectType() const
Determine whether this type is an object type.
bool isDoubleType() const
bool isPointerOrReferenceType() const
bool isMetaInfoType() const
KeywordWrapperBitfields KeywordWrapperBits
FunctionTypeBitfields FunctionTypeBits
bool isBFloat16Type() const
void setDependence(TypeDependence D)
const T * getAsAdjusted() const
Member-template getAsAdjusted<specific type>.
bool isFunctionType() const
bool isObjCObjectPointerType() const
SubstTemplateTypeParmTypeBitfields SubstTemplateTypeParmTypeBits
TypeDependence getDependence() const
Visibility getVisibility() const
Determine the visibility of this type.
bool isMemberFunctionPointerType() const
bool isUnsignedFixedPointType() const
Return true if this is a fixed point type that is unsigned according to ISO/IEC JTC1 SC22 WG14 N1169.
bool isVectorType() const
bool isObjCQualifiedClassType() const
bool isObjCClassType() const
bool isObjCInertUnsafeUnretainedType() const
Was this type written with the special inert-in-ARC __unsafe_unretained qualifier?
bool isRealFloatingType() const
Floating point categories.
const T * getAsCanonical() const
If this type is canonically the specified type, return its canonical type cast to that specified type...
bool isHLSLAttributedResourceType() const
ObjCObjectTypeBitfields ObjCObjectTypeBits
TemplateTypeParmTypeBitfields TemplateTypeParmTypeBits
bool isOCLExtOpaqueType() const
const T * castAsCanonical() const
Return this type's canonical type cast to the specified type.
bool isAnyPointerType() const
TypeClass getTypeClass() const
bool isCanonicalUnqualified() const
Determines if this type would be canonical if it had no further qualification.
static constexpr unsigned TemplateTypeParmTypeIndexBits
bool isSubscriptableVectorType() const
const T * getAs() const
Member-template getAs<specific type>'.
const Type * getUnqualifiedDesugaredType() const
Return the specified type with any "sugar" removed from the type, removing any typedefs,...
bool isNullPtrType() const
bool isRecordType() const
TemplateSpecializationTypeBitfields TemplateSpecializationTypeBits
bool isTypedefNameType() const
Determines whether this type is written as a typedef-name.
static constexpr int FunctionTypeNumParamsWidth
bool isFunctionNoProtoType() const
bool isReserveIDT() const
bool hasObjCPointerRepresentation() const
Whether this type can represent an objective pointer type for the purpose of GC'ability.
bool hasPointerRepresentation() const
Whether this type is represented natively as a pointer.
DeducedTypeBitfields DeducedTypeBits
AutoTypeBitfields AutoTypeBits
bool isCFIUncheckedCalleeFunctionType() const
Type & operator=(Type &&)=delete
Base class for declarations which introduce a typedef-name.
TypedefNameDecl * getDecl() const
NestedNameSpecifier getQualifier() const
static void Profile(llvm::FoldingSetNodeID &ID, ElaboratedTypeKeyword Keyword, NestedNameSpecifier Qualifier, const TypedefNameDecl *Decl, QualType Underlying)
static bool classof(const Type *T)
bool typeMatchesDecl() const
void Profile(llvm::FoldingSetNodeID &ID) const
void Profile(llvm::FoldingSetNodeID &ID) const
NestedNameSpecifier getQualifier() const
UnresolvedUsingTypenameDecl * getDecl() const
static void Profile(llvm::FoldingSetNodeID &ID, ElaboratedTypeKeyword Keyword, NestedNameSpecifier Qualifier, const UnresolvedUsingTypenameDecl *D)
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 ...
UsingShadowDecl * getDecl() const
void Profile(llvm::FoldingSetNodeID &ID) const
NestedNameSpecifier getQualifier() const
static void Profile(llvm::FoldingSetNodeID &ID, ElaboratedTypeKeyword Keyword, NestedNameSpecifier Qualifier, const UsingShadowDecl *D, QualType UnderlyingType)
static bool classof(const Type *T)
Represent the declaration of a variable (in which case it is an lvalue) a function (in which case it ...
static bool classof(const Type *T)
friend class StmtIteratorBase
void Profile(llvm::FoldingSetNodeID &ID)
Expr * getSizeExpr() const
Represents a GCC generic vector type.
unsigned getNumElements() const
VectorType(QualType vecType, unsigned nElements, QualType canonType, VectorKind vecKind)
void Profile(llvm::FoldingSetNodeID &ID)
static void Profile(llvm::FoldingSetNodeID &ID, QualType ElementType, unsigned NumElements, TypeClass TypeClass, VectorKind VecKind)
unsigned getRVVFixedLengthMaskLanes() const
Return the number of lanes of an RVV fixed-length mask vector.
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.
mlir::Type getBaseType(mlir::Value varPtr)
@ AttributedType
The l-value was considered opaque, so the alignment was determined from a type, but that type was an ...
bool operator!=(const CommonEntityInfo &LHS, const CommonEntityInfo &RHS)
const internal::VariadicAllOfMatcher< Type > type
Matches Types in the clang AST.
const AstTypeMatcher< ArrayType > arrayType
const internal::VariadicAllOfMatcher< Decl > decl
Matches declarations.
uint32_t Literal
Literals are represented as positive integers.
std::variant< struct RequiresDecl, struct HeaderDecl, struct UmbrellaDirDecl, struct ModuleDecl, struct ExcludeDecl, struct ExportDecl, struct ExportAsDecl, struct ExternModuleDecl, struct UseDecl, struct LinkDecl, struct ConfigMacrosDecl, struct ConflictDecl > Decl
All declarations that can appear in a module declaration.
bool operator==(const ValueType &a, const ValueType &b)
bool isLiteral(TokenKind K)
Return true if this is a "literal" kind, like a numeric constant, string, etc.
Top level wrappers for InstallAPI frontend operations.
CanQual< Type > CanQualType
Represents a canonical, potentially-qualified type.
VectorKind getRVVFixedLengthDataVectorKind(int LMulLog2)
Inverse of getRVVFixedLengthDataLMulLog2().
@ Overload
This is a legitimate overload: the existing declarations are functions or function templates with dif...
bool isa(CodeGen::Address addr)
AutoTypeKeyword
Which keyword(s) were used to create an AutoType.
@ GNUAutoType
__auto_type (GNU extension)
@ DecltypeAuto
decltype(auto)
bool isTargetAddressSpace(LangAS AS)
bool isRVVFixedLengthDataVectorKind(VectorKind VK)
True if VK is one of the RVV fixed-length data vector kinds, i.e.
CanThrowResult
Possible results from evaluation of a noexcept expression.
FunctionType::ExtInfo getFunctionExtInfo(const Type &t)
bool isDynamicExceptionSpec(ExceptionSpecificationType ESpecType)
TypeDependenceScope::TypeDependence TypeDependence
@ Nullable
Values of this type can be null.
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 (&&).
@ TemplateName
The identifier is a template name. FIXME: Add an annotation for that.
VectorKind getRVVFixedLengthMaskVectorKind(unsigned RatioLog2, unsigned SubByteLanes)
Inverse of getRVVFixedLengthMaskRatioLog2() and getRVVFixedLengthMaskSubByteLanes().
bool IsEnumDeclComplete(EnumDecl *ED)
Check if the given decl is complete.
ExprDependence computeDependence(FullExpr *E)
@ Vector
'vector' clause, allowed on 'loop', Combined, and 'routine' directives.
@ Create
'create' clause, allowed on Compute and Combined constructs, plus 'data', 'enter data',...
@ Self
'self' clause, allowed on Compute and Combined Constructs, plus 'update'.
TypeOfKind
The kind of 'typeof' expression we're after.
bool operator==(const CallGraphNode::CallRecord &LHS, const CallGraphNode::CallRecord &RHS)
unsigned getRVVFixedLengthMaskRatioLog2(VectorKind VK)
Return log2 of the R of the vbool<R>_t type recorded in an RVV fixed-length mask vector kind: Ratio1 ...
nullptr
This class represents a compute construct, representing a 'Kind' of ‘parallel’, 'serial',...
TypeDependence toTypeDependence(ExprDependence D)
StringRef getRVVFixedLengthString(VectorKind VK)
Return the LMUL of an RVV fixed-length data vector kind, "mf8" .
bool isRVVFixedLengthVectorKind(VectorKind VK)
True if VK is one of the RVV fixed-length data or mask vector kinds.
@ Dependent
Parse the block as a dependent block, which may be used in some template instantiations but not other...
unsigned toTargetAddressSpace(LangAS AS)
Linkage
Describes the different kinds of linkage (C++ [basic.link], C99 6.2.2) that an entity may have.
unsigned getRVVFixedLengthMaskSubByteLanes(VectorKind VK)
Return the number of lanes (1, 2 or 4) of an RVV fixed-length mask vector kind that fits in less than...
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.
@ Ordinary
This parameter uses ordinary ABI rules for its type.
OptionalUnsigned< unsigned > UnsignedOrNone
bool isComputedNoexcept(ExceptionSpecificationType ESpecType)
@ Template
We are parsing a template declaration.
bool isNoexceptExceptionSpec(ExceptionSpecificationType ESpecType)
TagTypeKind
The kind of a tag type.
constexpr unsigned PointerAuthKeyNone
int getRVVFixedLengthDataLMulLog2(VectorKind VK)
Return log2 of the LMUL recorded in an RVV fixed-length data vector kind: MF8 -> -3,...
bool IsEnumDeclScoped(EnumDecl *ED)
Check if the given decl is scoped.
std::is_base_of< ArrayType, T > TypeIsArrayType
@ Keyword
The name has been typo-corrected to a keyword.
LangAS
Defines the address space values used by the address space qualifier of QualType.
void FixedPointValueToString(SmallVectorImpl< char > &Str, llvm::APSInt Val, unsigned Scale)
bool operator!=(CanQual< T > x, CanQual< U > y)
@ Deduced
The normal deduced case.
@ Undeduced
Not deduced yet. This is for example an 'auto' which was just parsed.
@ DeducedAsPack
Same as above, but additionally this represents a case where the deduced entity itself is a pack.
@ DeducedAsDependent
This is a special case where the initializer is dependent, so we can't deduce a type yet.
PointerAuthenticationMode
const StreamingDiagnostic & operator<<(const StreamingDiagnostic &DB, const ConceptReference *C)
Insertion operator for diagnostics.
CallingConv
CallingConv - Specifies the calling convention that a function uses.
@ RVVFixedLengthMaskRatio8
@ RVVFixedLengthMaskRatio4
@ AltiVecBool
is AltiVec 'vector bool ...'
@ RVVFixedLengthMaskRatio2_2
@ SveFixedLengthData
is AArch64 SVE fixed-length data vector
@ RVVFixedLengthMaskRatio8_2
@ AltiVecVector
is AltiVec vector
@ RVVFixedLengthMaskRatio2_4
@ AltiVecPixel
is AltiVec 'vector Pixel'
@ RVVFixedLengthMaskRatio32_1
@ RVVFixedLengthMaskRatio1_4
@ RVVFixedLengthMaskRatio64_2
@ Generic
not a target-specific vector type
@ RVVFixedLengthMaskRatio8_1
@ RVVFixedLengthMaskRatio1
is RISC-V RVV fixed-length mask vector of vbool<R>_t; the _<L> kinds have only L lanes in a single by...
@ RVVFixedLengthMaskRatio2_1
@ RVVFixedLengthMaskRatio64_1
@ RVVFixedLengthMaskRatio1_1
@ RVVFixedLengthMaskRatio1_2
@ RVVFixedLengthMaskRatio32_2
@ RVVFixedLengthMaskRatio64_4
@ RVVFixedLengthMaskRatio32_4
@ RVVFixedLengthData_MF8
is RISC-V RVV fixed-length data vector
@ RVVFixedLengthMaskRatio16_2
@ RVVFixedLengthMaskRatio8_4
@ RVVFixedLengthMaskRatio2
@ RVVFixedLengthMaskRatio16
@ RVVFixedLengthMaskRatio4_1
@ RVVFixedLengthMaskRatio16_1
@ RVVFixedLengthMaskRatio4_2
@ NeonPoly
is ARM Neon polynomial vector
@ SveFixedLengthPredicate
is AArch64 SVE fixed-length predicate vector
@ RVVFixedLengthMaskRatio32
@ RVVFixedLengthMaskRatio4_4
@ RVVFixedLengthMaskRatio16_4
@ RVVFixedLengthMaskRatio64
U cast(CodeGen::Address addr)
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.
@ None
No keyword precedes the qualified type name.
@ Struct
The "struct" keyword introduces the elaborated-type-specifier.
@ Class
The "class" keyword introduces the elaborated-type-specifier.
@ Union
The "union" keyword introduces the elaborated-type-specifier.
@ Enum
The "enum" keyword introduces the elaborated-type-specifier.
@ Typename
The "typename" keyword precedes the qualified type name, e.g., typename T::type.
TypeDependence toSyntacticDependence(TypeDependence D)
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)
OptionalUnsigned< NullabilityKind > NullabilityKindOrNone
bool isRVVFixedLengthMaskVectorKind(VectorKind VK)
True if VK is one of the RVV fixed-length mask vector kinds, i.e.
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...
int32_t uint32_t uint32_t __builtin_riscv_mhracc_i32 __builtin_riscv_mhraccu_u32 __builtin_riscv_mhraccsu_i32 __builtin_riscv_mhacc_h1_i32 __builtin_riscv_mhaccsu_h1_i32 __builtin_riscv_mulqr_i32 __builtin_riscv_mqrwacc_i64 __packed_splat4 __packed_splat2 __packed_splat8 __packed_splat4 __packed_splat2 __packed_splat4 uint16_t
__builtin_elementwise_add_sat __builtin_elementwise_sub_sat uint32_t uint64_t __builtin_riscv_ssha_i32 __builtin_riscv_sshl_u32 unsigned
__builtin_elementwise_add_sat __builtin_elementwise_sub_sat uint32_t int64_t
__builtin_elementwise_add_sat __builtin_elementwise_sub_sat uint32_t uint64_t __builtin_riscv_ssha_i32 __builtin_riscv_sshl_u32 uint64_t
int32_t uint32_t uint32_t __builtin_riscv_mhracc_i32 __builtin_riscv_mhraccu_u32 __builtin_riscv_mhraccsu_i32 __builtin_riscv_mhacc_h1_i32 __builtin_riscv_mhaccsu_h1_i32 __builtin_riscv_mulqr_i32 __builtin_riscv_mqrwacc_i64 __packed_splat4 __packed_splat2 __packed_splat8 __packed_splat4 __packed_splat2 uint8_t
void Profile(llvm::FoldingSetNodeID &ID)
const T * getType() const
FunctionEffectWithCondition Rejected
FunctionEffectWithCondition Kept
A FunctionEffect plus a potential boolean expression determining whether the effect is declared (e....
FunctionEffectWithCondition(FunctionEffect E, const EffectConditionExpr &C)
Holds information about the various types of exception specification.
FunctionDecl * SourceDecl
The function whose exception specification this is, for EST_Unevaluated and EST_Uninstantiated.
ExceptionSpecInfo(ExceptionSpecificationType EST)
FunctionDecl * SourceTemplate
The function template whose exception specification this is instantiated from, for EST_Uninstantiated...
ExceptionSpecificationType Type
The kind of exception specification this is.
ArrayRef< QualType > Exceptions
Explicitly-specified list of exception types.
Expr * NoexceptExpr
Noexcept expression, if this is a computed noexcept specification.
ExceptionSpecInfo()=default
Extra information about a function prototype.
ExceptionSpecInfo ExceptionSpec
FunctionTypeExtraAttributeInfo ExtraAttributeInfo
bool requiresFunctionProtoTypeArmAttributes() const
unsigned AArch64SMEAttributes
SourceLocation EllipsisLoc
FunctionEffectsRef FunctionEffects
unsigned CFIUncheckedCallee
const ExtParameterInfo * ExtParameterInfos
RefQualifierKind RefQualifier
bool requiresFunctionProtoTypeExtraAttributeInfo() const
ExtProtoInfo withCFIUncheckedCallee(bool CFIUncheckedCallee)
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.
FunctionTypeArmAttributes()
unsigned AArch64SMEAttributes
Any AArch64 SME ACLE type attributes that need to be propagated on declarations and function pointers...
Provides a few static helpers for converting and printing elaborated type keyword and tag type kind e...
static StringRef getTagTypeKindName(TagTypeKind Kind)
static StringRef getKeywordName(ElaboratedTypeKeyword Keyword)
static ElaboratedTypeKeyword getKeywordForTagTypeKind(TagTypeKind Tag)
Converts a TagTypeKind into an elaborated type keyword.
static TagTypeKind getTagTypeKindForKeyword(ElaboratedTypeKeyword Keyword)
Converts an elaborated type keyword into a TagTypeKind.
static TagTypeKind getTagTypeKindForTypeSpec(unsigned TypeSpec)
Converts a type specifier (DeclSpec::TST) into a tag type kind.
static bool KeywordIsTagTypeKind(ElaboratedTypeKeyword Keyword)
static ElaboratedTypeKeyword getKeywordForTypeSpec(unsigned TypeSpec)
Converts a type specifier (DeclSpec::TST) into an elaborated type keyword.
A late-parsed attribute that will be applied as a type attribute.
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 constexpr int NumLowBitsAvailable
static void * getAsVoidPointer(::clang::Type *P)
static constexpr int NumLowBitsAvailable
static inline ::clang::Type * getFromVoidPointer(void *P)
static void * getAsVoidPointer(clang::QualType P)
static clang::QualType getFromVoidPointer(void *P)
static constexpr int NumLowBitsAvailable
static SimpleType getSimplifiedValue(::clang::QualType Val)
const ::clang::Type * SimpleType