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
314 "only CVR index qualifiers are stored");
321 const llvm::APInt &Sz,
const Expr *SzExpr,
323 bool NeedsExternalSize = SzExpr !=
nullptr || Sz.ugt(0x0FFFFFFFFFFFFFFF) ||
324 Sz.getBitWidth() > 0xFF;
325 if (!NeedsExternalSize)
327 ET, Can, Sz.getBitWidth(), Sz.getZExtValue(), SzMod, Qual);
329 auto *SzPtr =
new (Ctx,
alignof(ConstantArrayType::ExternalSize))
330 ConstantArrayType::ExternalSize(Sz, SzExpr);
338 const llvm::APInt &NumElements) {
339 uint64_t ElementSize = Context.getTypeSizeInChars(ElementType).getQuantity();
347 if (llvm::isPowerOf2_64(ElementSize)) {
348 return NumElements.getActiveBits() + llvm::Log2_64(ElementSize);
353 if ((ElementSize >> 32) == 0 && NumElements.getBitWidth() <= 64 &&
354 (NumElements.getZExtValue() >> 32) == 0) {
355 uint64_t TotalSize = NumElements.getZExtValue() * ElementSize;
356 return llvm::bit_width(TotalSize);
360 llvm::APSInt SizeExtended(NumElements,
true);
361 unsigned SizeTypeBits = Context.getTypeSize(Context.getSizeType());
362 SizeExtended = SizeExtended.extend(
363 std::max(SizeTypeBits, SizeExtended.getBitWidth()) * 2);
365 llvm::APSInt TotalSize(llvm::APInt(SizeExtended.getBitWidth(), ElementSize));
366 TotalSize *= SizeExtended;
368 return TotalSize.getActiveBits();
377 unsigned Bits = Context.getTypeSize(Context.getSizeType());
390 uint64_t ArraySize,
const Expr *SizeExpr,
393 ID.AddInteger(ArraySize);
394 ID.AddInteger(llvm::to_underlying(SizeMod));
395 ID.AddInteger(TypeQuals);
396 ID.AddBoolean(SizeExpr !=
nullptr);
398 SizeExpr->
Profile(ID, Context,
true);
410 :
ArrayType(DependentSizedArray, et, can, sm, tq, e), SizeExpr((
Stmt *)e) {}
415 unsigned TypeQuals,
Expr *E) {
417 ID.AddInteger(llvm::to_underlying(SizeMod));
418 ID.AddInteger(TypeQuals);
423DependentVectorType::DependentVectorType(
QualType ElementType,
426 :
Type(DependentVector, CanonType,
428 ElementType->getDependence() |
431 ElementType(ElementType), SizeExpr(SizeExpr), Loc(Loc) {
439 ID.AddPointer(ElementType.getAsOpaquePtr());
440 ID.AddInteger(llvm::to_underlying(VecKind));
441 SizeExpr->Profile(ID, Context,
true);
444DependentSizedExtVectorType::DependentSizedExtVectorType(
QualType ElementType,
448 :
Type(DependentSizedExtVector, can,
450 ElementType->getDependence() |
453 SizeExpr(SizeExpr), ElementType(ElementType), loc(loc) {}
459 ID.AddPointer(ElementType.getAsOpaquePtr());
460 SizeExpr->Profile(ID, Context,
true);
463DependentAddressSpaceType::DependentAddressSpaceType(
QualType PointeeType,
467 :
Type(DependentAddressSpace, can,
469 PointeeType->getDependence() |
472 AddrSpaceExpr(AddrSpaceExpr), PointeeType(PointeeType), loc(loc) {}
477 Expr *AddrSpaceExpr) {
478 ID.AddPointer(PointeeType.getAsOpaquePtr());
479 AddrSpaceExpr->Profile(ID, Context,
true);
483 const Expr *RowExpr,
const Expr *ColumnExpr)
484 :
Type(tc, canonType,
498 ElementType(matrixType) {}
501 unsigned nColumns,
QualType canonType,
502 std::optional<LayoutKind>
Layout)
507 unsigned nRows,
unsigned nColumns,
509 std::optional<LayoutKind>
Layout)
513DependentSizedMatrixType::DependentSizedMatrixType(
QualType ElementType,
518 :
MatrixType(DependentSizedMatrix, ElementType, CanonicalType, RowExpr,
520 RowExpr(RowExpr), ColumnExpr(ColumnExpr), loc(loc) {}
526 ID.AddPointer(ElementType.getAsOpaquePtr());
527 RowExpr->Profile(ID, CTX,
true);
528 ColumnExpr->Profile(ID, CTX,
true);
555 ExprAndUnsigned(NumBitsExpr, IsUnsigned) {}
558 return ExprAndUnsigned.getInt();
562 return ExprAndUnsigned.getPointer();
568 ID.AddBoolean(IsUnsigned);
569 NumBitsExpr->
Profile(ID, Context,
true);
581 bool CountInBytes,
bool OrNull) {
582 ID.AddPointer(WrappedTy.getAsOpaquePtr());
583 ID.AddBoolean(CountInBytes);
584 ID.AddBoolean(OrNull);
589 ID.AddPointer(CountExpr);
597 if (
const auto *ATy = dyn_cast<ArrayType>(
this))
598 return ATy->getElementType().getTypePtr();
626 return Context.getQualifiedType(desugar,
split.
Quals);
632#define TYPE(CLASS, BASE) \
633 static_assert(!std::is_polymorphic<CLASS##Type>::value, \
634 #CLASS "Type should not be polymorphic!");
635#include "clang/AST/TypeNodes.inc"
640#define TYPE(CLASS, BASE) \
641 static_assert(std::is_trivially_destructible<CLASS##Type>::value, \
642 #CLASS "Type should be trivially destructible!");
643#include "clang/AST/TypeNodes.inc"
647#define ABSTRACT_TYPE(Class, Parent)
648#define TYPE(Class, Parent) \
649 case Type::Class: { \
650 const auto *ty = cast<Class##Type>(this); \
651 if (!ty->isSugared()) \
652 return QualType(ty, 0); \
653 return ty->desugar(); \
655#include "clang/AST/TypeNodes.inc"
657 llvm_unreachable(
"bad type kind!");
667#define ABSTRACT_TYPE(Class, Parent)
668#define TYPE(Class, Parent) \
669 case Type::Class: { \
670 const auto *Ty = cast<Class##Type>(CurTy); \
671 if (!Ty->isSugared()) \
672 return SplitQualType(Ty, Qs); \
673 Cur = Ty->desugar(); \
676#include "clang/AST/TypeNodes.inc"
685 Qualifiers quals =
split.Quals;
688 const Type *lastTypeWithQuals =
split.Ty;
695 switch (
split.Ty->getTypeClass()) {
696#define ABSTRACT_TYPE(Class, Parent)
697#define TYPE(Class, Parent) \
698 case Type::Class: { \
699 const auto *ty = cast<Class##Type>(split.Ty); \
700 if (!ty->isSugared()) \
702 next = ty->desugar(); \
705#include "clang/AST/TypeNodes.inc"
711 if (!
split.Quals.empty()) {
712 lastTypeWithQuals =
split.Ty;
721 if (
const auto *OBT = dyn_cast<OverflowBehaviorType>(
split.Ty)) {
722 SplitQualType SplitOBT = OBT->getSplitUnqualifiedType();
724 return SplitQualType(SplitOBT.
Ty, quals);
727 return SplitQualType(lastTypeWithQuals, quals);
732 while (
const auto *PT =
T->
getAs<ParenType>())
733 T = PT->getInnerType();
742 if (
const auto *Sugar = dyn_cast<T>(Cur))
745#define ABSTRACT_TYPE(Class, Parent)
746#define TYPE(Class, Parent) \
747 case Type::Class: { \
748 const auto *Ty = cast<Class##Type>(Cur); \
749 if (!Ty->isSugared()) \
751 Cur = Ty->desugar().getTypePtr(); \
754#include "clang/AST/TypeNodes.inc"
767template <>
const TemplateSpecializationType *
Type::getAs()
const {
787 const Type *Cur =
this;
791#define ABSTRACT_TYPE(Class, Parent)
792#define TYPE(Class, Parent) \
794 const auto *Ty = cast<Class##Type>(Cur); \
795 if (!Ty->isSugared()) \
797 Cur = Ty->desugar().getTypePtr(); \
800#include "clang/AST/TypeNodes.inc"
807 return RT->getDecl()->isClass();
813 return RT->getDecl()->isStruct();
821 const auto *
Decl = RT->getDecl();
822 if (!
Decl->isStruct())
824 return Decl->getDefinitionOrSelf()->hasFlexibleArrayMember();
829 return RD->hasAttr<ObjCBoxableAttr>();
835 return RT->getDecl()->isInterface();
841 return RT->getDecl()->isStructureOrClass();
847 return PT->getPointeeType()->isVoidType();
853 return RT->getDecl()->isUnion();
859 return CT->getElementType()->isFloatingType();
870 return ET->getDecl()->isScoped();
880 if (
Complex->getElementType()->isIntegerType())
903 if (
const auto *RT = dyn_cast<RecordType>(
this)) {
904 if (RT->getDecl()->isStruct())
909 if (
const auto *RT = dyn_cast<RecordType>(CanonicalType)) {
910 if (!RT->getDecl()->isStruct())
922 if (
const auto *RT = dyn_cast<RecordType>(
this)) {
923 if (RT->getDecl()->isUnion())
928 if (
const auto *RT = dyn_cast<RecordType>(CanonicalType)) {
929 if (!RT->getDecl()->isUnion())
949 if (OPT->isObjCIdType())
953 if (!OPT->isKindOfType())
957 if (OPT->isObjCClassType() || OPT->isObjCQualifiedClassType())
961 bound = OPT->getObjectType()
962 ->stripObjCKindOfTypeAndQuals(ctx)
973 if (OPT->isObjCClassType())
977 if (!OPT->isKindOfType())
981 return OPT->isObjCClassType() || OPT->isObjCQualifiedClassType();
988 initialize(protocols);
995 :
Type(ObjCObject, Canonical,
Base->getDependence()), BaseType(
Base) {
999 assert(getTypeArgsAsWritten().size() == typeArgs.size() &&
1000 "bitfield overflow in type argument count");
1001 if (!typeArgs.empty())
1002 memcpy(getTypeArgStorage(), typeArgs.data(),
1003 typeArgs.size() *
sizeof(
QualType));
1005 for (
auto typeArg : typeArgs) {
1006 addDependence(typeArg->getDependence() & ~TypeDependence::VariablyModified);
1010 initialize(protocols);
1013bool ObjCObjectType::isSpecialized()
const {
1015 if (ObjCObjectTypeBits.NumTypeArgs > 0)
1019 if (
const auto objcObject =
getBaseType()->getAs<ObjCObjectType>()) {
1024 return objcObject->isSpecialized();
1033 if (isSpecializedAsWritten())
1034 return getTypeArgsAsWritten();
1037 if (
const auto objcObject =
getBaseType()->getAs<ObjCObjectType>()) {
1042 return objcObject->getTypeArgs();
1049bool ObjCObjectType::isKindOfType()
const {
1050 if (isKindOfTypeAsWritten())
1054 if (
const auto objcObject =
getBaseType()->getAs<ObjCObjectType>()) {
1059 return objcObject->isKindOfType();
1067ObjCObjectType::stripObjCKindOfTypeAndQuals(
const ASTContext &ctx)
const {
1068 if (!isKindOfType() && qual_empty())
1074 if (
const auto *baseObj = splitBaseType.
Ty->
getAs<ObjCObjectType>())
1075 baseType = baseObj->stripObjCKindOfTypeAndQuals(ctx);
1079 getTypeArgsAsWritten(),
1104template <
typename Derived>
1105struct SimpleTransformVisitor :
public TypeVisitor<Derived, QualType> {
1113 QualType result =
static_cast<Derived *
>(
this)->Visit(splitType.
Ty);
1123 explicit SimpleTransformVisitor(
ASTContext &ctx) : Ctx(ctx) {}
1127#define TYPE(Class, Base)
1128#define DEPENDENT_TYPE(Class, Base) \
1129 QualType Visit##Class##Type(const Class##Type *T) { return QualType(T, 0); }
1130#include "clang/AST/TypeNodes.inc"
1132#define TRIVIAL_TYPE_CLASS(Class) \
1133 QualType Visit##Class##Type(const Class##Type *T) { return QualType(T, 0); }
1134#define SUGARED_TYPE_CLASS(Class) \
1135 QualType Visit##Class##Type(const Class##Type *T) { \
1136 if (!T->isSugared()) \
1137 return QualType(T, 0); \
1138 QualType desugaredType = recurse(T->desugar()); \
1139 if (desugaredType.isNull()) \
1141 if (desugaredType.getAsOpaquePtr() == T->desugar().getAsOpaquePtr()) \
1142 return QualType(T, 0); \
1143 return desugaredType; \
1149 QualType elementType = recurse(
T->getElementType());
1150 if (elementType.
isNull())
1153 if (elementType.
getAsOpaquePtr() ==
T->getElementType().getAsOpaquePtr())
1159 QualType VisitPointerType(
const PointerType *
T) {
1165 return QualType(
T, 0);
1170 QualType VisitBlockPointerType(
const BlockPointerType *
T) {
1176 return QualType(
T, 0);
1181 QualType VisitLValueReferenceType(
const LValueReferenceType *
T) {
1182 QualType
pointeeType = recurse(
T->getPointeeTypeAsWritten());
1187 T->getPointeeTypeAsWritten().getAsOpaquePtr())
1188 return QualType(
T, 0);
1193 QualType VisitRValueReferenceType(
const RValueReferenceType *
T) {
1194 QualType
pointeeType = recurse(
T->getPointeeTypeAsWritten());
1199 T->getPointeeTypeAsWritten().getAsOpaquePtr())
1200 return QualType(
T, 0);
1205 QualType VisitMemberPointerType(
const MemberPointerType *
T) {
1211 return QualType(
T, 0);
1214 T->getMostRecentCXXRecordDecl());
1217 QualType VisitConstantArrayType(
const ConstantArrayType *
T) {
1218 QualType elementType = recurse(
T->getElementType());
1219 if (elementType.
isNull())
1222 if (elementType.
getAsOpaquePtr() ==
T->getElementType().getAsOpaquePtr())
1223 return QualType(
T, 0);
1226 T->getSizeModifier(),
1227 T->getIndexTypeCVRQualifiers());
1230 QualType VisitVariableArrayType(
const VariableArrayType *
T) {
1231 QualType elementType = recurse(
T->getElementType());
1232 if (elementType.
isNull())
1235 if (elementType.
getAsOpaquePtr() ==
T->getElementType().getAsOpaquePtr())
1236 return QualType(
T, 0);
1239 T->getSizeModifier(),
1240 T->getIndexTypeCVRQualifiers());
1243 QualType VisitIncompleteArrayType(
const IncompleteArrayType *
T) {
1244 QualType elementType = recurse(
T->getElementType());
1245 if (elementType.
isNull())
1248 if (elementType.
getAsOpaquePtr() ==
T->getElementType().getAsOpaquePtr())
1249 return QualType(
T, 0);
1252 T->getIndexTypeCVRQualifiers());
1255 QualType VisitVectorType(
const VectorType *
T) {
1256 QualType elementType = recurse(
T->getElementType());
1257 if (elementType.
isNull())
1260 if (elementType.
getAsOpaquePtr() ==
T->getElementType().getAsOpaquePtr())
1261 return QualType(
T, 0);
1264 T->getVectorKind());
1267 QualType VisitExtVectorType(
const ExtVectorType *
T) {
1268 QualType elementType = recurse(
T->getElementType());
1269 if (elementType.
isNull())
1272 if (elementType.
getAsOpaquePtr() ==
T->getElementType().getAsOpaquePtr())
1273 return QualType(
T, 0);
1278 QualType VisitConstantMatrixType(
const ConstantMatrixType *
T) {
1279 QualType elementType = recurse(
T->getElementType());
1280 if (elementType.
isNull())
1282 if (elementType.
getAsOpaquePtr() ==
T->getElementType().getAsOpaquePtr())
1283 return QualType(
T, 0);
1286 T->getNumColumns(),
T->getLayout());
1289 QualType VisitOverflowBehaviorType(
const OverflowBehaviorType *
T) {
1290 QualType UnderlyingType = recurse(
T->getUnderlyingType());
1291 if (UnderlyingType.
isNull())
1295 T->getUnderlyingType().getAsOpaquePtr())
1296 return QualType(
T, 0);
1301 QualType VisitFunctionNoProtoType(
const FunctionNoProtoType *
T) {
1307 return QualType(
T, 0);
1312 QualType VisitFunctionProtoType(
const FunctionProtoType *
T) {
1318 SmallVector<QualType, 4> paramTypes;
1319 bool paramChanged =
false;
1321 QualType newParamType = recurse(paramType);
1322 if (newParamType.
isNull())
1326 paramChanged =
true;
1328 paramTypes.push_back(newParamType);
1333 bool exceptionChanged =
false;
1335 SmallVector<QualType, 4> exceptionTypes;
1336 for (
auto exceptionType :
info.ExceptionSpec.Exceptions) {
1337 QualType newExceptionType = recurse(exceptionType);
1338 if (newExceptionType.
isNull())
1341 if (newExceptionType.
getAsOpaquePtr() != exceptionType.getAsOpaquePtr())
1342 exceptionChanged =
true;
1344 exceptionTypes.push_back(newExceptionType);
1347 if (exceptionChanged) {
1348 info.ExceptionSpec.Exceptions =
1349 llvm::ArrayRef(exceptionTypes).copy(Ctx);
1354 !paramChanged && !exceptionChanged)
1355 return QualType(
T, 0);
1360 QualType VisitParenType(
const ParenType *
T) {
1361 QualType innerType = recurse(
T->getInnerType());
1366 return QualType(
T, 0);
1375 QualType VisitAdjustedType(
const AdjustedType *
T) {
1376 QualType originalType = recurse(
T->getOriginalType());
1377 if (originalType.
isNull())
1380 QualType adjustedType = recurse(
T->getAdjustedType());
1381 if (adjustedType.
isNull())
1385 T->getOriginalType().getAsOpaquePtr() &&
1386 adjustedType.
getAsOpaquePtr() ==
T->getAdjustedType().getAsOpaquePtr())
1387 return QualType(
T, 0);
1392 QualType VisitDecayedType(
const DecayedType *
T) {
1393 QualType originalType = recurse(
T->getOriginalType());
1394 if (originalType.
isNull())
1397 if (originalType.
getAsOpaquePtr() ==
T->getOriginalType().getAsOpaquePtr())
1398 return QualType(
T, 0);
1403 QualType VisitArrayParameterType(
const ArrayParameterType *
T) {
1404 QualType ArrTy = VisitConstantArrayType(
T);
1418 QualType VisitAttributedType(
const AttributedType *
T) {
1419 QualType modifiedType = recurse(
T->getModifiedType());
1420 if (modifiedType.
isNull())
1423 QualType equivalentType = recurse(
T->getEquivalentType());
1424 if (equivalentType.
isNull())
1428 T->getModifiedType().getAsOpaquePtr() &&
1430 T->getEquivalentType().getAsOpaquePtr())
1431 return QualType(
T, 0);
1437 QualType VisitSubstTemplateTypeParmType(
const SubstTemplateTypeParmType *
T) {
1438 QualType replacementType = recurse(
T->getReplacementType());
1439 if (replacementType.
isNull())
1443 T->getReplacementType().getAsOpaquePtr())
1444 return QualType(
T, 0);
1447 replacementType,
T->getAssociatedDecl(),
T->getIndex(),
1448 T->getPackIndex(),
T->getFinal());
1454 QualType VisitAutoType(
const AutoType *
T) {
1455 if (!
T->isDeduced())
1456 return QualType(
T, 0);
1458 QualType deducedType = recurse(
T->getDeducedType());
1459 if (deducedType.
isNull())
1462 if (deducedType ==
T->getDeducedType())
1463 return QualType(
T, 0);
1465 return Ctx.
getAutoType(
T->getDeducedKind(), deducedType,
T->getKeyword(),
1466 T->getTypeConstraintConcept(),
1467 T->getTypeConstraintArguments());
1470 QualType VisitObjCObjectType(
const ObjCObjectType *
T) {
1471 QualType baseType = recurse(
T->getBaseType());
1476 bool typeArgChanged =
false;
1477 SmallVector<QualType, 4> typeArgs;
1478 for (
auto typeArg :
T->getTypeArgsAsWritten()) {
1479 QualType newTypeArg = recurse(typeArg);
1484 typeArgChanged =
true;
1486 typeArgs.push_back(newTypeArg);
1491 return QualType(
T, 0);
1495 llvm::ArrayRef(
T->qual_begin(),
T->getNumProtocols()),
1496 T->isKindOfTypeAsWritten());
1501 QualType VisitObjCObjectPointerType(
const ObjCObjectPointerType *
T) {
1507 return QualType(
T, 0);
1512 QualType VisitAtomicType(
const AtomicType *
T) {
1513 QualType valueType = recurse(
T->getValueType());
1518 return QualType(
T, 0);
1523#undef TRIVIAL_TYPE_CLASS
1524#undef SUGARED_TYPE_CLASS
1527struct SubstObjCTypeArgsVisitor
1528 :
public SimpleTransformVisitor<SubstObjCTypeArgsVisitor> {
1529 using BaseType = SimpleTransformVisitor<SubstObjCTypeArgsVisitor>;
1531 ArrayRef<QualType> TypeArgs;
1534 SubstObjCTypeArgsVisitor(ASTContext &ctx, ArrayRef<QualType> typeArgs,
1536 : BaseType(ctx), TypeArgs(typeArgs), SubstContext(context) {}
1538 QualType VisitObjCTypeParamType(
const ObjCTypeParamType *OTPTy) {
1541 ObjCTypeParamDecl *typeParam = OTPTy->getDecl();
1543 if (!TypeArgs.empty()) {
1544 QualType argType = TypeArgs[typeParam->
getIndex()];
1545 if (OTPTy->qual_empty())
1550 SmallVector<ObjCProtocolDecl *, 8> protocolsVec;
1551 protocolsVec.append(OTPTy->qual_begin(), OTPTy->qual_end());
1552 ArrayRef<ObjCProtocolDecl *> protocolsToApply = protocolsVec;
1554 argType, protocolsToApply, hasError,
true );
1557 switch (SubstContext) {
1558 case ObjCSubstitutionContext::Ordinary:
1559 case ObjCSubstitutionContext::Parameter:
1560 case ObjCSubstitutionContext::Superclass:
1564 case ObjCSubstitutionContext::Result:
1565 case ObjCSubstitutionContext::Property: {
1567 const auto *objPtr =
1572 if (objPtr->isKindOfType() || objPtr->isObjCIdOrClassType())
1576 const auto *obj = objPtr->getObjectType();
1578 obj->getBaseType(), obj->getTypeArgsAsWritten(), obj->getProtocols(),
1585 llvm_unreachable(
"Unexpected ObjCSubstitutionContext!");
1588 QualType VisitFunctionType(
const FunctionType *funcType) {
1594 Ctx, TypeArgs, ObjCSubstitutionContext::Result);
1604 return BaseType::VisitFunctionType(funcType);
1613 SmallVector<QualType, 4> paramTypes;
1614 bool paramChanged =
false;
1615 for (
auto paramType : funcProtoType->getParamTypes()) {
1617 Ctx, TypeArgs, ObjCSubstitutionContext::Parameter);
1618 if (newParamType.
isNull())
1622 paramChanged =
true;
1624 paramTypes.push_back(newParamType);
1628 FunctionProtoType::ExtProtoInfo
info = funcProtoType->getExtProtoInfo();
1629 bool exceptionChanged =
false;
1631 SmallVector<QualType, 4> exceptionTypes;
1632 for (
auto exceptionType :
info.ExceptionSpec.Exceptions) {
1634 Ctx, TypeArgs, ObjCSubstitutionContext::Ordinary);
1635 if (newExceptionType.
isNull())
1638 if (newExceptionType.
getAsOpaquePtr() != exceptionType.getAsOpaquePtr())
1639 exceptionChanged =
true;
1641 exceptionTypes.push_back(newExceptionType);
1644 if (exceptionChanged) {
1645 info.ExceptionSpec.Exceptions =
1646 llvm::ArrayRef(exceptionTypes).copy(Ctx);
1651 funcProtoType->getReturnType().getAsOpaquePtr() &&
1652 !paramChanged && !exceptionChanged)
1653 return BaseType::VisitFunctionType(funcType);
1658 QualType VisitObjCObjectType(
const ObjCObjectType *objcObjectType) {
1661 if (objcObjectType->isSpecializedAsWritten()) {
1662 SmallVector<QualType, 4> newTypeArgs;
1663 bool anyChanged =
false;
1664 for (
auto typeArg : objcObjectType->getTypeArgsAsWritten()) {
1666 Ctx, TypeArgs, ObjCSubstitutionContext::Ordinary);
1673 ArrayRef<ObjCProtocolDecl *> protocols(
1674 objcObjectType->qual_begin(), objcObjectType->getNumProtocols());
1675 if (TypeArgs.empty() &&
1676 SubstContext != ObjCSubstitutionContext::Superclass) {
1678 objcObjectType->getBaseType(), {}, protocols,
1679 objcObjectType->isKindOfTypeAsWritten());
1685 newTypeArgs.push_back(newTypeArg);
1689 ArrayRef<ObjCProtocolDecl *> protocols(
1690 objcObjectType->qual_begin(), objcObjectType->getNumProtocols());
1693 objcObjectType->isKindOfTypeAsWritten());
1697 return BaseType::VisitObjCObjectType(objcObjectType);
1700 QualType VisitAttributedType(
const AttributedType *attrType) {
1701 QualType newType = BaseType::VisitAttributedType(attrType);
1705 const auto *newAttrType = dyn_cast<AttributedType>(newType.
getTypePtr());
1706 if (!newAttrType || newAttrType->getAttrKind() != attr::ObjCKindOf)
1710 QualType newEquivType = newAttrType->getEquivalentType();
1711 const ObjCObjectPointerType *ptrType =
1712 newEquivType->
getAs<ObjCObjectPointerType>();
1713 const ObjCObjectType *objType = ptrType
1715 : newEquivType->
getAs<ObjCObjectType>();
1722 objType->getBaseType(), objType->getTypeArgsAsWritten(),
1723 objType->getProtocols(),
1725 objType->isObjCUnqualifiedId() ?
false :
true);
1733 newAttrType->getModifiedType(), newEquivType,
1734 newAttrType->getAttr());
1738struct StripNullabilityTypeVisitor
1739 :
public SimpleTransformVisitor<StripNullabilityTypeVisitor> {
1740 using BaseType = SimpleTransformVisitor<StripNullabilityTypeVisitor>;
1742 explicit StripNullabilityTypeVisitor(ASTContext &ctx) : BaseType(ctx) {}
1744 QualType VisitAttributedType(
const AttributedType *attrType) {
1745 QualType
type(attrType, 0);
1746 if (AttributedType::stripOuterNullability(
type)) {
1747 while (AttributedType::stripOuterNullability(
type)) {
1749 return BaseType::recurse(
type);
1752 return BaseType::VisitAttributedType(attrType);
1756struct StripObjCKindOfTypeVisitor
1757 :
public SimpleTransformVisitor<StripObjCKindOfTypeVisitor> {
1758 using BaseType = SimpleTransformVisitor<StripObjCKindOfTypeVisitor>;
1760 explicit StripObjCKindOfTypeVisitor(ASTContext &ctx) : BaseType(ctx) {}
1762 QualType VisitObjCObjectType(
const ObjCObjectType *objType) {
1763 if (!objType->isKindOfType())
1764 return BaseType::VisitObjCObjectType(objType);
1766 QualType baseType = objType->getBaseType().stripObjCKindOfType(Ctx);
1768 objType->getProtocols(),
1785 case BuiltinType::Kind::Float16: {
1793 case BuiltinType::Kind::BFloat16: {
1813 SubstObjCTypeArgsVisitor visitor(ctx, typeArgs, context);
1814 return visitor.recurse(*
this);
1828 auto &ctx =
const_cast<ASTContext &
>(constCtx);
1829 StripObjCKindOfTypeVisitor visitor(ctx);
1830 return visitor.recurse(*
this);
1836 auto &ctx =
const_cast<ASTContext &
>(constCtx);
1837 StripNullabilityTypeVisitor visitor(ctx);
1838 return visitor.recurse(*
this);
1843 if (
const auto AT =
T.getTypePtr()->getAs<
AtomicType>())
1844 T = AT->getValueType();
1845 return T.getUnqualifiedType();
1848std::optional<ArrayRef<QualType>>
1851 if (
const auto method = dyn_cast<ObjCMethodDecl>(dc))
1852 dc = method->getDeclContext();
1856 const auto *dcClassDecl = dyn_cast<ObjCInterfaceDecl>(dc);
1862 dcTypeParams = dcClassDecl->getTypeParamList();
1864 return std::nullopt;
1868 dcCategoryDecl = dyn_cast<ObjCCategoryDecl>(dc);
1869 if (!dcCategoryDecl)
1870 return std::nullopt;
1876 return std::nullopt;
1880 return std::nullopt;
1882 assert(dcTypeParams &&
"No substitutions to perform");
1883 assert(dcClassDecl &&
"No class context");
1888 objectType = objectPointerType->getObjectType();
1899 objectType ? objectType->getInterface() :
nullptr;
1900 if (!curClassDecl) {
1908 while (curClassDecl != dcClassDecl) {
1910 QualType superType = objectType->getSuperClassType();
1911 if (superType.
isNull()) {
1912 objectType =
nullptr;
1917 curClassDecl = objectType->getInterface();
1922 if (!objectType || objectType->isUnspecialized()) {
1927 return objectType->getTypeArgs();
1932 if (
auto *ID = IfaceT->getInterface()) {
1933 if (ID->getTypeParamList())
1941void ObjCObjectType::computeSuperClassTypeSlow()
const {
1947 CachedSuperClassType.setInt(
true);
1953 if (!superClassObjTy) {
1954 CachedSuperClassType.setInt(
true);
1959 if (!superClassDecl) {
1960 CachedSuperClassType.setInt(
true);
1966 QualType superClassType(superClassObjTy, 0);
1968 if (!superClassTypeParams) {
1969 CachedSuperClassType.setPointerAndInt(
1970 superClassType->castAs<ObjCObjectType>(),
true);
1975 if (superClassObjTy->isUnspecialized()) {
1976 CachedSuperClassType.setPointerAndInt(superClassObjTy,
true);
1984 CachedSuperClassType.setPointerAndInt(
1985 superClassType->castAs<ObjCObjectType>(),
true);
1991 if (isUnspecialized()) {
1994 superClassObjTy->getInterface());
1995 CachedSuperClassType.setPointerAndInt(
1996 unspecializedSuper->
castAs<ObjCObjectType>(),
true);
2002 assert(typeArgs.size() == typeParams->
size());
2003 CachedSuperClassType.setPointerAndInt(
2007 ->castAs<ObjCObjectType>(),
2013 return interfaceDecl->getASTContext()
2014 .getObjCInterfaceType(interfaceDecl)
2023 if (superObjectType.
isNull())
2024 return superObjectType;
2035 if (
T->getNumProtocols() &&
T->getInterface())
2048 if (OPT->isObjCQualifiedIdType())
2058 if (OPT->isObjCQualifiedClassType())
2066 if (OT->getInterface())
2074 if (OPT->getInterfaceType())
2091const TemplateSpecializationType *
2094 while (TST && TST->isTypeAlias())
2095 TST = TST->desugar()->getAs<TemplateSpecializationType>();
2101 case Type::DependentName:
2103 case Type::TemplateSpecialization:
2109 case Type::InjectedClassName:
2113 case Type::UnresolvedUsing:
2118 return std::nullopt;
2123 const Type *Cur =
this;
2124 while (
const auto *AT = Cur->
getAs<AttributedType>()) {
2125 if (AT->getAttrKind() == AK)
2127 Cur = AT->getEquivalentType().getTypePtr();
2134class GetContainedDeducedTypeVisitor
2135 :
public TypeVisitor<GetContainedDeducedTypeVisitor, Type *> {
2139 GetContainedDeducedTypeVisitor(
bool Syntactic =
false)
2140 : Syntactic(Syntactic) {}
2147 return Visit(
T.getTypePtr());
2151 Type *VisitDeducedType(
const DeducedType *AT) {
2152 return const_cast<DeducedType *
>(AT);
2156 Type *VisitSubstTemplateTypeParmType(
const SubstTemplateTypeParmType *
T) {
2157 return Visit(
T->getReplacementType());
2160 Type *VisitPointerType(
const PointerType *
T) {
2164 Type *VisitBlockPointerType(
const BlockPointerType *
T) {
2168 Type *VisitReferenceType(
const ReferenceType *
T) {
2169 return Visit(
T->getPointeeTypeAsWritten());
2172 Type *VisitMemberPointerType(
const MemberPointerType *
T) {
2176 Type *VisitArrayType(
const ArrayType *
T) {
2177 return Visit(
T->getElementType());
2180 Type *VisitDependentSizedExtVectorType(
const DependentSizedExtVectorType *
T) {
2181 return Visit(
T->getElementType());
2184 Type *VisitVectorType(
const VectorType *
T) {
2185 return Visit(
T->getElementType());
2188 Type *VisitDependentSizedMatrixType(
const DependentSizedMatrixType *
T) {
2189 return Visit(
T->getElementType());
2192 Type *VisitConstantMatrixType(
const ConstantMatrixType *
T) {
2193 return Visit(
T->getElementType());
2196 Type *VisitFunctionProtoType(
const FunctionProtoType *
T) {
2198 return const_cast<FunctionProtoType *
>(
T);
2199 return VisitFunctionType(
T);
2202 Type *VisitFunctionType(
const FunctionType *
T) {
2206 Type *VisitParenType(
const ParenType *
T) {
return Visit(
T->getInnerType()); }
2208 Type *VisitAttributedType(
const AttributedType *
T) {
2209 return Visit(
T->getModifiedType());
2212 Type *VisitMacroQualifiedType(
const MacroQualifiedType *
T) {
2213 return Visit(
T->getUnderlyingType());
2216 Type *VisitOverflowBehaviorType(
const OverflowBehaviorType *
T) {
2217 return Visit(
T->getUnderlyingType());
2220 Type *VisitAdjustedType(
const AdjustedType *
T) {
2221 return Visit(
T->getOriginalType());
2224 Type *VisitPackExpansionType(
const PackExpansionType *
T) {
2225 return Visit(
T->getPattern());
2228 Type *VisitAtomicType(
const AtomicType *
T) {
2229 return Visit(
T->getValueType());
2236 return cast_or_null<DeducedType>(
2237 GetContainedDeducedTypeVisitor().Visit(
this));
2241 return isa_and_nonnull<FunctionType>(
2242 GetContainedDeducedTypeVisitor(
true).Visit(
this));
2246 if (
const auto *VT = dyn_cast<VectorType>(CanonicalType))
2247 return VT->getElementType()->isIntegerType();
2248 if (
const auto *MT = dyn_cast<MatrixType>(CanonicalType))
2249 return MT->getElementType()->isIntegerType();
2250 if (CanonicalType->isSveVLSBuiltinType()) {
2252 return VT->getKind() == BuiltinType::SveBool ||
2253 (VT->getKind() >= BuiltinType::SveInt8 &&
2254 VT->getKind() <= BuiltinType::SveUint64);
2256 if (CanonicalType->isRVVVLSBuiltinType()) {
2258 return (VT->getKind() >= BuiltinType::RvvInt8mf8 &&
2259 VT->getKind() <= BuiltinType::RvvUint64m8);
2285 if (
const auto *BT = dyn_cast<BuiltinType>(CanonicalType))
2286 return BT->isInteger();
2290 if (
const auto *ET = dyn_cast<EnumType>(CanonicalType))
2293 if (
const OverflowBehaviorType *OBT =
2294 dyn_cast<OverflowBehaviorType>(CanonicalType))
2295 return OBT->getUnderlyingType()->isIntegralOrEnumerationType();
2302 if (
const auto *BT = dyn_cast<BuiltinType>(CanonicalType))
2303 return BT->isInteger();
2305 if (
const auto *OBT = dyn_cast<OverflowBehaviorType>(CanonicalType))
2306 return OBT->getUnderlyingType()->isIntegerType();
2315 if (
const auto *ET = dyn_cast<EnumType>(CanonicalType))
2316 return !ET->getDecl()->isScoped();
2322 if (
const auto *BT = dyn_cast<BuiltinType>(CanonicalType))
2323 return BT->getKind() == BuiltinType::Char_U ||
2324 BT->getKind() == BuiltinType::UChar ||
2325 BT->getKind() == BuiltinType::Char_S ||
2326 BT->getKind() == BuiltinType::SChar;
2331 if (
const auto *BT = dyn_cast<BuiltinType>(CanonicalType))
2332 return BT->getKind() == BuiltinType::WChar_S ||
2333 BT->getKind() == BuiltinType::WChar_U;
2338 if (
const BuiltinType *BT = dyn_cast<BuiltinType>(CanonicalType))
2339 return BT->getKind() == BuiltinType::Char8;
2344 if (
const auto *BT = dyn_cast<BuiltinType>(CanonicalType))
2345 return BT->getKind() == BuiltinType::Char16;
2350 if (
const auto *BT = dyn_cast<BuiltinType>(CanonicalType))
2351 return BT->getKind() == BuiltinType::Char32;
2358 const auto *BT = dyn_cast<BuiltinType>(CanonicalType);
2361 switch (BT->getKind()) {
2364 case BuiltinType::Char_U:
2365 case BuiltinType::UChar:
2366 case BuiltinType::WChar_U:
2367 case BuiltinType::Char8:
2368 case BuiltinType::Char16:
2369 case BuiltinType::Char32:
2370 case BuiltinType::Char_S:
2371 case BuiltinType::SChar:
2372 case BuiltinType::WChar_S:
2378 const auto *BT = dyn_cast<BuiltinType>(CanonicalType);
2381 switch (BT->getKind()) {
2384 case BuiltinType::Char8:
2385 case BuiltinType::Char16:
2386 case BuiltinType::Char32:
2395 if (
const auto *BT = dyn_cast<BuiltinType>(CanonicalType))
2396 return BT->isSignedInteger();
2401 if (!ED->isComplete() || ED->isScoped())
2403 return ED->getIntegerType()->isSignedIntegerType();
2406 if (
const auto *IT = dyn_cast<BitIntType>(CanonicalType))
2407 return IT->isSigned();
2408 if (
const auto *IT = dyn_cast<DependentBitIntType>(CanonicalType))
2409 return IT->isSigned();
2411 if (
const auto *OBT = dyn_cast<OverflowBehaviorType>(CanonicalType))
2412 return OBT->getUnderlyingType()->isSignedIntegerType();
2418 if (
const auto *BT = dyn_cast<BuiltinType>(CanonicalType))
2419 return BT->isSignedInteger();
2422 if (!ED->isComplete())
2424 return ED->getIntegerType()->isSignedIntegerType();
2427 if (
const auto *IT = dyn_cast<BitIntType>(CanonicalType))
2428 return IT->isSigned();
2429 if (
const auto *IT = dyn_cast<DependentBitIntType>(CanonicalType))
2430 return IT->isSigned();
2432 if (
const auto *OBT = dyn_cast<OverflowBehaviorType>(CanonicalType))
2433 return OBT->getUnderlyingType()->isSignedIntegerOrEnumerationType();
2439 if (
const auto *VT = dyn_cast<VectorType>(CanonicalType))
2440 return VT->getElementType()->isSignedIntegerOrEnumerationType();
2441 if (
const auto *MT = dyn_cast<MatrixType>(CanonicalType))
2442 return MT->getElementType()->isSignedIntegerOrEnumerationType();
2444 if (
const auto *BT = dyn_cast<BuiltinType>(CanonicalType)) {
2445 switch (BT->getKind()) {
2446#define SVE_VECTOR_TYPE_INT(Name, MangledName, Id, SingletonId, NumEls, \
2447 ElBits, NF, IsSigned) \
2448 case BuiltinType::Id: \
2450#include "clang/Basic/AArch64ACLETypes.def"
2463 if (
const auto *BT = dyn_cast<BuiltinType>(CanonicalType))
2464 return BT->isUnsignedInteger();
2469 if (!ED->isComplete() || ED->isScoped())
2471 return ED->getIntegerType()->isUnsignedIntegerType();
2474 if (
const auto *IT = dyn_cast<BitIntType>(CanonicalType))
2475 return IT->isUnsigned();
2476 if (
const auto *IT = dyn_cast<DependentBitIntType>(CanonicalType))
2477 return IT->isUnsigned();
2479 if (
const auto *OBT = dyn_cast<OverflowBehaviorType>(CanonicalType))
2480 return OBT->getUnderlyingType()->isUnsignedIntegerType();
2486 if (
const auto *BT = dyn_cast<BuiltinType>(CanonicalType))
2487 return BT->isUnsignedInteger();
2490 if (!ED->isComplete())
2492 return ED->getIntegerType()->isUnsignedIntegerType();
2495 if (
const auto *IT = dyn_cast<BitIntType>(CanonicalType))
2496 return IT->isUnsigned();
2497 if (
const auto *IT = dyn_cast<DependentBitIntType>(CanonicalType))
2498 return IT->isUnsigned();
2500 if (
const auto *OBT = dyn_cast<OverflowBehaviorType>(CanonicalType))
2501 return OBT->getUnderlyingType()->isUnsignedIntegerOrEnumerationType();
2507 if (
const auto *VT = dyn_cast<VectorType>(CanonicalType))
2508 return VT->getElementType()->isUnsignedIntegerOrEnumerationType();
2509 if (
const auto *VT = dyn_cast<MatrixType>(CanonicalType))
2510 return VT->getElementType()->isUnsignedIntegerOrEnumerationType();
2511 if (CanonicalType->isSveVLSBuiltinType()) {
2513 return VT->getKind() >= BuiltinType::SveUint8 &&
2514 VT->getKind() <= BuiltinType::SveUint64;
2520 if (
const auto *BT = dyn_cast<BuiltinType>(CanonicalType))
2521 return BT->isFloatingPoint();
2522 if (
const auto *CT = dyn_cast<ComplexType>(CanonicalType))
2523 return CT->getElementType()->isFloatingType();
2528 if (
const auto *VT = dyn_cast<VectorType>(CanonicalType))
2529 return VT->getElementType()->isFloatingType();
2530 if (
const auto *MT = dyn_cast<MatrixType>(CanonicalType))
2531 return MT->getElementType()->isFloatingType();
2536 if (
const auto *BT = dyn_cast<BuiltinType>(CanonicalType))
2537 return BT->isFloatingPoint();
2542 if (
const auto *BT = dyn_cast<BuiltinType>(CanonicalType))
2543 return BT->getKind() >= BuiltinType::Bool &&
2544 BT->getKind() <= BuiltinType::Ibm128;
2545 if (
const auto *ET = dyn_cast<EnumType>(CanonicalType)) {
2546 const auto *ED = ET->getDecl();
2547 return !ED->isScoped() && ED->getDefinitionOrSelf()->isComplete();
2553 if (
const auto *BT = dyn_cast<BuiltinType>(CanonicalType))
2554 return BT->getKind() >= BuiltinType::Bool &&
2555 BT->getKind() <= BuiltinType::Ibm128;
2556 if (
const auto *ET = dyn_cast<EnumType>(CanonicalType)) {
2563 const auto *ED = ET->getDecl();
2564 return !ED->isScoped() && ED->getDefinitionOrSelf()->isComplete();
2575 if (
const auto *VT = dyn_cast<VectorType>(CanonicalType))
2576 return VT->getElementType()->isBooleanType();
2578 return ED->isComplete() && ED->getIntegerType()->isBooleanType();
2579 if (
const auto *IT = dyn_cast<BitIntType>(CanonicalType))
2580 return IT->getNumBits() == 1;
2587 const Type *
T = CanonicalType.getTypePtr();
2588 if (
const auto *BT = dyn_cast<BuiltinType>(
T)) {
2589 if (BT->getKind() == BuiltinType::Bool)
2591 if (BT->getKind() == BuiltinType::NullPtr)
2593 if (BT->isInteger())
2595 if (BT->isFloatingPoint())
2597 if (BT->isFixedPointType())
2599 llvm_unreachable(
"unknown scalar builtin type");
2609 const EnumDecl *ED =
T->castAsEnumDecl();
2616 }
else if (
const auto *CT = dyn_cast<ComplexType>(
T)) {
2617 if (CT->getElementType()->isRealFloatingType())
2626 llvm_unreachable(
"unknown scalar type");
2639 if (
const auto *
Record = dyn_cast<RecordType>(CanonicalType)) {
2640 if (
const auto *ClassDecl = dyn_cast<CXXRecordDecl>(
Record->getDecl()))
2641 return ClassDecl->isAggregate();
2653 assert(!
isIncompleteType() &&
"This doesn't make sense for incomplete types");
2654 assert(!
isDependentType() &&
"This doesn't make sense for dependent types");
2666 switch (CanonicalType->getTypeClass()) {
2677 return !EnumD->isComplete();
2685 return !Rec->isCompleteDefinition();
2687 case InjectedClassName: {
2689 if (!Rec->isBeingDefined())
2703 ->isIncompleteType(Def);
2704 case IncompleteArray:
2707 case MemberPointer: {
2720 if (!Context.getTargetInfo().getCXXABI().isMicrosoft())
2723 if (RD->
hasAttr<MSInheritanceAttr>())
2730 ->isIncompleteType(Def);
2731 case ObjCInterface: {
2763 switch (BT->getKind()) {
2765#define WASM_TYPE(Name, Id, SingletonId) case BuiltinType::Id:
2766#include "clang/Basic/WebAssemblyReferenceTypes.def"
2768#define HLSL_INTANGIBLE_TYPE(Name, Id, SingletonId) case BuiltinType::Id:
2769#include "clang/Basic/HLSLIntangibleTypes.def"
2771 case BuiltinType::AMDGPUFeaturePredicate:
2782 return BT->getKind() == BuiltinType::WasmExternRef;
2787 if (
const auto *ATy = dyn_cast<ArrayType>(
this))
2788 return ATy->getElementType().isWebAssemblyReferenceType();
2790 if (
const auto *PTy = dyn_cast<PointerType>(
this))
2791 return PTy->getPointeeType().isWebAssemblyReferenceType();
2804 switch (BT->getKind()) {
2806#define SVE_VECTOR_TYPE(Name, MangledName, Id, SingletonId) \
2807 case BuiltinType::Id: \
2809#define SVE_OPAQUE_TYPE(Name, MangledName, Id, SingletonId) \
2810 case BuiltinType::Id: \
2812#define SVE_PREDICATE_TYPE(Name, MangledName, Id, SingletonId) \
2813 case BuiltinType::Id: \
2815#include "clang/Basic/AArch64ACLETypes.def"
2825 switch (BT->getKind()) {
2826#define RVV_TYPE(Name, Id, SingletonId) case BuiltinType::Id:
2827#include "clang/Basic/RISCVVTypes.def"
2838 switch (BT->getKind()) {
2839 case BuiltinType::SveInt8:
2840 case BuiltinType::SveInt16:
2841 case BuiltinType::SveInt32:
2842 case BuiltinType::SveInt64:
2843 case BuiltinType::SveUint8:
2844 case BuiltinType::SveUint16:
2845 case BuiltinType::SveUint32:
2846 case BuiltinType::SveUint64:
2847 case BuiltinType::SveFloat16:
2848 case BuiltinType::SveFloat32:
2849 case BuiltinType::SveFloat64:
2850 case BuiltinType::SveBFloat16:
2851 case BuiltinType::SveBool:
2852 case BuiltinType::SveMFloat8:
2870 llvm_unreachable(
"Unhandled type");
2877 if (BTy->
getKind() == BuiltinType::SveBool)
2888 switch (BT->getKind()) {
2889#define RVV_VECTOR_TYPE(Name, Id, SingletonId, NumEls, ElBits, NF, IsSigned, \
2891 case BuiltinType::Id: \
2893#define RVV_PREDICATE_TYPE(Name, Id, SingletonId, NumEls) \
2894 case BuiltinType::Id: \
2896#include "clang/Basic/RISCVVTypes.def"
2910#define RVV_PREDICATE_TYPE(Name, Id, SingletonId, NumEls) \
2911 case BuiltinType::Id: \
2912 return Ctx.UnsignedCharTy;
2915#include "clang/Basic/RISCVVTypes.def"
2918 llvm_unreachable(
"Unhandled type");
2922 if (Context.getLangOpts().HLSL &&
2923 getTypePtr()->isHLSLStandardLayoutRecordOrArrayOf())
2927 if (Context.getLangOpts().CPlusPlus11)
2940 if ((*this)->isIncompleteArrayType())
2941 return Context.getBaseElementType(*this).isCXX98PODType(Context);
2943 if ((*this)->isIncompleteType())
2952 if (Context.containsAddressDiscriminatedPointerAuth(CanonicalType))
2959 case Type::VariableArray:
2960 case Type::ConstantArray:
2962 return Context.getBaseElementType(*this).isCXX98PODType(Context);
2964 case Type::ObjCObjectPointer:
2965 case Type::BlockPointer:
2969 case Type::MemberPointer:
2971 case Type::ExtVector:
2973 case Type::OverflowBehavior:
2980 if (
const auto *ClassDecl =
2982 return ClassDecl->isPOD();
2996 if ((*this)->isArrayType())
2997 return Context.getBaseElementType(*this).isTrivialType(Context);
2999 if ((*this)->isSizelessBuiltinType())
3004 if ((*this)->isIncompleteType())
3016 if (Context.containsAddressDiscriminatedPointerAuth(CanonicalType))
3035 return ClassDecl->hasTrivialDefaultConstructor() &&
3036 !ClassDecl->hasNonTrivialDefaultConstructor() &&
3037 ClassDecl->isTriviallyCopyable();
3049 bool IsCopyConstructible) {
3050 if (
type->isArrayType())
3052 Context, IsCopyConstructible);
3054 if (
type.hasNonTrivialObjCLifetime())
3088 if (
const auto *ClassDecl = dyn_cast<CXXRecordDecl>(RD)) {
3089 if (IsCopyConstructible)
3090 return ClassDecl->isTriviallyCopyConstructible();
3091 return ClassDecl->isTriviallyCopyable();
3093 return !RD->isNonTrivialToPrimitiveCopy();
3107 if (CanonicalType.hasNonTrivialObjCLifetime())
3109 if (CanonicalType->isArrayType())
3110 return Context.getBaseElementType(CanonicalType)
3111 .isBitwiseCloneableType(Context);
3113 if (CanonicalType->isIncompleteType())
3118 if (Context.containsAddressDiscriminatedPointerAuth(CanonicalType))
3121 const auto *RD = CanonicalType->getAsRecordDecl();
3125 if (RD->isInvalidDecl())
3131 if (RD->mayInsertExtraPadding())
3134 for (
auto *
const Field : RD->fields()) {
3135 if (!Field->getType().isBitwiseCloneableType(Context))
3139 if (
const auto *CXXRD = dyn_cast<CXXRecordDecl>(RD)) {
3140 for (
auto Base : CXXRD->bases())
3141 if (!
Base.getType().isBitwiseCloneableType(Context))
3143 for (
auto VBase : CXXRD->vbases())
3144 if (!VBase.getType().isBitwiseCloneableType(Context))
3157 return !Context.getLangOpts().ObjCAutoRefCount &&
3158 Context.getLangOpts().ObjCWeak &&
3191 return OBT->getBehaviorKind() ==
3192 OverflowBehaviorType::OverflowBehaviorKind::Wrap;
3199 return OBT->getBehaviorKind() ==
3200 OverflowBehaviorType::OverflowBehaviorKind::Trap;
3207 if (
const auto *RD =
3223 if (
const auto *RD =
3263 assert(BaseTy &&
"NULL element type");
3297 if (
const auto *ClassDecl = dyn_cast<CXXRecordDecl>(RD))
3298 return ClassDecl->isLiteral();
3312 return AT->getValueType()->isLiteralType(Ctx);
3314 if (
const auto *OBT = BaseTy->
getAs<OverflowBehaviorType>())
3315 return OBT->getUnderlyingType()->isLiteralType(Ctx);
3337 return RD->isStructural();
3350 assert(BaseTy &&
"NULL element type");
3361 if (
const auto *ClassDecl = dyn_cast<CXXRecordDecl>(RD);
3362 ClassDecl && !ClassDecl->isStandardLayout())
3390 assert(BaseTy &&
"NULL element type");
3401 if (Context.containsAddressDiscriminatedPointerAuth(*
this))
3408 if (
const auto *ClassDecl = dyn_cast<CXXRecordDecl>(RD)) {
3411 if (!ClassDecl->isTrivial())
3417 if (!ClassDecl->isStandardLayout())
3448 const auto *ED = ET->getDecl();
3450 if (II && II->
isStr(
"align_val_t") && ED->isInStdNamespace())
3458 const auto *ED = ET->getDecl();
3460 if (II && II->
isStr(
"byte") && ED->isInStdNamespace())
3476 case TemplateTypeParm:
3477 case SubstTemplateTypeParm:
3478 case TemplateSpecialization:
3521 llvm_unreachable(
"Type specifier is not a tag type kind.");
3538 llvm_unreachable(
"Unknown tag type kind.");
3556 llvm_unreachable(
"Elaborated type keyword is not a tag type kind.");
3558 llvm_unreachable(
"Unknown elaborated type keyword.");
3573 llvm_unreachable(
"Unknown elaborated type keyword.");
3587 return "__interface";
3594 llvm_unreachable(
"Unknown elaborated type keyword.");
3599 if (
const auto *TST = dyn_cast<TemplateSpecializationType>(
this))
3601 else if (
const auto *DepName = dyn_cast<DependentNameType>(
this))
3602 Keyword = DepName->getKeyword();
3603 else if (
const auto *
T = dyn_cast<TagType>(
this))
3605 else if (
const auto *
T = dyn_cast<TypedefType>(
this))
3607 else if (
const auto *
T = dyn_cast<UnresolvedUsingType>(
this))
3609 else if (
const auto *
T = dyn_cast<UsingType>(
this))
3619#define ABSTRACT_TYPE(Derived, Base)
3620#define TYPE(Derived, Base) \
3623#include "clang/AST/TypeNodes.inc"
3626 llvm_unreachable(
"Invalid type class.");
3634 return Policy.
Bool ?
"bool" :
"_Bool";
3640 return "signed char";
3652 return "unsigned char";
3654 return "unsigned short";
3656 return "unsigned int";
3658 return "unsigned long";
3660 return "unsigned long long";
3662 return "unsigned __int128";
3664 return Policy.
Half ?
"half" :
"__fp16";
3672 return "long double";
3674 return "short _Accum";
3678 return "long _Accum";
3680 return "unsigned short _Accum";
3682 return "unsigned _Accum";
3684 return "unsigned long _Accum";
3685 case BuiltinType::MetaInfo:
3686 return "std::meta::info";
3687 case BuiltinType::ShortFract:
3688 return "short _Fract";
3689 case BuiltinType::Fract:
3691 case BuiltinType::LongFract:
3692 return "long _Fract";
3693 case BuiltinType::UShortFract:
3694 return "unsigned short _Fract";
3695 case BuiltinType::UFract:
3696 return "unsigned _Fract";
3697 case BuiltinType::ULongFract:
3698 return "unsigned long _Fract";
3699 case BuiltinType::SatShortAccum:
3700 return "_Sat short _Accum";
3701 case BuiltinType::SatAccum:
3702 return "_Sat _Accum";
3703 case BuiltinType::SatLongAccum:
3704 return "_Sat long _Accum";
3705 case BuiltinType::SatUShortAccum:
3706 return "_Sat unsigned short _Accum";
3707 case BuiltinType::SatUAccum:
3708 return "_Sat unsigned _Accum";
3709 case BuiltinType::SatULongAccum:
3710 return "_Sat unsigned long _Accum";
3711 case BuiltinType::SatShortFract:
3712 return "_Sat short _Fract";
3713 case BuiltinType::SatFract:
3714 return "_Sat _Fract";
3715 case BuiltinType::SatLongFract:
3716 return "_Sat long _Fract";
3717 case BuiltinType::SatUShortFract:
3718 return "_Sat unsigned short _Fract";
3719 case BuiltinType::SatUFract:
3720 return "_Sat unsigned _Fract";
3721 case BuiltinType::SatULongFract:
3722 return "_Sat unsigned long _Fract";
3726 return "__float128";
3731 return Policy.
MSWChar ?
"__wchar_t" :
"wchar_t";
3741 return "<overloaded function type>";
3743 return "<bound member function type>";
3744 case UnresolvedTemplate:
3745 return "<unresolved template type>";
3747 return "<pseudo-object type>";
3749 return "<dependent type>";
3751 return "<unknown type>";
3752 case ARCUnbridgedCast:
3753 return "<ARC unbridged cast type>";
3755 return "<builtin fn type>";
3762#define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \
3764 return "__" #Access " " #ImgType "_t";
3765#include "clang/Basic/OpenCLImageTypes.def"
3771 return "clk_event_t";
3775 return "reserve_id_t";
3776 case IncompleteMatrixIdx:
3777 return "<incomplete matrix index type>";
3779 return "<array section type>";
3780 case OMPArrayShaping:
3781 return "<OpenMP array shaping type>";
3783 return "<OpenMP iterator type>";
3784#define EXT_OPAQUE_TYPE(ExtType, Id, Ext) \
3787#include "clang/Basic/OpenCLExtensionTypes.def"
3788#define SVE_TYPE(Name, Id, SingletonId) \
3791#include "clang/Basic/AArch64ACLETypes.def"
3792#define PPC_VECTOR_TYPE(Name, Id, Size) \
3795#include "clang/Basic/PPCTypes.def"
3796#define RVV_TYPE(Name, Id, SingletonId) \
3799#include "clang/Basic/RISCVVTypes.def"
3800#define WASM_TYPE(Name, Id, SingletonId) \
3803#include "clang/Basic/WebAssemblyReferenceTypes.def"
3804#define AMDGPU_TYPE(Name, Id, SingletonId, Width, Align) \
3807#include "clang/Basic/AMDGPUTypes.def"
3808#define HLSL_INTANGIBLE_TYPE(Name, Id, SingletonId) \
3811#include "clang/Basic/HLSLIntangibleTypes.def"
3812#define HLSL_PACKED_TYPE(Name, Id, SingletonId) \
3815#include "clang/Basic/HLSLPackedTypes.def"
3816#define SPIRV_TYPE(Name, Id, SingletonId) \
3819#include "clang/Basic/SPIRVTypes.def"
3822 llvm_unreachable(
"Invalid builtin type.");
3827 if (
auto *PET = dyn_cast<PackExpansionType>(
getTypePtr()))
3828 return PET->getPattern();
3833 if (
const auto *RefType =
getTypePtr()->getAs<ReferenceType>())
3841 if (!Context.getLangOpts().CPlusPlus ||
3850 return FPT->hasCFIUncheckedCallee();
3867 return "vectorcall";
3879 return "aarch64_vector_pcs";
3881 return "aarch64_sve_pcs";
3883 return "intel_ocl_bicc";
3885 return "device_kernel";
3889 return "swiftasynccall";
3891 return "preserve_most";
3893 return "preserve_all";
3897 return "preserve_none";
3900#define CC_VLS_CASE(ABI_VLEN) \
3901 case CC_RISCVVLSCall_##ABI_VLEN: return "riscv_vls_cc(" #ABI_VLEN ")";
3918 llvm_unreachable(
"Invalid calling convention.");
3936 assert(
getNumParams() == params.size() &&
"NumParams overflow!");
3945 auto &ExtraBits = *getTrailingObjects<FunctionTypeExtraBitfields>();
3953 auto &ExtraAttrInfo = *getTrailingObjects<FunctionTypeExtraAttributeInfo>();
3957 auto &ExtraBits = *getTrailingObjects<FunctionTypeExtraBitfields>();
3958 ExtraBits.HasExtraAttributeInfo =
true;
3962 auto &ArmTypeAttrs = *getTrailingObjects<FunctionTypeArmAttributes>();
3963 ArmTypeAttrs = FunctionTypeArmAttributes();
3966 auto &ExtraBits = *getTrailingObjects<FunctionTypeExtraBitfields>();
3967 ExtraBits.HasArmTypeAttributes =
true;
3971 auto *argSlot = getTrailingObjects<QualType>();
3974 ~TypeDependence::VariablyModified);
3975 argSlot[i] = params[i];
3980 auto &ArmTypeAttrs = *getTrailingObjects<FunctionTypeArmAttributes>();
3982 "Not enough bits to encode SME attributes");
3988 auto &ExtraBits = *getTrailingObjects<FunctionTypeExtraBitfields>();
3990 assert(NumExceptions <= 1023 &&
"Not enough bits to encode exceptions");
3991 ExtraBits.NumExceptionType = NumExceptions;
3993 assert(hasExtraBitfields() &&
"missing trailing extra bitfields!");
3995 reinterpret_cast<QualType *
>(getTrailingObjects<ExceptionType>());
4003 (TypeDependence::Instantiation | TypeDependence::UnexpandedPack));
4005 exnSlot[I++] = ExceptionType;
4019 (TypeDependence::Instantiation | TypeDependence::UnexpandedPack));
4025 auto **slot = getTrailingObjects<FunctionDecl *>();
4033 auto **slot = getTrailingObjects<FunctionDecl *>();
4052 auto *extParamInfos = getTrailingObjects<ExtParameterInfo>();
4059 *getTrailingObjects<Qualifiers>() = epi.
TypeQuals;
4066 auto &EllipsisLoc = *getTrailingObjects<SourceLocation>();
4071 auto &ExtraBits = *getTrailingObjects<FunctionTypeExtraBitfields>();
4073 ExtraBits.NumFunctionEffects = EffectsCount;
4074 assert(ExtraBits.NumFunctionEffects == EffectsCount &&
4075 "effect bitfield overflow");
4078 auto *DestFX = getTrailingObjects<FunctionEffect>();
4079 llvm::uninitialized_copy(SrcFX, DestFX);
4082 if (!SrcConds.empty()) {
4083 ExtraBits.EffectsHaveConditions =
true;
4084 auto *DestConds = getTrailingObjects<EffectConditionExpr>();
4085 llvm::uninitialized_copy(SrcConds, DestConds);
4086 assert(llvm::any_of(SrcConds,
4087 [](
const EffectConditionExpr &EC) {
4089 return E->isTypeDependent() ||
4090 E->isValueDependent();
4093 "expected a dependent expression among the conditions");
4101 return NE->isValueDependent();
4113 return NE->isInstantiationDependent();
4124 llvm_unreachable(
"should not call this with unresolved exception specs");
4150 llvm_unreachable(
"unexpected exception specification kind");
4154 for (
unsigned ArgIdx =
getNumParams(); ArgIdx; --ArgIdx)
4162 const QualType *ArgTys,
unsigned NumParams,
4163 const ExtProtoInfo &epi,
4187 ID.AddPointer(
Result.getAsOpaquePtr());
4188 for (
unsigned i = 0; i != NumParams; ++i)
4189 ID.AddPointer(ArgTys[i].getAsOpaquePtr());
4193 assert(!(
unsigned(epi.Variadic) & ~1) && !(
unsigned(epi.RefQualifier) & ~3) &&
4194 !(
unsigned(epi.ExceptionSpec.Type) & ~15) &&
4195 "Values larger than expected.");
4196 ID.AddInteger(
unsigned(epi.Variadic) + (epi.RefQualifier << 1) +
4197 (epi.ExceptionSpec.Type << 3));
4198 ID.Add(epi.TypeQuals);
4200 for (
QualType Ex : epi.ExceptionSpec.Exceptions)
4213 ID.AddPointer(epi.ExceptionSpec.NoexceptExpr);
4217 epi.ExceptionSpec.NoexceptExpr->Profile(ID, Context,
true);
4220 ID.AddPointer(epi.ExceptionSpec.SourceDecl->getCanonicalDecl());
4222 if (epi.ExtParameterInfos) {
4223 for (
unsigned i = 0; i != NumParams; ++i)
4224 ID.AddInteger(epi.ExtParameterInfos[i].getOpaqueValue());
4227 epi.ExtInfo.Profile(ID);
4228 epi.ExtraAttributeInfo.Profile(ID);
4230 unsigned EffectCount = epi.FunctionEffects.size();
4231 bool HasConds = !epi.FunctionEffects.Conditions.empty();
4233 ID.AddInteger((EffectCount << 3) | (HasConds << 2) |
4234 (epi.AArch64SMEAttributes << 1) | epi.HasTrailingReturn);
4235 ID.AddInteger(epi.CFIUncheckedCallee);
4237 for (
unsigned Idx = 0; Idx != EffectCount; ++Idx) {
4238 ID.AddInteger(epi.FunctionEffects.Effects[Idx].toOpaqueInt32());
4240 ID.AddPointer(epi.FunctionEffects.Conditions[Idx].getCondition());
4251 : Data(D, Deref << DerefShift) {}
4254 return Data.getInt() & DerefMask;
4259 return Data.getOpaqueValue();
4266 Data.setFromOpaqueValue(
V);
4269OverflowBehaviorType::OverflowBehaviorType(
4271 OverflowBehaviorType::OverflowBehaviorKind Kind)
4272 :
Type(OverflowBehavior, Canon, Underlying->getDependence()),
4273 UnderlyingType(Underlying), BehaviorKind(Kind), Context(Context) {}
4275SplitQualType OverflowBehaviorType::getSplitUnqualifiedType()
const {
4277 QualType UnqualUnderlyingTy(SplitUnderlying.
Ty, 0);
4278 if (UnqualUnderlyingTy == UnderlyingType)
4282 Context.getOverflowBehaviorType(BehaviorKind, UnqualUnderlyingTy);
4290CountAttributedType::CountAttributedType(
4294 CountExpr(CountExpr) {
4302 Decls = CoupledDecls;
4314 llvm::copy(Decls, Slots);
4315 return ArrayRef(Slots, Decls.size());
4323 ArrayRef<TypeCoupledDeclRefInfo>
Decls =
4325 return new (Ctx,
alignof(CountAttributedType)) CountAttributedType(
4326 Wrapped, Canon, CountExpr, CountInBytes, OrNull,
Decls);
4329void CountAttributedType::complete(
4332 assert(!CountExpr &&
"count expression is already set");
4333 assert(E &&
"completing with a null count expression");
4344#define ENUMERATE_ATTRS(PREFIX) \
4346 if (isCountInBytes()) { \
4348 return PREFIX "sized_by_or_null"; \
4349 return PREFIX "sized_by"; \
4352 return PREFIX "counted_by_or_null"; \
4353 return PREFIX "counted_by"; \
4356 if (WithMacroPrefix)
4361#undef ENUMERATE_ATTRS
4367 bool HasTypeDifferentFromDecl)
4369 Keyword, TC, UnderlyingType.getCanonicalType(),
4373 ~NestedNameSpecifierDependence::
Dependent)
4377 *getTrailingObjects<NestedNameSpecifier>() = Qualifier;
4378 if ((
TypedefBits.hasTypeDifferentFromDecl = HasTypeDifferentFromDecl))
4379 *getTrailingObjects<QualType>() = UnderlyingType;
4384 : *getTrailingObjects<QualType>();
4390 const Type *CanonicalType)
4396 ~NestedNameSpecifierDependence::
Dependent)
4400 *getTrailingObjects<NestedNameSpecifier>() = Qualifier;
4409 if ((
UsingBits.hasQualifier = !!Qualifier))
4410 *getTrailingObjects() = Qualifier;
4419 while (
auto *InnerMQT = dyn_cast<MacroQualifiedType>(Inner)) {
4422 Inner = InnerMQT->getModifiedType();
4433 ? Context.getUnqualifiedArrayType(Can).getAtomicUnqualifiedType()
4438 TOExpr(E), Context(Context) {
4439 TypeOfBits.Kind =
static_cast<unsigned>(Kind);
4448 ? Context.getUnqualifiedArrayType(QT).getAtomicUnqualifiedType()
4457 E->
Profile(ID, Context,
true);
4458 ID.AddBoolean(IsUnqual);
4465 ? Context.getUnqualifiedArrayType(Can).getAtomicUnqualifiedType()
4467 T->getDependence()),
4468 TOType(
T), Context(Context) {
4469 TypeOfBits.Kind =
static_cast<unsigned>(Kind);
4472QualType TypeOfType::desugar()
const {
4475 ? Context.getUnqualifiedArrayType(QT).getAtomicUnqualifiedType()
4483 :
Type(Decltype, can,
4487 (E->
getType()->getDependence() &
4489 E(E), UnderlyingType(underlyingType) {}
4493QualType DecltypeType::desugar()
const {
4500DependentDecltypeType::DependentDecltypeType(
Expr *E)
4503void DependentDecltypeType::Profile(llvm::FoldingSetNodeID &ID,
4505 E->
Profile(ID, Context,
true);
4509 Expr *IndexExpr,
bool FullySubstituted,
4511 :
Type(PackIndexing, Canonical,
4513 Pattern(Pattern), IndexExpr(IndexExpr),
Size(Expansions.size()),
4514 FullySubstituted(FullySubstituted) {
4516 llvm::uninitialized_copy(Expansions, getTrailingObjects());
4520 if (isInstantiationDependentType())
4521 return std::nullopt;
4523 ConstantExpr *CE = dyn_cast<ConstantExpr>(getIndexExpr());
4525 return std::nullopt;
4527 assert(Index.isNonNegative() &&
"Invalid index");
4528 return static_cast<unsigned>(Index.getExtValue());
4532PackIndexingType::computeDependence(
QualType Pattern,
Expr *IndexExpr,
4537 ? TypeDependence::DependentInstantiation
4538 : TypeDependence::None);
4539 if (Expansions.empty())
4540 TD |= Pattern->
getDependence() & TypeDependence::DependentInstantiation;
4543 TD |=
T->getDependence();
4545 if (!(IndexD & TypeDependence::UnexpandedPack))
4551 TD |= TypeDependence::Error | TypeDependence::DependentInstantiation;
4556void PackIndexingType::Profile(llvm::FoldingSetNodeID &ID,
4558 Profile(ID, Context, getPattern(), getIndexExpr(), isFullySubstituted(),
4562void PackIndexingType::Profile(llvm::FoldingSetNodeID &ID,
4564 Expr *E,
bool FullySubstituted,
4567 E->
Profile(ID, Context,
true);
4568 ID.AddBoolean(FullySubstituted);
4569 if (!Expansions.empty()) {
4570 ID.AddInteger(Expansions.size());
4572 T.getCanonicalType().Profile(ID);
4578UnaryTransformType::UnaryTransformType(
QualType BaseType,
4579 QualType UnderlyingType, UTTKind UKind,
4581 :
Type(UnaryTransform, CanonicalType, BaseType->getDependence()),
4582 BaseType(BaseType), UnderlyingType(UnderlyingType), UKind(UKind) {}
4586 bool OwnsTag,
bool ISInjected,
const Type *CanonicalType)
4593 ~NestedNameSpecifierDependence::
Dependent)
4597 getTrailingQualifier() = Qualifier;
4602void *TagType::getTrailingPointer()
const {
4603 switch (getTypeClass()) {
4608 case Type::InjectedClassName:
4609 return const_cast<InjectedClassNameType *
>(
4612 llvm_unreachable(
"unexpected type class");
4617 assert(TagTypeBits.HasQualifier);
4619 getTrailingPointer(), llvm::Align::Of<NestedNameSpecifier *>()));
4623 return TagTypeBits.HasQualifier ? getTrailingQualifier() : std::nullopt;
4627 auto *
Decl = dyn_cast<CXXRecordDecl>(
decl);
4630 if (
auto *RD = dyn_cast<ClassTemplateSpecializationDecl>(
Decl))
4631 return RD->getSpecializedTemplate();
4632 return Decl->getDescribedClassTemplate();
4636 auto *TD = getTemplateDecl();
4639 if (isCanonicalUnqualified())
4646TagType::getTemplateArgs(
const ASTContext &Ctx)
const {
4647 auto *
Decl = dyn_cast<CXXRecordDecl>(
decl);
4651 if (
auto *RD = dyn_cast<ClassTemplateSpecializationDecl>(
Decl))
4652 return RD->getTemplateArgs().asArray();
4654 return TD->getTemplateParameters()->getInjectedTemplateArgs(Ctx);
4658bool RecordType::hasConstFields()
const {
4659 std::vector<const RecordType *> RecordTypeList;
4660 RecordTypeList.push_back(
this);
4661 unsigned NextToCheckIndex = 0;
4663 while (RecordTypeList.size() > NextToCheckIndex) {
4664 for (
FieldDecl *FD : RecordTypeList[NextToCheckIndex]
4666 ->getDefinitionOrSelf()
4672 if (
const auto *FieldRecTy = FieldTy->
getAsCanonical<RecordType>()) {
4673 if (!llvm::is_contained(RecordTypeList, FieldRecTy))
4674 RecordTypeList.push_back(FieldRecTy);
4684 const TagDecl *TD,
bool IsInjected,
4685 const Type *CanonicalType)
4687 false, IsInjected, CanonicalType) {}
4696 :
Type(Attributed, canon, equivalent->getDependence()), Attribute(
attr),
4697 ModifiedType(modified), EquivalentType(equivalent) {
4699 assert(!attr ||
attr->getKind() == attrKind);
4702bool AttributedType::isQualifier()
const {
4704 switch (getAttrKind()) {
4709 case attr::ObjCOwnership:
4710 case attr::ObjCInertUnsafeUnretained:
4711 case attr::TypeNonNull:
4712 case attr::TypeNullable:
4713 case attr::TypeNullableResult:
4714 case attr::TypeNullUnspecified:
4715 case attr::LifetimeBound:
4716 case attr::AddressSpace:
4726bool AttributedType::isMSTypeSpec()
const {
4728 switch (getAttrKind()) {
4737 llvm_unreachable(
"invalid attr kind");
4740bool AttributedType::isWebAssemblyFuncrefSpec()
const {
4741 return getAttrKind() == attr::WebAssemblyFuncref;
4744bool AttributedType::isCallingConv()
const {
4746 switch (getAttrKind()) {
4751 case attr::FastCall:
4753 case attr::ThisCall:
4755 case attr::SwiftCall:
4756 case attr::SwiftAsyncCall:
4757 case attr::VectorCall:
4758 case attr::AArch64VectorPcs:
4759 case attr::AArch64SVEPcs:
4760 case attr::DeviceKernel:
4764 case attr::IntelOclBicc:
4765 case attr::PreserveMost:
4766 case attr::PreserveAll:
4768 case attr::PreserveNone:
4769 case attr::RISCVVectorCC:
4770 case attr::RISCVVLSCC:
4773 llvm_unreachable(
"invalid attr kind");
4777 return isCanonicalUnqualified() ?
nullptr : getDecl()->getIdentifier();
4780SubstTemplateTypeParmType::SubstTemplateTypeParmType(
QualType Replacement,
4781 Decl *AssociatedDecl,
4785 :
Type(SubstTemplateTypeParm, Replacement.getCanonicalType(),
4786 Replacement->getDependence()),
4787 AssociatedDecl(AssociatedDecl) {
4791 *getTrailingObjects() = Replacement;
4797 assert(AssociatedDecl !=
nullptr);
4801SubstTemplateTypeParmType::getReplacedParameter()
const {
4806SubstPackType::SubstPackType(TypeClass Derived,
QualType Canon,
4808 :
Type(Derived, Canon,
4812 assert(llvm::all_of(
4814 [](
auto &P) { return P.getKind() == TemplateArgument::Type; }) &&
4815 "non-type argument to SubstPackType?");
4823void SubstPackType::Profile(llvm::FoldingSetNodeID &ID) {
4824 Profile(ID, getArgumentPack());
4827void SubstPackType::Profile(llvm::FoldingSetNodeID &ID,
4831 ID.AddPointer(P.getAsType().getAsOpaquePtr());
4834SubstTemplateTypeParmPackType::SubstTemplateTypeParmPackType(
4835 QualType Canon,
Decl *AssociatedDecl,
unsigned Index,
bool Final,
4837 : SubstPackType(SubstTemplateTypeParmPack, Canon, ArgPack),
4838 AssociatedDeclAndFinal(AssociatedDecl, Final) {
4839 assert(AssociatedDecl !=
nullptr);
4842 assert(getNumArgs() == ArgPack.
pack_size() &&
4843 "Parent bitfields in SubstPackType were overwritten."
4844 "Check NumSubstPackTypeBits.");
4847Decl *SubstTemplateTypeParmPackType::getAssociatedDecl()
const {
4848 return AssociatedDeclAndFinal.getPointer();
4851bool SubstTemplateTypeParmPackType::getFinal()
const {
4852 return AssociatedDeclAndFinal.getInt();
4856SubstTemplateTypeParmPackType::getReplacedParameter()
const {
4861IdentifierInfo *SubstTemplateTypeParmPackType::getIdentifier()
const {
4862 return getReplacedParameter()->getIdentifier();
4865void SubstTemplateTypeParmPackType::Profile(llvm::FoldingSetNodeID &ID) {
4866 Profile(ID, getAssociatedDecl(),
getIndex(), getFinal(), getArgumentPack());
4869void SubstTemplateTypeParmPackType::Profile(llvm::FoldingSetNodeID &ID,
4870 const Decl *AssociatedDecl,
4871 unsigned Index,
bool Final,
4873 ID.AddPointer(AssociatedDecl);
4874 ID.AddInteger(Index);
4875 ID.AddBoolean(Final);
4876 SubstPackType::Profile(ID, ArgPack);
4879SubstBuiltinTemplatePackType::SubstBuiltinTemplatePackType(
4881 : SubstPackType(SubstBuiltinTemplatePack, Canon, ArgPack) {}
4883bool TemplateSpecializationType::anyDependentTemplateArguments(
4886 return anyDependentTemplateArguments(Args.
arguments(), Converted);
4889bool TemplateSpecializationType::anyDependentTemplateArguments(
4892 if (Arg.isDependent())
4897bool TemplateSpecializationType::anyInstantiationDependentTemplateArguments(
4900 if (ArgLoc.getArgument().isInstantiationDependent())
4909 ? TypeDependence::DependentInstantiation
4914 D |= TypeDependence::UnexpandedPack;
4916 D |= (Underlying->
getDependence() & TypeDependence::UnexpandedPack);
4921TemplateSpecializationType::TemplateSpecializationType(
4925 Underlying.isNull() ?
QualType(this, 0)
4926 : Underlying.getCanonicalType(),
4929 TemplateSpecializationTypeBits.NumArgs = Args.size();
4930 TemplateSpecializationTypeBits.TypeAlias = IsAlias;
4932 auto *TemplateArgs =
4944 ~TypeDependence::Dependent);
4946 addDependence(Arg.getAsType()->getDependence() &
4947 TypeDependence::VariablyModified);
4954 *
reinterpret_cast<QualType *
>(TemplateArgs) = Underlying;
4957QualType TemplateSpecializationType::getAliasedType()
const {
4958 assert(isTypeAlias() &&
"not a type alias template specialization");
4959 return *
reinterpret_cast<const QualType *
>(template_arguments().end());
4962bool clang::TemplateSpecializationType::isSugared()
const {
4963 return !isDependentType() || isCurrentInstantiation() || isTypeAlias() ||
4968void TemplateSpecializationType::Profile(llvm::FoldingSetNodeID &ID,
4970 Profile(ID, getKeyword(),
Template, template_arguments(),
4971 isSugared() ? desugar() :
QualType(), Ctx);
4974void TemplateSpecializationType::Profile(llvm::FoldingSetNodeID &ID,
4980 ID.AddInteger(llvm::to_underlying(
Keyword));
4984 ID.AddInteger(Args.size());
4986 Arg.Profile(ID, Context);
4994 return Context.getQualifiedType(QT, *
this);
4998 const Type *
T)
const {
5002 return Context.getQualifiedType(
T, *
this);
5005void ObjCObjectTypeImpl::Profile(llvm::FoldingSetNodeID &ID,
QualType BaseType,
5009 ID.AddPointer(BaseType.getAsOpaquePtr());
5010 ID.AddInteger(typeArgs.size());
5011 for (
auto typeArg : typeArgs)
5012 ID.AddPointer(typeArg.getAsOpaquePtr());
5013 ID.AddInteger(protocols.size());
5014 for (
auto *proto : protocols)
5015 ID.AddPointer(proto);
5016 ID.AddBoolean(isKindOf);
5019void ObjCObjectTypeImpl::Profile(llvm::FoldingSetNodeID &ID) {
5020 Profile(ID, getBaseType(), getTypeArgsAsWritten(),
5022 isKindOfTypeAsWritten());
5028class CachedProperties {
5033 CachedProperties(
Linkage L,
bool local) : L(L), local(local) {}
5035 Linkage getLinkage()
const {
return L; }
5036 bool hasLocalOrUnnamedType()
const {
return local; }
5038 friend CachedProperties
merge(CachedProperties L, CachedProperties R) {
5040 return CachedProperties(MergedLinkage, L.hasLocalOrUnnamedType() ||
5041 R.hasLocalOrUnnamedType());
5060 return CachedProperties(
T->TypeBits.getLinkage(),
5061 T->TypeBits.hasLocalOrUnnamedType());
5066 if (
T->TypeBits.isCacheValid())
5071 if (!
T->isCanonicalUnqualified()) {
5072 const Type *CT =
T->getCanonicalTypeInternal().getTypePtr();
5074 T->TypeBits.CacheValid =
true;
5075 T->TypeBits.CachedLinkage = CT->
TypeBits.CachedLinkage;
5076 T->TypeBits.CachedLocalOrUnnamed = CT->
TypeBits.CachedLocalOrUnnamed;
5082 T->TypeBits.CacheValid =
true;
5083 T->TypeBits.CachedLinkage = llvm::to_underlying(
Result.getLinkage());
5084 T->TypeBits.CachedLocalOrUnnamed =
Result.hasLocalOrUnnamedType();
5102 switch (
T->getTypeClass()) {
5103#define TYPE(Class, Base)
5104#define NON_CANONICAL_TYPE(Class, Base) case Type::Class:
5105#include "clang/AST/TypeNodes.inc"
5106 llvm_unreachable(
"didn't expect a non-canonical type here");
5108#define TYPE(Class, Base)
5109#define DEPENDENT_TYPE(Class, Base) case Type::Class:
5110#define NON_CANONICAL_UNLESS_DEPENDENT_TYPE(Class, Base) case Type::Class:
5111#include "clang/AST/TypeNodes.inc"
5113 assert(
T->isInstantiationDependentType());
5117 case Type::DeducedTemplateSpecialization:
5131 const auto *Tag =
cast<TagType>(
T)->getDecl()->getDefinitionOrSelf();
5137 Linkage L = Tag->getLinkageInternal();
5138 bool IsLocalOrUnnamed = Tag->getDeclContext()->isFunctionOrMethod() ||
5139 !Tag->hasNameForLinkage();
5140 return CachedProperties(L, IsLocalOrUnnamed);
5150 case Type::BlockPointer:
5152 case Type::LValueReference:
5153 case Type::RValueReference:
5155 case Type::MemberPointer: {
5157 CachedProperties Cls = [&] {
5158 if (MPT->isSugared())
5160 return Cache::get(MPT->getQualifier().getAsType());
5162 return merge(Cls,
Cache::get(MPT->getPointeeType()));
5164 case Type::ConstantArray:
5165 case Type::IncompleteArray:
5166 case Type::VariableArray:
5167 case Type::ArrayParameter:
5170 case Type::ExtVector:
5172 case Type::ConstantMatrix:
5174 case Type::FunctionNoProto:
5176 case Type::FunctionProto: {
5178 CachedProperties result =
Cache::get(FPT->getReturnType());
5179 for (
const auto &ai : FPT->param_types())
5183 case Type::ObjCInterface: {
5185 return CachedProperties(L,
false);
5187 case Type::ObjCObject:
5189 case Type::ObjCObjectPointer:
5195 case Type::HLSLAttributedResource:
5197 case Type::HLSLInlineSpirv:
5199 case Type::OverflowBehavior:
5203 llvm_unreachable(
"unhandled type class");
5214 return TypeBits.hasLocalOrUnnamedType();
5218 switch (
T->getTypeClass()) {
5219#define TYPE(Class, Base)
5220#define NON_CANONICAL_TYPE(Class, Base) case Type::Class:
5221#include "clang/AST/TypeNodes.inc"
5222 llvm_unreachable(
"didn't expect a non-canonical type here");
5224#define TYPE(Class, Base)
5225#define DEPENDENT_TYPE(Class, Base) case Type::Class:
5226#define NON_CANONICAL_UNLESS_DEPENDENT_TYPE(Class, Base) case Type::Class:
5227#include "clang/AST/TypeNodes.inc"
5229 assert(
T->isInstantiationDependentType());
5237 case Type::DeducedTemplateSpecialization:
5249 case Type::BlockPointer:
5251 case Type::LValueReference:
5252 case Type::RValueReference:
5254 case Type::MemberPointer: {
5257 if (
auto *D = MPT->getMostRecentCXXRecordDecl()) {
5265 case Type::ConstantArray:
5266 case Type::IncompleteArray:
5267 case Type::VariableArray:
5268 case Type::ArrayParameter:
5271 case Type::ExtVector:
5273 case Type::ConstantMatrix:
5276 case Type::FunctionNoProto:
5278 case Type::FunctionProto: {
5281 for (
const auto &ai : FPT->param_types())
5285 case Type::ObjCInterface:
5287 case Type::ObjCObject:
5289 case Type::ObjCObjectPointer:
5296 case Type::OverflowBehavior:
5299 case Type::HLSLAttributedResource:
5302 case Type::HLSLInlineSpirv:
5306 llvm_unreachable(
"unhandled type class");
5320 if (!
T->isCanonicalUnqualified())
5334 while (
const auto *AT =
Type->getAs<AttributedType>()) {
5337 if (
auto Nullability = AT->getImmediateNullability())
5340 Type = AT->getEquivalentType();
5342 return std::nullopt;
5348 switch (
type->getTypeClass()) {
5349#define NON_CANONICAL_TYPE(Class, Parent) \
5352 llvm_unreachable("non-canonical type");
5353#define TYPE(Class, Parent)
5354#include "clang/AST/TypeNodes.inc"
5358 case Type::BlockPointer:
5359 case Type::MemberPointer:
5360 case Type::ObjCObjectPointer:
5364 case Type::UnresolvedUsing:
5365 case Type::TypeOfExpr:
5367 case Type::Decltype:
5368 case Type::PackIndexing:
5369 case Type::UnaryTransform:
5370 case Type::TemplateTypeParm:
5371 case Type::SubstTemplateTypeParmPack:
5372 case Type::SubstBuiltinTemplatePack:
5373 case Type::DependentName:
5375 return ResultIfUnknown;
5378 case Type::TemplateSpecialization:
5383 .getAsTemplateDecl())
5384 if (
auto *CTD = dyn_cast<ClassTemplateDecl>(templateDecl))
5385 return llvm::any_of(
5387 return RTD->getTemplatedDecl()->hasAttr<TypeNullableAttr>();
5389 return ResultIfUnknown;
5394#define SIGNED_TYPE(Id, SingletonId) case BuiltinType::Id:
5395#define UNSIGNED_TYPE(Id, SingletonId) case BuiltinType::Id:
5396#define FLOATING_TYPE(Id, SingletonId) case BuiltinType::Id:
5397#define BUILTIN_TYPE(Id, SingletonId)
5398#include "clang/AST/BuiltinTypes.def"
5401 case BuiltinType::UnresolvedTemplate:
5403 case BuiltinType::Dependent:
5404 case BuiltinType::Overload:
5405 case BuiltinType::BoundMember:
5406 case BuiltinType::PseudoObject:
5407 case BuiltinType::UnknownAny:
5408 case BuiltinType::ARCUnbridgedCast:
5409 return ResultIfUnknown;
5411 case BuiltinType::Void:
5412 case BuiltinType::ObjCId:
5413 case BuiltinType::ObjCClass:
5414 case BuiltinType::ObjCSel:
5415#define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \
5416 case BuiltinType::Id:
5417#include "clang/Basic/OpenCLImageTypes.def"
5418#define EXT_OPAQUE_TYPE(ExtType, Id, Ext) case BuiltinType::Id:
5419#include "clang/Basic/OpenCLExtensionTypes.def"
5420 case BuiltinType::OCLSampler:
5421 case BuiltinType::OCLEvent:
5422 case BuiltinType::OCLClkEvent:
5423 case BuiltinType::OCLQueue:
5424 case BuiltinType::OCLReserveID:
5425#define SVE_TYPE(Name, Id, SingletonId) case BuiltinType::Id:
5426#include "clang/Basic/AArch64ACLETypes.def"
5427#define PPC_VECTOR_TYPE(Name, Id, Size) case BuiltinType::Id:
5428#include "clang/Basic/PPCTypes.def"
5429#define RVV_TYPE(Name, Id, SingletonId) case BuiltinType::Id:
5430#include "clang/Basic/RISCVVTypes.def"
5431#define WASM_TYPE(Name, Id, SingletonId) case BuiltinType::Id:
5432#include "clang/Basic/WebAssemblyReferenceTypes.def"
5433#define AMDGPU_TYPE(Name, Id, SingletonId, Width, Align) case BuiltinType::Id:
5434#include "clang/Basic/AMDGPUTypes.def"
5435#define HLSL_INTANGIBLE_TYPE(Name, Id, SingletonId) case BuiltinType::Id:
5436#include "clang/Basic/HLSLIntangibleTypes.def"
5437#define HLSL_PACKED_TYPE(Name, Id, SingletonId) case BuiltinType::Id:
5438#include "clang/Basic/HLSLPackedTypes.def"
5439#define SPIRV_TYPE(Name, Id, SingletonId) case BuiltinType::Id:
5440#include "clang/Basic/SPIRVTypes.def"
5441 case BuiltinType::BuiltinFn:
5442 case BuiltinType::NullPtr:
5443 case BuiltinType::MetaInfo:
5444 case BuiltinType::IncompleteMatrixIdx:
5445 case BuiltinType::ArraySection:
5446 case BuiltinType::OMPArrayShaping:
5447 case BuiltinType::OMPIterator:
5450 llvm_unreachable(
"unknown builtin type");
5452 case Type::Record: {
5456 if (
const auto *CTSD = dyn_cast<ClassTemplateSpecializationDecl>(RD))
5457 return llvm::any_of(
5458 CTSD->getSpecializedTemplate()->redecls(),
5460 return RTD->getTemplatedDecl()->hasAttr<TypeNullableAttr>();
5463 return RD->hasAttr<TypeNullableAttr>();
5469 case Type::LValueReference:
5470 case Type::RValueReference:
5471 case Type::ConstantArray:
5472 case Type::IncompleteArray:
5473 case Type::VariableArray:
5474 case Type::DependentSizedArray:
5475 case Type::DependentVector:
5476 case Type::DependentSizedExtVector:
5478 case Type::ExtVector:
5479 case Type::ConstantMatrix:
5480 case Type::DependentSizedMatrix:
5481 case Type::DependentAddressSpace:
5482 case Type::FunctionProto:
5483 case Type::FunctionNoProto:
5484 case Type::DeducedTemplateSpecialization:
5486 case Type::InjectedClassName:
5487 case Type::PackExpansion:
5488 case Type::ObjCObject:
5489 case Type::ObjCInterface:
5493 case Type::DependentBitInt:
5494 case Type::ArrayParameter:
5495 case Type::HLSLAttributedResource:
5496 case Type::HLSLInlineSpirv:
5497 case Type::OverflowBehavior:
5500 llvm_unreachable(
"bad type kind!");
5504 if (getAttrKind() == attr::TypeNonNull)
5506 if (getAttrKind() == attr::TypeNullable)
5508 if (getAttrKind() == attr::TypeNullUnspecified)
5510 if (getAttrKind() == attr::TypeNullableResult)
5512 return std::nullopt;
5517 if (
auto MacroTy = dyn_cast<MacroQualifiedType>(
T))
5518 AttrTy = MacroTy->getUnderlyingType();
5520 if (
auto attributed = dyn_cast<AttributedType>(AttrTy)) {
5521 if (
auto nullability = attributed->getImmediateNullability()) {
5522 T = attributed->getModifiedType();
5527 return std::nullopt;
5530void AttributedType::Profile(llvm::FoldingSetNodeID &ID,
const ASTContext &Ctx,
5533 ID.AddInteger(attrKind);
5537 attr->Profile(ID, Ctx);
5551 if (objcPtr->isObjCIdType()) {
5562 }
else if (objcPtr->isObjCQualifiedIdType()) {
5587 "cannot query implicit lifetime for non-inferrable type");
5592 while (
const auto *array = dyn_cast<ArrayType>(canon))
5593 canon = array->getElementType().getTypePtr();
5595 if (
const auto *
opt = dyn_cast<ObjCObjectPointerType>(canon)) {
5597 if (
opt->getObjectType()->isObjCClass())
5606 return typedefType->getDecl()->hasAttr<ObjCNSObjectAttr>();
5612 return typedefType->getDecl()->hasAttr<ObjCIndependentClassAttr>();
5625 return OPT->getPointeeType()->isObjCIndirectLifetimeType();
5627 return Ref->getPointeeType()->isObjCIndirectLifetimeType();
5629 return MemPtr->getPointeeType()->isObjCIndirectLifetimeType();
5637 while (
const ArrayType *array =
type->getAsArrayTypeUnsafe())
5638 type = array->getElementType().getTypePtr();
5639 return type->isObjCRetainableType();
5661 return RT->getDecl()
5662 ->getMostRecentDecl()
5663 ->hasAttr<CUDADeviceBuiltinSurfaceTypeAttr>();
5670 return RT->getDecl()
5671 ->getMostRecentDecl()
5672 ->hasAttr<CUDADeviceBuiltinTextureTypeAttr>();
5684 if (
const auto *BT = dyn_cast<BuiltinType>(Ty))
5685 return BT->getKind() == BuiltinType::AMDGPUNamedWorkgroupBarrier;
5686 if (AllowWrappers) {
5687 if (
const auto *RT = dyn_cast<RecordType>(Ty))
5688 return RT->getDecl()->hasAttr<AMDGPUNamedBarrierWrapperAttr>();
5706 return ptr->getPointeeType()->hasSizedVLAType();
5708 return ref->getPointeeType()->hasSizedVLAType();
5714 return arr->getElementType()->hasSizedVLAType();
5721 return HLSLAttributedResourceType::findHandleTypeOnResource(
this) !=
nullptr;
5744 const RecordType *RT =
5750 assert(RD !=
nullptr &&
5751 "all HLSL structs and classes should be CXXRecordDecl");
5758 if (
const auto *RD =
5760 if (!RD->isHLSLBuiltinRecord() && RD->isStandardLayout())
5767 switch (
type.getObjCLifetime()) {
5779 if (
const auto *RD =
type->getBaseElementTypeUnsafe()->getAsRecordDecl()) {
5780 if (
const auto *CXXRD = dyn_cast<CXXRecordDecl>(RD)) {
5782 if (CXXRD->hasDefinition() && !CXXRD->hasTrivialDestructor())
5797 llvm::SmallPtrSetImpl<const Decl *> &Seen) {
5798 if (
const auto *Arr = Context.getAsArrayType(Ty))
5799 Ty = Context.getBaseElementType(Arr);
5801 if (
const auto *AttrTy = Ty->
getAs<AttributedType>())
5802 Ty = AttrTy->getModifiedType();
5805 "Incomplete types cannot be evaluated for laundering");
5812 if (!Seen.insert(
Record).second)
5815 if (
Record->isDynamicClass())
5841 Qualifier.Profile(ID);
5853 auto *RD = getCXXRecordDecl();
5860 llvm::APSInt Val,
unsigned Scale) {
5861 llvm::FixedPointSemantics FXSema(Val.getBitWidth(), Scale, Val.isSigned(),
5864 llvm::APFixedPoint(Val, FXSema).toString(Str);
5867DeducedType::DeducedType(TypeClass TC,
DeducedKind DK,
5870 ? DeducedAsTypeOrCanon.getCanonicalType()
5871 : DeducedAsTypeOrCanon,
5873 DeducedTypeBits.Kind = llvm::to_underlying(DK);
5878 assert(!DeducedAsTypeOrCanon.
isNull() &&
"Deduced type cannot be null");
5880 ~TypeDependence::VariablyModified);
5881 DeducedAsType = DeducedAsTypeOrCanon;
5884 addDependence(TypeDependence::UnexpandedPack);
5887 addDependence(TypeDependence::DependentInstantiation);
5890 assert(getDeducedKind() == DK &&
"DeducedKind does not match the type state");
5896 : DeducedType(
Auto, DK, DeducedAsTypeOrCanon) {
5897 AutoTypeBits.Keyword = llvm::to_underlying(
Keyword);
5898 AutoTypeBits.NumArgs = TypeConstraintArgs.size();
5899 this->TypeConstraintConcept = TypeConstraintConcept;
5900 assert(!TypeConstraintConcept.
isNull() || AutoTypeBits.NumArgs == 0);
5901 if (!TypeConstraintConcept.
isNull()) {
5903 "type-constraint does not name a concept");
5920void AutoType::Profile(llvm::FoldingSetNodeID &ID,
const ASTContext &Context,
5924 DeducedType::Profile(ID, DK,
Deduced);
5925 ID.AddInteger(llvm::to_underlying(
Keyword));
5928 Arg.Profile(ID, Context);
5931void AutoType::Profile(llvm::FoldingSetNodeID &ID,
const ASTContext &Context) {
5932 Profile(ID, Context, getDeducedKind(), getDeducedType(), getKeyword(),
5933 getTypeConstraintConcept(), getTypeConstraintArguments());
5947 llvm_unreachable(
"unknown effect kind");
5953 return "nonblocking";
5955 return "nonallocating";
5959 return "allocating";
5961 llvm_unreachable(
"unknown effect kind");
5977 return std::nullopt;
5982 assert(0 &&
"effectProhibitingInference with non-inferable effect kind");
5985 llvm_unreachable(
"unknown effect kind");
5995 const Kind EK = Effect.kind();
5997 if (EK == CallerKind ||
6008 llvm_unreachable(
"unknown effect kind");
6020 unsigned InsertIdx = Effects.size();
6035 Errs.push_back({EC, NewEC});
6046 if (NewCondition || !Conditions.empty()) {
6047 if (Conditions.empty() && !Effects.empty())
6048 Conditions.resize(Effects.size());
6049 Conditions.insert(Conditions.begin() + InsertIdx,
6052 Effects.insert(Effects.begin() + InsertIdx, NewEC.
Effect);
6057 for (
const auto &Item :
Set)
6059 return Errs.empty();
6070 auto IterA = LHS.
begin(), EndA = LHS.
end();
6071 auto IterB = RHS.
begin(), EndB = RHS.
end();
6075 return std::tuple(LHS.Effect,
uintptr_t(LHS.Cond.getCondition())) <
6076 std::tuple(RHS.Effect,
uintptr_t(RHS.Cond.getCondition()));
6079 while (IterA != EndA && IterB != EndB) {
6084 else if (FEWCLess(B, A))
6095 assert(Errs.empty() &&
"conflict shouldn't be possible in getIntersection");
6108 Combined.
insert(RHS, Errs);
6129 llvm::interleaveComma(*
this, OS);
6139 llvm::interleaveComma(*
this, OS);
6146 assert(llvm::is_sorted(FX) &&
"effects should be sorted");
6147 assert((Conds.empty() || Conds.size() == FX.size()) &&
6148 "effects size should match conditions size");
6154 if (
Cond.getCondition() !=
nullptr)
6160HLSLAttributedResourceType::computeDependence(
QualType Contained,
6161 const Attributes &Attrs) {
6165 if (Attrs.SampleCountExpr)
6170HLSLAttributedResourceType::HLSLAttributedResourceType(
QualType Wrapped,
6172 const Attributes &Attrs)
6175 WrappedType(Wrapped), ContainedType(Contained), Attrs(Attrs) {}
6177void HLSLAttributedResourceType::Profile(llvm::FoldingSetNodeID &ID,
6180 const Attributes &Attrs) {
6183 ID.AddInteger(
static_cast<uint32_t>(Attrs.ResourceClass));
6184 ID.AddInteger(
static_cast<uint32_t>(Attrs.ResourceDimension));
6185 ID.AddBoolean(Attrs.IsROV);
6186 ID.AddBoolean(Attrs.RawBuffer);
6187 ID.AddBoolean(Attrs.IsCounter);
6188 ID.AddBoolean(Attrs.IsArray);
6189 ID.AddBoolean(Attrs.SampleCountExpr !=
nullptr);
6190 if (Attrs.SampleCountExpr)
6191 Attrs.SampleCountExpr->Profile(ID, Ctx,
true);
6194const HLSLAttributedResourceType *
6195HLSLAttributedResourceType::findHandleTypeOnResource(
const Type *RT) {
6200 if (!RD->
fields().empty()) {
6201 const auto &FirstFD = RD->
fields().begin();
6202 return dyn_cast<HLSLAttributedResourceType>(
6203 FirstFD->getType().getTypePtr());
6209StringRef PredefinedSugarType::getName(Kind KD) {
6214 return "__signed_size_t";
6216 return "__ptrdiff_t";
6218 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)
An expression that occurs in a constant context and the result of evaluating the expression.
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
bool isComplete() const
Returns true if this can be considered a complete type.
bool isFixed() const
Returns true if this is an Objective-C, C++11, or Microsoft-style enumeration with a fixed underlying...
QualType getIntegerType() const
Return the integer type this enum decl corresponds to.
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
bool isMetaInfoType() 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.
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)
@ 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)
@ 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...
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.