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) &&
60 getElementType().getBaseTypeIdentifier();
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))
203 ->getElementType().getTypePtr();
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(),
1278 if (
auto AT =
getTypePtr()->getAs<AtomicType>())
1279 return AT->getValueType().getUnqualifiedType();
1286 if (
auto method = dyn_cast<ObjCMethodDecl>(dc))
1287 dc = method->getDeclContext();
1304 if (!dcCategoryDecl)
1309 dcTypeParams = dcCategoryDecl->getTypeParamList();
1313 dcClassDecl = dcCategoryDecl->getClassInterface();
1317 assert(dcTypeParams &&
"No substitutions to perform");
1318 assert(dcClassDecl &&
"No class context");
1322 if (
const auto *objectPointerType = getAs<ObjCObjectPointerType>()) {
1323 objectType = objectPointerType->getObjectType();
1324 }
else if (getAs<BlockPointerType>()) {
1327 ->castAs<ObjCObjectType>();;
1329 objectType = getAs<ObjCObjectType>();
1335 if (!curClassDecl) {
1343 while (curClassDecl != dcClassDecl) {
1345 QualType superType = objectType->getSuperClassType();
1346 if (superType.
isNull()) {
1347 objectType =
nullptr;
1357 if (!objectType || objectType->isUnspecialized()) {
1362 return objectType->getTypeArgs();
1365 bool Type::acceptsObjCTypeParams()
const {
1367 if (
auto *
ID = IfaceT->getInterface()) {
1368 if (
ID->getTypeParamList())
1382 CachedSuperClassType.setInt(
true);
1388 if (!superClassObjTy) {
1389 CachedSuperClassType.setInt(
true);
1394 if (!superClassDecl) {
1395 CachedSuperClassType.setInt(
true);
1401 QualType superClassType(superClassObjTy, 0);
1403 if (!superClassTypeParams) {
1404 CachedSuperClassType.setPointerAndInt(
1411 CachedSuperClassType.setPointerAndInt(superClassObjTy,
true);
1419 CachedSuperClassType.setPointerAndInt(
1428 = classDecl->getASTContext().getObjCInterfaceType(
1430 CachedSuperClassType.setPointerAndInt(
1438 assert(typeArgs.size() == typeParams->
size());
1439 CachedSuperClassType.setPointerAndInt(
1442 ->castAs<ObjCObjectType>(),
1448 return interfaceDecl->getASTContext().getObjCInterfaceType(interfaceDecl)
1457 if (superObjectType.
isNull())
1458 return superObjectType;
1469 if (T->getNumProtocols() && T->getInterface())
1482 if (OPT->isObjCQualifiedIdType())
1492 if (OPT->isObjCQualifiedClassType())
1500 if (OT->getInterface())
1507 if (OPT->getInterfaceType())
1529 return dyn_cast_or_null<CXXRecordDecl>(
getAsTagDecl());
1533 if (
const auto *TT = getAs<TagType>())
1534 return cast<TagDecl>(TT->getDecl());
1535 if (
const auto *Injected = getAs<InjectedClassNameType>())
1536 return Injected->getDecl();
1542 class GetContainedAutoVisitor :
1543 public TypeVisitor<GetContainedAutoVisitor, AutoType*> {
1573 AutoType *VisitDependentSizedExtVectorType(
1596 return GetContainedAutoVisitor().Visit(
this);
1600 if (
const VectorType *VT = dyn_cast<VectorType>(CanonicalType))
1601 return VT->getElementType()->isIntegerType();
1626 if (
const BuiltinType *BT = dyn_cast<BuiltinType>(CanonicalType))
1627 return BT->getKind() >= BuiltinType::Bool &&
1628 BT->getKind() <= BuiltinType::Int128;
1632 if (
const EnumType *ET = dyn_cast<EnumType>(CanonicalType))
1633 return ET->getDecl()->isComplete();
1640 if (
const BuiltinType *BT = dyn_cast<BuiltinType>(CanonicalType))
1641 return BT->getKind() >= BuiltinType::Bool &&
1642 BT->getKind() <= BuiltinType::Int128;
1648 if (
const EnumType *ET = dyn_cast<EnumType>(CanonicalType))
1649 return ET->getDecl()->isComplete() && !ET->getDecl()->isScoped();
1657 if (
const BuiltinType *BT = dyn_cast<BuiltinType>(CanonicalType))
1658 return BT->getKind() == BuiltinType::Char_U ||
1659 BT->getKind() == BuiltinType::UChar ||
1660 BT->getKind() == BuiltinType::Char_S ||
1661 BT->getKind() == BuiltinType::SChar;
1666 if (
const BuiltinType *BT = dyn_cast<BuiltinType>(CanonicalType))
1667 return BT->getKind() == BuiltinType::WChar_S ||
1668 BT->getKind() == BuiltinType::WChar_U;
1673 if (
const BuiltinType *BT = dyn_cast<BuiltinType>(CanonicalType))
1674 return BT->getKind() == BuiltinType::Char16;
1679 if (
const BuiltinType *BT = dyn_cast<BuiltinType>(CanonicalType))
1680 return BT->getKind() == BuiltinType::Char32;
1688 if (!BT)
return false;
1690 default:
return false;
1691 case BuiltinType::Char_U:
1692 case BuiltinType::UChar:
1693 case BuiltinType::WChar_U:
1694 case BuiltinType::Char16:
1695 case BuiltinType::Char32:
1696 case BuiltinType::Char_S:
1697 case BuiltinType::SChar:
1698 case BuiltinType::WChar_S:
1707 if (
const BuiltinType *BT = dyn_cast<BuiltinType>(CanonicalType)) {
1708 return BT->getKind() >= BuiltinType::Char_S &&
1709 BT->getKind() <= BuiltinType::Int128;
1712 if (
const EnumType *ET = dyn_cast<EnumType>(CanonicalType)) {
1715 if (ET->getDecl()->isComplete() && !ET->getDecl()->isScoped())
1716 return ET->getDecl()->getIntegerType()->isSignedIntegerType();
1723 if (
const BuiltinType *BT = dyn_cast<BuiltinType>(CanonicalType)) {
1724 return BT->getKind() >= BuiltinType::Char_S &&
1725 BT->getKind() <= BuiltinType::Int128;
1728 if (
const EnumType *ET = dyn_cast<EnumType>(CanonicalType)) {
1729 if (ET->getDecl()->isComplete())
1730 return ET->getDecl()->getIntegerType()->isSignedIntegerType();
1737 if (
const VectorType *VT = dyn_cast<VectorType>(CanonicalType))
1738 return VT->getElementType()->isSignedIntegerOrEnumerationType();
1747 if (
const BuiltinType *BT = dyn_cast<BuiltinType>(CanonicalType)) {
1748 return BT->getKind() >= BuiltinType::Bool &&
1749 BT->getKind() <= BuiltinType::UInt128;
1752 if (
const EnumType *ET = dyn_cast<EnumType>(CanonicalType)) {
1755 if (ET->getDecl()->isComplete() && !ET->getDecl()->isScoped())
1756 return ET->getDecl()->getIntegerType()->isUnsignedIntegerType();
1763 if (
const BuiltinType *BT = dyn_cast<BuiltinType>(CanonicalType)) {
1764 return BT->getKind() >= BuiltinType::Bool &&
1765 BT->getKind() <= BuiltinType::UInt128;
1768 if (
const EnumType *ET = dyn_cast<EnumType>(CanonicalType)) {
1769 if (ET->getDecl()->isComplete())
1770 return ET->getDecl()->getIntegerType()->isUnsignedIntegerType();
1777 if (
const VectorType *VT = dyn_cast<VectorType>(CanonicalType))
1778 return VT->getElementType()->isUnsignedIntegerOrEnumerationType();
1784 if (
const BuiltinType *BT = dyn_cast<BuiltinType>(CanonicalType))
1785 return BT->getKind() >= BuiltinType::Half &&
1786 BT->getKind() <= BuiltinType::Float128;
1787 if (
const ComplexType *CT = dyn_cast<ComplexType>(CanonicalType))
1788 return CT->getElementType()->isFloatingType();
1793 if (
const VectorType *VT = dyn_cast<VectorType>(CanonicalType))
1794 return VT->getElementType()->isFloatingType();
1800 if (
const BuiltinType *BT = dyn_cast<BuiltinType>(CanonicalType))
1801 return BT->isFloatingPoint();
1806 if (
const BuiltinType *BT = dyn_cast<BuiltinType>(CanonicalType))
1807 return BT->getKind() >= BuiltinType::Bool &&
1808 BT->getKind() <= BuiltinType::Float128;
1809 if (
const EnumType *ET = dyn_cast<EnumType>(CanonicalType))
1810 return ET->getDecl()->isComplete() && !ET->getDecl()->isScoped();
1815 if (
const BuiltinType *BT = dyn_cast<BuiltinType>(CanonicalType))
1816 return BT->getKind() >= BuiltinType::Bool &&
1817 BT->getKind() <= BuiltinType::Float128;
1818 if (
const EnumType *ET = dyn_cast<EnumType>(CanonicalType))
1825 return !ET->getDecl()->isScoped() && ET->getDecl()->isComplete();
1826 return isa<ComplexType>(CanonicalType);
1832 const Type *T = CanonicalType.getTypePtr();
1833 if (
const BuiltinType *BT = dyn_cast<BuiltinType>(T)) {
1834 if (BT->getKind() == BuiltinType::Bool)
return STK_Bool;
1835 if (BT->getKind() == BuiltinType::NullPtr)
return STK_CPointer;
1838 llvm_unreachable(
"unknown scalar builtin type");
1839 }
else if (isa<PointerType>(T)) {
1841 }
else if (isa<BlockPointerType>(T)) {
1843 }
else if (isa<ObjCObjectPointerType>(T)) {
1845 }
else if (isa<MemberPointerType>(T)) {
1847 }
else if (isa<EnumType>(T)) {
1848 assert(cast<EnumType>(T)->getDecl()->isComplete());
1850 }
else if (
const ComplexType *CT = dyn_cast<ComplexType>(T)) {
1851 if (CT->getElementType()->isRealFloatingType())
1856 llvm_unreachable(
"unknown scalar type");
1869 if (
const RecordType *Record = dyn_cast<RecordType>(CanonicalType)) {
1870 if (
CXXRecordDecl *ClassDecl = dyn_cast<CXXRecordDecl>(Record->getDecl()))
1871 return ClassDecl->isAggregate();
1876 return isa<ArrayType>(CanonicalType);
1883 assert(!
isIncompleteType() &&
"This doesn't make sense for incomplete types");
1884 assert(!
isDependentType() &&
"This doesn't make sense for dependent types");
1886 return !isa<VariableArrayType>(CanonicalType);
1896 switch (CanonicalType->getTypeClass()) {
1897 default:
return false;
1903 EnumDecl *EnumD = cast<EnumType>(CanonicalType)->getDecl();
1916 RecordDecl *Rec = cast<RecordType>(CanonicalType)->getDecl();
1926 return cast<ArrayType>(CanonicalType)->getElementType()
1927 ->isIncompleteType(Def);
1928 case IncompleteArray:
1931 case MemberPointer: {
1935 auto *MPTy = cast<MemberPointerType>(CanonicalType);
1936 const Type *ClassTy = MPTy->getClass();
1938 if (ClassTy->isDependentType())
1949 if (RD->hasAttr<MSInheritanceAttr>())
1954 return cast<ObjCObjectType>(CanonicalType)->getBaseType()
1955 ->isIncompleteType(Def);
1956 case ObjCInterface: {
1959 = cast<ObjCInterfaceType>(CanonicalType)->getDecl();
1982 if ((*this)->isIncompleteArrayType())
1985 if ((*this)->isIncompleteType())
2006 default:
return false;
2007 case Type::VariableArray:
2008 case Type::ConstantArray:
2012 case Type::ObjCObjectPointer:
2013 case Type::BlockPointer:
2017 case Type::MemberPointer:
2019 case Type::ExtVector:
2027 = dyn_cast<CXXRecordDecl>(cast<RecordType>(CanonicalType)->getDecl()))
2028 return ClassDecl->isPOD();
2042 if ((*this)->isArrayType())
2047 if ((*this)->isIncompleteType())
2061 if ((*this)->isObjCLifetimeType())
2081 dyn_cast<CXXRecordDecl>(RT->getDecl())) {
2086 return ClassDecl->hasDefaultConstructor() &&
2087 !ClassDecl->hasNonTrivialDefaultConstructor() &&
2088 ClassDecl->isTriviallyCopyable();
2099 if ((*this)->isArrayType())
2113 if ((*this)->isObjCLifetimeType())
2142 dyn_cast<CXXRecordDecl>(RT->getDecl())) {
2143 if (!ClassDecl->isTriviallyCopyable())
return false;
2172 assert(BaseTy &&
"NULL element type");
2203 dyn_cast<CXXRecordDecl>(RT->getDecl()))
2204 return ClassDecl->isLiteral();
2211 return AT->getValueType()->isLiteralType(Ctx);
2230 assert(BaseTy &&
"NULL element type");
2241 dyn_cast<CXXRecordDecl>(RT->getDecl()))
2242 if (!ClassDecl->isStandardLayout())
2282 assert(BaseTy &&
"NULL element type");
2293 dyn_cast<CXXRecordDecl>(RT->getDecl())) {
2296 if (!ClassDecl->isTrivial())
return false;
2301 if (!ClassDecl->isStandardLayout())
return false;
2322 switch (BT->getKind()) {
2323 case BuiltinType::Bool:
2324 case BuiltinType::Char_S:
2325 case BuiltinType::Char_U:
2326 case BuiltinType::SChar:
2327 case BuiltinType::UChar:
2328 case BuiltinType::Short:
2329 case BuiltinType::UShort:
2330 case BuiltinType::WChar_S:
2331 case BuiltinType::WChar_U:
2332 case BuiltinType::Char16:
2333 case BuiltinType::Char32:
2341 if (
const EnumType *ET = getAs<EnumType>()){
2342 if (this->
isDependentType() || ET->getDecl()->getPromotionType().isNull()
2343 || ET->getDecl()->isScoped())
2362 case TemplateTypeParm:
2363 case SubstTemplateTypeParm:
2364 case TemplateSpecialization:
2367 case DependentTemplateSpecialization:
2370 case ObjCObjectPointer:
2400 llvm_unreachable(
"Type specifier is not a tag type kind.");
2412 llvm_unreachable(
"Unknown tag type kind.");
2425 llvm_unreachable(
"Elaborated type keyword is not a tag type kind.");
2427 llvm_unreachable(
"Unknown elaborated type keyword.");
2443 llvm_unreachable(
"Unknown elaborated type keyword.");
2457 llvm_unreachable(
"Unknown elaborated type keyword.");
2467 NNS && NNS->containsUnexpandedParameterPack()),
2468 NNS(NNS), Name(Name),
NumArgs(Args.size()) {
2470 "DependentTemplateSpecializatonType requires dependent qualifier");
2473 if (Arg.containsUnexpandedParameterPack())
2486 ArrayRef<TemplateArgument> Args) {
2487 ID.AddInteger(Keyword);
2488 ID.AddPointer(Qualifier);
2489 ID.AddPointer(Name);
2491 Arg.Profile(ID, Context);
2497 Keyword = Elab->getKeyword();
2499 Keyword = DepName->getKeyword();
2501 dyn_cast<DependentTemplateSpecializationType>(
this))
2502 Keyword = DepTST->getKeyword();
2511 #define ABSTRACT_TYPE(Derived, Base)
2512 #define TYPE(Derived, Base) case Derived: return #Derived;
2513 #include "clang/AST/TypeNodes.def"
2516 llvm_unreachable(
"Invalid type class.");
2524 return Policy.
Bool ?
"bool" :
"_Bool";
2530 return "signed char";
2542 return "unsigned char";
2544 return "unsigned short";
2546 return "unsigned int";
2548 return "unsigned long";
2550 return "unsigned long long";
2552 return "unsigned __int128";
2554 return Policy.
Half ?
"half" :
"__fp16";
2560 return "long double";
2562 return "__float128";
2565 return Policy.
MSWChar ?
"__wchar_t" :
"wchar_t";
2573 return "<overloaded function type>";
2575 return "<bound member function type>";
2577 return "<pseudo-object type>";
2579 return "<dependent type>";
2581 return "<unknown type>";
2582 case ARCUnbridgedCast:
2583 return "<ARC unbridged cast type>";
2585 return "<builtin fn type>";
2592 #define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \
2594 return "__" #Access " " #ImgType "_t";
2595 #include "clang/Basic/OpenCLImageTypes.def"
2601 return "clk_event_t";
2607 return "reserve_id_t";
2608 case OMPArraySection:
2609 return "<OpenMP array section type>";
2612 llvm_unreachable(
"Invalid builtin type.");
2633 case CC_C:
return "cdecl";
2651 llvm_unreachable(
"Invalid calling convention.");
2656 const ExtProtoInfo &epi)
2658 result->isDependentType(),
2659 result->isInstantiationDependentType(),
2660 result->isVariablyModifiedType(),
2661 result->containsUnexpandedParameterPack(), epi.
ExtInfo),
2662 NumParams(params.size()),
2663 NumExceptions(epi.ExceptionSpec.Exceptions.size()),
2664 ExceptionSpecType(epi.ExceptionSpec.
Type),
2665 HasExtParameterInfos(epi.ExtParameterInfos != nullptr),
2666 Variadic(epi.Variadic), HasTrailingReturn(epi.HasTrailingReturn) {
2667 assert(NumParams == params.size() &&
"function has too many parameters");
2674 for (
unsigned i = 0; i != NumParams; ++i) {
2683 argSlot[i] = params[i];
2688 QualType *exnSlot = argSlot + NumParams;
2690 for (
QualType ExceptionType : epi.ExceptionSpec.Exceptions) {
2699 exnSlot[I++] = ExceptionType;
2703 Expr **noexSlot =
reinterpret_cast<Expr **
>(argSlot + NumParams);
2704 *noexSlot = epi.ExceptionSpec.NoexceptExpr;
2706 if (epi.ExceptionSpec.NoexceptExpr) {
2707 if (epi.ExceptionSpec.NoexceptExpr->isValueDependent() ||
2708 epi.ExceptionSpec.NoexceptExpr->isInstantiationDependent())
2711 if (epi.ExceptionSpec.NoexceptExpr->containsUnexpandedParameterPack())
2718 reinterpret_cast<FunctionDecl **
>(argSlot + NumParams);
2719 slot[0] = epi.ExceptionSpec.SourceDecl;
2720 slot[1] = epi.ExceptionSpec.SourceTemplate;
2727 reinterpret_cast<FunctionDecl **
>(argSlot + NumParams);
2728 slot[0] = epi.ExceptionSpec.SourceDecl;
2731 if (epi.ExtParameterInfos) {
2732 ExtParameterInfo *extParamInfos =
2733 const_cast<ExtParameterInfo *
>(getExtParameterInfosBuffer());
2734 for (
unsigned i = 0; i != NumParams; ++i)
2735 extParamInfos[i] = epi.ExtParameterInfos[i];
2741 return NE->isValueDependent();
2770 assert(isICE &&
"AST should not contain bad noexcept expressions.");
2776 bool ResultIfDependent)
const {
2785 for (
unsigned I = 0, N = NumExceptions; I != N; ++
I)
2788 return ResultIfDependent;
2796 return ResultIfDependent;
2801 for (
unsigned ArgIdx =
getNumParams(); ArgIdx; --ArgIdx)
2809 const QualType *ArgTys,
unsigned NumParams,
2810 const ExtProtoInfo &epi,
2831 for (
unsigned i = 0; i != NumParams; ++i)
2836 assert(!(
unsigned(epi.Variadic) & ~1) &&
2837 !(
unsigned(epi.TypeQuals) & ~255) &&
2838 !(
unsigned(epi.RefQualifier) & ~3) &&
2839 !(
unsigned(epi.ExceptionSpec.Type) & ~15) &&
2840 "Values larger than expected.");
2841 ID.AddInteger(
unsigned(epi.Variadic) +
2842 (epi.TypeQuals << 1) +
2843 (epi.RefQualifier << 9) +
2844 (epi.ExceptionSpec.Type << 11));
2846 for (
QualType Ex : epi.ExceptionSpec.Exceptions)
2849 epi.ExceptionSpec.NoexceptExpr) {
2850 epi.ExceptionSpec.NoexceptExpr->Profile(ID, Context,
false);
2853 ID.AddPointer(epi.ExceptionSpec.SourceDecl->getCanonicalDecl());
2855 if (epi.ExtParameterInfos) {
2856 for (
unsigned i = 0; i != NumParams; ++i)
2857 ID.AddInteger(epi.ExtParameterInfos[i].getOpaqueValue());
2859 epi.ExtInfo.Profile(ID);
2860 ID.AddBoolean(epi.HasTrailingReturn);
2874 :
Type(TypeOfExpr, can, E->isTypeDependent(),
2875 E->isInstantiationDependent(),
2876 E->getType()->isVariablyModifiedType(),
2877 E->containsUnexpandedParameterPack()),
2894 E->Profile(ID, Context,
true);
2901 :
Type(Decltype, can, E->isInstantiationDependent(),
2902 E->isInstantiationDependent(),
2903 E->getType()->isVariablyModifiedType(),
2904 E->containsUnexpandedParameterPack()),
2906 UnderlyingType(underlyingType) {
2919 :
DecltypeType(E, Context.DependentTy), Context(Context) { }
2923 E->Profile(ID, Context,
true);
2930 :
Type(UnaryTransform, CanonicalType, BaseType->isDependentType(),
2931 BaseType->isInstantiationDependentType(),
2932 BaseType->isVariablyModifiedType(),
2933 BaseType->containsUnexpandedParameterPack())
2934 , BaseType(BaseType), UnderlyingType(UnderlyingType), UKind(UKind)
2945 :
Type(TC, can, D->isDependentType(),
2946 D->isDependentType(),
2952 for (
auto I : decl->
redecls()) {
2953 if (I->isCompleteDefinition() || I->isBeingDefined())
3010 llvm_unreachable(
"bad attributed type kind");
3015 default:
return false;
3022 llvm_unreachable(
"invalid attr kind");
3062 llvm_unreachable(
"invalid attr kind");
3073 SubstTemplateTypeParmPackType::
3079 Arguments(ArgPack.pack_begin()), NumArguments(ArgPack.pack_size())
3094 ID.AddPointer(Replaced);
3097 ID.AddPointer(
P.getAsType().getAsOpaquePtr());
3102 bool &InstantiationDependent) {
3104 InstantiationDependent);
3109 bool &InstantiationDependent) {
3111 if (ArgLoc.getArgument().isDependent()) {
3112 InstantiationDependent =
true;
3116 if (ArgLoc.getArgument().isInstantiationDependent())
3117 InstantiationDependent =
true;
3124 ArrayRef<TemplateArgument> Args,
3127 Canon.isNull()?
QualType(this, 0) : Canon,
3128 Canon.isNull()?
true : Canon->isDependentType(),
3129 Canon.isNull()?
true : Canon->isInstantiationDependentType(),
3131 T.containsUnexpandedParameterPack()),
3134 "Use DependentTemplateSpecializationType for dependent template-name");
3138 "Unexpected template name for TemplateSpecializationType");
3151 if (Arg.isInstantiationDependent())
3154 Arg.getAsType()->isVariablyModifiedType())
3156 if (Arg.containsUnexpandedParameterPack())
3171 ArrayRef<TemplateArgument> Args,
3175 Arg.Profile(ID, Context);
3200 ID.AddInteger(typeArgs.size());
3201 for (
auto typeArg : typeArgs)
3202 ID.AddPointer(typeArg.getAsOpaquePtr());
3203 ID.AddInteger(protocols.size());
3204 for (
auto proto : protocols)
3205 ID.AddPointer(proto);
3206 ID.AddBoolean(isKindOf);
3218 class CachedProperties {
3223 CachedProperties(
Linkage L,
bool local) : L(L), local(local) {}
3225 Linkage getLinkage()
const {
return L; }
3226 bool hasLocalOrUnnamedType()
const {
return local; }
3228 friend CachedProperties merge(CachedProperties L, CachedProperties R) {
3230 return CachedProperties(MergedLinkage,
3231 L.hasLocalOrUnnamedType() | R.hasLocalOrUnnamedType());
3245 return get(T.getTypePtr());
3248 static CachedProperties
get(
const Type *T) {
3250 return CachedProperties(T->TypeBits.getLinkage(),
3251 T->TypeBits.hasLocalOrUnnamedType());
3256 if (T->
TypeBits.isCacheValid())
return;
3272 T->
TypeBits.CachedLinkage = Result.getLinkage();
3273 T->
TypeBits.CachedLocalOrUnnamed = Result.hasLocalOrUnnamedType();
3281 namespace {
class Private {}; }
3286 #define TYPE(Class,Base)
3287 #define NON_CANONICAL_TYPE(Class,Base) case Type::Class:
3288 #include "clang/AST/TypeNodes.def"
3289 llvm_unreachable(
"didn't expect a non-canonical type here");
3291 #define TYPE(Class,Base)
3292 #define DEPENDENT_TYPE(Class,Base) case Type::Class:
3293 #define NON_CANONICAL_UNLESS_DEPENDENT_TYPE(Class,Base) case Type::Class:
3294 #include "clang/AST/TypeNodes.def"
3312 const TagDecl *Tag = cast<TagType>(T)->getDecl();
3319 bool IsLocalOrUnnamed =
3322 return CachedProperties(L, IsLocalOrUnnamed);
3329 return Cache::get(cast<ComplexType>(T)->getElementType());
3331 return Cache::get(cast<PointerType>(T)->getPointeeType());
3332 case Type::BlockPointer:
3333 return Cache::get(cast<BlockPointerType>(T)->getPointeeType());
3334 case Type::LValueReference:
3335 case Type::RValueReference:
3336 return Cache::get(cast<ReferenceType>(T)->getPointeeType());
3337 case Type::MemberPointer: {
3342 case Type::ConstantArray:
3343 case Type::IncompleteArray:
3344 case Type::VariableArray:
3345 return Cache::get(cast<ArrayType>(T)->getElementType());
3347 case Type::ExtVector:
3348 return Cache::get(cast<VectorType>(T)->getElementType());
3349 case Type::FunctionNoProto:
3350 return Cache::get(cast<FunctionType>(T)->getReturnType());
3351 case Type::FunctionProto: {
3358 case Type::ObjCInterface: {
3359 Linkage L = cast<ObjCInterfaceType>(T)->getDecl()->getLinkageInternal();
3360 return CachedProperties(L,
false);
3362 case Type::ObjCObject:
3363 return Cache::get(cast<ObjCObjectType>(T)->getBaseType());
3364 case Type::ObjCObjectPointer:
3365 return Cache::get(cast<ObjCObjectPointerType>(T)->getPointeeType());
3367 return Cache::get(cast<AtomicType>(T)->getValueType());
3369 return Cache::get(cast<PipeType>(T)->getElementType());
3372 llvm_unreachable(
"unhandled type class");
3383 return TypeBits.hasLocalOrUnnamedType();
3390 #define TYPE(Class,Base)
3391 #define NON_CANONICAL_TYPE(Class,Base) case Type::Class:
3392 #include "clang/AST/TypeNodes.def"
3393 llvm_unreachable(
"didn't expect a non-canonical type here");
3395 #define TYPE(Class,Base)
3396 #define DEPENDENT_TYPE(Class,Base) case Type::Class:
3397 #define NON_CANONICAL_UNLESS_DEPENDENT_TYPE(Class,Base) case Type::Class:
3398 #include "clang/AST/TypeNodes.def"
3411 return cast<TagType>(T)->getDecl()->getLinkageAndVisibility();
3417 case Type::BlockPointer:
3419 case Type::LValueReference:
3420 case Type::RValueReference:
3422 case Type::MemberPointer: {
3428 case Type::ConstantArray:
3429 case Type::IncompleteArray:
3430 case Type::VariableArray:
3433 case Type::ExtVector:
3435 case Type::FunctionNoProto:
3437 case Type::FunctionProto: {
3444 case Type::ObjCInterface:
3445 return cast<ObjCInterfaceType>(T)->getDecl()->getLinkageAndVisibility();
3446 case Type::ObjCObject:
3448 case Type::ObjCObjectPointer:
3456 llvm_unreachable(
"unhandled type class");
3485 if (
auto attributed = dyn_cast<AttributedType>(type.
getTypePtr())) {
3486 if (
auto nullability = attributed->getImmediateNullability())
3504 #define NON_CANONICAL_TYPE(Class, Parent) \
3506 llvm_unreachable("non-canonical type");
3507 #define TYPE(Class, Parent)
3508 #include "clang/AST/TypeNodes.def"
3512 case Type::BlockPointer:
3513 case Type::MemberPointer:
3514 case Type::ObjCObjectPointer:
3518 case Type::UnresolvedUsing:
3519 case Type::TypeOfExpr:
3521 case Type::Decltype:
3522 case Type::UnaryTransform:
3523 case Type::TemplateTypeParm:
3524 case Type::SubstTemplateTypeParmPack:
3525 case Type::DependentName:
3526 case Type::DependentTemplateSpecialization:
3532 case Type::TemplateSpecialization:
3534 = cast<TemplateSpecializationType>(type.
getTypePtr())
3536 if (isa<ClassTemplateDecl>(templateDecl))
3543 return !cast<AutoType>(type.
getTypePtr())->isDeduced();
3548 #define SIGNED_TYPE(Id, SingletonId) case BuiltinType::Id:
3549 #define UNSIGNED_TYPE(Id, SingletonId) case BuiltinType::Id:
3550 #define FLOATING_TYPE(Id, SingletonId) case BuiltinType::Id:
3551 #define BUILTIN_TYPE(Id, SingletonId)
3552 #include "clang/AST/BuiltinTypes.def"
3556 case BuiltinType::Dependent:
3557 case BuiltinType::Overload:
3558 case BuiltinType::BoundMember:
3559 case BuiltinType::PseudoObject:
3560 case BuiltinType::UnknownAny:
3561 case BuiltinType::ARCUnbridgedCast:
3564 case BuiltinType::Void:
3565 case BuiltinType::ObjCId:
3566 case BuiltinType::ObjCClass:
3567 case BuiltinType::ObjCSel:
3568 #define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \
3569 case BuiltinType::Id:
3570 #include "clang/Basic/OpenCLImageTypes.def"
3571 case BuiltinType::OCLSampler:
3572 case BuiltinType::OCLEvent:
3573 case BuiltinType::OCLClkEvent:
3574 case BuiltinType::OCLQueue:
3575 case BuiltinType::OCLNDRange:
3576 case BuiltinType::OCLReserveID:
3577 case BuiltinType::BuiltinFn:
3578 case BuiltinType::NullPtr:
3579 case BuiltinType::OMPArraySection:
3585 case Type::LValueReference:
3586 case Type::RValueReference:
3587 case Type::ConstantArray:
3588 case Type::IncompleteArray:
3589 case Type::VariableArray:
3590 case Type::DependentSizedArray:
3591 case Type::DependentSizedExtVector:
3593 case Type::ExtVector:
3594 case Type::FunctionProto:
3595 case Type::FunctionNoProto:
3598 case Type::InjectedClassName:
3599 case Type::PackExpansion:
3600 case Type::ObjCObject:
3601 case Type::ObjCInterface:
3606 llvm_unreachable(
"bad type kind!");
3620 if (
auto attributed = dyn_cast<AttributedType>(T.
getTypePtr())) {
3621 if (
auto nullability = attributed->getImmediateNullability()) {
3622 T = attributed->getModifiedType();
3671 "cannot query implicit lifetime for non-inferrable type");
3676 while (
const ArrayType *array = dyn_cast<ArrayType>(canon))
3677 canon = array->getElementType().getTypePtr();
3680 = dyn_cast<ObjCObjectPointerType>(canon)) {
3682 if (opt->getObjectType()->isObjCClass())
3690 if (
const TypedefType *typedefType = dyn_cast<TypedefType>(
this))
3691 return typedefType->getDecl()->hasAttr<ObjCNSObjectAttr>();
3695 if (
const TypedefType *typedefType = dyn_cast<TypedefType>(
this))
3696 return typedefType->getDecl()->hasAttr<ObjCIndependentClassAttr>();
3707 if (
const PointerType *OPT = getAs<PointerType>())
3708 return OPT->getPointeeType()->isObjCIndirectLifetimeType();
3710 return Ref->getPointeeType()->isObjCIndirectLifetimeType();
3712 return MemPtr->getPointeeType()->isObjCIndirectLifetimeType();
3719 const Type *type =
this;
3721 type = array->getElementType().getTypePtr();
3733 const PointerType *Pointer = getAs<PointerType>();
3744 if (
const PointerType *ptr = getAs<PointerType>())
3745 return ptr->getPointeeType()->hasSizedVLAType();
3747 return ref->getPointeeType()->hasSizedVLAType();
3749 if (isa<VariableArrayType>(arr) &&
3750 cast<VariableArrayType>(arr)->getSizeExpr())
3753 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.
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)
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
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...
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.
DependentTemplateSpecializationType(ElaboratedTypeKeyword Keyword, NestedNameSpecifier *NNS, const IdentifierInfo *Name, ArrayRef< 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
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. ...
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
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...
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.
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.
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...
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...
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
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 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'...
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...
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.
static bool anyDependentTemplateArguments(ArrayRef< TemplateArgumentLoc > Args, bool &InstantiationDependent)
Determine whether any of the given template arguments are dependent.
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.
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 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...
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.
void setVariablyModified(bool VM=true)
unsigned TypeAlias
Whether this template specialization type is a substituted type alias.
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
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.
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.).
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.
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
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.
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.
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 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.
TemplateSpecializationType(TemplateName T, ArrayRef< TemplateArgument > Args, QualType Canon, QualType Aliased)
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
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