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) &&
114 if (
const auto *DNT = ty->
getAs<DependentNameType>())
118 if (
const auto *TT = ty->
getAs<TagType>())
136 switch (
T->getTypeClass()) {
142 case Type::BlockPointer:
145 case Type::MemberPointer:
148 case Type::LValueReference:
149 case Type::RValueReference:
152 case Type::PackExpansion:
156 case Type::ConstantArray:
157 case Type::DependentSizedArray:
158 case Type::IncompleteArray:
159 case Type::VariableArray:
160 case Type::FunctionProto:
161 case Type::FunctionNoProto:
178 if (
T.isConstQualified())
182 return AT->getElementType().isConstant(Ctx);
187std::optional<QualType::NonConstantStorageReason>
190 if (!
isConstant(Ctx) && !(*this)->isReferenceType())
198 if (
Record->hasMutableFields())
200 if (!
Record->hasTrivialDestructor() && !ExcludeDtor)
226 (tc == DependentSizedArray
236 const llvm::APInt &Sz,
const Expr *SzExpr,
238 bool NeedsExternalSize = SzExpr !=
nullptr || Sz.ugt(0x0FFFFFFFFFFFFFFF) ||
239 Sz.getBitWidth() > 0xFF;
240 if (!NeedsExternalSize)
242 ET, Can, Sz.getBitWidth(), Sz.getZExtValue(), SzMod, Qual);
244 auto *SzPtr =
new (Ctx,
alignof(ConstantArrayType::ExternalSize))
245 ConstantArrayType::ExternalSize(Sz, SzExpr);
253 const llvm::APInt &NumElements) {
254 uint64_t ElementSize = Context.getTypeSizeInChars(ElementType).getQuantity();
262 if (llvm::isPowerOf2_64(ElementSize)) {
263 return NumElements.getActiveBits() + llvm::Log2_64(ElementSize);
268 if ((ElementSize >> 32) == 0 && NumElements.getBitWidth() <= 64 &&
269 (NumElements.getZExtValue() >> 32) == 0) {
270 uint64_t TotalSize = NumElements.getZExtValue() * ElementSize;
271 return llvm::bit_width(TotalSize);
275 llvm::APSInt SizeExtended(NumElements,
true);
276 unsigned SizeTypeBits = Context.getTypeSize(Context.getSizeType());
277 SizeExtended = SizeExtended.extend(
278 std::max(SizeTypeBits, SizeExtended.getBitWidth()) * 2);
280 llvm::APSInt TotalSize(llvm::APInt(SizeExtended.getBitWidth(), ElementSize));
281 TotalSize *= SizeExtended;
283 return TotalSize.getActiveBits();
292 unsigned Bits = Context.getTypeSize(Context.getSizeType());
305 uint64_t ArraySize,
const Expr *SizeExpr,
308 ID.AddInteger(ArraySize);
309 ID.AddInteger(llvm::to_underlying(SizeMod));
310 ID.AddInteger(TypeQuals);
311 ID.AddBoolean(SizeExpr !=
nullptr);
313 SizeExpr->
Profile(ID, Context,
true);
325 :
ArrayType(DependentSizedArray, et, can, sm, tq, e), SizeExpr((
Stmt *)e) {}
330 unsigned TypeQuals,
Expr *E) {
332 ID.AddInteger(llvm::to_underlying(SizeMod));
333 ID.AddInteger(TypeQuals);
338DependentVectorType::DependentVectorType(
QualType ElementType,
341 :
Type(DependentVector, CanonType,
343 ElementType->getDependence() |
346 ElementType(ElementType), SizeExpr(SizeExpr), Loc(Loc) {
354 ID.AddPointer(ElementType.getAsOpaquePtr());
355 ID.AddInteger(llvm::to_underlying(VecKind));
356 SizeExpr->Profile(ID, Context,
true);
359DependentSizedExtVectorType::DependentSizedExtVectorType(
QualType ElementType,
363 :
Type(DependentSizedExtVector, can,
365 ElementType->getDependence() |
368 SizeExpr(SizeExpr), ElementType(ElementType), loc(loc) {}
374 ID.AddPointer(ElementType.getAsOpaquePtr());
375 SizeExpr->Profile(ID, Context,
true);
378DependentAddressSpaceType::DependentAddressSpaceType(
QualType PointeeType,
382 :
Type(DependentAddressSpace, can,
384 PointeeType->getDependence() |
387 AddrSpaceExpr(AddrSpaceExpr), PointeeType(PointeeType), loc(loc) {}
392 Expr *AddrSpaceExpr) {
393 ID.AddPointer(PointeeType.getAsOpaquePtr());
394 AddrSpaceExpr->Profile(ID, Context,
true);
398 const Expr *RowExpr,
const Expr *ColumnExpr)
399 :
Type(tc, canonType,
416 unsigned nColumns,
QualType canonType)
421 unsigned nRows,
unsigned nColumns,
426DependentSizedMatrixType::DependentSizedMatrixType(
QualType ElementType,
431 :
MatrixType(DependentSizedMatrix, ElementType, CanonicalType, RowExpr,
433 RowExpr(RowExpr), ColumnExpr(ColumnExpr), loc(loc) {}
440 RowExpr->Profile(ID, CTX,
true);
441 ColumnExpr->Profile(ID, CTX,
true);
468 ExprAndUnsigned(NumBitsExpr, IsUnsigned) {}
471 return ExprAndUnsigned.getInt();
475 return ExprAndUnsigned.getPointer();
481 ID.AddBoolean(IsUnsigned);
482 NumBitsExpr->
Profile(ID, Context,
true);
494 bool CountInBytes,
bool OrNull) {
495 ID.AddPointer(WrappedTy.getAsOpaquePtr());
496 ID.AddBoolean(CountInBytes);
497 ID.AddBoolean(OrNull);
502 ID.AddPointer(CountExpr);
510 if (
const auto *ATy = dyn_cast<ArrayType>(
this))
511 return ATy->getElementType().getTypePtr();
539 return Context.getQualifiedType(desugar,
split.
Quals);
545#define TYPE(CLASS, BASE) \
546 static_assert(!std::is_polymorphic<CLASS##Type>::value, \
547 #CLASS "Type should not be polymorphic!");
548#include "clang/AST/TypeNodes.inc"
553#define TYPE(CLASS, BASE) \
554 static_assert(std::is_trivially_destructible<CLASS##Type>::value, \
555 #CLASS "Type should be trivially destructible!");
556#include "clang/AST/TypeNodes.inc"
560#define ABSTRACT_TYPE(Class, Parent)
561#define TYPE(Class, Parent) \
562 case Type::Class: { \
563 const auto *ty = cast<Class##Type>(this); \
564 if (!ty->isSugared()) \
565 return QualType(ty, 0); \
566 return ty->desugar(); \
568#include "clang/AST/TypeNodes.inc"
570 llvm_unreachable(
"bad type kind!");
580#define ABSTRACT_TYPE(Class, Parent)
581#define TYPE(Class, Parent) \
582 case Type::Class: { \
583 const auto *Ty = cast<Class##Type>(CurTy); \
584 if (!Ty->isSugared()) \
585 return SplitQualType(Ty, Qs); \
586 Cur = Ty->desugar(); \
589#include "clang/AST/TypeNodes.inc"
598 Qualifiers quals =
split.Quals;
601 const Type *lastTypeWithQuals =
split.Ty;
608 switch (
split.Ty->getTypeClass()) {
609#define ABSTRACT_TYPE(Class, Parent)
610#define TYPE(Class, Parent) \
611 case Type::Class: { \
612 const auto *ty = cast<Class##Type>(split.Ty); \
613 if (!ty->isSugared()) \
615 next = ty->desugar(); \
618#include "clang/AST/TypeNodes.inc"
624 if (!
split.Quals.empty()) {
625 lastTypeWithQuals =
split.Ty;
631 return SplitQualType(lastTypeWithQuals, quals);
636 while (
const auto *PT =
T->
getAs<ParenType>())
637 T = PT->getInnerType();
646 if (
const auto *Sugar = dyn_cast<T>(Cur))
649#define ABSTRACT_TYPE(Class, Parent)
650#define TYPE(Class, Parent) \
651 case Type::Class: { \
652 const auto *Ty = cast<Class##Type>(Cur); \
653 if (!Ty->isSugared()) \
655 Cur = Ty->desugar().getTypePtr(); \
658#include "clang/AST/TypeNodes.inc"
671template <>
const TemplateSpecializationType *
Type::getAs()
const {
691 const Type *Cur =
this;
695#define ABSTRACT_TYPE(Class, Parent)
696#define TYPE(Class, Parent) \
698 const auto *Ty = cast<Class##Type>(Cur); \
699 if (!Ty->isSugared()) \
701 Cur = Ty->desugar().getTypePtr(); \
704#include "clang/AST/TypeNodes.inc"
711 return RT->getDecl()->isClass();
717 return RT->getDecl()->isStruct();
725 const auto *
Decl = RT->getDecl();
726 if (!
Decl->isStruct())
728 return Decl->getDefinitionOrSelf()->hasFlexibleArrayMember();
733 return RD->hasAttr<ObjCBoxableAttr>();
739 return RT->getDecl()->isInterface();
745 return RT->getDecl()->isStructureOrClass();
751 return PT->getPointeeType()->isVoidType();
757 return RT->getDecl()->isUnion();
763 return CT->getElementType()->isFloatingType();
774 return ET->getDecl()->isScoped();
784 if (
Complex->getElementType()->isIntegerType())
807 if (
const auto *RT = dyn_cast<RecordType>(
this)) {
808 if (RT->getDecl()->isStruct())
813 if (
const auto *RT = dyn_cast<RecordType>(CanonicalType)) {
814 if (!RT->getDecl()->isStruct())
826 if (
const auto *RT = dyn_cast<RecordType>(
this)) {
827 if (RT->getDecl()->isUnion())
832 if (
const auto *RT = dyn_cast<RecordType>(CanonicalType)) {
833 if (!RT->getDecl()->isUnion())
853 if (OPT->isObjCIdType())
857 if (!OPT->isKindOfType())
861 if (OPT->isObjCClassType() || OPT->isObjCQualifiedClassType())
865 bound = OPT->getObjectType()
866 ->stripObjCKindOfTypeAndQuals(ctx)
877 if (OPT->isObjCClassType())
881 if (!OPT->isKindOfType())
885 return OPT->isObjCClassType() || OPT->isObjCQualifiedClassType();
892 initialize(protocols);
899 :
Type(ObjCObject, Canonical,
Base->getDependence()), BaseType(
Base) {
903 assert(getTypeArgsAsWritten().size() == typeArgs.size() &&
904 "bitfield overflow in type argument count");
905 if (!typeArgs.empty())
906 memcpy(getTypeArgStorage(), typeArgs.data(),
907 typeArgs.size() *
sizeof(
QualType));
909 for (
auto typeArg : typeArgs) {
910 addDependence(typeArg->getDependence() & ~TypeDependence::VariablyModified);
914 initialize(protocols);
917bool ObjCObjectType::isSpecialized()
const {
919 if (ObjCObjectTypeBits.NumTypeArgs > 0)
923 if (
const auto objcObject =
getBaseType()->getAs<ObjCObjectType>()) {
928 return objcObject->isSpecialized();
937 if (isSpecializedAsWritten())
938 return getTypeArgsAsWritten();
941 if (
const auto objcObject =
getBaseType()->getAs<ObjCObjectType>()) {
946 return objcObject->getTypeArgs();
953bool ObjCObjectType::isKindOfType()
const {
954 if (isKindOfTypeAsWritten())
958 if (
const auto objcObject =
getBaseType()->getAs<ObjCObjectType>()) {
963 return objcObject->isKindOfType();
971ObjCObjectType::stripObjCKindOfTypeAndQuals(
const ASTContext &ctx)
const {
972 if (!isKindOfType() && qual_empty())
978 if (
const auto *baseObj = splitBaseType.
Ty->
getAs<ObjCObjectType>())
979 baseType = baseObj->stripObjCKindOfTypeAndQuals(ctx);
983 getTypeArgsAsWritten(),
1008template <
typename Derived>
1009struct SimpleTransformVisitor :
public TypeVisitor<Derived, QualType> {
1017 QualType result =
static_cast<Derived *
>(
this)->Visit(splitType.
Ty);
1027 explicit SimpleTransformVisitor(
ASTContext &ctx) : Ctx(ctx) {}
1031#define TYPE(Class, Base)
1032#define DEPENDENT_TYPE(Class, Base) \
1033 QualType Visit##Class##Type(const Class##Type *T) { return QualType(T, 0); }
1034#include "clang/AST/TypeNodes.inc"
1036#define TRIVIAL_TYPE_CLASS(Class) \
1037 QualType Visit##Class##Type(const Class##Type *T) { return QualType(T, 0); }
1038#define SUGARED_TYPE_CLASS(Class) \
1039 QualType Visit##Class##Type(const Class##Type *T) { \
1040 if (!T->isSugared()) \
1041 return QualType(T, 0); \
1042 QualType desugaredType = recurse(T->desugar()); \
1043 if (desugaredType.isNull()) \
1045 if (desugaredType.getAsOpaquePtr() == T->desugar().getAsOpaquePtr()) \
1046 return QualType(T, 0); \
1047 return desugaredType; \
1053 QualType elementType = recurse(
T->getElementType());
1054 if (elementType.
isNull())
1057 if (elementType.
getAsOpaquePtr() ==
T->getElementType().getAsOpaquePtr())
1063 QualType VisitPointerType(
const PointerType *
T) {
1065 if (pointeeType.
isNull())
1069 return QualType(
T, 0);
1074 QualType VisitBlockPointerType(
const BlockPointerType *
T) {
1076 if (pointeeType.
isNull())
1080 return QualType(
T, 0);
1085 QualType VisitLValueReferenceType(
const LValueReferenceType *
T) {
1086 QualType pointeeType = recurse(
T->getPointeeTypeAsWritten());
1087 if (pointeeType.
isNull())
1091 T->getPointeeTypeAsWritten().getAsOpaquePtr())
1092 return QualType(
T, 0);
1097 QualType VisitRValueReferenceType(
const RValueReferenceType *
T) {
1098 QualType pointeeType = recurse(
T->getPointeeTypeAsWritten());
1099 if (pointeeType.
isNull())
1103 T->getPointeeTypeAsWritten().getAsOpaquePtr())
1104 return QualType(
T, 0);
1109 QualType VisitMemberPointerType(
const MemberPointerType *
T) {
1111 if (pointeeType.
isNull())
1115 return QualType(
T, 0);
1118 T->getMostRecentCXXRecordDecl());
1121 QualType VisitConstantArrayType(
const ConstantArrayType *
T) {
1122 QualType elementType = recurse(
T->getElementType());
1123 if (elementType.
isNull())
1126 if (elementType.
getAsOpaquePtr() ==
T->getElementType().getAsOpaquePtr())
1127 return QualType(
T, 0);
1130 T->getSizeModifier(),
1131 T->getIndexTypeCVRQualifiers());
1134 QualType VisitVariableArrayType(
const VariableArrayType *
T) {
1135 QualType elementType = recurse(
T->getElementType());
1136 if (elementType.
isNull())
1139 if (elementType.
getAsOpaquePtr() ==
T->getElementType().getAsOpaquePtr())
1140 return QualType(
T, 0);
1143 T->getSizeModifier(),
1144 T->getIndexTypeCVRQualifiers());
1147 QualType VisitIncompleteArrayType(
const IncompleteArrayType *
T) {
1148 QualType elementType = recurse(
T->getElementType());
1149 if (elementType.
isNull())
1152 if (elementType.
getAsOpaquePtr() ==
T->getElementType().getAsOpaquePtr())
1153 return QualType(
T, 0);
1156 T->getIndexTypeCVRQualifiers());
1159 QualType VisitVectorType(
const VectorType *
T) {
1160 QualType elementType = recurse(
T->getElementType());
1161 if (elementType.
isNull())
1164 if (elementType.
getAsOpaquePtr() ==
T->getElementType().getAsOpaquePtr())
1165 return QualType(
T, 0);
1168 T->getVectorKind());
1171 QualType VisitExtVectorType(
const ExtVectorType *
T) {
1172 QualType elementType = recurse(
T->getElementType());
1173 if (elementType.
isNull())
1176 if (elementType.
getAsOpaquePtr() ==
T->getElementType().getAsOpaquePtr())
1177 return QualType(
T, 0);
1182 QualType VisitConstantMatrixType(
const ConstantMatrixType *
T) {
1183 QualType elementType = recurse(
T->getElementType());
1184 if (elementType.
isNull())
1186 if (elementType.
getAsOpaquePtr() ==
T->getElementType().getAsOpaquePtr())
1187 return QualType(
T, 0);
1190 T->getNumColumns());
1193 QualType VisitOverflowBehaviorType(
const OverflowBehaviorType *
T) {
1194 QualType UnderlyingType = recurse(
T->getUnderlyingType());
1195 if (UnderlyingType.
isNull())
1199 T->getUnderlyingType().getAsOpaquePtr())
1200 return QualType(
T, 0);
1205 QualType VisitFunctionNoProtoType(
const FunctionNoProtoType *
T) {
1211 return QualType(
T, 0);
1216 QualType VisitFunctionProtoType(
const FunctionProtoType *
T) {
1222 SmallVector<QualType, 4> paramTypes;
1223 bool paramChanged =
false;
1225 QualType newParamType = recurse(paramType);
1226 if (newParamType.
isNull())
1230 paramChanged =
true;
1232 paramTypes.push_back(newParamType);
1237 bool exceptionChanged =
false;
1239 SmallVector<QualType, 4> exceptionTypes;
1240 for (
auto exceptionType :
info.ExceptionSpec.Exceptions) {
1241 QualType newExceptionType = recurse(exceptionType);
1242 if (newExceptionType.
isNull())
1245 if (newExceptionType.
getAsOpaquePtr() != exceptionType.getAsOpaquePtr())
1246 exceptionChanged =
true;
1248 exceptionTypes.push_back(newExceptionType);
1251 if (exceptionChanged) {
1252 info.ExceptionSpec.Exceptions =
1253 llvm::ArrayRef(exceptionTypes).copy(Ctx);
1258 !paramChanged && !exceptionChanged)
1259 return QualType(
T, 0);
1264 QualType VisitParenType(
const ParenType *
T) {
1265 QualType innerType = recurse(
T->getInnerType());
1270 return QualType(
T, 0);
1279 QualType VisitAdjustedType(
const AdjustedType *
T) {
1280 QualType originalType = recurse(
T->getOriginalType());
1281 if (originalType.
isNull())
1284 QualType adjustedType = recurse(
T->getAdjustedType());
1285 if (adjustedType.
isNull())
1289 T->getOriginalType().getAsOpaquePtr() &&
1290 adjustedType.
getAsOpaquePtr() ==
T->getAdjustedType().getAsOpaquePtr())
1291 return QualType(
T, 0);
1296 QualType VisitDecayedType(
const DecayedType *
T) {
1297 QualType originalType = recurse(
T->getOriginalType());
1298 if (originalType.
isNull())
1301 if (originalType.
getAsOpaquePtr() ==
T->getOriginalType().getAsOpaquePtr())
1302 return QualType(
T, 0);
1307 QualType VisitArrayParameterType(
const ArrayParameterType *
T) {
1308 QualType ArrTy = VisitConstantArrayType(
T);
1322 QualType VisitAttributedType(
const AttributedType *
T) {
1323 QualType modifiedType = recurse(
T->getModifiedType());
1324 if (modifiedType.
isNull())
1327 QualType equivalentType = recurse(
T->getEquivalentType());
1328 if (equivalentType.
isNull())
1332 T->getModifiedType().getAsOpaquePtr() &&
1334 T->getEquivalentType().getAsOpaquePtr())
1335 return QualType(
T, 0);
1341 QualType VisitSubstTemplateTypeParmType(
const SubstTemplateTypeParmType *
T) {
1342 QualType replacementType = recurse(
T->getReplacementType());
1343 if (replacementType.
isNull())
1347 T->getReplacementType().getAsOpaquePtr())
1348 return QualType(
T, 0);
1351 replacementType,
T->getAssociatedDecl(),
T->getIndex(),
1352 T->getPackIndex(),
T->getFinal());
1358 QualType VisitAutoType(
const AutoType *
T) {
1359 if (!
T->isDeduced())
1360 return QualType(
T, 0);
1362 QualType deducedType = recurse(
T->getDeducedType());
1363 if (deducedType.
isNull())
1366 if (deducedType ==
T->getDeducedType())
1367 return QualType(
T, 0);
1369 return Ctx.
getAutoType(
T->getDeducedKind(), deducedType,
T->getKeyword(),
1370 T->getTypeConstraintConcept(),
1371 T->getTypeConstraintArguments());
1374 QualType VisitObjCObjectType(
const ObjCObjectType *
T) {
1375 QualType baseType = recurse(
T->getBaseType());
1380 bool typeArgChanged =
false;
1381 SmallVector<QualType, 4> typeArgs;
1382 for (
auto typeArg :
T->getTypeArgsAsWritten()) {
1383 QualType newTypeArg = recurse(typeArg);
1388 typeArgChanged =
true;
1390 typeArgs.push_back(newTypeArg);
1395 return QualType(
T, 0);
1399 llvm::ArrayRef(
T->qual_begin(),
T->getNumProtocols()),
1400 T->isKindOfTypeAsWritten());
1405 QualType VisitObjCObjectPointerType(
const ObjCObjectPointerType *
T) {
1407 if (pointeeType.
isNull())
1411 return QualType(
T, 0);
1416 QualType VisitAtomicType(
const AtomicType *
T) {
1417 QualType valueType = recurse(
T->getValueType());
1422 return QualType(
T, 0);
1427#undef TRIVIAL_TYPE_CLASS
1428#undef SUGARED_TYPE_CLASS
1431struct SubstObjCTypeArgsVisitor
1432 :
public SimpleTransformVisitor<SubstObjCTypeArgsVisitor> {
1433 using BaseType = SimpleTransformVisitor<SubstObjCTypeArgsVisitor>;
1435 ArrayRef<QualType> TypeArgs;
1438 SubstObjCTypeArgsVisitor(ASTContext &ctx, ArrayRef<QualType> typeArgs,
1440 : BaseType(ctx), TypeArgs(typeArgs), SubstContext(context) {}
1442 QualType VisitObjCTypeParamType(
const ObjCTypeParamType *OTPTy) {
1445 ObjCTypeParamDecl *typeParam = OTPTy->getDecl();
1447 if (!TypeArgs.empty()) {
1448 QualType argType = TypeArgs[typeParam->
getIndex()];
1449 if (OTPTy->qual_empty())
1454 SmallVector<ObjCProtocolDecl *, 8> protocolsVec;
1455 protocolsVec.append(OTPTy->qual_begin(), OTPTy->qual_end());
1456 ArrayRef<ObjCProtocolDecl *> protocolsToApply = protocolsVec;
1458 argType, protocolsToApply, hasError,
true );
1461 switch (SubstContext) {
1462 case ObjCSubstitutionContext::Ordinary:
1463 case ObjCSubstitutionContext::Parameter:
1464 case ObjCSubstitutionContext::Superclass:
1468 case ObjCSubstitutionContext::Result:
1469 case ObjCSubstitutionContext::Property: {
1471 const auto *objPtr =
1476 if (objPtr->isKindOfType() || objPtr->isObjCIdOrClassType())
1480 const auto *obj = objPtr->getObjectType();
1482 obj->getBaseType(), obj->getTypeArgsAsWritten(), obj->getProtocols(),
1489 llvm_unreachable(
"Unexpected ObjCSubstitutionContext!");
1492 QualType VisitFunctionType(
const FunctionType *funcType) {
1498 Ctx, TypeArgs, ObjCSubstitutionContext::Result);
1508 return BaseType::VisitFunctionType(funcType);
1517 SmallVector<QualType, 4> paramTypes;
1518 bool paramChanged =
false;
1519 for (
auto paramType : funcProtoType->getParamTypes()) {
1521 Ctx, TypeArgs, ObjCSubstitutionContext::Parameter);
1522 if (newParamType.
isNull())
1526 paramChanged =
true;
1528 paramTypes.push_back(newParamType);
1532 FunctionProtoType::ExtProtoInfo
info = funcProtoType->getExtProtoInfo();
1533 bool exceptionChanged =
false;
1535 SmallVector<QualType, 4> exceptionTypes;
1536 for (
auto exceptionType :
info.ExceptionSpec.Exceptions) {
1538 Ctx, TypeArgs, ObjCSubstitutionContext::Ordinary);
1539 if (newExceptionType.
isNull())
1542 if (newExceptionType.
getAsOpaquePtr() != exceptionType.getAsOpaquePtr())
1543 exceptionChanged =
true;
1545 exceptionTypes.push_back(newExceptionType);
1548 if (exceptionChanged) {
1549 info.ExceptionSpec.Exceptions =
1550 llvm::ArrayRef(exceptionTypes).copy(Ctx);
1555 funcProtoType->getReturnType().getAsOpaquePtr() &&
1556 !paramChanged && !exceptionChanged)
1557 return BaseType::VisitFunctionType(funcType);
1562 QualType VisitObjCObjectType(
const ObjCObjectType *objcObjectType) {
1565 if (objcObjectType->isSpecializedAsWritten()) {
1566 SmallVector<QualType, 4> newTypeArgs;
1567 bool anyChanged =
false;
1568 for (
auto typeArg : objcObjectType->getTypeArgsAsWritten()) {
1570 Ctx, TypeArgs, ObjCSubstitutionContext::Ordinary);
1577 ArrayRef<ObjCProtocolDecl *> protocols(
1578 objcObjectType->qual_begin(), objcObjectType->getNumProtocols());
1579 if (TypeArgs.empty() &&
1580 SubstContext != ObjCSubstitutionContext::Superclass) {
1582 objcObjectType->getBaseType(), {}, protocols,
1583 objcObjectType->isKindOfTypeAsWritten());
1589 newTypeArgs.push_back(newTypeArg);
1593 ArrayRef<ObjCProtocolDecl *> protocols(
1594 objcObjectType->qual_begin(), objcObjectType->getNumProtocols());
1597 objcObjectType->isKindOfTypeAsWritten());
1601 return BaseType::VisitObjCObjectType(objcObjectType);
1604 QualType VisitAttributedType(
const AttributedType *attrType) {
1605 QualType newType = BaseType::VisitAttributedType(attrType);
1609 const auto *newAttrType = dyn_cast<AttributedType>(newType.
getTypePtr());
1610 if (!newAttrType || newAttrType->getAttrKind() != attr::ObjCKindOf)
1614 QualType newEquivType = newAttrType->getEquivalentType();
1615 const ObjCObjectPointerType *ptrType =
1616 newEquivType->
getAs<ObjCObjectPointerType>();
1617 const ObjCObjectType *objType = ptrType
1619 : newEquivType->
getAs<ObjCObjectType>();
1626 objType->getBaseType(), objType->getTypeArgsAsWritten(),
1627 objType->getProtocols(),
1629 objType->isObjCUnqualifiedId() ?
false :
true);
1637 newAttrType->getModifiedType(), newEquivType,
1638 newAttrType->getAttr());
1642struct StripNullabilityTypeVisitor
1643 :
public SimpleTransformVisitor<StripNullabilityTypeVisitor> {
1644 using BaseType = SimpleTransformVisitor<StripNullabilityTypeVisitor>;
1646 explicit StripNullabilityTypeVisitor(ASTContext &ctx) : BaseType(ctx) {}
1648 QualType VisitAttributedType(
const AttributedType *attrType) {
1649 QualType
type(attrType, 0);
1650 if (AttributedType::stripOuterNullability(
type)) {
1651 while (AttributedType::stripOuterNullability(
type)) {
1653 return BaseType::recurse(
type);
1656 return BaseType::VisitAttributedType(attrType);
1660struct StripObjCKindOfTypeVisitor
1661 :
public SimpleTransformVisitor<StripObjCKindOfTypeVisitor> {
1662 using BaseType = SimpleTransformVisitor<StripObjCKindOfTypeVisitor>;
1664 explicit StripObjCKindOfTypeVisitor(ASTContext &ctx) : BaseType(ctx) {}
1666 QualType VisitObjCObjectType(
const ObjCObjectType *objType) {
1667 if (!objType->isKindOfType())
1668 return BaseType::VisitObjCObjectType(objType);
1670 QualType baseType = objType->getBaseType().stripObjCKindOfType(Ctx);
1672 objType->getProtocols(),
1689 case BuiltinType::Kind::Float16: {
1697 case BuiltinType::Kind::BFloat16: {
1717 SubstObjCTypeArgsVisitor visitor(ctx, typeArgs, context);
1718 return visitor.recurse(*
this);
1732 auto &ctx =
const_cast<ASTContext &
>(constCtx);
1733 StripObjCKindOfTypeVisitor visitor(ctx);
1734 return visitor.recurse(*
this);
1740 auto &ctx =
const_cast<ASTContext &
>(constCtx);
1741 StripNullabilityTypeVisitor visitor(ctx);
1742 return visitor.recurse(*
this);
1747 if (
const auto AT =
T.getTypePtr()->getAs<
AtomicType>())
1748 T = AT->getValueType();
1749 return T.getUnqualifiedType();
1752std::optional<ArrayRef<QualType>>
1755 if (
const auto method = dyn_cast<ObjCMethodDecl>(dc))
1756 dc = method->getDeclContext();
1760 const auto *dcClassDecl = dyn_cast<ObjCInterfaceDecl>(dc);
1766 dcTypeParams = dcClassDecl->getTypeParamList();
1768 return std::nullopt;
1772 dcCategoryDecl = dyn_cast<ObjCCategoryDecl>(dc);
1773 if (!dcCategoryDecl)
1774 return std::nullopt;
1780 return std::nullopt;
1784 return std::nullopt;
1786 assert(dcTypeParams &&
"No substitutions to perform");
1787 assert(dcClassDecl &&
"No class context");
1792 objectType = objectPointerType->getObjectType();
1803 objectType ? objectType->getInterface() :
nullptr;
1804 if (!curClassDecl) {
1812 while (curClassDecl != dcClassDecl) {
1814 QualType superType = objectType->getSuperClassType();
1815 if (superType.
isNull()) {
1816 objectType =
nullptr;
1821 curClassDecl = objectType->getInterface();
1826 if (!objectType || objectType->isUnspecialized()) {
1831 return objectType->getTypeArgs();
1836 if (
auto *ID = IfaceT->getInterface()) {
1837 if (ID->getTypeParamList())
1845void ObjCObjectType::computeSuperClassTypeSlow()
const {
1851 CachedSuperClassType.setInt(
true);
1857 if (!superClassObjTy) {
1858 CachedSuperClassType.setInt(
true);
1863 if (!superClassDecl) {
1864 CachedSuperClassType.setInt(
true);
1870 QualType superClassType(superClassObjTy, 0);
1872 if (!superClassTypeParams) {
1873 CachedSuperClassType.setPointerAndInt(
1874 superClassType->castAs<ObjCObjectType>(),
true);
1879 if (superClassObjTy->isUnspecialized()) {
1880 CachedSuperClassType.setPointerAndInt(superClassObjTy,
true);
1888 CachedSuperClassType.setPointerAndInt(
1889 superClassType->castAs<ObjCObjectType>(),
true);
1895 if (isUnspecialized()) {
1898 superClassObjTy->getInterface());
1899 CachedSuperClassType.setPointerAndInt(
1900 unspecializedSuper->
castAs<ObjCObjectType>(),
true);
1906 assert(typeArgs.size() == typeParams->
size());
1907 CachedSuperClassType.setPointerAndInt(
1911 ->castAs<ObjCObjectType>(),
1917 return interfaceDecl->getASTContext()
1918 .getObjCInterfaceType(interfaceDecl)
1927 if (superObjectType.
isNull())
1928 return superObjectType;
1939 if (
T->getNumProtocols() &&
T->getInterface())
1952 if (OPT->isObjCQualifiedIdType())
1962 if (OPT->isObjCQualifiedClassType())
1970 if (OT->getInterface())
1978 if (OPT->getInterfaceType())
1995const TemplateSpecializationType *
1998 while (TST && TST->isTypeAlias())
1999 TST = TST->desugar()->getAs<TemplateSpecializationType>();
2005 case Type::DependentName:
2007 case Type::TemplateSpecialization:
2013 case Type::InjectedClassName:
2017 case Type::UnresolvedUsing:
2022 return std::nullopt;
2027 const Type *Cur =
this;
2028 while (
const auto *AT = Cur->
getAs<AttributedType>()) {
2029 if (AT->getAttrKind() == AK)
2031 Cur = AT->getEquivalentType().getTypePtr();
2038class GetContainedDeducedTypeVisitor
2039 :
public TypeVisitor<GetContainedDeducedTypeVisitor, Type *> {
2043 GetContainedDeducedTypeVisitor(
bool Syntactic =
false)
2044 : Syntactic(Syntactic) {}
2051 return Visit(
T.getTypePtr());
2055 Type *VisitDeducedType(
const DeducedType *AT) {
2056 return const_cast<DeducedType *
>(AT);
2060 Type *VisitSubstTemplateTypeParmType(
const SubstTemplateTypeParmType *
T) {
2061 return Visit(
T->getReplacementType());
2064 Type *VisitPointerType(
const PointerType *
T) {
2068 Type *VisitBlockPointerType(
const BlockPointerType *
T) {
2072 Type *VisitReferenceType(
const ReferenceType *
T) {
2073 return Visit(
T->getPointeeTypeAsWritten());
2076 Type *VisitMemberPointerType(
const MemberPointerType *
T) {
2080 Type *VisitArrayType(
const ArrayType *
T) {
2081 return Visit(
T->getElementType());
2084 Type *VisitDependentSizedExtVectorType(
const DependentSizedExtVectorType *
T) {
2085 return Visit(
T->getElementType());
2088 Type *VisitVectorType(
const VectorType *
T) {
2089 return Visit(
T->getElementType());
2092 Type *VisitDependentSizedMatrixType(
const DependentSizedMatrixType *
T) {
2093 return Visit(
T->getElementType());
2096 Type *VisitConstantMatrixType(
const ConstantMatrixType *
T) {
2097 return Visit(
T->getElementType());
2100 Type *VisitFunctionProtoType(
const FunctionProtoType *
T) {
2102 return const_cast<FunctionProtoType *
>(
T);
2103 return VisitFunctionType(
T);
2106 Type *VisitFunctionType(
const FunctionType *
T) {
2110 Type *VisitParenType(
const ParenType *
T) {
return Visit(
T->getInnerType()); }
2112 Type *VisitAttributedType(
const AttributedType *
T) {
2113 return Visit(
T->getModifiedType());
2116 Type *VisitMacroQualifiedType(
const MacroQualifiedType *
T) {
2117 return Visit(
T->getUnderlyingType());
2120 Type *VisitOverflowBehaviorType(
const OverflowBehaviorType *
T) {
2121 return Visit(
T->getUnderlyingType());
2124 Type *VisitAdjustedType(
const AdjustedType *
T) {
2125 return Visit(
T->getOriginalType());
2128 Type *VisitPackExpansionType(
const PackExpansionType *
T) {
2129 return Visit(
T->getPattern());
2132 Type *VisitAtomicType(
const AtomicType *
T) {
2133 return Visit(
T->getValueType());
2140 return cast_or_null<DeducedType>(
2141 GetContainedDeducedTypeVisitor().Visit(
this));
2145 return isa_and_nonnull<FunctionType>(
2146 GetContainedDeducedTypeVisitor(
true).Visit(
this));
2150 if (
const auto *VT = dyn_cast<VectorType>(CanonicalType))
2151 return VT->getElementType()->isIntegerType();
2152 if (CanonicalType->isSveVLSBuiltinType()) {
2154 return VT->getKind() == BuiltinType::SveBool ||
2155 (VT->getKind() >= BuiltinType::SveInt8 &&
2156 VT->getKind() <= BuiltinType::SveUint64);
2158 if (CanonicalType->isRVVVLSBuiltinType()) {
2160 return (VT->getKind() >= BuiltinType::RvvInt8mf8 &&
2161 VT->getKind() <= BuiltinType::RvvUint64m8);
2187 if (
const auto *BT = dyn_cast<BuiltinType>(CanonicalType))
2188 return BT->isInteger();
2192 if (
const auto *ET = dyn_cast<EnumType>(CanonicalType))
2195 if (
const OverflowBehaviorType *OBT =
2196 dyn_cast<OverflowBehaviorType>(CanonicalType))
2197 return OBT->getUnderlyingType()->isIntegralOrEnumerationType();
2204 if (
const auto *BT = dyn_cast<BuiltinType>(CanonicalType))
2205 return BT->isInteger();
2207 if (
const auto *OBT = dyn_cast<OverflowBehaviorType>(CanonicalType))
2208 return OBT->getUnderlyingType()->isIntegerType();
2217 if (
const auto *ET = dyn_cast<EnumType>(CanonicalType))
2218 return !ET->getDecl()->isScoped();
2224 if (
const auto *BT = dyn_cast<BuiltinType>(CanonicalType))
2225 return BT->getKind() == BuiltinType::Char_U ||
2226 BT->getKind() == BuiltinType::UChar ||
2227 BT->getKind() == BuiltinType::Char_S ||
2228 BT->getKind() == BuiltinType::SChar;
2233 if (
const auto *BT = dyn_cast<BuiltinType>(CanonicalType))
2234 return BT->getKind() == BuiltinType::WChar_S ||
2235 BT->getKind() == BuiltinType::WChar_U;
2240 if (
const BuiltinType *BT = dyn_cast<BuiltinType>(CanonicalType))
2241 return BT->getKind() == BuiltinType::Char8;
2246 if (
const auto *BT = dyn_cast<BuiltinType>(CanonicalType))
2247 return BT->getKind() == BuiltinType::Char16;
2252 if (
const auto *BT = dyn_cast<BuiltinType>(CanonicalType))
2253 return BT->getKind() == BuiltinType::Char32;
2260 const auto *BT = dyn_cast<BuiltinType>(CanonicalType);
2263 switch (BT->getKind()) {
2266 case BuiltinType::Char_U:
2267 case BuiltinType::UChar:
2268 case BuiltinType::WChar_U:
2269 case BuiltinType::Char8:
2270 case BuiltinType::Char16:
2271 case BuiltinType::Char32:
2272 case BuiltinType::Char_S:
2273 case BuiltinType::SChar:
2274 case BuiltinType::WChar_S:
2280 const auto *BT = dyn_cast<BuiltinType>(CanonicalType);
2283 switch (BT->getKind()) {
2286 case BuiltinType::Char8:
2287 case BuiltinType::Char16:
2288 case BuiltinType::Char32:
2297 if (
const auto *BT = dyn_cast<BuiltinType>(CanonicalType))
2298 return BT->isSignedInteger();
2303 if (!ED->isComplete() || ED->isScoped())
2305 return ED->getIntegerType()->isSignedIntegerType();
2308 if (
const auto *IT = dyn_cast<BitIntType>(CanonicalType))
2309 return IT->isSigned();
2310 if (
const auto *IT = dyn_cast<DependentBitIntType>(CanonicalType))
2311 return IT->isSigned();
2313 if (
const auto *OBT = dyn_cast<OverflowBehaviorType>(CanonicalType))
2314 return OBT->getUnderlyingType()->isSignedIntegerType();
2320 if (
const auto *BT = dyn_cast<BuiltinType>(CanonicalType))
2321 return BT->isSignedInteger();
2324 if (!ED->isComplete())
2326 return ED->getIntegerType()->isSignedIntegerType();
2329 if (
const auto *IT = dyn_cast<BitIntType>(CanonicalType))
2330 return IT->isSigned();
2331 if (
const auto *IT = dyn_cast<DependentBitIntType>(CanonicalType))
2332 return IT->isSigned();
2334 if (
const auto *OBT = dyn_cast<OverflowBehaviorType>(CanonicalType))
2335 return OBT->getUnderlyingType()->isSignedIntegerOrEnumerationType();
2341 if (
const auto *VT = dyn_cast<VectorType>(CanonicalType))
2342 return VT->getElementType()->isSignedIntegerOrEnumerationType();
2344 if (
const auto *BT = dyn_cast<BuiltinType>(CanonicalType)) {
2345 switch (BT->getKind()) {
2346#define SVE_VECTOR_TYPE_INT(Name, MangledName, Id, SingletonId, NumEls, \
2347 ElBits, NF, IsSigned) \
2348 case BuiltinType::Id: \
2350#include "clang/Basic/AArch64ACLETypes.def"
2363 if (
const auto *BT = dyn_cast<BuiltinType>(CanonicalType))
2364 return BT->isUnsignedInteger();
2369 if (!ED->isComplete() || ED->isScoped())
2371 return ED->getIntegerType()->isUnsignedIntegerType();
2374 if (
const auto *IT = dyn_cast<BitIntType>(CanonicalType))
2375 return IT->isUnsigned();
2376 if (
const auto *IT = dyn_cast<DependentBitIntType>(CanonicalType))
2377 return IT->isUnsigned();
2379 if (
const auto *OBT = dyn_cast<OverflowBehaviorType>(CanonicalType))
2380 return OBT->getUnderlyingType()->isUnsignedIntegerType();
2386 if (
const auto *BT = dyn_cast<BuiltinType>(CanonicalType))
2387 return BT->isUnsignedInteger();
2390 if (!ED->isComplete())
2392 return ED->getIntegerType()->isUnsignedIntegerType();
2395 if (
const auto *IT = dyn_cast<BitIntType>(CanonicalType))
2396 return IT->isUnsigned();
2397 if (
const auto *IT = dyn_cast<DependentBitIntType>(CanonicalType))
2398 return IT->isUnsigned();
2400 if (
const auto *OBT = dyn_cast<OverflowBehaviorType>(CanonicalType))
2401 return OBT->getUnderlyingType()->isUnsignedIntegerOrEnumerationType();
2407 if (
const auto *VT = dyn_cast<VectorType>(CanonicalType))
2408 return VT->getElementType()->isUnsignedIntegerOrEnumerationType();
2409 if (
const auto *VT = dyn_cast<MatrixType>(CanonicalType))
2410 return VT->getElementType()->isUnsignedIntegerOrEnumerationType();
2411 if (CanonicalType->isSveVLSBuiltinType()) {
2413 return VT->getKind() >= BuiltinType::SveUint8 &&
2414 VT->getKind() <= BuiltinType::SveUint64;
2420 if (
const auto *BT = dyn_cast<BuiltinType>(CanonicalType))
2421 return BT->isFloatingPoint();
2422 if (
const auto *CT = dyn_cast<ComplexType>(CanonicalType))
2423 return CT->getElementType()->isFloatingType();
2428 if (
const auto *VT = dyn_cast<VectorType>(CanonicalType))
2429 return VT->getElementType()->isFloatingType();
2430 if (
const auto *MT = dyn_cast<MatrixType>(CanonicalType))
2431 return MT->getElementType()->isFloatingType();
2436 if (
const auto *BT = dyn_cast<BuiltinType>(CanonicalType))
2437 return BT->isFloatingPoint();
2442 if (
const auto *BT = dyn_cast<BuiltinType>(CanonicalType))
2443 return BT->getKind() >= BuiltinType::Bool &&
2444 BT->getKind() <= BuiltinType::Ibm128;
2445 if (
const auto *ET = dyn_cast<EnumType>(CanonicalType)) {
2446 const auto *ED = ET->getDecl();
2447 return !ED->isScoped() && ED->getDefinitionOrSelf()->isComplete();
2453 if (
const auto *BT = dyn_cast<BuiltinType>(CanonicalType))
2454 return BT->getKind() >= BuiltinType::Bool &&
2455 BT->getKind() <= BuiltinType::Ibm128;
2456 if (
const auto *ET = dyn_cast<EnumType>(CanonicalType)) {
2463 const auto *ED = ET->getDecl();
2464 return !ED->isScoped() && ED->getDefinitionOrSelf()->isComplete();
2475 if (
const auto *VT = dyn_cast<VectorType>(CanonicalType))
2476 return VT->getElementType()->isBooleanType();
2478 return ED->isComplete() && ED->getIntegerType()->isBooleanType();
2479 if (
const auto *IT = dyn_cast<BitIntType>(CanonicalType))
2480 return IT->getNumBits() == 1;
2487 const Type *
T = CanonicalType.getTypePtr();
2488 if (
const auto *BT = dyn_cast<BuiltinType>(
T)) {
2489 if (BT->getKind() == BuiltinType::Bool)
2491 if (BT->getKind() == BuiltinType::NullPtr)
2493 if (BT->isInteger())
2495 if (BT->isFloatingPoint())
2497 if (BT->isFixedPointType())
2499 llvm_unreachable(
"unknown scalar builtin type");
2509 assert(
T->castAsEnumDecl()->isComplete());
2511 }
else if (
const auto *CT = dyn_cast<ComplexType>(
T)) {
2512 if (CT->getElementType()->isRealFloatingType())
2521 llvm_unreachable(
"unknown scalar type");
2534 if (
const auto *
Record = dyn_cast<RecordType>(CanonicalType)) {
2535 if (
const auto *ClassDecl = dyn_cast<CXXRecordDecl>(
Record->getDecl()))
2536 return ClassDecl->isAggregate();
2548 assert(!
isIncompleteType() &&
"This doesn't make sense for incomplete types");
2549 assert(!
isDependentType() &&
"This doesn't make sense for dependent types");
2561 switch (CanonicalType->getTypeClass()) {
2572 return !EnumD->isComplete();
2580 return !Rec->isCompleteDefinition();
2582 case InjectedClassName: {
2584 if (!Rec->isBeingDefined())
2598 ->isIncompleteType(Def);
2599 case IncompleteArray:
2602 case MemberPointer: {
2615 if (!Context.getTargetInfo().getCXXABI().isMicrosoft())
2618 if (RD->
hasAttr<MSInheritanceAttr>())
2625 ->isIncompleteType(Def);
2626 case ObjCInterface: {
2658 switch (BT->getKind()) {
2660#define WASM_TYPE(Name, Id, SingletonId) case BuiltinType::Id:
2661#include "clang/Basic/WebAssemblyReferenceTypes.def"
2663#define HLSL_INTANGIBLE_TYPE(Name, Id, SingletonId) case BuiltinType::Id:
2664#include "clang/Basic/HLSLIntangibleTypes.def"
2666 case BuiltinType::AMDGPUFeaturePredicate:
2677 return BT->getKind() == BuiltinType::WasmExternRef;
2682 if (
const auto *ATy = dyn_cast<ArrayType>(
this))
2683 return ATy->getElementType().isWebAssemblyReferenceType();
2685 if (
const auto *PTy = dyn_cast<PointerType>(
this))
2686 return PTy->getPointeeType().isWebAssemblyReferenceType();
2699 switch (BT->getKind()) {
2701#define SVE_VECTOR_TYPE(Name, MangledName, Id, SingletonId) \
2702 case BuiltinType::Id: \
2704#define SVE_OPAQUE_TYPE(Name, MangledName, Id, SingletonId) \
2705 case BuiltinType::Id: \
2707#define SVE_PREDICATE_TYPE(Name, MangledName, Id, SingletonId) \
2708 case BuiltinType::Id: \
2710#include "clang/Basic/AArch64ACLETypes.def"
2720 switch (BT->getKind()) {
2721#define RVV_TYPE(Name, Id, SingletonId) case BuiltinType::Id:
2722#include "clang/Basic/RISCVVTypes.def"
2733 switch (BT->getKind()) {
2734 case BuiltinType::SveInt8:
2735 case BuiltinType::SveInt16:
2736 case BuiltinType::SveInt32:
2737 case BuiltinType::SveInt64:
2738 case BuiltinType::SveUint8:
2739 case BuiltinType::SveUint16:
2740 case BuiltinType::SveUint32:
2741 case BuiltinType::SveUint64:
2742 case BuiltinType::SveFloat16:
2743 case BuiltinType::SveFloat32:
2744 case BuiltinType::SveFloat64:
2745 case BuiltinType::SveBFloat16:
2746 case BuiltinType::SveBool:
2747 case BuiltinType::SveBoolx2:
2748 case BuiltinType::SveBoolx4:
2749 case BuiltinType::SveMFloat8:
2767 llvm_unreachable(
"Unhandled type");
2774 if (BTy->
getKind() == BuiltinType::SveBool)
2785 switch (BT->getKind()) {
2786#define RVV_VECTOR_TYPE(Name, Id, SingletonId, NumEls, ElBits, NF, IsSigned, \
2788 case BuiltinType::Id: \
2790#define RVV_PREDICATE_TYPE(Name, Id, SingletonId, NumEls) \
2791 case BuiltinType::Id: \
2793#include "clang/Basic/RISCVVTypes.def"
2807#define RVV_PREDICATE_TYPE(Name, Id, SingletonId, NumEls) \
2808 case BuiltinType::Id: \
2809 return Ctx.UnsignedCharTy;
2812#include "clang/Basic/RISCVVTypes.def"
2815 llvm_unreachable(
"Unhandled type");
2819 if (Context.getLangOpts().HLSL &&
2820 getTypePtr()->isHLSLStandardLayoutRecordOrArrayOf())
2824 if (Context.getLangOpts().CPlusPlus11)
2837 if ((*this)->isIncompleteArrayType())
2838 return Context.getBaseElementType(*this).isCXX98PODType(Context);
2840 if ((*this)->isIncompleteType())
2849 if (Context.containsAddressDiscriminatedPointerAuth(CanonicalType))
2856 case Type::VariableArray:
2857 case Type::ConstantArray:
2859 return Context.getBaseElementType(*this).isCXX98PODType(Context);
2861 case Type::ObjCObjectPointer:
2862 case Type::BlockPointer:
2866 case Type::MemberPointer:
2868 case Type::ExtVector:
2870 case Type::OverflowBehavior:
2877 if (
const auto *ClassDecl =
2879 return ClassDecl->isPOD();
2893 if ((*this)->isArrayType())
2894 return Context.getBaseElementType(*this).isTrivialType(Context);
2896 if ((*this)->isSizelessBuiltinType())
2901 if ((*this)->isIncompleteType())
2913 if (Context.containsAddressDiscriminatedPointerAuth(CanonicalType))
2932 return ClassDecl->hasTrivialDefaultConstructor() &&
2933 !ClassDecl->hasNonTrivialDefaultConstructor() &&
2934 ClassDecl->isTriviallyCopyable();
2946 bool IsCopyConstructible) {
2947 if (
type->isArrayType())
2949 Context, IsCopyConstructible);
2951 if (
type.hasNonTrivialObjCLifetime())
2985 if (
const auto *ClassDecl = dyn_cast<CXXRecordDecl>(RD)) {
2986 if (IsCopyConstructible)
2987 return ClassDecl->isTriviallyCopyConstructible();
2988 return ClassDecl->isTriviallyCopyable();
2990 return !RD->isNonTrivialToPrimitiveCopy();
3004 if (CanonicalType.hasNonTrivialObjCLifetime())
3006 if (CanonicalType->isArrayType())
3007 return Context.getBaseElementType(CanonicalType)
3008 .isBitwiseCloneableType(Context);
3010 if (CanonicalType->isIncompleteType())
3015 if (Context.containsAddressDiscriminatedPointerAuth(CanonicalType))
3018 const auto *RD = CanonicalType->getAsRecordDecl();
3022 if (RD->isInvalidDecl())
3028 if (RD->mayInsertExtraPadding())
3031 for (
auto *
const Field : RD->fields()) {
3032 if (!Field->getType().isBitwiseCloneableType(Context))
3036 if (
const auto *CXXRD = dyn_cast<CXXRecordDecl>(RD)) {
3037 for (
auto Base : CXXRD->bases())
3038 if (!
Base.getType().isBitwiseCloneableType(Context))
3040 for (
auto VBase : CXXRD->vbases())
3041 if (!VBase.getType().isBitwiseCloneableType(Context))
3054 return !Context.getLangOpts().ObjCAutoRefCount &&
3055 Context.getLangOpts().ObjCWeak &&
3088 return OBT->getBehaviorKind() ==
3089 OverflowBehaviorType::OverflowBehaviorKind::Wrap;
3096 return OBT->getBehaviorKind() ==
3097 OverflowBehaviorType::OverflowBehaviorKind::Trap;
3104 if (
const auto *RD =
3120 if (
const auto *RD =
3160 assert(BaseTy &&
"NULL element type");
3194 if (
const auto *ClassDecl = dyn_cast<CXXRecordDecl>(RD))
3195 return ClassDecl->isLiteral();
3202 return AT->getValueType()->isLiteralType(Ctx);
3204 if (
const auto *OBT = BaseTy->
getAs<OverflowBehaviorType>())
3205 return OBT->getUnderlyingType()->isLiteralType(Ctx);
3227 return RD->isStructural();
3240 assert(BaseTy &&
"NULL element type");
3251 if (
const auto *ClassDecl = dyn_cast<CXXRecordDecl>(RD);
3252 ClassDecl && !ClassDecl->isStandardLayout())
3280 assert(BaseTy &&
"NULL element type");
3291 if (Context.containsAddressDiscriminatedPointerAuth(*
this))
3298 if (
const auto *ClassDecl = dyn_cast<CXXRecordDecl>(RD)) {
3301 if (!ClassDecl->isTrivial())
3307 if (!ClassDecl->isStandardLayout())
3338 const auto *ED = ET->getDecl();
3340 if (II && II->
isStr(
"align_val_t") && ED->isInStdNamespace())
3348 const auto *ED = ET->getDecl();
3350 if (II && II->
isStr(
"byte") && ED->isInStdNamespace())
3366 case TemplateTypeParm:
3367 case SubstTemplateTypeParm:
3368 case TemplateSpecialization:
3411 llvm_unreachable(
"Type specifier is not a tag type kind.");
3428 llvm_unreachable(
"Unknown tag type kind.");
3446 llvm_unreachable(
"Elaborated type keyword is not a tag type kind.");
3448 llvm_unreachable(
"Unknown elaborated type keyword.");
3463 llvm_unreachable(
"Unknown elaborated type keyword.");
3477 return "__interface";
3484 llvm_unreachable(
"Unknown elaborated type keyword.");
3489 if (
const auto *TST = dyn_cast<TemplateSpecializationType>(
this))
3491 else if (
const auto *DepName = dyn_cast<DependentNameType>(
this))
3492 Keyword = DepName->getKeyword();
3493 else if (
const auto *
T = dyn_cast<TagType>(
this))
3495 else if (
const auto *
T = dyn_cast<TypedefType>(
this))
3497 else if (
const auto *
T = dyn_cast<UnresolvedUsingType>(
this))
3499 else if (
const auto *
T = dyn_cast<UsingType>(
this))
3509#define ABSTRACT_TYPE(Derived, Base)
3510#define TYPE(Derived, Base) \
3513#include "clang/AST/TypeNodes.inc"
3516 llvm_unreachable(
"Invalid type class.");
3524 return Policy.
Bool ?
"bool" :
"_Bool";
3530 return "signed char";
3542 return "unsigned char";
3544 return "unsigned short";
3546 return "unsigned int";
3548 return "unsigned long";
3550 return "unsigned long long";
3552 return "unsigned __int128";
3554 return Policy.
Half ?
"half" :
"__fp16";
3562 return "long double";
3564 return "short _Accum";
3568 return "long _Accum";
3570 return "unsigned short _Accum";
3572 return "unsigned _Accum";
3574 return "unsigned long _Accum";
3575 case BuiltinType::ShortFract:
3576 return "short _Fract";
3577 case BuiltinType::Fract:
3579 case BuiltinType::LongFract:
3580 return "long _Fract";
3581 case BuiltinType::UShortFract:
3582 return "unsigned short _Fract";
3583 case BuiltinType::UFract:
3584 return "unsigned _Fract";
3585 case BuiltinType::ULongFract:
3586 return "unsigned long _Fract";
3587 case BuiltinType::SatShortAccum:
3588 return "_Sat short _Accum";
3589 case BuiltinType::SatAccum:
3590 return "_Sat _Accum";
3591 case BuiltinType::SatLongAccum:
3592 return "_Sat long _Accum";
3593 case BuiltinType::SatUShortAccum:
3594 return "_Sat unsigned short _Accum";
3595 case BuiltinType::SatUAccum:
3596 return "_Sat unsigned _Accum";
3597 case BuiltinType::SatULongAccum:
3598 return "_Sat unsigned long _Accum";
3599 case BuiltinType::SatShortFract:
3600 return "_Sat short _Fract";
3601 case BuiltinType::SatFract:
3602 return "_Sat _Fract";
3603 case BuiltinType::SatLongFract:
3604 return "_Sat long _Fract";
3605 case BuiltinType::SatUShortFract:
3606 return "_Sat unsigned short _Fract";
3607 case BuiltinType::SatUFract:
3608 return "_Sat unsigned _Fract";
3609 case BuiltinType::SatULongFract:
3610 return "_Sat unsigned long _Fract";
3614 return "__float128";
3619 return Policy.
MSWChar ?
"__wchar_t" :
"wchar_t";
3629 return "<overloaded function type>";
3631 return "<bound member function type>";
3632 case UnresolvedTemplate:
3633 return "<unresolved template type>";
3635 return "<pseudo-object type>";
3637 return "<dependent type>";
3639 return "<unknown type>";
3640 case ARCUnbridgedCast:
3641 return "<ARC unbridged cast type>";
3643 return "<builtin fn type>";
3650#define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \
3652 return "__" #Access " " #ImgType "_t";
3653#include "clang/Basic/OpenCLImageTypes.def"
3659 return "clk_event_t";
3663 return "reserve_id_t";
3664 case IncompleteMatrixIdx:
3665 return "<incomplete matrix index type>";
3667 return "<array section type>";
3668 case OMPArrayShaping:
3669 return "<OpenMP array shaping type>";
3671 return "<OpenMP iterator type>";
3672#define EXT_OPAQUE_TYPE(ExtType, Id, Ext) \
3675#include "clang/Basic/OpenCLExtensionTypes.def"
3676#define SVE_TYPE(Name, Id, SingletonId) \
3679#include "clang/Basic/AArch64ACLETypes.def"
3680#define PPC_VECTOR_TYPE(Name, Id, Size) \
3683#include "clang/Basic/PPCTypes.def"
3684#define RVV_TYPE(Name, Id, SingletonId) \
3687#include "clang/Basic/RISCVVTypes.def"
3688#define WASM_TYPE(Name, Id, SingletonId) \
3691#include "clang/Basic/WebAssemblyReferenceTypes.def"
3692#define AMDGPU_TYPE(Name, Id, SingletonId, Width, Align) \
3695#include "clang/Basic/AMDGPUTypes.def"
3696#define HLSL_INTANGIBLE_TYPE(Name, Id, SingletonId) \
3699#include "clang/Basic/HLSLIntangibleTypes.def"
3700#define SPIRV_TYPE(Name, Id, SingletonId) \
3703#include "clang/Basic/SPIRVTypes.def"
3706 llvm_unreachable(
"Invalid builtin type.");
3711 if (
auto *PET = dyn_cast<PackExpansionType>(
getTypePtr()))
3712 return PET->getPattern();
3717 if (
const auto *RefType =
getTypePtr()->getAs<ReferenceType>())
3725 if (!Context.getLangOpts().CPlusPlus ||
3734 return FPT->hasCFIUncheckedCallee();
3751 return "vectorcall";
3763 return "aarch64_vector_pcs";
3765 return "aarch64_sve_pcs";
3767 return "intel_ocl_bicc";
3769 return "device_kernel";
3773 return "swiftasynccall";
3775 return "preserve_most";
3777 return "preserve_all";
3781 return "preserve_none";
3784#define CC_VLS_CASE(ABI_VLEN) \
3785 case CC_RISCVVLSCall_##ABI_VLEN: return "riscv_vls_cc(" #ABI_VLEN ")";
3802 llvm_unreachable(
"Invalid calling convention.");
3820 assert(
getNumParams() == params.size() &&
"NumParams overflow!");
3829 auto &ExtraBits = *getTrailingObjects<FunctionTypeExtraBitfields>();
3837 auto &ExtraAttrInfo = *getTrailingObjects<FunctionTypeExtraAttributeInfo>();
3841 auto &ExtraBits = *getTrailingObjects<FunctionTypeExtraBitfields>();
3842 ExtraBits.HasExtraAttributeInfo =
true;
3846 auto &ArmTypeAttrs = *getTrailingObjects<FunctionTypeArmAttributes>();
3847 ArmTypeAttrs = FunctionTypeArmAttributes();
3850 auto &ExtraBits = *getTrailingObjects<FunctionTypeExtraBitfields>();
3851 ExtraBits.HasArmTypeAttributes =
true;
3855 auto *argSlot = getTrailingObjects<QualType>();
3858 ~TypeDependence::VariablyModified);
3859 argSlot[i] = params[i];
3864 auto &ArmTypeAttrs = *getTrailingObjects<FunctionTypeArmAttributes>();
3866 "Not enough bits to encode SME attributes");
3872 auto &ExtraBits = *getTrailingObjects<FunctionTypeExtraBitfields>();
3874 assert(NumExceptions <= 1023 &&
"Not enough bits to encode exceptions");
3875 ExtraBits.NumExceptionType = NumExceptions;
3877 assert(hasExtraBitfields() &&
"missing trailing extra bitfields!");
3879 reinterpret_cast<QualType *
>(getTrailingObjects<ExceptionType>());
3887 (TypeDependence::Instantiation | TypeDependence::UnexpandedPack));
3889 exnSlot[I++] = ExceptionType;
3903 (TypeDependence::Instantiation | TypeDependence::UnexpandedPack));
3909 auto **slot = getTrailingObjects<FunctionDecl *>();
3917 auto **slot = getTrailingObjects<FunctionDecl *>();
3936 auto *extParamInfos = getTrailingObjects<ExtParameterInfo>();
3943 *getTrailingObjects<Qualifiers>() = epi.
TypeQuals;
3950 auto &EllipsisLoc = *getTrailingObjects<SourceLocation>();
3955 auto &ExtraBits = *getTrailingObjects<FunctionTypeExtraBitfields>();
3957 ExtraBits.NumFunctionEffects = EffectsCount;
3958 assert(ExtraBits.NumFunctionEffects == EffectsCount &&
3959 "effect bitfield overflow");
3962 auto *DestFX = getTrailingObjects<FunctionEffect>();
3963 llvm::uninitialized_copy(SrcFX, DestFX);
3966 if (!SrcConds.empty()) {
3967 ExtraBits.EffectsHaveConditions =
true;
3968 auto *DestConds = getTrailingObjects<EffectConditionExpr>();
3969 llvm::uninitialized_copy(SrcConds, DestConds);
3970 assert(llvm::any_of(SrcConds,
3971 [](
const EffectConditionExpr &EC) {
3973 return E->isTypeDependent() ||
3974 E->isValueDependent();
3977 "expected a dependent expression among the conditions");
3985 return NE->isValueDependent();
3997 return NE->isInstantiationDependent();
4008 llvm_unreachable(
"should not call this with unresolved exception specs");
4034 llvm_unreachable(
"unexpected exception specification kind");
4038 for (
unsigned ArgIdx =
getNumParams(); ArgIdx; --ArgIdx)
4046 const QualType *ArgTys,
unsigned NumParams,
4047 const ExtProtoInfo &epi,
4071 ID.AddPointer(
Result.getAsOpaquePtr());
4072 for (
unsigned i = 0; i != NumParams; ++i)
4073 ID.AddPointer(ArgTys[i].getAsOpaquePtr());
4077 assert(!(
unsigned(epi.Variadic) & ~1) && !(
unsigned(epi.RefQualifier) & ~3) &&
4078 !(
unsigned(epi.ExceptionSpec.Type) & ~15) &&
4079 "Values larger than expected.");
4080 ID.AddInteger(
unsigned(epi.Variadic) + (epi.RefQualifier << 1) +
4081 (epi.ExceptionSpec.Type << 3));
4082 ID.Add(epi.TypeQuals);
4084 for (
QualType Ex : epi.ExceptionSpec.Exceptions)
4087 epi.ExceptionSpec.NoexceptExpr->Profile(ID, Context, Canonical);
4090 ID.AddPointer(epi.ExceptionSpec.SourceDecl->getCanonicalDecl());
4092 if (epi.ExtParameterInfos) {
4093 for (
unsigned i = 0; i != NumParams; ++i)
4094 ID.AddInteger(epi.ExtParameterInfos[i].getOpaqueValue());
4097 epi.ExtInfo.Profile(ID);
4098 epi.ExtraAttributeInfo.Profile(ID);
4100 unsigned EffectCount = epi.FunctionEffects.size();
4101 bool HasConds = !epi.FunctionEffects.Conditions.empty();
4103 ID.AddInteger((EffectCount << 3) | (HasConds << 2) |
4104 (epi.AArch64SMEAttributes << 1) | epi.HasTrailingReturn);
4105 ID.AddInteger(epi.CFIUncheckedCallee);
4107 for (
unsigned Idx = 0; Idx != EffectCount; ++Idx) {
4108 ID.AddInteger(epi.FunctionEffects.Effects[Idx].toOpaqueInt32());
4110 ID.AddPointer(epi.FunctionEffects.Conditions[Idx].getCondition());
4121 : Data(D, Deref << DerefShift) {}
4124 return Data.getInt() & DerefMask;
4129 return Data.getOpaqueValue();
4136 Data.setFromOpaqueValue(
V);
4139OverflowBehaviorType::OverflowBehaviorType(
4141 OverflowBehaviorType::OverflowBehaviorKind Kind)
4142 :
Type(OverflowBehavior, Canon, Underlying->getDependence()),
4143 UnderlyingType(Underlying), BehaviorKind(Kind) {}
4149CountAttributedType::CountAttributedType(
4153 CountExpr(CountExpr) {
4157 auto *DeclSlot = getTrailingObjects();
4158 llvm::copy(CoupledDecls, DeclSlot);
4167#define ENUMERATE_ATTRS(PREFIX) \
4169 if (isCountInBytes()) { \
4171 return PREFIX "sized_by_or_null"; \
4172 return PREFIX "sized_by"; \
4175 return PREFIX "counted_by_or_null"; \
4176 return PREFIX "counted_by"; \
4179 if (WithMacroPrefix)
4184#undef ENUMERATE_ATTRS
4190 bool HasTypeDifferentFromDecl)
4192 Keyword, TC, UnderlyingType.getCanonicalType(),
4196 ~NestedNameSpecifierDependence::
Dependent)
4200 *getTrailingObjects<NestedNameSpecifier>() = Qualifier;
4201 if ((
TypedefBits.hasTypeDifferentFromDecl = HasTypeDifferentFromDecl))
4202 *getTrailingObjects<QualType>() = UnderlyingType;
4207 : *getTrailingObjects<QualType>();
4213 const Type *CanonicalType)
4219 ~NestedNameSpecifierDependence::
Dependent)
4223 *getTrailingObjects<NestedNameSpecifier>() = Qualifier;
4232 if ((
UsingBits.hasQualifier = !!Qualifier))
4233 *getTrailingObjects() = Qualifier;
4242 while (
auto *InnerMQT = dyn_cast<MacroQualifiedType>(Inner)) {
4245 Inner = InnerMQT->getModifiedType();
4256 ? Context.getUnqualifiedArrayType(Can).getAtomicUnqualifiedType()
4261 TOExpr(E), Context(Context) {
4262 TypeOfBits.Kind =
static_cast<unsigned>(Kind);
4271 ? Context.getUnqualifiedArrayType(QT).getAtomicUnqualifiedType()
4280 E->
Profile(ID, Context,
true);
4281 ID.AddBoolean(IsUnqual);
4288 ? Context.getUnqualifiedArrayType(Can).getAtomicUnqualifiedType()
4290 T->getDependence()),
4291 TOType(
T), Context(Context) {
4292 TypeOfBits.Kind =
static_cast<unsigned>(Kind);
4295QualType TypeOfType::desugar()
const {
4298 ? Context.getUnqualifiedArrayType(QT).getAtomicUnqualifiedType()
4306 :
Type(Decltype, can,
4310 (E->
getType()->getDependence() &
4312 E(E), UnderlyingType(underlyingType) {}
4314bool DecltypeType::isSugared()
const {
return !E->isInstantiationDependent(); }
4316QualType DecltypeType::desugar()
const {
4323DependentDecltypeType::DependentDecltypeType(
Expr *E)
4326void DependentDecltypeType::Profile(llvm::FoldingSetNodeID &ID,
4328 E->
Profile(ID, Context,
true);
4332 Expr *IndexExpr,
bool FullySubstituted,
4334 :
Type(PackIndexing, Canonical,
4336 Pattern(Pattern), IndexExpr(IndexExpr),
Size(Expansions.size()),
4337 FullySubstituted(FullySubstituted) {
4339 llvm::uninitialized_copy(Expansions, getTrailingObjects());
4343 if (isInstantiationDependentType())
4344 return std::nullopt;
4346 ConstantExpr *CE = dyn_cast<ConstantExpr>(getIndexExpr());
4348 return std::nullopt;
4350 assert(Index.isNonNegative() &&
"Invalid index");
4351 return static_cast<unsigned>(Index.getExtValue());
4355PackIndexingType::computeDependence(
QualType Pattern,
Expr *IndexExpr,
4360 ? TypeDependence::DependentInstantiation
4361 : TypeDependence::None);
4362 if (Expansions.empty())
4363 TD |= Pattern->
getDependence() & TypeDependence::DependentInstantiation;
4366 TD |=
T->getDependence();
4368 if (!(IndexD & TypeDependence::UnexpandedPack))
4374 TD |= TypeDependence::Error | TypeDependence::DependentInstantiation;
4379void PackIndexingType::Profile(llvm::FoldingSetNodeID &ID,
4381 Profile(ID, Context, getPattern(), getIndexExpr(), isFullySubstituted(),
4385void PackIndexingType::Profile(llvm::FoldingSetNodeID &ID,
4387 Expr *E,
bool FullySubstituted,
4390 E->
Profile(ID, Context,
true);
4391 ID.AddBoolean(FullySubstituted);
4392 if (!Expansions.empty()) {
4393 ID.AddInteger(Expansions.size());
4395 T.getCanonicalType().Profile(ID);
4401UnaryTransformType::UnaryTransformType(
QualType BaseType,
4402 QualType UnderlyingType, UTTKind UKind,
4404 :
Type(UnaryTransform, CanonicalType, BaseType->getDependence()),
4405 BaseType(BaseType), UnderlyingType(UnderlyingType), UKind(UKind) {}
4409 bool OwnsTag,
bool ISInjected,
const Type *CanonicalType)
4416 ~NestedNameSpecifierDependence::
Dependent)
4420 getTrailingQualifier() = Qualifier;
4425void *TagType::getTrailingPointer()
const {
4426 switch (getTypeClass()) {
4431 case Type::InjectedClassName:
4432 return const_cast<InjectedClassNameType *
>(
4435 llvm_unreachable(
"unexpected type class");
4440 assert(TagTypeBits.HasQualifier);
4442 getTrailingPointer(), llvm::Align::Of<NestedNameSpecifier *>()));
4446 return TagTypeBits.HasQualifier ? getTrailingQualifier() : std::nullopt;
4450 auto *
Decl = dyn_cast<CXXRecordDecl>(
decl);
4453 if (
auto *RD = dyn_cast<ClassTemplateSpecializationDecl>(
Decl))
4454 return RD->getSpecializedTemplate();
4455 return Decl->getDescribedClassTemplate();
4459 auto *TD = getTemplateDecl();
4462 if (isCanonicalUnqualified())
4469TagType::getTemplateArgs(
const ASTContext &Ctx)
const {
4470 auto *
Decl = dyn_cast<CXXRecordDecl>(
decl);
4474 if (
auto *RD = dyn_cast<ClassTemplateSpecializationDecl>(
Decl))
4475 return RD->getTemplateArgs().asArray();
4477 return TD->getTemplateParameters()->getInjectedTemplateArgs(Ctx);
4481bool RecordType::hasConstFields()
const {
4482 std::vector<const RecordType *> RecordTypeList;
4483 RecordTypeList.push_back(
this);
4484 unsigned NextToCheckIndex = 0;
4486 while (RecordTypeList.size() > NextToCheckIndex) {
4487 for (
FieldDecl *FD : RecordTypeList[NextToCheckIndex]
4489 ->getDefinitionOrSelf()
4495 if (
const auto *FieldRecTy = FieldTy->
getAsCanonical<RecordType>()) {
4496 if (!llvm::is_contained(RecordTypeList, FieldRecTy))
4497 RecordTypeList.push_back(FieldRecTy);
4507 const TagDecl *TD,
bool IsInjected,
4508 const Type *CanonicalType)
4510 false, IsInjected, CanonicalType) {}
4519 :
Type(Attributed, canon, equivalent->getDependence()), Attribute(
attr),
4520 ModifiedType(modified), EquivalentType(equivalent) {
4522 assert(!attr ||
attr->getKind() == attrKind);
4525bool AttributedType::isQualifier()
const {
4527 switch (getAttrKind()) {
4532 case attr::ObjCOwnership:
4533 case attr::ObjCInertUnsafeUnretained:
4534 case attr::TypeNonNull:
4535 case attr::TypeNullable:
4536 case attr::TypeNullableResult:
4537 case attr::TypeNullUnspecified:
4538 case attr::LifetimeBound:
4539 case attr::AddressSpace:
4549bool AttributedType::isMSTypeSpec()
const {
4551 switch (getAttrKind()) {
4560 llvm_unreachable(
"invalid attr kind");
4563bool AttributedType::isWebAssemblyFuncrefSpec()
const {
4564 return getAttrKind() == attr::WebAssemblyFuncref;
4567bool AttributedType::isCallingConv()
const {
4569 switch (getAttrKind()) {
4574 case attr::FastCall:
4576 case attr::ThisCall:
4578 case attr::SwiftCall:
4579 case attr::SwiftAsyncCall:
4580 case attr::VectorCall:
4581 case attr::AArch64VectorPcs:
4582 case attr::AArch64SVEPcs:
4583 case attr::DeviceKernel:
4587 case attr::IntelOclBicc:
4588 case attr::PreserveMost:
4589 case attr::PreserveAll:
4591 case attr::PreserveNone:
4592 case attr::RISCVVectorCC:
4593 case attr::RISCVVLSCC:
4596 llvm_unreachable(
"invalid attr kind");
4600 return isCanonicalUnqualified() ?
nullptr : getDecl()->getIdentifier();
4603SubstTemplateTypeParmType::SubstTemplateTypeParmType(
QualType Replacement,
4604 Decl *AssociatedDecl,
4608 :
Type(SubstTemplateTypeParm, Replacement.getCanonicalType(),
4609 Replacement->getDependence()),
4610 AssociatedDecl(AssociatedDecl) {
4614 *getTrailingObjects() = Replacement;
4620 assert(AssociatedDecl !=
nullptr);
4624SubstTemplateTypeParmType::getReplacedParameter()
const {
4629void SubstTemplateTypeParmType::Profile(llvm::FoldingSetNodeID &ID,
4631 const Decl *AssociatedDecl,
4634 Replacement.Profile(ID);
4635 ID.AddPointer(AssociatedDecl);
4636 ID.AddInteger(Index);
4637 ID.AddInteger(
PackIndex.toInternalRepresentation());
4638 ID.AddBoolean(Final);
4641SubstPackType::SubstPackType(TypeClass Derived,
QualType Canon,
4643 :
Type(Derived, Canon,
4647 assert(llvm::all_of(
4649 [](
auto &P) { return P.getKind() == TemplateArgument::Type; }) &&
4650 "non-type argument to SubstPackType?");
4658void SubstPackType::Profile(llvm::FoldingSetNodeID &ID) {
4659 Profile(ID, getArgumentPack());
4662void SubstPackType::Profile(llvm::FoldingSetNodeID &ID,
4666 ID.AddPointer(P.getAsType().getAsOpaquePtr());
4669SubstTemplateTypeParmPackType::SubstTemplateTypeParmPackType(
4670 QualType Canon,
Decl *AssociatedDecl,
unsigned Index,
bool Final,
4672 : SubstPackType(SubstTemplateTypeParmPack, Canon, ArgPack),
4673 AssociatedDeclAndFinal(AssociatedDecl, Final) {
4674 assert(AssociatedDecl !=
nullptr);
4677 assert(getNumArgs() == ArgPack.
pack_size() &&
4678 "Parent bitfields in SubstPackType were overwritten."
4679 "Check NumSubstPackTypeBits.");
4682Decl *SubstTemplateTypeParmPackType::getAssociatedDecl()
const {
4683 return AssociatedDeclAndFinal.getPointer();
4686bool SubstTemplateTypeParmPackType::getFinal()
const {
4687 return AssociatedDeclAndFinal.getInt();
4691SubstTemplateTypeParmPackType::getReplacedParameter()
const {
4696IdentifierInfo *SubstTemplateTypeParmPackType::getIdentifier()
const {
4697 return getReplacedParameter()->getIdentifier();
4700void SubstTemplateTypeParmPackType::Profile(llvm::FoldingSetNodeID &ID) {
4701 Profile(ID, getAssociatedDecl(),
getIndex(), getFinal(), getArgumentPack());
4704void SubstTemplateTypeParmPackType::Profile(llvm::FoldingSetNodeID &ID,
4705 const Decl *AssociatedDecl,
4706 unsigned Index,
bool Final,
4708 ID.AddPointer(AssociatedDecl);
4709 ID.AddInteger(Index);
4710 ID.AddBoolean(Final);
4711 SubstPackType::Profile(ID, ArgPack);
4714SubstBuiltinTemplatePackType::SubstBuiltinTemplatePackType(
4716 : SubstPackType(SubstBuiltinTemplatePack, Canon, ArgPack) {}
4718bool TemplateSpecializationType::anyDependentTemplateArguments(
4721 return anyDependentTemplateArguments(Args.
arguments(), Converted);
4724bool TemplateSpecializationType::anyDependentTemplateArguments(
4727 if (Arg.isDependent())
4732bool TemplateSpecializationType::anyInstantiationDependentTemplateArguments(
4735 if (ArgLoc.getArgument().isInstantiationDependent())
4744 ? TypeDependence::DependentInstantiation
4749 D |= TypeDependence::UnexpandedPack;
4751 D |= (Underlying->
getDependence() & TypeDependence::UnexpandedPack);
4756TemplateSpecializationType::TemplateSpecializationType(
4760 Underlying.isNull() ?
QualType(this, 0)
4761 : Underlying.getCanonicalType(),
4764 TemplateSpecializationTypeBits.NumArgs = Args.size();
4765 TemplateSpecializationTypeBits.TypeAlias = IsAlias;
4767 auto *TemplateArgs =
4779 ~TypeDependence::Dependent);
4781 addDependence(Arg.getAsType()->getDependence() &
4782 TypeDependence::VariablyModified);
4789 *
reinterpret_cast<QualType *
>(TemplateArgs) = Underlying;
4792QualType TemplateSpecializationType::getAliasedType()
const {
4793 assert(isTypeAlias() &&
"not a type alias template specialization");
4794 return *
reinterpret_cast<const QualType *
>(template_arguments().end());
4797bool clang::TemplateSpecializationType::isSugared()
const {
4798 return !isDependentType() || isCurrentInstantiation() || isTypeAlias() ||
4803void TemplateSpecializationType::Profile(llvm::FoldingSetNodeID &ID,
4805 Profile(ID, getKeyword(),
Template, template_arguments(),
4806 isSugared() ? desugar() :
QualType(), Ctx);
4809void TemplateSpecializationType::Profile(llvm::FoldingSetNodeID &ID,
4815 ID.AddInteger(llvm::to_underlying(
Keyword));
4819 ID.AddInteger(Args.size());
4821 Arg.Profile(ID, Context);
4829 return Context.getQualifiedType(QT, *
this);
4833 const Type *
T)
const {
4837 return Context.getQualifiedType(
T, *
this);
4840void ObjCObjectTypeImpl::Profile(llvm::FoldingSetNodeID &ID,
QualType BaseType,
4844 ID.AddPointer(BaseType.getAsOpaquePtr());
4845 ID.AddInteger(typeArgs.size());
4846 for (
auto typeArg : typeArgs)
4847 ID.AddPointer(typeArg.getAsOpaquePtr());
4848 ID.AddInteger(protocols.size());
4849 for (
auto *proto : protocols)
4850 ID.AddPointer(proto);
4851 ID.AddBoolean(isKindOf);
4854void ObjCObjectTypeImpl::Profile(llvm::FoldingSetNodeID &ID) {
4855 Profile(ID, getBaseType(), getTypeArgsAsWritten(),
4857 isKindOfTypeAsWritten());
4860void ObjCTypeParamType::Profile(llvm::FoldingSetNodeID &ID,
4864 ID.AddPointer(OTPDecl);
4866 ID.AddInteger(protocols.size());
4867 for (
auto *proto : protocols)
4868 ID.AddPointer(proto);
4871void ObjCTypeParamType::Profile(llvm::FoldingSetNodeID &ID) {
4872 Profile(ID, getDecl(), getCanonicalTypeInternal(),
4879class CachedProperties {
4884 CachedProperties(
Linkage L,
bool local) : L(L), local(local) {}
4886 Linkage getLinkage()
const {
return L; }
4887 bool hasLocalOrUnnamedType()
const {
return local; }
4889 friend CachedProperties
merge(CachedProperties L, CachedProperties R) {
4891 return CachedProperties(MergedLinkage, L.hasLocalOrUnnamedType() ||
4892 R.hasLocalOrUnnamedType());
4911 return CachedProperties(
T->TypeBits.getLinkage(),
4912 T->TypeBits.hasLocalOrUnnamedType());
4917 if (
T->TypeBits.isCacheValid())
4922 if (!
T->isCanonicalUnqualified()) {
4923 const Type *CT =
T->getCanonicalTypeInternal().getTypePtr();
4925 T->TypeBits.CacheValid =
true;
4926 T->TypeBits.CachedLinkage = CT->
TypeBits.CachedLinkage;
4927 T->TypeBits.CachedLocalOrUnnamed = CT->
TypeBits.CachedLocalOrUnnamed;
4933 T->TypeBits.CacheValid =
true;
4934 T->TypeBits.CachedLinkage = llvm::to_underlying(
Result.getLinkage());
4935 T->TypeBits.CachedLocalOrUnnamed =
Result.hasLocalOrUnnamedType();
4953 switch (
T->getTypeClass()) {
4954#define TYPE(Class, Base)
4955#define NON_CANONICAL_TYPE(Class, Base) case Type::Class:
4956#include "clang/AST/TypeNodes.inc"
4957 llvm_unreachable(
"didn't expect a non-canonical type here");
4959#define TYPE(Class, Base)
4960#define DEPENDENT_TYPE(Class, Base) case Type::Class:
4961#define NON_CANONICAL_UNLESS_DEPENDENT_TYPE(Class, Base) case Type::Class:
4962#include "clang/AST/TypeNodes.inc"
4964 assert(
T->isInstantiationDependentType());
4968 case Type::DeducedTemplateSpecialization:
4982 const auto *Tag =
cast<TagType>(
T)->getDecl()->getDefinitionOrSelf();
4988 Linkage L = Tag->getLinkageInternal();
4989 bool IsLocalOrUnnamed = Tag->getDeclContext()->isFunctionOrMethod() ||
4990 !Tag->hasNameForLinkage();
4991 return CachedProperties(L, IsLocalOrUnnamed);
5001 case Type::BlockPointer:
5003 case Type::LValueReference:
5004 case Type::RValueReference:
5006 case Type::MemberPointer: {
5008 CachedProperties Cls = [&] {
5009 if (MPT->isSugared())
5011 return Cache::get(MPT->getQualifier().getAsType());
5013 return merge(Cls,
Cache::get(MPT->getPointeeType()));
5015 case Type::ConstantArray:
5016 case Type::IncompleteArray:
5017 case Type::VariableArray:
5018 case Type::ArrayParameter:
5021 case Type::ExtVector:
5023 case Type::ConstantMatrix:
5025 case Type::FunctionNoProto:
5027 case Type::FunctionProto: {
5029 CachedProperties result =
Cache::get(FPT->getReturnType());
5030 for (
const auto &ai : FPT->param_types())
5034 case Type::ObjCInterface: {
5036 return CachedProperties(L,
false);
5038 case Type::ObjCObject:
5040 case Type::ObjCObjectPointer:
5046 case Type::HLSLAttributedResource:
5048 case Type::HLSLInlineSpirv:
5050 case Type::OverflowBehavior:
5054 llvm_unreachable(
"unhandled type class");
5065 return TypeBits.hasLocalOrUnnamedType();
5069 switch (
T->getTypeClass()) {
5070#define TYPE(Class, Base)
5071#define NON_CANONICAL_TYPE(Class, Base) case Type::Class:
5072#include "clang/AST/TypeNodes.inc"
5073 llvm_unreachable(
"didn't expect a non-canonical type here");
5075#define TYPE(Class, Base)
5076#define DEPENDENT_TYPE(Class, Base) case Type::Class:
5077#define NON_CANONICAL_UNLESS_DEPENDENT_TYPE(Class, Base) case Type::Class:
5078#include "clang/AST/TypeNodes.inc"
5080 assert(
T->isInstantiationDependentType());
5088 case Type::DeducedTemplateSpecialization:
5100 case Type::BlockPointer:
5102 case Type::LValueReference:
5103 case Type::RValueReference:
5105 case Type::MemberPointer: {
5108 if (
auto *D = MPT->getMostRecentCXXRecordDecl()) {
5116 case Type::ConstantArray:
5117 case Type::IncompleteArray:
5118 case Type::VariableArray:
5119 case Type::ArrayParameter:
5122 case Type::ExtVector:
5124 case Type::ConstantMatrix:
5127 case Type::FunctionNoProto:
5129 case Type::FunctionProto: {
5132 for (
const auto &ai : FPT->param_types())
5136 case Type::ObjCInterface:
5138 case Type::ObjCObject:
5140 case Type::ObjCObjectPointer:
5147 case Type::OverflowBehavior:
5150 case Type::HLSLAttributedResource:
5152 ->getContainedType()
5153 ->getCanonicalTypeInternal());
5154 case Type::HLSLInlineSpirv:
5158 llvm_unreachable(
"unhandled type class");
5172 if (!
T->isCanonicalUnqualified())
5186 while (
const auto *AT =
Type->getAs<AttributedType>()) {
5189 if (
auto Nullability = AT->getImmediateNullability())
5192 Type = AT->getEquivalentType();
5194 return std::nullopt;
5200 switch (
type->getTypeClass()) {
5201#define NON_CANONICAL_TYPE(Class, Parent) \
5204 llvm_unreachable("non-canonical type");
5205#define TYPE(Class, Parent)
5206#include "clang/AST/TypeNodes.inc"
5210 case Type::BlockPointer:
5211 case Type::MemberPointer:
5212 case Type::ObjCObjectPointer:
5216 case Type::UnresolvedUsing:
5217 case Type::TypeOfExpr:
5219 case Type::Decltype:
5220 case Type::PackIndexing:
5221 case Type::UnaryTransform:
5222 case Type::TemplateTypeParm:
5223 case Type::SubstTemplateTypeParmPack:
5224 case Type::SubstBuiltinTemplatePack:
5225 case Type::DependentName:
5227 return ResultIfUnknown;
5230 case Type::TemplateSpecialization:
5235 .getAsTemplateDecl())
5236 if (
auto *CTD = dyn_cast<ClassTemplateDecl>(templateDecl))
5237 return llvm::any_of(
5239 return RTD->getTemplatedDecl()->hasAttr<TypeNullableAttr>();
5241 return ResultIfUnknown;
5246#define SIGNED_TYPE(Id, SingletonId) case BuiltinType::Id:
5247#define UNSIGNED_TYPE(Id, SingletonId) case BuiltinType::Id:
5248#define FLOATING_TYPE(Id, SingletonId) case BuiltinType::Id:
5249#define BUILTIN_TYPE(Id, SingletonId)
5250#include "clang/AST/BuiltinTypes.def"
5253 case BuiltinType::UnresolvedTemplate:
5255 case BuiltinType::Dependent:
5256 case BuiltinType::Overload:
5257 case BuiltinType::BoundMember:
5258 case BuiltinType::PseudoObject:
5259 case BuiltinType::UnknownAny:
5260 case BuiltinType::ARCUnbridgedCast:
5261 return ResultIfUnknown;
5263 case BuiltinType::Void:
5264 case BuiltinType::ObjCId:
5265 case BuiltinType::ObjCClass:
5266 case BuiltinType::ObjCSel:
5267#define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \
5268 case BuiltinType::Id:
5269#include "clang/Basic/OpenCLImageTypes.def"
5270#define EXT_OPAQUE_TYPE(ExtType, Id, Ext) case BuiltinType::Id:
5271#include "clang/Basic/OpenCLExtensionTypes.def"
5272 case BuiltinType::OCLSampler:
5273 case BuiltinType::OCLEvent:
5274 case BuiltinType::OCLClkEvent:
5275 case BuiltinType::OCLQueue:
5276 case BuiltinType::OCLReserveID:
5277#define SVE_TYPE(Name, Id, SingletonId) case BuiltinType::Id:
5278#include "clang/Basic/AArch64ACLETypes.def"
5279#define PPC_VECTOR_TYPE(Name, Id, Size) case BuiltinType::Id:
5280#include "clang/Basic/PPCTypes.def"
5281#define RVV_TYPE(Name, Id, SingletonId) case BuiltinType::Id:
5282#include "clang/Basic/RISCVVTypes.def"
5283#define WASM_TYPE(Name, Id, SingletonId) case BuiltinType::Id:
5284#include "clang/Basic/WebAssemblyReferenceTypes.def"
5285#define AMDGPU_TYPE(Name, Id, SingletonId, Width, Align) case BuiltinType::Id:
5286#include "clang/Basic/AMDGPUTypes.def"
5287#define HLSL_INTANGIBLE_TYPE(Name, Id, SingletonId) case BuiltinType::Id:
5288#include "clang/Basic/HLSLIntangibleTypes.def"
5289#define SPIRV_TYPE(Name, Id, SingletonId) case BuiltinType::Id:
5290#include "clang/Basic/SPIRVTypes.def"
5291 case BuiltinType::BuiltinFn:
5292 case BuiltinType::NullPtr:
5293 case BuiltinType::IncompleteMatrixIdx:
5294 case BuiltinType::ArraySection:
5295 case BuiltinType::OMPArrayShaping:
5296 case BuiltinType::OMPIterator:
5299 llvm_unreachable(
"unknown builtin type");
5301 case Type::Record: {
5305 if (
const auto *CTSD = dyn_cast<ClassTemplateSpecializationDecl>(RD))
5306 return llvm::any_of(
5307 CTSD->getSpecializedTemplate()->redecls(),
5309 return RTD->getTemplatedDecl()->hasAttr<TypeNullableAttr>();
5312 return RD->hasAttr<TypeNullableAttr>();
5318 case Type::LValueReference:
5319 case Type::RValueReference:
5320 case Type::ConstantArray:
5321 case Type::IncompleteArray:
5322 case Type::VariableArray:
5323 case Type::DependentSizedArray:
5324 case Type::DependentVector:
5325 case Type::DependentSizedExtVector:
5327 case Type::ExtVector:
5328 case Type::ConstantMatrix:
5329 case Type::DependentSizedMatrix:
5330 case Type::DependentAddressSpace:
5331 case Type::FunctionProto:
5332 case Type::FunctionNoProto:
5333 case Type::DeducedTemplateSpecialization:
5335 case Type::InjectedClassName:
5336 case Type::PackExpansion:
5337 case Type::ObjCObject:
5338 case Type::ObjCInterface:
5342 case Type::DependentBitInt:
5343 case Type::ArrayParameter:
5344 case Type::HLSLAttributedResource:
5345 case Type::HLSLInlineSpirv:
5346 case Type::OverflowBehavior:
5349 llvm_unreachable(
"bad type kind!");
5353 if (getAttrKind() == attr::TypeNonNull)
5355 if (getAttrKind() == attr::TypeNullable)
5357 if (getAttrKind() == attr::TypeNullUnspecified)
5359 if (getAttrKind() == attr::TypeNullableResult)
5361 return std::nullopt;
5366 if (
auto MacroTy = dyn_cast<MacroQualifiedType>(
T))
5367 AttrTy = MacroTy->getUnderlyingType();
5369 if (
auto attributed = dyn_cast<AttributedType>(AttrTy)) {
5370 if (
auto nullability = attributed->getImmediateNullability()) {
5371 T = attributed->getModifiedType();
5376 return std::nullopt;
5379void AttributedType::Profile(llvm::FoldingSetNodeID &ID,
const ASTContext &Ctx,
5382 ID.AddInteger(attrKind);
5386 attr->Profile(ID, Ctx);
5400 if (objcPtr->isObjCIdType()) {
5411 }
else if (objcPtr->isObjCQualifiedIdType()) {
5436 "cannot query implicit lifetime for non-inferrable type");
5441 while (
const auto *array = dyn_cast<ArrayType>(canon))
5442 canon = array->getElementType().getTypePtr();
5444 if (
const auto *
opt = dyn_cast<ObjCObjectPointerType>(canon)) {
5446 if (
opt->getObjectType()->isObjCClass())
5455 return typedefType->getDecl()->hasAttr<ObjCNSObjectAttr>();
5461 return typedefType->getDecl()->hasAttr<ObjCIndependentClassAttr>();
5474 return OPT->getPointeeType()->isObjCIndirectLifetimeType();
5476 return Ref->getPointeeType()->isObjCIndirectLifetimeType();
5478 return MemPtr->getPointeeType()->isObjCIndirectLifetimeType();
5486 while (
const ArrayType *array =
type->getAsArrayTypeUnsafe())
5487 type = array->getElementType().getTypePtr();
5488 return type->isObjCRetainableType();
5510 return RT->getDecl()
5511 ->getMostRecentDecl()
5512 ->hasAttr<CUDADeviceBuiltinSurfaceTypeAttr>();
5519 return RT->getDecl()
5520 ->getMostRecentDecl()
5521 ->hasAttr<CUDADeviceBuiltinTextureTypeAttr>();
5533 if (
const auto *BT = dyn_cast<BuiltinType>(Ty))
5534 return BT->getKind() == BuiltinType::AMDGPUNamedWorkgroupBarrier;
5535 if (AllowWrappers) {
5536 if (
const auto *RT = dyn_cast<RecordType>(Ty))
5537 return RT->getDecl()->hasAttr<AMDGPUNamedBarrierWrapperAttr>();
5555 return ptr->getPointeeType()->hasSizedVLAType();
5557 return ref->getPointeeType()->hasSizedVLAType();
5563 return arr->getElementType()->hasSizedVLAType();
5570 return HLSLAttributedResourceType::findHandleTypeOnResource(
this) !=
nullptr;
5593 const RecordType *RT =
5599 assert(RD !=
nullptr &&
5600 "all HLSL structs and classes should be CXXRecordDecl");
5607 if (
const auto *RD =
5609 if (!RD->isHLSLBuiltinRecord() && RD->isStandardLayout())
5616 switch (
type.getObjCLifetime()) {
5628 if (
const auto *RD =
type->getBaseElementTypeUnsafe()->getAsRecordDecl()) {
5629 if (
const auto *CXXRD = dyn_cast<CXXRecordDecl>(RD)) {
5631 if (CXXRD->hasDefinition() && !CXXRD->hasTrivialDestructor())
5646 llvm::SmallPtrSetImpl<const Decl *> &Seen) {
5647 if (
const auto *Arr = Context.getAsArrayType(Ty))
5648 Ty = Context.getBaseElementType(Arr);
5650 if (
const auto *AttrTy = Ty->
getAs<AttributedType>())
5651 Ty = AttrTy->getModifiedType();
5654 "Incomplete types cannot be evaluated for laundering");
5661 if (!Seen.insert(
Record).second)
5664 if (
Record->isDynamicClass())
5690 Qualifier.Profile(ID);
5702 auto *RD = getCXXRecordDecl();
5709 llvm::APSInt Val,
unsigned Scale) {
5710 llvm::FixedPointSemantics FXSema(Val.getBitWidth(), Scale, Val.isSigned(),
5713 llvm::APFixedPoint(Val, FXSema).toString(Str);
5716DeducedType::DeducedType(TypeClass TC,
DeducedKind DK,
5719 ? DeducedAsTypeOrCanon.getCanonicalType()
5720 : DeducedAsTypeOrCanon,
5722 DeducedTypeBits.Kind = llvm::to_underlying(DK);
5727 assert(!DeducedAsTypeOrCanon.
isNull() &&
"Deduced type cannot be null");
5729 ~TypeDependence::VariablyModified);
5730 DeducedAsType = DeducedAsTypeOrCanon;
5733 addDependence(TypeDependence::UnexpandedPack);
5736 addDependence(TypeDependence::DependentInstantiation);
5739 assert(getDeducedKind() == DK &&
"DeducedKind does not match the type state");
5745 : DeducedType(
Auto, DK, DeducedAsTypeOrCanon) {
5746 AutoTypeBits.Keyword = llvm::to_underlying(
Keyword);
5747 AutoTypeBits.NumArgs = TypeConstraintArgs.size();
5748 this->TypeConstraintConcept = TypeConstraintConcept;
5749 assert(TypeConstraintConcept || AutoTypeBits.NumArgs == 0);
5750 if (TypeConstraintConcept) {
5751 auto Dep = TypeDependence::None;
5752 if (
const auto *TTP =
5753 dyn_cast<TemplateTemplateParmDecl>(TypeConstraintConcept))
5754 Dep = TypeDependence::DependentInstantiation |
5755 (TTP->isParameterPack() ? TypeDependence::UnexpandedPack
5756 : TypeDependence::None);
5771void AutoType::Profile(llvm::FoldingSetNodeID &ID,
const ASTContext &Context,
5775 DeducedType::Profile(ID, DK,
Deduced);
5776 ID.AddInteger(llvm::to_underlying(
Keyword));
5779 Arg.Profile(ID, Context);
5782void AutoType::Profile(llvm::FoldingSetNodeID &ID,
const ASTContext &Context) {
5783 Profile(ID, Context, getDeducedKind(), getDeducedType(), getKeyword(),
5784 getTypeConstraintConcept(), getTypeConstraintArguments());
5798 llvm_unreachable(
"unknown effect kind");
5804 return "nonblocking";
5806 return "nonallocating";
5810 return "allocating";
5812 llvm_unreachable(
"unknown effect kind");
5828 return std::nullopt;
5833 assert(0 &&
"effectProhibitingInference with non-inferable effect kind");
5836 llvm_unreachable(
"unknown effect kind");
5846 const Kind EK = Effect.kind();
5848 if (EK == CallerKind ||
5859 llvm_unreachable(
"unknown effect kind");
5871 unsigned InsertIdx = Effects.size();
5886 Errs.push_back({EC, NewEC});
5897 if (NewCondition || !Conditions.empty()) {
5898 if (Conditions.empty() && !Effects.empty())
5899 Conditions.resize(Effects.size());
5900 Conditions.insert(Conditions.begin() + InsertIdx,
5903 Effects.insert(Effects.begin() + InsertIdx, NewEC.
Effect);
5908 for (
const auto &Item :
Set)
5910 return Errs.empty();
5921 auto IterA = LHS.
begin(), EndA = LHS.
end();
5922 auto IterB = RHS.
begin(), EndB = RHS.
end();
5926 return std::tuple(LHS.Effect,
uintptr_t(LHS.Cond.getCondition())) <
5927 std::tuple(RHS.Effect,
uintptr_t(RHS.Cond.getCondition()));
5930 while (IterA != EndA && IterB != EndB) {
5935 else if (FEWCLess(B, A))
5946 assert(Errs.empty() &&
"conflict shouldn't be possible in getIntersection");
5959 Combined.
insert(RHS, Errs);
5980 llvm::interleaveComma(*
this, OS);
5990 llvm::interleaveComma(*
this, OS);
5997 assert(llvm::is_sorted(FX) &&
"effects should be sorted");
5998 assert((Conds.empty() || Conds.size() == FX.size()) &&
5999 "effects size should match conditions size");
6005 if (
Cond.getCondition() !=
nullptr)
6010const HLSLAttributedResourceType *
6011HLSLAttributedResourceType::findHandleTypeOnResource(
const Type *RT) {
6016 if (!RD->
fields().empty()) {
6017 const auto &FirstFD = RD->
fields().begin();
6018 return dyn_cast<HLSLAttributedResourceType>(
6019 FirstFD->getType().getTypePtr());
6025StringRef PredefinedSugarType::getName(Kind KD) {
6030 return "__signed_size_t";
6032 return "__ptrdiff_t";
6034 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 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 getObjCInterfaceType(const ObjCInterfaceDecl *Decl, ObjCInterfaceDecl *PrevDecl=nullptr) const
getObjCInterfaceType - Return the unique reference to the type for the specified ObjC interface decl.
QualType getBlockPointerType(QualType T) const
Return the uniqued reference to the type for a block of the specified type.
QualType 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 getAutoType(DeducedKind DK, QualType DeducedAsType, AutoTypeKeyword Keyword, TemplateDecl *TypeConstraintConcept=nullptr, ArrayRef< TemplateArgument > TypeConstraintArgs={}) const
C++11 deduced auto 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
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.
QualType getConstantMatrixType(QualType ElementType, unsigned NumRows, unsigned NumColumns) const
Return the unique reference to the matrix type of the specified element type and size.
IdentifierInfo * getNSCopyingName()
Retrieve the identifier 'NSCopying'.
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
This class is used for builtin types like 'int'.
StringRef getName(const PrintingPolicy &Policy) const
Represents a C++ struct/union/class.
bool isHLSLIntangible() const
Returns true if the class contains HLSL intangible type, either as a field or in base class.
bool mayBeNonDynamicClass() const
bool mayBeDynamicClass() const
CXXRecordDecl * getCanonicalDecl() override
Retrieves the "canonical" declaration of the given declaration.
Declaration of a class template.
Complex values, per C99 6.2.5p11.
Represents the canonical version of C arrays with a specified constant size.
static unsigned getNumAddressingBits(const ASTContext &Context, QualType ElementType, const llvm::APInt &NumElements)
Determine the number of bits required to address a member of.
static unsigned getMaxSizeBits(const ASTContext &Context)
Determine the maximum number of active bits that an array's size can require, which limits the maximu...
const Expr * getSizeExpr() const
Return a pointer to the size expression.
llvm::APInt getSize() const
Return the constant array size as an APInt.
void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Ctx)
ConstantExpr - An expression that occurs in a constant context and optionally the result of evaluatin...
llvm::APSInt getResultAsAPSInt() const
ConstantMatrixType(QualType MatrixElementType, unsigned NRows, unsigned NColumns, QualType CanonElementType)
unsigned NumRows
Number of rows and columns.
Represents a sugar type with __counted_by or __sized_by annotations, including their _or_null variant...
void Profile(llvm::FoldingSetNodeID &ID)
StringRef getAttributeName(bool WithMacroPrefix) const
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
ASTContext & getParentASTContext() const
Decl - This represents one declaration (or definition), e.g.
bool isInStdNamespace() const
ASTContext & getASTContext() const LLVM_READONLY
void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Context)
Expr * getNumBitsExpr() const
void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Context)
DependentBitIntType(bool IsUnsigned, Expr *NumBits)
void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Context)
void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Context)
void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Context)
void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Context)
void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Context)
Expr * getCondition() const
This represents one expression.
bool isValueDependent() const
Determines whether the value of this expression depends on.
bool isInstantiationDependent() const
Whether this expression is instantiation-dependent, meaning that it depends in some way on.
ExprDependence getDependence() const
Represents a member of a struct/union/class.
A mutable set of FunctionEffect::Kind.
void dump(llvm::raw_ostream &OS) const
FunctionEffectSet()=default
bool insert(const FunctionEffectWithCondition &NewEC, Conflicts &Errs)
SmallVector< Conflict > Conflicts
static FunctionEffectSet getIntersection(FunctionEffectsRef LHS, FunctionEffectsRef RHS)
void dump(llvm::raw_ostream &OS) const
static FunctionEffectSet getUnion(FunctionEffectsRef LHS, FunctionEffectsRef RHS, Conflicts &Errs)
Kind kind() const
The kind of the effect.
Kind
Identifies the particular effect.
bool shouldDiagnoseFunctionCall(bool Direct, FunctionEffectKindSet CalleeFX) const
StringRef name() const
The description printed in diagnostics, e.g. 'nonblocking'.
Kind oppositeKind() const
Return the opposite kind, for effects which have opposites.
std::optional< FunctionEffect > effectProhibitingInference(const Decl &Callee, FunctionEffectKindSet CalleeFX) const
Determine whether the effect is allowed to be inferred on the callee, which is either a FunctionDecl ...
An immutable set of FunctionEffects and possibly conditions attached to them.
void dump(llvm::raw_ostream &OS) const
ArrayRef< FunctionEffect > effects() const
ArrayRef< EffectConditionExpr > conditions() const
static FunctionEffectsRef create(ArrayRef< FunctionEffect > FX, ArrayRef< EffectConditionExpr > Conds)
Asserts invariants.
FunctionEffectsRef()=default
bool hasDependentExceptionSpec() const
Return whether this function has a dependent exception spec.
param_type_iterator param_type_begin() const
ExceptionSpecificationType getExceptionSpecType() const
Get the kind of exception specification on this function.
bool isTemplateVariadic() const
Determines whether this function prototype contains a parameter pack at the end.
unsigned getNumParams() const
bool hasTrailingReturn() const
Whether this function prototype has a trailing return type.
QualType getParamType(unsigned i) const
QualType getExceptionType(unsigned i) const
Return the ith exception type, where 0 <= i < getNumExceptions().
void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Ctx)
unsigned getNumExceptions() const
Return the number of types in the exception specification.
CanThrowResult canThrow() const
Determine whether this function type has a non-throwing exception specification.
ExtProtoInfo getExtProtoInfo() const
Expr * getNoexceptExpr() const
Return the expression inside noexcept(expression), or a null pointer if there is none (because the ex...
ArrayRef< QualType > getParamTypes() const
ArrayRef< QualType > exceptions() const
bool hasInstantiationDependentExceptionSpec() const
Return whether this function has an instantiation-dependent exception spec.
A class which abstracts out some details necessary for making a call.
ExtInfo getExtInfo() const
static StringRef getNameForCallConv(CallingConv CC)
bool getCFIUncheckedCalleeAttr() const
Determine whether this is a function prototype that includes the cfi_unchecked_callee attribute.
QualType getReturnType() const
FunctionType(TypeClass tc, QualType res, QualType Canonical, TypeDependence Dependence, ExtInfo Info)
One of these records is kept for each identifier that is lexed.
bool isStr(const char(&Str)[StrLen]) const
Return true if this is the identifier for the specified string.
LinkageInfo computeTypeLinkageInfo(const Type *T)
LinkageInfo getTypeLinkageAndVisibility(const Type *T)
LinkageInfo getDeclLinkageAndVisibility(const NamedDecl *D)
static LinkageInfo external()
Linkage getLinkage() const
void merge(LinkageInfo other)
Merge both linkage and visibility.
QualType getModifiedType() const
Return this attributed type's modified type with no qualifiers attached to it.
QualType getUnderlyingType() const
const IdentifierInfo * getMacroIdentifier() const
Represents a matrix type, as defined in the Matrix Types clang extensions.
MatrixType(QualType ElementTy, QualType CanonElementTy)
QualType ElementType
The element type of the matrix.
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.
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.
Declaration of a template type parameter.
[BoundsSafety] Represents information of declarations referenced by the arguments of the counted_by a...
ValueDecl * getDecl() const
bool operator==(const TypeCoupledDeclRefInfo &Other) const
void * getOpaqueValue() const
TypeCoupledDeclRefInfo(ValueDecl *D=nullptr, bool Deref=false)
D is to a declaration referenced by the argument of attribute.
void setFromOpaqueValue(void *V)
bool isSugared() const
Returns whether this type directly provides sugar.
TypeOfKind getKind() const
Returns the kind of 'typeof' type this is.
TypeOfExprType(const ASTContext &Context, Expr *E, TypeOfKind Kind, QualType Can=QualType())
Expr * getUnderlyingExpr() const
QualType desugar() const
Remove a single level of sugar.
static void ensure(const Type *T)
static CachedProperties get(QualType T)
static CachedProperties get(const Type *T)
A helper class for Type nodes having an ElaboratedTypeKeyword.
The base class of the type hierarchy.
bool isSizelessType() const
As an extension, we classify types as one of "sized" or "sizeless"; every type is one or the other.
bool isStructureType() const
bool isBlockPointerType() const
const ObjCObjectPointerType * getAsObjCQualifiedClassType() const
bool isLinkageValid() const
True if the computed linkage is valid.
TypedefBitfields TypedefBits
bool isBooleanType() const
const ObjCObjectType * getAsObjCQualifiedInterfaceType() const
const ObjCObjectPointerType * getAsObjCQualifiedIdType() const
const TemplateSpecializationType * getAsNonAliasTemplateSpecializationType() const
Look through sugar for an instance of TemplateSpecializationType which is not a type alias,...
bool isMFloat8Type() const
bool isSignedIntegerOrEnumerationType() const
Determines whether this is an integer type that is signed or an enumeration types whose underlying ty...
bool isPackedVectorBoolType(const ASTContext &ctx) const
bool hasAttr(attr::Kind AK) const
Determine whether this type had the specified attribute applied to it (looking through top-level type...
bool isAlwaysIncompleteType() const
QualType getRVVEltType(const ASTContext &Ctx) const
Returns the representative type for the element of an RVV builtin type.
const RecordType * getAsUnionType() const
NOTE: getAs*ArrayType are methods on ASTContext.
bool isLiteralType(const ASTContext &Ctx) const
Return true if this is a literal type (C++11 [basic.types]p10)
bool isSignedIntegerType() const
Return true if this is an integer type that is signed, according to C99 6.2.5p4 [char,...
bool isComplexType() const
isComplexType() does not include complex integers (a GCC extension).
ArrayTypeBitfields ArrayTypeBits
const ArrayType * castAsArrayTypeUnsafe() const
A variant of castAs<> for array type which silently discards qualifiers from the outermost type.
bool isUnsignedIntegerOrEnumerationType() const
Determines whether this is an integer type that is unsigned or an enumeration types whose underlying ...
bool isIntegralOrUnscopedEnumerationType() const
Determine whether this type is an integral or unscoped enumeration type.
CXXRecordDecl * getAsCXXRecordDecl() const
Retrieves the CXXRecordDecl that this type refers to, either because the type is a RecordType or beca...
VectorTypeBitfields VectorTypeBits
SubstPackTypeBitfields SubstPackTypeBits
RecordDecl * getAsRecordDecl() const
Retrieves the RecordDecl this type refers to.
bool hasIntegerRepresentation() const
Determine whether this type has an integer representation of some sort, e.g., it is an integer type o...
bool isVoidPointerType() const
const ComplexType * getAsComplexIntegerType() const
bool isConstantSizeType() const
Return true if this is not a variable sized type, according to the rules of C99 6....
QualType getLocallyUnqualifiedSingleStepDesugaredType() const
Pull a single level of sugar off of this locally-unqualified type.
bool isFunctionPointerType() const
bool isCountAttributedType() const
bool isObjCARCBridgableType() const
Determine whether the given type T is a "bridgable" Objective-C type, which is either an Objective-C ...
CXXRecordDecl * castAsCXXRecordDecl() const
bool isArithmeticType() const
bool isConstantMatrixType() const
bool isHLSLBuiltinIntangibleType() const
TypeOfBitfields TypeOfBits
bool isIntegerType() const
isIntegerType() does not include complex integers (a GCC extension).
bool isSVESizelessBuiltinType() const
Returns true for SVE scalable vector types.
const T * castAs() const
Member-template castAs<specific type>.
bool isReferenceType() const
bool isHLSLIntangibleType() const
bool isEnumeralType() const
void addDependence(TypeDependence D)
bool isObjCNSObjectType() const
Type(TypeClass tc, QualType canon, TypeDependence Dependence)
const ObjCObjectPointerType * getAsObjCInterfacePointerType() const
NestedNameSpecifier getPrefix() const
If this type represents a qualified-id, this returns its nested name specifier.
bool isScalarType() const
const CXXRecordDecl * getPointeeCXXRecordDecl() const
If this is a pointer or reference to a RecordType, return the CXXRecordDecl that the type refers to.
bool isInterfaceType() const
bool isVariableArrayType() const
bool isSizelessBuiltinType() const
bool isAMDGPUNamedBarrierTypeOrWrapper() const
Check if the type is the AMDGPU named barrier type/a RecordType of a named barrier wrapper,...
bool isCUDADeviceBuiltinSurfaceType() const
Check if the type is the CUDA device builtin surface type.
bool isSveVLSBuiltinType() const
Determines if this is a sizeless type supported by the 'arm_sve_vector_bits' type attribute,...
bool isIntegralType(const ASTContext &Ctx) const
Determine whether this type is an integral type.
bool isElaboratedTypeSpecifier() const
Determine wither this type is a C++ elaborated-type-specifier.
CountAttributedTypeBitfields CountAttributedTypeBits
const Type * getArrayElementTypeNoTypeQual() const
If this is an array type, return the element type of the array, potentially with type qualifiers miss...
QualType getPointeeType() const
If this is a pointer, ObjC object pointer, or block pointer, this returns the respective pointee.
LinkageInfo getLinkageAndVisibility() const
Determine the linkage and visibility of this type.
bool hasUnsignedIntegerRepresentation() const
Determine whether this type has an unsigned integer representation of some sort, e....
bool isAnyCharacterType() const
Determine whether this type is any of the built-in character types.
bool isExtVectorBoolType() const
bool isWebAssemblyExternrefType() const
Check if this is a WebAssembly Externref Type.
bool canHaveNullability(bool ResultIfUnknown=true) const
Determine whether the given type can have a nullability specifier applied to it, i....
QualType getSveEltType(const ASTContext &Ctx) const
Returns the representative type for the element of an SVE builtin type.
bool isInstantiationDependentType() const
Determine whether this type is an instantiation-dependent type, meaning that the type involves a temp...
bool isLValueReferenceType() const
bool isBitIntType() const
bool isBuiltinType() const
Helper methods to distinguish type categories.
bool isStructuralType() const
Determine if this type is a structural type, per C++20 [temp.param]p7.
bool isDependentType() const
Whether this type is a dependent type, meaning that its definition somehow depends on a template para...
bool isAggregateType() const
Determines whether the type is a C++ aggregate type or C aggregate or union type.
bool isCARCBridgableType() const
Determine whether the given type T is a "bridgeable" C type.
bool isSignableIntegerType(const ASTContext &Ctx) const
RecordDecl * castAsRecordDecl() const
bool isChar16Type() const
bool isAnyComplexType() const
DeducedType * getContainedDeducedType() const
Get the DeducedType whose type will be deduced for a variable with an initializer of this type.
bool containsUnexpandedParameterPack() const
Whether this type is or contains an unexpanded parameter pack, used to support C++0x variadic templat...
ScalarTypeKind getScalarTypeKind() const
Given that this is a scalar type, classify it.
bool hasSignedIntegerRepresentation() const
Determine whether this type has an signed integer representation of some sort, e.g....
QualType getCanonicalTypeInternal() const
const RecordType * getAsStructureType() const
const char * getTypeClassName() const
bool isWebAssemblyTableType() const
Returns true if this is a WebAssembly table type: either an array of reference types,...
@ PtrdiffT
The "ptrdiff_t" type.
@ SizeT
The "size_t" type.
@ SignedSizeT
The signed integer type corresponding to "size_t".
const Type * getBaseElementTypeUnsafe() const
Get the base element type of this type, potentially discarding type qualifiers.
bool isHLSLStandardLayoutRecordOrArrayOf() const
AttributedTypeBitfields AttributedTypeBits
bool isObjCBoxableRecordType() const
bool isMatrixType() const
bool isChar32Type() const
bool isStandardLayoutType() const
Test if this type is a standard-layout type.
TagTypeBitfields TagTypeBits
bool isOverflowBehaviorType() const
EnumDecl * castAsEnumDecl() const
bool isVariablyModifiedType() const
Whether this type is a variably-modified type (C99 6.7.5).
bool isComplexIntegerType() const
bool isUnscopedEnumerationType() const
bool isStdByteType() const
UnresolvedUsingBitfields UnresolvedUsingBits
bool isCUDADeviceBuiltinTextureType() const
Check if the type is the CUDA device builtin texture type.
bool isBlockCompatibleObjCPointerType(ASTContext &ctx) const
bool isObjCClassOrClassKindOfType() const
Whether the type is Objective-C 'Class' or a __kindof type of an Class type, e.g.,...
const ArrayType * getAsArrayTypeUnsafe() const
A variant of getAs<> for array types which silently discards qualifiers from the outermost type.
bool isObjCLifetimeType() const
Returns true if objects of this type have lifetime semantics under ARC.
bool isHLSLResourceRecord() const
EnumDecl * getAsEnumDecl() const
Retrieves the EnumDecl this type refers to.
bool isObjCIndirectLifetimeType() const
bool hasUnnamedOrLocalType() const
Whether this type is or contains a local or unnamed type.
bool isPointerOrReferenceType() const
Qualifiers::ObjCLifetime getObjCARCImplicitLifetime() const
Return the implicit lifetime for this type, which must not be dependent.
FunctionTypeBitfields FunctionTypeBits
bool isObjCQualifiedInterfaceType() const
bool isSpecifierType() const
Returns true if this type can be represented by some set of type specifiers.
bool isIncompleteType(NamedDecl **Def=nullptr) const
Types are partitioned into 3 broad categories (C99 6.2.5p1): object types, function types,...
bool isObjCObjectPointerType() const
SubstTemplateTypeParmTypeBitfields SubstTemplateTypeParmTypeBits
bool isStructureTypeWithFlexibleArrayMember() const
TypeDependence getDependence() const
bool hasFloatingRepresentation() const
Determine whether this type has a floating-point representation of some sort, e.g....
bool isStructureOrClassType() const
bool isAMDGPUNamedBarrierType() const
Check if the type is the AMDGPU named barrier type, or an array thereof.
bool isVectorType() const
bool isRVVVLSBuiltinType() const
Determines if this is a sizeless type supported by the 'riscv_rvv_vector_bits' type attribute,...
bool isRealFloatingType() const
Floating point categories.
bool isRVVSizelessBuiltinType() const
Returns true for RVV scalable vector types.
std::optional< ArrayRef< QualType > > getObjCSubstitutions(const DeclContext *dc) const
Retrieve the set of substitutions required when accessing a member of the Objective-C receiver type t...
const T * getAsCanonical() const
If this type is canonically the specified type, return its canonical type cast to that specified type...
Linkage getLinkage() const
Determine the linkage of this type.
ObjCObjectTypeBitfields ObjCObjectTypeBits
bool isFloatingType() const
const ObjCObjectType * getAsObjCInterfaceType() const
bool isWideCharType() const
bool isUnsignedIntegerType() const
Return true if this is an integer type that is unsigned, according to C99 6.2.5p6 [which returns true...
bool hasSizedVLAType() const
Whether this type involves a variable-length array type with a definite size.
TypeClass getTypeClass() const
bool isCanonicalUnqualified() const
Determines if this type would be canonical if it had no further qualification.
bool hasAutoForTrailingReturnType() const
Determine whether this type was written with a leading 'auto' corresponding to a trailing return type...
bool isObjCIdOrObjectKindOfType(const ASTContext &ctx, const ObjCObjectType *&bound) const
Whether the type is Objective-C 'id' or a __kindof type of an object type, e.g., __kindof NSView * or...
const T * getAs() const
Member-template getAs<specific type>'.
const Type * getUnqualifiedDesugaredType() const
Return the specified type with any "sugar" removed from the type, removing any typedefs,...
bool isObjCARCImplicitlyUnretainedType() const
Determines if this type, which must satisfy isObjCLifetimeType(), is implicitly __unsafe_unretained r...
bool isRecordType() const
bool isHLSLResourceRecordArray() const
bool isObjCRetainableType() const
bool isObjCIndependentClassType() const
bool isSizelessVectorType() const
Returns true for all scalable vector types.
bool isScopedEnumeralType() const
Determine whether this type is a scoped enumeration type.
NullabilityKindOrNone getNullability() const
Determine the nullability of the given type.
bool acceptsObjCTypeParams() const
Determines if this is an ObjC interface type that may accept type parameters.
QualType getSizelessVectorEltType(const ASTContext &Ctx) const
Returns the representative type for the element of a sizeless vector builtin type.
bool isUnicodeCharacterType() const
bool hasBooleanRepresentation() const
Determine whether this type has a boolean representation – i.e., it is a boolean type,...
Base class for declarations which introduce a typedef-name.
QualType getUnderlyingType() const
bool typeMatchesDecl() const
Represents a dependent using declaration which was marked with typename.
Represents a shadow declaration implicitly introduced into a scope by a (resolved) using-declaration ...
Represent the declaration of a variable (in which case it is an lvalue) a function (in which case it ...
Represents a GCC generic vector type.
VectorType(QualType vecType, unsigned nElements, QualType canonType, VectorKind vecKind)
QualType ElementType
The element type of the vector.
QualType getElementType() const
Defines the Linkage enumeration and various utility functions.
Defines the clang::TargetInfo interface.
mlir::Type getBaseType(mlir::Value varPtr)
@ AttributedType
The l-value was considered opaque, so the alignment was determined from a type, but that type was an ...
const internal::VariadicAllOfMatcher< Attr > attr
const internal::VariadicAllOfMatcher< Type > type
Matches Types in the clang AST.
const internal::VariadicAllOfMatcher< Decl > decl
Matches declarations.
const AstTypeMatcher< TypedefType > typedefType
void info(bool Verbose, unsigned Level, const char *Fmt, Ts &&...Args)
Prints an indented note to stderr when Verbose is set.
Top level wrappers for InstallAPI frontend operations.
@ Overload
This is a legitimate overload: the existing declarations are functions or function templates with dif...
bool isa(CodeGen::Address addr)
if(T->getSizeExpr()) TRY_TO(TraverseStmt(const_cast< Expr * >(T -> getSizeExpr())))
AutoTypeKeyword
Which keyword(s) were used to create an AutoType.
CanThrowResult
Possible results from evaluation of a noexcept expression.
TypeDependenceScope::TypeDependence TypeDependence
Linkage minLinkage(Linkage L1, Linkage L2)
Compute the minimum linkage given two linkages.
@ Nullable
Values of this type can be null.
@ Unspecified
Whether values of this type can be null is (explicitly) unspecified.
@ NonNull
Values of this type can never be null.
@ TemplateName
The identifier is a template name. FIXME: Add an annotation for that.
bool IsEnumDeclComplete(EnumDecl *ED)
Check if the given decl is complete.
bool isPackProducingBuiltinTemplateName(TemplateName N)
ExprDependence computeDependence(FullExpr *E)
@ Private
'private' clause, allowed on 'parallel', 'serial', 'loop', 'parallel loop', and 'serial loop' constru...
@ Vector
'vector' clause, allowed on 'loop', Combined, and 'routine' directives.
TypeOfKind
The kind of 'typeof' expression we're after.
nullptr
This class represents a compute construct, representing a 'Kind' of ‘parallel’, 'serial',...
TypeDependence toTypeDependence(ExprDependence D)
ExprDependence turnValueToTypeDependence(ExprDependence D)
@ Dependent
Parse the block as a dependent block, which may be used in some template instantiations but not other...
Linkage
Describes the different kinds of linkage (C++ [basic.link], C99 6.2.2) that an entity may have.
@ External
External linkage, which indicates that the entity can be referred to from other translation units.
ObjCSubstitutionContext
The kind of type we are substituting Objective-C type arguments into.
@ Superclass
The superclass of a type.
@ Result
The result type of a method or function.
ArraySizeModifier
Capture whether this is a normal array (e.g.
OptionalUnsigned< unsigned > UnsignedOrNone
const FunctionProtoType * T
bool isComputedNoexcept(ExceptionSpecificationType ESpecType)
@ Template
We are parsing a template declaration.
TagTypeKind
The kind of a tag type.
@ Interface
The "__interface" keyword.
@ Struct
The "struct" keyword.
@ Class
The "class" keyword.
@ Union
The "union" keyword.
@ Enum
The "enum" keyword.
@ Keyword
The name has been typo-corrected to a keyword.
@ Type
The name was classified as a type.
LangAS
Defines the address space values used by the address space qualifier of QualType.
void FixedPointValueToString(SmallVectorImpl< char > &Str, llvm::APSInt Val, unsigned Scale)
@ Deduced
The normal deduced case.
@ Undeduced
Not deduced yet. This is for example an 'auto' which was just parsed.
@ DeducedAsPack
Same as above, but additionally this represents a case where the deduced entity itself is a pack.
@ DeducedAsDependent
This is a special case where the initializer is dependent, so we can't deduce a type yet.
std::tuple< NamedDecl *, TemplateArgument > getReplacedTemplateParameter(Decl *D, unsigned Index)
Internal helper used by Subst* nodes to retrieve a parameter from the AssociatedDecl,...
bool isPtrSizeAddressSpace(LangAS AS)
const StreamingDiagnostic & operator<<(const StreamingDiagnostic &DB, const ConceptReference *C)
Insertion operator for diagnostics.
CallingConv
CallingConv - Specifies the calling convention that a function uses.
U cast(CodeGen::Address addr)
@ None
The alignment was not explicit in code.
@ PackIndex
Index of a pack indexing expression or specifier.
ElaboratedTypeKeyword
The elaboration keyword that precedes a qualified type name or introduces an elaborated-type-specifie...
@ Interface
The "__interface" keyword introduces the elaborated-type-specifier.
@ None
No keyword precedes the qualified type name.
@ Struct
The "struct" keyword introduces the elaborated-type-specifier.
@ Class
The "class" keyword introduces the elaborated-type-specifier.
@ Union
The "union" keyword introduces the elaborated-type-specifier.
@ Enum
The "enum" keyword introduces the elaborated-type-specifier.
@ Typename
The "typename" keyword precedes the qualified type name, e.g., typename T::type.
TypeDependence toSemanticDependence(TypeDependence D)
TypeDependence toSyntacticDependence(TypeDependence D)
@ Other
Other implicit parameter.
@ EST_DependentNoexcept
noexcept(expression), value-dependent
@ EST_Uninstantiated
not instantiated yet
@ EST_Unparsed
not parsed yet
@ EST_NoThrow
Microsoft __declspec(nothrow) extension.
@ EST_None
no exception specification
@ EST_MSAny
Microsoft throw(...) extension.
@ EST_BasicNoexcept
noexcept
@ EST_NoexceptFalse
noexcept(expression), evals to 'false'
@ EST_Unevaluated
not evaluated yet, for special member function
@ EST_NoexceptTrue
noexcept(expression), evals to 'true'
@ EST_Dynamic
throw(T1, T2)
OptionalUnsigned< NullabilityKind > NullabilityKindOrNone
__UINTPTR_TYPE__ uintptr_t
An unsigned integer type with the property that any valid pointer to void can be converted to this ty...
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.