26 #include "llvm/ADT/APSInt.h"
27 #include "llvm/ADT/StringExtras.h"
28 #include "llvm/Support/raw_ostream.h"
30 using namespace clang;
33 return (*
this != Other) &&
72 return AT->getElementType().isConstant(Ctx);
79 const llvm::APInt &NumElements) {
88 if (llvm::isPowerOf2_64(ElementSize)) {
89 return NumElements.getActiveBits() + llvm::Log2_64(ElementSize);
94 if ((ElementSize >> 32) == 0 && NumElements.getBitWidth() <= 64 &&
95 (NumElements.getZExtValue() >> 32) == 0) {
96 uint64_t TotalSize = NumElements.getZExtValue() * ElementSize;
97 return 64 - llvm::countLeadingZeros(TotalSize);
101 llvm::APSInt SizeExtended(NumElements,
true);
103 SizeExtended = SizeExtended.extend(std::max(SizeTypeBits,
104 SizeExtended.getBitWidth()) * 2);
106 llvm::APSInt TotalSize(llvm::APInt(SizeExtended.getBitWidth(), ElementSize));
107 TotalSize *= SizeExtended;
109 return TotalSize.getActiveBits();
126 Expr *e, ArraySizeModifier sm,
129 :
ArrayType(DependentSizedArray, et, can, sm, tq,
130 (et->containsUnexpandedParameterPack() ||
131 (e && e->containsUnexpandedParameterPack()))),
132 Context(Context), SizeExpr((
Stmt*) e), Brackets(brackets)
143 ID.AddInteger(SizeMod);
144 ID.AddInteger(TypeQuals);
145 E->Profile(ID, Context,
true);
148 DependentSizedExtVectorType::DependentSizedExtVectorType(
const
154 :
Type(DependentSizedExtVector, can,
true,
156 ElementType->isVariablyModifiedType(),
157 (ElementType->containsUnexpandedParameterPack() ||
158 (SizeExpr && SizeExpr->containsUnexpandedParameterPack()))),
159 Context(Context), SizeExpr(SizeExpr), ElementType(ElementType),
169 SizeExpr->Profile(ID, Context,
true);
174 :
VectorType(Vector, vecType, nElements, canonType, vecKind) {}
178 :
Type(tc, canonType, vecType->isDependentType(),
179 vecType->isInstantiationDependentType(),
180 vecType->isVariablyModifiedType(),
181 vecType->containsUnexpandedParameterPack()),
193 if (
const ArrayType *ATy = dyn_cast<ArrayType>(
this))
194 return ATy->getElementType().getTypePtr();
197 if (!isa<ArrayType>(CanonicalType))
226 #define ABSTRACT_TYPE(Class, Parent)
227 #define TYPE(Class, Parent) \
228 case Type::Class: { \
229 const Class##Type *ty = cast<Class##Type>(this); \
230 if (!ty->isSugared()) return QualType(ty, 0); \
231 return ty->desugar(); \
233 #include "clang/AST/TypeNodes.def"
235 llvm_unreachable(
"bad type kind!");
245 #define ABSTRACT_TYPE(Class, Parent)
246 #define TYPE(Class, Parent) \
247 case Type::Class: { \
248 const Class##Type *Ty = cast<Class##Type>(CurTy); \
249 if (!Ty->isSugared()) \
250 return SplitQualType(Ty, Qs); \
251 Cur = Ty->desugar(); \
254 #include "clang/AST/TypeNodes.def"
266 const Type *lastTypeWithQuals = split.
Ty;
274 #define ABSTRACT_TYPE(Class, Parent)
275 #define TYPE(Class, Parent) \
276 case Type::Class: { \
277 const Class##Type *ty = cast<Class##Type>(split.Ty); \
278 if (!ty->isSugared()) goto done; \
279 next = ty->desugar(); \
282 #include "clang/AST/TypeNodes.def"
287 split = next.
split();
289 lastTypeWithQuals = split.
Ty;
301 T = PT->getInnerType();
310 if (
const T *Sugar = dyn_cast<T>(Cur))
313 #define ABSTRACT_TYPE(Class, Parent)
314 #define TYPE(Class, Parent) \
315 case Type::Class: { \
316 const Class##Type *Ty = cast<Class##Type>(Cur); \
317 if (!Ty->isSugared()) return 0; \
318 Cur = Ty->desugar().getTypePtr(); \
321 #include "clang/AST/TypeNodes.def"
327 return getAsSugar<TypedefType>(
this);
331 return getAsSugar<TemplateSpecializationType>(
this);
335 return getAsSugar<AttributedType>(
this);
342 const Type *Cur =
this;
346 #define ABSTRACT_TYPE(Class, Parent)
347 #define TYPE(Class, Parent) \
349 const Class##Type *Ty = cast<Class##Type>(Cur); \
350 if (!Ty->isSugared()) return Cur; \
351 Cur = Ty->desugar().getTypePtr(); \
354 #include "clang/AST/TypeNodes.def"
359 if (
const RecordType *RT = getAs<RecordType>())
360 return RT->getDecl()->isClass();
364 if (
const RecordType *RT = getAs<RecordType>())
365 return RT->getDecl()->isStruct();
369 if (
const RecordType *RT = getAs<RecordType>())
370 return RT->getDecl()->hasAttr<ObjCBoxableAttr>();
374 if (
const RecordType *RT = getAs<RecordType>())
375 return RT->getDecl()->isInterface();
379 if (
const RecordType *RT = getAs<RecordType>()) {
387 return PT->getPointeeType()->isVoidType();
392 if (
const RecordType *RT = getAs<RecordType>())
393 return RT->getDecl()->isUnion();
398 if (
const ComplexType *CT = dyn_cast<ComplexType>(CanonicalType))
399 return CT->getElementType()->isFloatingType();
409 if (
const ComplexType *Complex = getAs<ComplexType>())
410 if (Complex->getElementType()->isIntegerType())
433 if (
const RecordType *RT = dyn_cast<RecordType>(
this)) {
434 if (RT->getDecl()->isStruct())
439 if (
const RecordType *RT = dyn_cast<RecordType>(CanonicalType)) {
440 if (!RT->getDecl()->isStruct())
452 if (
const RecordType *RT = dyn_cast<RecordType>(
this)) {
453 if (RT->getDecl()->isUnion())
458 if (
const RecordType *RT = dyn_cast<RecordType>(CanonicalType)) {
459 if (!RT->getDecl()->isUnion())
520 const Type *cur =
this;
522 if (
auto attributed = dyn_cast<AttributedType>(cur)) {
523 if (attributed->getAttrKind() ==
539 :
Type(ObjCObject, Canonical, Base->isDependentType(),
540 Base->isInstantiationDependentType(),
541 Base->isVariablyModifiedType(),
542 Base->containsUnexpandedParameterPack()),
549 "bitfield overflow in type argument count");
552 "bitfield overflow in protocol count");
553 if (!typeArgs.empty())
554 memcpy(getTypeArgStorage(), typeArgs.data(),
555 typeArgs.size() *
sizeof(
QualType));
556 if (!protocols.empty())
557 memcpy(getProtocolStorage(), protocols.data(),
560 for (
auto typeArg : typeArgs) {
561 if (typeArg->isDependentType())
563 else if (typeArg->isInstantiationDependentType())
566 if (typeArg->containsUnexpandedParameterPack())
577 if (
auto objcObject =
getBaseType()->getAs<ObjCObjectType>()) {
579 if (isa<ObjCInterfaceType>(objcObject))
582 return objcObject->isSpecialized();
595 if (
auto objcObject =
getBaseType()->getAs<ObjCObjectType>()) {
597 if (isa<ObjCInterfaceType>(objcObject))
600 return objcObject->getTypeArgs();
612 if (
auto objcObject =
getBaseType()->getAs<ObjCObjectType>()) {
614 if (isa<ObjCInterfaceType>(objcObject))
617 return objcObject->isKindOfType();
634 baseType = baseObj->stripObjCKindOfTypeAndQuals(ctx);
638 splitBaseType.
Quals),
660 struct SimpleTransformVisitor
661 :
public TypeVisitor<SimpleTransformVisitor<F>, QualType> {
666 return simpleTransform(Ctx, type, std::move(TheFunc));
670 SimpleTransformVisitor(
ASTContext &ctx, F &&f) : Ctx(ctx), TheFunc(std::move(f)) { }
674 #define TYPE(Class, Base)
675 #define DEPENDENT_TYPE(Class, Base) \
676 QualType Visit##Class##Type(const Class##Type *T) { return QualType(T, 0); }
677 #include "clang/AST/TypeNodes.def"
679 #define TRIVIAL_TYPE_CLASS(Class) \
680 QualType Visit##Class##Type(const Class##Type *T) { return QualType(T, 0); }
685 QualType elementType = recurse(T->getElementType());
689 if (elementType.
getAsOpaquePtr() == T->getElementType().getAsOpaquePtr())
832 bool paramChanged =
false;
834 QualType newParamType = recurse(paramType);
835 if (newParamType.
isNull())
841 paramTypes.push_back(newParamType);
846 bool exceptionChanged =
false;
850 QualType newExceptionType = recurse(exceptionType);
851 if (newExceptionType.
isNull())
855 != exceptionType.getAsOpaquePtr())
856 exceptionChanged =
true;
858 exceptionTypes.push_back(newExceptionType);
861 if (exceptionChanged) {
863 llvm::makeArrayRef(exceptionTypes).copy(Ctx);
868 !paramChanged && !exceptionChanged)
888 QualType originalType = recurse(T->getOriginalType());
889 if (originalType.
isNull())
892 QualType adjustedType = recurse(T->getAdjustedType());
893 if (adjustedType.
isNull())
897 == T->getOriginalType().getAsOpaquePtr() &&
898 adjustedType.
getAsOpaquePtr() == T->getAdjustedType().getAsOpaquePtr())
906 if (originalType.
isNull())
927 QualType modifiedType = recurse(T->getModifiedType());
928 if (modifiedType.
isNull())
931 QualType equivalentType = recurse(T->getEquivalentType());
932 if (equivalentType.
isNull())
936 == T->getModifiedType().getAsOpaquePtr() &&
938 == T->getEquivalentType().getAsOpaquePtr())
947 if (replacementType.
isNull())
965 QualType deducedType = recurse(T->getDeducedType());
970 == T->getDeducedType().getAsOpaquePtr())
973 return Ctx.
getAutoType(deducedType, T->getKeyword(),
981 QualType baseType = recurse(T->getBaseType());
986 bool typeArgChanged =
false;
988 for (
auto typeArg : T->getTypeArgsAsWritten()) {
989 QualType newTypeArg = recurse(typeArg);
994 typeArgChanged =
true;
996 typeArgs.push_back(newTypeArg);
999 if (baseType.
getAsOpaquePtr() == T->getBaseType().getAsOpaquePtr() &&
1004 llvm::makeArrayRef(T->qual_begin(),
1005 T->getNumProtocols()),
1006 T->isKindOfTypeAsWritten());
1012 QualType pointeeType = recurse(T->getPointeeType());
1013 if (pointeeType.
isNull())
1017 == T->getPointeeType().getAsOpaquePtr())
1035 #undef TRIVIAL_TYPE_CLASS
1040 template<
typename F>
1051 SimpleTransformVisitor<F> visitor(ctx, std::move(f));
1052 QualType result = visitor.Visit(splitType.
Ty);
1069 return simpleTransform(ctx, *
this,
1075 if (
const auto *typedefTy = dyn_cast<TypedefType>(splitType.
Ty)) {
1076 if (
auto *typeParam = dyn_cast<ObjCTypeParamDecl>(typedefTy->getDecl())) {
1078 if (!typeArgs.empty()) {
1080 QualType argType = typeArgs[typeParam->getIndex()];
1095 const auto *objPtr = typeParam->getUnderlyingType()
1100 if (objPtr->isKindOfType() || objPtr->isObjCIdOrClassType())
1105 const auto *obj = objPtr->getObjectType();
1107 obj->getTypeArgsAsWritten(),
1108 obj->getProtocols(),
1120 if (
const auto *funcType = dyn_cast<FunctionType>(splitType.
Ty)) {
1122 QualType returnType = funcType->getReturnType().substObjCTypeArgs(
1131 if (isa<FunctionNoProtoType>(funcType)) {
1134 == funcType->getReturnType().getAsOpaquePtr())
1141 const auto *funcProtoType = cast<FunctionProtoType>(funcType);
1145 bool paramChanged =
false;
1146 for (
auto paramType : funcProtoType->getParamTypes()) {
1151 if (newParamType.
isNull())
1155 paramChanged =
true;
1157 paramTypes.push_back(newParamType);
1162 bool exceptionChanged =
false;
1170 if (newExceptionType.
isNull())
1174 != exceptionType.getAsOpaquePtr())
1175 exceptionChanged =
true;
1177 exceptionTypes.push_back(newExceptionType);
1180 if (exceptionChanged) {
1182 llvm::makeArrayRef(exceptionTypes).copy(ctx);
1187 == funcProtoType->getReturnType().getAsOpaquePtr() &&
1188 !paramChanged && !exceptionChanged)
1196 if (
const auto *objcObjectType = dyn_cast<ObjCObjectType>(splitType.
Ty)) {
1197 if (objcObjectType->isSpecializedAsWritten()) {
1199 bool anyChanged =
false;
1200 for (
auto typeArg : objcObjectType->getTypeArgsAsWritten()) {
1211 objcObjectType->qual_begin(),
1212 objcObjectType->getNumProtocols());
1213 if (typeArgs.empty() &&
1216 objcObjectType->getBaseType(), { },
1218 objcObjectType->isKindOfTypeAsWritten());
1224 newTypeArgs.push_back(newTypeArg);
1229 objcObjectType->qual_begin(),
1230 objcObjectType->getNumProtocols());
1232 newTypeArgs, protocols,
1233 objcObjectType->isKindOfTypeAsWritten());
1255 auto &ctx =
const_cast<ASTContext &
>(constCtx);
1256 return simpleTransform(ctx, *
this,
1260 if (!objType->isKindOfType())
1264 = objType->getBaseType().stripObjCKindOfType(ctx);
1267 objType->getTypeArgsAsWritten(),
1268 objType->getProtocols(),
1280 if (
auto method = dyn_cast<ObjCMethodDecl>(dc))
1281 dc = method->getDeclContext();
1298 if (!dcCategoryDecl)
1303 dcTypeParams = dcCategoryDecl->getTypeParamList();
1307 dcClassDecl = dcCategoryDecl->getClassInterface();
1311 assert(dcTypeParams &&
"No substitutions to perform");
1312 assert(dcClassDecl &&
"No class context");
1316 if (
const auto *objectPointerType = getAs<ObjCObjectPointerType>()) {
1317 objectType = objectPointerType->getObjectType();
1318 }
else if (getAs<BlockPointerType>()) {
1321 ->castAs<ObjCObjectType>();;
1323 objectType = getAs<ObjCObjectType>();
1329 if (!curClassDecl) {
1337 while (curClassDecl != dcClassDecl) {
1339 QualType superType = objectType->getSuperClassType();
1340 if (superType.
isNull()) {
1341 objectType =
nullptr;
1351 if (!objectType || objectType->isUnspecialized()) {
1356 return objectType->getTypeArgs();
1359 bool Type::acceptsObjCTypeParams()
const {
1361 if (
auto *
ID = IfaceT->getInterface()) {
1362 if (
ID->getTypeParamList())
1376 CachedSuperClassType.setInt(
true);
1382 if (!superClassObjTy) {
1383 CachedSuperClassType.setInt(
true);
1388 if (!superClassDecl) {
1389 CachedSuperClassType.setInt(
true);
1395 QualType superClassType(superClassObjTy, 0);
1397 if (!superClassTypeParams) {
1398 CachedSuperClassType.setPointerAndInt(
1405 CachedSuperClassType.setPointerAndInt(superClassObjTy,
true);
1413 CachedSuperClassType.setPointerAndInt(
1424 CachedSuperClassType.setPointerAndInt(
1432 assert(typeArgs.size() == typeParams->
size());
1433 CachedSuperClassType.setPointerAndInt(
1436 ->castAs<ObjCObjectType>(),
1442 return interfaceDecl->getASTContext().getObjCInterfaceType(interfaceDecl)
1451 if (superObjectType.
isNull())
1452 return superObjectType;
1463 if (T->getNumProtocols() && T->getInterface())
1476 if (OPT->isObjCQualifiedIdType())
1486 if (OPT->isObjCQualifiedClassType())
1494 if (OT->getInterface())
1501 if (OPT->getInterfaceType())
1523 return dyn_cast_or_null<CXXRecordDecl>(
getAsTagDecl());
1527 if (
const auto *TT = getAs<TagType>())
1528 return cast<TagDecl>(TT->getDecl());
1529 if (
const auto *Injected = getAs<InjectedClassNameType>())
1530 return Injected->getDecl();
1536 class GetContainedAutoVisitor :
1537 public TypeVisitor<GetContainedAutoVisitor, AutoType*> {
1567 AutoType *VisitDependentSizedExtVectorType(
1590 return GetContainedAutoVisitor().Visit(
this);
1594 if (
const VectorType *VT = dyn_cast<VectorType>(CanonicalType))
1595 return VT->getElementType()->isIntegerType();
1620 if (
const BuiltinType *BT = dyn_cast<BuiltinType>(CanonicalType))
1621 return BT->getKind() >= BuiltinType::Bool &&
1622 BT->getKind() <= BuiltinType::Int128;
1626 if (
const EnumType *ET = dyn_cast<EnumType>(CanonicalType))
1627 return ET->getDecl()->isComplete();
1634 if (
const BuiltinType *BT = dyn_cast<BuiltinType>(CanonicalType))
1635 return BT->getKind() >= BuiltinType::Bool &&
1636 BT->getKind() <= BuiltinType::Int128;
1642 if (
const EnumType *ET = dyn_cast<EnumType>(CanonicalType))
1643 return ET->getDecl()->isComplete() && !ET->getDecl()->isScoped();
1651 if (
const BuiltinType *BT = dyn_cast<BuiltinType>(CanonicalType))
1652 return BT->getKind() == BuiltinType::Char_U ||
1653 BT->getKind() == BuiltinType::UChar ||
1654 BT->getKind() == BuiltinType::Char_S ||
1655 BT->getKind() == BuiltinType::SChar;
1660 if (
const BuiltinType *BT = dyn_cast<BuiltinType>(CanonicalType))
1661 return BT->getKind() == BuiltinType::WChar_S ||
1662 BT->getKind() == BuiltinType::WChar_U;
1667 if (
const BuiltinType *BT = dyn_cast<BuiltinType>(CanonicalType))
1668 return BT->getKind() == BuiltinType::Char16;
1673 if (
const BuiltinType *BT = dyn_cast<BuiltinType>(CanonicalType))
1674 return BT->getKind() == BuiltinType::Char32;
1682 if (!BT)
return false;
1684 default:
return false;
1685 case BuiltinType::Char_U:
1686 case BuiltinType::UChar:
1687 case BuiltinType::WChar_U:
1688 case BuiltinType::Char16:
1689 case BuiltinType::Char32:
1690 case BuiltinType::Char_S:
1691 case BuiltinType::SChar:
1692 case BuiltinType::WChar_S:
1701 if (
const BuiltinType *BT = dyn_cast<BuiltinType>(CanonicalType)) {
1702 return BT->getKind() >= BuiltinType::Char_S &&
1703 BT->getKind() <= BuiltinType::Int128;
1706 if (
const EnumType *ET = dyn_cast<EnumType>(CanonicalType)) {
1709 if (ET->getDecl()->isComplete() && !ET->getDecl()->isScoped())
1710 return ET->getDecl()->getIntegerType()->isSignedIntegerType();
1717 if (
const BuiltinType *BT = dyn_cast<BuiltinType>(CanonicalType)) {
1718 return BT->getKind() >= BuiltinType::Char_S &&
1719 BT->getKind() <= BuiltinType::Int128;
1722 if (
const EnumType *ET = dyn_cast<EnumType>(CanonicalType)) {
1723 if (ET->getDecl()->isComplete())
1724 return ET->getDecl()->getIntegerType()->isSignedIntegerType();
1731 if (
const VectorType *VT = dyn_cast<VectorType>(CanonicalType))
1732 return VT->getElementType()->isSignedIntegerOrEnumerationType();
1741 if (
const BuiltinType *BT = dyn_cast<BuiltinType>(CanonicalType)) {
1742 return BT->getKind() >= BuiltinType::Bool &&
1743 BT->getKind() <= BuiltinType::UInt128;
1746 if (
const EnumType *ET = dyn_cast<EnumType>(CanonicalType)) {
1749 if (ET->getDecl()->isComplete() && !ET->getDecl()->isScoped())
1750 return ET->getDecl()->getIntegerType()->isUnsignedIntegerType();
1757 if (
const BuiltinType *BT = dyn_cast<BuiltinType>(CanonicalType)) {
1758 return BT->getKind() >= BuiltinType::Bool &&
1759 BT->getKind() <= BuiltinType::UInt128;
1762 if (
const EnumType *ET = dyn_cast<EnumType>(CanonicalType)) {
1763 if (ET->getDecl()->isComplete())
1764 return ET->getDecl()->getIntegerType()->isUnsignedIntegerType();
1771 if (
const VectorType *VT = dyn_cast<VectorType>(CanonicalType))
1772 return VT->getElementType()->isUnsignedIntegerOrEnumerationType();
1778 if (
const BuiltinType *BT = dyn_cast<BuiltinType>(CanonicalType))
1779 return BT->getKind() >= BuiltinType::Half &&
1780 BT->getKind() <= BuiltinType::LongDouble;
1781 if (
const ComplexType *CT = dyn_cast<ComplexType>(CanonicalType))
1782 return CT->getElementType()->isFloatingType();
1787 if (
const VectorType *VT = dyn_cast<VectorType>(CanonicalType))
1788 return VT->getElementType()->isFloatingType();
1794 if (
const BuiltinType *BT = dyn_cast<BuiltinType>(CanonicalType))
1795 return BT->isFloatingPoint();
1800 if (
const BuiltinType *BT = dyn_cast<BuiltinType>(CanonicalType))
1801 return BT->getKind() >= BuiltinType::Bool &&
1802 BT->getKind() <= BuiltinType::LongDouble;
1803 if (
const EnumType *ET = dyn_cast<EnumType>(CanonicalType))
1804 return ET->getDecl()->isComplete() && !ET->getDecl()->isScoped();
1809 if (
const BuiltinType *BT = dyn_cast<BuiltinType>(CanonicalType))
1810 return BT->getKind() >= BuiltinType::Bool &&
1811 BT->getKind() <= BuiltinType::LongDouble;
1812 if (
const EnumType *ET = dyn_cast<EnumType>(CanonicalType))
1819 return !ET->getDecl()->isScoped() && ET->getDecl()->isComplete();
1820 return isa<ComplexType>(CanonicalType);
1826 const Type *T = CanonicalType.getTypePtr();
1827 if (
const BuiltinType *BT = dyn_cast<BuiltinType>(T)) {
1828 if (BT->getKind() == BuiltinType::Bool)
return STK_Bool;
1829 if (BT->getKind() == BuiltinType::NullPtr)
return STK_CPointer;
1832 llvm_unreachable(
"unknown scalar builtin type");
1833 }
else if (isa<PointerType>(T)) {
1835 }
else if (isa<BlockPointerType>(T)) {
1837 }
else if (isa<ObjCObjectPointerType>(T)) {
1839 }
else if (isa<MemberPointerType>(T)) {
1841 }
else if (isa<EnumType>(T)) {
1842 assert(cast<EnumType>(T)->getDecl()->isComplete());
1844 }
else if (
const ComplexType *CT = dyn_cast<ComplexType>(T)) {
1845 if (CT->getElementType()->isRealFloatingType())
1850 llvm_unreachable(
"unknown scalar type");
1863 if (
const RecordType *Record = dyn_cast<RecordType>(CanonicalType)) {
1864 if (
CXXRecordDecl *ClassDecl = dyn_cast<CXXRecordDecl>(Record->getDecl()))
1865 return ClassDecl->isAggregate();
1870 return isa<ArrayType>(CanonicalType);
1877 assert(!
isIncompleteType() &&
"This doesn't make sense for incomplete types");
1878 assert(!
isDependentType() &&
"This doesn't make sense for dependent types");
1880 return !isa<VariableArrayType>(CanonicalType);
1890 switch (CanonicalType->getTypeClass()) {
1891 default:
return false;
1897 EnumDecl *EnumD = cast<EnumType>(CanonicalType)->getDecl();
1910 RecordDecl *Rec = cast<RecordType>(CanonicalType)->getDecl();
1922 case IncompleteArray:
1925 case MemberPointer: {
1929 auto *MPTy = cast<MemberPointerType>(CanonicalType);
1930 const Type *ClassTy = MPTy->getClass();
1932 if (ClassTy->isDependentType())
1943 if (RD->
hasAttr<MSInheritanceAttr>())
1948 return cast<ObjCObjectType>(CanonicalType)->getBaseType()
1949 ->isIncompleteType(Def);
1950 case ObjCInterface: {
1953 = cast<ObjCInterfaceType>(CanonicalType)->getDecl();
1976 if ((*this)->isIncompleteArrayType())
1979 if ((*this)->isIncompleteType())
2000 default:
return false;
2001 case Type::VariableArray:
2002 case Type::ConstantArray:
2006 case Type::ObjCObjectPointer:
2007 case Type::BlockPointer:
2011 case Type::MemberPointer:
2013 case Type::ExtVector:
2021 = dyn_cast<CXXRecordDecl>(cast<RecordType>(CanonicalType)->getDecl()))
2022 return ClassDecl->isPOD();
2036 if ((*this)->isArrayType())
2041 if ((*this)->isIncompleteType())
2055 if ((*this)->isObjCLifetimeType())
2075 dyn_cast<CXXRecordDecl>(RT->getDecl())) {
2080 return ClassDecl->hasDefaultConstructor() &&
2081 !ClassDecl->hasNonTrivialDefaultConstructor() &&
2082 ClassDecl->isTriviallyCopyable();
2093 if ((*this)->isArrayType())
2107 if ((*this)->isObjCLifetimeType())
2136 dyn_cast<CXXRecordDecl>(RT->getDecl())) {
2137 if (!ClassDecl->isTriviallyCopyable())
return false;
2166 assert(BaseTy &&
"NULL element type");
2197 dyn_cast<CXXRecordDecl>(RT->getDecl()))
2198 return ClassDecl->isLiteral();
2205 return AT->getValueType()->isLiteralType(Ctx);
2224 assert(BaseTy &&
"NULL element type");
2235 dyn_cast<CXXRecordDecl>(RT->getDecl()))
2236 if (!ClassDecl->isStandardLayout())
2276 assert(BaseTy &&
"NULL element type");
2287 dyn_cast<CXXRecordDecl>(RT->getDecl())) {
2290 if (!ClassDecl->isTrivial())
return false;
2295 if (!ClassDecl->isStandardLayout())
return false;
2316 switch (BT->getKind()) {
2317 case BuiltinType::Bool:
2318 case BuiltinType::Char_S:
2319 case BuiltinType::Char_U:
2320 case BuiltinType::SChar:
2321 case BuiltinType::UChar:
2322 case BuiltinType::Short:
2323 case BuiltinType::UShort:
2324 case BuiltinType::WChar_S:
2325 case BuiltinType::WChar_U:
2326 case BuiltinType::Char16:
2327 case BuiltinType::Char32:
2335 if (
const EnumType *ET = getAs<EnumType>()){
2336 if (this->
isDependentType() || ET->getDecl()->getPromotionType().isNull()
2337 || ET->getDecl()->isScoped())
2356 case TemplateTypeParm:
2357 case SubstTemplateTypeParm:
2358 case TemplateSpecialization:
2361 case DependentTemplateSpecialization:
2364 case ObjCObjectPointer:
2394 llvm_unreachable(
"Type specifier is not a tag type kind.");
2406 llvm_unreachable(
"Unknown tag type kind.");
2419 llvm_unreachable(
"Elaborated type keyword is not a tag type kind.");
2421 llvm_unreachable(
"Unknown elaborated type keyword.");
2437 llvm_unreachable(
"Unknown elaborated type keyword.");
2451 llvm_unreachable(
"Unknown elaborated type keyword.");
2461 NNS && NNS->containsUnexpandedParameterPack()),
2462 NNS(NNS), Name(Name), NumArgs(NumArgs) {
2464 "DependentTemplateSpecializatonType requires dependent qualifier");
2466 if (Args[
I].containsUnexpandedParameterPack())
2467 setContainsUnexpandedParameterPack();
2481 ID.AddInteger(Keyword);
2482 ID.AddPointer(Qualifier);
2483 ID.AddPointer(Name);
2484 for (
unsigned Idx = 0; Idx <
NumArgs; ++Idx)
2485 Args[Idx].
Profile(ID, Context);
2488 bool Type::isElaboratedTypeSpecifier()
const {
2491 Keyword = Elab->getKeyword();
2493 Keyword = DepName->getKeyword();
2495 dyn_cast<DependentTemplateSpecializationType>(
this))
2496 Keyword = DepTST->getKeyword();
2505 #define ABSTRACT_TYPE(Derived, Base)
2506 #define TYPE(Derived, Base) case Derived: return #Derived;
2507 #include "clang/AST/TypeNodes.def"
2510 llvm_unreachable(
"Invalid type class.");
2518 return Policy.
Bool ?
"bool" :
"_Bool";
2524 return "signed char";
2536 return "unsigned char";
2538 return "unsigned short";
2540 return "unsigned int";
2542 return "unsigned long";
2544 return "unsigned long long";
2546 return "unsigned __int128";
2548 return Policy.
Half ?
"half" :
"__fp16";
2554 return "long double";
2557 return Policy.
MSWChar ?
"__wchar_t" :
"wchar_t";
2565 return "<overloaded function type>";
2567 return "<bound member function type>";
2569 return "<pseudo-object type>";
2571 return "<dependent type>";
2573 return "<unknown type>";
2574 case ARCUnbridgedCast:
2575 return "<ARC unbridged cast type>";
2577 return "<builtin fn type>";
2586 case OCLImage1dArray:
2587 return "image1d_array_t";
2588 case OCLImage1dBuffer:
2589 return "image1d_buffer_t";
2592 case OCLImage2dArray:
2593 return "image2d_array_t";
2594 case OCLImage2dDepth:
2595 return "image2d_depth_t";
2596 case OCLImage2dArrayDepth:
2597 return "image2d_array_depth_t";
2598 case OCLImage2dMSAA:
2599 return "image2d_msaa_t";
2600 case OCLImage2dArrayMSAA:
2601 return "image2d_array_msaa_t";
2602 case OCLImage2dMSAADepth:
2603 return "image2d_msaa_depth_t";
2604 case OCLImage2dArrayMSAADepth:
2605 return "image2d_array_msaa_depth_t";
2613 return "clk_event_t";
2619 return "reserve_id_t";
2620 case OMPArraySection:
2621 return "<OpenMP array section type>";
2624 llvm_unreachable(
"Invalid builtin type.");
2645 case CC_C:
return "cdecl";
2660 llvm_unreachable(
"Invalid calling convention.");
2665 const ExtProtoInfo &epi)
2667 result->isDependentType(),
2668 result->isInstantiationDependentType(),
2669 result->isVariablyModifiedType(),
2670 result->containsUnexpandedParameterPack(), epi.
ExtInfo),
2671 NumParams(params.size()),
2672 NumExceptions(epi.ExceptionSpec.Exceptions.size()),
2673 ExceptionSpecType(epi.ExceptionSpec.
Type),
2674 HasAnyConsumedParams(epi.ConsumedParameters != nullptr),
2675 Variadic(epi.Variadic), HasTrailingReturn(epi.HasTrailingReturn) {
2676 assert(NumParams == params.size() &&
"function has too many parameters");
2683 for (
unsigned i = 0; i != NumParams; ++i) {
2692 argSlot[i] = params[i];
2697 QualType *exnSlot = argSlot + NumParams;
2699 for (
QualType ExceptionType : epi.ExceptionSpec.Exceptions) {
2708 exnSlot[I++] = ExceptionType;
2712 Expr **noexSlot =
reinterpret_cast<Expr **
>(argSlot + NumParams);
2713 *noexSlot = epi.ExceptionSpec.NoexceptExpr;
2715 if (epi.ExceptionSpec.NoexceptExpr) {
2716 if (epi.ExceptionSpec.NoexceptExpr->isValueDependent() ||
2717 epi.ExceptionSpec.NoexceptExpr->isInstantiationDependent())
2720 if (epi.ExceptionSpec.NoexceptExpr->containsUnexpandedParameterPack())
2727 reinterpret_cast<FunctionDecl **
>(argSlot + NumParams);
2728 slot[0] = epi.ExceptionSpec.SourceDecl;
2729 slot[1] = epi.ExceptionSpec.SourceTemplate;
2736 reinterpret_cast<FunctionDecl **
>(argSlot + NumParams);
2737 slot[0] = epi.ExceptionSpec.SourceDecl;
2740 if (epi.ConsumedParameters) {
2741 bool *consumedParams =
const_cast<bool *
>(getConsumedParamsBuffer());
2742 for (
unsigned i = 0; i != NumParams; ++i)
2743 consumedParams[i] = epi.ConsumedParameters[i];
2749 return NE->isValueDependent();
2778 assert(isICE &&
"AST should not contain bad noexcept expressions.");
2784 bool ResultIfDependent)
const {
2793 for (
unsigned I = 0, N = NumExceptions; I != N; ++
I)
2796 return ResultIfDependent;
2804 return ResultIfDependent;
2809 for (
unsigned ArgIdx =
getNumParams(); ArgIdx; --ArgIdx)
2817 const QualType *ArgTys,
unsigned NumParams,
2818 const ExtProtoInfo &epi,
2839 for (
unsigned i = 0; i != NumParams; ++i)
2844 assert(!(
unsigned(epi.Variadic) & ~1) &&
2845 !(
unsigned(epi.TypeQuals) & ~255) &&
2846 !(
unsigned(epi.RefQualifier) & ~3) &&
2847 !(
unsigned(epi.ExceptionSpec.Type) & ~15) &&
2848 "Values larger than expected.");
2849 ID.AddInteger(
unsigned(epi.Variadic) +
2850 (epi.TypeQuals << 1) +
2851 (epi.RefQualifier << 9) +
2852 (epi.ExceptionSpec.Type << 11));
2854 for (
QualType Ex : epi.ExceptionSpec.Exceptions)
2857 epi.ExceptionSpec.NoexceptExpr) {
2858 epi.ExceptionSpec.NoexceptExpr->Profile(ID, Context,
false);
2861 ID.AddPointer(epi.ExceptionSpec.SourceDecl->getCanonicalDecl());
2863 if (epi.ConsumedParameters) {
2864 for (
unsigned i = 0; i != NumParams; ++i)
2865 ID.AddBoolean(epi.ConsumedParameters[i]);
2867 epi.ExtInfo.Profile(ID);
2868 ID.AddBoolean(epi.HasTrailingReturn);
2882 :
Type(TypeOfExpr, can, E->isTypeDependent(),
2883 E->isInstantiationDependent(),
2884 E->getType()->isVariablyModifiedType(),
2885 E->containsUnexpandedParameterPack()),
2902 E->Profile(ID, Context,
true);
2909 :
Type(Decltype, can, E->isInstantiationDependent(),
2910 E->isInstantiationDependent(),
2911 E->getType()->isVariablyModifiedType(),
2912 E->containsUnexpandedParameterPack()),
2914 UnderlyingType(underlyingType) {
2927 :
DecltypeType(E, Context.DependentTy), Context(Context) { }
2931 E->Profile(ID, Context,
true);
2935 :
Type(TC, can, D->isDependentType(),
2936 D->isDependentType(),
2942 for (
auto I : decl->
redecls()) {
2943 if (I->isCompleteDefinition() || I->isBeingDefined())
2954 :
Type(UnaryTransform, CanonicalType, UnderlyingType->isDependentType(),
2955 UnderlyingType->isInstantiationDependentType(),
2956 UnderlyingType->isVariablyModifiedType(),
2957 BaseType->containsUnexpandedParameterPack())
2958 , BaseType(BaseType), UnderlyingType(UnderlyingType), UKind(UKind)
3008 llvm_unreachable(
"bad attributed type kind");
3013 default:
return false;
3020 llvm_unreachable(
"invalid attr kind");
3057 llvm_unreachable(
"invalid attr kind");
3068 SubstTemplateTypeParmPackType::
3074 Arguments(ArgPack.pack_begin()), NumArguments(ArgPack.pack_size())
3089 ID.AddPointer(Replaced);
3092 ID.AddPointer(
P.getAsType().getAsOpaquePtr());
3097 bool &InstantiationDependent) {
3099 InstantiationDependent);
3104 bool &InstantiationDependent) {
3105 for (
unsigned i = 0; i != N; ++i) {
3106 if (Args[i].getArgument().isDependent()) {
3107 InstantiationDependent =
true;
3111 if (Args[i].getArgument().isInstantiationDependent())
3112 InstantiationDependent =
true;
3121 :
Type(TemplateSpecialization,
3122 Canon.isNull()?
QualType(this, 0) : Canon,
3123 Canon.isNull()?
true : Canon->isDependentType(),
3124 Canon.isNull()?
true : Canon->isInstantiationDependentType(),
3126 T.containsUnexpandedParameterPack()),
3127 Template(T), NumArgs(NumArgs),
TypeAlias(!AliasedType.isNull()) {
3129 "Use DependentTemplateSpecializationType for dependent template-name");
3133 "Unexpected template name for TemplateSpecializationType");
3137 for (
unsigned Arg = 0; Arg <
NumArgs; ++Arg) {
3146 if (Args[Arg].isInstantiationDependent())
3147 setInstantiationDependent();
3150 setVariablyModified();
3151 if (Args[Arg].containsUnexpandedParameterPack())
3152 setContainsUnexpandedParameterPack();
3170 for (
unsigned Idx = 0; Idx <
NumArgs; ++Idx)
3171 Args[Idx].
Profile(ID, Context);
3196 ID.AddInteger(typeArgs.size());
3197 for (
auto typeArg : typeArgs)
3198 ID.AddPointer(typeArg.getAsOpaquePtr());
3199 ID.AddInteger(protocols.size());
3200 for (
auto proto : protocols)
3201 ID.AddPointer(proto);
3202 ID.AddBoolean(isKindOf);
3214 class CachedProperties {
3219 CachedProperties(
Linkage L,
bool local) : L(L), local(local) {}
3221 Linkage getLinkage()
const {
return L; }
3222 bool hasLocalOrUnnamedType()
const {
return local; }
3224 friend CachedProperties merge(CachedProperties L, CachedProperties R) {
3226 return CachedProperties(MergedLinkage,
3227 L.hasLocalOrUnnamedType() | R.hasLocalOrUnnamedType());
3241 return get(T.getTypePtr());
3244 static CachedProperties
get(
const Type *T) {
3246 return CachedProperties(T->TypeBits.getLinkage(),
3247 T->TypeBits.hasLocalOrUnnamedType());
3252 if (T->
TypeBits.isCacheValid())
return;
3268 T->
TypeBits.CachedLinkage = Result.getLinkage();
3269 T->
TypeBits.CachedLocalOrUnnamed = Result.hasLocalOrUnnamedType();
3277 namespace {
class Private {}; }
3282 #define TYPE(Class,Base)
3283 #define NON_CANONICAL_TYPE(Class,Base) case Type::Class:
3284 #include "clang/AST/TypeNodes.def"
3285 llvm_unreachable(
"didn't expect a non-canonical type here");
3287 #define TYPE(Class,Base)
3288 #define DEPENDENT_TYPE(Class,Base) case Type::Class:
3289 #define NON_CANONICAL_UNLESS_DEPENDENT_TYPE(Class,Base) case Type::Class:
3290 #include "clang/AST/TypeNodes.def"
3308 const TagDecl *Tag = cast<TagType>(T)->getDecl();
3315 bool IsLocalOrUnnamed =
3318 return CachedProperties(L, IsLocalOrUnnamed);
3327 return Cache::get(cast<PointerType>(T)->getPointeeType());
3328 case Type::BlockPointer:
3329 return Cache::get(cast<BlockPointerType>(T)->getPointeeType());
3330 case Type::LValueReference:
3331 case Type::RValueReference:
3332 return Cache::get(cast<ReferenceType>(T)->getPointeeType());
3333 case Type::MemberPointer: {
3338 case Type::ConstantArray:
3339 case Type::IncompleteArray:
3340 case Type::VariableArray:
3343 case Type::ExtVector:
3345 case Type::FunctionNoProto:
3346 return Cache::get(cast<FunctionType>(T)->getReturnType());
3347 case Type::FunctionProto: {
3354 case Type::ObjCInterface: {
3355 Linkage L = cast<ObjCInterfaceType>(T)->getDecl()->getLinkageInternal();
3356 return CachedProperties(L,
false);
3358 case Type::ObjCObject:
3359 return Cache::get(cast<ObjCObjectType>(T)->getBaseType());
3360 case Type::ObjCObjectPointer:
3361 return Cache::get(cast<ObjCObjectPointerType>(T)->getPointeeType());
3363 return Cache::get(cast<AtomicType>(T)->getValueType());
3368 llvm_unreachable(
"unhandled type class");
3379 return TypeBits.hasLocalOrUnnamedType();
3386 #define TYPE(Class,Base)
3387 #define NON_CANONICAL_TYPE(Class,Base) case Type::Class:
3388 #include "clang/AST/TypeNodes.def"
3389 llvm_unreachable(
"didn't expect a non-canonical type here");
3391 #define TYPE(Class,Base)
3392 #define DEPENDENT_TYPE(Class,Base) case Type::Class:
3393 #define NON_CANONICAL_UNLESS_DEPENDENT_TYPE(Class,Base) case Type::Class:
3394 #include "clang/AST/TypeNodes.def"
3407 return cast<TagType>(T)->getDecl()->getLinkageAndVisibility();
3413 case Type::BlockPointer:
3415 case Type::LValueReference:
3416 case Type::RValueReference:
3418 case Type::MemberPointer: {
3424 case Type::ConstantArray:
3425 case Type::IncompleteArray:
3426 case Type::VariableArray:
3429 case Type::ExtVector:
3431 case Type::FunctionNoProto:
3433 case Type::FunctionProto: {
3440 case Type::ObjCInterface:
3441 return cast<ObjCInterfaceType>(T)->getDecl()->getLinkageAndVisibility();
3442 case Type::ObjCObject:
3444 case Type::ObjCObjectPointer:
3452 llvm_unreachable(
"unhandled type class");
3481 if (
auto attributed = dyn_cast<AttributedType>(type.
getTypePtr())) {
3482 if (
auto nullability = attributed->getImmediateNullability())
3500 #define NON_CANONICAL_TYPE(Class, Parent) \
3502 llvm_unreachable("non-canonical type");
3503 #define TYPE(Class, Parent)
3504 #include "clang/AST/TypeNodes.def"
3508 case Type::BlockPointer:
3509 case Type::MemberPointer:
3510 case Type::ObjCObjectPointer:
3514 case Type::UnresolvedUsing:
3515 case Type::TypeOfExpr:
3517 case Type::Decltype:
3518 case Type::UnaryTransform:
3519 case Type::TemplateTypeParm:
3520 case Type::SubstTemplateTypeParmPack:
3521 case Type::DependentName:
3522 case Type::DependentTemplateSpecialization:
3528 case Type::TemplateSpecialization:
3530 = cast<TemplateSpecializationType>(type.
getTypePtr())
3532 if (isa<ClassTemplateDecl>(templateDecl))
3539 return !cast<AutoType>(type.
getTypePtr())->isDeduced();
3544 #define SIGNED_TYPE(Id, SingletonId) case BuiltinType::Id:
3545 #define UNSIGNED_TYPE(Id, SingletonId) case BuiltinType::Id:
3546 #define FLOATING_TYPE(Id, SingletonId) case BuiltinType::Id:
3547 #define BUILTIN_TYPE(Id, SingletonId)
3548 #include "clang/AST/BuiltinTypes.def"
3552 case BuiltinType::Dependent:
3553 case BuiltinType::Overload:
3554 case BuiltinType::BoundMember:
3555 case BuiltinType::PseudoObject:
3556 case BuiltinType::UnknownAny:
3557 case BuiltinType::ARCUnbridgedCast:
3560 case BuiltinType::Void:
3561 case BuiltinType::ObjCId:
3562 case BuiltinType::ObjCClass:
3563 case BuiltinType::ObjCSel:
3564 case BuiltinType::OCLImage1d:
3565 case BuiltinType::OCLImage1dArray:
3566 case BuiltinType::OCLImage1dBuffer:
3567 case BuiltinType::OCLImage2d:
3568 case BuiltinType::OCLImage2dArray:
3569 case BuiltinType::OCLImage2dDepth:
3570 case BuiltinType::OCLImage2dArrayDepth:
3571 case BuiltinType::OCLImage2dMSAA:
3572 case BuiltinType::OCLImage2dArrayMSAA:
3573 case BuiltinType::OCLImage2dMSAADepth:
3574 case BuiltinType::OCLImage2dArrayMSAADepth:
3575 case BuiltinType::OCLImage3d:
3576 case BuiltinType::OCLSampler:
3577 case BuiltinType::OCLEvent:
3578 case BuiltinType::OCLClkEvent:
3579 case BuiltinType::OCLQueue:
3580 case BuiltinType::OCLNDRange:
3581 case BuiltinType::OCLReserveID:
3582 case BuiltinType::BuiltinFn:
3583 case BuiltinType::NullPtr:
3584 case BuiltinType::OMPArraySection:
3590 case Type::LValueReference:
3591 case Type::RValueReference:
3592 case Type::ConstantArray:
3593 case Type::IncompleteArray:
3594 case Type::VariableArray:
3595 case Type::DependentSizedArray:
3596 case Type::DependentSizedExtVector:
3598 case Type::ExtVector:
3599 case Type::FunctionProto:
3600 case Type::FunctionNoProto:
3603 case Type::InjectedClassName:
3604 case Type::PackExpansion:
3605 case Type::ObjCObject:
3606 case Type::ObjCInterface:
3611 llvm_unreachable(
"bad type kind!");
3625 if (
auto attributed = dyn_cast<AttributedType>(T.
getTypePtr())) {
3626 if (
auto nullability = attributed->getImmediateNullability()) {
3627 T = attributed->getModifiedType();
3676 "cannot query implicit lifetime for non-inferrable type");
3681 while (
const ArrayType *array = dyn_cast<ArrayType>(canon))
3682 canon = array->getElementType().getTypePtr();
3685 = dyn_cast<ObjCObjectPointerType>(canon)) {
3687 if (opt->getObjectType()->isObjCClass())
3695 if (
const TypedefType *typedefType = dyn_cast<TypedefType>(
this))
3696 return typedefType->getDecl()->hasAttr<ObjCNSObjectAttr>();
3700 if (
const TypedefType *typedefType = dyn_cast<TypedefType>(
this))
3701 return typedefType->getDecl()->hasAttr<ObjCIndependentClassAttr>();
3712 if (
const PointerType *OPT = getAs<PointerType>())
3713 return OPT->getPointeeType()->isObjCIndirectLifetimeType();
3715 return Ref->getPointeeType()->isObjCIndirectLifetimeType();
3717 return MemPtr->getPointeeType()->isObjCIndirectLifetimeType();
3724 const Type *type =
this;
3726 type = array->getElementType().getTypePtr();
3738 const PointerType *Pointer = getAs<PointerType>();
3749 if (
const PointerType *ptr = getAs<PointerType>())
3750 return ptr->getPointeeType()->hasSizedVLAType();
3752 return ref->getPointeeType()->hasSizedVLAType();
3754 if (isa<VariableArrayType>(arr) &&
3755 cast<VariableArrayType>(arr)->getSizeExpr())
3758 return arr->getElementType()->hasSizedVLAType();
unsigned getNumElements() const
bool hasObjCGCAttr() const
unsigned getAddressSpace() const
Return the address space of this type.
const ComplexType * getAsComplexIntegerType() const
bool isUnspecialized() const
Determine whether this object type is "unspecialized", meaning that it has no type arguments...
DecltypeType(Expr *E, QualType underlyingType, QualType can=QualType())
static StringRef getKeywordName(ElaboratedTypeKeyword Keyword)
bool hasDefinition() const
Determine whether this class has been defined.
Defines the clang::ASTContext interface.
QualType getExceptionType(unsigned i) const
Represents a type that was referred to using an elaborated type keyword, e.g., struct S...
QualType getUnderlyingType() const
const Type * Ty
The locally-unqualified type.
FunctionDecl - An instance of this class is created to represent a function declaration or definition...
External linkage, which indicates that the entity can be referred to from other translation units...
The "enum" keyword introduces the elaborated-type-specifier.
void setDependent(bool D=true)
llvm::iterator_range< pack_iterator > pack_elements() const
Iterator range referencing all of the elements of a template argument pack.
bool isCXX98PODType(ASTContext &Context) const
Return true if this is a POD type according to the rules of the C++98 standard, regardless of the cur...
PointerType - C99 6.7.5.1 - Pointer Declarators.
A (possibly-)qualified type.
SourceRange getBracketsRange() const
void computeSuperClassTypeSlow() const
bool isCanonicalUnqualified() const
Determines if this type would be canonical if it had no further qualification.
bool hasFloatingRepresentation() const
Determine whether this type has a floating-point representation of some sort, e.g., it is a floating-point type or a vector thereof.
bool hasTrivialDestructor() const
Determine whether this class has a trivial destructor (C++ [class.dtor]p3)
QualType getAdjustedType(QualType Orig, QualType New) const
Return the uniqued reference to a type adjusted from the original type to a new type.
QualType getComplexType(QualType T) const
Return the uniqued reference to the type for a complex number with the specified element type...
IdentifierInfo * getIdentifier() const
getIdentifier - Get the identifier that names this declaration, if there is one.
bool isKindOfTypeAsWritten() const
Whether this is a "__kindof" type as written.
bool isInstantiationDependentType() const
Determine whether this type is an instantiation-dependent type, meaning that the type involves a temp...
unsigned getFastQualifiers() const
QualType getNonLValueExprType(const ASTContext &Context) const
Determine the type of a (typically non-lvalue) expression with the specified result type...
QualType getQualifiedType(SplitQualType split) const
Un-split a SplitQualType.
Qualifiers::ObjCLifetime getObjCARCImplicitLifetime() const
Return the implicit lifetime for this type, which must not be dependent.
void setInstantiationDependent(bool D=true)
bool isFixed() const
Returns true if this is an Objective-C, C++11, or Microsoft-style enumeration with a fixed underlying...
bool isAnyCharacterType() const
Determine whether this type is any of the built-in character types.
FunctionType - C99 6.7.5.3 - Function Declarators.
TemplateDecl * getAsTemplateDecl() const
Retrieve the underlying template declaration that this template name refers to, if known...
QualType getRValueReferenceType(QualType T) const
Return the uniqued reference to the type for an rvalue reference to the specified type...
CanQualType getSizeType() const
Return the unique type for "size_t" (C99 7.17), defined in <stddef.h>.
bool canHaveNullability() const
Determine whether the given type can have a nullability specifier applied to it, i.e., if it is any kind of pointer type or a dependent type that could instantiate to any kind of pointer type.
unsigned MSWChar
When true, print the built-in wchar_t type as __wchar_t.
C Language Family Type Representation.
Represents a qualified type name for which the type name is dependent.
QuantityType getQuantity() const
getQuantity - Get the raw integer representation of this quantity.
void Profile(llvm::FoldingSetNodeID &ID)
CXXRecordDecl * getDecl() const
bool isRecordType() const
QualType getUnderlyingType() const
Decl - This represents one declaration (or definition), e.g.
bool isChar16Type() const
ObjCObjectTypeBitfields ObjCObjectTypeBits
bool isLiteralType(const ASTContext &Ctx) const
Return true if this is a literal type (C++11 [basic.types]p10)
AutoType * getContainedAutoType() const
Get the AutoType whose type will be deduced for a variable with an initializer of this type...
Defines the C++ template declaration subclasses.
bool isVoidPointerType() const
Represents a C++11 auto or C++14 decltype(auto) type.
QualType substObjCTypeArgs(ASTContext &ctx, ArrayRef< QualType > typeArgs, ObjCSubstitutionContext context) const
Substitute type arguments for the Objective-C type parameters used in the subject type...
bool isEnumeralType() const
void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Ctx)
TypePropertyCache< Private > Cache
bool hasDefinition() const
QualType getLValueReferenceType(QualType T, bool SpelledAsLValue=true) const
Return the uniqued reference to the type for an lvalue reference to the specified type...
TemplateSpecializationType(TemplateName T, const TemplateArgument *Args, unsigned NumArgs, QualType Canon, QualType Aliased)
static ElaboratedTypeKeyword getKeywordForTagTypeKind(TagTypeKind Tag)
Converts a TagTypeKind into an elaborated type keyword.
QualType getPointeeType() const
The base class of the type hierarchy.
DependentTemplateSpecializationType(ElaboratedTypeKeyword Keyword, NestedNameSpecifier *NNS, const IdentifierInfo *Name, unsigned NumArgs, const TemplateArgument *Args, QualType Canon)
Represents an array type, per C99 6.7.5.2 - Array Declarators.
const ObjCObjectType * getObjectType() const
Gets the type pointed to by this ObjC pointer.
DependentDecltypeType(const ASTContext &Context, Expr *E)
bool isBlockPointerType() const
const ObjCObjectPointerType * getAsObjCQualifiedClassType() const
bool isSpelledAsLValue() const
A template template parameter that has been substituted for some other template name.
bool hasUnsignedIntegerRepresentation() const
Determine whether this type has an unsigned integer representation of some sort, e.g., it is an unsigned integer type or a vector.
const llvm::APInt & getSize() const
void * getAsOpaquePtr() const
const TemplateArgumentLoc * getArgumentArray() const
static CachedProperties computeCachedProperties(const Type *T)
QualType getBlockPointerType(QualType T) const
Return the uniqued reference to the type for a block of the specified type.
QualType substObjCMemberType(QualType objectType, const DeclContext *dc, ObjCSubstitutionContext context) const
Substitute type arguments from an object type for the Objective-C type parameters used in the subject...
The noexcept specifier has a bad expression.
ObjCLifetime getObjCLifetime() const
Extra information about a function prototype.
The "__interface" keyword.
uint64_t getTypeSize(QualType T) const
Return the size of the specified (complete) type T, in bits.
TemplateTypeParmDecl * getDecl() const
QualType getOriginalType() const
bool isTrivialType(ASTContext &Context) const
Return true if this is a trivial type per (C++0x [basic.types]p9)
Describes how types, statements, expressions, and declarations should be printed. ...
unsigned size() const
Determine the number of type parameters in this list.
bool isSpecialized() const
Determine whether this object type is "specialized", meaning that it has type arguments.
bool containsUnexpandedParameterPack() const
Whether this type is or contains an unexpanded parameter pack, used to support C++0x variadic templat...
bool isObjCRetainableType() const
Represents the result of substituting a type for a template type parameter.
Linkage
Describes the different kinds of linkage (C++ [basic.link], C99 6.2.2) that an entity may have...
const Type * getUnqualifiedDesugaredType() const
Return the specified type with any "sugar" removed from the type, removing any typedefs, typeofs, etc., as well as any qualifiers.
QualType getFunctionNoProtoType(QualType ResultTy, const FunctionType::ExtInfo &Info) const
Return a K&R style C function type like 'int()'.
The collection of all-type qualifiers we support.
void Profile(llvm::FoldingSetNodeID &ID)
bool isTemplateVariadic() const
Determines whether this function prototype contains a parameter pack at the end.
unsigned getNumParams() const
RecordDecl - Represents a struct/union/class.
QualType getElementType() const
One of these records is kept for each identifier that is lexed.
unsigned getIndexTypeCVRQualifiers() const
bool isScalarType() const
QualType apply(const ASTContext &Context, QualType QT) const
Apply the collected qualifiers to the given type.
TagDecl * getAsTagDecl() const
Retrieves the TagDecl that this type refers to, either because the type is a TagType or because it is...
class LLVM_ALIGNAS(8) DependentTemplateSpecializationType const IdentifierInfo * Name
Represents a template specialization type whose template cannot be resolved, e.g. ...
Represents a class type in Objective C.
Expr * getSizeExpr() const
IdentifierInfo * getIdentifier() const
bool isVariablyModifiedType() const
Whether this type is a variably-modified type (C99 6.7.5).
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
ArrayRef< QualType > getParamTypes() const
bool isObjCARCImplicitlyUnretainedType() const
Determines if this type, which must satisfy isObjCLifetimeType(), is implicitly __unsafe_unretained r...
bool isSugared() const
Returns whether this type directly provides sugar.
bool isReferenceType() const
bool isStructureOrClassType() const
QualType getExtVectorType(QualType VectorType, unsigned NumElts) const
Return the unique reference to an extended vector type of the specified element type and size...
bool isCompleteDefinition() const
isCompleteDefinition - Return true if this decl has its body fully specified.
NoexceptResult
Result type of getNoexceptSpec().
const internal::VariadicAllOfMatcher< Decl > decl
Matches declarations.
bool isBeingDefined() const
Determines whether this type is in the process of being defined.
bool isChar32Type() const
const CXXRecordDecl * getPointeeCXXRecordDecl() const
If this is a pointer or reference to a RecordType, return the CXXRecordDecl that that type refers to...
const RecordType * getAsUnionType() const
NOTE: getAs*ArrayType are methods on ASTContext.
static unsigned getNumAddressingBits(ASTContext &Context, QualType ElementType, const llvm::APInt &NumElements)
Determine the number of bits required to address a member of.
Linkage getLinkage() const
bool isSugared() const
Returns whether this type directly provides sugar.
Values of this type can be null.
bool isIntegralOrUnscopedEnumerationType() const
Determine whether this type is an integral or unscoped enumeration type.
bool hasNonFastQualifiers() const
Return true if the set contains any qualifiers which require an ExtQuals node to be allocated...
TemplateName getTemplateName() const
Retrieve the name of the template that we are specializing.
TemplateArgument getArgumentPack() const
An rvalue reference type, per C++11 [dcl.ref].
param_type_range param_types() const
QualType getParenType(QualType NamedType) const
const TargetInfo & getTargetInfo() const
const LangOptions & getLangOpts() const
A convenient class for passing around template argument information.
LinkageInfo getLinkageAndVisibility() const
Determine the linkage and visibility of this type.
QualType getBaseType() const
Gets the base type of this object type.
QualType getReturnType() const
The "struct" keyword introduces the elaborated-type-specifier.
static ElaboratedTypeKeyword getKeywordForTypeSpec(unsigned TypeSpec)
Converts a type specifier (DeclSpec::TST) into an elaborated type keyword.
Whether values of this type can be null is (explicitly) unspecified.
bool isObjCLifetimeType() const
Returns true if objects of this type have lifetime semantics under ARC.
const ArrayType * getAsArrayType(QualType T) const
Type Query functions.
Expr * getNoexceptExpr() const
bool isValueDependent() const
isValueDependent - Determines whether this expression is value-dependent (C++ [temp.dep.constexpr]).
RecordDecl * getDecl() const
ObjCInterfaceDecl * getInterface() const
Gets the interface declaration for this object type, if the base type really is an interface...
bool isUnsignedIntegerType() const
Return true if this is an integer type that is unsigned, according to C99 6.2.5p6 [which returns true...
const ObjCObjectType * getAsObjCInterfaceType() const
Values of this type can never be null.
bool isDependent() const
Whether this nested name specifier refers to a dependent type or not.
static TagDecl * getInterestingTagDecl(TagDecl *decl)
TypeClass getTypeClass() const
unsigned Half
When true, print the half-precision floating-point type as 'half' instead of '__fp16'.
bool isStructureType() const
Represents an Objective-C protocol declaration.
bool isObjCIndependentClassType() const
bool isIncompleteType(NamedDecl **Def=nullptr) const
Types are partitioned into 3 broad categories (C99 6.2.5p1): object types, function types...
CharUnits getTypeSizeInChars(QualType T) const
Return the size of the specified (complete) type T, in characters.
Represents an ObjC class declaration.
detail::InMemoryDirectory::const_iterator I
QualType getCanonicalTypeInternal() const
TagType(TypeClass TC, const TagDecl *D, QualType can)
Represents an extended vector type where either the type or size is dependent.
This object can be modified without requiring retains or releases.
const TemplateTypeParmType * getReplacedParameter() const
Gets the template parameter that was substituted for.
bool isLinkageValid() const
True if the computed linkage is valid.
const ArrayType * getAsArrayTypeUnsafe() const
A variant of getAs<> for array types which silently discards qualifiers from the outermost type...
EnumDecl * getDecl() const
Represents a K&R-style 'int foo()' function, which has no information available about its arguments...
QualType getValueType() const
Gets the type contained by this atomic type, i.e.
static void ensure(const Type *T)
ExtInfo getExtInfo() const
const ArrayType * castAsArrayTypeUnsafe() const
A variant of castAs<> for array type which silently discards qualifiers from the outermost type...
QualType getObjCObjectType(QualType Base, ObjCProtocolDecl *const *Protocols, unsigned NumProtocols) const
Legacy interface: cannot provide type arguments or __kindof.
CXXRecordDecl * getMostRecentDecl()
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...
QualType getParamType(unsigned i) const
Represents a prototype with parameter type info, e.g.
ExceptionSpecificationType getExceptionSpecType() const
Get the kind of exception specification on this function.
static bool KeywordIsTagTypeKind(ElaboratedTypeKeyword Keyword)
Qualifiers::ObjCLifetime getObjCLifetime() const
Returns lifetime attribute of this type.
param_type_iterator param_type_begin() const
ArraySizeModifier
Capture whether this is a normal array (e.g.
bool isInstantiationDependent() const
Whether this expression is instantiation-dependent, meaning that it depends in some way on a template...
QualType getAtomicType(QualType T) const
Return the uniqued reference to the atomic type for the specified type.
ID
Defines the set of possible language-specific address spaces.
QualType desugar() const
Remove a single level of sugar.
QualType getPointeeType() const
If this is a pointer, ObjC object pointer, or block pointer, this returns the respective pointee...
QualType getObjCInterfaceType(const ObjCInterfaceDecl *Decl, ObjCInterfaceDecl *PrevDecl=nullptr) const
getObjCInterfaceType - Return the unique reference to the type for the specified ObjC interface decl...
bool hasSizedVLAType() const
Whether this type involves a variable-length array type with a definite size.
bool isRealFloatingType() const
Floating point categories.
bool isObjCInertUnsafeUnretainedType() const
Was this type written with the special inert-in-MRC __unsafe_unretained qualifier?
bool isKindOfType() const
Whether this is a "__kindof" type.
bool isSignedIntegerOrEnumerationType() const
Determines whether this is an integer type that is signed or an enumeration types whose underlying ty...
SplitQualType split() const
Divides a QualType into its unqualified type and a set of local qualifiers.
bool isMicrosoft() const
Is this ABI an MSVC-compatible ABI?
QualType getSuperClassType() const
Retrieve the type of the superclass of this object type.
QualType getPointeeType() const
Expr - This represents one expression.
The "typename" keyword precedes the qualified type name, e.g., typename T::type.
static unsigned getMaxSizeBits(ASTContext &Context)
Determine the maximum number of active bits that an array's size can require, which limits the maximu...
bool isAnyComplexType() const
QualType getLocallyUnqualifiedSingleStepDesugaredType() const
Pull a single level of sugar off of this locally-unqualified type.
ASTContext & getParentASTContext() const
ElaboratedTypeKeyword
The elaboration keyword that precedes a qualified type name or introduces an elaborated-type-specifie...
ObjCObjectType(QualType Canonical, QualType Base, ArrayRef< QualType > typeArgs, ArrayRef< ObjCProtocolDecl * > protocols, bool isKindOf)
static LinkageInfo computeLinkageInfo(QualType T)
ObjCSubstitutionContext
The kind of type we are substituting Objective-C type arguments into.
Expr * getUnderlyingExpr() const
bool isVariableArrayType() const
ExtProtoInfo getExtProtoInfo() const
DeclContext * getDeclContext()
bool isFloatingType() const
void Profile(llvm::FoldingSetNodeID &ID)
static TagTypeKind getTagTypeKindForTypeSpec(unsigned TypeSpec)
Converts a type specifier (DeclSpec::TST) into a tag type kind.
Represents a C++ template name within the type system.
Represents the type decltype(expr) (C++11).
QualType getDesugaredType(const ASTContext &Context) const
Return the specified type with any "sugar" removed from the type.
There is no noexcept specifier.
bool isCXX11PODType(ASTContext &Context) const
Return true if this is a POD type according to the more relaxed rules of the C++11 standard...
A std::pair-like structure for storing a qualified type split into its local qualifiers and its local...
static Optional< NullabilityKind > stripOuterNullability(QualType &T)
Strip off the top-level nullability annotation on the given type, if it's there.
const ObjCObjectPointerType * stripObjCKindOfTypeAndQuals(const ASTContext &ctx) const
Strip off the Objective-C "kindof" type and (with it) any protocol qualifiers.
QualType stripObjCKindOfType(const ASTContext &ctx) const
Strip Objective-C "__kindof" types from the given type.
bool isDependentType() const
Whether this type is a dependent type, meaning that its definition somehow depends on a template para...
bool isFunctionOrMethod() const
Qualifiers Quals
The local qualifiers.
bool isObjCQualifiedIdType() const
True if this is equivalent to 'id.
#define TRIVIAL_TYPE_CLASS(Class)
QualType withFastQualifiers(unsigned TQs) const
A helper class for Type nodes having an ElaboratedTypeKeyword.
const IdentifierInfo * getBaseTypeIdentifier() const
Retrieves a pointer to the name of the base type.
Represents a GCC generic vector type.
An lvalue reference type, per C++11 [dcl.ref].
class LLVM_ALIGNAS(8) TemplateSpecializationType unsigned NumArgs
Represents a type template specialization; the template must be a class template, a type alias templa...
Linkage getLinkageInternal() const
Determine what kind of linkage this entity has.
QualType getElementType() const
bool isStrictSupersetOf(Qualifiers Other) const
Determine whether this set of qualifiers is a strict superset of another set of qualifiers, not considering qualifier compatibility.
The result type of a method or function.
bool isComplexIntegerType() const
bool hasNameForLinkage() const
Is this tag type named, either directly or via being defined in a typedef of this type...
IdentifierInfo * getNSObjectName()
Retrieve the identifier 'NSObject'.
bool isUnsignedIntegerOrEnumerationType() const
Determines whether this is an integer type that is unsigned or an enumeration types whose underlying ...
QualType getReplacementType() const
Gets the type that was substituted for the template parameter.
CallingConv
CallingConv - Specifies the calling convention that a function uses.
static LinkageInfo external()
bool hasObjCLifetime() const
QualType stripObjCKindOfTypeAndQuals(const ASTContext &ctx) const
Strip off the Objective-C "kindof" type and (with it) any protocol qualifiers.
IdentifierInfo * getNSCopyingName()
Retrieve the identifier 'NSCopying'.
bool hasUnnamedOrLocalType() const
Whether this type is or contains a local or unnamed type.
bool isNothrow(const ASTContext &Ctx, bool ResultIfDependent=false) const
Determine whether this function type has a non-throwing exception specification.
const TemplateTypeParmType * getReplacedParameter() const
Gets the template parameter that was substituted for.
unsigned Bool
Whether we can use 'bool' rather than '_Bool', even if the language doesn't actually have 'bool' (bec...
CXXRecordDecl * getMostRecentCXXRecordDecl() const
A template template parameter pack that has been substituted for a template template argument pack...
There is no lifetime qualification on this type.
redecl_range redecls() const
Returns an iterator range for all the redeclarations of the same decl.
Assigning into this object requires the old value to be released and the new value to be retained...
ExceptionSpecificationType Type
The kind of exception specification this is.
Encodes a location in the source.
bool hasIntegerRepresentation() const
Determine whether this type has an integer representation of some sort, e.g., it is an integer type o...
Sugar for parentheses used when specifying types.
A helper class that allows the use of isa/cast/dyncast to detect TagType objects of enums...
const Type * getTypePtr() const
Retrieves a pointer to the underlying (unqualified) type.
bool isQualifier() const
Does this attribute behave like a type qualifier?
Interfaces are the core concept in Objective-C for object oriented design.
bool isComplexType() const
isComplexType() does not include complex integers (a GCC extension).
bool isConstant(ASTContext &Ctx) const
TagDecl - Represents the declaration of a struct/union/class/enum.
bool isConstantSizeType() const
Return true if this is not a variable sized type, according to the rules of C99 6.7.5p3.
ASTContext & getASTContext() const LLVM_READONLY
VectorKind getVectorKind() const
bool isObjCClassOrClassKindOfType() const
Whether the type is Objective-C 'Class' or a __kindof type of an Class type, e.g., __kindof Class <NSCopying>.
const TemplateArgument * getArgBuffer() const
Represents a C++ nested name specifier, such as "\::std::vector<int>::".
QualType getIncompleteArrayType(QualType EltTy, ArrayType::ArraySizeModifier ASM, unsigned IndexTypeQuals) const
Return a unique reference to the type for an incomplete array of the specified element type...
The noexcept specifier evaluates to true.
bool isObjCBoxableRecordType() const
const Type * getArrayElementTypeNoTypeQual() const
If this is an array type, return the element type of the array, potentially with type qualifiers miss...
void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Ctx)
ObjCCategoryDecl - Represents a category declaration.
bool isIntegerConstantExpr(llvm::APSInt &Result, const ASTContext &Ctx, SourceLocation *Loc=nullptr, bool isEvaluated=true) const
isIntegerConstantExpr - Return true if this expression is a valid integer constant expression...
void Profile(llvm::FoldingSetNodeID &ID)
SplitQualType getSplitDesugaredType() const
bool hasDependentExceptionSpec() const
Return whether this function has a dependent exception spec.
const Type * getBaseElementTypeUnsafe() const
Get the base element type of this type, potentially discarding type qualifiers.
bool isSpecializedAsWritten() const
Determine whether this object type was written with type arguments.
TypedefNameDecl * getDecl() const
unsigned getNumProtocols() const
Return the number of qualifying protocols in this interface type, or 0 if there are none...
bool isObjCQualifiedClassType() const
True if this is equivalent to 'Class.
bool isTypeDependent() const
isTypeDependent - Determines whether this expression is type-dependent (C++ [temp.dep.expr]), which means that its type could change from one template instantiation to the next.
const T * castAs() const
Member-template castAs<specific type>.
NoexceptResult getNoexceptSpec(const ASTContext &Ctx) const
Get the meaning of the noexcept spec on this function, if any.
qual_iterator qual_begin() const
QualType getAttributedType(AttributedType::Kind attrKind, QualType modifiedType, QualType equivalentType)
QualType getAutoType(QualType DeducedType, AutoTypeKeyword Keyword, bool IsDependent) const
C++11 deduced auto type.
bool isVectorType() const
bool isPromotableIntegerType() const
More type predicates useful for type checking/promotion.
Assigning into this object requires a lifetime extension.
bool isVolatileQualified() const
Determine whether this type is volatile-qualified.
static TagTypeKind getTagTypeKindForKeyword(ElaboratedTypeKeyword Keyword)
Converts an elaborated type keyword into a TagTypeKind.
TypeOfExprType(Expr *E, QualType can=QualType())
Represents a pointer type decayed from an array or function type.
QualType getPointeeType() const
QualType getFunctionType(QualType ResultTy, ArrayRef< QualType > Args, const FunctionProtoType::ExtProtoInfo &EPI) const
Return a normal function type with a typed argument list.
Represents a pack expansion of types.
ArrayRef< QualType > getTypeArgsAsWritten() const
Retrieve the type arguments of this object type as they were written.
Defines various enumerations that describe declaration and type specifiers.
ArrayRef< QualType > getTypeArgs() const
Retrieve the type arguments of this object type (semantically).
const char * getTypeClassName() const
Linkage minLinkage(Linkage L1, Linkage L2)
Compute the minimum linkage given two linkages.
Represents a template argument.
QualType getMemberPointerType(QualType T, const Type *Cls) const
Return the uniqued reference to the type for a member pointer to the specified type in the specified ...
Represents a type which was implicitly adjusted by the semantic engine for arbitrary reasons...
QualType getAsType() const
Retrieve the type for a type template argument.
TagTypeKind
The kind of a tag type.
CanQualType ObjCBuiltinIdTy
static const Type * getElementType(const Expr *BaseExpr)
QualType getDecayedType(QualType T) const
Return the uniqued reference to the decayed version of the given type.
not evaluated yet, for special member function
A qualifier set is used to build a set of qualifiers.
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
bool isAggregateType() const
Determines whether the type is a C++ aggregate type or C aggregate or union type. ...
void setContainsUnexpandedParameterPack(bool PP=true)
The base class of all kinds of template declarations (e.g., class, function, etc.).
static CachedProperties get(QualType T)
const internal::VariadicAllOfMatcher< Type > type
Matches Types in the clang AST.
bool isKindOfType() const
Whether this ia a "__kindof" type (semantically).
QualType IgnoreParens() const
Returns the specified type after dropping any outer-level parentheses.
bool isCallingConv() const
const ObjCInterfaceType * getInterfaceType() const
If this pointer points to an Objective C @interface type, gets the type for that interface.
bool isStandardLayoutType() const
Test if this type is a standard-layout type.
QualType getPointerType(QualType T) const
Return the uniqued reference to the type for a pointer to the specified type.
void Profile(llvm::FoldingSetNodeID &ID)
The "union" keyword introduces the elaborated-type-specifier.
const Type * strip(QualType type)
Collect any qualifiers on the given type and return an unqualified type.
QualType getObjCObjectPointerType(QualType OIT) const
Return a ObjCObjectPointerType type for the given ObjCObjectType.
void Profile(llvm::FoldingSetNodeID &ID)
The "class" keyword introduces the elaborated-type-specifier.
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...
EnumDecl - Represents an enum.
detail::InMemoryDirectory::const_iterator E
A pointer to member type per C++ 8.3.3 - Pointers to members.
QualType getModifiedType() const
void addConsistentQualifiers(Qualifiers qs)
Add the qualifiers from the given set to this set, given that they don't conflict.
const RecordType * getAsStructureType() const
bool isWideCharType() const
Represents a pointer to an Objective C object.
FunctionTypeBitfields FunctionTypeBits
A helper class that allows the use of isa/cast/dyncast to detect TagType objects of structs/unions/cl...
Complex values, per C99 6.2.5p11.
bool isTriviallyCopyableType(ASTContext &Context) const
Return true if this is a trivially copyable type (C++0x [basic.types]p9)
Location wrapper for a TemplateArgument.
llvm::Optional< NullabilityKind > getImmediateNullability() const
bool isObjCNSObjectType() const
bool TypeAlias
Whether this template specialization type is a substituted type alias.
const T * getAs() const
Member-template getAs<specific type>'.
QualType getCanonicalType() const
ObjCTypeParamList * getTypeParamList() const
Retrieve the type parameters of this class.
bool isSpecifierType() const
Returns true if this type can be represented by some set of type specifiers.
ObjCInterfaceDecl * getInterfaceDecl() const
If this pointer points to an Objective @interface type, gets the declaration for that interface...
const ObjCObjectType * getAsObjCQualifiedInterfaceType() const
VectorTypeBitfields VectorTypeBits
ExtVectorType - Extended vector type.
QualType getInnerType() const
The noexcept specifier evaluates to false.
Base for LValueReferenceType and RValueReferenceType.
CXXRecordDecl * getAsCXXRecordDecl() const
Retrieves the CXXRecordDecl that this type refers to, either because the type is a RecordType or beca...
unsigned getAddressSpace() const
The template argument is a type.
ExceptionSpecificationType
The various types of exception specifications that exist in C++11.
bool isMSTypeSpec() const
ArrayRef< QualType > Exceptions
Explicitly-specified list of exception types.
void merge(LinkageInfo other)
Merge both linkage and visibility.
Linkage getLinkage() const
Determine the linkage of this type.
DependentTemplateName * getAsDependentTemplateName() const
Retrieve the underlying dependent template name structure, if any.
const Type * getClass() const
Reading or writing from this object requires a barrier call.
bool isPODType(ASTContext &Context) const
Determine whether this is a Plain Old Data (POD) type (C++ 3.9p10).
An attributed type is a type to which a type attribute has been applied.
Defines the C++ Decl subclasses, other than those for templates (found in DeclTemplate.h) and friends (in DeclFriend.h).
bool hasAddressSpace() const
bool isBlockCompatibleObjCPointerType(ASTContext &ctx) const
unsigned pack_size() const
The number of template arguments in the given template argument pack.
bool isObjCClassType() const
True if this is equivalent to the 'Class' type, i.e.
QualType getVariableArrayType(QualType EltTy, Expr *NumElts, ArrayType::ArraySizeModifier ASM, unsigned IndexTypeQuals, SourceRange Brackets) const
Return a non-unique reference to the type for a variable array of the specified element type...
bool isCARCBridgableType() const
Determine whether the given type T is a "bridgeable" C type.
QualType getUnqualifiedType() const
Retrieve the unqualified variant of the given type, removing as little sugar as possible.
Represents a C++ struct/union/class.
TargetCXXABI getCXXABI() const
Get the C++ ABI currently in use.
bool isObjCObjectPointerType() const
Represents a C array with an unspecified size.
static bool anyDependentTemplateArguments(const TemplateArgumentLoc *Args, unsigned NumArgs, bool &InstantiationDependent)
Determine whether any of the given template arguments are dependent.
The parameter type of a method or function.
ArraySizeModifier getSizeModifier() const
void Profile(llvm::FoldingSetNodeID &ID)
QualType getVectorType(QualType VectorType, unsigned NumElts, VectorType::VectorKind VecKind) const
Return the unique reference to a vector type of the specified element type and size.
Stores a list of Objective-C type parameters for a parameterized class or a category/extension thereo...
This class is used for builtin types like 'int'.
Defines the clang::TargetInfo interface.
QualType getPointeeTypeAsWritten() const
TagDecl * getDecl() const
bool isObjCIndirectLifetimeType() const
static Decl::Kind getKind(const Decl *D)
QualType getConstantArrayType(QualType EltTy, const llvm::APInt &ArySize, ArrayType::ArraySizeModifier ASM, unsigned IndexTypeQuals) const
Return the unique reference to the type for a constant array of the specified element type...
QualType getElementType() const
static StringRef getNameForCallConv(CallingConv CC)
bool isObjCARCBridgableType() const
Determine whether the given type T is a "bridgable" Objective-C type, which is either an Objective-C ...
bool isInterfaceType() const
QualType desugar() const
Remove a single level of sugar.
A trivial tuple used to represent a source range.
VectorType(QualType vecType, unsigned nElements, QualType canonType, VectorKind vecKind)
NamedDecl - This represents a decl with a name.
StringRef getName(const PrintingPolicy &Policy) const
Represents a C array with a specified size that is not an integer-constant-expression.
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...
bool isArithmeticType() const
No keyword precedes the qualified type name.
bool isSignedIntegerType() const
Return true if this is an integer type that is signed, according to C99 6.2.5p4 [char, signed char, short, int, long..], or an enum decl which has a signed representation.
bool isConstQualified() const
Determine whether this type is const-qualified.
bool hasSignedIntegerRepresentation() const
Determine whether this type has an signed integer representation of some sort, e.g., it is an signed integer type or a vector.
bool isNull() const
Return true if this QualType doesn't point to a type yet.
const ObjCObjectPointerType * getAsObjCInterfacePointerType() const
QualType getSubstTemplateTypeParmType(const TemplateTypeParmType *Replaced, QualType Replacement) const
Retrieve a substitution-result type.
bool isObjCIdType() const
True if this is equivalent to the 'id' type, i.e.
The noexcept specifier is dependent.
Optional< NullabilityKind > getNullability(const ASTContext &context) const
Determine the nullability of the given type.
QualType getSingleStepDesugaredType(const ASTContext &Context) const
Return the specified type with one level of "sugar" removed from the type.
QualType getSuperClassType() const
Retrieve the type of the superclass of this object pointer type.
The "__interface" keyword introduces the elaborated-type-specifier.
ArrayRef< QualType > exceptions() const
The superclass of a type.
bool isBeingDefined() const
isBeingDefined - Return true if this decl is currently being defined.
bool isIntegralType(ASTContext &Ctx) const
Determine whether this type is an integral type.
Represents the canonical version of C arrays with a specified constant size.
ExceptionSpecInfo ExceptionSpec
QualType getBaseElementType(const ArrayType *VAT) const
Return the innermost element type of an array type.
const ObjCObjectType * getSuperClassType() const
Retrieve the superclass type.
bool isObjCQualifiedInterfaceType() const
unsigned getNumArgs() const
Retrieve the number of template arguments.
ScalarTypeKind getScalarTypeKind() const
Given that this is a scalar type, classify it.
A single template declaration.
bool isIntegerType() const
isIntegerType() does not include complex integers (a GCC extension).
const ObjCObjectPointerType * getAsObjCQualifiedIdType() const
bool isPointerType() const