42#include "llvm/ADT/APInt.h"
43#include "llvm/ADT/APSInt.h"
44#include "llvm/ADT/ArrayRef.h"
45#include "llvm/ADT/FoldingSet.h"
46#include "llvm/ADT/SmallVector.h"
47#include "llvm/Support/Casting.h"
48#include "llvm/Support/ErrorHandling.h"
49#include "llvm/Support/MathExtras.h"
50#include "llvm/TargetParser/RISCVTargetParser.h"
61 return (*
this !=
Other) &&
88 getElementType().getBaseTypeIdentifier();
106 if (
T.isConstQualified())
110 return AT->getElementType().isConstant(Ctx);
115std::optional<QualType::NonConstantStorageReason>
118 if (!
isConstant(Ctx) && !(*this)->isReferenceType())
126 if (
Record->hasMutableFields())
128 if (!
Record->hasTrivialDestructor() && !ExcludeDtor)
148 et->getDependence() |
154 (tc == DependentSizedArray
164 const llvm::APInt &Sz,
const Expr *SzExpr,
166 bool NeedsExternalSize = SzExpr !=
nullptr || Sz.ugt(0x0FFFFFFFFFFFFFFF) ||
167 Sz.getBitWidth() > 0xFF;
168 if (!NeedsExternalSize)
170 ET, Can, Sz.getBitWidth(), Sz.getZExtValue(), SzMod, Qual);
172 auto *SzPtr =
new (Ctx,
alignof(ConstantArrayType::ExternalSize))
173 ConstantArrayType::ExternalSize(Sz, SzExpr);
180 const llvm::APInt &NumElements) {
189 if (llvm::isPowerOf2_64(ElementSize)) {
190 return NumElements.getActiveBits() + llvm::Log2_64(ElementSize);
195 if ((ElementSize >> 32) == 0 && NumElements.getBitWidth() <= 64 &&
196 (NumElements.getZExtValue() >> 32) == 0) {
197 uint64_t TotalSize = NumElements.getZExtValue() * ElementSize;
198 return llvm::bit_width(TotalSize);
202 llvm::APSInt SizeExtended(NumElements,
true);
204 SizeExtended = SizeExtended.extend(std::max(SizeTypeBits,
205 SizeExtended.getBitWidth()) * 2);
207 llvm::APSInt TotalSize(llvm::APInt(SizeExtended.getBitWidth(), ElementSize));
208 TotalSize *= SizeExtended;
210 return TotalSize.getActiveBits();
232 uint64_t ArraySize,
const Expr *SizeExpr,
235 ID.AddInteger(ArraySize);
236 ID.AddInteger(llvm::to_underlying(SizeMod));
237 ID.AddInteger(TypeQuals);
238 ID.AddBoolean(SizeExpr !=
nullptr);
240 SizeExpr->
Profile(ID, Context,
true);
247 :
ArrayType(DependentSizedArray, et, can, sm, tq, e), SizeExpr((
Stmt *)e),
248 Brackets(brackets) {}
257 ID.AddInteger(llvm::to_underlying(SizeMod));
258 ID.AddInteger(TypeQuals);
263DependentVectorType::DependentVectorType(
QualType ElementType,
266 :
Type(DependentVector, CanonType,
268 ElementType->getDependence() |
271 ElementType(ElementType), SizeExpr(SizeExpr),
Loc(
Loc) {
280 ID.AddInteger(llvm::to_underlying(VecKind));
281 SizeExpr->
Profile(ID, Context,
true);
284DependentSizedExtVectorType::DependentSizedExtVectorType(
QualType ElementType,
288 :
Type(DependentSizedExtVector, can,
290 ElementType->getDependence() |
293 SizeExpr(SizeExpr), ElementType(ElementType), loc(loc) {}
300 SizeExpr->
Profile(ID, Context,
true);
303DependentAddressSpaceType::DependentAddressSpaceType(
QualType PointeeType,
307 :
Type(DependentAddressSpace, can,
309 PointeeType->getDependence() |
312 AddrSpaceExpr(AddrSpaceExpr), PointeeType(PointeeType), loc(loc) {}
317 Expr *AddrSpaceExpr) {
319 AddrSpaceExpr->
Profile(ID, Context,
true);
323 const Expr *RowExpr,
const Expr *ColumnExpr)
324 :
Type(tc, canonType,
325 (RowExpr ? (matrixType->getDependence() |
TypeDependence::Dependent |
327 (matrixType->isVariablyModifiedType()
330 (matrixType->containsUnexpandedParameterPack() ||
332 RowExpr->containsUnexpandedParameterPack()) ||
334 ColumnExpr->containsUnexpandedParameterPack())
337 : matrixType->getDependence())),
338 ElementType(matrixType) {}
341 unsigned nColumns,
QualType canonType)
346 unsigned nRows,
unsigned nColumns,
348 :
MatrixType(tc, matrixType, canonType), NumRows(nRows),
349 NumColumns(nColumns) {}
351DependentSizedMatrixType::DependentSizedMatrixType(
QualType ElementType,
356 :
MatrixType(DependentSizedMatrix, ElementType, CanonicalType, RowExpr,
358 RowExpr(RowExpr), ColumnExpr(ColumnExpr), loc(loc) {}
365 RowExpr->
Profile(ID, CTX,
true);
366 ColumnExpr->
Profile(ID, CTX,
true);
375 :
Type(tc, canonType, vecType->getDependence()), ElementType(vecType) {
387 ExprAndUnsigned(NumBitsExpr, IsUnsigned) {}
390 return ExprAndUnsigned.getInt();
394 return ExprAndUnsigned.getPointer();
400 ID.AddBoolean(IsUnsigned);
401 NumBitsExpr->
Profile(ID, Context,
true);
407 return isa<FieldDecl>(Info.
getDecl());
413 bool CountInBytes,
bool OrNull) {
415 ID.AddBoolean(CountInBytes);
416 ID.AddBoolean(OrNull);
421 ID.AddPointer(CountExpr);
429 if (
const auto *ATy = dyn_cast<ArrayType>(
this))
430 return ATy->getElementType().getTypePtr();
433 if (!isa<ArrayType>(CanonicalType))
439 ->getElementType().getTypePtr();
463#define TYPE(CLASS, BASE) \
464 static_assert(!std::is_polymorphic<CLASS##Type>::value, \
465 #CLASS "Type should not be polymorphic!");
466#include "clang/AST/TypeNodes.inc"
471#define TYPE(CLASS, BASE) \
472 static_assert(std::is_trivially_destructible<CLASS##Type>::value, \
473 #CLASS "Type should be trivially destructible!");
474#include "clang/AST/TypeNodes.inc"
478#define ABSTRACT_TYPE(Class, Parent)
479#define TYPE(Class, Parent) \
480 case Type::Class: { \
481 const auto *ty = cast<Class##Type>(this); \
482 if (!ty->isSugared()) return QualType(ty, 0); \
483 return ty->desugar(); \
485#include "clang/AST/TypeNodes.inc"
487 llvm_unreachable(
"bad type kind!");
497#define ABSTRACT_TYPE(Class, Parent)
498#define TYPE(Class, Parent) \
499 case Type::Class: { \
500 const auto *Ty = cast<Class##Type>(CurTy); \
501 if (!Ty->isSugared()) \
502 return SplitQualType(Ty, Qs); \
503 Cur = Ty->desugar(); \
506#include "clang/AST/TypeNodes.inc"
526#define ABSTRACT_TYPE(Class, Parent)
527#define TYPE(Class, Parent) \
528 case Type::Class: { \
529 const auto *ty = cast<Class##Type>(split.Ty); \
530 if (!ty->isSugared()) goto done; \
531 next = ty->desugar(); \
534#include "clang/AST/TypeNodes.inc"
553 T = PT->getInnerType();
562 if (
const auto *Sugar = dyn_cast<T>(Cur))
565#define ABSTRACT_TYPE(Class, Parent)
566#define TYPE(Class, Parent) \
567 case Type::Class: { \
568 const auto *Ty = cast<Class##Type>(Cur); \
569 if (!Ty->isSugared()) return 0; \
570 Cur = Ty->desugar().getTypePtr(); \
573#include "clang/AST/TypeNodes.inc"
579 return getAsSugar<TypedefType>(
this);
583 return getAsSugar<UsingType>(
this);
587 return getAsSugar<TemplateSpecializationType>(
this);
591 return getAsSugar<AttributedType>(
this);
595 return getAsSugar<BoundsAttributedType>(
this);
599 return getAsSugar<CountAttributedType>(
this);
606 const Type *Cur =
this;
610#define ABSTRACT_TYPE(Class, Parent)
611#define TYPE(Class, Parent) \
613 const auto *Ty = cast<Class##Type>(Cur); \
614 if (!Ty->isSugared()) return Cur; \
615 Cur = Ty->desugar().getTypePtr(); \
618#include "clang/AST/TypeNodes.inc"
624 if (
const auto *RT = getAs<RecordType>())
625 return RT->getDecl()->isClass();
630 if (
const auto *RT = getAs<RecordType>())
631 return RT->getDecl()->isStruct();
636 const auto *RT = getAs<RecordType>();
639 const auto *
Decl = RT->getDecl();
640 if (!
Decl->isStruct())
642 return Decl->hasFlexibleArrayMember();
646 if (
const auto *RT = getAs<RecordType>())
647 return RT->getDecl()->hasAttr<ObjCBoxableAttr>();
652 if (
const auto *RT = getAs<RecordType>())
653 return RT->getDecl()->isInterface();
658 if (
const auto *RT = getAs<RecordType>()) {
666 if (
const auto *PT = getAs<PointerType>())
667 return PT->getPointeeType()->isVoidType();
672 if (
const auto *RT = getAs<RecordType>())
673 return RT->getDecl()->isUnion();
678 if (
const auto *CT = dyn_cast<ComplexType>(CanonicalType))
679 return CT->getElementType()->isFloatingType();
689 if (
const auto *ET = getAs<EnumType>())
690 return ET->getDecl()->isScoped();
695 return getAs<CountAttributedType>();
699 if (
const auto *
Complex = getAs<ComplexType>())
700 if (
Complex->getElementType()->isIntegerType())
706 if (
const auto *PT = getAs<PointerType>())
708 if (
const auto *OPT = getAs<ObjCObjectPointerType>())
710 if (
const auto *BPT = getAs<BlockPointerType>())
712 if (
const auto *RT = getAs<ReferenceType>())
714 if (
const auto *MPT = getAs<MemberPointerType>())
716 if (
const auto *DT = getAs<DecayedType>())
723 if (
const auto *RT = dyn_cast<RecordType>(
this)) {
724 if (RT->getDecl()->isStruct())
729 if (
const auto *RT = dyn_cast<RecordType>(CanonicalType)) {
730 if (!RT->getDecl()->isStruct())
742 if (
const auto *RT = dyn_cast<RecordType>(
this)) {
743 if (RT->getDecl()->isUnion())
748 if (
const auto *RT = dyn_cast<RecordType>(CanonicalType)) {
749 if (!RT->getDecl()->isUnion())
764 const auto *OPT = getAs<ObjCObjectPointerType>();
769 if (OPT->isObjCIdType())
773 if (!OPT->isKindOfType())
777 if (OPT->isObjCClassType() || OPT->isObjCQualifiedClassType())
787 const auto *OPT = getAs<ObjCObjectPointerType>();
792 if (OPT->isObjCClassType())
796 if (!OPT->isKindOfType())
800 return OPT->isObjCClassType() || OPT->isObjCQualifiedClassType();
814 :
Type(ObjCObject, Canonical,
Base->getDependence()), BaseType(
Base) {
819 "bitfield overflow in type argument count");
820 if (!typeArgs.empty())
821 memcpy(getTypeArgStorage(), typeArgs.data(),
822 typeArgs.size() *
sizeof(
QualType));
824 for (
auto typeArg : typeArgs) {
825 addDependence(typeArg->getDependence() & ~TypeDependence::VariablyModified);
838 if (
const auto objcObject =
getBaseType()->getAs<ObjCObjectType>()) {
840 if (isa<ObjCInterfaceType>(objcObject))
843 return objcObject->isSpecialized();
856 if (
const auto objcObject =
getBaseType()->getAs<ObjCObjectType>()) {
858 if (isa<ObjCInterfaceType>(objcObject))
861 return objcObject->getTypeArgs();
873 if (
const auto objcObject =
getBaseType()->getAs<ObjCObjectType>()) {
875 if (isa<ObjCInterfaceType>(objcObject))
878 return objcObject->isKindOfType();
894 baseType = baseObj->stripObjCKindOfTypeAndQuals(ctx);
897 splitBaseType.
Quals),
923template <
typename Derived>
924struct SimpleTransformVisitor :
public TypeVisitor<Derived, QualType> {
932 QualType result =
static_cast<Derived *
>(
this)->Visit(splitType.
Ty);
942 explicit SimpleTransformVisitor(
ASTContext &ctx) : Ctx(ctx) {}
946#define TYPE(Class, Base)
947#define DEPENDENT_TYPE(Class, Base) \
948 QualType Visit##Class##Type(const Class##Type *T) { return QualType(T, 0); }
949#include "clang/AST/TypeNodes.inc"
951#define TRIVIAL_TYPE_CLASS(Class) \
952 QualType Visit##Class##Type(const Class##Type *T) { return QualType(T, 0); }
953#define SUGARED_TYPE_CLASS(Class) \
954 QualType Visit##Class##Type(const Class##Type *T) { \
955 if (!T->isSugared()) \
956 return QualType(T, 0); \
957 QualType desugaredType = recurse(T->desugar()); \
958 if (desugaredType.isNull()) \
960 if (desugaredType.getAsOpaquePtr() == T->desugar().getAsOpaquePtr()) \
961 return QualType(T, 0); \
962 return desugaredType; \
968 QualType elementType = recurse(
T->getElementType());
972 if (elementType.
getAsOpaquePtr() ==
T->getElementType().getAsOpaquePtr())
1001 QualType pointeeType = recurse(
T->getPointeeTypeAsWritten());
1002 if (pointeeType.
isNull())
1006 ==
T->getPointeeTypeAsWritten().getAsOpaquePtr())
1013 QualType pointeeType = recurse(
T->getPointeeTypeAsWritten());
1014 if (pointeeType.
isNull())
1018 ==
T->getPointeeTypeAsWritten().getAsOpaquePtr())
1026 if (pointeeType.
isNull())
1036 QualType elementType = recurse(
T->getElementType());
1037 if (elementType.
isNull())
1040 if (elementType.
getAsOpaquePtr() ==
T->getElementType().getAsOpaquePtr())
1044 T->getSizeModifier(),
1045 T->getIndexTypeCVRQualifiers());
1049 QualType elementType = recurse(
T->getElementType());
1050 if (elementType.
isNull())
1053 if (elementType.
getAsOpaquePtr() ==
T->getElementType().getAsOpaquePtr())
1057 T->getSizeModifier(),
1058 T->getIndexTypeCVRQualifiers(),
1059 T->getBracketsRange());
1063 QualType elementType = recurse(
T->getElementType());
1064 if (elementType.
isNull())
1067 if (elementType.
getAsOpaquePtr() ==
T->getElementType().getAsOpaquePtr())
1071 T->getIndexTypeCVRQualifiers());
1075 QualType elementType = recurse(
T->getElementType());
1076 if (elementType.
isNull())
1079 if (elementType.
getAsOpaquePtr() ==
T->getElementType().getAsOpaquePtr())
1083 T->getVectorKind());
1087 QualType elementType = recurse(
T->getElementType());
1088 if (elementType.
isNull())
1091 if (elementType.
getAsOpaquePtr() ==
T->getElementType().getAsOpaquePtr())
1098 QualType elementType = recurse(
T->getElementType());
1099 if (elementType.
isNull())
1101 if (elementType.
getAsOpaquePtr() ==
T->getElementType().getAsOpaquePtr())
1105 T->getNumColumns());
1126 bool paramChanged =
false;
1128 QualType newParamType = recurse(paramType);
1129 if (newParamType.
isNull())
1133 paramChanged =
true;
1135 paramTypes.push_back(newParamType);
1140 bool exceptionChanged =
false;
1144 QualType newExceptionType = recurse(exceptionType);
1145 if (newExceptionType.
isNull())
1148 if (newExceptionType.
getAsOpaquePtr() != exceptionType.getAsOpaquePtr())
1149 exceptionChanged =
true;
1151 exceptionTypes.push_back(newExceptionType);
1154 if (exceptionChanged) {
1161 !paramChanged && !exceptionChanged)
1168 QualType innerType = recurse(
T->getInnerType());
1183 QualType originalType = recurse(
T->getOriginalType());
1184 if (originalType.
isNull())
1187 QualType adjustedType = recurse(
T->getAdjustedType());
1188 if (adjustedType.
isNull())
1192 ==
T->getOriginalType().getAsOpaquePtr() &&
1193 adjustedType.
getAsOpaquePtr() ==
T->getAdjustedType().getAsOpaquePtr())
1200 QualType originalType = recurse(
T->getOriginalType());
1201 if (originalType.
isNull())
1205 ==
T->getOriginalType().getAsOpaquePtr())
1212 QualType ArrTy = VisitConstantArrayType(
T);
1230 QualType modifiedType = recurse(
T->getModifiedType());
1231 if (modifiedType.
isNull())
1234 QualType equivalentType = recurse(
T->getEquivalentType());
1235 if (equivalentType.
isNull())
1239 ==
T->getModifiedType().getAsOpaquePtr() &&
1241 ==
T->getEquivalentType().getAsOpaquePtr())
1249 QualType replacementType = recurse(
T->getReplacementType());
1250 if (replacementType.
isNull())
1254 ==
T->getReplacementType().getAsOpaquePtr())
1258 T->getAssociatedDecl(),
1259 T->getIndex(),
T->getPackIndex());
1266 if (!
T->isDeduced())
1269 QualType deducedType = recurse(
T->getDeducedType());
1270 if (deducedType.
isNull())
1274 ==
T->getDeducedType().getAsOpaquePtr())
1279 T->getTypeConstraintConcept(),
1280 T->getTypeConstraintArguments());
1284 QualType baseType = recurse(
T->getBaseType());
1289 bool typeArgChanged =
false;
1291 for (
auto typeArg :
T->getTypeArgsAsWritten()) {
1292 QualType newTypeArg = recurse(typeArg);
1297 typeArgChanged =
true;
1299 typeArgs.push_back(newTypeArg);
1309 T->isKindOfTypeAsWritten());
1316 if (pointeeType.
isNull())
1327 QualType valueType = recurse(
T->getValueType());
1332 ==
T->getValueType().getAsOpaquePtr())
1338#undef TRIVIAL_TYPE_CLASS
1339#undef SUGARED_TYPE_CLASS
1342struct SubstObjCTypeArgsVisitor
1343 :
public SimpleTransformVisitor<SubstObjCTypeArgsVisitor> {
1344 using BaseType = SimpleTransformVisitor<SubstObjCTypeArgsVisitor>;
1351 : BaseType(ctx), TypeArgs(typeArgs), SubstContext(context) {}
1358 if (!TypeArgs.empty()) {
1369 argType, protocolsToApply, hasError,
true);
1372 switch (SubstContext) {
1373 case ObjCSubstitutionContext::Ordinary:
1374 case ObjCSubstitutionContext::Parameter:
1375 case ObjCSubstitutionContext::Superclass:
1379 case ObjCSubstitutionContext::Result:
1380 case ObjCSubstitutionContext::Property: {
1382 const auto *objPtr =
1387 if (objPtr->isKindOfType() || objPtr->isObjCIdOrClassType())
1391 const auto *obj = objPtr->getObjectType();
1393 obj->getBaseType(), obj->getTypeArgsAsWritten(), obj->getProtocols(),
1400 llvm_unreachable(
"Unexpected ObjCSubstitutionContext!");
1409 Ctx, TypeArgs, ObjCSubstitutionContext::Result);
1415 if (isa<FunctionNoProtoType>(funcType)) {
1419 return BaseType::VisitFunctionType(funcType);
1425 const auto *funcProtoType = cast<FunctionProtoType>(funcType);
1429 bool paramChanged =
false;
1430 for (
auto paramType : funcProtoType->getParamTypes()) {
1432 Ctx, TypeArgs, ObjCSubstitutionContext::Parameter);
1433 if (newParamType.
isNull())
1437 paramChanged =
true;
1439 paramTypes.push_back(newParamType);
1444 bool exceptionChanged =
false;
1449 Ctx, TypeArgs, ObjCSubstitutionContext::Ordinary);
1450 if (newExceptionType.
isNull())
1453 if (newExceptionType.
getAsOpaquePtr() != exceptionType.getAsOpaquePtr())
1454 exceptionChanged =
true;
1456 exceptionTypes.push_back(newExceptionType);
1459 if (exceptionChanged) {
1466 funcProtoType->getReturnType().getAsOpaquePtr() &&
1467 !paramChanged && !exceptionChanged)
1468 return BaseType::VisitFunctionType(funcType);
1478 bool anyChanged =
false;
1481 Ctx, TypeArgs, ObjCSubstitutionContext::Ordinary);
1490 if (TypeArgs.empty() &&
1491 SubstContext != ObjCSubstitutionContext::Superclass) {
1500 newTypeArgs.push_back(newTypeArg);
1512 return BaseType::VisitObjCObjectType(objcObjectType);
1516 QualType newType = BaseType::VisitAttributedType(attrType);
1520 const auto *newAttrType = dyn_cast<AttributedType>(newType.
getTypePtr());
1521 if (!newAttrType || newAttrType->getAttrKind() != attr::ObjCKindOf)
1525 QualType newEquivType = newAttrType->getEquivalentType();
1537 objType->getBaseType(), objType->getTypeArgsAsWritten(),
1538 objType->getProtocols(),
1540 objType->isObjCUnqualifiedId() ?
false :
true);
1548 newAttrType->getModifiedType(), newEquivType);
1552struct StripObjCKindOfTypeVisitor
1553 :
public SimpleTransformVisitor<StripObjCKindOfTypeVisitor> {
1554 using BaseType = SimpleTransformVisitor<StripObjCKindOfTypeVisitor>;
1556 explicit StripObjCKindOfTypeVisitor(
ASTContext &ctx) : BaseType(ctx) {}
1560 return BaseType::VisitObjCObjectType(objType);
1581 case BuiltinType::Kind::Float16: {
1589 case BuiltinType::Kind::BFloat16: {
1609 SubstObjCTypeArgsVisitor visitor(ctx, typeArgs, context);
1610 return visitor.recurse(*
this);
1624 auto &ctx =
const_cast<ASTContext &
>(constCtx);
1625 StripObjCKindOfTypeVisitor visitor(ctx);
1626 return visitor.recurse(*
this);
1630 if (
const auto AT =
getTypePtr()->getAs<AtomicType>())
1631 return AT->getValueType().getUnqualifiedType();
1635std::optional<ArrayRef<QualType>>
1638 if (
const auto method = dyn_cast<ObjCMethodDecl>(dc))
1639 dc = method->getDeclContext();
1643 const auto *dcClassDecl = dyn_cast<ObjCInterfaceDecl>(dc);
1649 dcTypeParams = dcClassDecl->getTypeParamList();
1651 return std::nullopt;
1655 dcCategoryDecl = dyn_cast<ObjCCategoryDecl>(dc);
1656 if (!dcCategoryDecl)
1657 return std::nullopt;
1663 return std::nullopt;
1667 return std::nullopt;
1669 assert(dcTypeParams &&
"No substitutions to perform");
1670 assert(dcClassDecl &&
"No class context");
1674 if (
const auto *objectPointerType = getAs<ObjCObjectPointerType>()) {
1675 objectType = objectPointerType->getObjectType();
1676 }
else if (getAs<BlockPointerType>()) {
1681 objectType = getAs<ObjCObjectType>();
1687 if (!curClassDecl) {
1695 while (curClassDecl != dcClassDecl) {
1698 if (superType.
isNull()) {
1699 objectType =
nullptr;
1719 if (
auto *ID = IfaceT->getInterface()) {
1720 if (ID->getTypeParamList())
1734 CachedSuperClassType.setInt(
true);
1740 if (!superClassObjTy) {
1741 CachedSuperClassType.setInt(
true);
1746 if (!superClassDecl) {
1747 CachedSuperClassType.setInt(
true);
1753 QualType superClassType(superClassObjTy, 0);
1755 if (!superClassTypeParams) {
1756 CachedSuperClassType.setPointerAndInt(
1763 CachedSuperClassType.setPointerAndInt(superClassObjTy,
true);
1771 CachedSuperClassType.setPointerAndInt(
1782 CachedSuperClassType.setPointerAndInt(
1790 assert(typeArgs.size() == typeParams->
size());
1791 CachedSuperClassType.setPointerAndInt(
1800 return interfaceDecl->getASTContext().getObjCInterfaceType(interfaceDecl)
1809 if (superObjectType.
isNull())
1810 return superObjectType;
1820 if (
const auto *
T = getAs<ObjCObjectType>())
1821 if (
T->getNumProtocols() &&
T->getInterface())
1833 if (
const auto *OPT = getAs<ObjCObjectPointerType>()) {
1834 if (OPT->isObjCQualifiedIdType())
1843 if (
const auto *OPT = getAs<ObjCObjectPointerType>()) {
1844 if (OPT->isObjCQualifiedClassType())
1851 if (
const auto *OT = getAs<ObjCObjectType>()) {
1852 if (OT->getInterface())
1859 if (
const auto *OPT = getAs<ObjCObjectPointerType>()) {
1860 if (OPT->getInterfaceType())
1868 if (
const auto *PT = getAs<PointerType>())
1870 else if (
const auto *RT = getAs<ReferenceType>())
1876 return dyn_cast<CXXRecordDecl>(RT->getDecl());
1882 return dyn_cast_or_null<CXXRecordDecl>(
getAsTagDecl());
1890 if (
const auto *TT = getAs<TagType>())
1891 return TT->getDecl();
1892 if (
const auto *Injected = getAs<InjectedClassNameType>())
1893 return Injected->getDecl();
1899 const Type *Cur =
this;
1901 if (AT->getAttrKind() == AK)
1903 Cur = AT->getEquivalentType().getTypePtr();
1910 class GetContainedDeducedTypeVisitor :
1911 public TypeVisitor<GetContainedDeducedTypeVisitor, Type*> {
1915 GetContainedDeducedTypeVisitor(
bool Syntactic =
false)
1916 : Syntactic(Syntactic) {}
1923 return Visit(
T.getTypePtr());
1933 return Visit(
T->getReplacementType());
1937 return Visit(
T->getNamedType());
1949 return Visit(
T->getPointeeTypeAsWritten());
1957 return Visit(
T->getElementType());
1960 Type *VisitDependentSizedExtVectorType(
1962 return Visit(
T->getElementType());
1966 return Visit(
T->getElementType());
1970 return Visit(
T->getElementType());
1974 return Visit(
T->getElementType());
1980 return VisitFunctionType(
T);
1988 return Visit(
T->getInnerType());
1992 return Visit(
T->getModifiedType());
1996 return Visit(
T->getUnderlyingType());
2000 return Visit(
T->getOriginalType());
2004 return Visit(
T->getPattern());
2011 return cast_or_null<DeducedType>(
2012 GetContainedDeducedTypeVisitor().Visit(
this));
2016 return isa_and_nonnull<FunctionType>(
2017 GetContainedDeducedTypeVisitor(
true).Visit(
this));
2021 if (
const auto *VT = dyn_cast<VectorType>(CanonicalType))
2022 return VT->getElementType()->isIntegerType();
2023 if (CanonicalType->isSveVLSBuiltinType()) {
2024 const auto *VT = cast<BuiltinType>(CanonicalType);
2025 return VT->getKind() == BuiltinType::SveBool ||
2026 (VT->getKind() >= BuiltinType::SveInt8 &&
2027 VT->getKind() <= BuiltinType::SveUint64);
2029 if (CanonicalType->isRVVVLSBuiltinType()) {
2030 const auto *VT = cast<BuiltinType>(CanonicalType);
2031 return (VT->getKind() >= BuiltinType::RvvInt8mf8 &&
2032 VT->getKind() <= BuiltinType::RvvUint64m8);
2058 if (
const auto *BT = dyn_cast<BuiltinType>(CanonicalType))
2059 return BT->getKind() >= BuiltinType::Bool &&
2060 BT->getKind() <= BuiltinType::Int128;
2064 if (
const auto *ET = dyn_cast<EnumType>(CanonicalType))
2065 return ET->getDecl()->isComplete();
2071 if (
const auto *BT = dyn_cast<BuiltinType>(CanonicalType))
2072 return BT->getKind() >= BuiltinType::Bool &&
2073 BT->getKind() <= BuiltinType::Int128;
2082 if (
const auto *ET = dyn_cast<EnumType>(CanonicalType))
2083 return !ET->getDecl()->isScoped();
2089 if (
const auto *BT = dyn_cast<BuiltinType>(CanonicalType))
2090 return BT->getKind() == BuiltinType::Char_U ||
2091 BT->getKind() == BuiltinType::UChar ||
2092 BT->getKind() == BuiltinType::Char_S ||
2093 BT->getKind() == BuiltinType::SChar;
2098 if (
const auto *BT = dyn_cast<BuiltinType>(CanonicalType))
2099 return BT->getKind() == BuiltinType::WChar_S ||
2100 BT->getKind() == BuiltinType::WChar_U;
2105 if (
const BuiltinType *BT = dyn_cast<BuiltinType>(CanonicalType))
2106 return BT->getKind() == BuiltinType::Char8;
2111 if (
const auto *BT = dyn_cast<BuiltinType>(CanonicalType))
2112 return BT->getKind() == BuiltinType::Char16;
2117 if (
const auto *BT = dyn_cast<BuiltinType>(CanonicalType))
2118 return BT->getKind() == BuiltinType::Char32;
2125 const auto *BT = dyn_cast<BuiltinType>(CanonicalType);
2126 if (!BT)
return false;
2127 switch (BT->getKind()) {
2128 default:
return false;
2129 case BuiltinType::Char_U:
2130 case BuiltinType::UChar:
2131 case BuiltinType::WChar_U:
2132 case BuiltinType::Char8:
2133 case BuiltinType::Char16:
2134 case BuiltinType::Char32:
2135 case BuiltinType::Char_S:
2136 case BuiltinType::SChar:
2137 case BuiltinType::WChar_S:
2146 if (
const auto *BT = dyn_cast<BuiltinType>(CanonicalType)) {
2147 return BT->getKind() >= BuiltinType::Char_S &&
2148 BT->getKind() <= BuiltinType::Int128;
2151 if (
const EnumType *ET = dyn_cast<EnumType>(CanonicalType)) {
2154 if (ET->getDecl()->isComplete() && !ET->getDecl()->isScoped())
2158 if (
const auto *IT = dyn_cast<BitIntType>(CanonicalType))
2159 return IT->isSigned();
2160 if (
const auto *IT = dyn_cast<DependentBitIntType>(CanonicalType))
2161 return IT->isSigned();
2167 if (
const auto *BT = dyn_cast<BuiltinType>(CanonicalType)) {
2168 return BT->getKind() >= BuiltinType::Char_S &&
2169 BT->getKind() <= BuiltinType::Int128;
2172 if (
const auto *ET = dyn_cast<EnumType>(CanonicalType)) {
2173 if (ET->getDecl()->isComplete())
2177 if (
const auto *IT = dyn_cast<BitIntType>(CanonicalType))
2178 return IT->isSigned();
2179 if (
const auto *IT = dyn_cast<DependentBitIntType>(CanonicalType))
2180 return IT->isSigned();
2186 if (
const auto *VT = dyn_cast<VectorType>(CanonicalType))
2187 return VT->getElementType()->isSignedIntegerOrEnumerationType();
2196 if (
const auto *BT = dyn_cast<BuiltinType>(CanonicalType)) {
2197 return BT->getKind() >= BuiltinType::Bool &&
2198 BT->getKind() <= BuiltinType::UInt128;
2201 if (
const auto *ET = dyn_cast<EnumType>(CanonicalType)) {
2204 if (ET->getDecl()->isComplete() && !ET->getDecl()->isScoped())
2208 if (
const auto *IT = dyn_cast<BitIntType>(CanonicalType))
2209 return IT->isUnsigned();
2210 if (
const auto *IT = dyn_cast<DependentBitIntType>(CanonicalType))
2211 return IT->isUnsigned();
2217 if (
const auto *BT = dyn_cast<BuiltinType>(CanonicalType)) {
2218 return BT->getKind() >= BuiltinType::Bool &&
2219 BT->getKind() <= BuiltinType::UInt128;
2222 if (
const auto *ET = dyn_cast<EnumType>(CanonicalType)) {
2223 if (ET->getDecl()->isComplete())
2227 if (
const auto *IT = dyn_cast<BitIntType>(CanonicalType))
2228 return IT->isUnsigned();
2229 if (
const auto *IT = dyn_cast<DependentBitIntType>(CanonicalType))
2230 return IT->isUnsigned();
2236 if (
const auto *VT = dyn_cast<VectorType>(CanonicalType))
2237 return VT->getElementType()->isUnsignedIntegerOrEnumerationType();
2238 if (
const auto *VT = dyn_cast<MatrixType>(CanonicalType))
2239 return VT->getElementType()->isUnsignedIntegerOrEnumerationType();
2240 if (CanonicalType->isSveVLSBuiltinType()) {
2241 const auto *VT = cast<BuiltinType>(CanonicalType);
2242 return VT->getKind() >= BuiltinType::SveUint8 &&
2243 VT->getKind() <= BuiltinType::SveUint64;
2249 if (
const auto *BT = dyn_cast<BuiltinType>(CanonicalType))
2250 return BT->getKind() >= BuiltinType::Half &&
2251 BT->getKind() <= BuiltinType::Ibm128;
2252 if (
const auto *CT = dyn_cast<ComplexType>(CanonicalType))
2253 return CT->getElementType()->isFloatingType();
2258 if (
const auto *VT = dyn_cast<VectorType>(CanonicalType))
2259 return VT->getElementType()->isFloatingType();
2260 if (
const auto *MT = dyn_cast<MatrixType>(CanonicalType))
2261 return MT->getElementType()->isFloatingType();
2266 if (
const auto *BT = dyn_cast<BuiltinType>(CanonicalType))
2267 return BT->isFloatingPoint();
2272 if (
const auto *BT = dyn_cast<BuiltinType>(CanonicalType))
2273 return BT->getKind() >= BuiltinType::Bool &&
2274 BT->getKind() <= BuiltinType::Ibm128;
2275 if (
const auto *ET = dyn_cast<EnumType>(CanonicalType))
2276 return ET->getDecl()->isComplete() && !ET->getDecl()->isScoped();
2281 if (
const auto *BT = dyn_cast<BuiltinType>(CanonicalType))
2282 return BT->getKind() >= BuiltinType::Bool &&
2283 BT->getKind() <= BuiltinType::Ibm128;
2284 if (
const auto *ET = dyn_cast<EnumType>(CanonicalType))
2291 return !ET->getDecl()->isScoped() && ET->getDecl()->isComplete();
2292 return isa<ComplexType>(CanonicalType) ||
isBitIntType();
2298 const Type *
T = CanonicalType.getTypePtr();
2299 if (
const auto *BT = dyn_cast<BuiltinType>(
T)) {
2300 if (BT->getKind() == BuiltinType::Bool)
return STK_Bool;
2301 if (BT->getKind() == BuiltinType::NullPtr)
return STK_CPointer;
2305 llvm_unreachable(
"unknown scalar builtin type");
2306 }
else if (isa<PointerType>(
T)) {
2308 }
else if (isa<BlockPointerType>(
T)) {
2310 }
else if (isa<ObjCObjectPointerType>(
T)) {
2312 }
else if (isa<MemberPointerType>(
T)) {
2314 }
else if (isa<EnumType>(
T)) {
2315 assert(cast<EnumType>(
T)->getDecl()->isComplete());
2317 }
else if (
const auto *CT = dyn_cast<ComplexType>(
T)) {
2318 if (CT->getElementType()->isRealFloatingType())
2325 llvm_unreachable(
"unknown scalar type");
2338 if (
const auto *
Record = dyn_cast<RecordType>(CanonicalType)) {
2339 if (
const auto *ClassDecl = dyn_cast<CXXRecordDecl>(
Record->getDecl()))
2340 return ClassDecl->isAggregate();
2345 return isa<ArrayType>(CanonicalType);
2352 assert(!
isIncompleteType() &&
"This doesn't make sense for incomplete types");
2353 assert(!
isDependentType() &&
"This doesn't make sense for dependent types");
2355 return !isa<VariableArrayType>(CanonicalType);
2365 switch (CanonicalType->getTypeClass()) {
2366 default:
return false;
2372 EnumDecl *EnumD = cast<EnumType>(CanonicalType)->getDecl();
2380 RecordDecl *Rec = cast<RecordType>(CanonicalType)->getDecl();
2391 return cast<ArrayType>(CanonicalType)->getElementType()
2392 ->isIncompleteType(Def);
2393 case IncompleteArray:
2396 case MemberPointer: {
2400 auto *MPTy = cast<MemberPointerType>(CanonicalType);
2401 const Type *ClassTy = MPTy->getClass();
2414 if (RD->
hasAttr<MSInheritanceAttr>())
2419 return cast<ObjCObjectType>(CanonicalType)->getBaseType()
2420 ->isIncompleteType(Def);
2421 case ObjCInterface: {
2424 = cast<ObjCInterfaceType>(CanonicalType)->getDecl();
2436 if (
const BuiltinType *BT = getAs<BuiltinType>()) {
2437 switch (BT->getKind()) {
2439#define WASM_TYPE(Name, Id, SingletonId) case BuiltinType::Id:
2440#include "clang/Basic/WebAssemblyReferenceTypes.def"
2450 if (
const auto *BT = getAs<BuiltinType>())
2451 return BT->getKind() == BuiltinType::WasmExternRef;
2456 if (
const auto *ATy = dyn_cast<ArrayType>(
this))
2457 return ATy->getElementType().isWebAssemblyReferenceType();
2459 if (
const auto *PTy = dyn_cast<PointerType>(
this))
2460 return PTy->getPointeeType().isWebAssemblyReferenceType();
2472 if (
const BuiltinType *BT = getAs<BuiltinType>()) {
2473 switch (BT->getKind()) {
2475#define SVE_TYPE(Name, Id, SingletonId) case BuiltinType::Id:
2476#include "clang/Basic/AArch64SVEACLETypes.def"
2486 if (
const BuiltinType *BT = getAs<BuiltinType>()) {
2487 switch (BT->getKind()) {
2488#define RVV_TYPE(Name, Id, SingletonId) case BuiltinType::Id:
2489#include "clang/Basic/RISCVVTypes.def"
2499 if (
const BuiltinType *BT = getAs<BuiltinType>()) {
2500 switch (BT->getKind()) {
2501 case BuiltinType::SveInt8:
2502 case BuiltinType::SveInt16:
2503 case BuiltinType::SveInt32:
2504 case BuiltinType::SveInt64:
2505 case BuiltinType::SveUint8:
2506 case BuiltinType::SveUint16:
2507 case BuiltinType::SveUint32:
2508 case BuiltinType::SveUint64:
2509 case BuiltinType::SveFloat16:
2510 case BuiltinType::SveFloat32:
2511 case BuiltinType::SveFloat64:
2512 case BuiltinType::SveBFloat16:
2513 case BuiltinType::SveBool:
2514 case BuiltinType::SveBoolx2:
2515 case BuiltinType::SveBoolx4:
2533 llvm_unreachable(
"Unhandled type");
2540 if (BTy->
getKind() == BuiltinType::SveBool)
2550 if (
const BuiltinType *BT = getAs<BuiltinType>()) {
2551 switch (BT->getKind()) {
2552#define RVV_VECTOR_TYPE(Name, Id, SingletonId, NumEls, ElBits, NF, IsSigned, \
2554 case BuiltinType::Id: \
2556#define RVV_PREDICATE_TYPE(Name, Id, SingletonId, NumEls) \
2557 case BuiltinType::Id: \
2559#include "clang/Basic/RISCVVTypes.def"
2573#define RVV_PREDICATE_TYPE(Name, Id, SingletonId, NumEls) \
2574 case BuiltinType::Id: \
2575 return Ctx.UnsignedCharTy;
2578#include "clang/Basic/RISCVVTypes.def"
2581 llvm_unreachable(
"Unhandled type");
2599 if ((*this)->isIncompleteArrayType())
2602 if ((*this)->isIncompleteType())
2611 default:
return false;
2612 case Type::VariableArray:
2613 case Type::ConstantArray:
2617 case Type::ObjCObjectPointer:
2618 case Type::BlockPointer:
2622 case Type::MemberPointer:
2624 case Type::ExtVector:
2632 if (
const auto *ClassDecl =
2633 dyn_cast<CXXRecordDecl>(cast<RecordType>(CanonicalType)->getDecl()))
2634 return ClassDecl->isPOD();
2648 if ((*this)->isArrayType())
2651 if ((*this)->isSizelessBuiltinType())
2656 if ((*this)->isIncompleteType())
2675 if (
const auto *ClassDecl = dyn_cast<CXXRecordDecl>(RT->getDecl())) {
2682 return ClassDecl->hasTrivialDefaultConstructor() &&
2683 !ClassDecl->hasNonTrivialDefaultConstructor() &&
2684 ClassDecl->isTriviallyCopyable();
2696 bool IsCopyConstructible) {
2697 if (
type->isArrayType())
2699 Context, IsCopyConstructible);
2701 if (
type.hasNonTrivialObjCLifetime())
2726 if (
const auto *ClassDecl = dyn_cast<CXXRecordDecl>(RT->getDecl())) {
2727 if (IsCopyConstructible) {
2728 return ClassDecl->isTriviallyCopyConstructible();
2730 return ClassDecl->isTriviallyCopyable();
2758 return RD->canPassInRegisters();
2775 if (
Decl->isUnion())
2777 if (
Decl->isLambda())
2778 return Decl->isCapturelessLambda();
2781 return Function->getOverloadedOperator() ==
2782 OverloadedOperatorKind::OO_EqualEqual &&
2784 (
Function->getParamDecl(0)->getType()->isReferenceType() ||
2785 Decl->isTriviallyCopyable());
2788 if (llvm::none_of(
Decl->methods(), IsDefaultedOperatorEqualEqual) &&
2790 if (
NamedDecl *ND = Friend->getFriendDecl()) {
2792 IsDefaultedOperatorEqualEqual(ND->getAsFunction());
2798 return llvm::all_of(
Decl->bases(),
2800 if (const auto *RD = BS.getType()->getAsCXXRecordDecl())
2801 return HasNonDeletedDefaultedEqualityComparison(RD);
2805 auto Type = FD->getType();
2806 if (Type->isArrayType())
2807 Type = Type->getBaseElementTypeUnsafe()->getCanonicalTypeUnqualified();
2809 if (Type->isReferenceType() || Type->isEnumeralType())
2811 if (const auto *RD = Type->getAsCXXRecordDecl())
2812 return HasNonDeletedDefaultedEqualityComparison(RD);
2830 CanonicalType,
false);
2866 if (
const auto *RT =
2867 getTypePtr()->getBaseElementTypeUnsafe()->getAs<RecordType>())
2868 if (RT->getDecl()->isNonTrivialToPrimitiveDefaultInitialize())
2882 if (
const auto *RT =
2883 getTypePtr()->getBaseElementTypeUnsafe()->getAs<RecordType>())
2884 if (RT->getDecl()->isNonTrivialToPrimitiveCopy())
2920 assert(BaseTy &&
"NULL element type");
2950 if (
const auto *ClassDecl = dyn_cast<CXXRecordDecl>(RT->getDecl()))
2951 return ClassDecl->isLiteral();
2958 return AT->getValueType()->isLiteralType(Ctx);
2980 return RD->isStructural();
2993 assert(BaseTy &&
"NULL element type");
3003 if (
const auto *ClassDecl = dyn_cast<CXXRecordDecl>(RT->getDecl()))
3004 if (!ClassDecl->isStandardLayout())
3032 assert(BaseTy &&
"NULL element type");
3045 if (
const auto *ClassDecl = dyn_cast<CXXRecordDecl>(RT->getDecl())) {
3048 if (!ClassDecl->isTrivial())
return false;
3053 if (!ClassDecl->isStandardLayout())
return false;
3082 if (
const auto *ET = getAs<EnumType>()) {
3084 if (II && II->
isStr(
"align_val_t") && ET->getDecl()->isInStdNamespace())
3091 if (
const auto *ET = getAs<EnumType>()) {
3093 if (II && II->
isStr(
"byte") && ET->getDecl()->isInStdNamespace())
3109 case TemplateTypeParm:
3110 case SubstTemplateTypeParm:
3111 case TemplateSpecialization:
3114 case DependentTemplateSpecialization:
3158 llvm_unreachable(
"Type specifier is not a tag type kind.");
3175 llvm_unreachable(
"Unknown tag type kind.");
3193 llvm_unreachable(
"Elaborated type keyword is not a tag type kind.");
3195 llvm_unreachable(
"Unknown elaborated type keyword.");
3211 llvm_unreachable(
"Unknown elaborated type keyword.");
3225 return "__interface";
3232 llvm_unreachable(
"Unknown elaborated type keyword.");
3235DependentTemplateSpecializationType::DependentTemplateSpecializationType(
3242 NNS(NNS), Name(Name) {
3245 "DependentTemplateSpecializatonType requires dependent qualifier");
3246 auto *ArgBuffer =
const_cast<TemplateArgument *
>(template_arguments().data());
3249 TemplateArgumentDependence::UnexpandedPack));
3262 ID.AddInteger(llvm::to_underlying(Keyword));
3263 ID.AddPointer(Qualifier);
3264 ID.AddPointer(Name);
3266 Arg.Profile(ID, Context);
3271 if (
const auto *Elab = dyn_cast<ElaboratedType>(
this))
3272 Keyword = Elab->getKeyword();
3273 else if (
const auto *DepName = dyn_cast<DependentNameType>(
this))
3274 Keyword = DepName->getKeyword();
3275 else if (
const auto *DepTST =
3276 dyn_cast<DependentTemplateSpecializationType>(
this))
3277 Keyword = DepTST->getKeyword();
3286#define ABSTRACT_TYPE(Derived, Base)
3287#define TYPE(Derived, Base) case Derived: return #Derived;
3288#include "clang/AST/TypeNodes.inc"
3291 llvm_unreachable(
"Invalid type class.");
3299 return Policy.
Bool ?
"bool" :
"_Bool";
3305 return "signed char";
3317 return "unsigned char";
3319 return "unsigned short";
3321 return "unsigned int";
3323 return "unsigned long";
3325 return "unsigned long long";
3327 return "unsigned __int128";
3329 return Policy.
Half ?
"half" :
"__fp16";
3337 return "long double";
3339 return "short _Accum";
3343 return "long _Accum";
3345 return "unsigned short _Accum";
3347 return "unsigned _Accum";
3349 return "unsigned long _Accum";
3350 case BuiltinType::ShortFract:
3351 return "short _Fract";
3352 case BuiltinType::Fract:
3354 case BuiltinType::LongFract:
3355 return "long _Fract";
3356 case BuiltinType::UShortFract:
3357 return "unsigned short _Fract";
3358 case BuiltinType::UFract:
3359 return "unsigned _Fract";
3360 case BuiltinType::ULongFract:
3361 return "unsigned long _Fract";
3362 case BuiltinType::SatShortAccum:
3363 return "_Sat short _Accum";
3364 case BuiltinType::SatAccum:
3365 return "_Sat _Accum";
3366 case BuiltinType::SatLongAccum:
3367 return "_Sat long _Accum";
3368 case BuiltinType::SatUShortAccum:
3369 return "_Sat unsigned short _Accum";
3370 case BuiltinType::SatUAccum:
3371 return "_Sat unsigned _Accum";
3372 case BuiltinType::SatULongAccum:
3373 return "_Sat unsigned long _Accum";
3374 case BuiltinType::SatShortFract:
3375 return "_Sat short _Fract";
3376 case BuiltinType::SatFract:
3377 return "_Sat _Fract";
3378 case BuiltinType::SatLongFract:
3379 return "_Sat long _Fract";
3380 case BuiltinType::SatUShortFract:
3381 return "_Sat unsigned short _Fract";
3382 case BuiltinType::SatUFract:
3383 return "_Sat unsigned _Fract";
3384 case BuiltinType::SatULongFract:
3385 return "_Sat unsigned long _Fract";
3389 return "__float128";
3394 return Policy.
MSWChar ?
"__wchar_t" :
"wchar_t";
3404 return "<overloaded function type>";
3406 return "<bound member function type>";
3407 case UnresolvedTemplate:
3408 return "<unresolved template type>";
3410 return "<pseudo-object type>";
3412 return "<dependent type>";
3414 return "<unknown type>";
3415 case ARCUnbridgedCast:
3416 return "<ARC unbridged cast type>";
3418 return "<builtin fn type>";
3425#define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \
3427 return "__" #Access " " #ImgType "_t";
3428#include "clang/Basic/OpenCLImageTypes.def"
3434 return "clk_event_t";
3438 return "reserve_id_t";
3439 case IncompleteMatrixIdx:
3440 return "<incomplete matrix index type>";
3442 return "<array section type>";
3443 case OMPArrayShaping:
3444 return "<OpenMP array shaping type>";
3446 return "<OpenMP iterator type>";
3447#define EXT_OPAQUE_TYPE(ExtType, Id, Ext) \
3450#include "clang/Basic/OpenCLExtensionTypes.def"
3451#define SVE_TYPE(Name, Id, SingletonId) \
3454#include "clang/Basic/AArch64SVEACLETypes.def"
3455#define PPC_VECTOR_TYPE(Name, Id, Size) \
3458#include "clang/Basic/PPCTypes.def"
3459#define RVV_TYPE(Name, Id, SingletonId) \
3462#include "clang/Basic/RISCVVTypes.def"
3463#define WASM_TYPE(Name, Id, SingletonId) \
3466#include "clang/Basic/WebAssemblyReferenceTypes.def"
3469 llvm_unreachable(
"Invalid builtin type.");
3474 if (
auto *PET = dyn_cast<PackExpansionType>(
getTypePtr()))
3475 return PET->getPattern();
3480 if (
const auto *RefType =
getTypePtr()->getAs<ReferenceType>())
3497 case CC_C:
return "cdecl";
3525 llvm_unreachable(
"Invalid calling convention.");
3543 assert(
getNumParams() == params.size() &&
"NumParams overflow!");
3551 auto &ExtraBits = *getTrailingObjects<FunctionTypeExtraBitfields>();
3558 auto &ArmTypeAttrs = *getTrailingObjects<FunctionTypeArmAttributes>();
3559 ArmTypeAttrs = FunctionTypeArmAttributes();
3562 auto &ExtraBits = *getTrailingObjects<FunctionTypeExtraBitfields>();
3563 ExtraBits.HasArmTypeAttributes =
true;
3567 auto *argSlot = getTrailingObjects<QualType>();
3570 ~TypeDependence::VariablyModified);
3571 argSlot[i] = params[i];
3576 auto &ArmTypeAttrs = *getTrailingObjects<FunctionTypeArmAttributes>();
3578 "Not enough bits to encode SME attributes");
3584 auto &ExtraBits = *getTrailingObjects<FunctionTypeExtraBitfields>();
3586 assert(NumExceptions <= 1023 &&
"Not enough bits to encode exceptions");
3587 ExtraBits.NumExceptionType = NumExceptions;
3589 assert(hasExtraBitfields() &&
"missing trailing extra bitfields!");
3591 reinterpret_cast<QualType *
>(getTrailingObjects<ExceptionType>());
3599 (TypeDependence::Instantiation | TypeDependence::UnexpandedPack));
3601 exnSlot[I++] = ExceptionType;
3615 (TypeDependence::Instantiation | TypeDependence::UnexpandedPack));
3621 auto **slot = getTrailingObjects<FunctionDecl *>();
3629 auto **slot = getTrailingObjects<FunctionDecl *>();
3648 auto *extParamInfos = getTrailingObjects<ExtParameterInfo>();
3655 *getTrailingObjects<Qualifiers>() = epi.
TypeQuals;
3662 auto &EllipsisLoc = *getTrailingObjects<SourceLocation>();
3669 return NE->isValueDependent();
3681 return NE->isInstantiationDependent();
3692 llvm_unreachable(
"should not call this with unresolved exception specs");
3718 llvm_unreachable(
"unexpected exception specification kind");
3722 for (
unsigned ArgIdx =
getNumParams(); ArgIdx; --ArgIdx)
3730 const QualType *ArgTys,
unsigned NumParams,
3731 const ExtProtoInfo &epi,
3753 ID.AddPointer(
Result.getAsOpaquePtr());
3754 for (
unsigned i = 0; i != NumParams; ++i)
3755 ID.AddPointer(ArgTys[i].getAsOpaquePtr());
3759 assert(!(
unsigned(epi.Variadic) & ~1) &&
3760 !(
unsigned(epi.RefQualifier) & ~3) &&
3761 !(
unsigned(epi.ExceptionSpec.Type) & ~15) &&
3762 "Values larger than expected.");
3763 ID.AddInteger(
unsigned(epi.Variadic) +
3764 (epi.RefQualifier << 1) +
3765 (epi.ExceptionSpec.Type << 3));
3766 ID.Add(epi.TypeQuals);
3768 for (
QualType Ex : epi.ExceptionSpec.Exceptions)
3771 epi.ExceptionSpec.NoexceptExpr->Profile(ID, Context, Canonical);
3774 ID.AddPointer(epi.ExceptionSpec.SourceDecl->getCanonicalDecl());
3776 if (epi.ExtParameterInfos) {
3777 for (
unsigned i = 0; i != NumParams; ++i)
3778 ID.AddInteger(epi.ExtParameterInfos[i].getOpaqueValue());
3781 epi.ExtInfo.Profile(ID);
3782 ID.AddInteger((epi.AArch64SMEAttributes << 1) | epi.HasTrailingReturn);
3792 :
Data(D, Deref << DerefShift) {}
3795 return Data.getInt() & DerefMask;
3800 return Data.getOpaqueValue();
3807 Data.setFromOpaqueValue(
V);
3812 :
Type(TC, Canon, Wrapped->getDependence()), WrappedTy(Wrapped) {}
3814CountAttributedType::CountAttributedType(
3818 CountExpr(CountExpr) {
3822 auto *DeclSlot = getTrailingObjects<TypeCoupledDeclRefInfo>();
3824 for (
unsigned i = 0; i != CoupledDecls.size(); ++i)
3825 DeclSlot[i] = CoupledDecls[i];
3832 assert(!isa<TypedefType>(can) &&
"Invalid canonical type");
3834 if (!typeMatchesDecl())
3835 *getTrailingObjects<QualType>() = Underlying;
3840 : *getTrailingObjects<QualType>();
3849 *getTrailingObjects<QualType>() = Underlying;
3855 cast<TypeDecl>(Found->
getTargetDecl())->getTypeForDecl(), 0)
3856 : *getTrailingObjects<QualType>();
3865 while (
auto *InnerMQT = dyn_cast<MacroQualifiedType>(Inner)) {
3868 Inner = InnerMQT->getModifiedType();
3878 ? Can.getAtomicUnqualifiedType()
3881 (E->getType()->getDependence() &
3902 E->
Profile(ID, Context,
true);
3903 ID.AddBoolean(IsUnqual);
3910 :
Type(Decltype, can,
3914 (E->getType()->getDependence() &
3916 E(E), UnderlyingType(underlyingType) {}
3932 E->
Profile(ID, Context,
true);
3939 :
Type(PackIndexing, Canonical,
3941 Context(Context), Pattern(Pattern), IndexExpr(IndexExpr),
3942 Size(Expansions.size()) {
3944 std::uninitialized_copy(Expansions.begin(), Expansions.end(),
3945 getTrailingObjects<QualType>());
3950 return std::nullopt;
3954 return std::nullopt;
3956 assert(Index.isNonNegative() &&
"Invalid index");
3957 return static_cast<unsigned>(Index.getExtValue());
3961PackIndexingType::computeDependence(
QualType Pattern,
Expr *IndexExpr,
3966 ? TypeDependence::DependentInstantiation
3967 : TypeDependence::None);
3968 if (Expansions.empty())
3969 TD |= Pattern->
getDependence() & TypeDependence::DependentInstantiation;
3974 if (!(IndexD & TypeDependence::UnexpandedPack))
3975 TD &= ~TypeDependence::UnexpandedPack;
3980 TD |= TypeDependence::Error | TypeDependence::DependentInstantiation;
3989 E->
Profile(ID, Context,
true);
3995 :
Type(UnaryTransform, CanonicalType, BaseType->getDependence()),
3996 BaseType(BaseType), UnderlyingType(UnderlyingType), UKind(UKind) {}
4010 for (
auto *I :
decl->redecls()) {
4011 if (I->isCompleteDefinition() || I->isBeingDefined())
4027 std::vector<const RecordType*> RecordTypeList;
4028 RecordTypeList.push_back(
this);
4029 unsigned NextToCheckIndex = 0;
4031 while (RecordTypeList.size() > NextToCheckIndex) {
4033 RecordTypeList[NextToCheckIndex]->
getDecl()->fields()) {
4039 if (!llvm::is_contained(RecordTypeList, FieldRecTy))
4040 RecordTypeList.push_back(FieldRecTy);
4055 case attr::ObjCOwnership:
4056 case attr::ObjCInertUnsafeUnretained:
4057 case attr::TypeNonNull:
4058 case attr::TypeNullable:
4059 case attr::TypeNullableResult:
4060 case attr::TypeNullUnspecified:
4061 case attr::LifetimeBound:
4062 case attr::AddressSpace:
4075 default:
return false;
4082 llvm_unreachable(
"invalid attr kind");
4092 default:
return false;
4095 case attr::FastCall:
4097 case attr::ThisCall:
4099 case attr::SwiftCall:
4100 case attr::SwiftAsyncCall:
4101 case attr::VectorCall:
4102 case attr::AArch64VectorPcs:
4103 case attr::AArch64SVEPcs:
4104 case attr::AMDGPUKernelCall:
4108 case attr::IntelOclBicc:
4109 case attr::PreserveMost:
4110 case attr::PreserveAll:
4112 case attr::PreserveNone:
4113 case attr::RISCVVectorCC:
4116 llvm_unreachable(
"invalid attr kind");
4129 if (
const auto *TTP = dyn_cast<TemplateTypeParmDecl>(D))
4131 return cast<TemplateTypeParmDecl>(
4135SubstTemplateTypeParmType::SubstTemplateTypeParmType(
4136 QualType Replacement,
Decl *AssociatedDecl,
unsigned Index,
4137 std::optional<unsigned> PackIndex)
4138 :
Type(SubstTemplateTypeParm, Replacement.getCanonicalType(),
4139 Replacement->getDependence()),
4140 AssociatedDecl(AssociatedDecl) {
4141 SubstTemplateTypeParmTypeBits.HasNonCanonicalUnderlyingType =
4142 Replacement != getCanonicalTypeInternal();
4143 if (SubstTemplateTypeParmTypeBits.HasNonCanonicalUnderlyingType)
4144 *getTrailingObjects<QualType>() = Replacement;
4146 SubstTemplateTypeParmTypeBits.Index = Index;
4147 SubstTemplateTypeParmTypeBits.PackIndex = PackIndex ? *PackIndex + 1 : 0;
4148 assert(AssociatedDecl !=
nullptr);
4156SubstTemplateTypeParmPackType::SubstTemplateTypeParmPackType(
4157 QualType Canon,
Decl *AssociatedDecl,
unsigned Index,
bool Final,
4159 :
Type(SubstTemplateTypeParmPack, Canon,
4162 Arguments(ArgPack.pack_begin()),
4163 AssociatedDeclAndFinal(AssociatedDecl, Final) {
4166 assert(AssociatedDecl !=
nullptr);
4170 return AssociatedDeclAndFinal.getPointer();
4174 return AssociatedDeclAndFinal.getInt();
4195 const Decl *AssociatedDecl,
4196 unsigned Index,
bool Final,
4198 ID.AddPointer(AssociatedDecl);
4199 ID.AddInteger(Index);
4200 ID.AddBoolean(Final);
4203 ID.AddPointer(
P.getAsType().getAsOpaquePtr());
4214 if (Arg.isDependent())
4222 if (ArgLoc.getArgument().isInstantiationDependent())
4228TemplateSpecializationType::TemplateSpecializationType(
4231 :
Type(TemplateSpecialization, Canon.isNull() ?
QualType(this, 0) : Canon,
4241 assert(!
T.getAsDependentTemplateName() &&
4242 "Use DependentTemplateSpecializationType for dependent template-name");
4247 "Unexpected template name for TemplateSpecializationType");
4260 ~TypeDependence::Dependent);
4263 TypeDependence::VariablyModified);
4270 *
reinterpret_cast<QualType *
>(
Begin + Args.size()) = AliasedType;
4275 assert(
isTypeAlias() &&
"not a type alias template specialization");
4293 Arg.Profile(ID, Context);
4318 ID.AddInteger(typeArgs.size());
4319 for (
auto typeArg : typeArgs)
4320 ID.AddPointer(typeArg.getAsOpaquePtr());
4321 ID.AddInteger(protocols.size());
4322 for (
auto *proto : protocols)
4323 ID.AddPointer(proto);
4324 ID.AddBoolean(isKindOf);
4337 ID.AddPointer(OTPDecl);
4339 ID.AddInteger(protocols.size());
4340 for (
auto *proto : protocols)
4341 ID.AddPointer(proto);
4352class CachedProperties {
4357 CachedProperties(
Linkage L,
bool local) : L(L), local(local) {}
4359 Linkage getLinkage()
const {
return L; }
4360 bool hasLocalOrUnnamedType()
const {
return local; }
4362 friend CachedProperties merge(CachedProperties L, CachedProperties R) {
4364 return CachedProperties(MergedLinkage, L.hasLocalOrUnnamedType() ||
4365 R.hasLocalOrUnnamedType());
4381 return get(
T.getTypePtr());
4386 return CachedProperties(
T->
TypeBits.getLinkage(),
4428#define TYPE(Class,Base)
4429#define NON_CANONICAL_TYPE(Class,Base) case Type::Class:
4430#include "clang/AST/TypeNodes.inc"
4431 llvm_unreachable(
"didn't expect a non-canonical type here");
4433#define TYPE(Class,Base)
4434#define DEPENDENT_TYPE(Class,Base) case Type::Class:
4435#define NON_CANONICAL_UNLESS_DEPENDENT_TYPE(Class,Base) case Type::Class:
4436#include "clang/AST/TypeNodes.inc"
4443 case Type::DeducedTemplateSpecialization:
4457 const TagDecl *Tag = cast<TagType>(
T)->getDecl();
4464 bool IsLocalOrUnnamed =
4467 return CachedProperties(L, IsLocalOrUnnamed);
4474 return Cache::get(cast<ComplexType>(
T)->getElementType());
4476 return Cache::get(cast<PointerType>(
T)->getPointeeType());
4477 case Type::BlockPointer:
4478 return Cache::get(cast<BlockPointerType>(
T)->getPointeeType());
4479 case Type::LValueReference:
4480 case Type::RValueReference:
4481 return Cache::get(cast<ReferenceType>(
T)->getPointeeType());
4482 case Type::MemberPointer: {
4483 const auto *MPT = cast<MemberPointerType>(
T);
4487 case Type::ConstantArray:
4488 case Type::IncompleteArray:
4489 case Type::VariableArray:
4490 case Type::ArrayParameter:
4491 return Cache::get(cast<ArrayType>(
T)->getElementType());
4493 case Type::ExtVector:
4494 return Cache::get(cast<VectorType>(
T)->getElementType());
4495 case Type::ConstantMatrix:
4496 return Cache::get(cast<ConstantMatrixType>(
T)->getElementType());
4497 case Type::FunctionNoProto:
4498 return Cache::get(cast<FunctionType>(
T)->getReturnType());
4499 case Type::FunctionProto: {
4500 const auto *FPT = cast<FunctionProtoType>(
T);
4501 CachedProperties result =
Cache::get(FPT->getReturnType());
4502 for (
const auto &ai : FPT->param_types())
4506 case Type::ObjCInterface: {
4507 Linkage L = cast<ObjCInterfaceType>(
T)->getDecl()->getLinkageInternal();
4508 return CachedProperties(L,
false);
4510 case Type::ObjCObject:
4511 return Cache::get(cast<ObjCObjectType>(
T)->getBaseType());
4512 case Type::ObjCObjectPointer:
4513 return Cache::get(cast<ObjCObjectPointerType>(
T)->getPointeeType());
4515 return Cache::get(cast<AtomicType>(
T)->getValueType());
4517 return Cache::get(cast<PipeType>(
T)->getElementType());
4520 llvm_unreachable(
"unhandled type class");
4531 return TypeBits.hasLocalOrUnnamedType();
4536#define TYPE(Class,Base)
4537#define NON_CANONICAL_TYPE(Class,Base) case Type::Class:
4538#include "clang/AST/TypeNodes.inc"
4539 llvm_unreachable(
"didn't expect a non-canonical type here");
4541#define TYPE(Class,Base)
4542#define DEPENDENT_TYPE(Class,Base) case Type::Class:
4543#define NON_CANONICAL_UNLESS_DEPENDENT_TYPE(Class,Base) case Type::Class:
4544#include "clang/AST/TypeNodes.inc"
4554 case Type::DeducedTemplateSpecialization:
4565 case Type::BlockPointer:
4567 case Type::LValueReference:
4568 case Type::RValueReference:
4570 case Type::MemberPointer: {
4571 const auto *MPT = cast<MemberPointerType>(
T);
4576 case Type::ConstantArray:
4577 case Type::IncompleteArray:
4578 case Type::VariableArray:
4579 case Type::ArrayParameter:
4582 case Type::ExtVector:
4584 case Type::ConstantMatrix:
4586 cast<ConstantMatrixType>(
T)->getElementType());
4587 case Type::FunctionNoProto:
4589 case Type::FunctionProto: {
4590 const auto *FPT = cast<FunctionProtoType>(
T);
4592 for (
const auto &ai : FPT->param_types())
4596 case Type::ObjCInterface:
4598 case Type::ObjCObject:
4600 case Type::ObjCObjectPointer:
4602 cast<ObjCObjectPointerType>(
T)->getPointeeType());
4609 llvm_unreachable(
"unhandled type class");
4640 if (
auto Nullability = AT->getImmediateNullability())
4643 Type = AT->getEquivalentType();
4645 return std::nullopt;
4651 switch (
type->getTypeClass()) {
4653#define NON_CANONICAL_TYPE(Class, Parent) \
4655 llvm_unreachable("non-canonical type");
4656#define TYPE(Class, Parent)
4657#include "clang/AST/TypeNodes.inc"
4661 case Type::BlockPointer:
4662 case Type::MemberPointer:
4663 case Type::ObjCObjectPointer:
4667 case Type::UnresolvedUsing:
4668 case Type::TypeOfExpr:
4670 case Type::Decltype:
4671 case Type::PackIndexing:
4672 case Type::UnaryTransform:
4673 case Type::TemplateTypeParm:
4674 case Type::SubstTemplateTypeParmPack:
4675 case Type::DependentName:
4676 case Type::DependentTemplateSpecialization:
4678 return ResultIfUnknown;
4681 case Type::TemplateSpecialization:
4684 cast<TemplateSpecializationType>(
type.getTypePtr())
4686 .getAsTemplateDecl())
4687 if (
auto *CTD = dyn_cast<ClassTemplateDecl>(templateDecl))
4688 return CTD->getTemplatedDecl()->hasAttr<TypeNullableAttr>();
4689 return ResultIfUnknown;
4692 switch (cast<BuiltinType>(
type.getTypePtr())->getKind()) {
4694#define SIGNED_TYPE(Id, SingletonId) case BuiltinType::Id:
4695#define UNSIGNED_TYPE(Id, SingletonId) case BuiltinType::Id:
4696#define FLOATING_TYPE(Id, SingletonId) case BuiltinType::Id:
4697#define BUILTIN_TYPE(Id, SingletonId)
4698#include "clang/AST/BuiltinTypes.def"
4701 case BuiltinType::UnresolvedTemplate:
4703 case BuiltinType::Dependent:
4704 case BuiltinType::Overload:
4705 case BuiltinType::BoundMember:
4706 case BuiltinType::PseudoObject:
4707 case BuiltinType::UnknownAny:
4708 case BuiltinType::ARCUnbridgedCast:
4709 return ResultIfUnknown;
4711 case BuiltinType::Void:
4712 case BuiltinType::ObjCId:
4713 case BuiltinType::ObjCClass:
4714 case BuiltinType::ObjCSel:
4715#define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \
4716 case BuiltinType::Id:
4717#include "clang/Basic/OpenCLImageTypes.def"
4718#define EXT_OPAQUE_TYPE(ExtType, Id, Ext) \
4719 case BuiltinType::Id:
4720#include "clang/Basic/OpenCLExtensionTypes.def"
4721 case BuiltinType::OCLSampler:
4722 case BuiltinType::OCLEvent:
4723 case BuiltinType::OCLClkEvent:
4724 case BuiltinType::OCLQueue:
4725 case BuiltinType::OCLReserveID:
4726#define SVE_TYPE(Name, Id, SingletonId) \
4727 case BuiltinType::Id:
4728#include "clang/Basic/AArch64SVEACLETypes.def"
4729#define PPC_VECTOR_TYPE(Name, Id, Size) \
4730 case BuiltinType::Id:
4731#include "clang/Basic/PPCTypes.def"
4732#define RVV_TYPE(Name, Id, SingletonId) case BuiltinType::Id:
4733#include "clang/Basic/RISCVVTypes.def"
4734#define WASM_TYPE(Name, Id, SingletonId) case BuiltinType::Id:
4735#include "clang/Basic/WebAssemblyReferenceTypes.def"
4736 case BuiltinType::BuiltinFn:
4737 case BuiltinType::NullPtr:
4738 case BuiltinType::IncompleteMatrixIdx:
4739 case BuiltinType::ArraySection:
4740 case BuiltinType::OMPArrayShaping:
4741 case BuiltinType::OMPIterator:
4744 llvm_unreachable(
"unknown builtin type");
4746 case Type::Record: {
4750 if (
const auto *CTSD = dyn_cast<ClassTemplateSpecializationDecl>(RD))
4751 return CTSD->getSpecializedTemplate()
4752 ->getTemplatedDecl()
4753 ->
hasAttr<TypeNullableAttr>();
4754 return RD->
hasAttr<TypeNullableAttr>();
4759 case Type::LValueReference:
4760 case Type::RValueReference:
4761 case Type::ConstantArray:
4762 case Type::IncompleteArray:
4763 case Type::VariableArray:
4764 case Type::DependentSizedArray:
4765 case Type::DependentVector:
4766 case Type::DependentSizedExtVector:
4768 case Type::ExtVector:
4769 case Type::ConstantMatrix:
4770 case Type::DependentSizedMatrix:
4771 case Type::DependentAddressSpace:
4772 case Type::FunctionProto:
4773 case Type::FunctionNoProto:
4774 case Type::DeducedTemplateSpecialization:
4776 case Type::InjectedClassName:
4777 case Type::PackExpansion:
4778 case Type::ObjCObject:
4779 case Type::ObjCInterface:
4783 case Type::DependentBitInt:
4784 case Type::ArrayParameter:
4787 llvm_unreachable(
"bad type kind!");
4799 return std::nullopt;
4802std::optional<NullabilityKind>
4805 if (
auto MacroTy = dyn_cast<MacroQualifiedType>(
T))
4806 AttrTy = MacroTy->getUnderlyingType();
4808 if (
auto attributed = dyn_cast<AttributedType>(AttrTy)) {
4809 if (
auto nullability = attributed->getImmediateNullability()) {
4810 T = attributed->getModifiedType();
4815 return std::nullopt;
4819 const auto *objcPtr = getAs<ObjCObjectPointerType>();
4823 if (objcPtr->isObjCIdType()) {
4834 }
else if (objcPtr->isObjCQualifiedIdType()) {
4859 "cannot query implicit lifetime for non-inferrable type");
4864 while (
const auto *array = dyn_cast<ArrayType>(canon))
4865 canon = array->getElementType().getTypePtr();
4867 if (
const auto *opt = dyn_cast<ObjCObjectPointerType>(canon)) {
4869 if (opt->getObjectType()->isObjCClass())
4877 if (
const auto *
typedefType = getAs<TypedefType>())
4878 return typedefType->getDecl()->hasAttr<ObjCNSObjectAttr>();
4883 if (
const auto *
typedefType = getAs<TypedefType>())
4884 return typedefType->getDecl()->hasAttr<ObjCIndependentClassAttr>();
4897 if (
const auto *OPT = getAs<PointerType>())
4898 return OPT->getPointeeType()->isObjCIndirectLifetimeType();
4899 if (
const auto *Ref = getAs<ReferenceType>())
4900 return Ref->getPointeeType()->isObjCIndirectLifetimeType();
4901 if (
const auto *MemPtr = getAs<MemberPointerType>())
4902 return MemPtr->getPointeeType()->isObjCIndirectLifetimeType();
4910 while (
const ArrayType *array =
type->getAsArrayTypeUnsafe())
4911 type = array->getElementType().getTypePtr();
4912 return type->isObjCRetainableType();
4923 const auto *
Pointer = getAs<PointerType>();
4933 if (
const auto *RT = getAs<RecordType>())
4934 return RT->getDecl()->hasAttr<CUDADeviceBuiltinSurfaceTypeAttr>();
4940 if (
const auto *RT = getAs<RecordType>())
4941 return RT->getDecl()->hasAttr<CUDADeviceBuiltinTextureTypeAttr>();
4948 if (
const auto *ptr = getAs<PointerType>())
4949 return ptr->getPointeeType()->hasSizedVLAType();
4950 if (
const auto *ref = getAs<ReferenceType>())
4951 return ref->getPointeeType()->hasSizedVLAType();
4953 if (isa<VariableArrayType>(arr) &&
4954 cast<VariableArrayType>(arr)->getSizeExpr())
4957 return arr->getElementType()->hasSizedVLAType();
4964 switch (
type.getObjCLifetime()) {
4976 if (
const auto *RT =
4979 if (
const auto *CXXRD = dyn_cast<CXXRecordDecl>(RD)) {
4981 if (CXXRD->hasDefinition() && !CXXRD->hasTrivialDestructor())
4999 llvm::APSInt Val,
unsigned Scale) {
5000 llvm::FixedPointSemantics FXSema(Val.getBitWidth(), Scale, Val.isSigned(),
5003 llvm::APFixedPoint(Val, FXSema).toString(Str);
5011 AutoTypeBits.Keyword = llvm::to_underlying(Keyword);
5012 AutoTypeBits.NumArgs = TypeConstraintArgs.size();
5013 this->TypeConstraintConcept = TypeConstraintConcept;
5014 assert(TypeConstraintConcept || AutoTypeBits.NumArgs == 0);
5015 if (TypeConstraintConcept) {
5034 ID.AddInteger((
unsigned)Keyword);
5035 ID.AddBoolean(IsDependent);
5038 Arg.Profile(ID, Context);
Defines the clang::ASTContext interface.
Provides definitions for the various language-specific address spaces.
Defines the C++ Decl subclasses, other than those for templates (found in DeclTemplate....
Defines the C++ template declaration subclasses.
Defines the ExceptionSpecificationType enumeration and various utility functions.
Defines the clang::IdentifierInfo, clang::IdentifierTable, and clang::Selector interfaces.
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified.
Defines the clang::LangOptions interface.
llvm::MachO::Record Record
static bool isRecordType(QualType T)
Defines various enumerations that describe declaration and type specifiers.
Defines the TargetCXXABI class, which abstracts details of the C++ ABI that we're targeting.
static TagDecl * getInterestingTagDecl(TagDecl *decl)
#define SUGARED_TYPE_CLASS(Class)
static bool HasNonDeletedDefaultedEqualityComparison(const CXXRecordDecl *Decl)
static const TemplateTypeParmDecl * getReplacedParameter(Decl *D, unsigned Index)
static bool isTriviallyCopyableTypeImpl(const QualType &type, const ASTContext &Context, bool IsCopyConstructible)
static const T * getAsSugar(const Type *Cur)
This will check for a T (which should be a Type which can act as sugar, such as a TypedefType) by rem...
#define TRIVIAL_TYPE_CLASS(Class)
static CachedProperties computeCachedProperties(const Type *T)
C Language Family Type Representation.
Defines the clang::Visibility enumeration and various utility functions.
__DEVICE__ void * memcpy(void *__a, const void *__b, size_t __c)
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
BuiltinVectorTypeInfo getBuiltinVectorTypeInfo(const BuiltinType *VecTy) const
Returns the element type, element count and number of vectors (in case of tuple) for a builtin vector...
QualType getAtomicType(QualType T) const
Return the uniqued reference to the atomic type for the specified type.
QualType getParenType(QualType NamedType) const
QualType getRValueReferenceType(QualType T) const
Return the uniqued reference to the type for an rvalue reference to the specified type.
QualType getAttributedType(attr::Kind attrKind, QualType modifiedType, QualType equivalentType) const
QualType getAutoType(QualType DeducedType, AutoTypeKeyword Keyword, bool IsDependent, bool IsPack=false, ConceptDecl *TypeConstraintConcept=nullptr, ArrayRef< TemplateArgument > TypeConstraintArgs={}) const
C++11 deduced auto type.
QualType getObjCInterfaceType(const ObjCInterfaceDecl *Decl, ObjCInterfaceDecl *PrevDecl=nullptr) const
getObjCInterfaceType - Return the unique reference to the type for the specified ObjC interface decl.
QualType getBlockPointerType(QualType T) const
Return the uniqued reference to the type for a block of the specified type.
QualType getMemberPointerType(QualType T, const Type *Cls) const
Return the uniqued reference to the type for a member pointer to the specified type in the specified ...
QualType getVariableArrayType(QualType EltTy, Expr *NumElts, ArraySizeModifier ASM, unsigned IndexTypeQuals, SourceRange Brackets) const
Return a non-unique reference to the type for a variable array of the specified element type.
QualType getFunctionNoProtoType(QualType ResultTy, const FunctionType::ExtInfo &Info) const
Return a K&R style C function type like 'int()'.
QualType getArrayParameterType(QualType Ty) const
Return the uniqued reference to a specified array parameter type from the original array type.
QualType getVectorType(QualType VectorType, unsigned NumElts, VectorKind VecKind) const
Return the unique reference to a vector type of the specified element type and size.
QualType getPointerType(QualType T) const
Return the uniqued reference to the type for a pointer to the specified type.
QualType getLValueReferenceType(QualType T, bool SpelledAsLValue=true) const
Return the uniqued reference to the type for an lvalue reference to the specified type.
QualType getConstantArrayType(QualType EltTy, const llvm::APInt &ArySize, const Expr *SizeExpr, ArraySizeModifier ASM, unsigned IndexTypeQuals) const
Return the unique reference to the type for a constant array of the specified element type.
const LangOptions & getLangOpts() const
QualType applyObjCProtocolQualifiers(QualType type, ArrayRef< ObjCProtocolDecl * > protocols, bool &hasError, bool allowOnPointerType=false) const
Apply Objective-C protocol qualifiers to the given type.
QualType getDecayedType(QualType T) const
Return the uniqued reference to the decayed version of the given type.
bool hasUniqueObjectRepresentations(QualType Ty, bool CheckIfTriviallyCopyable=true) const
Return true if the specified type has unique object representations according to (C++17 [meta....
QualType getBaseElementType(const ArrayType *VAT) const
Return the innermost element type of an array type.
CanQualType ObjCBuiltinIdTy
IdentifierInfo * getNSObjectName() const
Retrieve the identifier 'NSObject'.
CanQualType getSizeType() const
Return the unique type for "size_t" (C99 7.17), defined in <stddef.h>.
QualType getAdjustedType(QualType Orig, QualType New) const
Return the uniqued reference to a type adjusted from the original type to a new type.
QualType getQualifiedType(SplitQualType split) const
Un-split a SplitQualType.
QualType getObjCObjectPointerType(QualType OIT) const
Return a ObjCObjectPointerType type for the given ObjCObjectType.
QualType getObjCObjectType(QualType Base, ObjCProtocolDecl *const *Protocols, unsigned NumProtocols) const
Legacy interface: cannot provide type arguments or __kindof.
const ArrayType * getAsArrayType(QualType T) const
Type Query functions.
uint64_t getTypeSize(QualType T) const
Return the size of the specified (complete) type T, in bits.
CharUnits getTypeSizeInChars(QualType T) const
Return the size of the specified (complete) type T, in characters.
CanQualType UnsignedCharTy
QualType getFunctionType(QualType ResultTy, ArrayRef< QualType > Args, const FunctionProtoType::ExtProtoInfo &EPI) const
Return a normal function type with a typed argument list.
QualType getComplexType(QualType T) const
Return the uniqued reference to the type for a complex number with the specified element type.
QualType getExtVectorType(QualType VectorType, unsigned NumElts) const
Return the unique reference to an extended vector type of the specified element type and size.
const TargetInfo & getTargetInfo() const
QualType getSubstTemplateTypeParmType(QualType Replacement, Decl *AssociatedDecl, unsigned Index, std::optional< unsigned > PackIndex) const
Retrieve a substitution-result type.
QualType getIncompleteArrayType(QualType EltTy, ArraySizeModifier ASM, unsigned IndexTypeQuals) const
Return a unique reference to the type for an incomplete array of the specified element type.
QualType getConstantMatrixType(QualType ElementType, unsigned NumRows, unsigned NumColumns) const
Return the unique reference to the matrix type of the specified element type and size.
IdentifierInfo * getNSCopyingName()
Retrieve the identifier 'NSCopying'.
Represents a type which was implicitly adjusted by the semantic engine for arbitrary reasons.
Represents a constant array type that does not decay to a pointer when used as a function parameter.
Represents an array type, per C99 6.7.5.2 - Array Declarators.
QualType getElementType() const
ArrayType(TypeClass tc, QualType et, QualType can, ArraySizeModifier sm, unsigned tq, const Expr *sz=nullptr)
An attributed type is a type to which a type attribute has been applied.
bool isCallingConv() const
std::optional< NullabilityKind > getImmediateNullability() const
static std::optional< NullabilityKind > stripOuterNullability(QualType &T)
Strip off the top-level nullability annotation on the given type, if it's there.
bool isMSTypeSpec() const
bool isWebAssemblyFuncrefSpec() const
bool isQualifier() const
Does this attribute behave like a type qualifier?
Represents a C++11 auto or C++14 decltype(auto) type, possibly constrained by a type-constraint.
ArrayRef< TemplateArgument > getTypeConstraintArguments() const
void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Context)
ConceptDecl * getTypeConstraintConcept() const
AutoTypeKeyword getKeyword() const
BitIntType(bool isUnsigned, unsigned NumBits)
[BoundsSafety] Represents a parent type class for CountAttributedType and similar sugar types that wi...
BoundsAttributedType(TypeClass TC, QualType Wrapped, QualType Canon)
decl_range dependent_decls() const
bool referencesFieldDecls() const
ArrayRef< TypeCoupledDeclRefInfo > Decls
This class is used for builtin types like 'int'.
StringRef getName(const PrintingPolicy &Policy) const
Represents a base class of a C++ class.
Represents a C++ struct/union/class.
bool mayBeNonDynamicClass() const
CXXRecordDecl * getMostRecentNonInjectedDecl()
bool mayBeDynamicClass() const
QuantityType getQuantity() const
getQuantity - Get the raw integer representation of this quantity.
Complex values, per C99 6.2.5p11.
Declaration of a C++20 concept.
Represents the canonical version of C arrays with a specified constant size.
static unsigned getNumAddressingBits(const ASTContext &Context, QualType ElementType, const llvm::APInt &NumElements)
Determine the number of bits required to address a member of.
static unsigned getMaxSizeBits(const ASTContext &Context)
Determine the maximum number of active bits that an array's size can require, which limits the maximu...
llvm::APInt getSize() const
Return the constant array size as an APInt.
void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Ctx)
ConstantExpr - An expression that occurs in a constant context and optionally the result of evaluatin...
llvm::APSInt getResultAsAPSInt() const
Represents a concrete matrix type with constant number of rows and columns.
ConstantMatrixType(QualType MatrixElementType, unsigned NRows, unsigned NColumns, QualType CanonElementType)
Represents a sugar type with __counted_by or __sized_by annotations, including their _or_null variant...
void Profile(llvm::FoldingSetNodeID &ID)
Represents a pointer type decayed from an array or function type.
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
ASTContext & getParentASTContext() const
bool isFunctionOrMethod() const
Decl - This represents one declaration (or definition), e.g.
bool isInStdNamespace() const
bool isFunctionOrFunctionTemplate() const
Whether this declaration is a function or function template.
ASTContext & getASTContext() const LLVM_READONLY
DeclContext * getDeclContext()
virtual Decl * getCanonicalDecl()
Retrieves the "canonical" declaration of the given declaration.
Represents the type decltype(expr) (C++11).
QualType desugar() const
Remove a single level of sugar.
bool isSugared() const
Returns whether this type directly provides sugar.
DecltypeType(Expr *E, QualType underlyingType, QualType can=QualType())
QualType getUnderlyingType() const
Common base class for placeholders for types that get replaced by placeholder type deduction: C++11 a...
QualType getDeducedType() const
Get the type deduced for this placeholder type, or null if it has not been deduced.
void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Context)
Expr * getNumBitsExpr() const
void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Context)
DependentBitIntType(bool IsUnsigned, Expr *NumBits)
void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Context)
DependentDecltypeType(Expr *E, QualType UnderlyingTpe)
void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Context)
Represents an extended vector type where either the type or size is dependent.
void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Context)
Represents a matrix type where the type and the number of rows and columns is dependent on a template...
void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Context)
void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Context)
void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Context)
void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Context)
Represents a type that was referred to using an elaborated type keyword, e.g., struct S,...
bool isComplete() const
Returns true if this can be considered a complete type.
A helper class that allows the use of isa/cast/dyncast to detect TagType objects of enums.
This represents one expression.
bool isValueDependent() const
Determines whether the value of this expression depends on.
bool isTypeDependent() const
Determines whether the type of this expression depends on.
bool isInstantiationDependent() const
Whether this expression is instantiation-dependent, meaning that it depends in some way on.
ExprDependence getDependence() const
ExtVectorType - Extended vector type.
Represents a member of a struct/union/class.
FriendDecl - Represents the declaration of a friend entity, which can be a function,...
Represents a function declaration or definition.
Represents a K&R-style 'int foo()' function, which has no information available about its arguments.
Represents a prototype with parameter type info, e.g.
bool hasDependentExceptionSpec() const
Return whether this function has a dependent exception spec.
param_type_iterator param_type_begin() const
ExceptionSpecificationType getExceptionSpecType() const
Get the kind of exception specification on this function.
bool isTemplateVariadic() const
Determines whether this function prototype contains a parameter pack at the end.
unsigned getNumParams() const
bool hasTrailingReturn() const
Whether this function prototype has a trailing return type.
QualType getParamType(unsigned i) const
QualType getExceptionType(unsigned i) const
Return the ith exception type, where 0 <= i < getNumExceptions().
void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Ctx)
unsigned getNumExceptions() const
Return the number of types in the exception specification.
CanThrowResult canThrow() const
Determine whether this function type has a non-throwing exception specification.
ExtProtoInfo getExtProtoInfo() const
Expr * getNoexceptExpr() const
Return the expression inside noexcept(expression), or a null pointer if there is none (because the ex...
ArrayRef< QualType > getParamTypes() const
ArrayRef< QualType > exceptions() const
bool hasInstantiationDependentExceptionSpec() const
Return whether this function has an instantiation-dependent exception spec.
A class which abstracts out some details necessary for making a call.
FunctionType - C99 6.7.5.3 - Function Declarators.
ExtInfo getExtInfo() const
static StringRef getNameForCallConv(CallingConv CC)
QualType getReturnType() const
One of these records is kept for each identifier that is lexed.
bool isStr(const char(&Str)[StrLen]) const
Return true if this is the identifier for the specified string.
Represents a C array with an unspecified size.
CXXRecordDecl * getDecl() const
An lvalue reference type, per C++11 [dcl.ref].
LinkageInfo computeTypeLinkageInfo(const Type *T)
LinkageInfo getTypeLinkageAndVisibility(const Type *T)
LinkageInfo getDeclLinkageAndVisibility(const NamedDecl *D)
static LinkageInfo external()
Linkage getLinkage() const
void merge(LinkageInfo other)
Merge both linkage and visibility.
Sugar type that represents a type that was qualified by a qualifier written as a macro invocation.
QualType getModifiedType() const
Return this attributed type's modified type with no qualifiers attached to it.
QualType getUnderlyingType() const
const IdentifierInfo * getMacroIdentifier() const
Represents a matrix type, as defined in the Matrix Types clang extensions.
MatrixType(QualType ElementTy, QualType CanonElementTy)
QualType ElementType
The element type of the matrix.
A pointer to member type per C++ 8.3.3 - Pointers to members.
CXXRecordDecl * getMostRecentCXXRecordDecl() const
const Type * getClass() const
This represents a decl that may have a name.
Linkage getLinkageInternal() const
Determine what kind of linkage this entity has.
IdentifierInfo * getIdentifier() const
Get the identifier that names this declaration, if there is one.
Represents a C++ nested name specifier, such as "\::std::vector<int>::".
bool isDependent() const
Whether this nested name specifier refers to a dependent type or not.
ObjCCategoryDecl - Represents a category declaration.
ObjCInterfaceDecl * getClassInterface()
ObjCTypeParamList * getTypeParamList() const
Retrieve the type parameter list associated with this category or extension.
Represents an ObjC class declaration.
ObjCTypeParamList * getTypeParamList() const
Retrieve the type parameters of this class.
const ObjCObjectType * getSuperClassType() const
Retrieve the superclass type.
ObjCInterfaceDecl * getDefinition()
Retrieve the definition of this class, or NULL if this class has been forward-declared (with @class) ...
Interfaces are the core concept in Objective-C for object oriented design.
ObjCInterfaceDecl * getDecl() const
Get the declaration of this interface.
Represents a pointer to an Objective C object.
const ObjCObjectPointerType * stripObjCKindOfTypeAndQuals(const ASTContext &ctx) const
Strip off the Objective-C "kindof" type and (with it) any protocol qualifiers.
const ObjCObjectType * getObjectType() const
Gets the type pointed to by this ObjC pointer.
QualType getSuperClassType() const
Retrieve the type of the superclass of this object pointer type.
ObjCInterfaceDecl * getInterfaceDecl() const
If this pointer points to an Objective @interface type, gets the declaration for that interface.
const ObjCInterfaceType * getInterfaceType() const
If this pointer points to an Objective C @interface type, gets the type for that interface.
bool isKindOfType() const
Whether this is a "__kindof" type.
void Profile(llvm::FoldingSetNodeID &ID)
Represents a class type in Objective C.
bool isKindOfTypeAsWritten() const
Whether this is a "__kindof" type as written.
bool isSpecialized() const
Determine whether this object type is "specialized", meaning that it has type arguments.
ObjCObjectType(QualType Canonical, QualType Base, ArrayRef< QualType > typeArgs, ArrayRef< ObjCProtocolDecl * > protocols, bool isKindOf)
ArrayRef< QualType > getTypeArgsAsWritten() const
Retrieve the type arguments of this object type as they were written.
QualType getBaseType() const
Gets the base type of this object type.
bool isKindOfType() const
Whether this ia a "__kindof" type (semantically).
bool isSpecializedAsWritten() const
Determine whether this object type was written with type arguments.
ArrayRef< QualType > getTypeArgs() const
Retrieve the type arguments of this object type (semantically).
bool isUnspecialized() const
Determine whether this object type is "unspecialized", meaning that it has no type arguments.
QualType stripObjCKindOfTypeAndQuals(const ASTContext &ctx) const
Strip off the Objective-C "kindof" type and (with it) any protocol qualifiers.
void computeSuperClassTypeSlow() const
ObjCInterfaceDecl * getInterface() const
Gets the interface declaration for this object type, if the base type really is an interface.
QualType getSuperClassType() const
Retrieve the type of the superclass of this object type.
Represents an Objective-C protocol declaration.
void initialize(ArrayRef< ObjCProtocolDecl * > protocols)
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.
qual_iterator qual_end() const
qual_iterator qual_begin() const
Represents the declaration of an Objective-C type parameter.
unsigned getIndex() const
Retrieve the index into its type parameter list.
Stores a list of Objective-C type parameters for a parameterized class or a category/extension thereo...
unsigned size() const
Determine the number of type parameters in this list.
Represents a type parameter type in Objective C.
void Profile(llvm::FoldingSetNodeID &ID)
ObjCTypeParamDecl * getDecl() const
Represents a pack expansion of types.
PackIndexingType(const ASTContext &Context, QualType Canonical, QualType Pattern, Expr *IndexExpr, ArrayRef< QualType > Expansions={})
void Profile(llvm::FoldingSetNodeID &ID)
Expr * getIndexExpr() const
std::optional< unsigned > getSelectedIndex() const
Sugar for parentheses used when specifying types.
PointerType - C99 6.7.5.1 - Pointer Declarators.
A (possibly-)qualified type.
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.
QualType withFastQualifiers(unsigned TQs) 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...
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 isNonWeakInMRRWithObjCWeak(const ASTContext &Context) const
const IdentifierInfo * getBaseTypeIdentifier() const
Retrieves a pointer to the name of the base type.
void Profile(llvm::FoldingSetNodeID &ID) const
QualType getDesugaredType(const ASTContext &Context) const
Return the specified type with any "sugar" removed from the type.
bool isTriviallyCopyConstructibleType(const ASTContext &Context) const
Return true if this is a trivially copyable type.
bool isTrivialType(const ASTContext &Context) const
Return true if this is a trivial type per (C++0x [basic.types]p9)
bool isNull() const
Return true if this QualType doesn't point to a type yet.
PrimitiveCopyKind isNonTrivialToPrimitiveCopy() const
Check if this is a non-trivial type that would cause a C struct transitively containing this type to ...
bool isTriviallyRelocatableType(const ASTContext &Context) const
Return true if this is a trivially relocatable type.
const Type * getTypePtr() const
Retrieves a pointer to the underlying (unqualified) type.
LangAS getAddressSpace() const
Return the address space of this type.
bool isConstant(const ASTContext &Ctx) const
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.
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.
QualType getCanonicalType() const
QualType getUnqualifiedType() const
Retrieve the unqualified variant of the given type, removing as little sugar as possible.
bool isTriviallyEqualityComparableType(const ASTContext &Context) const
Return true if this is a trivially equality comparable type.
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.
SplitQualType split() const
Divides a QualType into its unqualified type and a set of local qualifiers.
bool UseExcessPrecision(const ASTContext &Ctx)
PrimitiveDefaultInitializeKind isNonTrivialToPrimitiveDefaultInitialize() const
Functions to query basic properties of non-trivial C struct types.
void * getAsOpaquePtr() const
bool isWebAssemblyExternrefType() const
Returns true if it is a WebAssembly Externref Type.
QualType getNonPackExpansionType() const
Remove an outer pack expansion type (if any) from this type.
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.
QualType substObjCTypeArgs(ASTContext &ctx, ArrayRef< QualType > typeArgs, ObjCSubstitutionContext context) const
Substitute type arguments for the Objective-C type parameters used in the subject type.
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.
bool hasNonTrivialObjCLifetime() const
bool isPODType(const ASTContext &Context) const
Determine whether this is a Plain Old Data (POD) type (C++ 3.9p10).
PrimitiveCopyKind isNonTrivialToPrimitiveDestructiveMove() const
Check if this is a non-trivial type that would cause a C struct transitively containing this type to ...
@ NonConstNonReferenceType
@ PCK_Struct
The type is a struct containing a field whose type is neither PCK_Trivial nor PCK_VolatileTrivial.
@ PCK_Trivial
The type does not fall into any of the following categories.
@ PCK_ARCStrong
The type is an Objective-C retainable pointer type that is qualified with the ARC __strong qualifier.
@ PCK_VolatileTrivial
The type would be trivial except that it is volatile-qualified.
@ PCK_ARCWeak
The type is an Objective-C retainable pointer type that is qualified with the ARC __weak qualifier.
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.
QualType apply(const ASTContext &Context, QualType QT) const
Apply the collected qualifiers to the given type.
The collection of all-type qualifiers we support.
@ 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.
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 addConsistentQualifiers(Qualifiers qs)
Add the qualifiers from the given set to this set, given that they don't conflict.
bool hasAddressSpace() const
unsigned getFastQualifiers() const
bool hasObjCGCAttr() const
bool hasObjCLifetime() const
ObjCLifetime getObjCLifetime() const
LangAS getAddressSpace() const
An rvalue reference type, per C++11 [dcl.ref].
Represents a struct/union/class.
bool hasNonTrivialToPrimitiveDestructCUnion() const
bool hasNonTrivialToPrimitiveCopyCUnion() const
bool hasNonTrivialToPrimitiveDefaultInitializeCUnion() const
bool isNonTrivialToPrimitiveDestroy() const
A helper class that allows the use of isa/cast/dyncast to detect TagType objects of structs/unions/cl...
RecordDecl * getDecl() const
bool hasConstFields() const
Recursively check all fields in the record for const-ness.
Base for LValueReferenceType and RValueReferenceType.
Encodes a location in the source.
A trivial tuple used to represent a source range.
Stmt - This represents one statement.
void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Context, bool Canonical, bool ProfileLambdaExpr=false) const
Produce a unique representation of the given statement.
Decl * getAssociatedDecl() const
A template-like entity which owns the whole pattern being substituted.
IdentifierInfo * getIdentifier() const
TemplateArgument getArgumentPack() const
void Profile(llvm::FoldingSetNodeID &ID)
unsigned getIndex() const
Returns the index of the replaced parameter in the associated declaration.
unsigned getNumArgs() const
const TemplateTypeParmDecl * getReplacedParameter() const
Gets the template parameter declaration that was substituted for.
Represents the result of substituting a type for a template type parameter.
Decl * getAssociatedDecl() const
A template-like entity which owns the whole pattern being substituted.
unsigned getIndex() const
Returns the index of the replaced parameter in the associated declaration.
const TemplateTypeParmDecl * getReplacedParameter() const
Gets the template parameter declaration that was substituted for.
Represents the declaration of a struct/union/class/enum.
bool isBeingDefined() const
Return true if this decl is currently being defined.
bool isCompleteDefinition() const
Return true if this decl has its body fully specified.
bool hasNameForLinkage() const
Is this tag type named, either directly or via being defined in a typedef of this type?
TagType(TypeClass TC, const TagDecl *D, QualType can)
TagDecl * getDecl() const
bool isBeingDefined() const
Determines whether this type is in the process of being defined.
bool isMicrosoft() const
Is this ABI an MSVC-compatible ABI?
Exposes information about the current target.
virtual bool hasLegalHalfType() const
Determine whether _Float16 is supported on this target.
virtual bool hasFullBFloat16Type() const
Determine whether the BFloat type is fully supported on this target, i.e arithemtic operations.
virtual bool hasFloat16Type() const
Determine whether the _Float16 type is supported on this target.
TargetCXXABI getCXXABI() const
Get the C++ ABI currently in use.
virtual bool hasBFloat16Type() const
Determine whether the _BFloat16 type is supported on this target.
A convenient class for passing around template argument information.
llvm::ArrayRef< TemplateArgumentLoc > arguments() const
Location wrapper for a TemplateArgument.
Represents a template argument.
unsigned pack_size() const
The number of template arguments in the given template argument pack.
ArrayRef< TemplateArgument > pack_elements() const
Iterator range referencing all of the elements of a template argument pack.
@ Type
The template argument is a type.
The base class of all kinds of template declarations (e.g., class, function, etc.).
Represents a C++ template name within the type system.
@ UsingTemplate
A template name that refers to a template declaration found through a specific using shadow declarati...
@ Template
A single template declaration.
@ SubstTemplateTemplateParm
A template template parameter that has been substituted for some other template name.
@ SubstTemplateTemplateParmPack
A template template parameter pack that has been substituted for a template template argument pack,...
Represents a type template specialization; the template must be a class template, a type alias templa...
QualType getAliasedType() const
Get the aliased type, if this is a specialization of a type alias template.
ArrayRef< TemplateArgument > template_arguments() const
bool isTypeAlias() const
Determine if this template specialization type is for a type alias template that has been substituted...
static bool anyInstantiationDependentTemplateArguments(ArrayRef< TemplateArgumentLoc > Args)
static bool anyDependentTemplateArguments(ArrayRef< TemplateArgumentLoc > Args, ArrayRef< TemplateArgument > Converted)
Determine whether any of the given template arguments are dependent.
void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Ctx)
Declaration of a template type parameter.
TemplateTypeParmDecl * getDecl() const
IdentifierInfo * getIdentifier() const
[BoundsSafety] Represents information of declarations referenced by the arguments of the counted_by a...
ValueDecl * getDecl() const
bool operator==(const TypeCoupledDeclRefInfo &Other) const
void * getOpaqueValue() const
TypeCoupledDeclRefInfo(ValueDecl *D=nullptr, bool Deref=false)
D is to a declaration referenced by the argument of attribute.
void setFromOpaqueValue(void *V)
TypeOfExprType(Expr *E, TypeOfKind Kind, QualType Can=QualType())
bool isSugared() const
Returns whether this type directly provides sugar.
Expr * getUnderlyingExpr() const
QualType desugar() const
Remove a single level of sugar.
static void ensure(const Type *T)
static CachedProperties get(QualType T)
static CachedProperties get(const Type *T)
A helper class for Type nodes having an ElaboratedTypeKeyword.
static ElaboratedTypeKeyword getKeywordForTypeSpec(unsigned TypeSpec)
Converts a type specifier (DeclSpec::TST) into an elaborated type keyword.
static TagTypeKind getTagTypeKindForKeyword(ElaboratedTypeKeyword Keyword)
Converts an elaborated type keyword into a TagTypeKind.
static bool KeywordIsTagTypeKind(ElaboratedTypeKeyword Keyword)
static StringRef getKeywordName(ElaboratedTypeKeyword Keyword)
static ElaboratedTypeKeyword getKeywordForTagTypeKind(TagTypeKind Tag)
Converts a TagTypeKind into an elaborated type keyword.
static TagTypeKind getTagTypeKindForTypeSpec(unsigned TypeSpec)
Converts a type specifier (DeclSpec::TST) into a tag type kind.
The base class of the type hierarchy.
bool isSizelessType() const
As an extension, we classify types as one of "sized" or "sizeless"; every type is one or the other.
bool isStructureType() const
CXXRecordDecl * getAsCXXRecordDecl() const
Retrieves the CXXRecordDecl that this type refers to, either because the type is a RecordType or beca...
bool isBlockPointerType() const
const ObjCObjectPointerType * getAsObjCQualifiedClassType() const
bool isLinkageValid() const
True if the computed linkage is valid.
TypedefBitfields TypedefBits
const ObjCObjectType * getAsObjCQualifiedInterfaceType() const
const ObjCObjectPointerType * getAsObjCQualifiedIdType() const
bool isSignedIntegerOrEnumerationType() const
Determines whether this is an integer type that is signed or an enumeration types whose underlying ty...
bool hasAttr(attr::Kind AK) const
Determine whether this type had the specified attribute applied to it (looking through top-level type...
QualType getRVVEltType(const ASTContext &Ctx) const
Returns the representative type for the element of an RVV builtin type.
const RecordType * getAsUnionType() const
NOTE: getAs*ArrayType are methods on ASTContext.
bool isLiteralType(const ASTContext &Ctx) const
Return true if this is a literal type (C++11 [basic.types]p10)
bool isSignedIntegerType() const
Return true if this is an integer type that is signed, according to C99 6.2.5p4 [char,...
bool isComplexType() const
isComplexType() does not include complex integers (a GCC extension).
ArrayTypeBitfields ArrayTypeBits
const ArrayType * castAsArrayTypeUnsafe() const
A variant of castAs<> for array type which silently discards qualifiers from the outermost type.
bool isUnsignedIntegerOrEnumerationType() const
Determines whether this is an integer type that is unsigned or an enumeration types whose underlying ...
bool isIntegralOrUnscopedEnumerationType() const
Determine whether this type is an integral or unscoped enumeration type.
VectorTypeBitfields VectorTypeBits
bool hasIntegerRepresentation() const
Determine whether this type has an integer representation of some sort, e.g., it is an integer type o...
bool isVoidPointerType() const
const ComplexType * getAsComplexIntegerType() const
bool isConstantSizeType() const
Return true if this is not a variable sized type, according to the rules of C99 6....
QualType getLocallyUnqualifiedSingleStepDesugaredType() const
Pull a single level of sugar off of this locally-unqualified type.
bool isFunctionPointerType() const
bool isCountAttributedType() const
bool isObjCARCBridgableType() const
Determine whether the given type T is a "bridgable" Objective-C type, which is either an Objective-C ...
bool isArithmeticType() const
bool isPointerType() const
TypeOfBitfields TypeOfBits
bool isIntegerType() const
isIntegerType() does not include complex integers (a GCC extension).
bool isSVESizelessBuiltinType() const
Returns true for SVE scalable vector types.
const T * castAs() const
Member-template castAs<specific type>.
bool isReferenceType() const
bool isEnumeralType() const
void addDependence(TypeDependence D)
bool isObjCNSObjectType() const
const ObjCObjectPointerType * getAsObjCInterfacePointerType() const
bool isScalarType() const
const CXXRecordDecl * getPointeeCXXRecordDecl() const
If this is a pointer or reference to a RecordType, return the CXXRecordDecl that the type refers to.
bool isInterfaceType() const
bool isVariableArrayType() const
bool isSizelessBuiltinType() const
bool isCUDADeviceBuiltinSurfaceType() const
Check if the type is the CUDA device builtin surface type.
bool isSveVLSBuiltinType() const
Determines if this is a sizeless type supported by the 'arm_sve_vector_bits' type attribute,...
bool isIntegralType(const ASTContext &Ctx) const
Determine whether this type is an integral type.
bool isElaboratedTypeSpecifier() const
Determine wither this type is a C++ elaborated-type-specifier.
CountAttributedTypeBitfields CountAttributedTypeBits
const Type * getArrayElementTypeNoTypeQual() const
If this is an array type, return the element type of the array, potentially with type qualifiers miss...
QualType getPointeeType() const
If this is a pointer, ObjC object pointer, or block pointer, this returns the respective pointee.
LinkageInfo getLinkageAndVisibility() const
Determine the linkage and visibility of this type.
bool hasUnsignedIntegerRepresentation() const
Determine whether this type has an unsigned integer representation of some sort, e....
bool isAnyCharacterType() const
Determine whether this type is any of the built-in character types.
bool isWebAssemblyExternrefType() const
Check if this is a WebAssembly Externref Type.
bool canHaveNullability(bool ResultIfUnknown=true) const
Determine whether the given type can have a nullability specifier applied to it, i....
QualType getSveEltType(const ASTContext &Ctx) const
Returns the representative type for the element of an SVE builtin type.
bool isInstantiationDependentType() const
Determine whether this type is an instantiation-dependent type, meaning that the type involves a temp...
bool isLValueReferenceType() const
bool isBitIntType() const
bool isStructuralType() const
Determine if this type is a structural type, per C++20 [temp.param]p7.
bool isDependentType() const
Whether this type is a dependent type, meaning that its definition somehow depends on a template para...
bool isAggregateType() const
Determines whether the type is a C++ aggregate type or C aggregate or union type.
bool isCARCBridgableType() const
Determine whether the given type T is a "bridgeable" C type.
bool isChar16Type() const
bool isAnyComplexType() const
DependentTemplateSpecializationTypeBitfields DependentTemplateSpecializationTypeBits
DeducedType * getContainedDeducedType() const
Get the DeducedType whose type will be deduced for a variable with an initializer of this type.
bool containsUnexpandedParameterPack() const
Whether this type is or contains an unexpanded parameter pack, used to support C++0x variadic templat...
ScalarTypeKind getScalarTypeKind() const
Given that this is a scalar type, classify it.
bool hasSignedIntegerRepresentation() const
Determine whether this type has an signed integer representation of some sort, e.g....
QualType getCanonicalTypeInternal() const
const RecordType * getAsStructureType() const
const char * getTypeClassName() const
bool isWebAssemblyTableType() const
Returns true if this is a WebAssembly table type: either an array of reference types,...
const Type * getBaseElementTypeUnsafe() const
Get the base element type of this type, potentially discarding type qualifiers.
bool isObjCBoxableRecordType() const
bool isChar32Type() const
bool isStandardLayoutType() const
Test if this type is a standard-layout type.
bool isVariablyModifiedType() const
Whether this type is a variably-modified type (C99 6.7.5).
bool isComplexIntegerType() const
bool isUnscopedEnumerationType() const
bool isStdByteType() const
bool isCUDADeviceBuiltinTextureType() const
Check if the type is the CUDA device builtin texture type.
bool isBlockCompatibleObjCPointerType(ASTContext &ctx) const
bool isObjCClassOrClassKindOfType() const
Whether the type is Objective-C 'Class' or a __kindof type of an Class type, e.g.,...
const ArrayType * getAsArrayTypeUnsafe() const
A variant of getAs<> for array types which silently discards qualifiers from the outermost type.
bool isObjCLifetimeType() const
Returns true if objects of this type have lifetime semantics under ARC.
bool isObjectType() const
Determine whether this type is an object type.
bool isObjCIndirectLifetimeType() const
bool hasUnnamedOrLocalType() const
Whether this type is or contains a local or unnamed type.
Qualifiers::ObjCLifetime getObjCARCImplicitLifetime() const
Return the implicit lifetime for this type, which must not be dependent.
FunctionTypeBitfields FunctionTypeBits
bool isObjCQualifiedInterfaceType() const
bool isSpecifierType() const
Returns true if this type can be represented by some set of type specifiers.
bool isIncompleteType(NamedDecl **Def=nullptr) const
Types are partitioned into 3 broad categories (C99 6.2.5p1): object types, function types,...
bool isObjCObjectPointerType() const
bool isStructureTypeWithFlexibleArrayMember() const
TypeDependence getDependence() const
bool hasFloatingRepresentation() const
Determine whether this type has a floating-point representation of some sort, e.g....
bool isStructureOrClassType() const
bool isVectorType() const
bool isRVVVLSBuiltinType() const
Determines if this is a sizeless type supported by the 'riscv_rvv_vector_bits' type attribute,...
bool isRealFloatingType() const
Floating point categories.
bool isRVVSizelessBuiltinType() const
Returns true for RVV scalable vector types.
std::optional< ArrayRef< QualType > > getObjCSubstitutions(const DeclContext *dc) const
Retrieve the set of substitutions required when accessing a member of the Objective-C receiver type t...
Linkage getLinkage() const
Determine the linkage of this type.
ObjCObjectTypeBitfields ObjCObjectTypeBits
bool isFloatingType() const
const ObjCObjectType * getAsObjCInterfaceType() const
bool isWideCharType() const
bool isUnsignedIntegerType() const
Return true if this is an integer type that is unsigned, according to C99 6.2.5p6 [which returns true...
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.
bool hasAutoForTrailingReturnType() const
Determine whether this type was written with a leading 'auto' corresponding to a trailing return type...
bool isObjCIdOrObjectKindOfType(const ASTContext &ctx, const ObjCObjectType *&bound) const
Whether the type is Objective-C 'id' or a __kindof type of an object type, e.g., __kindof NSView * or...
const T * getAs() const
Member-template getAs<specific type>'.
SubstTemplateTypeParmPackTypeBitfields SubstTemplateTypeParmPackTypeBits
const Type * getUnqualifiedDesugaredType() const
Return the specified type with any "sugar" removed from the type, removing any typedefs,...
bool isObjCARCImplicitlyUnretainedType() const
Determines if this type, which must satisfy isObjCLifetimeType(), is implicitly __unsafe_unretained r...
bool isRecordType() const
TemplateSpecializationTypeBitfields TemplateSpecializationTypeBits
bool isObjCRetainableType() const
std::optional< NullabilityKind > getNullability() const
Determine the nullability of the given type.
bool isObjCIndependentClassType() const
TagDecl * getAsTagDecl() const
Retrieves the TagDecl that this type refers to, either because the type is a TagType or because it is...
bool isSizelessVectorType() const
Returns true for all scalable vector types.
bool isScopedEnumeralType() const
Determine whether this type is a scoped enumeration type.
bool acceptsObjCTypeParams() const
Determines if this is an ObjC interface type that may accept type parameters.
QualType getSizelessVectorEltType(const ASTContext &Ctx) const
Returns the representative type for the element of a sizeless vector builtin type.
RecordDecl * getAsRecordDecl() const
Retrieves the RecordDecl this type refers to.
Base class for declarations which introduce a typedef-name.
QualType getUnderlyingType() const
bool typeMatchesDecl() const
Represents a shadow declaration implicitly introduced into a scope by a (resolved) using-declaration ...
NamedDecl * getTargetDecl() const
Gets the underlying declaration which has been brought into the local scope.
QualType getUnderlyingType() const
bool typeMatchesDecl() const
Represent the declaration of a variable (in which case it is an lvalue) a function (in which case it ...
Represents a C array with a specified size that is not an integer-constant-expression.
Represents a GCC generic vector type.
VectorType(QualType vecType, unsigned nElements, QualType canonType, VectorKind vecKind)
QualType getElementType() const
Defines the Linkage enumeration and various utility functions.
Defines the clang::TargetInfo interface.
const internal::VariadicAllOfMatcher< Type > type
Matches Types in the clang AST.
const AstTypeMatcher< TypedefType > typedefType
Matches typedef types.
const internal::VariadicAllOfMatcher< Decl > decl
Matches declarations.
The JSON file list parser is used to communicate input to InstallAPI.
@ Private
'private' clause, allowed on 'parallel', 'serial', 'loop', 'parallel loop', and 'serial loop' constru...
@ Vector
'vector' clause, allowed on 'loop', Combined, and 'routine' directives.
AutoTypeKeyword
Which keyword(s) were used to create an AutoType.
CanThrowResult
Possible results from evaluation of a noexcept expression.
void initialize(TemplateInstantiationCallbackPtrs &Callbacks, const Sema &TheSema)
Linkage minLinkage(Linkage L1, Linkage L2)
Compute the minimum linkage given two linkages.
@ Nullable
Values of this type can be null.
@ Unspecified
Whether values of this type can be null is (explicitly) unspecified.
@ NonNull
Values of this type can never be null.
ExprDependence computeDependence(FullExpr *E)
TypeOfKind
The kind of 'typeof' expression we're after.
TypeDependence toTypeDependence(ExprDependence D)
ExprDependence turnValueToTypeDependence(ExprDependence D)
Linkage
Describes the different kinds of linkage (C++ [basic.link], C99 6.2.2) that an entity may have.
@ External
External linkage, which indicates that the entity can be referred to from other translation units.
ObjCSubstitutionContext
The kind of type we are substituting Objective-C type arguments into.
@ Superclass
The superclass of a type.
@ Result
The result type of a method or function.
ArraySizeModifier
Capture whether this is a normal array (e.g.
bool isComputedNoexcept(ExceptionSpecificationType ESpecType)
TemplateParameterList * getReplacedTemplateParameterList(Decl *D)
Internal helper used by Subst* nodes to retrieve the parameter list for their AssociatedDecl.
TagTypeKind
The kind of a tag type.
@ Interface
The "__interface" keyword.
@ Struct
The "struct" keyword.
@ Class
The "class" keyword.
@ Union
The "union" keyword.
@ Enum
The "enum" keyword.
void FixedPointValueToString(SmallVectorImpl< char > &Str, llvm::APSInt Val, unsigned Scale)
const FunctionProtoType * T
CallingConv
CallingConv - Specifies the calling convention that a function uses.
@ None
The alignment was not explicit in code.
ElaboratedTypeKeyword
The elaboration keyword that precedes a qualified type name or introduces an elaborated-type-specifie...
@ Interface
The "__interface" keyword introduces the elaborated-type-specifier.
@ None
No keyword precedes the qualified type name.
@ Struct
The "struct" keyword introduces the elaborated-type-specifier.
@ Class
The "class" keyword introduces the elaborated-type-specifier.
@ Union
The "union" keyword introduces the elaborated-type-specifier.
@ Enum
The "enum" keyword introduces the elaborated-type-specifier.
@ Typename
The "typename" keyword precedes the qualified type name, e.g., typename T::type.
TypeDependence toSemanticDependence(TypeDependence D)
TypeDependence toSyntacticDependence(TypeDependence D)
@ Other
Other implicit parameter.
@ 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)
FunctionDecl * SourceDecl
The function whose exception specification this is, for EST_Unevaluated and EST_Uninstantiated.
FunctionDecl * SourceTemplate
The function template whose exception specification this is instantiated from, for EST_Uninstantiated...
ExceptionSpecificationType Type
The kind of exception specification this is.
ArrayRef< QualType > Exceptions
Explicitly-specified list of exception types.
Expr * NoexceptExpr
Noexcept expression, if this is a computed noexcept specification.
Extra information about a function prototype.
ExceptionSpecInfo ExceptionSpec
bool requiresFunctionProtoTypeArmAttributes() const
unsigned AArch64SMEAttributes
SourceLocation EllipsisLoc
const ExtParameterInfo * ExtParameterInfos
RefQualifierKind RefQualifier
unsigned HasTrailingReturn
bool requiresFunctionProtoTypeExtraBitfields() const
Describes how types, statements, expressions, and declarations should be printed.
unsigned Bool
Whether we can use 'bool' rather than '_Bool' (even if the language doesn't actually have 'bool',...
unsigned NullptrTypeInNamespace
Whether 'nullptr_t' is in namespace 'std' or not.
unsigned Half
When true, print the half-precision floating-point type as 'half' instead of '__fp16'.
unsigned MSWChar
When true, print the built-in wchar_t type as __wchar_t.
A std::pair-like structure for storing a qualified type split into its local qualifiers and its local...
const Type * Ty
The locally-unqualified type.
Qualifiers Quals
The local qualifiers.