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"
70class TemplateParameterList;
79namespace serialization {
80 template <
class T>
class AbstractTypeReader;
117template <
typename>
class CanQual;
122class ExtQualsTypeCommonBase;
124class FunctionEffectsRef;
125class FunctionEffectKindSet;
126class FunctionEffectSet;
129class ObjCInterfaceDecl;
130class ObjCProtocolDecl;
131class ObjCTypeParamDecl;
132struct PrintingPolicy;
136class ClassTemplateDecl;
137class TemplateArgument;
138class TemplateArgumentListInfo;
139class TemplateArgumentLoc;
140class TemplateTypeParmDecl;
141class TypedefNameDecl;
142class UnresolvedUsingTypenameDecl;
143class UsingShadowDecl;
148#define TYPE(Class, Base) class Class##Type;
149#include "clang/AST/TypeNodes.inc"
156 EnabledMask = 1 << EnabledShift,
157 AddressDiscriminatedShift = EnabledShift + EnabledBits,
158 AddressDiscriminatedBits = 1,
159 AddressDiscriminatedMask = 1 << AddressDiscriminatedShift,
160 AuthenticationModeShift =
161 AddressDiscriminatedShift + AddressDiscriminatedBits,
162 AuthenticationModeBits = 2,
163 AuthenticationModeMask = ((1 << AuthenticationModeBits) - 1)
164 << AuthenticationModeShift,
165 IsaPointerShift = AuthenticationModeShift + AuthenticationModeBits,
167 IsaPointerMask = ((1 << IsaPointerBits) - 1) << IsaPointerShift,
168 AuthenticatesNullValuesShift = IsaPointerShift + IsaPointerBits,
169 AuthenticatesNullValuesBits = 1,
170 AuthenticatesNullValuesMask = ((1 << AuthenticatesNullValuesBits) - 1)
171 << AuthenticatesNullValuesShift,
172 KeyShift = AuthenticatesNullValuesShift + AuthenticatesNullValuesBits,
174 KeyMask = ((1 << KeyBits) - 1) << KeyShift,
175 DiscriminatorShift = KeyShift + KeyBits,
176 DiscriminatorBits = 16,
177 DiscriminatorMask = ((1u << DiscriminatorBits) - 1) << DiscriminatorShift,
188 static_assert((EnabledBits + AddressDiscriminatedBits +
189 AuthenticationModeBits + IsaPointerBits +
190 AuthenticatesNullValuesBits + KeyBits + DiscriminatorBits) ==
192 "PointerAuthQualifier should be exactly 32 bits");
193 static_assert((EnabledMask + AddressDiscriminatedMask +
194 AuthenticationModeMask + IsaPointerMask +
195 AuthenticatesNullValuesMask + KeyMask + DiscriminatorMask) ==
197 "All masks should cover the entire bits");
198 static_assert((EnabledMask ^ AddressDiscriminatedMask ^
199 AuthenticationModeMask ^ IsaPointerMask ^
200 AuthenticatesNullValuesMask ^ KeyMask ^ DiscriminatorMask) ==
202 "All masks should cover the entire bits");
205 unsigned ExtraDiscriminator,
207 bool IsIsaPointer,
bool AuthenticatesNullValues)
209 (IsAddressDiscriminated
210 ? llvm::to_underlying(AddressDiscriminatedMask)
213 (llvm::to_underlying(AuthenticationMode)
214 << AuthenticationModeShift) |
215 (ExtraDiscriminator << DiscriminatorShift) |
216 (IsIsaPointer << IsaPointerShift) |
217 (AuthenticatesNullValues << AuthenticatesNullValuesShift)) {
220 assert((
Data == 0) ==
239 Create(
unsigned Key,
bool IsAddressDiscriminated,
unsigned ExtraDiscriminator,
241 bool AuthenticatesNullValues) {
246 AuthenticationMode, IsIsaPointer,
247 AuthenticatesNullValues);
251 assert((
Data == 0) ==
260 return (
Data & KeyMask) >> KeyShift;
267 return (
Data & AddressDiscriminatedMask) >> AddressDiscriminatedShift;
272 return (
Data >> DiscriminatorShift);
277 AuthenticationModeShift);
282 return (
Data & IsaPointerMask) >> IsaPointerShift;
287 return (
Data & AuthenticatesNullValuesMask) >> AuthenticatesNullValuesShift;
295 return Lhs.Data == Rhs.Data;
298 return Lhs.Data != Rhs.Data;
311 assert((
Result.Data == 0) ==
398 Q.Mask = L.Mask & R.Mask;
492 assert(!(mask & ~
CVRMask) &&
"bitmask contains non-CVR bits");
493 Mask = (Mask & ~CVRMask) | mask;
496 assert(!(mask & ~
CVRMask) &&
"bitmask contains non-CVR bits");
497 Mask &= ~static_cast<uint64_t>(mask);
503 assert(!(mask & ~
CVRMask) &&
"bitmask contains non-CVR bits");
507 assert(!(mask & ~
CVRMask & ~UMask) &&
"bitmask contains non-CVRU bits");
513 Mask = (Mask & ~UMask) | (flag ? UMask : 0);
521 Mask = (Mask & ~GCAttrMask) | (
type << GCAttrShift);
546 return ObjCLifetime((Mask & LifetimeMask) >> LifetimeShift);
549 Mask = (Mask & ~LifetimeMask) | (
type << LifetimeShift);
555 Mask |= (
type << LifetimeShift);
572 return static_cast<LangAS>((Mask & AddressSpaceMask) >> AddressSpaceShift);
593 Mask = (Mask & ~AddressSpaceMask)
594 | (((uint32_t) space) << AddressSpaceShift);
607 Mask = (Mask & ~PtrAuthMask) |
621 assert(!(mask & ~
FastMask) &&
"bitmask contains non-fast qualifier bits");
622 Mask = (Mask & ~FastMask) | mask;
625 assert(!(mask & ~
FastMask) &&
"bitmask contains non-fast qualifier bits");
626 Mask &= ~static_cast<uint64_t>(mask);
632 assert(!(mask & ~
FastMask) &&
"bitmask contains non-fast qualifier bits");
647 bool empty()
const {
return !Mask; }
802 bool appendSpaceIfNonEmpty =
false)
const;
804 void Profile(llvm::FoldingSetNodeID &
ID)
const {
ID.AddInteger(Mask); }
811 "PointerAuthQualifier must be 32 bits");
813 static constexpr uint64_t PtrAuthShift = 32;
814 static constexpr uint64_t PtrAuthMask = UINT64_C(0xffffffff) << PtrAuthShift;
816 static constexpr uint64_t UMask = 0x8;
817 static constexpr uint64_t UShift = 3;
818 static constexpr uint64_t GCAttrMask = 0x30;
819 static constexpr uint64_t GCAttrShift = 4;
820 static constexpr uint64_t LifetimeMask = 0x1C0;
821 static constexpr uint64_t LifetimeShift = 6;
822 static constexpr uint64_t AddressSpaceMask =
823 ~(
CVRMask | UMask | GCAttrMask | LifetimeMask | PtrAuthMask);
824 static constexpr uint64_t AddressSpaceShift = 9;
834 : Quals(Quals), HasAtomic(HasAtomic) {}
883 std::pair<const Type *,Qualifiers>
asPair()
const {
884 return std::pair<const Type *, Qualifiers>(
Ty,
Quals);
888 return a.
Ty ==
b.Ty && a.
Quals ==
b.Quals;
891 return a.
Ty !=
b.Ty || a.
Quals !=
b.Quals;
941 llvm::PointerIntPair<llvm::PointerUnion<const Type *, const ExtQuals *>,
944 const ExtQuals *getExtQualsUnsafe()
const {
945 return cast<const ExtQuals *>(
Value.getPointer());
948 const Type *getTypePtrUnsafe()
const {
949 return cast<const Type *>(
Value.getPointer());
952 const ExtQualsTypeCommonBase *getCommonPtr()
const {
953 assert(!
isNull() &&
"Cannot retrieve a NULL type pointer");
954 auto CommonPtrVal =
reinterpret_cast<uintptr_t>(
Value.getOpaqueValue());
956 return reinterpret_cast<ExtQualsTypeCommonBase*
>(CommonPtrVal);
988 T.Value.setFromOpaqueValue(
const_cast<void*
>(Ptr));
1005 return Value.getPointer().isNull();
1032 std::optional<NonConstantStorageReason>
1075 return isa<const ExtQuals *>(
Value.getPointer());
1185 &&
"non-fast qualifier bits set in mask!");
1203 T.addFastQualifiers(TQs);
1216 T.removeLocalFastQualifiers();
1310 return getSingleStepDesugaredTypeImpl(*
this, Context);
1316 if (isa<ParenType>(*
this))
1323 return LHS.Value == RHS.Value;
1326 return LHS.Value != RHS.Value;
1329 return LHS.Value < RHS.Value;
1343 const Twine &PlaceHolder = Twine(),
1344 unsigned Indentation = 0)
const;
1348 unsigned Indentation = 0) {
1354 const Twine &PlaceHolder,
1355 unsigned Indentation = 0);
1372 const Twine &PlaceHolder;
1373 unsigned Indentation;
1377 const Twine &PlaceHolder,
unsigned Indentation)
1378 :
T(
T), Policy(Policy), PlaceHolder(PlaceHolder),
1379 Indentation(Indentation) {}
1383 SQT.T.
print(OS, SQT.Policy, SQT.PlaceHolder, SQT.Indentation);
1389 const Twine &PlaceHolder = Twine(),
1390 unsigned Indentation = 0)
const {
1394 void dump(
const char *
s)
const;
1396 void dump(llvm::raw_ostream &OS,
const ASTContext &Context)
const;
1459 return PtrAuth.isAddressDiscriminated();
1546 return isDestructedTypeImpl(*
this);
1648raw_ostream &
operator<<(raw_ostream &OS, QualType QT);
1668 return P.getAsOpaquePtr();
1676 static constexpr int NumLowBitsAvailable = 0;
1697 const Type *
const BaseType;
1703 : BaseType(baseType), CanonicalType(canon) {}
1717 public llvm::FoldingSetNode {
1740 canon.isNull() ?
QualType(this_(), 0) : canon),
1742 assert(Quals.hasNonFastQualifiers()
1743 &&
"ExtQuals created with no fast qualifiers");
1744 assert(!Quals.hasFastQualifiers()
1745 &&
"ExtQuals created with fast qualifiers");
1755 return Quals.getObjCLifetime();
1765 Profile(
ID, getBaseType(), Quals);
1769 const Type *BaseType,
1772 ID.AddPointer(BaseType);
1803enum class ArraySizeModifier;
1804enum class ElaboratedTypeKeyword;
1805enum class VectorKind;
1836#define TYPE(Class, Base) Class,
1837#define LAST_TYPE(Class) TypeLast = Class
1838#define ABSTRACT_TYPE(Class, Base)
1839#include "clang/AST/TypeNodes.inc"
1844 class TypeBitfields {
1846 template <
class T>
friend class TypePropertyCache;
1849 LLVM_PREFERRED_TYPE(TypeClass)
1854 unsigned Dependence : llvm::BitWidth<TypeDependence>;
1858 LLVM_PREFERRED_TYPE(
bool)
1859 mutable unsigned CacheValid : 1;
1863 mutable unsigned CachedLinkage : 3;
1866 LLVM_PREFERRED_TYPE(
bool)
1867 mutable unsigned CachedLocalOrUnnamed : 1;
1870 LLVM_PREFERRED_TYPE(
bool)
1871 mutable unsigned FromAST : 1;
1873 bool isCacheValid()
const {
1878 assert(isCacheValid() &&
"getting linkage from invalid cache");
1879 return static_cast<Linkage>(CachedLinkage);
1882 bool hasLocalOrUnnamedType()
const {
1883 assert(isCacheValid() &&
"getting linkage from invalid cache");
1884 return CachedLocalOrUnnamed;
1887 enum { NumTypeBits = 8 + llvm::BitWidth<TypeDependence> + 6 };
1896 LLVM_PREFERRED_TYPE(TypeBitfields)
1902 unsigned IndexTypeQuals : 3;
1907 unsigned SizeModifier : 3;
1909 enum { NumArrayTypeBits = NumTypeBits + 6 };
1918 LLVM_PREFERRED_TYPE(
bool)
1919 unsigned HasExternalSize : 1;
1921 LLVM_PREFERRED_TYPE(
unsigned)
1922 unsigned SizeWidth : 5;
1928 LLVM_PREFERRED_TYPE(TypeBitfields)
1932 static constexpr unsigned NumOfBuiltinTypeBits = 9;
1933 unsigned Kind : NumOfBuiltinTypeBits;
1937 static constexpr int FunctionTypeNumParamsWidth = 16;
1938 static constexpr int FunctionTypeNumParamsLimit = (1 << 16) - 1;
1948 LLVM_PREFERRED_TYPE(TypeBitfields)
1955 unsigned RefQualifier : 2;
1964 unsigned FastTypeQuals : Qualifiers::FastWidth;
1966 LLVM_PREFERRED_TYPE(
bool)
1967 unsigned HasExtQuals : 1;
1971 unsigned ExceptionSpecType : 4;
1974 LLVM_PREFERRED_TYPE(
bool)
1975 unsigned HasExtParameterInfos : 1;
1978 LLVM_PREFERRED_TYPE(
bool)
1979 unsigned HasExtraBitfields : 1;
1982 LLVM_PREFERRED_TYPE(
bool)
1983 unsigned Variadic : 1;
1986 LLVM_PREFERRED_TYPE(
bool)
1987 unsigned HasTrailingReturn : 1;
1990 LLVM_PREFERRED_TYPE(
bool)
1991 unsigned CFIUncheckedCallee : 1;
1996 unsigned ExtInfo : 14;
2002 unsigned NumParams : FunctionTypeNumParamsWidth;
2008 LLVM_PREFERRED_TYPE(TypeBitfields)
2012 unsigned NumTypeArgs : 7;
2015 unsigned NumProtocols : 6;
2018 LLVM_PREFERRED_TYPE(
bool)
2019 unsigned IsKindOf : 1;
2025 LLVM_PREFERRED_TYPE(TypeBitfields)
2039 LLVM_PREFERRED_TYPE(
bool)
2040 unsigned SpelledAsLValue : 1;
2044 LLVM_PREFERRED_TYPE(
bool)
2045 unsigned InnerRef : 1;
2051 LLVM_PREFERRED_TYPE(TypeBitfields)
2059 enum { NumTypeWithKeywordBits = NumTypeBits + 8 };
2068 LLVM_PREFERRED_TYPE(
bool)
2069 unsigned HasQualifier : 1;
2072 LLVM_PREFERRED_TYPE(
bool)
2073 unsigned OwnsTag : 1;
2076 LLVM_PREFERRED_TYPE(
bool)
2077 unsigned IsInjected : 1;
2084 LLVM_PREFERRED_TYPE(TypeBitfields)
2090 unsigned VecKind : 4;
2092 uint32_t NumElements;
2098 LLVM_PREFERRED_TYPE(TypeBitfields)
2102 unsigned AttrKind : 32 - NumTypeBits;
2108 LLVM_PREFERRED_TYPE(TypeBitfields)
2130 LLVM_PREFERRED_TYPE(TypeBitfields)
2143 LLVM_PREFERRED_TYPE(
bool)
2144 unsigned hasQualifier : 1;
2154 LLVM_PREFERRED_TYPE(
bool)
2155 unsigned hasQualifier : 1;
2165 LLVM_PREFERRED_TYPE(
bool)
2166 unsigned hasQualifier : 1;
2169 LLVM_PREFERRED_TYPE(
bool)
2170 unsigned hasTypeDifferentFromDecl : 1;
2176 LLVM_PREFERRED_TYPE(TypeBitfields)
2180 unsigned Depth : 15;
2183 LLVM_PREFERRED_TYPE(
bool)
2184 unsigned ParameterPack : 1;
2187 unsigned Index : 16;
2193 LLVM_PREFERRED_TYPE(TypeBitfields)
2196 LLVM_PREFERRED_TYPE(
bool)
2197 unsigned HasNonCanonicalUnderlyingType : 1;
2200 unsigned Index : 15;
2202 LLVM_PREFERRED_TYPE(
bool)
2210 unsigned PackIndex : 15;
2217 LLVM_PREFERRED_TYPE(TypeBitfields)
2224 unsigned NumArgs : 16;
2230 unsigned SubstTemplTypeParmPackIndex : 16;
2240 LLVM_PREFERRED_TYPE(
bool)
2241 unsigned TypeAlias : 1;
2272 LLVM_PREFERRED_TYPE(TypeBitfields)
2286 unsigned NumExpansions;
2306 LLVM_PREFERRED_TYPE(TypeBitfields)
2316 LLVM_PREFERRED_TYPE(TypeBitfields)
2319 static constexpr unsigned NumCoupledDeclsBits = 4;
2320 unsigned NumCoupledDecls : NumCoupledDeclsBits;
2321 LLVM_PREFERRED_TYPE(
bool)
2322 unsigned CountInBytes : 1;
2323 LLVM_PREFERRED_TYPE(
bool)
2324 unsigned OrNull : 1;
2360 void setFromAST(
bool V =
true)
const {
2361 TypeBits.FromAST =
V;
2369 canon.isNull() ?
QualType(this_(), 0) : canon) {
2370 static_assert(
sizeof(*this) <=
2372 "changing bitfields changed sizeof(Type)!");
2373 static_assert(
alignof(
decltype(*this)) %
TypeAlignment == 0,
2374 "Insufficient alignment!");
2376 TypeBits.Dependence =
static_cast<unsigned>(
Dependence);
2377 TypeBits.CacheValid =
false;
2378 TypeBits.CachedLocalOrUnnamed =
false;
2379 TypeBits.CachedLinkage = llvm::to_underlying(Linkage::Invalid);
2380 TypeBits.FromAST =
false;
2387 TypeBits.Dependence =
static_cast<unsigned>(
D);
2424 return getDependence() & TypeDependence::UnexpandedPack;
2430 return CanonicalType ==
QualType(
this, 0);
2436 QualType getLocallyUnqualifiedSingleStepDesugaredType()
const;
2444 bool isSizelessType()
const;
2445 bool isSizelessBuiltinType()
const;
2448 bool isSizelessVectorType()
const;
2451 bool isSVESizelessBuiltinType()
const;
2454 bool isRVVSizelessBuiltinType()
const;
2457 bool isWebAssemblyExternrefType()
const;
2462 bool isWebAssemblyTableType()
const;
2467 bool isSveVLSBuiltinType()
const;
2477 bool isRVVVLSBuiltinType()
const;
2499 bool isIncompleteType(
NamedDecl **Def =
nullptr)
const;
2504 return !isFunctionType();
2525 bool isAlwaysIncompleteType()
const;
2532 return !isReferenceType() && !isFunctionType() && !isVoidType();
2537 bool isLiteralType(
const ASTContext &Ctx)
const;
2540 bool isStructuralType()
const;
2544 bool isStandardLayoutType()
const;
2550 bool isBuiltinType()
const;
2553 bool isSpecificBuiltinType(
unsigned K)
const;
2558 bool isPlaceholderType()
const;
2562 bool isSpecificPlaceholderType(
unsigned K)
const;
2566 bool isNonOverloadPlaceholderType()
const;
2570 bool isIntegerType()
const;
2571 bool isEnumeralType()
const;
2574 bool isScopedEnumeralType()
const;
2576 bool isCharType()
const;
2577 bool isWideCharType()
const;
2578 bool isChar8Type()
const;
2579 bool isChar16Type()
const;
2580 bool isChar32Type()
const;
2581 bool isAnyCharacterType()
const;
2582 bool isUnicodeCharacterType()
const;
2583 bool isIntegralType(
const ASTContext &Ctx)
const;
2586 bool isIntegralOrEnumerationType()
const;
2589 bool isIntegralOrUnscopedEnumerationType()
const;
2590 bool isUnscopedEnumerationType()
const;
2593 bool isRealFloatingType()
const;
2596 bool isComplexType()
const;
2597 bool isAnyComplexType()
const;
2598 bool isFloatingType()
const;
2599 bool isHalfType()
const;
2600 bool isFloat16Type()
const;
2601 bool isFloat32Type()
const;
2602 bool isDoubleType()
const;
2603 bool isBFloat16Type()
const;
2604 bool isMFloat8Type()
const;
2605 bool isFloat128Type()
const;
2606 bool isIbm128Type()
const;
2607 bool isRealType()
const;
2608 bool isArithmeticType()
const;
2609 bool isVoidType()
const;
2610 bool isScalarType()
const;
2611 bool isAggregateType()
const;
2612 bool isFundamentalType()
const;
2613 bool isCompoundType()
const;
2617 bool isFunctionType()
const;
2620 bool isPointerType()
const;
2621 bool isPointerOrReferenceType()
const;
2622 bool isSignableType(
const ASTContext &Ctx)
const;
2623 bool isSignablePointerType()
const;
2624 bool isSignableIntegerType(
const ASTContext &Ctx)
const;
2625 bool isAnyPointerType()
const;
2626 bool isCountAttributedType()
const;
2627 bool isCFIUncheckedCalleeFunctionType()
const;
2628 bool hasPointeeToToCFIUncheckedCalleeFunctionType()
const;
2629 bool isBlockPointerType()
const;
2630 bool isVoidPointerType()
const;
2631 bool isReferenceType()
const;
2632 bool isLValueReferenceType()
const;
2633 bool isRValueReferenceType()
const;
2634 bool isObjectPointerType()
const;
2635 bool isFunctionPointerType()
const;
2636 bool isFunctionReferenceType()
const;
2637 bool isMemberPointerType()
const;
2638 bool isMemberFunctionPointerType()
const;
2639 bool isMemberDataPointerType()
const;
2640 bool isArrayType()
const;
2641 bool isConstantArrayType()
const;
2642 bool isIncompleteArrayType()
const;
2643 bool isVariableArrayType()
const;
2644 bool isArrayParameterType()
const;
2645 bool isDependentSizedArrayType()
const;
2647 bool isClassType()
const;
2648 bool isStructureType()
const;
2649 bool isStructureTypeWithFlexibleArrayMember()
const;
2650 bool isObjCBoxableRecordType()
const;
2651 bool isInterfaceType()
const;
2652 bool isStructureOrClassType()
const;
2653 bool isUnionType()
const;
2654 bool isComplexIntegerType()
const;
2655 bool isVectorType()
const;
2656 bool isExtVectorType()
const;
2657 bool isExtVectorBoolType()
const;
2660 bool isPackedVectorBoolType(
const ASTContext &ctx)
const;
2661 bool isSubscriptableVectorType()
const;
2662 bool isMatrixType()
const;
2663 bool isConstantMatrixType()
const;
2664 bool isDependentAddressSpaceType()
const;
2665 bool isObjCObjectPointerType()
const;
2666 bool isObjCRetainableType()
const;
2667 bool isObjCLifetimeType()
const;
2668 bool isObjCIndirectLifetimeType()
const;
2669 bool isObjCNSObjectType()
const;
2670 bool isObjCIndependentClassType()
const;
2673 bool isObjCObjectType()
const;
2674 bool isObjCQualifiedInterfaceType()
const;
2675 bool isObjCQualifiedIdType()
const;
2676 bool isObjCQualifiedClassType()
const;
2677 bool isObjCObjectOrInterfaceType()
const;
2678 bool isObjCIdType()
const;
2679 bool isDecltypeType()
const;
2687 return hasAttr(attr::ObjCInertUnsafeUnretained);
2697 bool isObjCIdOrObjectKindOfType(
const ASTContext &ctx,
2700 bool isObjCClassType()
const;
2708 bool isObjCClassOrClassKindOfType()
const;
2710 bool isBlockCompatibleObjCPointerType(
ASTContext &ctx)
const;
2711 bool isObjCSelType()
const;
2712 bool isObjCBuiltinType()
const;
2713 bool isObjCARCBridgableType()
const;
2714 bool isCARCBridgableType()
const;
2715 bool isTemplateTypeParmType()
const;
2716 bool isNullPtrType()
const;
2718 bool isNothrowT()
const;
2719 bool isAlignValT()
const;
2720 bool isStdByteType()
const;
2721 bool isAtomicType()
const;
2722 bool isUndeducedAutoType()
const;
2724 bool isTypedefNameType()
const;
2726#define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \
2727 bool is##Id##Type() const;
2728#include "clang/Basic/OpenCLImageTypes.def"
2730 bool isImageType()
const;
2732 bool isSamplerT()
const;
2733 bool isEventT()
const;
2734 bool isClkEventT()
const;
2735 bool isQueueT()
const;
2736 bool isReserveIDT()
const;
2738#define EXT_OPAQUE_TYPE(ExtType, Id, Ext) \
2739 bool is##Id##Type() const;
2740#include "clang/Basic/OpenCLExtensionTypes.def"
2742 bool isOCLIntelSubgroupAVCType()
const;
2743 bool isOCLExtOpaqueType()
const;
2745 bool isPipeType()
const;
2746 bool isBitIntType()
const;
2747 bool isOpenCLSpecificType()
const;
2749#define HLSL_INTANGIBLE_TYPE(Name, Id, SingletonId) bool is##Id##Type() const;
2750#include "clang/Basic/HLSLIntangibleTypes.def"
2751 bool isHLSLSpecificType()
const;
2752 bool isHLSLBuiltinIntangibleType()
const;
2753 bool isHLSLAttributedResourceType()
const;
2754 bool isHLSLInlineSpirvType()
const;
2755 bool isHLSLResourceRecord()
const;
2756 bool isHLSLResourceRecordArray()
const;
2757 bool isHLSLIntangibleType()
2763 bool isObjCARCImplicitlyUnretainedType()
const;
2766 bool isCUDADeviceBuiltinSurfaceType()
const;
2768 bool isCUDADeviceBuiltinTextureType()
const;
2787 ScalarTypeKind getScalarTypeKind()
const;
2795 return getDependence() & TypeDependence::Error;
2801 return getDependence() & TypeDependence::Dependent;
2809 return getDependence() & TypeDependence::Instantiation;
2815 bool isUndeducedType()
const;
2819 return getDependence() & TypeDependence::VariablyModified;
2824 bool hasSizedVLAType()
const;
2827 bool hasUnnamedOrLocalType()
const;
2829 bool isOverloadableType()
const;
2832 bool isElaboratedTypeSpecifier()
const;
2834 bool canDecayToPointerType()
const;
2839 bool hasPointerRepresentation()
const;
2843 bool hasObjCPointerRepresentation()
const;
2847 bool hasIntegerRepresentation()
const;
2851 bool hasSignedIntegerRepresentation()
const;
2855 bool hasUnsignedIntegerRepresentation()
const;
2859 bool hasFloatingRepresentation()
const;
2864 bool hasBooleanRepresentation()
const;
2869 const RecordType *getAsStructureType()
const;
2872 const ComplexType *getAsComplexIntegerType()
const;
2893 inline EnumDecl *getAsEnumDecl()
const;
2894 inline EnumDecl *castAsEnumDecl()
const;
2899 inline TagDecl *getAsTagDecl()
const;
2900 inline TagDecl *castAsTagDecl()
const;
2918 return dyn_cast_or_null<AutoType>(getContainedDeducedType());
2924 bool hasAutoForTrailingReturnType()
const;
2935 template <
typename T>
const T *getAs()
const;
2940 return dyn_cast<T>(CanonicalType);
2947 return cast<T>(CanonicalType);
2951#define TYPE(Class, Base)
2952#define NEVER_CANONICAL_TYPE(Class) \
2953 template <> inline const Class##Type *Type::getAsCanonical() const = delete; \
2954 template <> inline const Class##Type *Type::castAsCanonical() const = delete;
2955#include "clang/AST/TypeNodes.inc"
2961 const TemplateSpecializationType *
2962 getAsNonAliasTemplateSpecializationType()
const;
2964 const TemplateSpecializationType *
2966 const auto *TST = getAsNonAliasTemplateSpecializationType();
2967 assert(TST &&
"not a TemplateSpecializationType");
2976 template <
typename T>
const T *getAsAdjusted()
const;
2980 const ArrayType *getAsArrayTypeUnsafe()
const;
2988 template <
typename T>
const T *castAs()
const;
2992 const ArrayType *castAsArrayTypeUnsafe()
const;
3006 const Type *getBaseElementTypeUnsafe()
const;
3011 const Type *getArrayElementTypeNoTypeQual()
const;
3016 const Type *getPointeeOrArrayElementType()
const;
3024 const Type *getUnqualifiedDesugaredType()
const;
3029 bool isSignedIntegerType()
const;
3034 bool isUnsignedIntegerType()
const;
3038 bool isSignedIntegerOrEnumerationType()
const;
3042 bool isUnsignedIntegerOrEnumerationType()
const;
3046 bool isFixedPointType()
const;
3049 bool isFixedPointOrIntegerType()
const;
3052 bool isConvertibleToFixedPointType()
const;
3056 bool isSaturatedFixedPointType()
const;
3060 bool isUnsaturatedFixedPointType()
const;
3064 bool isSignedFixedPointType()
const;
3068 bool isUnsignedFixedPointType()
const;
3073 bool isConstantSizeType()
const;
3077 bool isSpecifierType()
const;
3084 return getLinkageAndVisibility().getVisibility();
3089 return getLinkageAndVisibility().isVisibilityExplicit();
3097 bool isLinkageValid()
const;
3104 std::optional<NullabilityKind> getNullability()
const;
3111 bool canHaveNullability(
bool ResultIfUnknown =
true)
const;
3128 std::optional<ArrayRef<QualType>>
3129 getObjCSubstitutions(
const DeclContext *dc)
const;
3133 bool acceptsObjCTypeParams()
const;
3135 const char *getTypeClassName()
const;
3138 return CanonicalType;
3143 void dump(llvm::raw_ostream &OS,
const ASTContext &Context)
const;
3148template <>
const TypedefType *Type::getAs()
const;
3149template <>
const UsingType *Type::getAs()
const;
3154template <>
const TemplateSpecializationType *Type::getAs()
const;
3158template <>
const AttributedType *Type::getAs()
const;
3162template <>
const BoundsAttributedType *Type::getAs()
const;
3166template <>
const CountAttributedType *Type::getAs()
const;
3170#define TYPE(Class, Base)
3171#define ALWAYS_CANONICAL_TYPE(Class) \
3172 template <> inline const Class##Type *Type::getAs() const { \
3173 return dyn_cast<Class##Type>(CanonicalType); \
3175 template <> inline const Class##Type *Type::castAs() const { \
3176 return cast<Class##Type>(CanonicalType); \
3178#include "clang/AST/TypeNodes.inc"
3186#define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) Id,
3187#include "clang/Basic/OpenCLImageTypes.def"
3189#define EXT_OPAQUE_TYPE(ExtType, Id, Ext) Id,
3190#include "clang/Basic/OpenCLExtensionTypes.def"
3192#define SVE_TYPE(Name, Id, SingletonId) Id,
3193#include "clang/Basic/AArch64ACLETypes.def"
3195#define PPC_VECTOR_TYPE(Name, Id, Size) Id,
3196#include "clang/Basic/PPCTypes.def"
3198#define RVV_TYPE(Name, Id, SingletonId) Id,
3199#include "clang/Basic/RISCVVTypes.def"
3201#define WASM_TYPE(Name, Id, SingletonId) Id,
3202#include "clang/Basic/WebAssemblyReferenceTypes.def"
3204#define AMDGPU_TYPE(Name, Id, SingletonId, Width, Align) Id,
3205#include "clang/Basic/AMDGPUTypes.def"
3207#define HLSL_INTANGIBLE_TYPE(Name, Id, SingletonId) Id,
3208#include "clang/Basic/HLSLIntangibleTypes.def"
3210#define BUILTIN_TYPE(Id, SingletonId) Id,
3211#define LAST_BUILTIN_TYPE(Id) LastKind = Id
3212#include "clang/AST/BuiltinTypes.def"
3222 static_assert(Kind::LastKind <
3223 (1 << BuiltinTypeBitfields::NumOfBuiltinTypeBits) &&
3224 "Defined builtin type exceeds the allocated space for serial "
3226 BuiltinTypeBits.Kind = K;
3235 StringRef str = getName(Policy);
3236 assert(!str.empty() && str.data()[str.size()] ==
'\0');
3272 return isPlaceholderTypeKind(
getKind());
3299 :
Type(
Complex, CanonicalPtr, Element->getDependence()),
3300 ElementType(Element) {}
3309 Profile(
ID, getElementType());
3313 ID.AddPointer(Element.getAsOpaquePtr());
3326 :
Type(
Paren, CanonType, InnerType->getDependence()), Inner(InnerType) {}
3335 Profile(
ID, getInnerType());
3352 :
Type(
Pointer, CanonicalPtr, Pointee->getDependence()),
3353 PointeeType(Pointee) {}
3376 using BaseTy = llvm::PointerIntPair<ValueDecl *, 1, unsigned>;
3391 bool isDeref()
const;
3393 unsigned getInt()
const;
3394 void *getOpaqueValue()
const;
3396 void setFromOpaqueValue(
void *
V);
3427 return decl_range(dependent_decl_begin(), dependent_decl_end());
3431 return {dependent_decl_begin(), dependent_decl_end()};
3434 bool referencesFieldDecls()
const;
3441 case CountAttributed:
3453 public llvm::TrailingObjects<CountAttributedType,
3454 TypeCoupledDeclRefInfo> {
3465 bool CountInBytes,
bool OrNull,
3468 unsigned numTrailingObjects(OverloadToken<TypeCoupledDeclRefInfo>)
const {
3469 return CountAttributedTypeBits.NumCoupledDecls;
3482 bool isOrNull()
const {
return CountAttributedTypeBits.OrNull; }
3486 return isCountInBytes() ? SizedByOrNull : CountedByOrNull;
3487 return isCountInBytes() ? SizedBy : CountedBy;
3491 Profile(
ID, desugar(), CountExpr, isCountInBytes(), isOrNull());
3494 static void Profile(llvm::FoldingSetNodeID &
ID,
QualType WrappedTy,
3495 Expr *CountExpr,
bool CountInBytes,
bool Nullable);
3501 StringRef getAttributeName(
bool WithMacroPrefix)
const;
3516 :
Type(TC, CanonicalPtr, OriginalTy->getDependence()),
3517 OriginalTy(OriginalTy), AdjustedTy(AdjustedTy) {}
3527 Profile(
ID, OriginalTy, AdjustedTy);
3532 ID.AddPointer(
New.getAsOpaquePtr());
3565 :
Type(BlockPointer, CanonicalCls, Pointee->getDependence()),
3566 PointeeType(Pointee) {}
3594 bool SpelledAsLValue)
3595 :
Type(tc, CanonicalRef, Referencee->getDependence()),
3596 PointeeType(Referencee) {
3597 ReferenceTypeBits.SpelledAsLValue = SpelledAsLValue;
3610 while (
T->isInnerRef())
3612 return T->PointeeType;
3616 Profile(
ID, PointeeType, isSpelledAsLValue());
3621 bool SpelledAsLValue) {
3623 ID.AddBoolean(SpelledAsLValue);
3637 bool SpelledAsLValue)
3680 :
Type(MemberPointer, CanonicalPtr,
3683 Pointee->getDependence()),
3684 PointeeType(Pointee), Qualifier(Qualifier) {}
3707 bool isSugared()
const;
3709 return isSugared() ? getCanonicalTypeInternal() :
QualType(
this, 0);
3719 static void Profile(llvm::FoldingSetNodeID &
ID,
QualType Pointee,
3747 unsigned tq,
const Expr *sz =
nullptr);
3757 return Qualifiers::fromCVRMask(getIndexTypeCVRQualifiers());
3761 return ArrayTypeBits.IndexTypeQuals;
3779 struct ExternalSize {
3780 ExternalSize(
const llvm::APInt &Sz,
const Expr *SE)
3781 : Size(Sz), SizeExpr(SE) {}
3783 const Expr *SizeExpr;
3793 :
ArrayType(ConstantArray, Et, Can,
SM, TQ, nullptr), Size(Sz) {
3794 ConstantArrayTypeBits.HasExternalSize =
false;
3795 ConstantArrayTypeBits.SizeWidth = Width / 8;
3798 assert(Width < 0xFF &&
"Type width in bits must be less than 8 bits");
3801 ConstantArrayType(QualType Et, QualType Can, ExternalSize *SzPtr,
3802 ArraySizeModifier
SM,
unsigned TQ)
3803 : ArrayType(ConstantArray, Et, Can,
SM, TQ, SzPtr->SizeExpr),
3805 ConstantArrayTypeBits.HasExternalSize =
true;
3806 ConstantArrayTypeBits.SizeWidth = 0;
3808 assert((SzPtr->SizeExpr ==
nullptr || !Can.isNull()) &&
3809 "canonical constant array should not have size expression");
3812 static ConstantArrayType *
Create(
const ASTContext &Ctx, QualType ET,
3813 QualType Can,
const llvm::APInt &Sz,
3814 const Expr *SzExpr, ArraySizeModifier SzMod,
3819 :
ArrayType(Tc, ATy->getElementType(), Can, ATy->getSizeModifier(),
3820 ATy->getIndexTypeQualifiers().getAsOpaqueValue(), nullptr) {
3821 ConstantArrayTypeBits.HasExternalSize =
3823 if (!ConstantArrayTypeBits.HasExternalSize) {
3833 return ConstantArrayTypeBits.HasExternalSize
3835 : llvm::APInt(ConstantArrayTypeBits.SizeWidth * 8, Size);
3840 return ConstantArrayTypeBits.HasExternalSize
3841 ? SizePtr->Size.getBitWidth()
3842 :
static_cast<unsigned>(ConstantArrayTypeBits.SizeWidth * 8);
3847 return ConstantArrayTypeBits.HasExternalSize ? SizePtr->Size.isZero()
3853 return ConstantArrayTypeBits.HasExternalSize ? SizePtr->Size.getZExtValue()
3859 return ConstantArrayTypeBits.HasExternalSize ? SizePtr->Size.getSExtValue()
3860 :
static_cast<int64_t
>(Size);
3866 return ConstantArrayTypeBits.HasExternalSize
3867 ? SizePtr->Size.getLimitedValue()
3873 return ConstantArrayTypeBits.HasExternalSize ? SizePtr->SizeExpr :
nullptr;
3881 static unsigned getNumAddressingBits(
const ASTContext &Context,
3883 const llvm::APInt &NumElements);
3885 unsigned getNumAddressingBits(
const ASTContext &Context)
const;
3889 static unsigned getMaxSizeBits(
const ASTContext &Context);
3892 Profile(
ID, Ctx, getElementType(), getZExtSize(), getSizeExpr(),
3893 getSizeModifier(), getIndexTypeCVRQualifiers());
3896 static void Profile(llvm::FoldingSetNodeID &
ID,
const ASTContext &Ctx,
3930 :
ArrayType(IncompleteArray, et, can, sm, tq) {}
3943 Profile(
ID, getElementType(), getSizeModifier(),
3944 getIndexTypeCVRQualifiers());
3950 ID.AddInteger(llvm::to_underlying(SizeMod));
3951 ID.AddInteger(TypeQuals);
3991 :
ArrayType(VariableArray, et, can, sm, tq, e), SizeExpr((
Stmt *)e) {}
3999 return (
Expr*) SizeExpr;
4010 llvm_unreachable(
"Cannot unique VariableArrayTypes.");
4046 return (
Expr*) SizeExpr;
4057 Profile(
ID, Context, getElementType(),
4058 getSizeModifier(), getIndexTypeCVRQualifiers(), getSizeExpr());
4061 static void Profile(llvm::FoldingSetNodeID &
ID,
const ASTContext &Context,
4063 unsigned TypeQuals,
Expr *
E);
4080 Expr *AddrSpaceExpr;
4103 static void Profile(llvm::FoldingSetNodeID &
ID,
const ASTContext &Context,
4143 Profile(
ID, Context, getElementType(), getSizeExpr());
4146 static void Profile(llvm::FoldingSetNodeID &
ID,
const ASTContext &Context,
4216 Profile(
ID, getElementType(), getNumElements(),
4217 getTypeClass(), getVectorKind());
4224 ID.AddInteger(NumElements);
4226 ID.AddInteger(llvm::to_underlying(VecKind));
4269 Profile(
ID, Context, getElementType(), getSizeExpr(), getVectorKind());
4272 static void Profile(llvm::FoldingSetNodeID &
ID,
const ASTContext &Context,
4287 :
VectorType(ExtVector, vecType, nElements, canonType,
4294 case 'x':
case 'r':
return 0;
4295 case 'y':
case 'g':
return 1;
4296 case 'z':
case 'b':
return 2;
4297 case 'w':
case 'a':
return 3;
4315 case 'a':
return 10;
4317 case 'b':
return 11;
4319 case 'c':
return 12;
4321 case 'd':
return 13;
4323 case 'e':
return 14;
4325 case 'f':
return 15;
4330 if (isNumericAccessor)
4331 return getNumericAccessorIdx(
c);
4333 return getPointAccessorIdx(
c);
4337 if (
int idx = getAccessorIdx(
c, isNumericAccessor)+1)
4338 return unsigned(idx-1) < getNumElements();
4363 const Expr *RowExpr =
nullptr,
const Expr *ColumnExpr =
nullptr);
4397 static constexpr unsigned MaxElementsPerDimension = (1 << 20) - 1;
4400 unsigned NColumns,
QualType CanonElementType);
4403 unsigned NColumns,
QualType CanonElementType);
4414 return getNumRows() * getNumColumns();
4419 return NumElements > 0 && NumElements <= MaxElementsPerDimension;
4424 return MaxElementsPerDimension;
4428 Profile(
ID, getElementType(), getNumRows(), getNumColumns(),
4433 unsigned NumRows,
unsigned NumColumns,
4436 ID.AddInteger(NumRows);
4437 ID.AddInteger(NumColumns);
4469 Profile(
ID, Context, getElementType(), getRowExpr(), getColumnExpr());
4472 static void Profile(llvm::FoldingSetNodeID &
ID,
const ASTContext &Context,
4508 HasPassObjSize = 0x20,
4511 unsigned char Data = 0;
4520 copy.Data = (copy.Data & ~ABIMask) |
unsigned(kind);
4530 copy.Data |= IsConsumed;
4532 copy.Data &= ~IsConsumed;
4539 Copy.Data |= HasPassObjSize;
4547 Copy.Data |= IsNoEscape;
4549 Copy.Data &= ~IsNoEscape;
4561 return lhs.Data == rhs.Data;
4565 return lhs.Data != rhs.Data;
4600 enum { CallConvMask = 0x3F };
4601 enum { NoReturnMask = 0x40 };
4602 enum { ProducesResultMask = 0x80 };
4603 enum { NoCallerSavedRegsMask = 0x100 };
4604 enum { RegParmMask = 0xe00, RegParmOffset = 9 };
4605 enum { NoCfCheckMask = 0x1000 };
4606 enum { CmseNSCallMask = 0x2000 };
4607 uint16_t Bits =
CC_C;
4609 ExtInfo(
unsigned Bits) : Bits(static_cast<uint16_t>(Bits)) {}
4615 bool producesResult,
bool noCallerSavedRegs,
bool NoCfCheck,
4617 assert((!hasRegParm || regParm < 7) &&
"Invalid regparm value");
4618 Bits = ((
unsigned)cc) | (noReturn ? NoReturnMask : 0) |
4619 (producesResult ? ProducesResultMask : 0) |
4620 (noCallerSavedRegs ? NoCallerSavedRegsMask : 0) |
4621 (hasRegParm ? ((regParm + 1) << RegParmOffset) : 0) |
4622 (NoCfCheck ? NoCfCheckMask : 0) |
4623 (cmseNSCall ? CmseNSCallMask : 0);
4639 bool getHasRegParm()
const {
return ((Bits & RegParmMask) >> RegParmOffset) != 0; }
4642 unsigned RegParm = (Bits & RegParmMask) >> RegParmOffset;
4651 return Bits ==
Other.Bits;
4654 return Bits !=
Other.Bits;
4662 return ExtInfo(Bits | NoReturnMask);
4664 return ExtInfo(Bits & ~NoReturnMask);
4669 return ExtInfo(Bits | ProducesResultMask);
4671 return ExtInfo(Bits & ~ProducesResultMask);
4676 return ExtInfo(Bits | CmseNSCallMask);
4678 return ExtInfo(Bits & ~CmseNSCallMask);
4682 if (noCallerSavedRegs)
4683 return ExtInfo(Bits | NoCallerSavedRegsMask);
4685 return ExtInfo(Bits & ~NoCallerSavedRegsMask);
4690 return ExtInfo(Bits | NoCfCheckMask);
4692 return ExtInfo(Bits & ~NoCfCheckMask);
4696 assert(RegParm < 7 &&
"Invalid regparm value");
4697 return ExtInfo((Bits & ~RegParmMask) |
4698 ((RegParm + 1) << RegParmOffset));
4702 return ExtInfo((Bits & ~CallConvMask) | (
unsigned) cc);
4706 ID.AddInteger(Bits);
4724 LLVM_PREFERRED_TYPE(
bool)
4727 LLVM_PREFERRED_TYPE(
bool)
4728 unsigned HasArmTypeAttributes : 1;
4730 LLVM_PREFERRED_TYPE(
bool)
4731 unsigned EffectsHaveConditions : 1;
4732 unsigned NumFunctionEffects : 4;
4735 : NumExceptionType(0), HasExtraAttributeInfo(
false),
4736 HasArmTypeAttributes(
false), EffectsHaveConditions(
false),
4737 NumFunctionEffects(0) {}
4746 operator bool()
const {
return !CFISalt.empty(); }
4748 void Profile(llvm::FoldingSetNodeID &
ID)
const {
ID.AddString(CFISalt); }
4755 SME_NormalFunction = 0,
4756 SME_PStateSMEnabledMask = 1 << 0,
4757 SME_PStateSMCompatibleMask = 1 << 1,
4761 SME_ZAMask = 0b111 << SME_ZAShift,
4763 SME_ZT0Mask = 0b111 << SME_ZT0Shift,
4766 SME_AgnosticZAStateShift = 8,
4767 SME_AgnosticZAStateMask = 1 << SME_AgnosticZAStateShift,
4784 return static_cast<ArmStateValue>((AttrBits & SME_ZAMask) >> SME_ZAShift);
4788 return static_cast<ArmStateValue>((AttrBits & SME_ZT0Mask) >> SME_ZT0Shift);
4807 FunctionTypeBits.ExtInfo = Info.Bits;
4811 if (isFunctionProtoType())
4812 return Qualifiers::fromFastMask(FunctionTypeBits.FastTypeQuals);
4830 bool getCFIUncheckedCalleeAttr()
const;
4836 static_assert((
~Qualifiers::FastMask & Qualifiers::CVRMask) == 0,
4837 "Const, volatile and restrict are assumed to be a subset of "
4838 "the fast qualifiers.");
4840 bool isConst()
const {
return getFastTypeQuals().hasConst(); }
4841 bool isVolatile()
const {
return getFastTypeQuals().hasVolatile(); }
4842 bool isRestrict()
const {
return getFastTypeQuals().hasRestrict(); }
4850 static StringRef getNameForCallConv(
CallingConv CC);
4865 Result->getDependence() &
4877 Profile(
ID, getReturnType(), getExtInfo());
4905 constexpr static size_t KindCount =
static_cast<size_t>(Kind::Last) + 1;
4913 FE_InferrableOnCallees = 0x1,
4916 FE_ExcludeThrow = 0x2,
4917 FE_ExcludeCatch = 0x4,
4918 FE_ExcludeObjCMessageSend = 0x8,
4919 FE_ExcludeStaticLocalVars = 0x10,
4920 FE_ExcludeThreadLocalVars = 0x20
4937 Kind oppositeKind()
const;
4948 case Kind::NonBlocking:
4949 return FE_InferrableOnCallees | FE_ExcludeThrow | FE_ExcludeCatch |
4950 FE_ExcludeObjCMessageSend | FE_ExcludeStaticLocalVars |
4951 FE_ExcludeThreadLocalVars;
4952 case Kind::NonAllocating:
4954 return FE_InferrableOnCallees | FE_ExcludeThrow | FE_ExcludeCatch |
4955 FE_ExcludeObjCMessageSend | FE_ExcludeThreadLocalVars;
4956 case Kind::Blocking:
4957 case Kind::Allocating:
4960 llvm_unreachable(
"unknown effect kind");
4964 StringRef name()
const;
4968 OS << Effect.
name();
4978 std::optional<FunctionEffect>
4979 effectProhibitingInference(
const Decl &Callee,
4986 bool shouldDiagnoseFunctionCall(
bool Direct,
4990 return LHS.FKind == RHS.FKind;
4993 return !(LHS == RHS);
4996 return LHS.FKind < RHS.FKind;
5003 Expr *Cond =
nullptr;
5012 return Cond == RHS.Cond;
5024 : Effect(
E), Cond(C) {}
5027 std::string description()
const;
5029 friend raw_ostream &operator<<(raw_ostream &OS,
5038 const Container *Outer =
nullptr;
5045 return Idx ==
Other.Idx;
5048 return Idx !=
Other.Idx;
5057 assert(Outer !=
nullptr &&
"invalid FunctionEffectIterator");
5058 bool HasConds = !Outer->Conditions.empty();
5060 HasConds ? Outer->Conditions[Idx]
5099 : Effects(FX), Conditions(Conds) {}
5112 bool empty()
const {
return Effects.empty(); }
5113 size_t size()
const {
return Effects.size(); }
5125 return LHS.Effects == RHS.Effects && LHS.Conditions == RHS.Conditions;
5129 return !(LHS == RHS);
5132 void dump(llvm::raw_ostream &OS)
const;
5138 constexpr static size_t EndBitPos = FunctionEffect::KindCount;
5139 using KindBitsT = std::bitset<EndBitPos>;
5141 KindBitsT KindBits{};
5149 return static_cast<size_t>(K);
5163 void advanceToNextSetBit() {
5164 while (Idx < EndBitPos && !Outer->KindBits.test(Idx))
5171 advanceToNextSetBit();
5174 bool operator!=(
const iterator &
Other)
const {
return Idx !=
Other.Idx; }
5176 iterator operator++() {
5178 advanceToNextSetBit();
5183 assert(Idx < EndBitPos &&
"Dereference of end iterator");
5192 iterator
begin()
const {
return iterator(*
this, 0); }
5193 iterator
end()
const {
return iterator(*
this, EndBitPos); }
5202 bool empty()
const {
return KindBits.none(); }
5204 return KindBits.test(kindToPos(EK));
5206 void dump(llvm::raw_ostream &OS)
const;
5226 : Effects(FX.effects()), Conditions(FX.conditions()) {}
5228 bool empty()
const {
return Effects.empty(); }
5229 size_t size()
const {
return Effects.size(); }
5238 void dump(llvm::raw_ostream &OS)
const;
5275 public llvm::FoldingSetNode,
5276 private llvm::TrailingObjects<
5277 FunctionProtoType, QualType, SourceLocation,
5278 FunctionType::FunctionTypeExtraBitfields,
5279 FunctionType::FunctionTypeExtraAttributeInfo,
5280 FunctionType::FunctionTypeArmAttributes, FunctionType::ExceptionType,
5281 Expr *, FunctionDecl *, FunctionType::ExtParameterInfo, Qualifiers,
5282 FunctionEffect, EffectConditionExpr> {
5284 friend TrailingObjects;
5377 LLVM_PREFERRED_TYPE(
bool)
5379 LLVM_PREFERRED_TYPE(
bool)
5380 unsigned HasTrailingReturn : 1;
5381 LLVM_PREFERRED_TYPE(
bool)
5382 unsigned CFIUncheckedCallee : 1;
5384 unsigned AArch64SMEAttributes : 9;
5387 : Variadic(
false), HasTrailingReturn(
false), CFIUncheckedCallee(
false),
5388 AArch64SMEAttributes(SME_NormalFunction) {}
5392 CFIUncheckedCallee(
false), AArch64SMEAttributes(SME_NormalFunction) {}
5396 Result.ExceptionSpec = ESI;
5402 Result.CFIUncheckedCallee = CFIUncheckedCallee;
5408 requiresFunctionProtoTypeArmAttributes() ||
5409 requiresFunctionProtoTypeExtraAttributeInfo() ||
5410 !FunctionEffects.
empty();
5414 return AArch64SMEAttributes != SME_NormalFunction;
5418 return static_cast<bool>(ExtraAttributeInfo);
5423 AArch64SMEAttributes |=
Kind;
5425 AArch64SMEAttributes &= ~Kind;
5430 unsigned numTrailingObjects(OverloadToken<QualType>)
const {
5431 return getNumParams();
5434 unsigned numTrailingObjects(OverloadToken<SourceLocation>)
const {
5435 return isVariadic();
5438 unsigned numTrailingObjects(OverloadToken<FunctionTypeArmAttributes>)
const {
5439 return hasArmTypeAttributes();
5442 unsigned numTrailingObjects(OverloadToken<FunctionTypeExtraBitfields>)
const {
5443 return hasExtraBitfields();
5447 numTrailingObjects(OverloadToken<FunctionTypeExtraAttributeInfo>)
const {
5448 return hasExtraAttributeInfo();
5451 unsigned numTrailingObjects(OverloadToken<ExceptionType>)
const {
5452 return getExceptionSpecSize().NumExceptionType;
5455 unsigned numTrailingObjects(OverloadToken<Expr *>)
const {
5456 return getExceptionSpecSize().NumExprPtr;
5459 unsigned numTrailingObjects(OverloadToken<FunctionDecl *>)
const {
5460 return getExceptionSpecSize().NumFunctionDeclPtr;
5463 unsigned numTrailingObjects(OverloadToken<ExtParameterInfo>)
const {
5464 return hasExtParameterInfos() ? getNumParams() : 0;
5467 unsigned numTrailingObjects(OverloadToken<Qualifiers>)
const {
5468 return hasExtQualifiers() ? 1 : 0;
5471 unsigned numTrailingObjects(OverloadToken<FunctionEffect>)
const {
5472 return getNumFunctionEffects();
5477 static bool containsAnyUnexpandedParameterPack(
const QualType *ArgArray,
5479 for (
unsigned Idx = 0; Idx < numArgs; ++Idx)
5480 if (ArgArray[Idx]->containsUnexpandedParameterPack())
5486 FunctionProtoType(QualType result, ArrayRef<QualType> params,
5487 QualType canonical,
const ExtProtoInfo &epi);
5492 struct ExceptionSpecSizeHolder {
5493 unsigned NumExceptionType;
5494 unsigned NumExprPtr;
5495 unsigned NumFunctionDeclPtr;
5500 static ExceptionSpecSizeHolder
5501 getExceptionSpecSize(ExceptionSpecificationType EST,
unsigned NumExceptions) {
5512 return {NumExceptions, 0, 0};
5525 llvm_unreachable(
"bad exception specification kind");
5530 ExceptionSpecSizeHolder getExceptionSpecSize()
const {
5531 return getExceptionSpecSize(getExceptionSpecType(), getNumExceptions());
5535 bool hasExtraBitfields()
const {
5536 assert((getExceptionSpecType() != EST_Dynamic ||
5537 FunctionTypeBits.HasExtraBitfields) &&
5538 "ExtraBitfields are required for given ExceptionSpecType");
5539 return FunctionTypeBits.HasExtraBitfields;
5543 bool hasExtraAttributeInfo()
const {
5544 return FunctionTypeBits.HasExtraBitfields &&
5545 getTrailingObjects<FunctionTypeExtraBitfields>()
5546 ->HasExtraAttributeInfo;
5549 bool hasArmTypeAttributes()
const {
5550 return FunctionTypeBits.HasExtraBitfields &&
5551 getTrailingObjects<FunctionTypeExtraBitfields>()
5552 ->HasArmTypeAttributes;
5555 bool hasExtQualifiers()
const {
5556 return FunctionTypeBits.HasExtQuals;
5563 assert(i < getNumParams() &&
"invalid parameter index");
5564 return param_type_begin()[i];
5568 return {param_type_begin(), param_type_end()};
5591 FunctionTypeBits.ExceptionSpecType);
5608 bool hasDependentExceptionSpec()
const;
5612 bool hasInstantiationDependentExceptionSpec()
const;
5617 Result.Type = getExceptionSpecType();
5619 Result.Exceptions = exceptions();
5621 Result.NoexceptExpr = getNoexceptExpr();
5623 Result.SourceDecl = getExceptionSpecDecl();
5624 Result.SourceTemplate = getExceptionSpecTemplate();
5626 Result.SourceDecl = getExceptionSpecDecl();
5634 ? getTrailingObjects<FunctionTypeExtraBitfields>()
5641 assert(i < getNumExceptions() &&
"Invalid exception number!");
5642 return exception_begin()[i];
5650 return *getTrailingObjects<Expr *>();
5661 return getTrailingObjects<FunctionDecl *>()[0];
5671 return getTrailingObjects<FunctionDecl *>()[1];
5682 return ResultIfDependent ? canThrow() !=
CT_Can : canThrow() ==
CT_Cannot;
5689 return isVariadic() ? *getTrailingObjects<SourceLocation>()
5699 bool isTemplateVariadic()
const;
5705 return FunctionTypeBits.CFIUncheckedCallee;
5709 if (hasExtQualifiers())
5710 return *getTrailingObjects<Qualifiers>();
5712 return getFastTypeQuals();
5723 return {param_type_begin(), param_type_end()};
5727 return getTrailingObjects<QualType>();
5731 return param_type_begin() + getNumParams();
5737 return {exception_begin(), exception_end()};
5742 getTrailingObjects<ExceptionType>());
5746 return exception_begin() + getNumExceptions();
5752 return FunctionTypeBits.HasExtParameterInfos;
5756 assert(hasExtParameterInfos());
5765 if (!hasExtParameterInfos())
5767 return getTrailingObjects<ExtParameterInfo>();
5772 if (hasExtraAttributeInfo())
5773 return *getTrailingObjects<FunctionTypeExtraAttributeInfo>();
5780 if (!hasArmTypeAttributes())
5781 return SME_NormalFunction;
5782 return getTrailingObjects<FunctionTypeArmAttributes>()
5783 ->AArch64SMEAttributes;
5787 assert(I < getNumParams() &&
"parameter index out of range");
5788 if (hasExtParameterInfos())
5789 return getTrailingObjects<ExtParameterInfo>()[I];
5794 assert(I < getNumParams() &&
"parameter index out of range");
5795 if (hasExtParameterInfos())
5796 return getTrailingObjects<ExtParameterInfo>()[I].getABI();
5797 return ParameterABI::Ordinary;
5801 assert(I < getNumParams() &&
"parameter index out of range");
5802 if (hasExtParameterInfos())
5803 return getTrailingObjects<ExtParameterInfo>()[I].isConsumed();
5808 return hasExtraBitfields()
5809 ? getTrailingObjects<FunctionTypeExtraBitfields>()
5810 ->NumFunctionEffects
5816 if (hasExtraBitfields()) {
5817 const auto *Bitfields = getTrailingObjects<FunctionTypeExtraBitfields>();
5818 if (Bitfields->NumFunctionEffects > 0)
5819 return getTrailingObjects<FunctionEffect>(
5820 Bitfields->NumFunctionEffects);
5826 if (hasExtraBitfields()) {
5827 const auto *Bitfields = getTrailingObjects<FunctionTypeExtraBitfields>();
5828 if (Bitfields->EffectsHaveConditions)
5829 return Bitfields->NumFunctionEffects;
5836 if (hasExtraBitfields()) {
5837 const auto *Bitfields = getTrailingObjects<FunctionTypeExtraBitfields>();
5838 if (Bitfields->EffectsHaveConditions)
5839 return getTrailingObjects<EffectConditionExpr>(
5840 Bitfields->NumFunctionEffects);
5847 if (hasExtraBitfields()) {
5848 const auto *Bitfields = getTrailingObjects<FunctionTypeExtraBitfields>();
5849 if (Bitfields->NumFunctionEffects > 0) {
5850 const size_t NumConds = Bitfields->EffectsHaveConditions
5851 ? Bitfields->NumFunctionEffects
5854 getTrailingObjects<FunctionEffect>(Bitfields->NumFunctionEffects),
5855 {NumConds ? getTrailingObjects<EffectConditionExpr>() : nullptr,
5865 void printExceptionSpecification(raw_ostream &OS,
5872 void Profile(llvm::FoldingSetNodeID &
ID,
const ASTContext &Ctx);
5931 static TagTypeKind getTagTypeKindForTypeSpec(
unsigned TypeSpec);
5946 return getKeywordName(getKeywordForTagTypeKind(
Kind));
5952 template <
class... As>
5955 this->KeywordWrapperBits.Keyword = llvm::to_underlying(
Keyword);
5980 constexpr unsigned long Offset =
5982 const auto *
Addr =
reinterpret_cast<const T *
>(
5983 reinterpret_cast<const char *
>(
this) - Offset);
5984 assert(llvm::isAddrAligned(llvm::Align(
alignof(
T)),
Addr));
5996 private llvm::TrailingObjects<UnresolvedUsingType,
5997 FoldingSetPlaceholder<UnresolvedUsingType>,
5998 NestedNameSpecifier> {
6000 friend TrailingObjects;
6004 unsigned numTrailingObjects(
6006 assert(UnresolvedUsingBits.hasQualifier ||
6007 getKeyword() != ElaboratedTypeKeyword::None);
6012 assert(numTrailingObjects(
6015 return getTrailingObjects<FoldingSetPlaceholder<UnresolvedUsingType>>();
6018 UnresolvedUsingType(ElaboratedTypeKeyword Keyword,
6019 NestedNameSpecifier Qualifier,
6020 const UnresolvedUsingTypenameDecl *
D,
6021 const Type *CanonicalType);
6025 return UnresolvedUsingBits.hasQualifier
6026 ? *getTrailingObjects<NestedNameSpecifier>()
6038 static_assert(llvm::to_underlying(ElaboratedTypeKeyword::None) <= 7);
6041 Qualifier.Profile(
ID);
6045 Profile(
ID, getKeyword(), getQualifier(), getDecl());
6054 public llvm::FoldingSetNode,
6055 llvm::TrailingObjects<UsingType, NestedNameSpecifier> {
6060 friend TrailingObjects;
6067 return UsingBits.hasQualifier ? *getTrailingObjects() : std::nullopt;
6078 static_assert(llvm::to_underlying(ElaboratedTypeKeyword::None) <= 7);
6082 Qualifier.Profile(
ID);
6086 Profile(
ID, getKeyword(), getQualifier(),
D, desugar());
6093 private llvm::TrailingObjects<TypedefType,
6094 FoldingSetPlaceholder<TypedefType>,
6095 NestedNameSpecifier, QualType> {
6098 friend TrailingObjects;
6102 assert(TypedefBits.hasQualifier || TypedefBits.hasTypeDifferentFromDecl ||
6103 getKeyword() != ElaboratedTypeKeyword::None);
6107 unsigned numTrailingObjects(OverloadToken<NestedNameSpecifier>)
const {
6108 return TypedefBits.hasQualifier;
6111 TypedefType(TypeClass TC, ElaboratedTypeKeyword Keyword,
6112 NestedNameSpecifier Qualifier,
const TypedefNameDecl *
D,
6113 QualType UnderlyingType,
bool HasTypeDifferentFromDecl);
6115 FoldingSetPlaceholder<TypedefType> *getFoldingSetPlaceholder() {
6116 assert(numTrailingObjects(
6117 OverloadToken<FoldingSetPlaceholder<TypedefType>>{}) == 1);
6118 return getTrailingObjects<FoldingSetPlaceholder<TypedefType>>();
6123 return TypedefBits.hasQualifier ? *getTrailingObjects<NestedNameSpecifier>()
6143 if (
Keyword != ElaboratedTypeKeyword::None)
6144 ID.AddInteger(llvm::to_underlying(
Keyword));
6146 Qualifier.Profile(
ID);
6147 if (!Underlying.
isNull())
6152 Profile(
ID, getKeyword(), getQualifier(), getDecl(),
6153 typeMatchesDecl() ?
QualType() : desugar());
6169 :
Type(MacroQualified, CanonTy, UnderlyingTy->getDependence()),
6170 UnderlyingTy(UnderlyingTy), MacroII(MacroII) {
6171 assert(isa<AttributedType>(UnderlyingTy) &&
6172 "Expected a macro qualified type to only wrap attributed types.");
6208 return static_cast<TypeOfKind>(TypeOfBits.Kind);
6215 bool isSugared()
const;
6227 public llvm::FoldingSetNode {
6233 Profile(
ID, Context, getUnderlyingExpr(),
6234 getKind() == TypeOfKind::Unqualified);
6237 static void Profile(llvm::FoldingSetNodeID &
ID,
const ASTContext &Context,
6238 Expr *
E,
bool IsUnqual);
6263 return static_cast<TypeOfKind>(TypeOfBits.Kind);
6287 bool isSugared()
const;
6303 Profile(
ID, Context, getUnderlyingExpr());
6306 static void Profile(llvm::FoldingSetNodeID &
ID,
const ASTContext &Context,
6312 public llvm::FoldingSetNode,
6313 private llvm::TrailingObjects<PackIndexingType, QualType> {
6314 friend TrailingObjects;
6321 LLVM_PREFERRED_TYPE(
bool)
6322 unsigned FullySubstituted : 1;
6336 if (hasSelectedType())
6337 return getSelectedType();
6342 assert(hasSelectedType() &&
"Type is dependant");
6343 return *(getExpansionsPtr() + *getSelectedIndex());
6355 return {getExpansionsPtr(), Size};
6362 void Profile(llvm::FoldingSetNodeID &
ID,
const ASTContext &Context);
6363 static void Profile(llvm::FoldingSetNodeID &
ID,
const ASTContext &Context,
6368 const QualType *getExpansionsPtr()
const {
return getTrailingObjects(); }
6370 static TypeDependence computeDependence(QualType Pattern, Expr *IndexExpr,
6371 ArrayRef<QualType> Expansions = {});
6378#define TRANSFORM_TYPE_TRAIT_DEF(Enum, _) Enum,
6379#include "clang/Basic/TransformTypeTraits.def"
6387 QualType UnderlyingType;
6418 ID.AddInteger(UKind);
6429 void *getTrailingPointer()
const;
6435 bool IsInjected,
const Type *CanonicalType);
6471 bool OwnsTag,
bool IsInjected) {
6472 ID.AddInteger(
uintptr_t(Tag) | OwnsTag | (IsInjected << 1) |
6473 ((
Keyword != ElaboratedTypeKeyword::None) << 2));
6474 if (
Keyword != ElaboratedTypeKeyword::None)
6475 ID.AddInteger(llvm::to_underlying(
Keyword));
6477 Qualifier.Profile(
ID);
6482 Profile(
ID,
T->getKeyword(),
T->getQualifier(),
T->getOriginalDecl(),
6483 T->isTagOwned(),
T->isInjected());
6487 return reinterpret_cast<TagType *
>(
reinterpret_cast<char *
>(
this + 1) +
6495 reinterpret_cast<char *
>(
T) - getOffset()) -
6503 using TagType::TagType;
6510 return reinterpret_cast<RecordDecl *
>(TagType::getOriginalDecl());
6515 bool hasConstFields()
const;
6523 using TagType::TagType;
6530 return reinterpret_cast<EnumDecl *
>(TagType::getOriginalDecl());
6558 bool IsInjected,
const Type *CanonicalType);
6565 return reinterpret_cast<CXXRecordDecl *
>(TagType::getOriginalDecl());
6592 const Attr *Attribute;
6599 :
AttributedType(canon, attrKind, nullptr, modified, equivalent) {}
6610 return static_cast<Kind>(AttributedTypeBits.AttrKind);
6636 bool isQualifier()
const;
6638 bool isMSTypeSpec()
const;
6640 bool isWebAssemblyFuncrefSpec()
const;
6642 bool isCallingConv()
const;
6644 std::optional<NullabilityKind> getImmediateNullability()
const;
6655 static std::optional<NullabilityKind> stripOuterNullability(
QualType &T);
6658 Profile(
ID, getAttrKind(), ModifiedType, EquivalentType, Attribute);
6664 ID.AddInteger(attrKind);
6680 const BTFTypeTagAttr *BTFAttr;
6683 const BTFTypeTagAttr *BTFAttr)
6684 :
Type(BTFTagAttributed, Canon, Wrapped->getDependence()),
6685 WrappedType(Wrapped), BTFAttr(BTFAttr) {}
6689 const BTFTypeTagAttr *
getAttr()
const {
return BTFAttr; }
6695 Profile(
ID, WrappedType, BTFAttr);
6699 const BTFTypeTagAttr *BTFAttr) {
6701 ID.AddPointer(BTFAttr);
6715 LLVM_PREFERRED_TYPE(
bool)
6718 LLVM_PREFERRED_TYPE(
bool)
6719 uint8_t RawBuffer : 1;
6722 bool RawBuffer =
false)
6732 return !(LHS == RHS);
6747 : Contained->getDependence()),
6748 WrappedType(Wrapped), ContainedType(Contained), Attrs(Attrs) {}
6760 Profile(
ID, WrappedType, ContainedType, Attrs);
6778 findHandleTypeOnResource(
const Type *RT);
6795 SpirvOperandKind
Kind = Invalid;
6826 assert((isConstant() || isLiteral()) &&
6827 "This is not an operand with a value!");
6832 assert((isConstant() || isType()) &&
6833 "This is not an operand with a result type!");
6838 return SpirvOperand(ConstantId, ResultType, std::move(Val));
6859 public llvm::FoldingSetNode,
6860 private llvm::TrailingObjects<HLSLInlineSpirvType, SpirvOperand> {
6862 friend TrailingObjects;
6873 Size(Size), Alignment(Alignment), NumOperands(Operands.size()) {
6874 for (
size_t I = 0; I < NumOperands; I++) {
6877 auto *Operand =
new (&getTrailingObjects()[I])
SpirvOperand();
6878 *Operand = Operands[I];
6887 return getTrailingObjects(NumOperands);
6894 Profile(
ID, Opcode, Size, Alignment, getOperands());
6897 static void Profile(llvm::FoldingSetNodeID &
ID, uint32_t Opcode,
6898 uint32_t Size, uint32_t Alignment,
6900 ID.AddInteger(Opcode);
6901 ID.AddInteger(Size);
6902 ID.AddInteger(Alignment);
6903 for (
auto &Operand : Operands)
6904 Operand.Profile(
ID);
6920 :
Type(TemplateTypeParm, Canon,
6924 assert(!TTPDecl == Canon.
isNull());
6925 TemplateTypeParmTypeBits.Depth =
D;
6926 TemplateTypeParmTypeBits.Index = I;
6927 TemplateTypeParmTypeBits.ParameterPack = PP;
6931 unsigned getDepth()
const {
return TemplateTypeParmTypeBits.Depth; }
6932 unsigned getIndex()
const {
return TemplateTypeParmTypeBits.Index; }
6934 return TemplateTypeParmTypeBits.ParameterPack;
6948 static void Profile(llvm::FoldingSetNodeID &
ID,
unsigned Depth,
6949 unsigned Index,
bool ParameterPack,
6951 ID.AddInteger(Depth);
6952 ID.AddInteger(Index);
6953 ID.AddBoolean(ParameterPack);
6954 ID.AddPointer(TTPDecl);
6971 public llvm::FoldingSetNode,
6972 private llvm::TrailingObjects<SubstTemplateTypeParmType, QualType> {
6976 Decl *AssociatedDecl;
6986 return SubstTemplateTypeParmTypeBits.HasNonCanonicalUnderlyingType
6987 ? *getTrailingObjects()
6988 : getCanonicalTypeInternal();
7001 unsigned getIndex()
const {
return SubstTemplateTypeParmTypeBits.Index; }
7005 unsigned getFinal()
const {
return SubstTemplateTypeParmTypeBits.Final; }
7008 return UnsignedOrNone::fromInternalRepresentation(
7009 SubstTemplateTypeParmTypeBits.PackIndex);
7016 Profile(
ID, getReplacementType(), getAssociatedDecl(),
getIndex(),
7017 getPackIndex(), getFinal());
7020 static void Profile(llvm::FoldingSetNodeID &
ID,
QualType Replacement,
7021 const Decl *AssociatedDecl,
unsigned Index,
7047 unsigned getNumArgs()
const {
return SubstPackTypeBits.NumArgs; }
7051 void Profile(llvm::FoldingSetNodeID &
ID);
7052 static void Profile(llvm::FoldingSetNodeID &
ID,
7072 using SubstPackType::Profile;
7098 llvm::PointerIntPair<Decl *, 1, bool> AssociatedDeclAndFinal;
7101 unsigned Index,
bool Final,
7110 Decl *getAssociatedDecl()
const;
7118 return SubstPackTypeBits.SubstTemplTypeParmPackIndex;
7123 bool getFinal()
const;
7128 void Profile(llvm::FoldingSetNodeID &
ID);
7129 static void Profile(llvm::FoldingSetNodeID &
ID,
const Decl *AssociatedDecl,
7130 unsigned Index,
bool Final,
7153 ExtraDependence | (DeducedAsType.isNull()
7155 : DeducedAsType->getDependence() &
7157 DeducedAsType(DeducedAsType) {}
7162 return isSugared() ? DeducedAsType :
QualType(
this, 0);
7169 return !DeducedAsType.
isNull() || isDependentType();
7192 AutoTypeBits.NumArgs};
7196 return TypeConstraintConcept;
7200 return TypeConstraintConcept !=
nullptr;
7204 return getKeyword() == AutoTypeKeyword::DecltypeAuto;
7208 return getKeyword() == AutoTypeKeyword::GNUAutoType;
7215 void Profile(llvm::FoldingSetNodeID &
ID,
const ASTContext &Context);
7216 static void Profile(llvm::FoldingSetNodeID &
ID,
const ASTContext &Context,
7228 public llvm::FoldingSetNode {
7237 bool IsDeducedAsDependent,
QualType Canon)
7240 (IsDeducedAsDependent
7251 Profile(
ID, getKeyword(), getTemplateName(), getDeducedType(),
7258 ID.AddInteger(llvm::to_underlying(
Keyword));
7261 ID.AddBoolean(IsDependent ||
Template.isDependent());
7290 public llvm::FoldingSetNode {
7324 static bool anyInstantiationDependentTemplateArguments(
7330 return isa<InjectedClassNameType>(getCanonicalTypeInternal());
7348 bool isTypeAlias()
const {
return TemplateSpecializationTypeBits.TypeAlias; }
7359 TemplateSpecializationTypeBits.NumArgs};
7362 bool isSugared()
const;
7365 return isTypeAlias() ? getAliasedType() : getCanonicalTypeInternal();
7368 void Profile(llvm::FoldingSetNodeID &
ID,
const ASTContext &Ctx);
7380void printTemplateArgumentList(raw_ostream &OS,
7381 ArrayRef<TemplateArgument> Args,
7382 const PrintingPolicy &Policy,
7383 const TemplateParameterList *TPL =
nullptr);
7385void printTemplateArgumentList(raw_ostream &OS,
7386 ArrayRef<TemplateArgumentLoc> Args,
7387 const PrintingPolicy &Policy,
7388 const TemplateParameterList *TPL =
nullptr);
7390void printTemplateArgumentList(raw_ostream &OS,
7391 const TemplateArgumentListInfo &Args,
7392 const PrintingPolicy &Policy,
7393 const TemplateParameterList *TPL =
nullptr);
7397bool isSubstitutedDefaultArgument(ASTContext &Ctx, TemplateArgument Arg,
7398 const NamedDecl *Param,
7399 ArrayRef<TemplateArgument> Args,
7429 NNS(NNS), Name(Name) {
7447 Profile(
ID, getKeyword(), NNS, Name);
7452 ID.AddInteger(llvm::to_underlying(
Keyword));
7454 ID.AddPointer(Name);
7482 DependentTemplateSpecializationTypeBits.NumArgs};
7489 Profile(
ID, Context, getKeyword(), Name, template_arguments());
7492 static void Profile(llvm::FoldingSetNodeID &
ID,
const ASTContext &Context,
7498 return T->
getTypeClass() == DependentTemplateSpecialization;
7532 :
Type(PackExpansion, Canon,
7537 PackExpansionTypeBits.NumExpansions =
7538 NumExpansions ? *NumExpansions + 1 : 0;
7550 if (PackExpansionTypeBits.NumExpansions)
7551 return PackExpansionTypeBits.NumExpansions - 1;
7552 return std::nullopt;
7559 Profile(
ID, getPattern(), getNumExpansions());
7585 return static_cast<T*
>(
this)->getProtocolStorageImpl();
7589 static_cast<T*
>(
this)->setNumProtocolsImpl(N);
7593 setNumProtocols(protocols.size());
7594 assert(getNumProtocols() == protocols.size() &&
7595 "bitfield overflow in protocol count");
7596 if (!protocols.empty())
7597 memcpy(getProtocolStorage(), protocols.data(),
7614 return static_cast<const T*
>(
this)->getNumProtocolsImpl();
7619 assert(I < getNumProtocols() &&
"Out-of-range protocol access");
7620 return qual_begin()[I];
7633 public llvm::FoldingSetNode {
7638 unsigned NumProtocols : 6;
7649 unsigned getNumProtocolsImpl()
const {
7650 return NumProtocols;
7653 void setNumProtocolsImpl(
unsigned N) {
7657 ObjCTypeParamType(
const ObjCTypeParamDecl *
D,
7659 ArrayRef<ObjCProtocolDecl *> protocols);
7669 void Profile(llvm::FoldingSetNodeID &
ID);
7670 static void Profile(llvm::FoldingSetNodeID &
ID,
7726 mutable llvm::PointerIntPair<const ObjCObjectType *, 1, bool>
7727 CachedSuperClassType;
7730 const QualType *getTypeArgStorage()
const {
7737 unsigned getNumProtocolsImpl()
const {
7738 return ObjCObjectTypeBits.NumProtocols;
7740 void setNumProtocolsImpl(
unsigned N) {
7741 ObjCObjectTypeBits.NumProtocols = N;
7755 ObjCObjectTypeBits.NumProtocols = 0;
7756 ObjCObjectTypeBits.NumTypeArgs = 0;
7757 ObjCObjectTypeBits.IsKindOf = 0;
7760 void computeSuperClassTypeSlow()
const;
7772 return getBaseType()->isSpecificBuiltinType(BuiltinType::ObjCId);
7776 return getBaseType()->isSpecificBuiltinType(BuiltinType::ObjCClass);
7782 if (!qual_empty())
return false;
7783 if (
const BuiltinType *
T = getBaseType()->getAs<BuiltinType>())
7784 return T->getKind() == BuiltinType::ObjCId ||
7785 T->getKind() == BuiltinType::ObjCClass;
7797 bool isSpecialized()
const;
7801 return ObjCObjectTypeBits.NumTypeArgs > 0;
7818 return {getTypeArgStorage(), ObjCObjectTypeBits.NumTypeArgs};
7825 bool isKindOfType()
const;
7834 if (!CachedSuperClassType.getInt())
7835 computeSuperClassTypeSlow();
7837 assert(CachedSuperClassType.getInt() &&
"Superclass not set?");
7838 return QualType(CachedSuperClassType.getPointer(), 0);
7871 void Profile(llvm::FoldingSetNodeID &
ID);
7872 static void Profile(llvm::FoldingSetNodeID &
ID,
7879inline QualType *ObjCObjectType::getTypeArgStorage() {
7880 return reinterpret_cast<QualType *
>(
static_cast<ObjCObjectTypeImpl*
>(
this)+1);
7883inline ObjCProtocolDecl **ObjCObjectType::getProtocolStorageImpl() {
7884 return reinterpret_cast<ObjCProtocolDecl**
>(
7885 getTypeArgStorage() + ObjCObjectTypeBits.NumTypeArgs);
7888inline ObjCProtocolDecl **ObjCTypeParamType::getProtocolStorageImpl() {
7889 return reinterpret_cast<ObjCProtocolDecl**
>(
7890 static_cast<ObjCTypeParamType*
>(
this)+1);
7943 if (
const auto *
T = dyn_cast<ObjCInterfaceType>(ObjT))
7944 return T->getDecl();
7946 baseType = ObjT->getBaseType();
7967 :
Type(ObjCObjectPointer, Canonical, Pointee->getDependence()),
7968 PointeeType(Pointee) {}
8111 QualType getSuperClassType()
const;
8123 ID.AddPointer(
T.getAsOpaquePtr());
8137 :
Type(
Atomic, Canonical, ValTy->getDependence()), ValueType(ValTy) {}
8148 Profile(
ID, getValueType());
8152 ID.AddPointer(
T.getAsOpaquePtr());
8168 :
Type(
Pipe, CanonicalPtr, elemType->getDependence()),
8179 Profile(
ID, getElementType(), isReadOnly());
8183 ID.AddPointer(
T.getAsOpaquePtr());
8197 LLVM_PREFERRED_TYPE(
bool)
8198 unsigned IsUnsigned : 1;
8199 unsigned NumBits : 24;
8216 static void Profile(llvm::FoldingSetNodeID &
ID,
bool IsUnsigned,
8218 ID.AddBoolean(IsUnsigned);
8219 ID.AddInteger(NumBits);
8227 llvm::PointerIntPair<Expr*, 1, bool> ExprAndUnsigned;
8235 Expr *getNumBitsExpr()
const;
8243 static void Profile(llvm::FoldingSetNodeID &
ID,
const ASTContext &Context,
8244 bool IsUnsigned,
Expr *NumBitsExpr);
8261 PredefinedSugarTypeBits.Kind = llvm::to_underlying(KD);
8264 static StringRef getName(
Kind KD);
8291 addFastQualifiers(
type.getLocalFastQualifiers());
8292 if (!
type.hasLocalNonFastQualifiers())
8293 return type.getTypePtrUnsafe();
8338 Ty->getLocallyUnqualifiedSingleStepDesugaredType().split();
8343inline const Type *QualType::getTypePtr()
const {
8344 return getCommonPtr()->BaseType;
8347inline const Type *QualType::getTypePtrOrNull()
const {
8348 return (isNull() ?
nullptr : getCommonPtr()->BaseType);
8351inline bool QualType::isReferenceable()
const {
8355 const Type &Self = **
this;
8356 if (Self.isObjectType() || Self.isReferenceType())
8359 return F->getMethodQuals().empty() && F->getRefQualifier() ==
RQ_None;
8365 if (!hasLocalNonFastQualifiers())
8367 Qualifiers::fromFastMask(getLocalFastQualifiers()));
8369 const ExtQuals *eq = getExtQualsUnsafe();
8377 if (hasLocalNonFastQualifiers())
8378 Quals = getExtQualsUnsafe()->getQualifiers();
8384 Qualifiers quals = getCommonPtr()->CanonicalType.getLocalQualifiers();
8389inline unsigned QualType::getCVRQualifiers()
const {
8390 unsigned cvr = getCommonPtr()->CanonicalType.getLocalCVRQualifiers();
8391 cvr |= getLocalCVRQualifiers();
8396 QualType canon = getCommonPtr()->CanonicalType;
8400inline bool QualType::isCanonical()
const {
8404inline bool QualType::isCanonicalAsParam()
const {
8405 if (!isCanonical())
return false;
8406 if (hasLocalQualifiers())
return false;
8408 const Type *
T = getTypePtr();
8412 return !isa<FunctionType>(
T) &&
8413 (!isa<ArrayType>(
T) || isa<ArrayParameterType>(
T));
8416inline bool QualType::isConstQualified()
const {
8417 return isLocalConstQualified() ||
8418 getCommonPtr()->CanonicalType.isLocalConstQualified();
8421inline bool QualType::isRestrictQualified()
const {
8422 return isLocalRestrictQualified() ||
8423 getCommonPtr()->CanonicalType.isLocalRestrictQualified();
8427inline bool QualType::isVolatileQualified()
const {
8428 return isLocalVolatileQualified() ||
8429 getCommonPtr()->CanonicalType.isLocalVolatileQualified();
8432inline bool QualType::hasQualifiers()
const {
8433 return hasLocalQualifiers() ||
8434 getCommonPtr()->CanonicalType.hasLocalQualifiers();
8438 if (!getTypePtr()->getCanonicalTypeInternal().hasLocalQualifiers())
8441 return QualType(getSplitUnqualifiedTypeImpl(*this).Ty, 0);
8445 if (!getTypePtr()->getCanonicalTypeInternal().hasLocalQualifiers())
8448 return getSplitUnqualifiedTypeImpl(*
this);
8451inline void QualType::removeLocalConst() {
8452 removeLocalFastQualifiers(Qualifiers::Const);
8455inline void QualType::removeLocalRestrict() {
8456 removeLocalFastQualifiers(Qualifiers::Restrict);
8459inline void QualType::removeLocalVolatile() {
8460 removeLocalFastQualifiers(Qualifiers::Volatile);
8464inline bool QualType::hasAddressSpace()
const {
8465 return getQualifiers().hasAddressSpace();
8469inline LangAS QualType::getAddressSpace()
const {
8470 return getQualifiers().getAddressSpace();
8475 return getQualifiers().getObjCGCAttr();
8480 if (
const auto *FT = PT->getPointeeType()->getAs<
FunctionType>())
8481 return FT->getExtInfo();
8483 return FT->getExtInfo();
8497inline bool QualType::isMoreQualifiedThan(
QualType other,
8508inline bool QualType::isAtLeastAsQualifiedAs(
QualType other,
8513 if (getUnqualifiedType()->isVoidType())
8516 return getQualifiers().compatiblyIncludes(OtherQuals, Ctx);
8535inline bool QualType::isCForbiddenLValueType()
const {
8536 return ((getTypePtr()->isVoidType() && !hasQualifiers()) ||
8537 getTypePtr()->isFunctionType());
8543inline bool Type::isFundamentalType()
const {
8544 return isVoidType() ||
8548 (isArithmeticType() && !isEnumeralType());
8554inline bool Type::isCompoundType()
const {
8558 return isArrayType() ||
8564 isReferenceType() ||
8573 isMemberPointerType();
8576inline bool Type::isFunctionType()
const {
8577 return isa<FunctionType>(CanonicalType);
8580inline bool Type::isPointerType()
const {
8581 return isa<PointerType>(CanonicalType);
8584inline bool Type::isPointerOrReferenceType()
const {
8585 return isPointerType() || isReferenceType();
8588inline bool Type::isAnyPointerType()
const {
8589 return isPointerType() || isObjCObjectPointerType();
8593 return isSignablePointerType() || isSignableIntegerType(Ctx);
8596inline bool Type::isSignablePointerType()
const {
8597 return isPointerType() || isObjCClassType() || isObjCQualifiedClassType();
8600inline bool Type::isBlockPointerType()
const {
8601 return isa<BlockPointerType>(CanonicalType);
8604inline bool Type::isReferenceType()
const {
8605 return isa<ReferenceType>(CanonicalType);
8608inline bool Type::isLValueReferenceType()
const {
8609 return isa<LValueReferenceType>(CanonicalType);
8612inline bool Type::isRValueReferenceType()
const {
8613 return isa<RValueReferenceType>(CanonicalType);
8616inline bool Type::isObjectPointerType()
const {
8620 if (
const auto *
T = getAs<PointerType>())
8626inline bool Type::isCFIUncheckedCalleeFunctionType()
const {
8627 if (
const auto *Fn = getAs<FunctionProtoType>())
8628 return Fn->hasCFIUncheckedCallee();
8632inline bool Type::hasPointeeToToCFIUncheckedCalleeFunctionType()
const {
8634 if (
const auto *PT = getAs<PointerType>())
8636 else if (
const auto *RT = getAs<ReferenceType>())
8638 else if (
const auto *MPT = getAs<MemberPointerType>())
8640 else if (
const auto *DT = getAs<DecayedType>())
8647inline bool Type::isFunctionPointerType()
const {
8648 if (
const auto *
T = getAs<PointerType>())
8654inline bool Type::isFunctionReferenceType()
const {
8655 if (
const auto *
T = getAs<ReferenceType>())
8661inline bool Type::isMemberPointerType()
const {
8662 return isa<MemberPointerType>(CanonicalType);
8665inline bool Type::isMemberFunctionPointerType()
const {
8666 if (
const auto *
T = getAs<MemberPointerType>())
8667 return T->isMemberFunctionPointer();
8672inline bool Type::isMemberDataPointerType()
const {
8673 if (
const auto *
T = getAs<MemberPointerType>())
8674 return T->isMemberDataPointer();
8679inline bool Type::isArrayType()
const {
8680 return isa<ArrayType>(CanonicalType);
8683inline bool Type::isConstantArrayType()
const {
8684 return isa<ConstantArrayType>(CanonicalType);
8687inline bool Type::isIncompleteArrayType()
const {
8688 return isa<IncompleteArrayType>(CanonicalType);
8691inline bool Type::isVariableArrayType()
const {
8692 return isa<VariableArrayType>(CanonicalType);
8695inline bool Type::isArrayParameterType()
const {
8696 return isa<ArrayParameterType>(CanonicalType);
8699inline bool Type::isDependentSizedArrayType()
const {
8700 return isa<DependentSizedArrayType>(CanonicalType);
8703inline bool Type::isBuiltinType()
const {
8704 return isa<BuiltinType>(CanonicalType);
8707inline bool Type::isRecordType()
const {
8708 return isa<RecordType>(CanonicalType);
8711inline bool Type::isEnumeralType()
const {
8712 return isa<EnumType>(CanonicalType);
8715inline bool Type::isAnyComplexType()
const {
8716 return isa<ComplexType>(CanonicalType);
8719inline bool Type::isVectorType()
const {
8720 return isa<VectorType>(CanonicalType);
8723inline bool Type::isExtVectorType()
const {
8724 return isa<ExtVectorType>(CanonicalType);
8727inline bool Type::isExtVectorBoolType()
const {
8728 if (!isExtVectorType())
8730 return cast<ExtVectorType>(CanonicalType)->getElementType()->isBooleanType();
8733inline bool Type::isSubscriptableVectorType()
const {
8734 return isVectorType() || isSveVLSBuiltinType();
8737inline bool Type::isMatrixType()
const {
8738 return isa<MatrixType>(CanonicalType);
8741inline bool Type::isConstantMatrixType()
const {
8742 return isa<ConstantMatrixType>(CanonicalType);
8745inline bool Type::isDependentAddressSpaceType()
const {
8746 return isa<DependentAddressSpaceType>(CanonicalType);
8749inline bool Type::isObjCObjectPointerType()
const {
8750 return isa<ObjCObjectPointerType>(CanonicalType);
8753inline bool Type::isObjCObjectType()
const {
8754 return isa<ObjCObjectType>(CanonicalType);
8757inline bool Type::isObjCObjectOrInterfaceType()
const {
8758 return isa<ObjCInterfaceType>(CanonicalType) ||
8759 isa<ObjCObjectType>(CanonicalType);
8762inline bool Type::isAtomicType()
const {
8763 return isa<AtomicType>(CanonicalType);
8766inline bool Type::isUndeducedAutoType()
const {
8767 return isa<AutoType>(CanonicalType);
8770inline bool Type::isObjCQualifiedIdType()
const {
8771 if (
const auto *OPT = getAs<ObjCObjectPointerType>())
8772 return OPT->isObjCQualifiedIdType();
8776inline bool Type::isObjCQualifiedClassType()
const {
8777 if (
const auto *OPT = getAs<ObjCObjectPointerType>())
8778 return OPT->isObjCQualifiedClassType();
8782inline bool Type::isObjCIdType()
const {
8783 if (
const auto *OPT = getAs<ObjCObjectPointerType>())
8784 return OPT->isObjCIdType();
8788inline bool Type::isObjCClassType()
const {
8789 if (
const auto *OPT = getAs<ObjCObjectPointerType>())
8790 return OPT->isObjCClassType();
8794inline bool Type::isObjCSelType()
const {
8795 if (
const auto *OPT = getAs<PointerType>())
8796 return OPT->getPointeeType()->isSpecificBuiltinType(BuiltinType::ObjCSel);
8800inline bool Type::isObjCBuiltinType()
const {
8801 return isObjCIdType() || isObjCClassType() || isObjCSelType();
8804inline bool Type::isDecltypeType()
const {
8805 return isa<DecltypeType>(
this);
8808#define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \
8809 inline bool Type::is##Id##Type() const { \
8810 return isSpecificBuiltinType(BuiltinType::Id); \
8812#include "clang/Basic/OpenCLImageTypes.def"
8814inline bool Type::isSamplerT()
const {
8815 return isSpecificBuiltinType(BuiltinType::OCLSampler);
8818inline bool Type::isEventT()
const {
8819 return isSpecificBuiltinType(BuiltinType::OCLEvent);
8822inline bool Type::isClkEventT()
const {
8823 return isSpecificBuiltinType(BuiltinType::OCLClkEvent);
8826inline bool Type::isQueueT()
const {
8827 return isSpecificBuiltinType(BuiltinType::OCLQueue);
8830inline bool Type::isReserveIDT()
const {
8831 return isSpecificBuiltinType(BuiltinType::OCLReserveID);
8834inline bool Type::isImageType()
const {
8835#define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) is##Id##Type() ||
8837#include "clang/Basic/OpenCLImageTypes.def"
8841inline bool Type::isPipeType()
const {
8842 return isa<PipeType>(CanonicalType);
8845inline bool Type::isBitIntType()
const {
8846 return isa<BitIntType>(CanonicalType);
8849#define EXT_OPAQUE_TYPE(ExtType, Id, Ext) \
8850 inline bool Type::is##Id##Type() const { \
8851 return isSpecificBuiltinType(BuiltinType::Id); \
8853#include "clang/Basic/OpenCLExtensionTypes.def"
8855inline bool Type::isOCLIntelSubgroupAVCType()
const {
8856#define INTEL_SUBGROUP_AVC_TYPE(ExtType, Id) \
8857 isOCLIntelSubgroupAVC##Id##Type() ||
8859#include "clang/Basic/OpenCLExtensionTypes.def"
8863inline bool Type::isOCLExtOpaqueType()
const {
8864#define EXT_OPAQUE_TYPE(ExtType, Id, Ext) is##Id##Type() ||
8866#include "clang/Basic/OpenCLExtensionTypes.def"
8870inline bool Type::isOpenCLSpecificType()
const {
8871 return isSamplerT() || isEventT() || isImageType() || isClkEventT() ||
8872 isQueueT() || isReserveIDT() || isPipeType() || isOCLExtOpaqueType();
8875#define HLSL_INTANGIBLE_TYPE(Name, Id, SingletonId) \
8876 inline bool Type::is##Id##Type() const { \
8877 return isSpecificBuiltinType(BuiltinType::Id); \
8879#include "clang/Basic/HLSLIntangibleTypes.def"
8881inline bool Type::isHLSLBuiltinIntangibleType()
const {
8882#define HLSL_INTANGIBLE_TYPE(Name, Id, SingletonId) is##Id##Type() ||
8884#include "clang/Basic/HLSLIntangibleTypes.def"
8888inline bool Type::isHLSLSpecificType()
const {
8889 return isHLSLBuiltinIntangibleType() || isHLSLAttributedResourceType() ||
8890 isHLSLInlineSpirvType();
8893inline bool Type::isHLSLAttributedResourceType()
const {
8894 return isa<HLSLAttributedResourceType>(
this);
8897inline bool Type::isHLSLInlineSpirvType()
const {
8898 return isa<HLSLInlineSpirvType>(
this);
8901inline bool Type::isTemplateTypeParmType()
const {
8902 return isa<TemplateTypeParmType>(CanonicalType);
8905inline bool Type::isSpecificBuiltinType(
unsigned K)
const {
8906 if (
const BuiltinType *BT = getAs<BuiltinType>()) {
8912inline bool Type::isPlaceholderType()
const {
8913 if (
const auto *BT = dyn_cast<BuiltinType>(
this))
8914 return BT->isPlaceholderType();
8919 if (
const auto *BT = dyn_cast<BuiltinType>(
this))
8920 if (BT->isPlaceholderType())
8925inline bool Type::isSpecificPlaceholderType(
unsigned K)
const {
8927 return isSpecificBuiltinType(K);
8930inline bool Type::isNonOverloadPlaceholderType()
const {
8931 if (
const auto *BT = dyn_cast<BuiltinType>(
this))
8932 return BT->isNonOverloadPlaceholderType();
8936inline bool Type::isVoidType()
const {
8937 return isSpecificBuiltinType(BuiltinType::Void);
8940inline bool Type::isHalfType()
const {
8942 return isSpecificBuiltinType(BuiltinType::Half);
8945inline bool Type::isFloat16Type()
const {
8946 return isSpecificBuiltinType(BuiltinType::Float16);
8949inline bool Type::isFloat32Type()
const {
8950 return isSpecificBuiltinType(BuiltinType::Float);
8953inline bool Type::isDoubleType()
const {
8954 return isSpecificBuiltinType(BuiltinType::Double);
8957inline bool Type::isBFloat16Type()
const {
8958 return isSpecificBuiltinType(BuiltinType::BFloat16);
8961inline bool Type::isMFloat8Type()
const {
8962 return isSpecificBuiltinType(BuiltinType::MFloat8);
8965inline bool Type::isFloat128Type()
const {
8966 return isSpecificBuiltinType(BuiltinType::Float128);
8969inline bool Type::isIbm128Type()
const {
8970 return isSpecificBuiltinType(BuiltinType::Ibm128);
8973inline bool Type::isNullPtrType()
const {
8974 return isSpecificBuiltinType(BuiltinType::NullPtr);
8980inline bool Type::isIntegerType()
const {
8981 if (
const auto *BT = dyn_cast<BuiltinType>(CanonicalType))
8982 return BT->isInteger();
8983 if (
const EnumType *ET = dyn_cast<EnumType>(CanonicalType)) {
8989 return isBitIntType();
8992inline bool Type::isFixedPointType()
const {
8993 if (
const auto *BT = dyn_cast<BuiltinType>(CanonicalType)) {
8994 return BT->getKind() >= BuiltinType::ShortAccum &&
8995 BT->getKind() <= BuiltinType::SatULongFract;
9000inline bool Type::isFixedPointOrIntegerType()
const {
9001 return isFixedPointType() || isIntegerType();
9004inline bool Type::isConvertibleToFixedPointType()
const {
9005 return isRealFloatingType() || isFixedPointOrIntegerType();
9008inline bool Type::isSaturatedFixedPointType()
const {
9009 if (
const auto *BT = dyn_cast<BuiltinType>(CanonicalType)) {
9010 return BT->getKind() >= BuiltinType::SatShortAccum &&
9011 BT->getKind() <= BuiltinType::SatULongFract;
9016inline bool Type::isUnsaturatedFixedPointType()
const {
9017 return isFixedPointType() && !isSaturatedFixedPointType();
9020inline bool Type::isSignedFixedPointType()
const {
9021 if (
const auto *BT = dyn_cast<BuiltinType>(CanonicalType)) {
9022 return ((BT->getKind() >= BuiltinType::ShortAccum &&
9023 BT->getKind() <= BuiltinType::LongAccum) ||
9024 (BT->getKind() >= BuiltinType::ShortFract &&
9025 BT->getKind() <= BuiltinType::LongFract) ||
9026 (BT->getKind() >= BuiltinType::SatShortAccum &&
9027 BT->getKind() <= BuiltinType::SatLongAccum) ||
9028 (BT->getKind() >= BuiltinType::SatShortFract &&
9029 BT->getKind() <= BuiltinType::SatLongFract));
9034inline bool Type::isUnsignedFixedPointType()
const {
9035 return isFixedPointType() && !isSignedFixedPointType();
9038inline bool Type::isScalarType()
const {
9039 if (
const auto *BT = dyn_cast<BuiltinType>(CanonicalType))
9040 return BT->getKind() > BuiltinType::Void &&
9041 BT->getKind() <= BuiltinType::NullPtr;
9042 if (
const EnumType *ET = dyn_cast<EnumType>(CanonicalType))
9046 return isa<PointerType>(CanonicalType) ||
9047 isa<BlockPointerType>(CanonicalType) ||
9048 isa<MemberPointerType>(CanonicalType) ||
9049 isa<ComplexType>(CanonicalType) ||
9050 isa<ObjCObjectPointerType>(CanonicalType) ||
9054inline bool Type::isIntegralOrEnumerationType()
const {
9055 if (
const auto *BT = dyn_cast<BuiltinType>(CanonicalType))
9056 return BT->isInteger();
9060 if (
const auto *ET = dyn_cast<EnumType>(CanonicalType))
9063 return isBitIntType();
9066inline bool Type::isBooleanType()
const {
9067 if (
const auto *BT = dyn_cast<BuiltinType>(CanonicalType))
9068 return BT->getKind() == BuiltinType::Bool;
9072inline bool Type::isUndeducedType()
const {
9073 auto *DT = getContainedDeducedType();
9074 return DT && !DT->isDeduced();
9079inline bool Type::isOverloadableType()
const {
9080 if (!isDependentType())
9082 return !isArrayType() && !isFunctionType() && !isAnyPointerType() &&
9083 !isMemberPointerType();
9087inline bool Type::isTypedefNameType()
const {
9088 if (getAs<TypedefType>())
9090 if (
auto *TST = getAs<TemplateSpecializationType>())
9091 return TST->isTypeAlias();
9096inline bool Type::canDecayToPointerType()
const {
9097 return isFunctionType() || (isArrayType() && !isArrayParameterType());
9100inline bool Type::hasPointerRepresentation()
const {
9101 return (isPointerType() || isReferenceType() || isBlockPointerType() ||
9102 isObjCObjectPointerType() || isNullPtrType());
9105inline bool Type::hasObjCPointerRepresentation()
const {
9106 return isObjCObjectPointerType();
9109inline const Type *Type::getBaseElementTypeUnsafe()
const {
9116inline const Type *Type::getPointeeOrArrayElementType()
const {
9118 if (
type->isAnyPointerType())
9119 return type->getPointeeType().getTypePtr();
9120 else if (
type->isArrayType())
9121 return type->getBaseElementTypeUnsafe();
9129 DiagnosticsEngine::ArgumentKind::ak_addrspace);
9138 DiagnosticsEngine::ArgumentKind::ak_qual);
9146 PD.
AddTaggedVal(
reinterpret_cast<uint64_t
>(
T.getAsOpaquePtr()),
9147 DiagnosticsEngine::ak_qualtype);
9153template <
typename T>
9155 std::integral_constant<bool, std::is_same<T, ArrayType>::value ||
9156 std::is_base_of<ArrayType, T>::value>;
9159template <
typename T>
const T *Type::getAs()
const {
9161 "ArrayType cannot be used with getAs!");
9164 if (
const auto *Ty = dyn_cast<T>(
this))
9168 if (!isa<T>(CanonicalType))
9173 return cast<T>(getUnqualifiedDesugaredType());
9176template <
typename T>
const T *Type::getAsAdjusted()
const {
9180 if (
const auto *Ty = dyn_cast<T>(
this))
9184 if (!isa<T>(CanonicalType))
9189 const Type *Ty =
this;
9191 if (
const auto *A = dyn_cast<AttributedType>(Ty))
9192 Ty = A->getModifiedType().getTypePtr();
9193 else if (
const auto *A = dyn_cast<BTFTagAttributedType>(Ty))
9194 Ty = A->getWrappedType().getTypePtr();
9195 else if (
const auto *A = dyn_cast<HLSLAttributedResourceType>(Ty))
9196 Ty = A->getWrappedType().getTypePtr();
9197 else if (
const auto *
P = dyn_cast<ParenType>(Ty))
9198 Ty =
P->desugar().getTypePtr();
9199 else if (
const auto *A = dyn_cast<AdjustedType>(Ty))
9200 Ty = A->desugar().getTypePtr();
9201 else if (
const auto *M = dyn_cast<MacroQualifiedType>(Ty))
9202 Ty = M->desugar().getTypePtr();
9209 return dyn_cast<T>(Ty);
9214 if (
const auto *arr = dyn_cast<ArrayType>(
this))
9218 if (!isa<ArrayType>(CanonicalType))
9223 return cast<ArrayType>(getUnqualifiedDesugaredType());
9226template <
typename T>
const T *Type::castAs()
const {
9228 "ArrayType cannot be used with castAs!");
9230 if (
const auto *ty = dyn_cast<T>(
this))
return ty;
9231 assert(isa<T>(CanonicalType));
9232 return cast<T>(getUnqualifiedDesugaredType());
9235inline const ArrayType *Type::castAsArrayTypeUnsafe()
const {
9236 assert(isa<ArrayType>(CanonicalType));
9237 if (
const auto *arr = dyn_cast<ArrayType>(
this))
return arr;
9238 return cast<ArrayType>(getUnqualifiedDesugaredType());
9243 :
AdjustedType(Decayed, OriginalType, DecayedPtr, CanonicalPtr) {
9245 QualType Adjusted = getAdjustedType();
9247 assert(isa<PointerType>(Adjusted));
9254 return cast<PointerType>(Decayed)->getPointeeType();
9268 TypePtr = Pointee.getTypePtr();
9275 return FPT->getFunctionEffects();
Provides definitions for the various language-specific address spaces.
static bool isUnsigned(SValBuilder &SVB, NonLoc Value)
Defines the clang::attr::Kind enum.
Defines the Diagnostic-related interfaces.
static bool isBooleanType(QualType Ty)
llvm::dxil::ResourceClass ResourceClass
static std::optional< NonLoc > getIndex(ProgramStateRef State, const ElementRegion *ER, CharKind CK)
clang::CharUnits operator*(clang::CharUnits::QuantityType Scale, const clang::CharUnits &CU)
enum clang::sema::@1840::IndirectLocalPathEntry::EntryKind Kind
static void dump(llvm::raw_ostream &OS, StringRef FunctionName, ArrayRef< CounterExpression > Expressions, ArrayRef< CounterMappingRegion > Regions)
static Decl::Kind getKind(const Decl *D)
Defines the ExceptionSpecificationType enumeration and various utility functions.
static bool isRead(AccessKinds AK)
static QualType getObjectType(APValue::LValueBase B)
Retrieves the "underlying object type" of the given expression, as used by __builtin_object_size.
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified.
Defines the clang::LangOptions interface.
llvm::MachO::Record Record
static StringRef getIdentifier(const Token &Tok)
Implements a partial diagnostic that can be emitted anwyhere in a DiagnosticBuilder stream.
static QualType getUnderlyingType(const SubRegion *R)
static bool hasAttr(const Decl *D, bool IgnoreImplicitAttr)
static RecordDecl * getAsRecordDecl(QualType BaseType, HeuristicResolver &Resolver)
static bool isRecordType(QualType T)
static bool isParameterPack(Expr *PackExpression)
Defines the clang::SourceLocation class and associated facilities.
Defines various enumerations that describe declaration and type specifiers.
static QualType getPointeeType(const MemRegion *R)
static const TemplateTypeParmDecl * getReplacedParameter(Decl *D, unsigned Index)
Defines the clang::Visibility enumeration and various utility functions.
__DEVICE__ void * memcpy(void *__a, const void *__b, size_t __c)
__device__ __2f16 float __ockl_bool s
__device__ __2f16 float c
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Reads an AST files chain containing the contents of a translation unit.
Writes an AST file containing the contents of a translation unit.
Represents a type which was implicitly adjusted by the semantic engine for arbitrary reasons.
static bool classof(const Type *T)
static void Profile(llvm::FoldingSetNodeID &ID, QualType Orig, QualType New)
AdjustedType(TypeClass TC, QualType OriginalTy, QualType AdjustedTy, QualType CanonicalPtr)
QualType getAdjustedType() const
void Profile(llvm::FoldingSetNodeID &ID)
QualType getOriginalType() const
Represents a constant array type that does not decay to a pointer when used as a function parameter.
static bool classof(const Type *T)
Represents an array type, per C99 6.7.5.2 - Array Declarators.
ArraySizeModifier getSizeModifier() const
Qualifiers getIndexTypeQualifiers() const
static bool classof(const Type *T)
QualType getElementType() const
unsigned getIndexTypeCVRQualifiers() const
static void Profile(llvm::FoldingSetNodeID &ID, QualType T)
QualType getValueType() const
Gets the type contained by this atomic type, i.e.
void Profile(llvm::FoldingSetNodeID &ID)
static bool classof(const Type *T)
Attr - This represents one attribute.
An attributed type is a type to which a type attribute has been applied.
QualType getModifiedType() const
static bool classof(const Type *T)
const Attr * getAttr() const
static std::optional< NullabilityKind > stripOuterNullability(QualType &T)
Strip off the top-level nullability annotation on the given type, if it's there.
static void Profile(llvm::FoldingSetNodeID &ID, Kind attrKind, QualType modified, QualType equivalent, const Attr *attr)
QualType getEquivalentType() const
void Profile(llvm::FoldingSetNodeID &ID)
Represents a C++11 auto or C++14 decltype(auto) type, possibly constrained by a type-constraint.
ArrayRef< TemplateArgument > getTypeConstraintArguments() const
static bool classof(const Type *T)
bool isDecltypeAuto() const
AutoTypeKeyword getKeyword() const
bool isGNUAutoType() const
bool isConstrained() const
TemplateDecl * getTypeConstraintConcept() const
static bool classof(const Type *T)
const BTFTypeTagAttr * getAttr() const
QualType getWrappedType() const
void Profile(llvm::FoldingSetNodeID &ID)
static void Profile(llvm::FoldingSetNodeID &ID, QualType Wrapped, const BTFTypeTagAttr *BTFAttr)
A fixed int type of a specified bitwidth.
static bool classof(const Type *T)
static void Profile(llvm::FoldingSetNodeID &ID, bool IsUnsigned, unsigned NumBits)
void Profile(llvm::FoldingSetNodeID &ID) const
unsigned getNumBits() const
void Profile(llvm::FoldingSetNodeID &ID)
QualType getPointeeType() const
static bool classof(const Type *T)
static void Profile(llvm::FoldingSetNodeID &ID, QualType Pointee)
[BoundsSafety] Represents a parent type class for CountAttributedType and similar sugar types that wi...
decl_iterator dependent_decl_begin() const
decl_iterator dependent_decl_end() const
unsigned getNumCoupledDecls() const
decl_range dependent_decls() const
ArrayRef< TypeCoupledDeclRefInfo > getCoupledDecls() const
llvm::iterator_range< decl_iterator > decl_range
static bool classof(const Type *T)
ArrayRef< TypeCoupledDeclRefInfo > Decls
This class is used for builtin types like 'int'.
bool isPlaceholderType() const
Determines whether this type is a placeholder type, i.e.
bool isNonOverloadPlaceholderType() const
Determines whether this type is a placeholder type other than Overload.
bool isFloatingPoint() const
static bool classof(const Type *T)
bool isSignedInteger() const
bool isUnsignedInteger() const
static bool isPlaceholderTypeKind(Kind K)
Determines whether the given kind corresponds to a placeholder type.
const char * getNameAsCString(const PrintingPolicy &Policy) const
Represents a C++ struct/union/class.
Declaration of a class template.
Complex values, per C99 6.2.5p11.
QualType getElementType() const
static void Profile(llvm::FoldingSetNodeID &ID, QualType Element)
static bool classof(const Type *T)
void Profile(llvm::FoldingSetNodeID &ID)
Represents the canonical version of C arrays with a specified constant size.
unsigned getSizeBitWidth() const
Return the bit width of the size type.
ConstantArrayType(TypeClass Tc, const ConstantArrayType *ATy, QualType Can)
uint64_t getLimitedSize() const
Return the size zero-extended to uint64_t or UINT64_MAX if the value is larger than UINT64_MAX.
bool isZeroSize() const
Return true if the size is zero.
int64_t getSExtSize() const
Return the size sign-extended as a uint64_t.
const Expr * getSizeExpr() const
Return a pointer to the size expression.
static bool classof(const Type *T)
llvm::APInt getSize() const
Return the constant array size as an APInt.
void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Ctx)
uint64_t getZExtSize() const
Return the size zero-extended as a uint64_t.
Represents a concrete matrix type with constant number of rows and columns.
unsigned getNumColumns() const
Returns the number of columns in the matrix.
static void Profile(llvm::FoldingSetNodeID &ID, QualType ElementType, unsigned NumRows, unsigned NumColumns, TypeClass TypeClass)
void Profile(llvm::FoldingSetNodeID &ID)
static constexpr unsigned getMaxElementsPerDimension()
Returns the maximum number of elements per dimension.
unsigned getNumRows() const
Returns the number of rows in the matrix.
unsigned getNumElementsFlattened() const
Returns the number of elements required to embed the matrix into a vector.
static constexpr bool isDimensionValid(size_t NumElements)
Returns true if NumElements is a valid matrix dimension.
unsigned NumRows
Number of rows and columns.
static bool classof(const Type *T)
Represents a sugar type with __counted_by or __sized_by annotations, including their _or_null variant...
void Profile(llvm::FoldingSetNodeID &ID)
static bool classof(const Type *T)
bool isCountInBytes() const
Expr * getCountExpr() const
DynamicCountPointerKind getKind() const
Represents a pointer type decayed from an array or function type.
QualType getPointeeType() const
static bool classof(const Type *T)
QualType getDecayedType() const
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
Decl - This represents one declaration (or definition), e.g.
Represents the type decltype(expr) (C++11).
static bool classof(const Type *T)
Expr * getUnderlyingExpr() const
QualType getUnderlyingType() const
Represents a C++17 deduced template specialization type.
void Profile(llvm::FoldingSetNodeID &ID) const
TemplateName getTemplateName() const
Retrieve the name of the template that we are deducing.
static bool classof(const Type *T)
static void Profile(llvm::FoldingSetNodeID &ID, ElaboratedTypeKeyword Keyword, TemplateName Template, QualType Deduced, bool IsDependent)
Common base class for placeholders for types that get replaced by placeholder type deduction: C++11 a...
static bool classof(const Type *T)
QualType getDeducedType() const
Get the type deduced for this placeholder type, or null if it has not been deduced.
DeducedType(TypeClass TC, QualType DeducedAsType, TypeDependence ExtraDependence, QualType Canon)
Represents an extended address space qualifier where the input address space value is dependent.
Expr * getAddrSpaceExpr() const
void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Context)
QualType getPointeeType() const
static bool classof(const Type *T)
SourceLocation getAttributeLoc() const
void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Context)
static bool classof(const Type *T)
Internal representation of canonical, dependent decltype(expr) types.
void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Context)
Represents a qualified type name for which the type name is dependent.
static void Profile(llvm::FoldingSetNodeID &ID, ElaboratedTypeKeyword Keyword, NestedNameSpecifier NNS, const IdentifierInfo *Name)
static bool classof(const Type *T)
NestedNameSpecifier getQualifier() const
Retrieve the qualification on this type.
const IdentifierInfo * getIdentifier() const
Retrieve the identifier that terminates this type name.
void Profile(llvm::FoldingSetNodeID &ID)
Represents an array type in C++ whose size is a value-dependent expression.
void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Context)
static bool classof(const Type *T)
Expr * getSizeExpr() const
Represents an extended vector type where either the type or size is dependent.
Expr * getSizeExpr() const
static bool classof(const Type *T)
SourceLocation getAttributeLoc() const
void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Context)
QualType getElementType() const
Represents a matrix type where the type and the number of rows and columns is dependent on a template...
Expr * getColumnExpr() const
Expr * getRowExpr() const
void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Context)
SourceLocation getAttributeLoc() const
static bool classof(const Type *T)
Represents a template specialization type whose template cannot be resolved, e.g.
void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Context)
const DependentTemplateStorage & getDependentTemplateName() const
ArrayRef< TemplateArgument > template_arguments() const
static bool classof(const Type *T)
Represents a dependent template name that cannot be resolved prior to template instantiation.
Internal representation of canonical, dependent typeof(expr) types.
void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Context)
DependentTypeOfExprType(const ASTContext &Context, Expr *E, TypeOfKind Kind)
Represents a vector type where either the type or size is dependent.
Expr * getSizeExpr() const
VectorKind getVectorKind() const
SourceLocation getAttributeLoc() const
QualType getElementType() const
void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Context)
static bool classof(const Type *T)
Wrap a function effect's condition expression in another struct so that FunctionProtoType's TrailingO...
EffectConditionExpr(Expr *E)
Expr * getCondition() const
bool operator==(const EffectConditionExpr &RHS) const
EffectConditionExpr()=default
A helper class that allows the use of isa/cast/dyncast to detect TagType objects of enums.
EnumDecl * getOriginalDecl() const
static bool classof(const Type *T)
This represents one expression.
Base class that is common to both the ExtQuals and Type classes, which allows QualType to access the ...
We can encode up to four bits in the low bits of a type pointer, but there are many more type qualifi...
Qualifiers::ObjCLifetime getObjCLifetime() const
static void Profile(llvm::FoldingSetNodeID &ID, const Type *BaseType, Qualifiers Quals)
void Profile(llvm::FoldingSetNodeID &ID) const
ExtQuals(const Type *baseType, QualType canon, Qualifiers quals)
bool hasObjCGCAttr() const
Qualifiers::GC getObjCGCAttr() const
bool hasAddressSpace() const
const Type * getBaseType() const
Qualifiers getQualifiers() const
LangAS getAddressSpace() const
bool hasObjCLifetime() const
ExtVectorType - Extended vector type.
bool isAccessorWithinNumElements(char c, bool isNumericAccessor) const
static int getNumericAccessorIdx(char c)
static bool classof(const Type *T)
static int getPointAccessorIdx(char c)
static int getAccessorIdx(char c, bool isNumericAccessor)
Represents a function declaration or definition.
Support iteration in parallel through a pair of FunctionEffect and EffectConditionExpr containers.
bool operator==(const FunctionEffectIterator &Other) const
bool operator!=(const FunctionEffectIterator &Other) const
FunctionEffectIterator operator++()
FunctionEffectIterator(const Container &O, size_t I)
FunctionEffectWithCondition operator*() const
A mutable set of FunctionEffect::Kind.
static FunctionEffectKindSet difference(FunctionEffectKindSet LHS, FunctionEffectKindSet RHS)
bool contains(const FunctionEffect::Kind EK) const
FunctionEffectKindSet()=default
FunctionEffectKindSet(FunctionEffectsRef FX)
void insert(FunctionEffectKindSet Set)
void insert(FunctionEffectsRef FX)
void insert(FunctionEffect Effect)
A mutable set of FunctionEffects and possibly conditions attached to them.
FunctionEffectSet(const FunctionEffectsRef &FX)
FunctionEffectSet()=default
Represents an abstract function effect, using just an enumeration describing its kind.
Kind kind() const
The kind of the effect.
friend bool operator<(FunctionEffect LHS, FunctionEffect RHS)
friend bool operator==(FunctionEffect LHS, FunctionEffect RHS)
uint32_t toOpaqueInt32() const
For serialization.
friend bool operator!=(FunctionEffect LHS, FunctionEffect RHS)
Kind
Identifies the particular effect.
Flags flags() const
Flags describing some behaviors of the effect.
StringRef name() const
The description printed in diagnostics, e.g. 'nonblocking'.
static FunctionEffect fromOpaqueInt32(uint32_t Value)
friend raw_ostream & operator<<(raw_ostream &OS, const FunctionEffect &Effect)
An immutable set of FunctionEffects and possibly conditions attached to them.
ArrayRef< FunctionEffect > effects() const
ArrayRef< EffectConditionExpr > conditions() const
FunctionEffectsRef()=default
friend bool operator==(const FunctionEffectsRef &LHS, const FunctionEffectsRef &RHS)
static FunctionEffectsRef get(QualType QT)
Extract the effects from a Type if it is a function, block, or member function pointer,...
friend bool operator!=(const FunctionEffectsRef &LHS, const FunctionEffectsRef &RHS)
Represents a K&R-style 'int foo()' function, which has no information available about its arguments.
static void Profile(llvm::FoldingSetNodeID &ID, QualType ResultType, ExtInfo Info)
static bool classof(const Type *T)
void Profile(llvm::FoldingSetNodeID &ID)
Represents a prototype with parameter type info, e.g.
param_type_iterator param_type_begin() const
unsigned getNumFunctionEffectConditions() const
ExtParameterInfo getExtParameterInfo(unsigned I) const
ArrayRef< EffectConditionExpr > getFunctionEffectConditions() const
ExceptionSpecificationType getExceptionSpecType() const
Get the kind of exception specification on this function.
ArrayRef< FunctionEffect > getFunctionEffectsWithoutConditions() const
bool isParamConsumed(unsigned I) const
exception_iterator exception_end() const
const ExtParameterInfo * getExtParameterInfosOrNull() const
Return a pointer to the beginning of the array of extra parameter information, if present,...
unsigned getNumParams() const
bool hasTrailingReturn() const
Whether this function prototype has a trailing return type.
ExceptionSpecInfo getExceptionSpecInfo() const
Return all the available information about this type's exception spec.
Qualifiers getMethodQuals() const
static bool classof(const Type *T)
QualType getParamType(unsigned i) const
FunctionEffectsRef getFunctionEffects() const
unsigned getAArch64SMEAttributes() const
Return a bitmask describing the SME attributes on the function type, see AArch64SMETypeAttributes for...
QualType getExceptionType(unsigned i) const
Return the ith exception type, where 0 <= i < getNumExceptions().
static void Profile(llvm::FoldingSetNodeID &ID, QualType Result, param_type_iterator ArgTys, unsigned NumArgs, const ExtProtoInfo &EPI, const ASTContext &Context, bool Canonical)
SourceLocation getEllipsisLoc() const
unsigned getNumFunctionEffects() const
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.
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
bool operator==(ExtInfo Other) const
bool getProducesResult() const
ExtInfo withNoCallerSavedRegs(bool noCallerSavedRegs) const
ExtInfo withCmseNSCall(bool cmseNSCall) const
ExtInfo withRegParm(unsigned RegParm) const
bool operator!=(ExtInfo Other) const
Interesting information about a specific parameter that can't simply be reflected in parameter's type...
friend bool operator==(ExtParameterInfo lhs, ExtParameterInfo rhs)
friend bool operator!=(ExtParameterInfo lhs, ExtParameterInfo rhs)
ExtParameterInfo()=default
bool hasPassObjectSize() const
ExtParameterInfo withHasPassObjectSize() const
unsigned char getOpaqueValue() const
bool isConsumed() const
Is this parameter considered "consumed" by Objective-C ARC? Consumed parameters must have retainable ...
ParameterABI getABI() const
Return the ABI treatment of this parameter.
ExtParameterInfo withIsConsumed(bool consumed) const
ExtParameterInfo withIsNoEscape(bool NoEscape) const
ExtParameterInfo withABI(ParameterABI kind) const
static ExtParameterInfo getFromOpaqueValue(unsigned char data)
FunctionType - C99 6.7.5.3 - Function Declarators.
ExtInfo getExtInfo() const
AArch64SMETypeAttributes
The AArch64 SME ACLE (Arm C/C++ Language Extensions) define a number of function type attributes that...
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.
QualType getWrappedType() const
bool hasContainedType() const
const Attributes & getAttrs() const
static bool classof(const Type *T)
static void Profile(llvm::FoldingSetNodeID &ID, QualType Wrapped, QualType Contained, const Attributes &Attrs)
QualType getContainedType() const
void Profile(llvm::FoldingSetNodeID &ID)
Represents an arbitrary, user-specified SPIR-V type instruction.
static void Profile(llvm::FoldingSetNodeID &ID, uint32_t Opcode, uint32_t Size, uint32_t Alignment, ArrayRef< SpirvOperand > Operands)
uint32_t getAlignment() const
static bool classof(const Type *T)
uint32_t getOpcode() const
ArrayRef< SpirvOperand > getOperands() const
void Profile(llvm::FoldingSetNodeID &ID)
One of these records is kept for each identifier that is lexed.
Represents a C array with an unspecified size.
void Profile(llvm::FoldingSetNodeID &ID)
static void Profile(llvm::FoldingSetNodeID &ID, QualType ET, ArraySizeModifier SizeMod, unsigned TypeQuals)
static bool classof(const Type *T)
The injected class name of a C++ class template or class template partial specialization.
static bool classof(const Type *T)
CXXRecordDecl * getOriginalDecl() const
KeywordWrapper(ElaboratedTypeKeyword Keyword, As &&...as)
ElaboratedTypeKeyword getKeyword() const
static CannotCastToThisType classof(const T *)
An lvalue reference type, per C++11 [dcl.ref].
static bool classof(const Type *T)
Sugar type that represents a type that was qualified by a qualifier written as a macro invocation.
static bool classof(const Type *T)
QualType getUnderlyingType() const
const IdentifierInfo * getMacroIdentifier() const
Represents a matrix type, as defined in the Matrix Types clang extensions.
QualType getElementType() const
Returns type of the elements being stored in the matrix.
MatrixType(QualType ElementTy, QualType CanonElementTy)
static bool isValidElementType(QualType T)
Valid elements types are the following:
QualType ElementType
The element type of the matrix.
static bool classof(const Type *T)
A pointer to member type per C++ 8.3.3 - Pointers to members.
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>::".
void Profile(llvm::FoldingSetNodeID &ID) const
Represents an ObjC class declaration.
Interfaces are the core concept in Objective-C for object oriented design.
static bool classof(const Type *T)
Represents a pointer to an Objective C object.
unsigned getNumProtocols() const
Return the number of qualifying protocols on the object type.
bool isSpecialized() const
Whether this type is specialized, meaning that it has type arguments.
qual_iterator qual_end() const
bool isObjCQualifiedClassType() const
True if this is equivalent to 'Class.
static void Profile(llvm::FoldingSetNodeID &ID, QualType T)
bool isObjCQualifiedIdType() const
True if this is equivalent to 'id.
bool isSpecializedAsWritten() const
Whether this type is specialized, meaning that it has type arguments.
bool isUnspecializedAsWritten() const
Determine whether this object type is "unspecialized" as written, meaning that it has no type argumen...
ArrayRef< QualType > getTypeArgsAsWritten() const
Retrieve the type arguments for this type.
void Profile(llvm::FoldingSetNodeID &ID)
const ObjCObjectType * getObjectType() const
Gets the type pointed to by this ObjC pointer.
ObjCObjectType::qual_iterator qual_iterator
An iterator over the qualifiers on the object type.
llvm::iterator_range< qual_iterator > qual_range
static bool classof(const Type *T)
bool isUnspecialized() const
Whether this type is unspecialized, meaning that is has no type arguments.
bool isObjCIdType() const
True if this is equivalent to the 'id' type, i.e.
ObjCProtocolDecl * getProtocol(unsigned I) const
Retrieve a qualifying protocol by index on the object type.
QualType getPointeeType() const
Gets the type pointed to by this ObjC pointer.
ObjCInterfaceDecl * getInterfaceDecl() const
If this pointer points to an Objective @interface type, gets the declaration for that interface.
bool isObjCClassType() const
True if this is equivalent to the 'Class' type, i.e.
bool isObjCIdOrClassType() const
True if this is equivalent to the 'id' or 'Class' type,.
ArrayRef< QualType > getTypeArgs() const
Retrieve the type arguments for this type.
qual_iterator qual_begin() const
bool isKindOfType() const
Whether this is a "__kindof" type.
A class providing a concrete implementation of ObjCObjectType, so as to not increase the footprint of...
Represents a class type in Objective C.
bool isKindOfTypeAsWritten() const
Whether this is a "__kindof" type as written.
ArrayRef< QualType > getTypeArgsAsWritten() const
Retrieve the type arguments of this object type as they were written.
bool isUnspecializedAsWritten() const
Determine whether this object type is "unspecialized" as written, meaning that it has no type argumen...
bool isObjCQualifiedClass() const
ObjCObjectType(enum Nonce_ObjCInterface)
bool isObjCUnqualifiedIdOrClass() const
QualType getBaseType() const
Gets the base type of this object type.
bool isObjCQualifiedId() const
bool isSpecializedAsWritten() const
Determine whether this object type was written with type arguments.
bool isObjCUnqualifiedId() const
bool isUnspecialized() const
Determine whether this object type is "unspecialized", meaning that it has no type arguments.
bool isObjCUnqualifiedClass() const
static bool classof(const Type *T)
QualType getSuperClassType() const
Retrieve the type of the superclass of this object type.
Represents an Objective-C protocol declaration.
This class wraps the list of protocol qualifiers.
llvm::iterator_range< qual_iterator > qual_range
void initialize(ArrayRef< ObjCProtocolDecl * > protocols)
ObjCProtocolDecl ** getProtocolStorage()
ArrayRef< ObjCProtocolDecl * > getProtocols() const
Retrieve all of the protocol qualifiers.
unsigned getNumProtocols() const
Return the number of qualifying protocols in this type, or 0 if there are none.
void setNumProtocols(unsigned N)
qual_iterator qual_end() const
ObjCProtocolDecl *const * getProtocolStorage() const
ObjCProtocolDecl * getProtocol(unsigned I) const
Fetch a protocol by index.
qual_iterator qual_begin() const
ObjCProtocolQualifiers()=default
ObjCProtocolDecl *const * qual_iterator
Represents the declaration of an Objective-C type parameter.
Represents a type parameter type in Objective C.
static bool classof(const Type *T)
ObjCTypeParamDecl * getDecl() const
Represents a pack expansion of types.
UnsignedOrNone getNumExpansions() const
Retrieve the number of expansions that this pack expansion will generate, if known.
void Profile(llvm::FoldingSetNodeID &ID)
static bool classof(const Type *T)
static void Profile(llvm::FoldingSetNodeID &ID, QualType Pattern, UnsignedOrNone NumExpansions)
QualType getPattern() const
Retrieve the pattern of this pack expansion, which is the type that will be repeatedly instantiated w...
bool hasSelectedType() const
QualType getPattern() const
QualType getSelectedType() const
bool isFullySubstituted() const
ArrayRef< QualType > getExpansions() const
Expr * getIndexExpr() const
static bool classof(const Type *T)
bool expandsToEmptyPack() const
Sugar for parentheses used when specifying types.
void Profile(llvm::FoldingSetNodeID &ID)
static bool classof(const Type *T)
static void Profile(llvm::FoldingSetNodeID &ID, QualType Inner)
QualType getInnerType() const
static void Profile(llvm::FoldingSetNodeID &ID, QualType T, bool isRead)
QualType getElementType() const
void Profile(llvm::FoldingSetNodeID &ID)
static bool classof(const Type *T)
Pointer-authentication qualifiers.
static PointerAuthQualifier fromOpaqueValue(uint32_t Opaque)
friend bool operator==(PointerAuthQualifier Lhs, PointerAuthQualifier Rhs)
bool isIsaPointer() const
static PointerAuthQualifier Create(unsigned Key, bool IsAddressDiscriminated, unsigned ExtraDiscriminator, PointerAuthenticationMode AuthenticationMode, bool IsIsaPointer, bool AuthenticatesNullValues)
friend bool operator!=(PointerAuthQualifier Lhs, PointerAuthQualifier Rhs)
bool authenticatesNullValues() const
bool isEquivalent(PointerAuthQualifier Other) const
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
@ MaxDiscriminator
The maximum supported pointer-authentication discriminator.
@ MaxKey
The maximum supported pointer-authentication key.
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)
void Profile(llvm::FoldingSetNodeID &ID)
static void Profile(llvm::FoldingSetNodeID &ID, QualType Pointee)
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...
Qualifiers::ObjCLifetime getObjCLifetime() const
Returns lifetime attribute of this type.
QualType stripObjCKindOfType(const ASTContext &ctx) const
Strip Objective-C "__kindof" types from the given type.
void print(raw_ostream &OS, const PrintingPolicy &Policy, const Twine &PlaceHolder=Twine(), unsigned Indentation=0) const
void getAsStringInternal(std::string &Str, const PrintingPolicy &Policy) const
bool isReferenceable() const
QualType getNonReferenceType() const
If Type is a reference type (e.g., const int&), returns the type that the reference refers to ("const...
QualType getCanonicalType() const
QualType getUnqualifiedType() const
Retrieve the unqualified variant of the given type, removing as little sugar as possible.
void removeLocalVolatile()
QualType substObjCMemberType(QualType objectType, const DeclContext *dc, ObjCSubstitutionContext context) const
Substitute type arguments from an object type for the Objective-C type parameters used in the subject...
bool isWebAssemblyReferenceType() const
Returns true if it is a WebAssembly Reference Type.
SplitQualType getSplitDesugaredType() const
std::optional< NonConstantStorageReason > isNonConstantStorage(const ASTContext &Ctx, bool ExcludeCtor, bool ExcludeDtor)
Determine whether instances of this type can be placed in immutable storage.
QualType withCVRQualifiers(unsigned CVR) const
unsigned getLocalCVRQualifiers() const
Retrieve the set of CVR (const-volatile-restrict) qualifiers local to this particular QualType instan...
SplitQualType split() const
Divides a QualType into its unqualified type and a set of local qualifiers.
bool UseExcessPrecision(const ASTContext &Ctx)
void addVolatile()
Add the volatile type qualifier to this QualType.
bool isCForbiddenLValueType() const
Determine whether expressions of the given type are forbidden from being lvalues in C.
PrimitiveDefaultInitializeKind isNonTrivialToPrimitiveDefaultInitialize() const
Functions to query basic properties of non-trivial C struct types.
bool isObjCGCStrong() const
true when Type is objc's strong.
std::string getAsString() const
void * getAsOpaquePtr() const
static void print(SplitQualType split, raw_ostream &OS, const PrintingPolicy &policy, const Twine &PlaceHolder, unsigned Indentation=0)
bool isMoreQualifiedThan(QualType Other, const ASTContext &Ctx) const
Determine whether this type is more qualified than the other given type, requiring exact equality for...
bool isCanonicalAsParam() const
void removeLocalRestrict()
bool isWebAssemblyExternrefType() const
Returns true if it is a WebAssembly Externref Type.
QualType(const Type *Ptr, unsigned Quals)
QualType getNonPackExpansionType() const
Remove an outer pack expansion type (if any) from this type.
SplitQualType getSplitUnqualifiedType() const
Retrieve the unqualified variant of the given type, removing as little sugar as possible.
bool isCXX11PODType(const ASTContext &Context) const
Return true if this is a POD type according to the more relaxed rules of the C++11 standard,...
bool mayBeNotDynamicClass() const
Returns true if it is not a class or if the class might not be dynamic.
bool isConstQualified() const
Determine whether this type is const-qualified.
bool hasAddressSpace() const
Check if this type has any address space qualifier.
bool isObjCGCWeak() const
true when Type is objc's weak.
QualType substObjCTypeArgs(ASTContext &ctx, ArrayRef< QualType > typeArgs, ObjCSubstitutionContext context) const
Substitute type arguments for the Objective-C type parameters used in the subject type.
unsigned getLocalFastQualifiers() const
void removeLocalFastQualifiers()
QualType getAtomicUnqualifiedType() const
Remove all qualifiers including _Atomic.
DestructionKind isDestructedType() const
Returns a nonzero value if objects of this type require non-trivial work to clean up after.
friend bool operator<(const QualType &LHS, const QualType &RHS)
friend bool operator!=(const QualType &LHS, const QualType &RHS)
StreamedQualTypeHelper stream(const PrintingPolicy &Policy, const Twine &PlaceHolder=Twine(), unsigned Indentation=0) const
bool isLocalVolatileQualified() const
Determine whether this particular QualType instance has the "volatile" qualifier set,...
bool isConstantStorage(const ASTContext &Ctx, bool ExcludeCtor, bool ExcludeDtor)
unsigned getCVRQualifiers() const
Retrieve the set of CVR (const-volatile-restrict) qualifiers applied to this type.
static void getAsStringInternal(SplitQualType split, std::string &out, const PrintingPolicy &policy)
QualType getSingleStepDesugaredType(const ASTContext &Context) const
Return the specified type with one level of "sugar" removed from the type.
const Type * getTypePtrOrNull() const
static std::string getAsString(SplitQualType split, const PrintingPolicy &Policy)
bool hasNonTrivialObjCLifetime() const
bool isPODType(const ASTContext &Context) const
Determine whether this is a Plain Old Data (POD) type (C++ 3.9p10).
bool isAtLeastAsQualifiedAs(QualType Other, const ASTContext &Ctx) const
Determine whether this type is at least as qualified as the other given type, requiring exact equalit...
bool hasStrongOrWeakObjCLifetime() const
PrimitiveCopyKind isNonTrivialToPrimitiveDestructiveMove() const
Check if this is a non-trivial type that would cause a C struct transitively containing this type to ...
QualType withExactLocalFastQualifiers(unsigned TQs) const
@ NonConstNonReferenceType
@ PCK_Struct
The type is a struct containing a field whose type is neither PCK_Trivial nor PCK_VolatileTrivial.
@ PCK_Trivial
The type does not fall into any of the following categories.
@ PCK_ARCStrong
The type is an Objective-C retainable pointer type that is qualified with the ARC __strong qualifier.
@ PCK_VolatileTrivial
The type would be trivial except that it is volatile-qualified.
@ PCK_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...
A qualifier set is used to build a set of qualifiers.
const Type * strip(QualType type)
Collect any qualifiers on the given type and return an unqualified type.
QualifierCollector(Qualifiers Qs=Qualifiers())
QualifiersAndAtomic & operator+=(Qualifiers RHS)
QualifiersAndAtomic withVolatile()
QualifiersAndAtomic withAtomic()
QualifiersAndAtomic withConst()
QualifiersAndAtomic(Qualifiers Quals, bool HasAtomic)
QualifiersAndAtomic withRestrict()
The collection of all-type qualifiers we support.
unsigned getCVRQualifiers() const
void removeCVRQualifiers(unsigned mask)
friend Qualifiers operator-(Qualifiers L, Qualifiers R)
Compute the difference between two qualifier sets.
static Qualifiers fromFastMask(unsigned Mask)
void setFastQualifiers(unsigned mask)
void addAddressSpace(LangAS space)
static Qualifiers removeCommonQualifiers(Qualifiers &L, Qualifiers &R)
Returns the common set of qualifiers while removing them from the given sets.
bool hasOnlyConst() const
@ OCL_Strong
Assigning into this object requires the old value to be released and the new value to be retained.
@ OCL_ExplicitNone
This object can be modified without requiring retains or releases.
@ OCL_None
There is no lifetime qualification on this type.
@ OCL_Weak
Reading or writing from this object requires a barrier call.
@ OCL_Autoreleasing
Assigning into this object requires a lifetime extension.
void removeObjCLifetime()
bool hasTargetSpecificAddressSpace() const
bool isStrictSupersetOf(Qualifiers Other) const
Determine whether this set of qualifiers is a strict superset of another set of qualifiers,...
bool hasNonFastQualifiers() const
Return true if the set contains any qualifiers which require an ExtQuals node to be allocated.
void Profile(llvm::FoldingSetNodeID &ID) const
bool operator!=(Qualifiers Other) const
bool hasNonTrivialObjCLifetime() const
True if the lifetime is neither None or ExplicitNone.
void addCVRQualifiers(unsigned mask)
bool hasCVRQualifiers() const
void addConsistentQualifiers(Qualifiers qs)
Add the qualifiers from the given set to this set, given that they don't conflict.
void removeFastQualifiers(unsigned mask)
static bool isTargetAddressSpaceSupersetOf(LangAS A, LangAS B, const ASTContext &Ctx)
Qualifiers & operator+=(Qualifiers R)
void removeFastQualifiers()
bool hasQualifiers() const
Return true if the set contains any qualifiers.
void removeCVRQualifiers()
Qualifiers withVolatile() const
void addCVRUQualifiers(unsigned mask)
Qualifiers & operator-=(Qualifiers R)
bool compatiblyIncludes(Qualifiers other, const ASTContext &Ctx) const
Determines if these qualifiers compatibly include another set.
bool hasUnaligned() const
unsigned getAddressSpaceAttributePrintValue() const
Get the address space attribute value to be printed by diagnostics.
bool hasAddressSpace() const
static bool isAddressSpaceSupersetOf(LangAS A, LangAS B, const ASTContext &Ctx)
Returns true if address space A is equal to or a superset of B.
Qualifiers withoutAddressSpace() const
unsigned getFastQualifiers() const
void print(raw_ostream &OS, const PrintingPolicy &Policy, bool appendSpaceIfNonEmpty=false) const
void removeAddressSpace()
void addQualifiers(Qualifiers Q)
Add the qualifiers from the given set to this set.
static Qualifiers fromCVRMask(unsigned CVR)
void setAddressSpace(LangAS space)
@ FastWidth
The width of the "fast" qualifier mask.
@ MaxAddressSpace
The maximum supported address space number.
@ FastMask
The fast qualifier mask.
unsigned getCVRUQualifiers() const
bool isEmptyWhenPrinted(const PrintingPolicy &Policy) const
PointerAuthQualifier getPointerAuth() const
void setObjCGCAttr(GC type)
Qualifiers withConst() const
bool hasObjCGCAttr() const
uint64_t getAsOpaqueValue() const
void setCVRQualifiers(unsigned mask)
bool hasObjCLifetime() const
ObjCLifetime getObjCLifetime() const
Qualifiers withoutObjCLifetime() const
Qualifiers withoutObjCGCAttr() const
static Qualifiers fromCVRUMask(unsigned CVRU)
friend Qualifiers operator+(Qualifiers L, Qualifiers R)
void setUnaligned(bool flag)
void addFastQualifiers(unsigned mask)
std::string getAsString() const
Qualifiers withRestrict() const
void addPointerAuth(PointerAuthQualifier Q)
void addObjCGCAttr(GC type)
bool hasPointerAuth() const
bool operator==(Qualifiers Other) const
void removeQualifiers(Qualifiers Q)
Remove the qualifiers from the given set from this set.
LangAS getAddressSpace() const
bool hasOnlyVolatile() const
void setPointerAuth(PointerAuthQualifier Q)
bool compatiblyIncludesObjCLifetime(Qualifiers other) const
Determines if these qualifiers compatibly include another set of qualifiers from the narrow perspecti...
Qualifiers getNonFastQualifiers() const
static Qualifiers fromOpaqueValue(uint64_t opaque)
bool hasStrongOrWeakObjCLifetime() const
True if the lifetime is either strong or weak.
static std::string getAddrSpaceAsString(LangAS AS)
bool hasFastQualifiers() const
bool hasOnlyRestrict() const
bool isAddressSpaceSupersetOf(Qualifiers other, const ASTContext &Ctx) const
Returns true if the address space in these qualifiers is equal to or a superset of the address space ...
void addObjCLifetime(ObjCLifetime type)
void setObjCLifetime(ObjCLifetime type)
An rvalue reference type, per C++11 [dcl.ref].
static bool classof(const Type *T)
Represents a struct/union/class.
A helper class that allows the use of isa/cast/dyncast to detect TagType objects of structs/unions/cl...
RecordDecl * getOriginalDecl() const
static bool classof(const Type *T)
Base for LValueReferenceType and RValueReferenceType.
QualType getPointeeType() const
ReferenceType(TypeClass tc, QualType Referencee, QualType CanonicalRef, bool SpelledAsLValue)
static bool classof(const Type *T)
QualType getPointeeTypeAsWritten() const
bool isSpelledAsLValue() const
void Profile(llvm::FoldingSetNodeID &ID)
static void Profile(llvm::FoldingSetNodeID &ID, QualType Referencee, bool SpelledAsLValue)
Encodes a location in the source.
Instances of this class represent operands to a SPIR-V type instruction.
@ TypeId
Type to represent as a SPIR-V type ID.
@ Literal
Integral value to represent as an immediate literal.
static SpirvOperand createConstant(QualType ResultType, llvm::APInt Val)
SpirvOperand & operator=(const SpirvOperand &Other)=default
static SpirvOperand createType(QualType T)
bool operator==(const SpirvOperand &Other) const
SpirvOperand(SpirvOperandKind Kind, QualType ResultType, llvm::APInt Value)
llvm::APInt getValue() const
void Profile(llvm::FoldingSetNodeID &ID) const
bool operator!=(const SpirvOperand &Other) const
SpirvOperandKind getKind() const
QualType getResultType() const
static SpirvOperand createLiteral(llvm::APInt Val)
SpirvOperand(const SpirvOperand &Other)
Stmt - This represents one statement.
The streaming interface shared between DiagnosticBuilder and PartialDiagnostic.
void AddTaggedVal(uint64_t V, DiagnosticsEngine::ArgumentKind Kind) const
Represents the result of substituting a builtin template as a pack.
static bool classof(const Type *T)
Represents the result of substituting a set of types as a template argument that needs to be expanded...
unsigned getNumArgs() const
static bool classof(const Type *T)
Represents the result of substituting a set of types for a template type parameter pack.
unsigned getIndex() const
Returns the index of the replaced parameter in the associated declaration.
static bool classof(const Type *T)
Represents the result of substituting a type for a template type parameter.
unsigned getFinal() const
void Profile(llvm::FoldingSetNodeID &ID)
static bool classof(const Type *T)
Decl * getAssociatedDecl() const
A template-like entity which owns the whole pattern being substituted.
QualType getReplacementType() const
Gets the type that was substituted for the template parameter.
unsigned getIndex() const
Returns the index of the replaced parameter in the associated declaration.
UnsignedOrNone getPackIndex() const
Represents the declaration of a struct/union/class/enum.
static bool classof(const Type *T)
TagDecl * getOriginalDecl() const
bool isTagOwned() const
Does the TagType own this declaration of the Tag?
A convenient class for passing around template argument information.
Represents a template argument.
The base class of all kinds of template declarations (e.g., class, function, etc.).
Represents a C++ template name within the type system.
Represents a type template specialization; the template must be a class template, a type alias templa...
ArrayRef< TemplateArgument > template_arguments() const
static bool classof(const Type *T)
TemplateName getTemplateName() const
Retrieve the name of the template that we are specializing.
bool isTypeAlias() const
Determine if this template specialization type is for a type alias template that has been substituted...
bool isCurrentInstantiation() const
True if this template specialization type matches a current instantiation in the context in which it ...
Declaration of a template type parameter.
TemplateTypeParmDecl * getDecl() const
bool isParameterPack() const
void Profile(llvm::FoldingSetNodeID &ID)
unsigned getIndex() const
static bool classof(const Type *T)
static void Profile(llvm::FoldingSetNodeID &ID, unsigned Depth, unsigned Index, bool ParameterPack, TemplateTypeParmDecl *TTPDecl)
unsigned getDepth() const
[BoundsSafety] Represents information of declarations referenced by the arguments of the counted_by a...
llvm::PointerIntPair< ValueDecl *, 1, unsigned > BaseTy
Base wrapper for a particular "section" of type source info.
Represents a typeof (or typeof) expression (a C23 feature and GCC extension) or a typeof_unqual expre...
static bool classof(const Type *T)
TypeOfKind getKind() const
Returns the kind of 'typeof' type this is.
Expr * getUnderlyingExpr() const
Represents typeof(type), a C23 feature and GCC extension, or `typeof_unqual(type),...
static bool classof(const Type *T)
TypeOfKind getKind() const
Returns the kind of 'typeof' type this is.
bool isSugared() const
Returns whether this type directly provides sugar.
QualType getUnmodifiedType() const
A container of type source information.
QualType getType() const
Return the type wrapped by this type source info.
void overrideType(QualType T)
Override the type stored in this TypeSourceInfo. Use with caution!
A helper class for Type nodes having an ElaboratedTypeKeyword.
TypeWithKeyword(ElaboratedTypeKeyword Keyword, TypeClass tc, QualType Canonical, TypeDependence Dependence)
FunctionTypeBitfields store various bits belonging to FunctionProtoType.
The base class of the type hierarchy.
bool isIncompleteOrObjectType() const
Return true if this is an incomplete or object type, in other words, not a function type.
TypedefBitfields TypedefBits
bool isBooleanType() const
Type(const Type &)=delete
ReferenceTypeBitfields ReferenceTypeBits
ArrayTypeBitfields ArrayTypeBits
VectorTypeBitfields VectorTypeBits
SubstPackTypeBitfields SubstPackTypeBits
const TemplateSpecializationType * castAsNonAliasTemplateSpecializationType() const
TypeOfBitfields TypeOfBits
const T * castAs() const
Member-template castAs<specific type>.
BuiltinTypeBitfields BuiltinTypeBits
bool isReferenceType() const
bool isEnumeralType() const
bool isVisibilityExplicit() const
Return true if the visibility was explicitly set is the code.
void addDependence(TypeDependence D)
ConstantArrayTypeBitfields ConstantArrayTypeBits
Type(TypeClass tc, QualType canon, TypeDependence Dependence)
CountAttributedTypeBitfields CountAttributedTypeBits
QualType getPointeeType() const
If this is a pointer, ObjC object pointer, or block pointer, this returns the respective pointee.
Type & operator=(const Type &)=delete
AutoType * getContainedAutoType() const
Get the AutoType whose type will be deduced for a variable with an initializer of this type.
bool isInstantiationDependentType() const
Determine whether this type is an instantiation-dependent type, meaning that the type involves a temp...
bool isDependentType() const
Whether this type is a dependent type, meaning that its definition somehow depends on a template para...
DependentTemplateSpecializationTypeBitfields DependentTemplateSpecializationTypeBits
bool containsUnexpandedParameterPack() const
Whether this type is or contains an unexpanded parameter pack, used to support C++0x variadic templat...
QualType getCanonicalTypeInternal() const
PresefinedSugarTypeBitfields PredefinedSugarTypeBits
bool containsErrors() const
Whether this type is an error type.
const Type * getBaseElementTypeUnsafe() const
Get the base element type of this type, potentially discarding type qualifiers.
AttributedTypeBitfields AttributedTypeBits
bool isFunctionProtoType() const
TagTypeBitfields TagTypeBits
PackExpansionTypeBitfields PackExpansionTypeBits
bool isVariablyModifiedType() const
Whether this type is a variably-modified type (C99 6.7.5).
UnresolvedUsingBitfields UnresolvedUsingBits
bool isFromAST() const
Whether this type comes from an AST file.
bool isObjectType() const
Determine whether this type is an object type.
KeywordWrapperBitfields KeywordWrapperBits
FunctionTypeBitfields FunctionTypeBits
void setDependence(TypeDependence D)
bool isFunctionType() const
SubstTemplateTypeParmTypeBitfields SubstTemplateTypeParmTypeBits
TypeDependence getDependence() const
Visibility getVisibility() const
Determine the visibility of this type.
bool isObjCInertUnsafeUnretainedType() const
Was this type written with the special inert-in-ARC __unsafe_unretained qualifier?
const T * getAsCanonical() const
If this type is canonically the specified type, return its canonical type cast to that specified type...
ObjCObjectTypeBitfields ObjCObjectTypeBits
TemplateTypeParmTypeBitfields TemplateTypeParmTypeBits
const T * castAsCanonical() const
Return this type's canonical type cast to the specified type.
bool hasSizedVLAType() const
Whether this type involves a variable-length array type with a definite size.
TypeClass getTypeClass() const
bool isCanonicalUnqualified() const
Determines if this type would be canonical if it had no further qualification.
const T * getAs() const
Member-template getAs<specific type>'.
TemplateSpecializationTypeBitfields TemplateSpecializationTypeBits
bool isFunctionNoProtoType() const
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
Represents the dependent type named by a dependently-scoped typename using declaration,...
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 ...
Represents a C array with a specified size that is not an integer-constant-expression.
static bool classof(const Type *T)
void Profile(llvm::FoldingSetNodeID &ID)
Expr * getSizeExpr() const
Represents a GCC generic vector type.
unsigned getNumElements() const
void Profile(llvm::FoldingSetNodeID &ID)
static void Profile(llvm::FoldingSetNodeID &ID, QualType ElementType, unsigned NumElements, TypeClass TypeClass, VectorKind VecKind)
VectorKind getVectorKind() const
QualType ElementType
The element type of the vector.
QualType getElementType() const
static bool classof(const Type *T)
Defines the Linkage enumeration and various utility functions.
const internal::VariadicAllOfMatcher< Attr > attr
Matches attributes.
const internal::VariadicAllOfMatcher< Type > type
Matches Types in the clang AST.
const AstTypeMatcher< ArrayType > arrayType
Matches all kinds of arrays.
const internal::VariadicAllOfMatcher< Decl > decl
Matches declarations.
The JSON file list parser is used to communicate input to InstallAPI.
@ Overload
This is a legitimate overload: the existing declarations are functions or function templates with dif...
TypeDependenceScope::TypeDependence TypeDependence
AutoTypeKeyword
Which keyword(s) were used to create an AutoType.
@ GNUAutoType
__auto_type (GNU extension)
@ DecltypeAuto
decltype(auto)
bool isTargetAddressSpace(LangAS AS)
CanThrowResult
Possible results from evaluation of a noexcept expression.
FunctionType::ExtInfo getFunctionExtInfo(const Type &t)
bool isDynamicExceptionSpec(ExceptionSpecificationType ESpecType)
RefQualifierKind
The kind of C++11 ref-qualifier associated with a function type.
@ RQ_None
No ref-qualifier was provided.
@ RQ_LValue
An lvalue ref-qualifier was provided (&).
@ RQ_RValue
An rvalue ref-qualifier was provided (&&).
bool IsEnumDeclComplete(EnumDecl *ED)
Check if the given decl is complete.
@ Create
'create' clause, allowed on Compute and Combined constructs, plus 'data', 'enter data',...
TypeOfKind
The kind of 'typeof' expression we're after.
bool operator==(const CallGraphNode::CallRecord &LHS, const CallGraphNode::CallRecord &RHS)
CanQual< Type > CanQualType
Represents a canonical, potentially-qualified type.
TypeDependence toTypeDependence(ExprDependence D)
@ Dependent
Parse the block as a dependent block, which may be used in some template instantiations but not other...
const StreamingDiagnostic & operator<<(const StreamingDiagnostic &DB, const ASTContext::SectionInfo &Section)
Insertion operator for diagnostics.
unsigned toTargetAddressSpace(LangAS AS)
Linkage
Describes the different kinds of linkage (C++ [basic.link], C99 6.2.2) that an entity may have.
ObjCSubstitutionContext
The kind of type we are substituting Objective-C type arguments into.
@ Superclass
The superclass of a type.
@ Property
The type of a property.
@ Parameter
The parameter type of a method or function.
@ Result
The result type of a method or function.
ArraySizeModifier
Capture whether this is a normal array (e.g.
ParameterABI
Kinds of parameter ABI.
bool isComputedNoexcept(ExceptionSpecificationType ESpecType)
@ Template
We are parsing a template declaration.
bool isNoexceptExceptionSpec(ExceptionSpecificationType ESpecType)
TagTypeKind
The kind of a tag type.
constexpr unsigned PointerAuthKeyNone
bool IsEnumDeclScoped(EnumDecl *ED)
Check if the given decl is scoped.
@ 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)
std::integral_constant< bool, std::is_same< T, ArrayType >::value||std::is_base_of< ArrayType, T >::value > TypeIsArrayType
const FunctionProtoType * T
PointerAuthenticationMode
CallingConv
CallingConv - Specifies the calling convention that a function uses.
@ AltiVecBool
is AltiVec 'vector bool ...'
@ SveFixedLengthData
is AArch64 SVE fixed-length data vector
@ AltiVecVector
is AltiVec vector
@ AltiVecPixel
is AltiVec 'vector Pixel'
@ Generic
not a target-specific vector type
@ RVVFixedLengthData
is RISC-V RVV fixed-length data vector
@ RVVFixedLengthMask
is RISC-V RVV fixed-length mask vector
@ NeonPoly
is ARM Neon polynomial vector
@ SveFixedLengthPredicate
is AArch64 SVE fixed-length predicate vector
ElaboratedTypeKeyword
The elaboration keyword that precedes a qualified type name or introduces an elaborated-type-specifie...
@ Interface
The "__interface" keyword introduces the elaborated-type-specifier.
@ Class
The "class" keyword introduces the elaborated-type-specifier.
@ Typename
The "typename" keyword precedes the qualified type name, e.g., typename T::type.
@ Other
Other implicit parameter.
ExceptionSpecificationType
The various types of exception specifications that exist in C++11.
@ EST_DependentNoexcept
noexcept(expression), value-dependent
@ EST_Uninstantiated
not instantiated yet
@ EST_Unparsed
not parsed yet
@ EST_NoThrow
Microsoft __declspec(nothrow) extension.
@ EST_None
no exception specification
@ EST_MSAny
Microsoft throw(...) extension.
@ EST_BasicNoexcept
noexcept
@ EST_NoexceptFalse
noexcept(expression), evals to 'false'
@ EST_Unevaluated
not evaluated yet, for special member function
@ EST_NoexceptTrue
noexcept(expression), evals to 'true'
@ EST_Dynamic
throw(T1, T2)
Visibility
Describes the different kinds of visibility that a declaration may have.
Diagnostic wrappers for TextAPI types for error reporting.
__UINTPTR_TYPE__ uintptr_t
An unsigned integer type with the property that any valid pointer to void can be converted to this ty...
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.
ExceptionSpecInfo(ExceptionSpecificationType EST)
ExceptionSpecificationType Type
The kind of exception specification this is.
ArrayRef< QualType > Exceptions
Explicitly-specified list of exception types.
ExceptionSpecInfo()=default
Extra information about a function prototype.
ExceptionSpecInfo ExceptionSpec
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.
A holder for Arm type attributes as described in the Arm C/C++ Language extensions which are not part...
friend bool operator==(const Attributes &LHS, const Attributes &RHS)
llvm::dxil::ResourceClass ResourceClass
friend bool operator!=(const Attributes &LHS, const Attributes &RHS)
Provides a few static helpers for converting and printing elaborated type keyword and tag type kind e...
static StringRef getTagTypeKindName(TagTypeKind Kind)
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.
const TagType * getTagType() const
static constexpr size_t getOffset()
static TagTypeFoldingSetPlaceholder * fromTagType(TagType *T)
void Profile(llvm::FoldingSetNodeID &ID) const
static void Profile(llvm::FoldingSetNodeID &ID, ElaboratedTypeKeyword Keyword, NestedNameSpecifier Qualifier, const TagDecl *Tag, bool OwnsTag, bool IsInjected)
constexpr unsigned toInternalRepresentation() const
static inline ::clang::ExtQuals * getFromVoidPointer(void *P)
static void * getAsVoidPointer(::clang::ExtQuals *P)
static void * getAsVoidPointer(::clang::Type *P)
static inline ::clang::Type * getFromVoidPointer(void *P)
static void * getAsVoidPointer(clang::QualType P)
static clang::QualType getFromVoidPointer(void *P)
static SimpleType getSimplifiedValue(::clang::QualType Val)