41#include "llvm/ADT/APInt.h"
42#include "llvm/ADT/APSInt.h"
43#include "llvm/ADT/ArrayRef.h"
44#include "llvm/ADT/FoldingSet.h"
45#include "llvm/ADT/STLExtras.h"
46#include "llvm/ADT/SmallVector.h"
47#include "llvm/Support/ErrorHandling.h"
48#include "llvm/Support/MathExtras.h"
58 return (*
this !=
Other) &&
125 if (ToRegion == FromRegion)
197 if (
const auto *DNT = ty->
getAs<DependentNameType>())
201 if (
const auto *TT = ty->
getAs<TagType>())
219 switch (
T->getTypeClass()) {
225 case Type::BlockPointer:
228 case Type::MemberPointer:
231 case Type::LValueReference:
232 case Type::RValueReference:
235 case Type::PackExpansion:
239 case Type::ConstantArray:
240 case Type::DependentSizedArray:
241 case Type::IncompleteArray:
242 case Type::VariableArray:
243 case Type::FunctionProto:
244 case Type::FunctionNoProto:
261 if (
T.isConstQualified())
265 return AT->getElementType().isConstant(Ctx);
270std::optional<QualType::NonConstantStorageReason>
273 if (!
isConstant(Ctx) && !(*this)->isReferenceType())
281 if (
Record->hasMutableFields())
283 if (!
Record->hasTrivialDestructor() && !ExcludeDtor)
309 (tc == DependentSizedArray
319 const llvm::APInt &Sz,
const Expr *SzExpr,
321 bool NeedsExternalSize = SzExpr !=
nullptr || Sz.ugt(0x0FFFFFFFFFFFFFFF) ||
322 Sz.getBitWidth() > 0xFF;
323 if (!NeedsExternalSize)
325 ET, Can, Sz.getBitWidth(), Sz.getZExtValue(), SzMod, Qual);
327 auto *SzPtr =
new (Ctx,
alignof(ConstantArrayType::ExternalSize))
328 ConstantArrayType::ExternalSize(Sz, SzExpr);
336 const llvm::APInt &NumElements) {
337 uint64_t ElementSize = Context.getTypeSizeInChars(ElementType).getQuantity();
345 if (llvm::isPowerOf2_64(ElementSize)) {
346 return NumElements.getActiveBits() + llvm::Log2_64(ElementSize);
351 if ((ElementSize >> 32) == 0 && NumElements.getBitWidth() <= 64 &&
352 (NumElements.getZExtValue() >> 32) == 0) {
353 uint64_t TotalSize = NumElements.getZExtValue() * ElementSize;
354 return llvm::bit_width(TotalSize);
358 llvm::APSInt SizeExtended(NumElements,
true);
359 unsigned SizeTypeBits = Context.getTypeSize(Context.getSizeType());
360 SizeExtended = SizeExtended.extend(
361 std::max(SizeTypeBits, SizeExtended.getBitWidth()) * 2);
363 llvm::APSInt TotalSize(llvm::APInt(SizeExtended.getBitWidth(), ElementSize));
364 TotalSize *= SizeExtended;
366 return TotalSize.getActiveBits();
375 unsigned Bits = Context.getTypeSize(Context.getSizeType());
388 uint64_t ArraySize,
const Expr *SizeExpr,
391 ID.AddInteger(ArraySize);
392 ID.AddInteger(llvm::to_underlying(SizeMod));
393 ID.AddInteger(TypeQuals);
394 ID.AddBoolean(SizeExpr !=
nullptr);
396 SizeExpr->
Profile(ID, Context,
true);
408 :
ArrayType(DependentSizedArray, et, can, sm, tq, e), SizeExpr((
Stmt *)e) {}
413 unsigned TypeQuals,
Expr *E) {
415 ID.AddInteger(llvm::to_underlying(SizeMod));
416 ID.AddInteger(TypeQuals);
421DependentVectorType::DependentVectorType(
QualType ElementType,
424 :
Type(DependentVector, CanonType,
426 ElementType->getDependence() |
429 ElementType(ElementType), SizeExpr(SizeExpr), Loc(Loc) {
437 ID.AddPointer(ElementType.getAsOpaquePtr());
438 ID.AddInteger(llvm::to_underlying(VecKind));
439 SizeExpr->Profile(ID, Context,
true);
442DependentSizedExtVectorType::DependentSizedExtVectorType(
QualType ElementType,
446 :
Type(DependentSizedExtVector, can,
448 ElementType->getDependence() |
451 SizeExpr(SizeExpr), ElementType(ElementType), loc(loc) {}
457 ID.AddPointer(ElementType.getAsOpaquePtr());
458 SizeExpr->Profile(ID, Context,
true);
461DependentAddressSpaceType::DependentAddressSpaceType(
QualType PointeeType,
465 :
Type(DependentAddressSpace, can,
467 PointeeType->getDependence() |
470 AddrSpaceExpr(AddrSpaceExpr), PointeeType(PointeeType), loc(loc) {}
475 Expr *AddrSpaceExpr) {
476 ID.AddPointer(PointeeType.getAsOpaquePtr());
477 AddrSpaceExpr->Profile(ID, Context,
true);
481 const Expr *RowExpr,
const Expr *ColumnExpr)
482 :
Type(tc, canonType,
496 ElementType(matrixType) {}
499 unsigned nColumns,
QualType canonType,
500 std::optional<LayoutKind>
Layout)
505 unsigned nRows,
unsigned nColumns,
507 std::optional<LayoutKind>
Layout)
511DependentSizedMatrixType::DependentSizedMatrixType(
QualType ElementType,
516 :
MatrixType(DependentSizedMatrix, ElementType, CanonicalType, RowExpr,
518 RowExpr(RowExpr), ColumnExpr(ColumnExpr), loc(loc) {}
524 ID.AddPointer(ElementType.getAsOpaquePtr());
525 RowExpr->Profile(ID, CTX,
true);
526 ColumnExpr->Profile(ID, CTX,
true);
553 ExprAndUnsigned(NumBitsExpr, IsUnsigned) {}
556 return ExprAndUnsigned.getInt();
560 return ExprAndUnsigned.getPointer();
566 ID.AddBoolean(IsUnsigned);
567 NumBitsExpr->
Profile(ID, Context,
true);
579 bool CountInBytes,
bool OrNull) {
580 ID.AddPointer(WrappedTy.getAsOpaquePtr());
581 ID.AddBoolean(CountInBytes);
582 ID.AddBoolean(OrNull);
587 ID.AddPointer(CountExpr);
595 if (
const auto *ATy = dyn_cast<ArrayType>(
this))
596 return ATy->getElementType().getTypePtr();
624 return Context.getQualifiedType(desugar,
split.
Quals);
630#define TYPE(CLASS, BASE) \
631 static_assert(!std::is_polymorphic<CLASS##Type>::value, \
632 #CLASS "Type should not be polymorphic!");
633#include "clang/AST/TypeNodes.inc"
638#define TYPE(CLASS, BASE) \
639 static_assert(std::is_trivially_destructible<CLASS##Type>::value, \
640 #CLASS "Type should be trivially destructible!");
641#include "clang/AST/TypeNodes.inc"
645#define ABSTRACT_TYPE(Class, Parent)
646#define TYPE(Class, Parent) \
647 case Type::Class: { \
648 const auto *ty = cast<Class##Type>(this); \
649 if (!ty->isSugared()) \
650 return QualType(ty, 0); \
651 return ty->desugar(); \
653#include "clang/AST/TypeNodes.inc"
655 llvm_unreachable(
"bad type kind!");
665#define ABSTRACT_TYPE(Class, Parent)
666#define TYPE(Class, Parent) \
667 case Type::Class: { \
668 const auto *Ty = cast<Class##Type>(CurTy); \
669 if (!Ty->isSugared()) \
670 return SplitQualType(Ty, Qs); \
671 Cur = Ty->desugar(); \
674#include "clang/AST/TypeNodes.inc"
683 Qualifiers quals =
split.Quals;
686 const Type *lastTypeWithQuals =
split.Ty;
693 switch (
split.Ty->getTypeClass()) {
694#define ABSTRACT_TYPE(Class, Parent)
695#define TYPE(Class, Parent) \
696 case Type::Class: { \
697 const auto *ty = cast<Class##Type>(split.Ty); \
698 if (!ty->isSugared()) \
700 next = ty->desugar(); \
703#include "clang/AST/TypeNodes.inc"
709 if (!
split.Quals.empty()) {
710 lastTypeWithQuals =
split.Ty;
719 if (
const auto *OBT = dyn_cast<OverflowBehaviorType>(
split.Ty)) {
720 SplitQualType SplitOBT = OBT->getSplitUnqualifiedType();
722 return SplitQualType(SplitOBT.
Ty, quals);
725 return SplitQualType(lastTypeWithQuals, quals);
730 while (
const auto *PT =
T->
getAs<ParenType>())
731 T = PT->getInnerType();
740 if (
const auto *Sugar = dyn_cast<T>(Cur))
743#define ABSTRACT_TYPE(Class, Parent)
744#define TYPE(Class, Parent) \
745 case Type::Class: { \
746 const auto *Ty = cast<Class##Type>(Cur); \
747 if (!Ty->isSugared()) \
749 Cur = Ty->desugar().getTypePtr(); \
752#include "clang/AST/TypeNodes.inc"
765template <>
const TemplateSpecializationType *
Type::getAs()
const {
785 const Type *Cur =
this;
789#define ABSTRACT_TYPE(Class, Parent)
790#define TYPE(Class, Parent) \
792 const auto *Ty = cast<Class##Type>(Cur); \
793 if (!Ty->isSugared()) \
795 Cur = Ty->desugar().getTypePtr(); \
798#include "clang/AST/TypeNodes.inc"
805 return RT->getDecl()->isClass();
811 return RT->getDecl()->isStruct();
819 const auto *
Decl = RT->getDecl();
820 if (!
Decl->isStruct())
822 return Decl->getDefinitionOrSelf()->hasFlexibleArrayMember();
827 return RD->hasAttr<ObjCBoxableAttr>();
833 return RT->getDecl()->isInterface();
839 return RT->getDecl()->isStructureOrClass();
845 return PT->getPointeeType()->isVoidType();
851 return RT->getDecl()->isUnion();
857 return CT->getElementType()->isFloatingType();
868 return ET->getDecl()->isScoped();
878 if (
Complex->getElementType()->isIntegerType())
901 if (
const auto *RT = dyn_cast<RecordType>(
this)) {
902 if (RT->getDecl()->isStruct())
907 if (
const auto *RT = dyn_cast<RecordType>(CanonicalType)) {
908 if (!RT->getDecl()->isStruct())
920 if (
const auto *RT = dyn_cast<RecordType>(
this)) {
921 if (RT->getDecl()->isUnion())
926 if (
const auto *RT = dyn_cast<RecordType>(CanonicalType)) {
927 if (!RT->getDecl()->isUnion())
947 if (OPT->isObjCIdType())
951 if (!OPT->isKindOfType())
955 if (OPT->isObjCClassType() || OPT->isObjCQualifiedClassType())
959 bound = OPT->getObjectType()
960 ->stripObjCKindOfTypeAndQuals(ctx)
971 if (OPT->isObjCClassType())
975 if (!OPT->isKindOfType())
979 return OPT->isObjCClassType() || OPT->isObjCQualifiedClassType();
986 initialize(protocols);
993 :
Type(ObjCObject, Canonical,
Base->getDependence()), BaseType(
Base) {
997 assert(getTypeArgsAsWritten().size() == typeArgs.size() &&
998 "bitfield overflow in type argument count");
999 if (!typeArgs.empty())
1000 memcpy(getTypeArgStorage(), typeArgs.data(),
1001 typeArgs.size() *
sizeof(
QualType));
1003 for (
auto typeArg : typeArgs) {
1004 addDependence(typeArg->getDependence() & ~TypeDependence::VariablyModified);
1008 initialize(protocols);
1011bool ObjCObjectType::isSpecialized()
const {
1013 if (ObjCObjectTypeBits.NumTypeArgs > 0)
1017 if (
const auto objcObject =
getBaseType()->getAs<ObjCObjectType>()) {
1022 return objcObject->isSpecialized();
1031 if (isSpecializedAsWritten())
1032 return getTypeArgsAsWritten();
1035 if (
const auto objcObject =
getBaseType()->getAs<ObjCObjectType>()) {
1040 return objcObject->getTypeArgs();
1047bool ObjCObjectType::isKindOfType()
const {
1048 if (isKindOfTypeAsWritten())
1052 if (
const auto objcObject =
getBaseType()->getAs<ObjCObjectType>()) {
1057 return objcObject->isKindOfType();
1065ObjCObjectType::stripObjCKindOfTypeAndQuals(
const ASTContext &ctx)
const {
1066 if (!isKindOfType() && qual_empty())
1072 if (
const auto *baseObj = splitBaseType.
Ty->
getAs<ObjCObjectType>())
1073 baseType = baseObj->stripObjCKindOfTypeAndQuals(ctx);
1077 getTypeArgsAsWritten(),
1102template <
typename Derived>
1103struct SimpleTransformVisitor :
public TypeVisitor<Derived, QualType> {
1111 QualType result =
static_cast<Derived *
>(
this)->Visit(splitType.
Ty);
1121 explicit SimpleTransformVisitor(
ASTContext &ctx) : Ctx(ctx) {}
1125#define TYPE(Class, Base)
1126#define DEPENDENT_TYPE(Class, Base) \
1127 QualType Visit##Class##Type(const Class##Type *T) { return QualType(T, 0); }
1128#include "clang/AST/TypeNodes.inc"
1130#define TRIVIAL_TYPE_CLASS(Class) \
1131 QualType Visit##Class##Type(const Class##Type *T) { return QualType(T, 0); }
1132#define SUGARED_TYPE_CLASS(Class) \
1133 QualType Visit##Class##Type(const Class##Type *T) { \
1134 if (!T->isSugared()) \
1135 return QualType(T, 0); \
1136 QualType desugaredType = recurse(T->desugar()); \
1137 if (desugaredType.isNull()) \
1139 if (desugaredType.getAsOpaquePtr() == T->desugar().getAsOpaquePtr()) \
1140 return QualType(T, 0); \
1141 return desugaredType; \
1147 QualType elementType = recurse(
T->getElementType());
1148 if (elementType.
isNull())
1151 if (elementType.
getAsOpaquePtr() ==
T->getElementType().getAsOpaquePtr())
1157 QualType VisitPointerType(
const PointerType *
T) {
1163 return QualType(
T, 0);
1168 QualType VisitBlockPointerType(
const BlockPointerType *
T) {
1174 return QualType(
T, 0);
1179 QualType VisitLValueReferenceType(
const LValueReferenceType *
T) {
1180 QualType
pointeeType = recurse(
T->getPointeeTypeAsWritten());
1185 T->getPointeeTypeAsWritten().getAsOpaquePtr())
1186 return QualType(
T, 0);
1191 QualType VisitRValueReferenceType(
const RValueReferenceType *
T) {
1192 QualType
pointeeType = recurse(
T->getPointeeTypeAsWritten());
1197 T->getPointeeTypeAsWritten().getAsOpaquePtr())
1198 return QualType(
T, 0);
1203 QualType VisitMemberPointerType(
const MemberPointerType *
T) {
1209 return QualType(
T, 0);
1212 T->getMostRecentCXXRecordDecl());
1215 QualType VisitConstantArrayType(
const ConstantArrayType *
T) {
1216 QualType elementType = recurse(
T->getElementType());
1217 if (elementType.
isNull())
1220 if (elementType.
getAsOpaquePtr() ==
T->getElementType().getAsOpaquePtr())
1221 return QualType(
T, 0);
1224 T->getSizeModifier(),
1225 T->getIndexTypeCVRQualifiers());
1228 QualType VisitVariableArrayType(
const VariableArrayType *
T) {
1229 QualType elementType = recurse(
T->getElementType());
1230 if (elementType.
isNull())
1233 if (elementType.
getAsOpaquePtr() ==
T->getElementType().getAsOpaquePtr())
1234 return QualType(
T, 0);
1237 T->getSizeModifier(),
1238 T->getIndexTypeCVRQualifiers());
1241 QualType VisitIncompleteArrayType(
const IncompleteArrayType *
T) {
1242 QualType elementType = recurse(
T->getElementType());
1243 if (elementType.
isNull())
1246 if (elementType.
getAsOpaquePtr() ==
T->getElementType().getAsOpaquePtr())
1247 return QualType(
T, 0);
1250 T->getIndexTypeCVRQualifiers());
1253 QualType VisitVectorType(
const VectorType *
T) {
1254 QualType elementType = recurse(
T->getElementType());
1255 if (elementType.
isNull())
1258 if (elementType.
getAsOpaquePtr() ==
T->getElementType().getAsOpaquePtr())
1259 return QualType(
T, 0);
1262 T->getVectorKind());
1265 QualType VisitExtVectorType(
const ExtVectorType *
T) {
1266 QualType elementType = recurse(
T->getElementType());
1267 if (elementType.
isNull())
1270 if (elementType.
getAsOpaquePtr() ==
T->getElementType().getAsOpaquePtr())
1271 return QualType(
T, 0);
1276 QualType VisitConstantMatrixType(
const ConstantMatrixType *
T) {
1277 QualType elementType = recurse(
T->getElementType());
1278 if (elementType.
isNull())
1280 if (elementType.
getAsOpaquePtr() ==
T->getElementType().getAsOpaquePtr())
1281 return QualType(
T, 0);
1284 T->getNumColumns(),
T->getLayout());
1287 QualType VisitOverflowBehaviorType(
const OverflowBehaviorType *
T) {
1288 QualType UnderlyingType = recurse(
T->getUnderlyingType());
1289 if (UnderlyingType.
isNull())
1293 T->getUnderlyingType().getAsOpaquePtr())
1294 return QualType(
T, 0);
1299 QualType VisitFunctionNoProtoType(
const FunctionNoProtoType *
T) {
1305 return QualType(
T, 0);
1310 QualType VisitFunctionProtoType(
const FunctionProtoType *
T) {
1316 SmallVector<QualType, 4> paramTypes;
1317 bool paramChanged =
false;
1319 QualType newParamType = recurse(paramType);
1320 if (newParamType.
isNull())
1324 paramChanged =
true;
1326 paramTypes.push_back(newParamType);
1331 bool exceptionChanged =
false;
1333 SmallVector<QualType, 4> exceptionTypes;
1334 for (
auto exceptionType :
info.ExceptionSpec.Exceptions) {
1335 QualType newExceptionType = recurse(exceptionType);
1336 if (newExceptionType.
isNull())
1339 if (newExceptionType.
getAsOpaquePtr() != exceptionType.getAsOpaquePtr())
1340 exceptionChanged =
true;
1342 exceptionTypes.push_back(newExceptionType);
1345 if (exceptionChanged) {
1346 info.ExceptionSpec.Exceptions =
1347 llvm::ArrayRef(exceptionTypes).copy(Ctx);
1352 !paramChanged && !exceptionChanged)
1353 return QualType(
T, 0);
1358 QualType VisitParenType(
const ParenType *
T) {
1359 QualType innerType = recurse(
T->getInnerType());
1364 return QualType(
T, 0);
1373 QualType VisitAdjustedType(
const AdjustedType *
T) {
1374 QualType originalType = recurse(
T->getOriginalType());
1375 if (originalType.
isNull())
1378 QualType adjustedType = recurse(
T->getAdjustedType());
1379 if (adjustedType.
isNull())
1383 T->getOriginalType().getAsOpaquePtr() &&
1384 adjustedType.
getAsOpaquePtr() ==
T->getAdjustedType().getAsOpaquePtr())
1385 return QualType(
T, 0);
1390 QualType VisitDecayedType(
const DecayedType *
T) {
1391 QualType originalType = recurse(
T->getOriginalType());
1392 if (originalType.
isNull())
1395 if (originalType.
getAsOpaquePtr() ==
T->getOriginalType().getAsOpaquePtr())
1396 return QualType(
T, 0);
1401 QualType VisitArrayParameterType(
const ArrayParameterType *
T) {
1402 QualType ArrTy = VisitConstantArrayType(
T);
1416 QualType VisitAttributedType(
const AttributedType *
T) {
1417 QualType modifiedType = recurse(
T->getModifiedType());
1418 if (modifiedType.
isNull())
1421 QualType equivalentType = recurse(
T->getEquivalentType());
1422 if (equivalentType.
isNull())
1426 T->getModifiedType().getAsOpaquePtr() &&
1428 T->getEquivalentType().getAsOpaquePtr())
1429 return QualType(
T, 0);
1435 QualType VisitSubstTemplateTypeParmType(
const SubstTemplateTypeParmType *
T) {
1436 QualType replacementType = recurse(
T->getReplacementType());
1437 if (replacementType.
isNull())
1441 T->getReplacementType().getAsOpaquePtr())
1442 return QualType(
T, 0);
1445 replacementType,
T->getAssociatedDecl(),
T->getIndex(),
1446 T->getPackIndex(),
T->getFinal());
1452 QualType VisitAutoType(
const AutoType *
T) {
1453 if (!
T->isDeduced())
1454 return QualType(
T, 0);
1456 QualType deducedType = recurse(
T->getDeducedType());
1457 if (deducedType.
isNull())
1460 if (deducedType ==
T->getDeducedType())
1461 return QualType(
T, 0);
1463 return Ctx.
getAutoType(
T->getDeducedKind(), deducedType,
T->getKeyword(),
1464 T->getTypeConstraintConcept(),
1465 T->getTypeConstraintArguments());
1468 QualType VisitObjCObjectType(
const ObjCObjectType *
T) {
1469 QualType baseType = recurse(
T->getBaseType());
1474 bool typeArgChanged =
false;
1475 SmallVector<QualType, 4> typeArgs;
1476 for (
auto typeArg :
T->getTypeArgsAsWritten()) {
1477 QualType newTypeArg = recurse(typeArg);
1482 typeArgChanged =
true;
1484 typeArgs.push_back(newTypeArg);
1489 return QualType(
T, 0);
1493 llvm::ArrayRef(
T->qual_begin(),
T->getNumProtocols()),
1494 T->isKindOfTypeAsWritten());
1499 QualType VisitObjCObjectPointerType(
const ObjCObjectPointerType *
T) {
1505 return QualType(
T, 0);
1510 QualType VisitAtomicType(
const AtomicType *
T) {
1511 QualType valueType = recurse(
T->getValueType());
1516 return QualType(
T, 0);
1521#undef TRIVIAL_TYPE_CLASS
1522#undef SUGARED_TYPE_CLASS
1525struct SubstObjCTypeArgsVisitor
1526 :
public SimpleTransformVisitor<SubstObjCTypeArgsVisitor> {
1527 using BaseType = SimpleTransformVisitor<SubstObjCTypeArgsVisitor>;
1529 ArrayRef<QualType> TypeArgs;
1532 SubstObjCTypeArgsVisitor(ASTContext &ctx, ArrayRef<QualType> typeArgs,
1534 : BaseType(ctx), TypeArgs(typeArgs), SubstContext(context) {}
1536 QualType VisitObjCTypeParamType(
const ObjCTypeParamType *OTPTy) {
1539 ObjCTypeParamDecl *typeParam = OTPTy->getDecl();
1541 if (!TypeArgs.empty()) {
1542 QualType argType = TypeArgs[typeParam->
getIndex()];
1543 if (OTPTy->qual_empty())
1548 SmallVector<ObjCProtocolDecl *, 8> protocolsVec;
1549 protocolsVec.append(OTPTy->qual_begin(), OTPTy->qual_end());
1550 ArrayRef<ObjCProtocolDecl *> protocolsToApply = protocolsVec;
1552 argType, protocolsToApply, hasError,
true );
1555 switch (SubstContext) {
1556 case ObjCSubstitutionContext::Ordinary:
1557 case ObjCSubstitutionContext::Parameter:
1558 case ObjCSubstitutionContext::Superclass:
1562 case ObjCSubstitutionContext::Result:
1563 case ObjCSubstitutionContext::Property: {
1565 const auto *objPtr =
1570 if (objPtr->isKindOfType() || objPtr->isObjCIdOrClassType())
1574 const auto *obj = objPtr->getObjectType();
1576 obj->getBaseType(), obj->getTypeArgsAsWritten(), obj->getProtocols(),
1583 llvm_unreachable(
"Unexpected ObjCSubstitutionContext!");
1586 QualType VisitFunctionType(
const FunctionType *funcType) {
1592 Ctx, TypeArgs, ObjCSubstitutionContext::Result);
1602 return BaseType::VisitFunctionType(funcType);
1611 SmallVector<QualType, 4> paramTypes;
1612 bool paramChanged =
false;
1613 for (
auto paramType : funcProtoType->getParamTypes()) {
1615 Ctx, TypeArgs, ObjCSubstitutionContext::Parameter);
1616 if (newParamType.
isNull())
1620 paramChanged =
true;
1622 paramTypes.push_back(newParamType);
1626 FunctionProtoType::ExtProtoInfo
info = funcProtoType->getExtProtoInfo();
1627 bool exceptionChanged =
false;
1629 SmallVector<QualType, 4> exceptionTypes;
1630 for (
auto exceptionType :
info.ExceptionSpec.Exceptions) {
1632 Ctx, TypeArgs, ObjCSubstitutionContext::Ordinary);
1633 if (newExceptionType.
isNull())
1636 if (newExceptionType.
getAsOpaquePtr() != exceptionType.getAsOpaquePtr())
1637 exceptionChanged =
true;
1639 exceptionTypes.push_back(newExceptionType);
1642 if (exceptionChanged) {
1643 info.ExceptionSpec.Exceptions =
1644 llvm::ArrayRef(exceptionTypes).copy(Ctx);
1649 funcProtoType->getReturnType().getAsOpaquePtr() &&
1650 !paramChanged && !exceptionChanged)
1651 return BaseType::VisitFunctionType(funcType);
1656 QualType VisitObjCObjectType(
const ObjCObjectType *objcObjectType) {
1659 if (objcObjectType->isSpecializedAsWritten()) {
1660 SmallVector<QualType, 4> newTypeArgs;
1661 bool anyChanged =
false;
1662 for (
auto typeArg : objcObjectType->getTypeArgsAsWritten()) {
1664 Ctx, TypeArgs, ObjCSubstitutionContext::Ordinary);
1671 ArrayRef<ObjCProtocolDecl *> protocols(
1672 objcObjectType->qual_begin(), objcObjectType->getNumProtocols());
1673 if (TypeArgs.empty() &&
1674 SubstContext != ObjCSubstitutionContext::Superclass) {
1676 objcObjectType->getBaseType(), {}, protocols,
1677 objcObjectType->isKindOfTypeAsWritten());
1683 newTypeArgs.push_back(newTypeArg);
1687 ArrayRef<ObjCProtocolDecl *> protocols(
1688 objcObjectType->qual_begin(), objcObjectType->getNumProtocols());
1691 objcObjectType->isKindOfTypeAsWritten());
1695 return BaseType::VisitObjCObjectType(objcObjectType);
1698 QualType VisitAttributedType(
const AttributedType *attrType) {
1699 QualType newType = BaseType::VisitAttributedType(attrType);
1703 const auto *newAttrType = dyn_cast<AttributedType>(newType.
getTypePtr());
1704 if (!newAttrType || newAttrType->getAttrKind() != attr::ObjCKindOf)
1708 QualType newEquivType = newAttrType->getEquivalentType();
1709 const ObjCObjectPointerType *ptrType =
1710 newEquivType->
getAs<ObjCObjectPointerType>();
1711 const ObjCObjectType *objType = ptrType
1713 : newEquivType->
getAs<ObjCObjectType>();
1720 objType->getBaseType(), objType->getTypeArgsAsWritten(),
1721 objType->getProtocols(),
1723 objType->isObjCUnqualifiedId() ?
false :
true);
1731 newAttrType->getModifiedType(), newEquivType,
1732 newAttrType->getAttr());
1736struct StripNullabilityTypeVisitor
1737 :
public SimpleTransformVisitor<StripNullabilityTypeVisitor> {
1738 using BaseType = SimpleTransformVisitor<StripNullabilityTypeVisitor>;
1740 explicit StripNullabilityTypeVisitor(ASTContext &ctx) : BaseType(ctx) {}
1742 QualType VisitAttributedType(
const AttributedType *attrType) {
1743 QualType
type(attrType, 0);
1744 if (AttributedType::stripOuterNullability(
type)) {
1745 while (AttributedType::stripOuterNullability(
type)) {
1747 return BaseType::recurse(
type);
1750 return BaseType::VisitAttributedType(attrType);
1754struct StripObjCKindOfTypeVisitor
1755 :
public SimpleTransformVisitor<StripObjCKindOfTypeVisitor> {
1756 using BaseType = SimpleTransformVisitor<StripObjCKindOfTypeVisitor>;
1758 explicit StripObjCKindOfTypeVisitor(ASTContext &ctx) : BaseType(ctx) {}
1760 QualType VisitObjCObjectType(
const ObjCObjectType *objType) {
1761 if (!objType->isKindOfType())
1762 return BaseType::VisitObjCObjectType(objType);
1764 QualType baseType = objType->getBaseType().stripObjCKindOfType(Ctx);
1766 objType->getProtocols(),
1783 case BuiltinType::Kind::Float16: {
1791 case BuiltinType::Kind::BFloat16: {
1811 SubstObjCTypeArgsVisitor visitor(ctx, typeArgs, context);
1812 return visitor.recurse(*
this);
1826 auto &ctx =
const_cast<ASTContext &
>(constCtx);
1827 StripObjCKindOfTypeVisitor visitor(ctx);
1828 return visitor.recurse(*
this);
1834 auto &ctx =
const_cast<ASTContext &
>(constCtx);
1835 StripNullabilityTypeVisitor visitor(ctx);
1836 return visitor.recurse(*
this);
1841 if (
const auto AT =
T.getTypePtr()->getAs<
AtomicType>())
1842 T = AT->getValueType();
1843 return T.getUnqualifiedType();
1846std::optional<ArrayRef<QualType>>
1849 if (
const auto method = dyn_cast<ObjCMethodDecl>(dc))
1850 dc = method->getDeclContext();
1854 const auto *dcClassDecl = dyn_cast<ObjCInterfaceDecl>(dc);
1860 dcTypeParams = dcClassDecl->getTypeParamList();
1862 return std::nullopt;
1866 dcCategoryDecl = dyn_cast<ObjCCategoryDecl>(dc);
1867 if (!dcCategoryDecl)
1868 return std::nullopt;
1874 return std::nullopt;
1878 return std::nullopt;
1880 assert(dcTypeParams &&
"No substitutions to perform");
1881 assert(dcClassDecl &&
"No class context");
1886 objectType = objectPointerType->getObjectType();
1897 objectType ? objectType->getInterface() :
nullptr;
1898 if (!curClassDecl) {
1906 while (curClassDecl != dcClassDecl) {
1908 QualType superType = objectType->getSuperClassType();
1909 if (superType.
isNull()) {
1910 objectType =
nullptr;
1915 curClassDecl = objectType->getInterface();
1920 if (!objectType || objectType->isUnspecialized()) {
1925 return objectType->getTypeArgs();
1930 if (
auto *ID = IfaceT->getInterface()) {
1931 if (ID->getTypeParamList())
1939void ObjCObjectType::computeSuperClassTypeSlow()
const {
1945 CachedSuperClassType.setInt(
true);
1951 if (!superClassObjTy) {
1952 CachedSuperClassType.setInt(
true);
1957 if (!superClassDecl) {
1958 CachedSuperClassType.setInt(
true);
1964 QualType superClassType(superClassObjTy, 0);
1966 if (!superClassTypeParams) {
1967 CachedSuperClassType.setPointerAndInt(
1968 superClassType->castAs<ObjCObjectType>(),
true);
1973 if (superClassObjTy->isUnspecialized()) {
1974 CachedSuperClassType.setPointerAndInt(superClassObjTy,
true);
1982 CachedSuperClassType.setPointerAndInt(
1983 superClassType->castAs<ObjCObjectType>(),
true);
1989 if (isUnspecialized()) {
1992 superClassObjTy->getInterface());
1993 CachedSuperClassType.setPointerAndInt(
1994 unspecializedSuper->
castAs<ObjCObjectType>(),
true);
2000 assert(typeArgs.size() == typeParams->
size());
2001 CachedSuperClassType.setPointerAndInt(
2005 ->castAs<ObjCObjectType>(),
2011 return interfaceDecl->getASTContext()
2012 .getObjCInterfaceType(interfaceDecl)
2021 if (superObjectType.
isNull())
2022 return superObjectType;
2033 if (
T->getNumProtocols() &&
T->getInterface())
2046 if (OPT->isObjCQualifiedIdType())
2056 if (OPT->isObjCQualifiedClassType())
2064 if (OT->getInterface())
2072 if (OPT->getInterfaceType())
2089const TemplateSpecializationType *
2092 while (TST && TST->isTypeAlias())
2093 TST = TST->desugar()->getAs<TemplateSpecializationType>();
2099 case Type::DependentName:
2101 case Type::TemplateSpecialization:
2107 case Type::InjectedClassName:
2111 case Type::UnresolvedUsing:
2116 return std::nullopt;
2121 const Type *Cur =
this;
2122 while (
const auto *AT = Cur->
getAs<AttributedType>()) {
2123 if (AT->getAttrKind() == AK)
2125 Cur = AT->getEquivalentType().getTypePtr();
2132class GetContainedDeducedTypeVisitor
2133 :
public TypeVisitor<GetContainedDeducedTypeVisitor, Type *> {
2137 GetContainedDeducedTypeVisitor(
bool Syntactic =
false)
2138 : Syntactic(Syntactic) {}
2145 return Visit(
T.getTypePtr());
2149 Type *VisitDeducedType(
const DeducedType *AT) {
2150 return const_cast<DeducedType *
>(AT);
2154 Type *VisitSubstTemplateTypeParmType(
const SubstTemplateTypeParmType *
T) {
2155 return Visit(
T->getReplacementType());
2158 Type *VisitPointerType(
const PointerType *
T) {
2162 Type *VisitBlockPointerType(
const BlockPointerType *
T) {
2166 Type *VisitReferenceType(
const ReferenceType *
T) {
2167 return Visit(
T->getPointeeTypeAsWritten());
2170 Type *VisitMemberPointerType(
const MemberPointerType *
T) {
2174 Type *VisitArrayType(
const ArrayType *
T) {
2175 return Visit(
T->getElementType());
2178 Type *VisitDependentSizedExtVectorType(
const DependentSizedExtVectorType *
T) {
2179 return Visit(
T->getElementType());
2182 Type *VisitVectorType(
const VectorType *
T) {
2183 return Visit(
T->getElementType());
2186 Type *VisitDependentSizedMatrixType(
const DependentSizedMatrixType *
T) {
2187 return Visit(
T->getElementType());
2190 Type *VisitConstantMatrixType(
const ConstantMatrixType *
T) {
2191 return Visit(
T->getElementType());
2194 Type *VisitFunctionProtoType(
const FunctionProtoType *
T) {
2196 return const_cast<FunctionProtoType *
>(
T);
2197 return VisitFunctionType(
T);
2200 Type *VisitFunctionType(
const FunctionType *
T) {
2204 Type *VisitParenType(
const ParenType *
T) {
return Visit(
T->getInnerType()); }
2206 Type *VisitAttributedType(
const AttributedType *
T) {
2207 return Visit(
T->getModifiedType());
2210 Type *VisitMacroQualifiedType(
const MacroQualifiedType *
T) {
2211 return Visit(
T->getUnderlyingType());
2214 Type *VisitOverflowBehaviorType(
const OverflowBehaviorType *
T) {
2215 return Visit(
T->getUnderlyingType());
2218 Type *VisitAdjustedType(
const AdjustedType *
T) {
2219 return Visit(
T->getOriginalType());
2222 Type *VisitPackExpansionType(
const PackExpansionType *
T) {
2223 return Visit(
T->getPattern());
2226 Type *VisitAtomicType(
const AtomicType *
T) {
2227 return Visit(
T->getValueType());
2234 return cast_or_null<DeducedType>(
2235 GetContainedDeducedTypeVisitor().Visit(
this));
2239 return isa_and_nonnull<FunctionType>(
2240 GetContainedDeducedTypeVisitor(
true).Visit(
this));
2244 if (
const auto *VT = dyn_cast<VectorType>(CanonicalType))
2245 return VT->getElementType()->isIntegerType();
2246 if (CanonicalType->isSveVLSBuiltinType()) {
2248 return VT->getKind() == BuiltinType::SveBool ||
2249 (VT->getKind() >= BuiltinType::SveInt8 &&
2250 VT->getKind() <= BuiltinType::SveUint64);
2252 if (CanonicalType->isRVVVLSBuiltinType()) {
2254 return (VT->getKind() >= BuiltinType::RvvInt8mf8 &&
2255 VT->getKind() <= BuiltinType::RvvUint64m8);
2281 if (
const auto *BT = dyn_cast<BuiltinType>(CanonicalType))
2282 return BT->isInteger();
2286 if (
const auto *ET = dyn_cast<EnumType>(CanonicalType))
2289 if (
const OverflowBehaviorType *OBT =
2290 dyn_cast<OverflowBehaviorType>(CanonicalType))
2291 return OBT->getUnderlyingType()->isIntegralOrEnumerationType();
2298 if (
const auto *BT = dyn_cast<BuiltinType>(CanonicalType))
2299 return BT->isInteger();
2301 if (
const auto *OBT = dyn_cast<OverflowBehaviorType>(CanonicalType))
2302 return OBT->getUnderlyingType()->isIntegerType();
2311 if (
const auto *ET = dyn_cast<EnumType>(CanonicalType))
2312 return !ET->getDecl()->isScoped();
2318 if (
const auto *BT = dyn_cast<BuiltinType>(CanonicalType))
2319 return BT->getKind() == BuiltinType::Char_U ||
2320 BT->getKind() == BuiltinType::UChar ||
2321 BT->getKind() == BuiltinType::Char_S ||
2322 BT->getKind() == BuiltinType::SChar;
2327 if (
const auto *BT = dyn_cast<BuiltinType>(CanonicalType))
2328 return BT->getKind() == BuiltinType::WChar_S ||
2329 BT->getKind() == BuiltinType::WChar_U;
2334 if (
const BuiltinType *BT = dyn_cast<BuiltinType>(CanonicalType))
2335 return BT->getKind() == BuiltinType::Char8;
2340 if (
const auto *BT = dyn_cast<BuiltinType>(CanonicalType))
2341 return BT->getKind() == BuiltinType::Char16;
2346 if (
const auto *BT = dyn_cast<BuiltinType>(CanonicalType))
2347 return BT->getKind() == BuiltinType::Char32;
2354 const auto *BT = dyn_cast<BuiltinType>(CanonicalType);
2357 switch (BT->getKind()) {
2360 case BuiltinType::Char_U:
2361 case BuiltinType::UChar:
2362 case BuiltinType::WChar_U:
2363 case BuiltinType::Char8:
2364 case BuiltinType::Char16:
2365 case BuiltinType::Char32:
2366 case BuiltinType::Char_S:
2367 case BuiltinType::SChar:
2368 case BuiltinType::WChar_S:
2374 const auto *BT = dyn_cast<BuiltinType>(CanonicalType);
2377 switch (BT->getKind()) {
2380 case BuiltinType::Char8:
2381 case BuiltinType::Char16:
2382 case BuiltinType::Char32:
2391 if (
const auto *BT = dyn_cast<BuiltinType>(CanonicalType))
2392 return BT->isSignedInteger();
2397 if (!ED->isComplete() || ED->isScoped())
2399 return ED->getIntegerType()->isSignedIntegerType();
2402 if (
const auto *IT = dyn_cast<BitIntType>(CanonicalType))
2403 return IT->isSigned();
2404 if (
const auto *IT = dyn_cast<DependentBitIntType>(CanonicalType))
2405 return IT->isSigned();
2407 if (
const auto *OBT = dyn_cast<OverflowBehaviorType>(CanonicalType))
2408 return OBT->getUnderlyingType()->isSignedIntegerType();
2414 if (
const auto *BT = dyn_cast<BuiltinType>(CanonicalType))
2415 return BT->isSignedInteger();
2418 if (!ED->isComplete())
2420 return ED->getIntegerType()->isSignedIntegerType();
2423 if (
const auto *IT = dyn_cast<BitIntType>(CanonicalType))
2424 return IT->isSigned();
2425 if (
const auto *IT = dyn_cast<DependentBitIntType>(CanonicalType))
2426 return IT->isSigned();
2428 if (
const auto *OBT = dyn_cast<OverflowBehaviorType>(CanonicalType))
2429 return OBT->getUnderlyingType()->isSignedIntegerOrEnumerationType();
2435 if (
const auto *VT = dyn_cast<VectorType>(CanonicalType))
2436 return VT->getElementType()->isSignedIntegerOrEnumerationType();
2437 if (
const auto *MT = dyn_cast<MatrixType>(CanonicalType))
2438 return MT->getElementType()->isSignedIntegerOrEnumerationType();
2440 if (
const auto *BT = dyn_cast<BuiltinType>(CanonicalType)) {
2441 switch (BT->getKind()) {
2442#define SVE_VECTOR_TYPE_INT(Name, MangledName, Id, SingletonId, NumEls, \
2443 ElBits, NF, IsSigned) \
2444 case BuiltinType::Id: \
2446#include "clang/Basic/AArch64ACLETypes.def"
2459 if (
const auto *BT = dyn_cast<BuiltinType>(CanonicalType))
2460 return BT->isUnsignedInteger();
2465 if (!ED->isComplete() || ED->isScoped())
2467 return ED->getIntegerType()->isUnsignedIntegerType();
2470 if (
const auto *IT = dyn_cast<BitIntType>(CanonicalType))
2471 return IT->isUnsigned();
2472 if (
const auto *IT = dyn_cast<DependentBitIntType>(CanonicalType))
2473 return IT->isUnsigned();
2475 if (
const auto *OBT = dyn_cast<OverflowBehaviorType>(CanonicalType))
2476 return OBT->getUnderlyingType()->isUnsignedIntegerType();
2482 if (
const auto *BT = dyn_cast<BuiltinType>(CanonicalType))
2483 return BT->isUnsignedInteger();
2486 if (!ED->isComplete())
2488 return ED->getIntegerType()->isUnsignedIntegerType();
2491 if (
const auto *IT = dyn_cast<BitIntType>(CanonicalType))
2492 return IT->isUnsigned();
2493 if (
const auto *IT = dyn_cast<DependentBitIntType>(CanonicalType))
2494 return IT->isUnsigned();
2496 if (
const auto *OBT = dyn_cast<OverflowBehaviorType>(CanonicalType))
2497 return OBT->getUnderlyingType()->isUnsignedIntegerOrEnumerationType();
2503 if (
const auto *VT = dyn_cast<VectorType>(CanonicalType))
2504 return VT->getElementType()->isUnsignedIntegerOrEnumerationType();
2505 if (
const auto *VT = dyn_cast<MatrixType>(CanonicalType))
2506 return VT->getElementType()->isUnsignedIntegerOrEnumerationType();
2507 if (CanonicalType->isSveVLSBuiltinType()) {
2509 return VT->getKind() >= BuiltinType::SveUint8 &&
2510 VT->getKind() <= BuiltinType::SveUint64;
2516 if (
const auto *BT = dyn_cast<BuiltinType>(CanonicalType))
2517 return BT->isFloatingPoint();
2518 if (
const auto *CT = dyn_cast<ComplexType>(CanonicalType))
2519 return CT->getElementType()->isFloatingType();
2524 if (
const auto *VT = dyn_cast<VectorType>(CanonicalType))
2525 return VT->getElementType()->isFloatingType();
2526 if (
const auto *MT = dyn_cast<MatrixType>(CanonicalType))
2527 return MT->getElementType()->isFloatingType();
2532 if (
const auto *BT = dyn_cast<BuiltinType>(CanonicalType))
2533 return BT->isFloatingPoint();
2538 if (
const auto *BT = dyn_cast<BuiltinType>(CanonicalType))
2539 return BT->getKind() >= BuiltinType::Bool &&
2540 BT->getKind() <= BuiltinType::Ibm128;
2541 if (
const auto *ET = dyn_cast<EnumType>(CanonicalType)) {
2542 const auto *ED = ET->getDecl();
2543 return !ED->isScoped() && ED->getDefinitionOrSelf()->isComplete();
2549 if (
const auto *BT = dyn_cast<BuiltinType>(CanonicalType))
2550 return BT->getKind() >= BuiltinType::Bool &&
2551 BT->getKind() <= BuiltinType::Ibm128;
2552 if (
const auto *ET = dyn_cast<EnumType>(CanonicalType)) {
2559 const auto *ED = ET->getDecl();
2560 return !ED->isScoped() && ED->getDefinitionOrSelf()->isComplete();
2571 if (
const auto *VT = dyn_cast<VectorType>(CanonicalType))
2572 return VT->getElementType()->isBooleanType();
2574 return ED->isComplete() && ED->getIntegerType()->isBooleanType();
2575 if (
const auto *IT = dyn_cast<BitIntType>(CanonicalType))
2576 return IT->getNumBits() == 1;
2583 const Type *
T = CanonicalType.getTypePtr();
2584 if (
const auto *BT = dyn_cast<BuiltinType>(
T)) {
2585 if (BT->getKind() == BuiltinType::Bool)
2587 if (BT->getKind() == BuiltinType::NullPtr)
2589 if (BT->isInteger())
2591 if (BT->isFloatingPoint())
2593 if (BT->isFixedPointType())
2595 llvm_unreachable(
"unknown scalar builtin type");
2605 assert(
T->castAsEnumDecl()->isComplete());
2607 }
else if (
const auto *CT = dyn_cast<ComplexType>(
T)) {
2608 if (CT->getElementType()->isRealFloatingType())
2617 llvm_unreachable(
"unknown scalar type");
2630 if (
const auto *
Record = dyn_cast<RecordType>(CanonicalType)) {
2631 if (
const auto *ClassDecl = dyn_cast<CXXRecordDecl>(
Record->getDecl()))
2632 return ClassDecl->isAggregate();
2644 assert(!
isIncompleteType() &&
"This doesn't make sense for incomplete types");
2645 assert(!
isDependentType() &&
"This doesn't make sense for dependent types");
2657 switch (CanonicalType->getTypeClass()) {
2668 return !EnumD->isComplete();
2676 return !Rec->isCompleteDefinition();
2678 case InjectedClassName: {
2680 if (!Rec->isBeingDefined())
2694 ->isIncompleteType(Def);
2695 case IncompleteArray:
2698 case MemberPointer: {
2711 if (!Context.getTargetInfo().getCXXABI().isMicrosoft())
2714 if (RD->
hasAttr<MSInheritanceAttr>())
2721 ->isIncompleteType(Def);
2722 case ObjCInterface: {
2754 switch (BT->getKind()) {
2756#define WASM_TYPE(Name, Id, SingletonId) case BuiltinType::Id:
2757#include "clang/Basic/WebAssemblyReferenceTypes.def"
2759#define HLSL_INTANGIBLE_TYPE(Name, Id, SingletonId) case BuiltinType::Id:
2760#include "clang/Basic/HLSLIntangibleTypes.def"
2762 case BuiltinType::AMDGPUFeaturePredicate:
2773 return BT->getKind() == BuiltinType::WasmExternRef;
2778 if (
const auto *ATy = dyn_cast<ArrayType>(
this))
2779 return ATy->getElementType().isWebAssemblyReferenceType();
2781 if (
const auto *PTy = dyn_cast<PointerType>(
this))
2782 return PTy->getPointeeType().isWebAssemblyReferenceType();
2795 switch (BT->getKind()) {
2797#define SVE_VECTOR_TYPE(Name, MangledName, Id, SingletonId) \
2798 case BuiltinType::Id: \
2800#define SVE_OPAQUE_TYPE(Name, MangledName, Id, SingletonId) \
2801 case BuiltinType::Id: \
2803#define SVE_PREDICATE_TYPE(Name, MangledName, Id, SingletonId) \
2804 case BuiltinType::Id: \
2806#include "clang/Basic/AArch64ACLETypes.def"
2816 switch (BT->getKind()) {
2817#define RVV_TYPE(Name, Id, SingletonId) case BuiltinType::Id:
2818#include "clang/Basic/RISCVVTypes.def"
2829 switch (BT->getKind()) {
2830 case BuiltinType::SveInt8:
2831 case BuiltinType::SveInt16:
2832 case BuiltinType::SveInt32:
2833 case BuiltinType::SveInt64:
2834 case BuiltinType::SveUint8:
2835 case BuiltinType::SveUint16:
2836 case BuiltinType::SveUint32:
2837 case BuiltinType::SveUint64:
2838 case BuiltinType::SveFloat16:
2839 case BuiltinType::SveFloat32:
2840 case BuiltinType::SveFloat64:
2841 case BuiltinType::SveBFloat16:
2842 case BuiltinType::SveBool:
2843 case BuiltinType::SveBoolx2:
2844 case BuiltinType::SveBoolx4:
2845 case BuiltinType::SveMFloat8:
2863 llvm_unreachable(
"Unhandled type");
2870 if (BTy->
getKind() == BuiltinType::SveBool)
2881 switch (BT->getKind()) {
2882#define RVV_VECTOR_TYPE(Name, Id, SingletonId, NumEls, ElBits, NF, IsSigned, \
2884 case BuiltinType::Id: \
2886#define RVV_PREDICATE_TYPE(Name, Id, SingletonId, NumEls) \
2887 case BuiltinType::Id: \
2889#include "clang/Basic/RISCVVTypes.def"
2903#define RVV_PREDICATE_TYPE(Name, Id, SingletonId, NumEls) \
2904 case BuiltinType::Id: \
2905 return Ctx.UnsignedCharTy;
2908#include "clang/Basic/RISCVVTypes.def"
2911 llvm_unreachable(
"Unhandled type");
2915 if (Context.getLangOpts().HLSL &&
2916 getTypePtr()->isHLSLStandardLayoutRecordOrArrayOf())
2920 if (Context.getLangOpts().CPlusPlus11)
2933 if ((*this)->isIncompleteArrayType())
2934 return Context.getBaseElementType(*this).isCXX98PODType(Context);
2936 if ((*this)->isIncompleteType())
2945 if (Context.containsAddressDiscriminatedPointerAuth(CanonicalType))
2952 case Type::VariableArray:
2953 case Type::ConstantArray:
2955 return Context.getBaseElementType(*this).isCXX98PODType(Context);
2957 case Type::ObjCObjectPointer:
2958 case Type::BlockPointer:
2962 case Type::MemberPointer:
2964 case Type::ExtVector:
2966 case Type::OverflowBehavior:
2973 if (
const auto *ClassDecl =
2975 return ClassDecl->isPOD();
2989 if ((*this)->isArrayType())
2990 return Context.getBaseElementType(*this).isTrivialType(Context);
2992 if ((*this)->isSizelessBuiltinType())
2997 if ((*this)->isIncompleteType())
3009 if (Context.containsAddressDiscriminatedPointerAuth(CanonicalType))
3028 return ClassDecl->hasTrivialDefaultConstructor() &&
3029 !ClassDecl->hasNonTrivialDefaultConstructor() &&
3030 ClassDecl->isTriviallyCopyable();
3042 bool IsCopyConstructible) {
3043 if (
type->isArrayType())
3045 Context, IsCopyConstructible);
3047 if (
type.hasNonTrivialObjCLifetime())
3081 if (
const auto *ClassDecl = dyn_cast<CXXRecordDecl>(RD)) {
3082 if (IsCopyConstructible)
3083 return ClassDecl->isTriviallyCopyConstructible();
3084 return ClassDecl->isTriviallyCopyable();
3086 return !RD->isNonTrivialToPrimitiveCopy();
3100 if (CanonicalType.hasNonTrivialObjCLifetime())
3102 if (CanonicalType->isArrayType())
3103 return Context.getBaseElementType(CanonicalType)
3104 .isBitwiseCloneableType(Context);
3106 if (CanonicalType->isIncompleteType())
3111 if (Context.containsAddressDiscriminatedPointerAuth(CanonicalType))
3114 const auto *RD = CanonicalType->getAsRecordDecl();
3118 if (RD->isInvalidDecl())
3124 if (RD->mayInsertExtraPadding())
3127 for (
auto *
const Field : RD->fields()) {
3128 if (!Field->getType().isBitwiseCloneableType(Context))
3132 if (
const auto *CXXRD = dyn_cast<CXXRecordDecl>(RD)) {
3133 for (
auto Base : CXXRD->bases())
3134 if (!
Base.getType().isBitwiseCloneableType(Context))
3136 for (
auto VBase : CXXRD->vbases())
3137 if (!VBase.getType().isBitwiseCloneableType(Context))
3150 return !Context.getLangOpts().ObjCAutoRefCount &&
3151 Context.getLangOpts().ObjCWeak &&
3184 return OBT->getBehaviorKind() ==
3185 OverflowBehaviorType::OverflowBehaviorKind::Wrap;
3192 return OBT->getBehaviorKind() ==
3193 OverflowBehaviorType::OverflowBehaviorKind::Trap;
3200 if (
const auto *RD =
3216 if (
const auto *RD =
3256 assert(BaseTy &&
"NULL element type");
3290 if (
const auto *ClassDecl = dyn_cast<CXXRecordDecl>(RD))
3291 return ClassDecl->isLiteral();
3298 return AT->getValueType()->isLiteralType(Ctx);
3300 if (
const auto *OBT = BaseTy->
getAs<OverflowBehaviorType>())
3301 return OBT->getUnderlyingType()->isLiteralType(Ctx);
3323 return RD->isStructural();
3336 assert(BaseTy &&
"NULL element type");
3347 if (
const auto *ClassDecl = dyn_cast<CXXRecordDecl>(RD);
3348 ClassDecl && !ClassDecl->isStandardLayout())
3376 assert(BaseTy &&
"NULL element type");
3387 if (Context.containsAddressDiscriminatedPointerAuth(*
this))
3394 if (
const auto *ClassDecl = dyn_cast<CXXRecordDecl>(RD)) {
3397 if (!ClassDecl->isTrivial())
3403 if (!ClassDecl->isStandardLayout())
3434 const auto *ED = ET->getDecl();
3436 if (II && II->
isStr(
"align_val_t") && ED->isInStdNamespace())
3444 const auto *ED = ET->getDecl();
3446 if (II && II->
isStr(
"byte") && ED->isInStdNamespace())
3462 case TemplateTypeParm:
3463 case SubstTemplateTypeParm:
3464 case TemplateSpecialization:
3507 llvm_unreachable(
"Type specifier is not a tag type kind.");
3524 llvm_unreachable(
"Unknown tag type kind.");
3542 llvm_unreachable(
"Elaborated type keyword is not a tag type kind.");
3544 llvm_unreachable(
"Unknown elaborated type keyword.");
3559 llvm_unreachable(
"Unknown elaborated type keyword.");
3573 return "__interface";
3580 llvm_unreachable(
"Unknown elaborated type keyword.");
3585 if (
const auto *TST = dyn_cast<TemplateSpecializationType>(
this))
3587 else if (
const auto *DepName = dyn_cast<DependentNameType>(
this))
3588 Keyword = DepName->getKeyword();
3589 else if (
const auto *
T = dyn_cast<TagType>(
this))
3591 else if (
const auto *
T = dyn_cast<TypedefType>(
this))
3593 else if (
const auto *
T = dyn_cast<UnresolvedUsingType>(
this))
3595 else if (
const auto *
T = dyn_cast<UsingType>(
this))
3605#define ABSTRACT_TYPE(Derived, Base)
3606#define TYPE(Derived, Base) \
3609#include "clang/AST/TypeNodes.inc"
3612 llvm_unreachable(
"Invalid type class.");
3620 return Policy.
Bool ?
"bool" :
"_Bool";
3626 return "signed char";
3638 return "unsigned char";
3640 return "unsigned short";
3642 return "unsigned int";
3644 return "unsigned long";
3646 return "unsigned long long";
3648 return "unsigned __int128";
3650 return Policy.
Half ?
"half" :
"__fp16";
3658 return "long double";
3660 return "short _Accum";
3664 return "long _Accum";
3666 return "unsigned short _Accum";
3668 return "unsigned _Accum";
3670 return "unsigned long _Accum";
3671 case BuiltinType::ShortFract:
3672 return "short _Fract";
3673 case BuiltinType::Fract:
3675 case BuiltinType::LongFract:
3676 return "long _Fract";
3677 case BuiltinType::UShortFract:
3678 return "unsigned short _Fract";
3679 case BuiltinType::UFract:
3680 return "unsigned _Fract";
3681 case BuiltinType::ULongFract:
3682 return "unsigned long _Fract";
3683 case BuiltinType::SatShortAccum:
3684 return "_Sat short _Accum";
3685 case BuiltinType::SatAccum:
3686 return "_Sat _Accum";
3687 case BuiltinType::SatLongAccum:
3688 return "_Sat long _Accum";
3689 case BuiltinType::SatUShortAccum:
3690 return "_Sat unsigned short _Accum";
3691 case BuiltinType::SatUAccum:
3692 return "_Sat unsigned _Accum";
3693 case BuiltinType::SatULongAccum:
3694 return "_Sat unsigned long _Accum";
3695 case BuiltinType::SatShortFract:
3696 return "_Sat short _Fract";
3697 case BuiltinType::SatFract:
3698 return "_Sat _Fract";
3699 case BuiltinType::SatLongFract:
3700 return "_Sat long _Fract";
3701 case BuiltinType::SatUShortFract:
3702 return "_Sat unsigned short _Fract";
3703 case BuiltinType::SatUFract:
3704 return "_Sat unsigned _Fract";
3705 case BuiltinType::SatULongFract:
3706 return "_Sat unsigned long _Fract";
3710 return "__float128";
3715 return Policy.
MSWChar ?
"__wchar_t" :
"wchar_t";
3725 return "<overloaded function type>";
3727 return "<bound member function type>";
3728 case UnresolvedTemplate:
3729 return "<unresolved template type>";
3731 return "<pseudo-object type>";
3733 return "<dependent type>";
3735 return "<unknown type>";
3736 case ARCUnbridgedCast:
3737 return "<ARC unbridged cast type>";
3739 return "<builtin fn type>";
3746#define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \
3748 return "__" #Access " " #ImgType "_t";
3749#include "clang/Basic/OpenCLImageTypes.def"
3755 return "clk_event_t";
3759 return "reserve_id_t";
3760 case IncompleteMatrixIdx:
3761 return "<incomplete matrix index type>";
3763 return "<array section type>";
3764 case OMPArrayShaping:
3765 return "<OpenMP array shaping type>";
3767 return "<OpenMP iterator type>";
3768#define EXT_OPAQUE_TYPE(ExtType, Id, Ext) \
3771#include "clang/Basic/OpenCLExtensionTypes.def"
3772#define SVE_TYPE(Name, Id, SingletonId) \
3775#include "clang/Basic/AArch64ACLETypes.def"
3776#define PPC_VECTOR_TYPE(Name, Id, Size) \
3779#include "clang/Basic/PPCTypes.def"
3780#define RVV_TYPE(Name, Id, SingletonId) \
3783#include "clang/Basic/RISCVVTypes.def"
3784#define WASM_TYPE(Name, Id, SingletonId) \
3787#include "clang/Basic/WebAssemblyReferenceTypes.def"
3788#define AMDGPU_TYPE(Name, Id, SingletonId, Width, Align) \
3791#include "clang/Basic/AMDGPUTypes.def"
3792#define HLSL_INTANGIBLE_TYPE(Name, Id, SingletonId) \
3795#include "clang/Basic/HLSLIntangibleTypes.def"
3796#define SPIRV_TYPE(Name, Id, SingletonId) \
3799#include "clang/Basic/SPIRVTypes.def"
3802 llvm_unreachable(
"Invalid builtin type.");
3807 if (
auto *PET = dyn_cast<PackExpansionType>(
getTypePtr()))
3808 return PET->getPattern();
3813 if (
const auto *RefType =
getTypePtr()->getAs<ReferenceType>())
3821 if (!Context.getLangOpts().CPlusPlus ||
3830 return FPT->hasCFIUncheckedCallee();
3847 return "vectorcall";
3859 return "aarch64_vector_pcs";
3861 return "aarch64_sve_pcs";
3863 return "intel_ocl_bicc";
3865 return "device_kernel";
3869 return "swiftasynccall";
3871 return "preserve_most";
3873 return "preserve_all";
3877 return "preserve_none";
3880#define CC_VLS_CASE(ABI_VLEN) \
3881 case CC_RISCVVLSCall_##ABI_VLEN: return "riscv_vls_cc(" #ABI_VLEN ")";
3898 llvm_unreachable(
"Invalid calling convention.");
3916 assert(
getNumParams() == params.size() &&
"NumParams overflow!");
3925 auto &ExtraBits = *getTrailingObjects<FunctionTypeExtraBitfields>();
3933 auto &ExtraAttrInfo = *getTrailingObjects<FunctionTypeExtraAttributeInfo>();
3937 auto &ExtraBits = *getTrailingObjects<FunctionTypeExtraBitfields>();
3938 ExtraBits.HasExtraAttributeInfo =
true;
3942 auto &ArmTypeAttrs = *getTrailingObjects<FunctionTypeArmAttributes>();
3943 ArmTypeAttrs = FunctionTypeArmAttributes();
3946 auto &ExtraBits = *getTrailingObjects<FunctionTypeExtraBitfields>();
3947 ExtraBits.HasArmTypeAttributes =
true;
3951 auto *argSlot = getTrailingObjects<QualType>();
3954 ~TypeDependence::VariablyModified);
3955 argSlot[i] = params[i];
3960 auto &ArmTypeAttrs = *getTrailingObjects<FunctionTypeArmAttributes>();
3962 "Not enough bits to encode SME attributes");
3968 auto &ExtraBits = *getTrailingObjects<FunctionTypeExtraBitfields>();
3970 assert(NumExceptions <= 1023 &&
"Not enough bits to encode exceptions");
3971 ExtraBits.NumExceptionType = NumExceptions;
3973 assert(hasExtraBitfields() &&
"missing trailing extra bitfields!");
3975 reinterpret_cast<QualType *
>(getTrailingObjects<ExceptionType>());
3983 (TypeDependence::Instantiation | TypeDependence::UnexpandedPack));
3985 exnSlot[I++] = ExceptionType;
3999 (TypeDependence::Instantiation | TypeDependence::UnexpandedPack));
4005 auto **slot = getTrailingObjects<FunctionDecl *>();
4013 auto **slot = getTrailingObjects<FunctionDecl *>();
4032 auto *extParamInfos = getTrailingObjects<ExtParameterInfo>();
4039 *getTrailingObjects<Qualifiers>() = epi.
TypeQuals;
4046 auto &EllipsisLoc = *getTrailingObjects<SourceLocation>();
4051 auto &ExtraBits = *getTrailingObjects<FunctionTypeExtraBitfields>();
4053 ExtraBits.NumFunctionEffects = EffectsCount;
4054 assert(ExtraBits.NumFunctionEffects == EffectsCount &&
4055 "effect bitfield overflow");
4058 auto *DestFX = getTrailingObjects<FunctionEffect>();
4059 llvm::uninitialized_copy(SrcFX, DestFX);
4062 if (!SrcConds.empty()) {
4063 ExtraBits.EffectsHaveConditions =
true;
4064 auto *DestConds = getTrailingObjects<EffectConditionExpr>();
4065 llvm::uninitialized_copy(SrcConds, DestConds);
4066 assert(llvm::any_of(SrcConds,
4067 [](
const EffectConditionExpr &EC) {
4069 return E->isTypeDependent() ||
4070 E->isValueDependent();
4073 "expected a dependent expression among the conditions");
4081 return NE->isValueDependent();
4093 return NE->isInstantiationDependent();
4104 llvm_unreachable(
"should not call this with unresolved exception specs");
4130 llvm_unreachable(
"unexpected exception specification kind");
4134 for (
unsigned ArgIdx =
getNumParams(); ArgIdx; --ArgIdx)
4142 const QualType *ArgTys,
unsigned NumParams,
4143 const ExtProtoInfo &epi,
4167 ID.AddPointer(
Result.getAsOpaquePtr());
4168 for (
unsigned i = 0; i != NumParams; ++i)
4169 ID.AddPointer(ArgTys[i].getAsOpaquePtr());
4173 assert(!(
unsigned(epi.Variadic) & ~1) && !(
unsigned(epi.RefQualifier) & ~3) &&
4174 !(
unsigned(epi.ExceptionSpec.Type) & ~15) &&
4175 "Values larger than expected.");
4176 ID.AddInteger(
unsigned(epi.Variadic) + (epi.RefQualifier << 1) +
4177 (epi.ExceptionSpec.Type << 3));
4178 ID.Add(epi.TypeQuals);
4180 for (
QualType Ex : epi.ExceptionSpec.Exceptions)
4193 ID.AddPointer(epi.ExceptionSpec.NoexceptExpr);
4197 epi.ExceptionSpec.NoexceptExpr->Profile(ID, Context,
true);
4200 ID.AddPointer(epi.ExceptionSpec.SourceDecl->getCanonicalDecl());
4202 if (epi.ExtParameterInfos) {
4203 for (
unsigned i = 0; i != NumParams; ++i)
4204 ID.AddInteger(epi.ExtParameterInfos[i].getOpaqueValue());
4207 epi.ExtInfo.Profile(ID);
4208 epi.ExtraAttributeInfo.Profile(ID);
4210 unsigned EffectCount = epi.FunctionEffects.size();
4211 bool HasConds = !epi.FunctionEffects.Conditions.empty();
4213 ID.AddInteger((EffectCount << 3) | (HasConds << 2) |
4214 (epi.AArch64SMEAttributes << 1) | epi.HasTrailingReturn);
4215 ID.AddInteger(epi.CFIUncheckedCallee);
4217 for (
unsigned Idx = 0; Idx != EffectCount; ++Idx) {
4218 ID.AddInteger(epi.FunctionEffects.Effects[Idx].toOpaqueInt32());
4220 ID.AddPointer(epi.FunctionEffects.Conditions[Idx].getCondition());
4231 : Data(D, Deref << DerefShift) {}
4234 return Data.getInt() & DerefMask;
4239 return Data.getOpaqueValue();
4246 Data.setFromOpaqueValue(
V);
4249OverflowBehaviorType::OverflowBehaviorType(
4251 OverflowBehaviorType::OverflowBehaviorKind Kind)
4252 :
Type(OverflowBehavior, Canon, Underlying->getDependence()),
4253 UnderlyingType(Underlying), BehaviorKind(Kind), Context(Context) {}
4255SplitQualType OverflowBehaviorType::getSplitUnqualifiedType()
const {
4257 QualType UnqualUnderlyingTy(SplitUnderlying.
Ty, 0);
4258 if (UnqualUnderlyingTy == UnderlyingType)
4262 Context.getOverflowBehaviorType(BehaviorKind, UnqualUnderlyingTy);
4270CountAttributedType::CountAttributedType(
4274 CountExpr(CountExpr) {
4282 Decls = CoupledDecls;
4294 llvm::copy(Decls, Slots);
4295 return ArrayRef(Slots, Decls.size());
4303 ArrayRef<TypeCoupledDeclRefInfo>
Decls =
4305 return new (Ctx,
alignof(CountAttributedType)) CountAttributedType(
4306 Wrapped, Canon, CountExpr, CountInBytes, OrNull,
Decls);
4309void CountAttributedType::complete(
4312 assert(!CountExpr &&
"count expression is already set");
4313 assert(E &&
"completing with a null count expression");
4324#define ENUMERATE_ATTRS(PREFIX) \
4326 if (isCountInBytes()) { \
4328 return PREFIX "sized_by_or_null"; \
4329 return PREFIX "sized_by"; \
4332 return PREFIX "counted_by_or_null"; \
4333 return PREFIX "counted_by"; \
4336 if (WithMacroPrefix)
4341#undef ENUMERATE_ATTRS
4347 bool HasTypeDifferentFromDecl)
4349 Keyword, TC, UnderlyingType.getCanonicalType(),
4353 ~NestedNameSpecifierDependence::
Dependent)
4357 *getTrailingObjects<NestedNameSpecifier>() = Qualifier;
4358 if ((
TypedefBits.hasTypeDifferentFromDecl = HasTypeDifferentFromDecl))
4359 *getTrailingObjects<QualType>() = UnderlyingType;
4364 : *getTrailingObjects<QualType>();
4370 const Type *CanonicalType)
4376 ~NestedNameSpecifierDependence::
Dependent)
4380 *getTrailingObjects<NestedNameSpecifier>() = Qualifier;
4389 if ((
UsingBits.hasQualifier = !!Qualifier))
4390 *getTrailingObjects() = Qualifier;
4399 while (
auto *InnerMQT = dyn_cast<MacroQualifiedType>(Inner)) {
4402 Inner = InnerMQT->getModifiedType();
4413 ? Context.getUnqualifiedArrayType(Can).getAtomicUnqualifiedType()
4418 TOExpr(E), Context(Context) {
4419 TypeOfBits.Kind =
static_cast<unsigned>(Kind);
4428 ? Context.getUnqualifiedArrayType(QT).getAtomicUnqualifiedType()
4437 E->
Profile(ID, Context,
true);
4438 ID.AddBoolean(IsUnqual);
4445 ? Context.getUnqualifiedArrayType(Can).getAtomicUnqualifiedType()
4447 T->getDependence()),
4448 TOType(
T), Context(Context) {
4449 TypeOfBits.Kind =
static_cast<unsigned>(Kind);
4452QualType TypeOfType::desugar()
const {
4455 ? Context.getUnqualifiedArrayType(QT).getAtomicUnqualifiedType()
4463 :
Type(Decltype, can,
4467 (E->
getType()->getDependence() &
4469 E(E), UnderlyingType(underlyingType) {}
4473QualType DecltypeType::desugar()
const {
4480DependentDecltypeType::DependentDecltypeType(
Expr *E)
4483void DependentDecltypeType::Profile(llvm::FoldingSetNodeID &ID,
4485 E->
Profile(ID, Context,
true);
4489 Expr *IndexExpr,
bool FullySubstituted,
4491 :
Type(PackIndexing, Canonical,
4493 Pattern(Pattern), IndexExpr(IndexExpr),
Size(Expansions.size()),
4494 FullySubstituted(FullySubstituted) {
4496 llvm::uninitialized_copy(Expansions, getTrailingObjects());
4500 if (isInstantiationDependentType())
4501 return std::nullopt;
4503 ConstantExpr *CE = dyn_cast<ConstantExpr>(getIndexExpr());
4505 return std::nullopt;
4507 assert(Index.isNonNegative() &&
"Invalid index");
4508 return static_cast<unsigned>(Index.getExtValue());
4512PackIndexingType::computeDependence(
QualType Pattern,
Expr *IndexExpr,
4517 ? TypeDependence::DependentInstantiation
4518 : TypeDependence::None);
4519 if (Expansions.empty())
4520 TD |= Pattern->
getDependence() & TypeDependence::DependentInstantiation;
4523 TD |=
T->getDependence();
4525 if (!(IndexD & TypeDependence::UnexpandedPack))
4531 TD |= TypeDependence::Error | TypeDependence::DependentInstantiation;
4536void PackIndexingType::Profile(llvm::FoldingSetNodeID &ID,
4538 Profile(ID, Context, getPattern(), getIndexExpr(), isFullySubstituted(),
4542void PackIndexingType::Profile(llvm::FoldingSetNodeID &ID,
4544 Expr *E,
bool FullySubstituted,
4547 E->
Profile(ID, Context,
true);
4548 ID.AddBoolean(FullySubstituted);
4549 if (!Expansions.empty()) {
4550 ID.AddInteger(Expansions.size());
4552 T.getCanonicalType().Profile(ID);
4558UnaryTransformType::UnaryTransformType(
QualType BaseType,
4559 QualType UnderlyingType, UTTKind UKind,
4561 :
Type(UnaryTransform, CanonicalType, BaseType->getDependence()),
4562 BaseType(BaseType), UnderlyingType(UnderlyingType), UKind(UKind) {}
4566 bool OwnsTag,
bool ISInjected,
const Type *CanonicalType)
4573 ~NestedNameSpecifierDependence::
Dependent)
4577 getTrailingQualifier() = Qualifier;
4582void *TagType::getTrailingPointer()
const {
4583 switch (getTypeClass()) {
4588 case Type::InjectedClassName:
4589 return const_cast<InjectedClassNameType *
>(
4592 llvm_unreachable(
"unexpected type class");
4597 assert(TagTypeBits.HasQualifier);
4599 getTrailingPointer(), llvm::Align::Of<NestedNameSpecifier *>()));
4603 return TagTypeBits.HasQualifier ? getTrailingQualifier() : std::nullopt;
4607 auto *
Decl = dyn_cast<CXXRecordDecl>(
decl);
4610 if (
auto *RD = dyn_cast<ClassTemplateSpecializationDecl>(
Decl))
4611 return RD->getSpecializedTemplate();
4612 return Decl->getDescribedClassTemplate();
4616 auto *TD = getTemplateDecl();
4619 if (isCanonicalUnqualified())
4626TagType::getTemplateArgs(
const ASTContext &Ctx)
const {
4627 auto *
Decl = dyn_cast<CXXRecordDecl>(
decl);
4631 if (
auto *RD = dyn_cast<ClassTemplateSpecializationDecl>(
Decl))
4632 return RD->getTemplateArgs().asArray();
4634 return TD->getTemplateParameters()->getInjectedTemplateArgs(Ctx);
4638bool RecordType::hasConstFields()
const {
4639 std::vector<const RecordType *> RecordTypeList;
4640 RecordTypeList.push_back(
this);
4641 unsigned NextToCheckIndex = 0;
4643 while (RecordTypeList.size() > NextToCheckIndex) {
4644 for (
FieldDecl *FD : RecordTypeList[NextToCheckIndex]
4646 ->getDefinitionOrSelf()
4652 if (
const auto *FieldRecTy = FieldTy->
getAsCanonical<RecordType>()) {
4653 if (!llvm::is_contained(RecordTypeList, FieldRecTy))
4654 RecordTypeList.push_back(FieldRecTy);
4664 const TagDecl *TD,
bool IsInjected,
4665 const Type *CanonicalType)
4667 false, IsInjected, CanonicalType) {}
4676 :
Type(Attributed, canon, equivalent->getDependence()), Attribute(
attr),
4677 ModifiedType(modified), EquivalentType(equivalent) {
4679 assert(!attr ||
attr->getKind() == attrKind);
4682bool AttributedType::isQualifier()
const {
4684 switch (getAttrKind()) {
4689 case attr::ObjCOwnership:
4690 case attr::ObjCInertUnsafeUnretained:
4691 case attr::TypeNonNull:
4692 case attr::TypeNullable:
4693 case attr::TypeNullableResult:
4694 case attr::TypeNullUnspecified:
4695 case attr::LifetimeBound:
4696 case attr::AddressSpace:
4706bool AttributedType::isMSTypeSpec()
const {
4708 switch (getAttrKind()) {
4717 llvm_unreachable(
"invalid attr kind");
4720bool AttributedType::isWebAssemblyFuncrefSpec()
const {
4721 return getAttrKind() == attr::WebAssemblyFuncref;
4724bool AttributedType::isCallingConv()
const {
4726 switch (getAttrKind()) {
4731 case attr::FastCall:
4733 case attr::ThisCall:
4735 case attr::SwiftCall:
4736 case attr::SwiftAsyncCall:
4737 case attr::VectorCall:
4738 case attr::AArch64VectorPcs:
4739 case attr::AArch64SVEPcs:
4740 case attr::DeviceKernel:
4744 case attr::IntelOclBicc:
4745 case attr::PreserveMost:
4746 case attr::PreserveAll:
4748 case attr::PreserveNone:
4749 case attr::RISCVVectorCC:
4750 case attr::RISCVVLSCC:
4753 llvm_unreachable(
"invalid attr kind");
4757 return isCanonicalUnqualified() ?
nullptr : getDecl()->getIdentifier();
4760SubstTemplateTypeParmType::SubstTemplateTypeParmType(
QualType Replacement,
4761 Decl *AssociatedDecl,
4765 :
Type(SubstTemplateTypeParm, Replacement.getCanonicalType(),
4766 Replacement->getDependence()),
4767 AssociatedDecl(AssociatedDecl) {
4771 *getTrailingObjects() = Replacement;
4777 assert(AssociatedDecl !=
nullptr);
4781SubstTemplateTypeParmType::getReplacedParameter()
const {
4786SubstPackType::SubstPackType(TypeClass Derived,
QualType Canon,
4788 :
Type(Derived, Canon,
4792 assert(llvm::all_of(
4794 [](
auto &P) { return P.getKind() == TemplateArgument::Type; }) &&
4795 "non-type argument to SubstPackType?");
4803void SubstPackType::Profile(llvm::FoldingSetNodeID &ID) {
4804 Profile(ID, getArgumentPack());
4807void SubstPackType::Profile(llvm::FoldingSetNodeID &ID,
4811 ID.AddPointer(P.getAsType().getAsOpaquePtr());
4814SubstTemplateTypeParmPackType::SubstTemplateTypeParmPackType(
4815 QualType Canon,
Decl *AssociatedDecl,
unsigned Index,
bool Final,
4817 : SubstPackType(SubstTemplateTypeParmPack, Canon, ArgPack),
4818 AssociatedDeclAndFinal(AssociatedDecl, Final) {
4819 assert(AssociatedDecl !=
nullptr);
4822 assert(getNumArgs() == ArgPack.
pack_size() &&
4823 "Parent bitfields in SubstPackType were overwritten."
4824 "Check NumSubstPackTypeBits.");
4827Decl *SubstTemplateTypeParmPackType::getAssociatedDecl()
const {
4828 return AssociatedDeclAndFinal.getPointer();
4831bool SubstTemplateTypeParmPackType::getFinal()
const {
4832 return AssociatedDeclAndFinal.getInt();
4836SubstTemplateTypeParmPackType::getReplacedParameter()
const {
4841IdentifierInfo *SubstTemplateTypeParmPackType::getIdentifier()
const {
4842 return getReplacedParameter()->getIdentifier();
4845void SubstTemplateTypeParmPackType::Profile(llvm::FoldingSetNodeID &ID) {
4846 Profile(ID, getAssociatedDecl(),
getIndex(), getFinal(), getArgumentPack());
4849void SubstTemplateTypeParmPackType::Profile(llvm::FoldingSetNodeID &ID,
4850 const Decl *AssociatedDecl,
4851 unsigned Index,
bool Final,
4853 ID.AddPointer(AssociatedDecl);
4854 ID.AddInteger(Index);
4855 ID.AddBoolean(Final);
4856 SubstPackType::Profile(ID, ArgPack);
4859SubstBuiltinTemplatePackType::SubstBuiltinTemplatePackType(
4861 : SubstPackType(SubstBuiltinTemplatePack, Canon, ArgPack) {}
4863bool TemplateSpecializationType::anyDependentTemplateArguments(
4866 return anyDependentTemplateArguments(Args.
arguments(), Converted);
4869bool TemplateSpecializationType::anyDependentTemplateArguments(
4872 if (Arg.isDependent())
4877bool TemplateSpecializationType::anyInstantiationDependentTemplateArguments(
4880 if (ArgLoc.getArgument().isInstantiationDependent())
4889 ? TypeDependence::DependentInstantiation
4894 D |= TypeDependence::UnexpandedPack;
4896 D |= (Underlying->
getDependence() & TypeDependence::UnexpandedPack);
4901TemplateSpecializationType::TemplateSpecializationType(
4905 Underlying.isNull() ?
QualType(this, 0)
4906 : Underlying.getCanonicalType(),
4909 TemplateSpecializationTypeBits.NumArgs = Args.size();
4910 TemplateSpecializationTypeBits.TypeAlias = IsAlias;
4912 auto *TemplateArgs =
4924 ~TypeDependence::Dependent);
4926 addDependence(Arg.getAsType()->getDependence() &
4927 TypeDependence::VariablyModified);
4934 *
reinterpret_cast<QualType *
>(TemplateArgs) = Underlying;
4937QualType TemplateSpecializationType::getAliasedType()
const {
4938 assert(isTypeAlias() &&
"not a type alias template specialization");
4939 return *
reinterpret_cast<const QualType *
>(template_arguments().end());
4942bool clang::TemplateSpecializationType::isSugared()
const {
4943 return !isDependentType() || isCurrentInstantiation() || isTypeAlias() ||
4948void TemplateSpecializationType::Profile(llvm::FoldingSetNodeID &ID,
4950 Profile(ID, getKeyword(),
Template, template_arguments(),
4951 isSugared() ? desugar() :
QualType(), Ctx);
4954void TemplateSpecializationType::Profile(llvm::FoldingSetNodeID &ID,
4960 ID.AddInteger(llvm::to_underlying(
Keyword));
4964 ID.AddInteger(Args.size());
4966 Arg.Profile(ID, Context);
4974 return Context.getQualifiedType(QT, *
this);
4978 const Type *
T)
const {
4982 return Context.getQualifiedType(
T, *
this);
4985void ObjCObjectTypeImpl::Profile(llvm::FoldingSetNodeID &ID,
QualType BaseType,
4989 ID.AddPointer(BaseType.getAsOpaquePtr());
4990 ID.AddInteger(typeArgs.size());
4991 for (
auto typeArg : typeArgs)
4992 ID.AddPointer(typeArg.getAsOpaquePtr());
4993 ID.AddInteger(protocols.size());
4994 for (
auto *proto : protocols)
4995 ID.AddPointer(proto);
4996 ID.AddBoolean(isKindOf);
4999void ObjCObjectTypeImpl::Profile(llvm::FoldingSetNodeID &ID) {
5000 Profile(ID, getBaseType(), getTypeArgsAsWritten(),
5002 isKindOfTypeAsWritten());
5008class CachedProperties {
5013 CachedProperties(
Linkage L,
bool local) : L(L), local(local) {}
5015 Linkage getLinkage()
const {
return L; }
5016 bool hasLocalOrUnnamedType()
const {
return local; }
5018 friend CachedProperties
merge(CachedProperties L, CachedProperties R) {
5020 return CachedProperties(MergedLinkage, L.hasLocalOrUnnamedType() ||
5021 R.hasLocalOrUnnamedType());
5040 return CachedProperties(
T->TypeBits.getLinkage(),
5041 T->TypeBits.hasLocalOrUnnamedType());
5046 if (
T->TypeBits.isCacheValid())
5051 if (!
T->isCanonicalUnqualified()) {
5052 const Type *CT =
T->getCanonicalTypeInternal().getTypePtr();
5054 T->TypeBits.CacheValid =
true;
5055 T->TypeBits.CachedLinkage = CT->
TypeBits.CachedLinkage;
5056 T->TypeBits.CachedLocalOrUnnamed = CT->
TypeBits.CachedLocalOrUnnamed;
5062 T->TypeBits.CacheValid =
true;
5063 T->TypeBits.CachedLinkage = llvm::to_underlying(
Result.getLinkage());
5064 T->TypeBits.CachedLocalOrUnnamed =
Result.hasLocalOrUnnamedType();
5082 switch (
T->getTypeClass()) {
5083#define TYPE(Class, Base)
5084#define NON_CANONICAL_TYPE(Class, Base) case Type::Class:
5085#include "clang/AST/TypeNodes.inc"
5086 llvm_unreachable(
"didn't expect a non-canonical type here");
5088#define TYPE(Class, Base)
5089#define DEPENDENT_TYPE(Class, Base) case Type::Class:
5090#define NON_CANONICAL_UNLESS_DEPENDENT_TYPE(Class, Base) case Type::Class:
5091#include "clang/AST/TypeNodes.inc"
5093 assert(
T->isInstantiationDependentType());
5097 case Type::DeducedTemplateSpecialization:
5111 const auto *Tag =
cast<TagType>(
T)->getDecl()->getDefinitionOrSelf();
5117 Linkage L = Tag->getLinkageInternal();
5118 bool IsLocalOrUnnamed = Tag->getDeclContext()->isFunctionOrMethod() ||
5119 !Tag->hasNameForLinkage();
5120 return CachedProperties(L, IsLocalOrUnnamed);
5130 case Type::BlockPointer:
5132 case Type::LValueReference:
5133 case Type::RValueReference:
5135 case Type::MemberPointer: {
5137 CachedProperties Cls = [&] {
5138 if (MPT->isSugared())
5140 return Cache::get(MPT->getQualifier().getAsType());
5142 return merge(Cls,
Cache::get(MPT->getPointeeType()));
5144 case Type::ConstantArray:
5145 case Type::IncompleteArray:
5146 case Type::VariableArray:
5147 case Type::ArrayParameter:
5150 case Type::ExtVector:
5152 case Type::ConstantMatrix:
5154 case Type::FunctionNoProto:
5156 case Type::FunctionProto: {
5158 CachedProperties result =
Cache::get(FPT->getReturnType());
5159 for (
const auto &ai : FPT->param_types())
5163 case Type::ObjCInterface: {
5165 return CachedProperties(L,
false);
5167 case Type::ObjCObject:
5169 case Type::ObjCObjectPointer:
5175 case Type::HLSLAttributedResource:
5177 case Type::HLSLInlineSpirv:
5179 case Type::OverflowBehavior:
5183 llvm_unreachable(
"unhandled type class");
5194 return TypeBits.hasLocalOrUnnamedType();
5198 switch (
T->getTypeClass()) {
5199#define TYPE(Class, Base)
5200#define NON_CANONICAL_TYPE(Class, Base) case Type::Class:
5201#include "clang/AST/TypeNodes.inc"
5202 llvm_unreachable(
"didn't expect a non-canonical type here");
5204#define TYPE(Class, Base)
5205#define DEPENDENT_TYPE(Class, Base) case Type::Class:
5206#define NON_CANONICAL_UNLESS_DEPENDENT_TYPE(Class, Base) case Type::Class:
5207#include "clang/AST/TypeNodes.inc"
5209 assert(
T->isInstantiationDependentType());
5217 case Type::DeducedTemplateSpecialization:
5229 case Type::BlockPointer:
5231 case Type::LValueReference:
5232 case Type::RValueReference:
5234 case Type::MemberPointer: {
5237 if (
auto *D = MPT->getMostRecentCXXRecordDecl()) {
5245 case Type::ConstantArray:
5246 case Type::IncompleteArray:
5247 case Type::VariableArray:
5248 case Type::ArrayParameter:
5251 case Type::ExtVector:
5253 case Type::ConstantMatrix:
5256 case Type::FunctionNoProto:
5258 case Type::FunctionProto: {
5261 for (
const auto &ai : FPT->param_types())
5265 case Type::ObjCInterface:
5267 case Type::ObjCObject:
5269 case Type::ObjCObjectPointer:
5276 case Type::OverflowBehavior:
5279 case Type::HLSLAttributedResource:
5282 case Type::HLSLInlineSpirv:
5286 llvm_unreachable(
"unhandled type class");
5300 if (!
T->isCanonicalUnqualified())
5314 while (
const auto *AT =
Type->getAs<AttributedType>()) {
5317 if (
auto Nullability = AT->getImmediateNullability())
5320 Type = AT->getEquivalentType();
5322 return std::nullopt;
5328 switch (
type->getTypeClass()) {
5329#define NON_CANONICAL_TYPE(Class, Parent) \
5332 llvm_unreachable("non-canonical type");
5333#define TYPE(Class, Parent)
5334#include "clang/AST/TypeNodes.inc"
5338 case Type::BlockPointer:
5339 case Type::MemberPointer:
5340 case Type::ObjCObjectPointer:
5344 case Type::UnresolvedUsing:
5345 case Type::TypeOfExpr:
5347 case Type::Decltype:
5348 case Type::PackIndexing:
5349 case Type::UnaryTransform:
5350 case Type::TemplateTypeParm:
5351 case Type::SubstTemplateTypeParmPack:
5352 case Type::SubstBuiltinTemplatePack:
5353 case Type::DependentName:
5355 return ResultIfUnknown;
5358 case Type::TemplateSpecialization:
5363 .getAsTemplateDecl())
5364 if (
auto *CTD = dyn_cast<ClassTemplateDecl>(templateDecl))
5365 return llvm::any_of(
5367 return RTD->getTemplatedDecl()->hasAttr<TypeNullableAttr>();
5369 return ResultIfUnknown;
5374#define SIGNED_TYPE(Id, SingletonId) case BuiltinType::Id:
5375#define UNSIGNED_TYPE(Id, SingletonId) case BuiltinType::Id:
5376#define FLOATING_TYPE(Id, SingletonId) case BuiltinType::Id:
5377#define BUILTIN_TYPE(Id, SingletonId)
5378#include "clang/AST/BuiltinTypes.def"
5381 case BuiltinType::UnresolvedTemplate:
5383 case BuiltinType::Dependent:
5384 case BuiltinType::Overload:
5385 case BuiltinType::BoundMember:
5386 case BuiltinType::PseudoObject:
5387 case BuiltinType::UnknownAny:
5388 case BuiltinType::ARCUnbridgedCast:
5389 return ResultIfUnknown;
5391 case BuiltinType::Void:
5392 case BuiltinType::ObjCId:
5393 case BuiltinType::ObjCClass:
5394 case BuiltinType::ObjCSel:
5395#define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \
5396 case BuiltinType::Id:
5397#include "clang/Basic/OpenCLImageTypes.def"
5398#define EXT_OPAQUE_TYPE(ExtType, Id, Ext) case BuiltinType::Id:
5399#include "clang/Basic/OpenCLExtensionTypes.def"
5400 case BuiltinType::OCLSampler:
5401 case BuiltinType::OCLEvent:
5402 case BuiltinType::OCLClkEvent:
5403 case BuiltinType::OCLQueue:
5404 case BuiltinType::OCLReserveID:
5405#define SVE_TYPE(Name, Id, SingletonId) case BuiltinType::Id:
5406#include "clang/Basic/AArch64ACLETypes.def"
5407#define PPC_VECTOR_TYPE(Name, Id, Size) case BuiltinType::Id:
5408#include "clang/Basic/PPCTypes.def"
5409#define RVV_TYPE(Name, Id, SingletonId) case BuiltinType::Id:
5410#include "clang/Basic/RISCVVTypes.def"
5411#define WASM_TYPE(Name, Id, SingletonId) case BuiltinType::Id:
5412#include "clang/Basic/WebAssemblyReferenceTypes.def"
5413#define AMDGPU_TYPE(Name, Id, SingletonId, Width, Align) case BuiltinType::Id:
5414#include "clang/Basic/AMDGPUTypes.def"
5415#define HLSL_INTANGIBLE_TYPE(Name, Id, SingletonId) case BuiltinType::Id:
5416#include "clang/Basic/HLSLIntangibleTypes.def"
5417#define SPIRV_TYPE(Name, Id, SingletonId) case BuiltinType::Id:
5418#include "clang/Basic/SPIRVTypes.def"
5419 case BuiltinType::BuiltinFn:
5420 case BuiltinType::NullPtr:
5421 case BuiltinType::IncompleteMatrixIdx:
5422 case BuiltinType::ArraySection:
5423 case BuiltinType::OMPArrayShaping:
5424 case BuiltinType::OMPIterator:
5427 llvm_unreachable(
"unknown builtin type");
5429 case Type::Record: {
5433 if (
const auto *CTSD = dyn_cast<ClassTemplateSpecializationDecl>(RD))
5434 return llvm::any_of(
5435 CTSD->getSpecializedTemplate()->redecls(),
5437 return RTD->getTemplatedDecl()->hasAttr<TypeNullableAttr>();
5440 return RD->hasAttr<TypeNullableAttr>();
5446 case Type::LValueReference:
5447 case Type::RValueReference:
5448 case Type::ConstantArray:
5449 case Type::IncompleteArray:
5450 case Type::VariableArray:
5451 case Type::DependentSizedArray:
5452 case Type::DependentVector:
5453 case Type::DependentSizedExtVector:
5455 case Type::ExtVector:
5456 case Type::ConstantMatrix:
5457 case Type::DependentSizedMatrix:
5458 case Type::DependentAddressSpace:
5459 case Type::FunctionProto:
5460 case Type::FunctionNoProto:
5461 case Type::DeducedTemplateSpecialization:
5463 case Type::InjectedClassName:
5464 case Type::PackExpansion:
5465 case Type::ObjCObject:
5466 case Type::ObjCInterface:
5470 case Type::DependentBitInt:
5471 case Type::ArrayParameter:
5472 case Type::HLSLAttributedResource:
5473 case Type::HLSLInlineSpirv:
5474 case Type::OverflowBehavior:
5477 llvm_unreachable(
"bad type kind!");
5481 if (getAttrKind() == attr::TypeNonNull)
5483 if (getAttrKind() == attr::TypeNullable)
5485 if (getAttrKind() == attr::TypeNullUnspecified)
5487 if (getAttrKind() == attr::TypeNullableResult)
5489 return std::nullopt;
5494 if (
auto MacroTy = dyn_cast<MacroQualifiedType>(
T))
5495 AttrTy = MacroTy->getUnderlyingType();
5497 if (
auto attributed = dyn_cast<AttributedType>(AttrTy)) {
5498 if (
auto nullability = attributed->getImmediateNullability()) {
5499 T = attributed->getModifiedType();
5504 return std::nullopt;
5507void AttributedType::Profile(llvm::FoldingSetNodeID &ID,
const ASTContext &Ctx,
5510 ID.AddInteger(attrKind);
5514 attr->Profile(ID, Ctx);
5528 if (objcPtr->isObjCIdType()) {
5539 }
else if (objcPtr->isObjCQualifiedIdType()) {
5564 "cannot query implicit lifetime for non-inferrable type");
5569 while (
const auto *array = dyn_cast<ArrayType>(canon))
5570 canon = array->getElementType().getTypePtr();
5572 if (
const auto *
opt = dyn_cast<ObjCObjectPointerType>(canon)) {
5574 if (
opt->getObjectType()->isObjCClass())
5583 return typedefType->getDecl()->hasAttr<ObjCNSObjectAttr>();
5589 return typedefType->getDecl()->hasAttr<ObjCIndependentClassAttr>();
5602 return OPT->getPointeeType()->isObjCIndirectLifetimeType();
5604 return Ref->getPointeeType()->isObjCIndirectLifetimeType();
5606 return MemPtr->getPointeeType()->isObjCIndirectLifetimeType();
5614 while (
const ArrayType *array =
type->getAsArrayTypeUnsafe())
5615 type = array->getElementType().getTypePtr();
5616 return type->isObjCRetainableType();
5638 return RT->getDecl()
5639 ->getMostRecentDecl()
5640 ->hasAttr<CUDADeviceBuiltinSurfaceTypeAttr>();
5647 return RT->getDecl()
5648 ->getMostRecentDecl()
5649 ->hasAttr<CUDADeviceBuiltinTextureTypeAttr>();
5661 if (
const auto *BT = dyn_cast<BuiltinType>(Ty))
5662 return BT->getKind() == BuiltinType::AMDGPUNamedWorkgroupBarrier;
5663 if (AllowWrappers) {
5664 if (
const auto *RT = dyn_cast<RecordType>(Ty))
5665 return RT->getDecl()->hasAttr<AMDGPUNamedBarrierWrapperAttr>();
5683 return ptr->getPointeeType()->hasSizedVLAType();
5685 return ref->getPointeeType()->hasSizedVLAType();
5691 return arr->getElementType()->hasSizedVLAType();
5698 return HLSLAttributedResourceType::findHandleTypeOnResource(
this) !=
nullptr;
5721 const RecordType *RT =
5727 assert(RD !=
nullptr &&
5728 "all HLSL structs and classes should be CXXRecordDecl");
5735 if (
const auto *RD =
5737 if (!RD->isHLSLBuiltinRecord() && RD->isStandardLayout())
5744 switch (
type.getObjCLifetime()) {
5756 if (
const auto *RD =
type->getBaseElementTypeUnsafe()->getAsRecordDecl()) {
5757 if (
const auto *CXXRD = dyn_cast<CXXRecordDecl>(RD)) {
5759 if (CXXRD->hasDefinition() && !CXXRD->hasTrivialDestructor())
5774 llvm::SmallPtrSetImpl<const Decl *> &Seen) {
5775 if (
const auto *Arr = Context.getAsArrayType(Ty))
5776 Ty = Context.getBaseElementType(Arr);
5778 if (
const auto *AttrTy = Ty->
getAs<AttributedType>())
5779 Ty = AttrTy->getModifiedType();
5782 "Incomplete types cannot be evaluated for laundering");
5789 if (!Seen.insert(
Record).second)
5792 if (
Record->isDynamicClass())
5818 Qualifier.Profile(ID);
5830 auto *RD = getCXXRecordDecl();
5837 llvm::APSInt Val,
unsigned Scale) {
5838 llvm::FixedPointSemantics FXSema(Val.getBitWidth(), Scale, Val.isSigned(),
5841 llvm::APFixedPoint(Val, FXSema).toString(Str);
5844DeducedType::DeducedType(TypeClass TC,
DeducedKind DK,
5847 ? DeducedAsTypeOrCanon.getCanonicalType()
5848 : DeducedAsTypeOrCanon,
5850 DeducedTypeBits.Kind = llvm::to_underlying(DK);
5855 assert(!DeducedAsTypeOrCanon.
isNull() &&
"Deduced type cannot be null");
5857 ~TypeDependence::VariablyModified);
5858 DeducedAsType = DeducedAsTypeOrCanon;
5861 addDependence(TypeDependence::UnexpandedPack);
5864 addDependence(TypeDependence::DependentInstantiation);
5867 assert(getDeducedKind() == DK &&
"DeducedKind does not match the type state");
5873 : DeducedType(
Auto, DK, DeducedAsTypeOrCanon) {
5874 AutoTypeBits.Keyword = llvm::to_underlying(
Keyword);
5875 AutoTypeBits.NumArgs = TypeConstraintArgs.size();
5876 this->TypeConstraintConcept = TypeConstraintConcept;
5877 assert(!TypeConstraintConcept.
isNull() || AutoTypeBits.NumArgs == 0);
5878 if (!TypeConstraintConcept.
isNull()) {
5880 "type-constraint does not name a concept");
5897void AutoType::Profile(llvm::FoldingSetNodeID &ID,
const ASTContext &Context,
5901 DeducedType::Profile(ID, DK,
Deduced);
5902 ID.AddInteger(llvm::to_underlying(
Keyword));
5905 Arg.Profile(ID, Context);
5908void AutoType::Profile(llvm::FoldingSetNodeID &ID,
const ASTContext &Context) {
5909 Profile(ID, Context, getDeducedKind(), getDeducedType(), getKeyword(),
5910 getTypeConstraintConcept(), getTypeConstraintArguments());
5924 llvm_unreachable(
"unknown effect kind");
5930 return "nonblocking";
5932 return "nonallocating";
5936 return "allocating";
5938 llvm_unreachable(
"unknown effect kind");
5954 return std::nullopt;
5959 assert(0 &&
"effectProhibitingInference with non-inferable effect kind");
5962 llvm_unreachable(
"unknown effect kind");
5972 const Kind EK = Effect.kind();
5974 if (EK == CallerKind ||
5985 llvm_unreachable(
"unknown effect kind");
5997 unsigned InsertIdx = Effects.size();
6012 Errs.push_back({EC, NewEC});
6023 if (NewCondition || !Conditions.empty()) {
6024 if (Conditions.empty() && !Effects.empty())
6025 Conditions.resize(Effects.size());
6026 Conditions.insert(Conditions.begin() + InsertIdx,
6029 Effects.insert(Effects.begin() + InsertIdx, NewEC.
Effect);
6034 for (
const auto &Item :
Set)
6036 return Errs.empty();
6047 auto IterA = LHS.
begin(), EndA = LHS.
end();
6048 auto IterB = RHS.
begin(), EndB = RHS.
end();
6052 return std::tuple(LHS.Effect,
uintptr_t(LHS.Cond.getCondition())) <
6053 std::tuple(RHS.Effect,
uintptr_t(RHS.Cond.getCondition()));
6056 while (IterA != EndA && IterB != EndB) {
6061 else if (FEWCLess(B, A))
6072 assert(Errs.empty() &&
"conflict shouldn't be possible in getIntersection");
6085 Combined.
insert(RHS, Errs);
6106 llvm::interleaveComma(*
this, OS);
6116 llvm::interleaveComma(*
this, OS);
6123 assert(llvm::is_sorted(FX) &&
"effects should be sorted");
6124 assert((Conds.empty() || Conds.size() == FX.size()) &&
6125 "effects size should match conditions size");
6131 if (
Cond.getCondition() !=
nullptr)
6137HLSLAttributedResourceType::computeDependence(
QualType Contained,
6138 const Attributes &Attrs) {
6142 if (Attrs.SampleCountExpr)
6147HLSLAttributedResourceType::HLSLAttributedResourceType(
QualType Wrapped,
6149 const Attributes &Attrs)
6152 WrappedType(Wrapped), ContainedType(Contained), Attrs(Attrs) {}
6154void HLSLAttributedResourceType::Profile(llvm::FoldingSetNodeID &ID,
6157 const Attributes &Attrs) {
6160 ID.AddInteger(
static_cast<uint32_t>(Attrs.ResourceClass));
6161 ID.AddInteger(
static_cast<uint32_t>(Attrs.ResourceDimension));
6162 ID.AddBoolean(Attrs.IsROV);
6163 ID.AddBoolean(Attrs.RawBuffer);
6164 ID.AddBoolean(Attrs.IsCounter);
6165 ID.AddBoolean(Attrs.IsArray);
6166 ID.AddBoolean(Attrs.SampleCountExpr !=
nullptr);
6167 if (Attrs.SampleCountExpr)
6168 Attrs.SampleCountExpr->Profile(ID, Ctx,
true);
6171const HLSLAttributedResourceType *
6172HLSLAttributedResourceType::findHandleTypeOnResource(
const Type *RT) {
6177 if (!RD->
fields().empty()) {
6178 const auto &FirstFD = RD->
fields().begin();
6179 return dyn_cast<HLSLAttributedResourceType>(
6180 FirstFD->getType().getTypePtr());
6186StringRef PredefinedSugarType::getName(Kind KD) {
6191 return "__signed_size_t";
6193 return "__ptrdiff_t";
6195 llvm_unreachable(
"unexpected kind");
Defines the clang::ASTContext interface.
Provides definitions for the various language-specific address spaces.
static std::optional< NonLoc > getIndex(ProgramStateRef State, const ElementRegion *ER, CharKind CK)
static Decl::Kind getKind(const Decl *D)
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.
#define CC_VLS_CASE(ABI_VLEN)
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified.
Defines the clang::LangOptions interface.
llvm::MachO::Record Record
static QualType getUnderlyingType(const SubRegion *R)
static RecordDecl * getAsRecordDecl(QualType BaseType, HeuristicResolver &Resolver)
static bool isRecordType(QualType T)
Defines various enumerations that describe declaration and type specifiers.
static QualType getPointeeType(const MemRegion *R)
Defines the TargetCXXABI class, which abstracts details of the C++ ABI that we're targeting.
static TypeDependence getTemplateSpecializationTypeDependence(QualType Underlying, TemplateName T)
#define ENUMERATE_ATTRS(PREFIX)
#define SUGARED_TYPE_CLASS(Class)
static ArrayRef< TypeCoupledDeclRefInfo > allocateCoupledDecls(const ASTContext &Ctx, ArrayRef< TypeCoupledDeclRefInfo > Decls)
Copy Decls into Ctx so a CountAttributedType can retain it by reference.
static MemoryRegion getMemoryRegion(LangAS AS)
static bool isConvertibleOpenCLSYCLAddressSpace(LangAS To, LangAS From)
static bool isAMDGPUNamedBarrierTypeImpl(const Type *Ty, bool AllowWrappers)
static bool requiresBuiltinLaunderImpl(const ASTContext &Context, QualType Ty, llvm::SmallPtrSetImpl< const Decl * > &Seen)
TypePropertyCache< Private > Cache
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 getConstantMatrixType(QualType ElementType, unsigned NumRows, unsigned NumColumns, std::optional< MatrixType::LayoutKind > Layout=std::nullopt) const
Return the unique reference to the matrix type of the specified element type and size.
QualType getObjCInterfaceType(const ObjCInterfaceDecl *Decl, ObjCInterfaceDecl *PrevDecl=nullptr) const
getObjCInterfaceType - Return the unique reference to the type for the specified ObjC interface decl.
QualType getAutoType(DeducedKind DK, QualType DeducedAsType, AutoTypeKeyword Keyword, TemplateName TypeConstraintConcept=TemplateName(), ArrayRef< TemplateArgument > TypeConstraintArgs={}) const
C++11 deduced auto type.
QualType getBlockPointerType(QualType T) const
Return the uniqued reference to the type for a block of the specified type.
QualType getAttributedType(attr::Kind attrKind, QualType modifiedType, QualType equivalentType, const Attr *attr=nullptr) const
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 getSubstTemplateTypeParmType(QualType Replacement, Decl *AssociatedDecl, unsigned Index, UnsignedOrNone PackIndex, bool Final) const
Retrieve a substitution-result type.
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.
QualType getBaseElementType(const ArrayType *VAT) const
Return the innermost element type of an array type.
CanQualType ObjCBuiltinIdTy
IdentifierInfo * getNSObjectName() const
Retrieve the identifier 'NSObject'.
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.
QualType getVariableArrayType(QualType EltTy, Expr *NumElts, ArraySizeModifier ASM, unsigned IndexTypeQuals) const
Return a non-unique reference to the type for a variable array of the specified element type.
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.
CanQualType UnsignedCharTy
void * Allocate(size_t Size, unsigned Align=8) const
TemplateName getQualifiedTemplateName(NestedNameSpecifier Qualifier, bool TemplateKeyword, TemplateName Template) const
Retrieve the template name that represents a qualified template name such as std::vector.
QualType getFunctionType(QualType ResultTy, ArrayRef< QualType > Args, const FunctionProtoType::ExtProtoInfo &EPI) const
Return a normal function type with a typed argument list.
QualType getMemberPointerType(QualType T, NestedNameSpecifier Qualifier, const CXXRecordDecl *Cls) const
Return the uniqued reference to the type for a member pointer to the specified type in the specified ...
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 getOverflowBehaviorType(const OverflowBehaviorAttr *Attr, QualType Wrapped) const
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.
IdentifierInfo * getNSCopyingName()
Retrieve the identifier 'NSCopying'.
QualType getConstantArrayType(const ASTContext &Ctx) const
Represents an array type, per C99 6.7.5.2 - Array Declarators.
ArraySizeModifier getSizeModifier() const
Qualifiers getIndexTypeQualifiers() const
QualType getElementType() const
ArrayType(TypeClass tc, QualType et, QualType can, ArraySizeModifier sm, unsigned tq, const Expr *sz=nullptr)
Attr - This represents one attribute.
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 C++ struct/union/class.
bool isHLSLIntangible() const
Returns true if the class contains HLSL intangible type, either as a field or in base class.
bool mayBeNonDynamicClass() const
bool mayBeDynamicClass() const
CXXRecordDecl * getCanonicalDecl() override
Retrieves the "canonical" declaration of the given declaration.
Declaration of a class template.
Complex values, per C99 6.2.5p11.
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...
const Expr * getSizeExpr() const
Return a pointer to the size expression.
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
std::optional< LayoutKind > Layout
unsigned NumRows
Number of rows and columns.
ConstantMatrixType(QualType MatrixElementType, unsigned NRows, unsigned NColumns, QualType CanonElementType, std::optional< LayoutKind > Layout)
Represents a sugar type with __counted_by or __sized_by annotations, including their _or_null variant...
void Profile(llvm::FoldingSetNodeID &ID)
StringRef getAttributeName(bool WithMacroPrefix) const
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
ASTContext & getParentASTContext() const
Decl - This represents one declaration (or definition), e.g.
bool isInStdNamespace() const
ASTContext & getASTContext() const LLVM_READONLY
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)
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)
Expr * getCondition() const
This represents one expression.
bool isValueDependent() const
Determines whether the value 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
Represents a member of a struct/union/class.
A mutable set of FunctionEffect::Kind.
void dump(llvm::raw_ostream &OS) const
FunctionEffectSet()=default
bool insert(const FunctionEffectWithCondition &NewEC, Conflicts &Errs)
SmallVector< Conflict > Conflicts
static FunctionEffectSet getIntersection(FunctionEffectsRef LHS, FunctionEffectsRef RHS)
void dump(llvm::raw_ostream &OS) const
static FunctionEffectSet getUnion(FunctionEffectsRef LHS, FunctionEffectsRef RHS, Conflicts &Errs)
Kind kind() const
The kind of the effect.
Kind
Identifies the particular effect.
bool shouldDiagnoseFunctionCall(bool Direct, FunctionEffectKindSet CalleeFX) const
StringRef name() const
The description printed in diagnostics, e.g. 'nonblocking'.
Kind oppositeKind() const
Return the opposite kind, for effects which have opposites.
std::optional< FunctionEffect > effectProhibitingInference(const Decl &Callee, FunctionEffectKindSet CalleeFX) const
Determine whether the effect is allowed to be inferred on the callee, which is either a FunctionDecl ...
An immutable set of FunctionEffects and possibly conditions attached to them.
void dump(llvm::raw_ostream &OS) const
ArrayRef< FunctionEffect > effects() const
ArrayRef< EffectConditionExpr > conditions() const
static FunctionEffectsRef create(ArrayRef< FunctionEffect > FX, ArrayRef< EffectConditionExpr > Conds)
Asserts invariants.
FunctionEffectsRef()=default
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.
ExtInfo getExtInfo() const
static StringRef getNameForCallConv(CallingConv CC)
bool getCFIUncheckedCalleeAttr() const
Determine whether this is a function prototype that includes the cfi_unchecked_callee attribute.
QualType getReturnType() const
FunctionType(TypeClass tc, QualType res, QualType Canonical, TypeDependence Dependence, ExtInfo Info)
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.
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.
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)
NestedNameSpecifier getQualifier() const
void Profile(llvm::FoldingSetNodeID &ID)
CXXRecordDecl * getMostRecentCXXRecordDecl() const
Note: this can trigger extra deserialization when external AST sources are used.
This represents a decl that may have a name.
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>::".
CXXRecordDecl * getAsRecordDecl() const
Retrieve the record declaration stored in this nested name specifier, or null.
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 * getCanonicalDecl() override
Retrieves the canonical declaration of this Objective-C class.
ObjCInterfaceDecl * getDefinition()
Retrieve the definition of this class, or NULL if this class has been forward-declared (with @class) ...
Represents typeof(type), a C23 feature and GCC extension, or `typeof_unqual(type),...
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.
Represents an Objective-C protocol declaration.
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.
A (possibly-)qualified type.
bool hasAddressDiscriminatedPointerAuth() const
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.
bool isBitwiseCloneableType(const ASTContext &Context) const
Return true if the type is safe to bitwise copy using memcpy/memmove.
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 ...
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...
bool hasPostfixDeclaratorSyntax() const
Returns true if the type uses postfix declarator syntax, i.e.
Qualifiers::ObjCLifetime getObjCLifetime() const
Returns lifetime attribute of this type.
QualType stripObjCKindOfType(const ASTContext &ctx) const
Strip Objective-C "__kindof" types from the given type.
QualType getCanonicalType() const
QualType getUnqualifiedType() const
Retrieve the unqualified variant of the given type, removing as little sugar as possible.
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.
bool isTrapType() const
Returns true if it is a OverflowBehaviorType of Trap kind.
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
QualType stripNullability(const ASTContext &ctx) const
Strip nullability attributes from the given type.
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.
SplitQualType getSplitUnqualifiedType() const
Retrieve the unqualified variant of the given type, removing as little sugar as possible.
bool isCXX11PODType(const ASTContext &Context) const
Return true if this is a POD type according to the more relaxed rules of the C++11 standard,...
bool mayBeNotDynamicClass() const
Returns true if it is not a class or if the class might not be dynamic.
bool isConstQualified() const
Determine whether this type is const-qualified.
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.
bool requiresBuiltinLaunder(const ASTContext &Context) const
Returns true if this type requires laundering by checking if it is a dynamic class type,...
bool isWrapType() const
Returns true if it is a OverflowBehaviorType of Wrap kind.
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_PtrAuth
The type is an address-discriminated signed pointer type.
@ PCK_ARCWeak
The type is an Objective-C retainable pointer type that is qualified with the ARC __weak qualifier.
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.
static bool isTargetAddressSpaceSupersetOf(LangAS A, LangAS B, const ASTContext &Ctx)
bool hasAddressSpace() const
unsigned getFastQualifiers() const
bool hasObjCGCAttr() const
bool hasObjCLifetime() const
ObjCLifetime getObjCLifetime() const
LangAS getAddressSpace() const
Represents a struct/union/class.
bool hasNonTrivialToPrimitiveDestructCUnion() const
bool hasNonTrivialToPrimitiveCopyCUnion() const
bool hasNonTrivialToPrimitiveDefaultInitializeCUnion() const
bool isNonTrivialToPrimitiveDestroy() const
bool isNonTrivialToPrimitiveCopy() const
field_range fields() const
RecordDecl * getMostRecentDecl()
bool isNonTrivialToPrimitiveDefaultInitialize() const
Functions to query basic properties of non-trivial C structs.
Declaration of a redeclarable template.
Encodes a location in the source.
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.
void dump() const
Dumps the specified AST fragment and all subtrees to llvm::errs().
Represents the declaration of a struct/union/class/enum.
redecl_range redecls() const
Returns an iterator range for all the redeclarations of the same decl.
bool isCompleteDefinition() const
Return true if this decl has its body fully specified.
NestedNameSpecifier getQualifier() const
Retrieve the nested-name-specifier that qualifies the name of this declaration, if it was present in ...
bool isDependentType() const
Whether this declaration declares a type that is dependent, i.e., a type that somehow depends on temp...
Exposes information about the current target.
virtual bool hasFullBFloat16Type() const
Determine whether the BFloat type is fully supported on this target, i.e arithemtic operations.
virtual bool hasFastHalfType() const
Determine whether the target has fast native support for operations on half types.
virtual bool hasFloat16Type() const
Determine whether the _Float16 type is supported on this target.
virtual bool hasBFloat16Type() const
Determine whether the _BFloat16 type is supported on this target.
virtual bool isAddressSpaceSupersetOf(LangAS A, LangAS B) const
Returns true if an address space can be safely converted to another.
A convenient class for passing around template argument information.
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.
TemplateNameDependence getDependence() const
bool isNull() const
Determine whether this template name is NULL.
bool isConceptName() const
Determines whether this template name denotes a concept, or a template template parameter denoting on...
void Profile(llvm::FoldingSetNodeID &ID)
Declaration of a template type parameter.
[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)
bool isSugared() const
Returns whether this type directly provides sugar.
TypeOfKind getKind() const
Returns the kind of 'typeof' type this is.
TypeOfExprType(const ASTContext &Context, Expr *E, TypeOfKind Kind, QualType Can=QualType())
Expr * getUnderlyingExpr() const
QualType 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.
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
bool isBlockPointerType() const
const ObjCObjectPointerType * getAsObjCQualifiedClassType() const
bool isLinkageValid() const
True if the computed linkage is valid.
TypedefBitfields TypedefBits
bool isBooleanType() const
const ObjCObjectType * getAsObjCQualifiedInterfaceType() const
const ObjCObjectPointerType * getAsObjCQualifiedIdType() const
const TemplateSpecializationType * getAsNonAliasTemplateSpecializationType() const
Look through sugar for an instance of TemplateSpecializationType which is not a type alias,...
bool isMFloat8Type() const
bool isSignedIntegerOrEnumerationType() const
Determines whether this is an integer type that is signed or an enumeration types whose underlying ty...
bool isPackedVectorBoolType(const ASTContext &ctx) const
bool hasAttr(attr::Kind AK) const
Determine whether this type had the specified attribute applied to it (looking through top-level type...
bool isAlwaysIncompleteType() const
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.
CXXRecordDecl * getAsCXXRecordDecl() const
Retrieves the CXXRecordDecl that this type refers to, either because the type is a RecordType or beca...
VectorTypeBitfields VectorTypeBits
SubstPackTypeBitfields SubstPackTypeBits
RecordDecl * getAsRecordDecl() const
Retrieves the RecordDecl this type refers to.
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 ...
CXXRecordDecl * castAsCXXRecordDecl() const
bool isArithmeticType() const
bool isConstantMatrixType() const
bool isHLSLBuiltinIntangibleType() 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 isHLSLIntangibleType() const
bool isEnumeralType() const
void addDependence(TypeDependence D)
bool isObjCNSObjectType() const
Type(TypeClass tc, QualType canon, TypeDependence Dependence)
const ObjCObjectPointerType * getAsObjCInterfacePointerType() const
NestedNameSpecifier getPrefix() const
If this type represents a qualified-id, this returns its nested name specifier.
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 isAMDGPUNamedBarrierTypeOrWrapper() const
Check if the type is the AMDGPU named barrier type/a RecordType of a named barrier wrapper,...
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 isExtVectorBoolType() const
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 isBuiltinType() const
Helper methods to distinguish type categories.
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 isSignableIntegerType(const ASTContext &Ctx) const
RecordDecl * castAsRecordDecl() const
bool isChar16Type() const
bool isAnyComplexType() const
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,...
@ PtrdiffT
The "ptrdiff_t" type.
@ SizeT
The "size_t" type.
@ SignedSizeT
The signed integer type corresponding to "size_t".
const Type * getBaseElementTypeUnsafe() const
Get the base element type of this type, potentially discarding type qualifiers.
bool isHLSLStandardLayoutRecordOrArrayOf() const
AttributedTypeBitfields AttributedTypeBits
bool isObjCBoxableRecordType() const
bool isMatrixType() const
bool isChar32Type() const
bool isStandardLayoutType() const
Test if this type is a standard-layout type.
TagTypeBitfields TagTypeBits
bool isOverflowBehaviorType() const
EnumDecl * castAsEnumDecl() const
bool isVariablyModifiedType() const
Whether this type is a variably-modified type (C99 6.7.5).
bool isComplexIntegerType() const
bool isUnscopedEnumerationType() const
bool isStdByteType() const
UnresolvedUsingBitfields UnresolvedUsingBits
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 isHLSLResourceRecord() const
EnumDecl * getAsEnumDecl() const
Retrieves the EnumDecl this type refers to.
bool isObjCIndirectLifetimeType() const
bool hasUnnamedOrLocalType() const
Whether this type is or contains a local or unnamed type.
bool isPointerOrReferenceType() const
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
SubstTemplateTypeParmTypeBitfields SubstTemplateTypeParmTypeBits
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 isAMDGPUNamedBarrierType() const
Check if the type is the AMDGPU named barrier type, or an array thereof.
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...
const T * getAsCanonical() const
If this type is canonically the specified type, return its canonical type cast to that specified type...
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>'.
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
bool isHLSLResourceRecordArray() const
bool isObjCRetainableType() const
bool isObjCIndependentClassType() const
bool isSizelessVectorType() const
Returns true for all scalable vector types.
bool isScopedEnumeralType() const
Determine whether this type is a scoped enumeration type.
NullabilityKindOrNone getNullability() const
Determine the nullability of the given 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.
bool isUnicodeCharacterType() const
bool hasBooleanRepresentation() const
Determine whether this type has a boolean representation – i.e., it is a boolean type,...
Base class for declarations which introduce a typedef-name.
QualType getUnderlyingType() const
bool typeMatchesDecl() const
Represents a dependent using declaration which was marked with typename.
Represents a shadow declaration implicitly introduced into a scope by a (resolved) using-declaration ...
Represent the declaration of a variable (in which case it is an lvalue) a function (in which case it ...
Represents a GCC generic vector type.
VectorType(QualType vecType, unsigned nElements, QualType canonType, VectorKind vecKind)
QualType ElementType
The element type of the vector.
QualType getElementType() const
Defines the Linkage enumeration and various utility functions.
Defines the clang::TargetInfo interface.
mlir::Type getBaseType(mlir::Value varPtr)
@ AttributedType
The l-value was considered opaque, so the alignment was determined from a type, but that type was an ...
const internal::VariadicAllOfMatcher< Attr > attr
const internal::VariadicAllOfMatcher< Type > type
Matches Types in the clang AST.
const internal::VariadicAllOfMatcher< Decl > decl
Matches declarations.
const AstTypeMatcher< TypedefType > typedefType
void info(bool Verbose, unsigned Level, const char *Fmt, Ts &&...Args)
Prints an indented note to stderr when Verbose is set.
Top level wrappers for InstallAPI frontend operations.
@ Overload
This is a legitimate overload: the existing declarations are functions or function templates with dif...
bool isa(CodeGen::Address addr)
if(T->getSizeExpr()) TRY_TO(TraverseStmt(const_cast< Expr * >(T -> getSizeExpr())))
AutoTypeKeyword
Which keyword(s) were used to create an AutoType.
QualType pointeeType(QualType T)
CanThrowResult
Possible results from evaluation of a noexcept expression.
TypeDependenceScope::TypeDependence TypeDependence
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.
@ TemplateName
The identifier is a template name. FIXME: Add an annotation for that.
bool IsEnumDeclComplete(EnumDecl *ED)
Check if the given decl is complete.
bool isPackProducingBuiltinTemplateName(TemplateName N)
ExprDependence computeDependence(FullExpr *E)
@ Private
'private' clause, allowed on 'parallel', 'serial', 'loop', 'parallel loop', and 'serial loop' constru...
@ Vector
'vector' clause, allowed on 'loop', Combined, and 'routine' directives.
TypeOfKind
The kind of 'typeof' expression we're after.
nullptr
This class represents a compute construct, representing a 'Kind' of ‘parallel’, 'serial',...
TypeDependence toTypeDependence(ExprDependence D)
ExprDependence turnValueToTypeDependence(ExprDependence D)
@ Dependent
Parse the block as a dependent block, which may be used in some template instantiations but not other...
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.
OptionalUnsigned< unsigned > UnsignedOrNone
const FunctionProtoType * T
bool isComputedNoexcept(ExceptionSpecificationType ESpecType)
@ Template
We are parsing a template declaration.
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.
@ Keyword
The name has been typo-corrected to a keyword.
@ Type
The name was classified as a type.
LangAS
Defines the address space values used by the address space qualifier of QualType.
void FixedPointValueToString(SmallVectorImpl< char > &Str, llvm::APSInt Val, unsigned Scale)
@ Deduced
The normal deduced case.
@ Undeduced
Not deduced yet. This is for example an 'auto' which was just parsed.
@ DeducedAsPack
Same as above, but additionally this represents a case where the deduced entity itself is a pack.
@ DeducedAsDependent
This is a special case where the initializer is dependent, so we can't deduce a type yet.
std::tuple< NamedDecl *, TemplateArgument > getReplacedTemplateParameter(Decl *D, unsigned Index)
Internal helper used by Subst* nodes to retrieve a parameter from the AssociatedDecl,...
bool isPtrSizeAddressSpace(LangAS AS)
const StreamingDiagnostic & operator<<(const StreamingDiagnostic &DB, const ConceptReference *C)
Insertion operator for diagnostics.
CallingConv
CallingConv - Specifies the calling convention that a function uses.
@ Generic
not a target-specific vector type
U cast(CodeGen::Address addr)
@ None
The alignment was not explicit in code.
@ PackIndex
Index of a pack indexing expression or specifier.
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)
OptionalUnsigned< NullabilityKind > NullabilityKindOrNone
__UINTPTR_TYPE__ uintptr_t
An unsigned integer type with the property that any valid pointer to void can be converted to this ty...
__builtin_elementwise_add_sat __builtin_elementwise_sub_sat uint32_t __packed_splat4 __packed_splat2 __packed_splat8 __packed_splat4 __packed_splat2 __packed_splat4 __packed_splat2 __packed_splat8 __packed_splat4 uint32_t
A FunctionEffect plus a potential boolean expression determining whether the effect is declared (e....
FunctionEffectWithCondition(FunctionEffect E, const EffectConditionExpr &C)
std::string description() const
Return a textual description of the effect, and its condition, if any.
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
FunctionTypeExtraAttributeInfo ExtraAttributeInfo
bool requiresFunctionProtoTypeArmAttributes() const
unsigned AArch64SMEAttributes
SourceLocation EllipsisLoc
FunctionEffectsRef FunctionEffects
unsigned CFIUncheckedCallee
const ExtParameterInfo * ExtParameterInfos
RefQualifierKind RefQualifier
bool requiresFunctionProtoTypeExtraAttributeInfo() const
unsigned HasTrailingReturn
bool requiresFunctionProtoTypeExtraBitfields() const
static StringRef getKeywordName(ElaboratedTypeKeyword Keyword)
static ElaboratedTypeKeyword getKeywordForTagTypeKind(TagTypeKind Tag)
Converts a TagTypeKind into an elaborated type keyword.
static TagTypeKind getTagTypeKindForKeyword(ElaboratedTypeKeyword Keyword)
Converts an elaborated type keyword into a TagTypeKind.
static TagTypeKind getTagTypeKindForTypeSpec(unsigned TypeSpec)
Converts a type specifier (DeclSpec::TST) into a tag type kind.
static bool KeywordIsTagTypeKind(ElaboratedTypeKeyword Keyword)
static ElaboratedTypeKeyword getKeywordForTypeSpec(unsigned TypeSpec)
Converts a type specifier (DeclSpec::TST) into an elaborated type keyword.
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.