26 #include "llvm/ADT/APSInt.h"
27 #include "llvm/ADT/StringExtras.h"
29 using namespace clang;
32 return (*
this != Other) &&
59 getElementType().getBaseTypeIdentifier();
71 return AT->getElementType().isConstant(Ctx);
78 const llvm::APInt &NumElements) {
87 if (llvm::isPowerOf2_64(ElementSize)) {
88 return NumElements.getActiveBits() + llvm::Log2_64(ElementSize);
93 if ((ElementSize >> 32) == 0 && NumElements.getBitWidth() <= 64 &&
94 (NumElements.getZExtValue() >> 32) == 0) {
95 uint64_t TotalSize = NumElements.getZExtValue() * ElementSize;
96 return 64 - llvm::countLeadingZeros(TotalSize);
100 llvm::APSInt SizeExtended(NumElements,
true);
102 SizeExtended = SizeExtended.extend(
std::max(SizeTypeBits,
103 SizeExtended.getBitWidth()) * 2);
105 llvm::APSInt TotalSize(llvm::APInt(SizeExtended.getBitWidth(), ElementSize));
106 TotalSize *= SizeExtended;
108 return TotalSize.getActiveBits();
125 Expr *e, ArraySizeModifier sm,
128 :
ArrayType(DependentSizedArray, et, can, sm, tq,
129 (et->containsUnexpandedParameterPack() ||
130 (e && e->containsUnexpandedParameterPack()))),
131 Context(Context), SizeExpr((
Stmt*) e), Brackets(brackets)
142 ID.AddInteger(SizeMod);
143 ID.AddInteger(TypeQuals);
147 DependentSizedExtVectorType::DependentSizedExtVectorType(
const
153 :
Type(DependentSizedExtVector, can,
true,
155 ElementType->isVariablyModifiedType(),
156 (ElementType->containsUnexpandedParameterPack() ||
157 (SizeExpr && SizeExpr->containsUnexpandedParameterPack()))),
158 Context(Context), SizeExpr(SizeExpr), ElementType(ElementType),
168 SizeExpr->
Profile(ID, Context,
true);
173 :
VectorType(Vector, vecType, nElements, canonType, vecKind) {}
177 :
Type(tc, canonType, vecType->isDependentType(),
178 vecType->isInstantiationDependentType(),
179 vecType->isVariablyModifiedType(),
180 vecType->containsUnexpandedParameterPack()),
192 if (
const ArrayType *ATy = dyn_cast<ArrayType>(
this))
193 return ATy->getElementType().getTypePtr();
196 if (!isa<ArrayType>(CanonicalType))
202 ->getElementType().getTypePtr();
225 #define ABSTRACT_TYPE(Class, Parent)
226 #define TYPE(Class, Parent) \
227 case Type::Class: { \
228 const Class##Type *ty = cast<Class##Type>(this); \
229 if (!ty->isSugared()) return QualType(ty, 0); \
230 return ty->desugar(); \
232 #include "clang/AST/TypeNodes.def"
234 llvm_unreachable(
"bad type kind!");
244 #define ABSTRACT_TYPE(Class, Parent)
245 #define TYPE(Class, Parent) \
246 case Type::Class: { \
247 const Class##Type *Ty = cast<Class##Type>(CurTy); \
248 if (!Ty->isSugared()) \
249 return SplitQualType(Ty, Qs); \
250 Cur = Ty->desugar(); \
253 #include "clang/AST/TypeNodes.def"
265 const Type *lastTypeWithQuals = split.
Ty;
273 #define ABSTRACT_TYPE(Class, Parent)
274 #define TYPE(Class, Parent) \
275 case Type::Class: { \
276 const Class##Type *ty = cast<Class##Type>(split.Ty); \
277 if (!ty->isSugared()) goto done; \
278 next = ty->desugar(); \
281 #include "clang/AST/TypeNodes.def"
286 split = next.
split();
288 lastTypeWithQuals = split.
Ty;
300 T = PT->getInnerType();
309 if (
const T *Sugar = dyn_cast<T>(Cur))
312 #define ABSTRACT_TYPE(Class, Parent)
313 #define TYPE(Class, Parent) \
314 case Type::Class: { \
315 const Class##Type *Ty = cast<Class##Type>(Cur); \
316 if (!Ty->isSugared()) return 0; \
317 Cur = Ty->desugar().getTypePtr(); \
320 #include "clang/AST/TypeNodes.def"
326 return getAsSugar<TypedefType>(
this);
330 return getAsSugar<TemplateSpecializationType>(
this);
334 return getAsSugar<AttributedType>(
this);
341 const Type *Cur =
this;
345 #define ABSTRACT_TYPE(Class, Parent)
346 #define TYPE(Class, Parent) \
348 const Class##Type *Ty = cast<Class##Type>(Cur); \
349 if (!Ty->isSugared()) return Cur; \
350 Cur = Ty->desugar().getTypePtr(); \
353 #include "clang/AST/TypeNodes.def"
358 if (
const RecordType *RT = getAs<RecordType>())
359 return RT->getDecl()->isClass();
363 if (
const RecordType *RT = getAs<RecordType>())
364 return RT->getDecl()->isStruct();
368 if (
const RecordType *RT = getAs<RecordType>())
369 return RT->getDecl()->hasAttr<ObjCBoxableAttr>();
373 if (
const RecordType *RT = getAs<RecordType>())
374 return RT->getDecl()->isInterface();
378 if (
const RecordType *RT = getAs<RecordType>()) {
386 return PT->getPointeeType()->isVoidType();
391 if (
const RecordType *RT = getAs<RecordType>())
392 return RT->getDecl()->isUnion();
397 if (
const ComplexType *CT = dyn_cast<ComplexType>(CanonicalType))
398 return CT->getElementType()->isFloatingType();
408 if (
const ComplexType *Complex = getAs<ComplexType>())
409 if (Complex->getElementType()->isIntegerType())
432 if (
const RecordType *RT = dyn_cast<RecordType>(
this)) {
433 if (RT->getDecl()->isStruct())
438 if (
const RecordType *RT = dyn_cast<RecordType>(CanonicalType)) {
439 if (!RT->getDecl()->isStruct())
451 if (
const RecordType *RT = dyn_cast<RecordType>(
this)) {
452 if (RT->getDecl()->isUnion())
457 if (
const RecordType *RT = dyn_cast<RecordType>(CanonicalType)) {
458 if (!RT->getDecl()->isUnion())
519 const Type *cur =
this;
521 if (
auto attributed = dyn_cast<AttributedType>(cur)) {
522 if (attributed->getAttrKind() ==
537 :
Type(ObjCTypeParam, can, can->isDependentType(),
538 can->isInstantiationDependentType(),
539 can->isVariablyModifiedType(),
543 initialize(protocols);
550 :
Type(ObjCObject, Canonical, Base->isDependentType(),
551 Base->isInstantiationDependentType(),
552 Base->isVariablyModifiedType(),
553 Base->containsUnexpandedParameterPack()),
560 "bitfield overflow in type argument count");
561 if (!typeArgs.empty())
562 memcpy(getTypeArgStorage(), typeArgs.data(),
563 typeArgs.size() *
sizeof(
QualType));
565 for (
auto typeArg : typeArgs) {
566 if (typeArg->isDependentType())
568 else if (typeArg->isInstantiationDependentType())
571 if (typeArg->containsUnexpandedParameterPack())
585 if (
auto objcObject =
getBaseType()->getAs<ObjCObjectType>()) {
587 if (isa<ObjCInterfaceType>(objcObject))
590 return objcObject->isSpecialized();
603 if (
auto objcObject =
getBaseType()->getAs<ObjCObjectType>()) {
605 if (isa<ObjCInterfaceType>(objcObject))
608 return objcObject->getTypeArgs();
620 if (
auto objcObject =
getBaseType()->getAs<ObjCObjectType>()) {
622 if (isa<ObjCInterfaceType>(objcObject))
625 return objcObject->isKindOfType();
642 baseType = baseObj->stripObjCKindOfTypeAndQuals(ctx);
646 splitBaseType.
Quals),
668 struct SimpleTransformVisitor
669 :
public TypeVisitor<SimpleTransformVisitor<F>, QualType> {
674 return simpleTransform(Ctx, type, std::move(TheFunc));
678 SimpleTransformVisitor(
ASTContext &ctx, F &&f) : Ctx(ctx), TheFunc(std::move(f)) { }
682 #define TYPE(Class, Base)
683 #define DEPENDENT_TYPE(Class, Base) \
684 QualType Visit##Class##Type(const Class##Type *T) { return QualType(T, 0); }
685 #include "clang/AST/TypeNodes.def"
687 #define TRIVIAL_TYPE_CLASS(Class) \
688 QualType Visit##Class##Type(const Class##Type *T) { return QualType(T, 0); }
693 QualType elementType = recurse(T->getElementType());
697 if (elementType.
getAsOpaquePtr() == T->getElementType().getAsOpaquePtr())
840 bool paramChanged =
false;
842 QualType newParamType = recurse(paramType);
843 if (newParamType.
isNull())
849 paramTypes.push_back(newParamType);
854 bool exceptionChanged =
false;
858 QualType newExceptionType = recurse(exceptionType);
859 if (newExceptionType.
isNull())
863 != exceptionType.getAsOpaquePtr())
864 exceptionChanged =
true;
866 exceptionTypes.push_back(newExceptionType);
869 if (exceptionChanged) {
871 llvm::makeArrayRef(exceptionTypes).copy(Ctx);
876 !paramChanged && !exceptionChanged)
897 QualType originalType = recurse(T->getOriginalType());
898 if (originalType.
isNull())
901 QualType adjustedType = recurse(T->getAdjustedType());
902 if (adjustedType.
isNull())
906 == T->getOriginalType().getAsOpaquePtr() &&
907 adjustedType.
getAsOpaquePtr() == T->getAdjustedType().getAsOpaquePtr())
915 if (originalType.
isNull())
936 QualType modifiedType = recurse(T->getModifiedType());
937 if (modifiedType.
isNull())
940 QualType equivalentType = recurse(T->getEquivalentType());
941 if (equivalentType.
isNull())
945 == T->getModifiedType().getAsOpaquePtr() &&
947 == T->getEquivalentType().getAsOpaquePtr())
956 if (replacementType.
isNull())
974 QualType deducedType = recurse(T->getDeducedType());
979 == T->getDeducedType().getAsOpaquePtr())
982 return Ctx.
getAutoType(deducedType, T->getKeyword(),
990 QualType baseType = recurse(T->getBaseType());
995 bool typeArgChanged =
false;
997 for (
auto typeArg : T->getTypeArgsAsWritten()) {
998 QualType newTypeArg = recurse(typeArg);
1003 typeArgChanged =
true;
1005 typeArgs.push_back(newTypeArg);
1008 if (baseType.
getAsOpaquePtr() == T->getBaseType().getAsOpaquePtr() &&
1013 llvm::makeArrayRef(T->qual_begin(),
1014 T->getNumProtocols()),
1015 T->isKindOfTypeAsWritten());
1021 QualType pointeeType = recurse(T->getPointeeType());
1022 if (pointeeType.
isNull())
1026 == T->getPointeeType().getAsOpaquePtr())
1044 #undef TRIVIAL_TYPE_CLASS
1049 template<
typename F>
1060 SimpleTransformVisitor<F> visitor(ctx, std::forward<F>(f));
1061 QualType result = visitor.Visit(splitType.
Ty);
1078 return simpleTransform(ctx, *
this,
1084 if (
const auto *OTPTy = dyn_cast<ObjCTypeParamType>(splitType.
Ty)) {
1085 if (
auto *typeParam = dyn_cast<ObjCTypeParamDecl>(OTPTy->getDecl())) {
1087 if (!typeArgs.empty()) {
1088 QualType argType = typeArgs[typeParam->getIndex()];
1089 if (OTPTy->qual_empty())
1095 protocolsVec.append(OTPTy->qual_begin(),
1099 protocolsToApply, hasError,
true);
1115 const auto *objPtr = typeParam->getUnderlyingType()
1120 if (objPtr->isKindOfType() || objPtr->isObjCIdOrClassType())
1125 const auto *obj = objPtr->getObjectType();
1127 obj->getTypeArgsAsWritten(),
1128 obj->getProtocols(),
1140 if (
const auto *funcType = dyn_cast<FunctionType>(splitType.
Ty)) {
1142 QualType returnType = funcType->getReturnType().substObjCTypeArgs(
1151 if (isa<FunctionNoProtoType>(funcType)) {
1154 == funcType->getReturnType().getAsOpaquePtr())
1161 const auto *funcProtoType = cast<FunctionProtoType>(funcType);
1165 bool paramChanged =
false;
1166 for (
auto paramType : funcProtoType->getParamTypes()) {
1171 if (newParamType.
isNull())
1175 paramChanged =
true;
1177 paramTypes.push_back(newParamType);
1182 bool exceptionChanged =
false;
1190 if (newExceptionType.
isNull())
1194 != exceptionType.getAsOpaquePtr())
1195 exceptionChanged =
true;
1197 exceptionTypes.push_back(newExceptionType);
1200 if (exceptionChanged) {
1202 llvm::makeArrayRef(exceptionTypes).copy(ctx);
1207 == funcProtoType->getReturnType().getAsOpaquePtr() &&
1208 !paramChanged && !exceptionChanged)
1216 if (
const auto *objcObjectType = dyn_cast<ObjCObjectType>(splitType.
Ty)) {
1217 if (objcObjectType->isSpecializedAsWritten()) {
1219 bool anyChanged =
false;
1220 for (
auto typeArg : objcObjectType->getTypeArgsAsWritten()) {
1231 objcObjectType->qual_begin(),
1232 objcObjectType->getNumProtocols());
1233 if (typeArgs.empty() &&
1236 objcObjectType->getBaseType(), { },
1238 objcObjectType->isKindOfTypeAsWritten());
1244 newTypeArgs.push_back(newTypeArg);
1249 objcObjectType->qual_begin(),
1250 objcObjectType->getNumProtocols());
1252 newTypeArgs, protocols,
1253 objcObjectType->isKindOfTypeAsWritten());
1275 auto &ctx =
const_cast<ASTContext &
>(constCtx);
1276 return simpleTransform(ctx, *
this,
1280 if (!objType->isKindOfType())
1284 = objType->getBaseType().stripObjCKindOfType(ctx);
1287 objType->getTypeArgsAsWritten(),
1288 objType->getProtocols(),
1298 if (
auto AT =
getTypePtr()->getAs<AtomicType>())
1299 return AT->getValueType().getUnqualifiedType();
1306 if (
auto method = dyn_cast<ObjCMethodDecl>(dc))
1307 dc = method->getDeclContext();
1324 if (!dcCategoryDecl)
1329 dcTypeParams = dcCategoryDecl->getTypeParamList();
1333 dcClassDecl = dcCategoryDecl->getClassInterface();
1337 assert(dcTypeParams &&
"No substitutions to perform");
1338 assert(dcClassDecl &&
"No class context");
1342 if (
const auto *objectPointerType = getAs<ObjCObjectPointerType>()) {
1343 objectType = objectPointerType->getObjectType();
1344 }
else if (getAs<BlockPointerType>()) {
1347 ->castAs<ObjCObjectType>();
1349 objectType = getAs<ObjCObjectType>();
1355 if (!curClassDecl) {
1363 while (curClassDecl != dcClassDecl) {
1365 QualType superType = objectType->getSuperClassType();
1366 if (superType.
isNull()) {
1367 objectType =
nullptr;
1377 if (!objectType || objectType->isUnspecialized()) {
1382 return objectType->getTypeArgs();
1385 bool Type::acceptsObjCTypeParams()
const {
1387 if (
auto *
ID = IfaceT->getInterface()) {
1388 if (
ID->getTypeParamList())
1402 CachedSuperClassType.setInt(
true);
1408 if (!superClassObjTy) {
1409 CachedSuperClassType.setInt(
true);
1414 if (!superClassDecl) {
1415 CachedSuperClassType.setInt(
true);
1421 QualType superClassType(superClassObjTy, 0);
1423 if (!superClassTypeParams) {
1424 CachedSuperClassType.setPointerAndInt(
1431 CachedSuperClassType.setPointerAndInt(superClassObjTy,
true);
1439 CachedSuperClassType.setPointerAndInt(
1450 CachedSuperClassType.setPointerAndInt(
1458 assert(typeArgs.size() == typeParams->
size());
1459 CachedSuperClassType.setPointerAndInt(
1462 ->castAs<ObjCObjectType>(),
1468 return interfaceDecl->getASTContext().getObjCInterfaceType(interfaceDecl)
1477 if (superObjectType.
isNull())
1478 return superObjectType;
1489 if (T->getNumProtocols() && T->getInterface())
1502 if (OPT->isObjCQualifiedIdType())
1512 if (OPT->isObjCQualifiedClassType())
1520 if (OT->getInterface())
1527 if (OPT->getInterfaceType())
1549 return dyn_cast_or_null<CXXRecordDecl>(
getAsTagDecl());
1553 if (
const auto *TT = getAs<TagType>())
1554 return cast<TagDecl>(TT->getDecl());
1555 if (
const auto *Injected = getAs<InjectedClassNameType>())
1556 return Injected->getDecl();
1562 class GetContainedDeducedTypeVisitor :
1563 public TypeVisitor<GetContainedDeducedTypeVisitor, Type*> {
1566 GetContainedDeducedTypeVisitor(
bool Syntactic =
false)
1567 : Syntactic(Syntactic) {}
1600 Type *VisitDependentSizedExtVectorType(
1609 return const_cast<FunctionProtoType*>(T);
1610 return VisitFunctionType(T);
1628 return cast_or_null<DeducedType>(
1629 GetContainedDeducedTypeVisitor().Visit(
this));
1633 return dyn_cast_or_null<FunctionType>(
1634 GetContainedDeducedTypeVisitor(
true).Visit(
this));
1638 if (
const VectorType *VT = dyn_cast<VectorType>(CanonicalType))
1639 return VT->getElementType()->isIntegerType();
1664 if (
const BuiltinType *BT = dyn_cast<BuiltinType>(CanonicalType))
1665 return BT->getKind() >= BuiltinType::Bool &&
1666 BT->getKind() <= BuiltinType::Int128;
1670 if (
const EnumType *ET = dyn_cast<EnumType>(CanonicalType))
1671 return ET->getDecl()->isComplete();
1678 if (
const BuiltinType *BT = dyn_cast<BuiltinType>(CanonicalType))
1679 return BT->getKind() >= BuiltinType::Bool &&
1680 BT->getKind() <= BuiltinType::Int128;
1686 if (
const EnumType *ET = dyn_cast<EnumType>(CanonicalType))
1687 return ET->getDecl()->isComplete() && !ET->getDecl()->isScoped();
1695 if (
const BuiltinType *BT = dyn_cast<BuiltinType>(CanonicalType))
1696 return BT->getKind() == BuiltinType::Char_U ||
1697 BT->getKind() == BuiltinType::UChar ||
1698 BT->getKind() == BuiltinType::Char_S ||
1699 BT->getKind() == BuiltinType::SChar;
1704 if (
const BuiltinType *BT = dyn_cast<BuiltinType>(CanonicalType))
1705 return BT->getKind() == BuiltinType::WChar_S ||
1706 BT->getKind() == BuiltinType::WChar_U;
1711 if (
const BuiltinType *BT = dyn_cast<BuiltinType>(CanonicalType))
1712 return BT->getKind() == BuiltinType::Char16;
1717 if (
const BuiltinType *BT = dyn_cast<BuiltinType>(CanonicalType))
1718 return BT->getKind() == BuiltinType::Char32;
1726 if (!BT)
return false;
1728 default:
return false;
1729 case BuiltinType::Char_U:
1730 case BuiltinType::UChar:
1731 case BuiltinType::WChar_U:
1732 case BuiltinType::Char16:
1733 case BuiltinType::Char32:
1734 case BuiltinType::Char_S:
1735 case BuiltinType::SChar:
1736 case BuiltinType::WChar_S:
1745 if (
const BuiltinType *BT = dyn_cast<BuiltinType>(CanonicalType)) {
1746 return BT->getKind() >= BuiltinType::Char_S &&
1747 BT->getKind() <= BuiltinType::Int128;
1750 if (
const EnumType *ET = dyn_cast<EnumType>(CanonicalType)) {
1753 if (ET->getDecl()->isComplete() && !ET->getDecl()->isScoped())
1754 return ET->getDecl()->getIntegerType()->isSignedIntegerType();
1761 if (
const BuiltinType *BT = dyn_cast<BuiltinType>(CanonicalType)) {
1762 return BT->getKind() >= BuiltinType::Char_S &&
1763 BT->getKind() <= BuiltinType::Int128;
1766 if (
const EnumType *ET = dyn_cast<EnumType>(CanonicalType)) {
1767 if (ET->getDecl()->isComplete())
1768 return ET->getDecl()->getIntegerType()->isSignedIntegerType();
1775 if (
const VectorType *VT = dyn_cast<VectorType>(CanonicalType))
1776 return VT->getElementType()->isSignedIntegerOrEnumerationType();
1785 if (
const BuiltinType *BT = dyn_cast<BuiltinType>(CanonicalType)) {
1786 return BT->getKind() >= BuiltinType::Bool &&
1787 BT->getKind() <= BuiltinType::UInt128;
1790 if (
const EnumType *ET = dyn_cast<EnumType>(CanonicalType)) {
1793 if (ET->getDecl()->isComplete() && !ET->getDecl()->isScoped())
1794 return ET->getDecl()->getIntegerType()->isUnsignedIntegerType();
1801 if (
const BuiltinType *BT = dyn_cast<BuiltinType>(CanonicalType)) {
1802 return BT->getKind() >= BuiltinType::Bool &&
1803 BT->getKind() <= BuiltinType::UInt128;
1806 if (
const EnumType *ET = dyn_cast<EnumType>(CanonicalType)) {
1807 if (ET->getDecl()->isComplete())
1808 return ET->getDecl()->getIntegerType()->isUnsignedIntegerType();
1815 if (
const VectorType *VT = dyn_cast<VectorType>(CanonicalType))
1816 return VT->getElementType()->isUnsignedIntegerOrEnumerationType();
1822 if (
const BuiltinType *BT = dyn_cast<BuiltinType>(CanonicalType))
1823 return BT->getKind() >= BuiltinType::Half &&
1824 BT->getKind() <= BuiltinType::Float128;
1825 if (
const ComplexType *CT = dyn_cast<ComplexType>(CanonicalType))
1826 return CT->getElementType()->isFloatingType();
1831 if (
const VectorType *VT = dyn_cast<VectorType>(CanonicalType))
1832 return VT->getElementType()->isFloatingType();
1838 if (
const BuiltinType *BT = dyn_cast<BuiltinType>(CanonicalType))
1839 return BT->isFloatingPoint();
1844 if (
const BuiltinType *BT = dyn_cast<BuiltinType>(CanonicalType))
1845 return BT->getKind() >= BuiltinType::Bool &&
1846 BT->getKind() <= BuiltinType::Float128;
1847 if (
const EnumType *ET = dyn_cast<EnumType>(CanonicalType))
1848 return ET->getDecl()->isComplete() && !ET->getDecl()->isScoped();
1853 if (
const BuiltinType *BT = dyn_cast<BuiltinType>(CanonicalType))
1854 return BT->getKind() >= BuiltinType::Bool &&
1855 BT->getKind() <= BuiltinType::Float128;
1856 if (
const EnumType *ET = dyn_cast<EnumType>(CanonicalType))
1863 return !ET->getDecl()->isScoped() && ET->getDecl()->isComplete();
1864 return isa<ComplexType>(CanonicalType);
1870 const Type *T = CanonicalType.getTypePtr();
1871 if (
const BuiltinType *BT = dyn_cast<BuiltinType>(T)) {
1872 if (BT->getKind() == BuiltinType::Bool)
return STK_Bool;
1873 if (BT->getKind() == BuiltinType::NullPtr)
return STK_CPointer;
1876 llvm_unreachable(
"unknown scalar builtin type");
1877 }
else if (isa<PointerType>(T)) {
1879 }
else if (isa<BlockPointerType>(T)) {
1881 }
else if (isa<ObjCObjectPointerType>(T)) {
1883 }
else if (isa<MemberPointerType>(T)) {
1885 }
else if (isa<EnumType>(T)) {
1886 assert(cast<EnumType>(T)->getDecl()->isComplete());
1888 }
else if (
const ComplexType *CT = dyn_cast<ComplexType>(T)) {
1889 if (CT->getElementType()->isRealFloatingType())
1894 llvm_unreachable(
"unknown scalar type");
1907 if (
const RecordType *Record = dyn_cast<RecordType>(CanonicalType)) {
1908 if (
CXXRecordDecl *ClassDecl = dyn_cast<CXXRecordDecl>(Record->getDecl()))
1909 return ClassDecl->isAggregate();
1914 return isa<ArrayType>(CanonicalType);
1921 assert(!
isIncompleteType() &&
"This doesn't make sense for incomplete types");
1922 assert(!
isDependentType() &&
"This doesn't make sense for dependent types");
1924 return !isa<VariableArrayType>(CanonicalType);
1934 switch (CanonicalType->getTypeClass()) {
1935 default:
return false;
1941 EnumDecl *EnumD = cast<EnumType>(CanonicalType)->getDecl();
1954 RecordDecl *Rec = cast<RecordType>(CanonicalType)->getDecl();
1964 return cast<ArrayType>(CanonicalType)->getElementType()
1965 ->isIncompleteType(Def);
1966 case IncompleteArray:
1969 case MemberPointer: {
1973 auto *MPTy = cast<MemberPointerType>(CanonicalType);
1974 const Type *ClassTy = MPTy->getClass();
1976 if (ClassTy->isDependentType())
1987 if (RD->
hasAttr<MSInheritanceAttr>())
1992 return cast<ObjCObjectType>(CanonicalType)->getBaseType()
1993 ->isIncompleteType(Def);
1994 case ObjCInterface: {
1997 = cast<ObjCInterfaceType>(CanonicalType)->getDecl();
2020 if ((*this)->isIncompleteArrayType())
2023 if ((*this)->isIncompleteType())
2032 default:
return false;
2033 case Type::VariableArray:
2034 case Type::ConstantArray:
2038 case Type::ObjCObjectPointer:
2039 case Type::BlockPointer:
2043 case Type::MemberPointer:
2045 case Type::ExtVector:
2053 = dyn_cast<CXXRecordDecl>(cast<RecordType>(CanonicalType)->getDecl()))
2054 return ClassDecl->isPOD();
2068 if ((*this)->isArrayType())
2073 if ((*this)->isIncompleteType())
2093 dyn_cast<CXXRecordDecl>(RT->getDecl())) {
2098 return ClassDecl->hasDefaultConstructor() &&
2099 !ClassDecl->hasNonTrivialDefaultConstructor() &&
2100 ClassDecl->isTriviallyCopyable();
2111 if ((*this)->isArrayType())
2137 dyn_cast<CXXRecordDecl>(RT->getDecl())) {
2138 if (!ClassDecl->isTriviallyCopyable())
return false;
2171 assert(BaseTy &&
"NULL element type");
2202 dyn_cast<CXXRecordDecl>(RT->getDecl()))
2203 return ClassDecl->isLiteral();
2210 return AT->getValueType()->isLiteralType(Ctx);
2229 assert(BaseTy &&
"NULL element type");
2240 dyn_cast<CXXRecordDecl>(RT->getDecl()))
2241 if (!ClassDecl->isStandardLayout())
2269 assert(BaseTy &&
"NULL element type");
2280 dyn_cast<CXXRecordDecl>(RT->getDecl())) {
2283 if (!ClassDecl->isTrivial())
return false;
2288 if (!ClassDecl->isStandardLayout())
return false;
2308 if (
auto *ET = getAs<EnumType>()) {
2309 auto *II = ET->getDecl()->getIdentifier();
2310 if (II && II->isStr(
"align_val_t") && ET->getDecl()->isInStdNamespace())
2317 if (
auto *ET = getAs<EnumType>()) {
2318 auto *II = ET->getDecl()->getIdentifier();
2319 if (II && II->isStr(
"byte") && ET->getDecl()->isInStdNamespace())
2327 switch (BT->getKind()) {
2328 case BuiltinType::Bool:
2329 case BuiltinType::Char_S:
2330 case BuiltinType::Char_U:
2331 case BuiltinType::SChar:
2332 case BuiltinType::UChar:
2333 case BuiltinType::Short:
2334 case BuiltinType::UShort:
2335 case BuiltinType::WChar_S:
2336 case BuiltinType::WChar_U:
2337 case BuiltinType::Char16:
2338 case BuiltinType::Char32:
2346 if (
const EnumType *ET = getAs<EnumType>()){
2347 if (this->
isDependentType() || ET->getDecl()->getPromotionType().isNull()
2348 || ET->getDecl()->isScoped())
2367 case TemplateTypeParm:
2368 case SubstTemplateTypeParm:
2369 case TemplateSpecialization:
2372 case DependentTemplateSpecialization:
2375 case ObjCObjectPointer:
2405 llvm_unreachable(
"Type specifier is not a tag type kind.");
2417 llvm_unreachable(
"Unknown tag type kind.");
2430 llvm_unreachable(
"Elaborated type keyword is not a tag type kind.");
2432 llvm_unreachable(
"Unknown elaborated type keyword.");
2448 llvm_unreachable(
"Unknown elaborated type keyword.");
2462 llvm_unreachable(
"Unknown elaborated type keyword.");
2465 DependentTemplateSpecializationType::DependentTemplateSpecializationType(
2472 NNS && NNS->containsUnexpandedParameterPack()),
2473 NNS(NNS), Name(Name), NumArgs(Args.size()) {
2475 "DependentTemplateSpecializatonType requires dependent qualifier");
2478 if (Arg.containsUnexpandedParameterPack())
2492 ID.AddInteger(Keyword);
2493 ID.AddPointer(Qualifier);
2494 ID.AddPointer(Name);
2496 Arg.Profile(ID, Context);
2502 Keyword = Elab->getKeyword();
2504 Keyword = DepName->getKeyword();
2506 dyn_cast<DependentTemplateSpecializationType>(
this))
2507 Keyword = DepTST->getKeyword();
2516 #define ABSTRACT_TYPE(Derived, Base)
2517 #define TYPE(Derived, Base) case Derived: return #Derived;
2518 #include "clang/AST/TypeNodes.def"
2521 llvm_unreachable(
"Invalid type class.");
2529 return Policy.
Bool ?
"bool" :
"_Bool";
2535 return "signed char";
2547 return "unsigned char";
2549 return "unsigned short";
2551 return "unsigned int";
2553 return "unsigned long";
2555 return "unsigned long long";
2557 return "unsigned __int128";
2559 return Policy.
Half ?
"half" :
"__fp16";
2565 return "long double";
2567 return "__float128";
2570 return Policy.
MSWChar ?
"__wchar_t" :
"wchar_t";
2578 return "<overloaded function type>";
2580 return "<bound member function type>";
2582 return "<pseudo-object type>";
2584 return "<dependent type>";
2586 return "<unknown type>";
2587 case ARCUnbridgedCast:
2588 return "<ARC unbridged cast type>";
2590 return "<builtin fn type>";
2597 #define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \
2599 return "__" #Access " " #ImgType "_t";
2600 #include "clang/Basic/OpenCLImageTypes.def"
2606 return "clk_event_t";
2610 return "reserve_id_t";
2611 case OMPArraySection:
2612 return "<OpenMP array section type>";
2615 llvm_unreachable(
"Invalid builtin type.");
2636 case CC_C:
return "cdecl";
2655 llvm_unreachable(
"Invalid calling convention.");
2660 const ExtProtoInfo &epi)
2662 result->isDependentType(),
2663 result->isInstantiationDependentType(),
2664 result->isVariablyModifiedType(),
2665 result->containsUnexpandedParameterPack(), epi.ExtInfo),
2666 NumParams(params.size()),
2667 NumExceptions(epi.ExceptionSpec.Exceptions.size()),
2668 ExceptionSpecType(epi.ExceptionSpec.
Type),
2669 HasExtParameterInfos(epi.ExtParameterInfos != nullptr),
2670 Variadic(epi.Variadic), HasTrailingReturn(epi.HasTrailingReturn) {
2671 assert(NumParams == params.size() &&
"function has too many parameters");
2678 for (
unsigned i = 0; i != NumParams; ++i) {
2687 argSlot[i] = params[i];
2692 QualType *exnSlot = argSlot + NumParams;
2694 for (
QualType ExceptionType : epi.ExceptionSpec.Exceptions) {
2704 exnSlot[I++] = ExceptionType;
2708 Expr **noexSlot =
reinterpret_cast<Expr **
>(argSlot + NumParams);
2709 *noexSlot = epi.ExceptionSpec.NoexceptExpr;
2711 if (epi.ExceptionSpec.NoexceptExpr) {
2712 if (epi.ExceptionSpec.NoexceptExpr->isValueDependent() ||
2713 epi.ExceptionSpec.NoexceptExpr->isInstantiationDependent())
2716 if (epi.ExceptionSpec.NoexceptExpr->containsUnexpandedParameterPack())
2723 reinterpret_cast<FunctionDecl **
>(argSlot + NumParams);
2724 slot[0] = epi.ExceptionSpec.SourceDecl;
2725 slot[1] = epi.ExceptionSpec.SourceTemplate;
2732 reinterpret_cast<FunctionDecl **
>(argSlot + NumParams);
2733 slot[0] = epi.ExceptionSpec.SourceDecl;
2741 assert(hasDependentExceptionSpec() &&
"type should not be canonical");
2749 if (epi.ExtParameterInfos) {
2750 ExtParameterInfo *extParamInfos =
2751 const_cast<ExtParameterInfo *
>(getExtParameterInfosBuffer());
2752 for (
unsigned i = 0; i != NumParams; ++i)
2753 extParamInfos[i] = epi.ExtParameterInfos[i];
2759 return NE->isValueDependent();
2771 return NE->isInstantiationDependent();
2773 if (ET->isInstantiationDependentType())
2797 assert(isICE &&
"AST should not contain bad noexcept expressions.");
2811 for (
unsigned I = 0, N = NumExceptions; I != N; ++
I)
2827 for (
unsigned ArgIdx =
getNumParams(); ArgIdx; --ArgIdx)
2835 const QualType *ArgTys,
unsigned NumParams,
2836 const ExtProtoInfo &epi,
2857 for (
unsigned i = 0; i != NumParams; ++i)
2862 assert(!(
unsigned(epi.Variadic) & ~1) &&
2863 !(
unsigned(epi.TypeQuals) & ~255) &&
2864 !(
unsigned(epi.RefQualifier) & ~3) &&
2865 !(
unsigned(epi.ExceptionSpec.Type) & ~15) &&
2866 "Values larger than expected.");
2867 ID.AddInteger(
unsigned(epi.Variadic) +
2868 (epi.TypeQuals << 1) +
2869 (epi.RefQualifier << 9) +
2870 (epi.ExceptionSpec.Type << 11));
2872 for (
QualType Ex : epi.ExceptionSpec.Exceptions)
2875 epi.ExceptionSpec.NoexceptExpr) {
2876 epi.ExceptionSpec.NoexceptExpr->Profile(ID, Context, Canonical);
2879 ID.AddPointer(epi.ExceptionSpec.SourceDecl->getCanonicalDecl());
2881 if (epi.ExtParameterInfos) {
2882 for (
unsigned i = 0; i != NumParams; ++i)
2883 ID.AddInteger(epi.ExtParameterInfos[i].getOpaqueValue());
2885 epi.ExtInfo.Profile(ID);
2886 ID.AddBoolean(epi.HasTrailingReturn);
2900 :
Type(TypeOfExpr, can, E->isTypeDependent(),
2901 E->isInstantiationDependent(),
2902 E->getType()->isVariablyModifiedType(),
2903 E->containsUnexpandedParameterPack()),
2920 E->
Profile(ID, Context,
true);
2927 :
Type(Decltype, can, E->isInstantiationDependent(),
2928 E->isInstantiationDependent(),
2929 E->getType()->isVariablyModifiedType(),
2930 E->containsUnexpandedParameterPack()),
2932 UnderlyingType(underlyingType) {
2945 :
DecltypeType(E, Context.DependentTy), Context(Context) { }
2949 E->
Profile(ID, Context,
true);
2956 :
Type(UnaryTransform, CanonicalType, BaseType->isDependentType(),
2957 BaseType->isInstantiationDependentType(),
2958 BaseType->isVariablyModifiedType(),
2959 BaseType->containsUnexpandedParameterPack())
2960 , BaseType(BaseType), UnderlyingType(UnderlyingType), UKind(UKind)
2971 :
Type(TC, can, D->isDependentType(),
2972 D->isDependentType(),
2978 for (
auto I : decl->
redecls()) {
2979 if (I->isCompleteDefinition() || I->isBeingDefined())
3038 llvm_unreachable(
"bad attributed type kind");
3043 default:
return false;
3050 llvm_unreachable(
"invalid attr kind");
3092 llvm_unreachable(
"invalid attr kind");
3103 SubstTemplateTypeParmPackType::
3109 Arguments(ArgPack.pack_begin()), NumArguments(ArgPack.pack_size())
3124 ID.AddPointer(Replaced);
3127 ID.AddPointer(
P.getAsType().getAsOpaquePtr());
3132 bool &InstantiationDependent) {
3134 InstantiationDependent);
3139 bool &InstantiationDependent) {
3141 if (ArgLoc.getArgument().isDependent()) {
3142 InstantiationDependent =
true;
3146 if (ArgLoc.getArgument().isInstantiationDependent())
3147 InstantiationDependent =
true;
3152 TemplateSpecializationType::
3156 :
Type(TemplateSpecialization,
3157 Canon.isNull()?
QualType(this, 0) : Canon,
3158 Canon.isNull()?
true : Canon->isDependentType(),
3159 Canon.isNull()?
true : Canon->isInstantiationDependentType(),
3161 T.containsUnexpandedParameterPack()),
3162 Template(T), NumArgs(Args.size()), TypeAlias(!AliasedType.isNull()) {
3164 "Use DependentTemplateSpecializationType for dependent template-name");
3168 "Unexpected template name for TemplateSpecializationType");
3181 if (Arg.isInstantiationDependent())
3184 Arg.getAsType()->isVariablyModifiedType())
3186 if (Arg.containsUnexpandedParameterPack())
3205 Arg.Profile(ID, Context);
3230 ID.AddInteger(typeArgs.size());
3231 for (
auto typeArg : typeArgs)
3232 ID.AddPointer(typeArg.getAsOpaquePtr());
3233 ID.AddInteger(protocols.size());
3234 for (
auto proto : protocols)
3235 ID.AddPointer(proto);
3236 ID.AddBoolean(isKindOf);
3248 ID.AddPointer(OTPDecl);
3249 ID.AddInteger(protocols.size());
3250 for (
auto proto : protocols)
3251 ID.AddPointer(proto);
3262 class CachedProperties {
3267 CachedProperties(
Linkage L,
bool local) : L(L), local(local) {}
3269 Linkage getLinkage()
const {
return L; }
3270 bool hasLocalOrUnnamedType()
const {
return local; }
3272 friend CachedProperties merge(CachedProperties L, CachedProperties R) {
3274 return CachedProperties(MergedLinkage,
3275 L.hasLocalOrUnnamedType() | R.hasLocalOrUnnamedType());
3289 return get(T.getTypePtr());
3292 static CachedProperties
get(
const Type *T) {
3294 return CachedProperties(T->TypeBits.getLinkage(),
3295 T->TypeBits.hasLocalOrUnnamedType());
3300 if (T->
TypeBits.isCacheValid())
return;
3316 T->
TypeBits.CachedLinkage = Result.getLinkage();
3317 T->
TypeBits.CachedLocalOrUnnamed = Result.hasLocalOrUnnamedType();
3325 namespace {
class Private {}; }
3330 #define TYPE(Class,Base)
3331 #define NON_CANONICAL_TYPE(Class,Base) case Type::Class:
3332 #include "clang/AST/TypeNodes.def"
3333 llvm_unreachable(
"didn't expect a non-canonical type here");
3335 #define TYPE(Class,Base)
3336 #define DEPENDENT_TYPE(Class,Base) case Type::Class:
3337 #define NON_CANONICAL_UNLESS_DEPENDENT_TYPE(Class,Base) case Type::Class:
3338 #include "clang/AST/TypeNodes.def"
3344 case Type::DeducedTemplateSpecialization:
3357 const TagDecl *Tag = cast<TagType>(T)->getDecl();
3364 bool IsLocalOrUnnamed =
3367 return CachedProperties(L, IsLocalOrUnnamed);
3374 return Cache::get(cast<ComplexType>(T)->getElementType());
3376 return Cache::get(cast<PointerType>(T)->getPointeeType());
3377 case Type::BlockPointer:
3378 return Cache::get(cast<BlockPointerType>(T)->getPointeeType());
3379 case Type::LValueReference:
3380 case Type::RValueReference:
3381 return Cache::get(cast<ReferenceType>(T)->getPointeeType());
3382 case Type::MemberPointer: {
3384 return merge(Cache::get(MPT->
getClass()),
3387 case Type::ConstantArray:
3388 case Type::IncompleteArray:
3389 case Type::VariableArray:
3390 return Cache::get(cast<ArrayType>(T)->getElementType());
3392 case Type::ExtVector:
3393 return Cache::get(cast<VectorType>(T)->getElementType());
3394 case Type::FunctionNoProto:
3395 return Cache::get(cast<FunctionType>(T)->getReturnType());
3396 case Type::FunctionProto: {
3400 result = merge(result, Cache::get(ai));
3403 case Type::ObjCInterface: {
3404 Linkage L = cast<ObjCInterfaceType>(T)->getDecl()->getLinkageInternal();
3405 return CachedProperties(L,
false);
3407 case Type::ObjCObject:
3408 return Cache::get(cast<ObjCObjectType>(T)->getBaseType());
3409 case Type::ObjCObjectPointer:
3410 return Cache::get(cast<ObjCObjectPointerType>(T)->getPointeeType());
3412 return Cache::get(cast<AtomicType>(T)->getValueType());
3414 return Cache::get(cast<PipeType>(T)->getElementType());
3417 llvm_unreachable(
"unhandled type class");
3422 Cache::ensure(
this);
3427 Cache::ensure(
this);
3428 return TypeBits.hasLocalOrUnnamedType();
3435 #define TYPE(Class,Base)
3436 #define NON_CANONICAL_TYPE(Class,Base) case Type::Class:
3437 #include "clang/AST/TypeNodes.def"
3438 llvm_unreachable(
"didn't expect a non-canonical type here");
3440 #define TYPE(Class,Base)
3441 #define DEPENDENT_TYPE(Class,Base) case Type::Class:
3442 #define NON_CANONICAL_UNLESS_DEPENDENT_TYPE(Class,Base) case Type::Class:
3443 #include "clang/AST/TypeNodes.def"
3452 case Type::DeducedTemplateSpecialization:
3457 return cast<TagType>(T)->getDecl()->getLinkageAndVisibility();
3463 case Type::BlockPointer:
3465 case Type::LValueReference:
3466 case Type::RValueReference:
3468 case Type::MemberPointer: {
3474 case Type::ConstantArray:
3475 case Type::IncompleteArray:
3476 case Type::VariableArray:
3479 case Type::ExtVector:
3481 case Type::FunctionNoProto:
3483 case Type::FunctionProto: {
3490 case Type::ObjCInterface:
3491 return cast<ObjCInterfaceType>(T)->getDecl()->getLinkageAndVisibility();
3492 case Type::ObjCObject:
3494 case Type::ObjCObjectPointer:
3502 llvm_unreachable(
"unhandled type class");
3531 if (
auto attributed = dyn_cast<AttributedType>(type.
getTypePtr())) {
3532 if (
auto nullability = attributed->getImmediateNullability())
3550 #define NON_CANONICAL_TYPE(Class, Parent) \
3552 llvm_unreachable("non-canonical type");
3553 #define TYPE(Class, Parent)
3554 #include "clang/AST/TypeNodes.def"
3558 case Type::BlockPointer:
3559 case Type::MemberPointer:
3560 case Type::ObjCObjectPointer:
3564 case Type::UnresolvedUsing:
3565 case Type::TypeOfExpr:
3567 case Type::Decltype:
3568 case Type::UnaryTransform:
3569 case Type::TemplateTypeParm:
3570 case Type::SubstTemplateTypeParmPack:
3571 case Type::DependentName:
3572 case Type::DependentTemplateSpecialization:
3574 return ResultIfUnknown;
3579 case Type::TemplateSpecialization:
3581 = cast<TemplateSpecializationType>(type.
getTypePtr())
3582 ->getTemplateName().getAsTemplateDecl()) {
3583 if (isa<ClassTemplateDecl>(templateDecl))
3586 return ResultIfUnknown;
3591 #define SIGNED_TYPE(Id, SingletonId) case BuiltinType::Id:
3592 #define UNSIGNED_TYPE(Id, SingletonId) case BuiltinType::Id:
3593 #define FLOATING_TYPE(Id, SingletonId) case BuiltinType::Id:
3594 #define BUILTIN_TYPE(Id, SingletonId)
3595 #include "clang/AST/BuiltinTypes.def"
3599 case BuiltinType::Dependent:
3600 case BuiltinType::Overload:
3601 case BuiltinType::BoundMember:
3602 case BuiltinType::PseudoObject:
3603 case BuiltinType::UnknownAny:
3604 case BuiltinType::ARCUnbridgedCast:
3605 return ResultIfUnknown;
3607 case BuiltinType::Void:
3608 case BuiltinType::ObjCId:
3609 case BuiltinType::ObjCClass:
3610 case BuiltinType::ObjCSel:
3611 #define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \
3612 case BuiltinType::Id:
3613 #include "clang/Basic/OpenCLImageTypes.def"
3614 case BuiltinType::OCLSampler:
3615 case BuiltinType::OCLEvent:
3616 case BuiltinType::OCLClkEvent:
3617 case BuiltinType::OCLQueue:
3618 case BuiltinType::OCLReserveID:
3619 case BuiltinType::BuiltinFn:
3620 case BuiltinType::NullPtr:
3621 case BuiltinType::OMPArraySection:
3624 llvm_unreachable(
"unknown builtin type");
3628 case Type::LValueReference:
3629 case Type::RValueReference:
3630 case Type::ConstantArray:
3631 case Type::IncompleteArray:
3632 case Type::VariableArray:
3633 case Type::DependentSizedArray:
3634 case Type::DependentSizedExtVector:
3636 case Type::ExtVector:
3637 case Type::FunctionProto:
3638 case Type::FunctionNoProto:
3640 case Type::DeducedTemplateSpecialization:
3642 case Type::InjectedClassName:
3643 case Type::PackExpansion:
3644 case Type::ObjCObject:
3645 case Type::ObjCInterface:
3650 llvm_unreachable(
"bad type kind!");
3664 if (
auto attributed = dyn_cast<AttributedType>(T.
getTypePtr())) {
3665 if (
auto nullability = attributed->getImmediateNullability()) {
3666 T = attributed->getModifiedType();
3715 "cannot query implicit lifetime for non-inferrable type");
3720 while (
const ArrayType *array = dyn_cast<ArrayType>(canon))
3721 canon = array->getElementType().getTypePtr();
3724 = dyn_cast<ObjCObjectPointerType>(canon)) {
3726 if (opt->getObjectType()->isObjCClass())
3734 const Type *cur =
this;
3736 if (
const TypedefType *typedefType = dyn_cast<TypedefType>(cur))
3737 return typedefType->getDecl()->hasAttr<ObjCNSObjectAttr>();
3741 if (next.getTypePtr() == cur)
return false;
3742 cur = next.getTypePtr();
3747 if (
const TypedefType *typedefType = dyn_cast<TypedefType>(
this))
3748 return typedefType->getDecl()->hasAttr<ObjCIndependentClassAttr>();
3759 if (
const PointerType *OPT = getAs<PointerType>())
3760 return OPT->getPointeeType()->isObjCIndirectLifetimeType();
3762 return Ref->getPointeeType()->isObjCIndirectLifetimeType();
3764 return MemPtr->getPointeeType()->isObjCIndirectLifetimeType();
3771 const Type *type =
this;
3773 type = array->getElementType().getTypePtr();
3785 const PointerType *Pointer = getAs<PointerType>();
3796 if (
const PointerType *ptr = getAs<PointerType>())
3797 return ptr->getPointeeType()->hasSizedVLAType();
3799 return ref->getPointeeType()->hasSizedVLAType();
3801 if (isa<VariableArrayType>(arr) &&
3802 cast<VariableArrayType>(arr)->getSizeExpr())
3805 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.
void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Ctx)
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)
PointerType - C99 6.7.5.1 - Pointer Declarators.
A (possibly-)qualified type.
bool isPODType(const ASTContext &Context) const
Determine whether this is a Plain Old Data (POD) type (C++ 3.9p10).
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)
Stmt - This represents one statement.
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.
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 hasAutoForTrailingReturnType() const
Determine whether this type was written with a leading 'auto' corresponding to a trailing return 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 hasInstantiationDependentExceptionSpec() const
Return whether this function has an instantiation-dependent exception spec.
ArrayRef< TemplateArgument > pack_elements() const
Iterator range referencing all of the elements of a template argument pack.
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)
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...
static ElaboratedTypeKeyword getKeywordForTagTypeKind(TagTypeKind Tag)
Converts a TagTypeKind into an elaborated type keyword.
QualType getPointeeType() const
The base class of the type hierarchy.
bool isElaboratedTypeSpecifier() const
Determine wither this type is a C++ elaborated-type-specifier.
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
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
Describes how types, statements, expressions, and declarations should be printed. ...
bool canHaveNullability(bool ResultIfUnknown=true) const
Determine whether the given type can have a nullability specifier applied to it, i.e., if it is any kind of pointer type.
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...
unsigned getNumArgs() const
Retrieve the number of template arguments.
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
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...
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...
Represents a class type in Objective C.
qual_iterator qual_begin() const
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.
static bool anyDependentTemplateArguments(ArrayRef< TemplateArgumentLoc > Args, bool &InstantiationDependent)
Determine whether any of the given template arguments are dependent.
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.
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...
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.
static unsigned getNumAddressingBits(const ASTContext &Context, QualType ElementType, const llvm::APInt &NumElements)
Determine the number of bits required to address a member of.
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.
bool isTrivialType(const ASTContext &Context) const
Return true if this is a trivial type per (C++0x [basic.types]p9)
Represents an ObjC class declaration.
detail::InMemoryDirectory::const_iterator I
QualType getCanonicalTypeInternal() const
bool isTriviallyCopyableType(const ASTContext &Context) const
Return true if this is a trivially copyable type (C++0x [basic.types]p9)
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.
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.
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...
bool isNonWeakInMRRWithObjCWeak(const ASTContext &Context) const
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
QualType getNamedType() const
Retrieve the type named by the qualified-id.
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.
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 hasTrailingReturn() const
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].
Common base class for placeholders for types that get replaced by placeholder type deduction: C++11 a...
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.
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'...
CXXRecordDecl * getMostRecentCXXRecordDecl() const
A template template parameter pack that has been substituted for a template template argument pack...
CanThrowResult
Possible results from evaluation of a noexcept expression.
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...
QualType getAtomicUnqualifiedType() const
Remove all qualifiers including _Atomic.
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?
bool isConstant(const ASTContext &Ctx) const
Interfaces are the core concept in Objective-C for object oriented design.
bool isComplexType() const
isComplexType() does not include complex integers (a GCC extension).
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
void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Context, bool Canonical) const
Produce a unique representation of the given statement.
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>.
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 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 isIntegralType(const ASTContext &Ctx) const
Determine whether this type is an integral type.
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...
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
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.
CanThrowResult canThrow(const ASTContext &Ctx) const
Determine whether this function type has a non-throwing exception specification.
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.
static TagTypeKind getTagTypeKindForKeyword(ElaboratedTypeKeyword Keyword)
Converts an elaborated type keyword into a TagTypeKind.
void setVariablyModified(bool VM=true)
ObjCTypeParamDecl * getDecl() const
TypeOfExprType(Expr *E, QualType can=QualType())
DeducedType * getContainedDeducedType() const
Get the DeducedType whose type will be deduced for a variable with an initializer of this type...
Represents a pointer type decayed from an array or function type.
QualType getPointeeType() const
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
static unsigned getMaxSizeBits(const ASTContext &Context)
Determine the maximum number of active bits that an array's size can require, which limits the maximu...
Linkage minLinkage(Linkage L1, Linkage L2)
Compute the minimum linkage given two linkages.
bool isStdByteType() const
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...
TagTypeKind
The kind of a tag type.
CanQualType ObjCBuiltinIdTy
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.).
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)
Represents the declaration of an Objective-C type parameter.
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)
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.
unsigned getNumProtocols() const
Return the number of qualifying protocols in this type, or 0 if there are none.
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.
Location wrapper for a TemplateArgument.
llvm::Optional< NullabilityKind > getImmediateNullability() const
bool isObjCNSObjectType() const
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
QualType getFunctionType(QualType ResultTy, ArrayRef< QualType > Args, const FunctionProtoType::ExtProtoInfo &EPI) const
Return a normal function type with a typed argument list.
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.
llvm::ArrayRef< TemplateArgumentLoc > arguments() const
char __ovld __cnfn max(char x, char y)
Returns y if x < y, otherwise it returns x.
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.
bool hasNonTrivialObjCLifetime() const
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.
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.
Represents a template specialization type whose template cannot be resolved, e.g. ...
bool isObjCObjectPointerType() const
Represents a C array with an unspecified size.
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 applyObjCProtocolQualifiers(QualType type, ArrayRef< ObjCProtocolDecl * > protocols, bool &hasError, bool allowOnPointerType=false) const
Apply Objective-C protocol qualifiers to the given type.
void initialize(ArrayRef< ObjCProtocolDecl * > protocols)
Represents a type template specialization; the template must be a class template, a type alias templa...
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.
void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Context)
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.
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
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