39 #include "llvm/ADT/APInt.h" 40 #include "llvm/ADT/APSInt.h" 41 #include "llvm/ADT/ArrayRef.h" 42 #include "llvm/ADT/FoldingSet.h" 43 #include "llvm/ADT/None.h" 44 #include "llvm/ADT/SmallVector.h" 45 #include "llvm/Support/Casting.h" 46 #include "llvm/Support/ErrorHandling.h" 47 #include "llvm/Support/MathExtras.h" 53 using namespace clang;
56 return (*
this != Other) &&
71 const Type* ty = getTypePtr();
83 getElementType().getBaseTypeIdentifier();
95 return AT->getElementType().isConstant(Ctx);
102 const llvm::APInt &NumElements) {
111 if (llvm::isPowerOf2_64(ElementSize)) {
112 return NumElements.getActiveBits() + llvm::Log2_64(ElementSize);
117 if ((ElementSize >> 32) == 0 && NumElements.getBitWidth() <= 64 &&
118 (NumElements.getZExtValue() >> 32) == 0) {
119 uint64_t TotalSize = NumElements.getZExtValue() * ElementSize;
120 return 64 - llvm::countLeadingZeros(TotalSize);
124 llvm::APSInt SizeExtended(NumElements,
true);
126 SizeExtended = SizeExtended.extend(
std::max(SizeTypeBits,
127 SizeExtended.getBitWidth()) * 2);
129 llvm::APSInt TotalSize(llvm::APInt(SizeExtended.getBitWidth(), ElementSize));
130 TotalSize *= SizeExtended;
132 return TotalSize.getActiveBits();
147 DependentSizedArrayType::DependentSizedArrayType(
const ASTContext &Context,
152 :
ArrayType(DependentSizedArray, et, can, sm, tq,
155 Context(Context), SizeExpr((
Stmt*) e), Brackets(brackets) {}
164 ID.AddInteger(SizeMod);
165 ID.AddInteger(TypeQuals);
169 DependentSizedExtVectorType::DependentSizedExtVectorType(
const 175 :
Type(DependentSizedExtVector, can,
true,
180 Context(Context), SizeExpr(SizeExpr), ElementType(ElementType),
188 SizeExpr->
Profile(ID, Context,
true);
191 DependentAddressSpaceType::DependentAddressSpaceType(
194 :
Type(DependentAddressSpace, can,
true,
200 Context(Context), AddrSpaceExpr(AddrSpaceExpr), PointeeType(PointeeType),
206 Expr *AddrSpaceExpr) {
208 AddrSpaceExpr->
Profile(ID, Context,
true);
213 :
VectorType(Vector, vecType, nElements, canonType, vecKind) {}
221 ElementType(vecType) {
231 if (
const ArrayType *ATy = dyn_cast<ArrayType>(
this))
232 return ATy->getElementType().getTypePtr();
235 if (!isa<ArrayType>(CanonicalType))
264 #define ABSTRACT_TYPE(Class, Parent) 265 #define TYPE(Class, Parent) \ 266 case Type::Class: { \ 267 const Class##Type *ty = cast<Class##Type>(this); \ 268 if (!ty->isSugared()) return QualType(ty, 0); \ 269 return ty->desugar(); \ 271 #include "clang/AST/TypeNodes.def" 273 llvm_unreachable(
"bad type kind!");
283 #define ABSTRACT_TYPE(Class, Parent) 284 #define TYPE(Class, Parent) \ 285 case Type::Class: { \ 286 const Class##Type *Ty = cast<Class##Type>(CurTy); \ 287 if (!Ty->isSugared()) \ 288 return SplitQualType(Ty, Qs); \ 289 Cur = Ty->desugar(); \ 292 #include "clang/AST/TypeNodes.def" 304 const Type *lastTypeWithQuals = split.
Ty;
312 #define ABSTRACT_TYPE(Class, Parent) 313 #define TYPE(Class, Parent) \ 314 case Type::Class: { \ 315 const Class##Type *ty = cast<Class##Type>(split.Ty); \ 316 if (!ty->isSugared()) goto done; \ 317 next = ty->desugar(); \ 320 #include "clang/AST/TypeNodes.def" 325 split = next.
split();
327 lastTypeWithQuals = split.
Ty;
339 T = PT->getInnerType();
348 if (
const T *Sugar = dyn_cast<T>(Cur))
351 #define ABSTRACT_TYPE(Class, Parent) 352 #define TYPE(Class, Parent) \ 353 case Type::Class: { \ 354 const Class##Type *Ty = cast<Class##Type>(Cur); \ 355 if (!Ty->isSugared()) return 0; \ 356 Cur = Ty->desugar().getTypePtr(); \ 359 #include "clang/AST/TypeNodes.def" 365 return getAsSugar<TypedefType>(
this);
369 return getAsSugar<TemplateSpecializationType>(
this);
373 return getAsSugar<AttributedType>(
this);
380 const Type *Cur =
this;
384 #define ABSTRACT_TYPE(Class, Parent) 385 #define TYPE(Class, Parent) \ 387 const Class##Type *Ty = cast<Class##Type>(Cur); \ 388 if (!Ty->isSugared()) return Cur; \ 389 Cur = Ty->desugar().getTypePtr(); \ 392 #include "clang/AST/TypeNodes.def" 398 if (
const RecordType *RT = getAs<RecordType>())
399 return RT->getDecl()->isClass();
404 if (
const RecordType *RT = getAs<RecordType>())
405 return RT->getDecl()->isStruct();
409 if (
const RecordType *RT = getAs<RecordType>())
410 return RT->getDecl()->hasAttr<ObjCBoxableAttr>();
414 if (
const RecordType *RT = getAs<RecordType>())
415 return RT->getDecl()->isInterface();
419 if (
const RecordType *RT = getAs<RecordType>()) {
428 return PT->getPointeeType()->isVoidType();
433 if (
const RecordType *RT = getAs<RecordType>())
434 return RT->getDecl()->isUnion();
439 if (
const ComplexType *CT = dyn_cast<ComplexType>(CanonicalType))
440 return CT->getElementType()->isFloatingType();
450 if (
const ComplexType *Complex = getAs<ComplexType>())
451 if (Complex->getElementType()->isIntegerType())
474 if (
const RecordType *RT = dyn_cast<RecordType>(
this)) {
475 if (RT->getDecl()->isStruct())
480 if (
const RecordType *RT = dyn_cast<RecordType>(CanonicalType)) {
481 if (!RT->getDecl()->isStruct())
493 if (
const RecordType *RT = dyn_cast<RecordType>(
this)) {
494 if (RT->getDecl()->isUnion())
499 if (
const RecordType *RT = dyn_cast<RecordType>(CanonicalType)) {
500 if (!RT->getDecl()->isUnion())
561 const Type *cur =
this;
563 if (
auto attributed = dyn_cast<AttributedType>(cur)) {
564 if (attributed->getAttrKind() ==
583 OTPDecl(const_cast<ObjCTypeParamDecl*>(D)) {
584 initialize(protocols);
600 "bitfield overflow in type argument count");
601 if (!typeArgs.empty())
602 memcpy(getTypeArgStorage(), typeArgs.data(),
603 typeArgs.size() *
sizeof(
QualType));
605 for (
auto typeArg : typeArgs) {
606 if (typeArg->isDependentType())
608 else if (typeArg->isInstantiationDependentType())
611 if (typeArg->containsUnexpandedParameterPack())
625 if (
auto objcObject =
getBaseType()->getAs<ObjCObjectType>()) {
627 if (isa<ObjCInterfaceType>(objcObject))
630 return objcObject->isSpecialized();
643 if (
auto objcObject =
getBaseType()->getAs<ObjCObjectType>()) {
645 if (isa<ObjCInterfaceType>(objcObject))
648 return objcObject->getTypeArgs();
660 if (
auto objcObject =
getBaseType()->getAs<ObjCObjectType>()) {
662 if (isa<ObjCInterfaceType>(objcObject))
665 return objcObject->isKindOfType();
682 baseType = baseObj->stripObjCKindOfTypeAndQuals(ctx);
686 splitBaseType.
Quals),
708 struct SimpleTransformVisitor
709 :
public TypeVisitor<SimpleTransformVisitor<F>, QualType> {
718 SimpleTransformVisitor(
ASTContext &ctx, F &&f)
719 : Ctx(ctx), TheFunc(std::move(f)) {}
723 #define TYPE(Class, Base) 724 #define DEPENDENT_TYPE(Class, Base) \ 725 QualType Visit##Class##Type(const Class##Type *T) { return QualType(T, 0); } 726 #include "clang/AST/TypeNodes.def" 728 #define TRIVIAL_TYPE_CLASS(Class) \ 729 QualType Visit##Class##Type(const Class##Type *T) { return QualType(T, 0); } 881 bool paramChanged =
false;
883 QualType newParamType = recurse(paramType);
884 if (newParamType.
isNull())
890 paramTypes.push_back(newParamType);
895 bool exceptionChanged =
false;
899 QualType newExceptionType = recurse(exceptionType);
900 if (newExceptionType.
isNull())
904 != exceptionType.getAsOpaquePtr())
905 exceptionChanged =
true;
907 exceptionTypes.push_back(newExceptionType);
910 if (exceptionChanged) {
912 llvm::makeArrayRef(exceptionTypes).copy(Ctx);
917 !paramChanged && !exceptionChanged)
939 if (originalType.
isNull())
943 if (adjustedType.
isNull())
956 if (originalType.
isNull())
978 if (modifiedType.
isNull())
982 if (equivalentType.
isNull())
997 if (replacementType.
isNull())
1016 if (deducedType.
isNull())
1036 bool typeArgChanged =
false;
1039 QualType newTypeArg = recurse(typeArg);
1044 typeArgChanged =
true;
1046 typeArgs.push_back(newTypeArg);
1063 if (pointeeType.
isNull())
1085 #undef TRIVIAL_TYPE_CLASS 1092 template<
typename F>
1103 SimpleTransformVisitor<F> visitor(ctx, std::forward<F>(f));
1104 QualType result = visitor.Visit(splitType.
Ty);
1125 if (
const auto *OTPTy = dyn_cast<ObjCTypeParamType>(splitType.
Ty)) {
1126 if (
auto *typeParam = dyn_cast<ObjCTypeParamDecl>(OTPTy->getDecl())) {
1128 if (!typeArgs.empty()) {
1129 QualType argType = typeArgs[typeParam->getIndex()];
1130 if (OTPTy->qual_empty())
1136 protocolsVec.append(OTPTy->qual_begin(),
1140 protocolsToApply, hasError,
true);
1156 const auto *objPtr = typeParam->getUnderlyingType()
1161 if (objPtr->isKindOfType() || objPtr->isObjCIdOrClassType())
1166 const auto *obj = objPtr->getObjectType();
1168 obj->getTypeArgsAsWritten(),
1169 obj->getProtocols(),
1181 if (
const auto *funcType = dyn_cast<FunctionType>(splitType.
Ty)) {
1183 QualType returnType = funcType->getReturnType().substObjCTypeArgs(
1192 if (isa<FunctionNoProtoType>(funcType)) {
1195 == funcType->getReturnType().getAsOpaquePtr())
1202 const auto *funcProtoType = cast<FunctionProtoType>(funcType);
1206 bool paramChanged =
false;
1207 for (
auto paramType : funcProtoType->getParamTypes()) {
1212 if (newParamType.
isNull())
1216 paramChanged =
true;
1218 paramTypes.push_back(newParamType);
1223 bool exceptionChanged =
false;
1231 if (newExceptionType.
isNull())
1235 != exceptionType.getAsOpaquePtr())
1236 exceptionChanged =
true;
1238 exceptionTypes.push_back(newExceptionType);
1241 if (exceptionChanged) {
1243 llvm::makeArrayRef(exceptionTypes).copy(ctx);
1248 == funcProtoType->getReturnType().getAsOpaquePtr() &&
1249 !paramChanged && !exceptionChanged)
1257 if (
const auto *objcObjectType = dyn_cast<ObjCObjectType>(splitType.
Ty)) {
1258 if (objcObjectType->isSpecializedAsWritten()) {
1260 bool anyChanged =
false;
1261 for (
auto typeArg : objcObjectType->getTypeArgsAsWritten()) {
1272 objcObjectType->qual_begin(),
1273 objcObjectType->getNumProtocols());
1274 if (typeArgs.empty() &&
1277 objcObjectType->getBaseType(), {},
1279 objcObjectType->isKindOfTypeAsWritten());
1285 newTypeArgs.push_back(newTypeArg);
1290 objcObjectType->qual_begin(),
1291 objcObjectType->getNumProtocols());
1293 newTypeArgs, protocols,
1294 objcObjectType->isKindOfTypeAsWritten());
1316 auto &ctx =
const_cast<ASTContext &
>(constCtx);
1321 if (!objType->isKindOfType())
1325 = objType->getBaseType().stripObjCKindOfType(ctx);
1328 objType->getTypeArgsAsWritten(),
1329 objType->getProtocols(),
1339 if (
auto AT = getTypePtr()->getAs<AtomicType>())
1340 return AT->getValueType().getUnqualifiedType();
1341 return getUnqualifiedType();
1347 if (
auto method = dyn_cast<ObjCMethodDecl>(dc))
1348 dc = method->getDeclContext();
1365 if (!dcCategoryDecl)
1370 dcTypeParams = dcCategoryDecl->getTypeParamList();
1374 dcClassDecl = dcCategoryDecl->getClassInterface();
1378 assert(dcTypeParams &&
"No substitutions to perform");
1379 assert(dcClassDecl &&
"No class context");
1383 if (
const auto *objectPointerType = getAs<ObjCObjectPointerType>()) {
1384 objectType = objectPointerType->getObjectType();
1385 }
else if (getAs<BlockPointerType>()) {
1390 objectType = getAs<ObjCObjectType>();
1396 if (!curClassDecl) {
1404 while (curClassDecl != dcClassDecl) {
1407 if (superType.
isNull()) {
1408 objectType =
nullptr;
1428 if (
auto *
ID = IfaceT->getInterface()) {
1429 if (
ID->getTypeParamList())
1443 CachedSuperClassType.setInt(
true);
1449 if (!superClassObjTy) {
1450 CachedSuperClassType.setInt(
true);
1455 if (!superClassDecl) {
1456 CachedSuperClassType.setInt(
true);
1462 QualType superClassType(superClassObjTy, 0);
1464 if (!superClassTypeParams) {
1465 CachedSuperClassType.setPointerAndInt(
1472 CachedSuperClassType.setPointerAndInt(superClassObjTy,
true);
1480 CachedSuperClassType.setPointerAndInt(
1491 CachedSuperClassType.setPointerAndInt(
1499 assert(typeArgs.size() == typeParams->
size());
1500 CachedSuperClassType.setPointerAndInt(
1503 ->castAs<ObjCObjectType>(),
1509 return interfaceDecl->getASTContext().getObjCInterfaceType(interfaceDecl)
1518 if (superObjectType.
isNull())
1519 return superObjectType;
1521 ASTContext &ctx = getInterfaceDecl()->getASTContext();
1530 if (T->getNumProtocols() && T->getInterface())
1543 if (OPT->isObjCQualifiedIdType())
1553 if (OPT->isObjCQualifiedClassType())
1561 if (OT->getInterface())
1569 if (OPT->getInterfaceType())
1591 return dyn_cast_or_null<CXXRecordDecl>(
getAsTagDecl());
1595 if (
const auto *TT = getAs<TagType>())
1596 return cast<TagDecl>(TT->getDecl());
1597 if (
const auto *Injected = getAs<InjectedClassNameType>())
1598 return Injected->getDecl();
1605 class GetContainedDeducedTypeVisitor :
1606 public TypeVisitor<GetContainedDeducedTypeVisitor, Type*> {
1610 GetContainedDeducedTypeVisitor(
bool Syntactic =
false)
1611 : Syntactic(Syntactic) {}
1652 Type *VisitDependentSizedExtVectorType(
1663 return const_cast<FunctionProtoType*>(T);
1664 return VisitFunctionType(T);
1687 return cast_or_null<DeducedType>(
1688 GetContainedDeducedTypeVisitor().Visit(
this));
1692 return dyn_cast_or_null<FunctionType>(
1693 GetContainedDeducedTypeVisitor(
true).Visit(
this));
1697 if (
const VectorType *VT = dyn_cast<VectorType>(CanonicalType))
1698 return VT->getElementType()->isIntegerType();
1723 if (
const BuiltinType *BT = dyn_cast<BuiltinType>(CanonicalType))
1724 return BT->getKind() >= BuiltinType::Bool &&
1725 BT->getKind() <= BuiltinType::Int128;
1729 if (
const EnumType *ET = dyn_cast<EnumType>(CanonicalType))
1730 return ET->getDecl()->isComplete();
1736 if (
const BuiltinType *BT = dyn_cast<BuiltinType>(CanonicalType))
1737 return BT->getKind() >= BuiltinType::Bool &&
1738 BT->getKind() <= BuiltinType::Int128;
1744 if (
const EnumType *ET = dyn_cast<EnumType>(CanonicalType))
1745 return ET->getDecl()->isComplete() && !ET->getDecl()->isScoped();
1751 if (
const BuiltinType *BT = dyn_cast<BuiltinType>(CanonicalType))
1752 return BT->getKind() == BuiltinType::Char_U ||
1753 BT->getKind() == BuiltinType::UChar ||
1754 BT->getKind() == BuiltinType::Char_S ||
1755 BT->getKind() == BuiltinType::SChar;
1760 if (
const BuiltinType *BT = dyn_cast<BuiltinType>(CanonicalType))
1761 return BT->getKind() == BuiltinType::WChar_S ||
1762 BT->getKind() == BuiltinType::WChar_U;
1767 if (
const BuiltinType *BT = dyn_cast<BuiltinType>(CanonicalType))
1768 return BT->getKind() == BuiltinType::Char16;
1773 if (
const BuiltinType *BT = dyn_cast<BuiltinType>(CanonicalType))
1774 return BT->getKind() == BuiltinType::Char32;
1782 if (!BT)
return false;
1784 default:
return false;
1785 case BuiltinType::Char_U:
1786 case BuiltinType::UChar:
1787 case BuiltinType::WChar_U:
1788 case BuiltinType::Char16:
1789 case BuiltinType::Char32:
1790 case BuiltinType::Char_S:
1791 case BuiltinType::SChar:
1792 case BuiltinType::WChar_S:
1801 if (
const BuiltinType *BT = dyn_cast<BuiltinType>(CanonicalType)) {
1802 return BT->getKind() >= BuiltinType::Char_S &&
1803 BT->getKind() <= BuiltinType::Int128;
1806 if (
const EnumType *ET = dyn_cast<EnumType>(CanonicalType)) {
1809 if (ET->getDecl()->isComplete() && !ET->getDecl()->isScoped())
1810 return ET->getDecl()->getIntegerType()->isSignedIntegerType();
1817 if (
const BuiltinType *BT = dyn_cast<BuiltinType>(CanonicalType)) {
1818 return BT->getKind() >= BuiltinType::Char_S &&
1819 BT->getKind() <= BuiltinType::Int128;
1822 if (
const EnumType *ET = dyn_cast<EnumType>(CanonicalType)) {
1823 if (ET->getDecl()->isComplete())
1824 return ET->getDecl()->getIntegerType()->isSignedIntegerType();
1831 if (
const VectorType *VT = dyn_cast<VectorType>(CanonicalType))
1832 return VT->getElementType()->isSignedIntegerOrEnumerationType();
1841 if (
const BuiltinType *BT = dyn_cast<BuiltinType>(CanonicalType)) {
1842 return BT->getKind() >= BuiltinType::Bool &&
1843 BT->getKind() <= BuiltinType::UInt128;
1846 if (
const EnumType *ET = dyn_cast<EnumType>(CanonicalType)) {
1849 if (ET->getDecl()->isComplete() && !ET->getDecl()->isScoped())
1850 return ET->getDecl()->getIntegerType()->isUnsignedIntegerType();
1857 if (
const BuiltinType *BT = dyn_cast<BuiltinType>(CanonicalType)) {
1858 return BT->getKind() >= BuiltinType::Bool &&
1859 BT->getKind() <= BuiltinType::UInt128;
1862 if (
const EnumType *ET = dyn_cast<EnumType>(CanonicalType)) {
1863 if (ET->getDecl()->isComplete())
1864 return ET->getDecl()->getIntegerType()->isUnsignedIntegerType();
1871 if (
const VectorType *VT = dyn_cast<VectorType>(CanonicalType))
1872 return VT->getElementType()->isUnsignedIntegerOrEnumerationType();
1878 if (
const BuiltinType *BT = dyn_cast<BuiltinType>(CanonicalType))
1879 return BT->getKind() >= BuiltinType::Half &&
1880 BT->getKind() <= BuiltinType::Float128;
1881 if (
const ComplexType *CT = dyn_cast<ComplexType>(CanonicalType))
1882 return CT->getElementType()->isFloatingType();
1887 if (
const VectorType *VT = dyn_cast<VectorType>(CanonicalType))
1888 return VT->getElementType()->isFloatingType();
1894 if (
const BuiltinType *BT = dyn_cast<BuiltinType>(CanonicalType))
1895 return BT->isFloatingPoint();
1900 if (
const BuiltinType *BT = dyn_cast<BuiltinType>(CanonicalType))
1901 return BT->getKind() >= BuiltinType::Bool &&
1902 BT->getKind() <= BuiltinType::Float128;
1903 if (
const EnumType *ET = dyn_cast<EnumType>(CanonicalType))
1904 return ET->getDecl()->isComplete() && !ET->getDecl()->isScoped();
1909 if (
const BuiltinType *BT = dyn_cast<BuiltinType>(CanonicalType))
1910 return BT->getKind() >= BuiltinType::Bool &&
1911 BT->getKind() <= BuiltinType::Float128;
1912 if (
const EnumType *ET = dyn_cast<EnumType>(CanonicalType))
1919 return !ET->getDecl()->isScoped() && ET->getDecl()->isComplete();
1920 return isa<ComplexType>(CanonicalType);
1927 if (
const BuiltinType *BT = dyn_cast<BuiltinType>(T)) {
1928 if (BT->getKind() == BuiltinType::Bool)
return STK_Bool;
1929 if (BT->getKind() == BuiltinType::NullPtr)
return STK_CPointer;
1932 llvm_unreachable(
"unknown scalar builtin type");
1933 }
else if (isa<PointerType>(T)) {
1935 }
else if (isa<BlockPointerType>(T)) {
1937 }
else if (isa<ObjCObjectPointerType>(T)) {
1939 }
else if (isa<MemberPointerType>(T)) {
1941 }
else if (isa<EnumType>(T)) {
1942 assert(cast<EnumType>(T)->getDecl()->isComplete());
1944 }
else if (
const ComplexType *CT = dyn_cast<ComplexType>(T)) {
1945 if (CT->getElementType()->isRealFloatingType())
1950 llvm_unreachable(
"unknown scalar type");
1963 if (
const RecordType *Record = dyn_cast<RecordType>(CanonicalType)) {
1964 if (
CXXRecordDecl *ClassDecl = dyn_cast<CXXRecordDecl>(Record->getDecl()))
1965 return ClassDecl->isAggregate();
1970 return isa<ArrayType>(CanonicalType);
1977 assert(!
isIncompleteType() &&
"This doesn't make sense for incomplete types");
1978 assert(!
isDependentType() &&
"This doesn't make sense for dependent types");
1980 return !isa<VariableArrayType>(CanonicalType);
1990 switch (CanonicalType->getTypeClass()) {
1991 default:
return false;
1997 EnumDecl *EnumD = cast<EnumType>(CanonicalType)->getDecl();
2010 RecordDecl *Rec = cast<RecordType>(CanonicalType)->getDecl();
2020 return cast<ArrayType>(CanonicalType)->getElementType()
2021 ->isIncompleteType(Def);
2022 case IncompleteArray:
2025 case MemberPointer: {
2029 auto *MPTy = cast<MemberPointerType>(CanonicalType);
2030 const Type *ClassTy = MPTy->getClass();
2032 if (ClassTy->isDependentType())
2043 if (RD->
hasAttr<MSInheritanceAttr>())
2048 return cast<ObjCObjectType>(CanonicalType)->
getBaseType()
2050 case ObjCInterface: {
2053 = cast<ObjCInterfaceType>(CanonicalType)->getDecl();
2064 return isCXX11PODType(Context);
2066 return isCXX98PODType(Context);
2076 if ((*this)->isIncompleteArrayType())
2079 if ((*this)->isIncompleteType())
2082 if (hasNonTrivialObjCLifetime())
2085 QualType CanonicalType = getTypePtr()->CanonicalType;
2088 default:
return false;
2089 case Type::VariableArray:
2090 case Type::ConstantArray:
2094 case Type::ObjCObjectPointer:
2095 case Type::BlockPointer:
2099 case Type::MemberPointer:
2101 case Type::ExtVector:
2109 = dyn_cast<CXXRecordDecl>(cast<RecordType>(CanonicalType)->getDecl()))
2110 return ClassDecl->isPOD();
2124 if ((*this)->isArrayType())
2129 if ((*this)->isIncompleteType())
2132 if (hasNonTrivialObjCLifetime())
2135 QualType CanonicalType = getTypePtr()->CanonicalType;
2149 dyn_cast<CXXRecordDecl>(RT->getDecl())) {
2154 return ClassDecl->hasDefaultConstructor() &&
2155 !ClassDecl->hasNonTrivialDefaultConstructor() &&
2156 ClassDecl->isTriviallyCopyable();
2167 if ((*this)->isArrayType())
2170 if (hasNonTrivialObjCLifetime())
2178 QualType CanonicalType = getCanonicalType();
2193 dyn_cast<CXXRecordDecl>(RT->getDecl())) {
2194 if (!ClassDecl->isTriviallyCopyable())
return false;
2227 assert(BaseTy &&
"NULL element type");
2258 dyn_cast<CXXRecordDecl>(RT->getDecl()))
2259 return ClassDecl->isLiteral();
2266 return AT->getValueType()->isLiteralType(Ctx);
2285 assert(BaseTy &&
"NULL element type");
2296 dyn_cast<CXXRecordDecl>(RT->getDecl()))
2297 if (!ClassDecl->isStandardLayout())
2314 const Type *ty = getTypePtr();
2318 if (hasNonTrivialObjCLifetime())
2325 assert(BaseTy &&
"NULL element type");
2336 dyn_cast<CXXRecordDecl>(RT->getDecl())) {
2339 if (!ClassDecl->isTrivial())
return false;
2344 if (!ClassDecl->isStandardLayout())
return false;
2364 if (
auto *ET = getAs<EnumType>()) {
2365 auto *II = ET->getDecl()->getIdentifier();
2366 if (II && II->isStr(
"align_val_t") && ET->getDecl()->isInStdNamespace())
2373 if (
auto *ET = getAs<EnumType>()) {
2374 auto *II = ET->getDecl()->getIdentifier();
2375 if (II && II->isStr(
"byte") && ET->getDecl()->isInStdNamespace())
2383 switch (BT->getKind()) {
2384 case BuiltinType::Bool:
2385 case BuiltinType::Char_S:
2386 case BuiltinType::Char_U:
2387 case BuiltinType::SChar:
2388 case BuiltinType::UChar:
2389 case BuiltinType::Short:
2390 case BuiltinType::UShort:
2391 case BuiltinType::WChar_S:
2392 case BuiltinType::WChar_U:
2393 case BuiltinType::Char16:
2394 case BuiltinType::Char32:
2402 if (
const EnumType *ET = getAs<EnumType>()){
2403 if (this->
isDependentType() || ET->getDecl()->getPromotionType().isNull()
2404 || ET->getDecl()->isScoped())
2423 case TemplateTypeParm:
2424 case SubstTemplateTypeParm:
2425 case TemplateSpecialization:
2428 case DependentTemplateSpecialization:
2431 case ObjCObjectPointer:
2461 llvm_unreachable(
"Type specifier is not a tag type kind.");
2473 llvm_unreachable(
"Unknown tag type kind.");
2486 llvm_unreachable(
"Elaborated type keyword is not a tag type kind.");
2488 llvm_unreachable(
"Unknown elaborated type keyword.");
2504 llvm_unreachable(
"Unknown elaborated type keyword.");
2518 llvm_unreachable(
"Unknown elaborated type keyword.");
2521 DependentTemplateSpecializationType::DependentTemplateSpecializationType(
2526 :
TypeWithKeyword(Keyword, DependentTemplateSpecialization, Canon,
true,
true,
2529 NNS(NNS), Name(Name), NumArgs(Args.size()) {
2531 "DependentTemplateSpecializatonType requires dependent qualifier");
2534 if (Arg.containsUnexpandedParameterPack())
2548 ID.AddInteger(Keyword);
2549 ID.AddPointer(Qualifier);
2550 ID.AddPointer(Name);
2552 Arg.Profile(ID, Context);
2558 Keyword = Elab->getKeyword();
2560 Keyword = DepName->getKeyword();
2562 dyn_cast<DependentTemplateSpecializationType>(
this))
2563 Keyword = DepTST->getKeyword();
2572 #define ABSTRACT_TYPE(Derived, Base) 2573 #define TYPE(Derived, Base) case Derived: return #Derived; 2574 #include "clang/AST/TypeNodes.def" 2577 llvm_unreachable(
"Invalid type class.");
2585 return Policy.
Bool ?
"bool" :
"_Bool";
2591 return "signed char";
2603 return "unsigned char";
2605 return "unsigned short";
2607 return "unsigned int";
2609 return "unsigned long";
2611 return "unsigned long long";
2613 return "unsigned __int128";
2615 return Policy.
Half ?
"half" :
"__fp16";
2621 return "long double";
2625 return "__float128";
2628 return Policy.
MSWChar ?
"__wchar_t" :
"wchar_t";
2636 return "<overloaded function type>";
2638 return "<bound member function type>";
2640 return "<pseudo-object type>";
2642 return "<dependent type>";
2644 return "<unknown type>";
2645 case ARCUnbridgedCast:
2646 return "<ARC unbridged cast type>";
2648 return "<builtin fn type>";
2655 #define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \ 2657 return "__" #Access " " #ImgType "_t"; 2658 #include "clang/Basic/OpenCLImageTypes.def" 2664 return "clk_event_t";
2668 return "reserve_id_t";
2669 case OMPArraySection:
2670 return "<OpenMP array section type>";
2673 llvm_unreachable(
"Invalid builtin type.");
2677 if (
const ReferenceType *RefType = getTypePtr()->getAs<ReferenceType>())
2686 (!getTypePtr()->isDependentType() && !getTypePtr()->isRecordType()))
2687 return getUnqualifiedType();
2694 case CC_C:
return "cdecl";
2713 llvm_unreachable(
"Invalid calling convention.");
2718 const ExtProtoInfo &epi)
2724 NumParams(params.size()),
2725 NumExceptions(epi.ExceptionSpec.Exceptions.size()),
2726 ExceptionSpecType(epi.ExceptionSpec.Type),
2727 HasExtParameterInfos(epi.ExtParameterInfos !=
nullptr),
2728 Variadic(epi.Variadic), HasTrailingReturn(epi.HasTrailingReturn) {
2729 assert(NumParams == params.size() &&
"function has too many parameters");
2736 for (
unsigned i = 0; i != NumParams; ++i) {
2745 argSlot[i] = params[i];
2750 QualType *exnSlot = argSlot + NumParams;
2752 for (
QualType ExceptionType : epi.ExceptionSpec.Exceptions) {
2762 exnSlot[I++] = ExceptionType;
2766 Expr **noexSlot =
reinterpret_cast<Expr **
>(argSlot + NumParams);
2767 *noexSlot = epi.ExceptionSpec.NoexceptExpr;
2769 if (epi.ExceptionSpec.NoexceptExpr) {
2770 if (epi.ExceptionSpec.NoexceptExpr->isValueDependent() ||
2771 epi.ExceptionSpec.NoexceptExpr->isInstantiationDependent())
2774 if (epi.ExceptionSpec.NoexceptExpr->containsUnexpandedParameterPack())
2781 reinterpret_cast<FunctionDecl **
>(argSlot + NumParams);
2782 slot[0] = epi.ExceptionSpec.SourceDecl;
2783 slot[1] = epi.ExceptionSpec.SourceTemplate;
2790 reinterpret_cast<FunctionDecl **
>(argSlot + NumParams);
2791 slot[0] = epi.ExceptionSpec.SourceDecl;
2799 assert(hasDependentExceptionSpec() &&
"type should not be canonical");
2807 if (epi.ExtParameterInfos) {
2808 ExtParameterInfo *extParamInfos =
2809 const_cast<ExtParameterInfo *
>(getExtParameterInfosBuffer());
2810 for (
unsigned i = 0; i != NumParams; ++i)
2811 extParamInfos[i] = epi.ExtParameterInfos[i];
2816 if (
Expr *NE = getNoexceptExpr())
2817 return NE->isValueDependent();
2828 if (
Expr *NE = getNoexceptExpr())
2829 return NE->isInstantiationDependent();
2831 if (ET->isInstantiationDependentType())
2843 return NR_NoNoexcept;
2845 Expr *noexceptExpr = getNoexceptExpr();
2847 return NR_BadNoexcept;
2849 return NR_Dependent;
2855 assert(isICE &&
"AST should not contain bad noexcept expressions.");
2857 return value.getBoolValue() ? NR_Nothrow : NR_Throw;
2869 for (
unsigned I = 0, N = NumExceptions; I != N; ++I)
2870 if (!getExceptionType(I)->getAs<PackExpansionType>())
2879 if (NR == NR_Dependent)
2885 for (
unsigned ArgIdx = getNumParams(); ArgIdx; --ArgIdx)
2893 const QualType *ArgTys,
unsigned NumParams,
2914 for (
unsigned i = 0; i != NumParams; ++i)
2919 assert(!(
unsigned(epi.
Variadic) & ~1) &&
2923 "Values larger than expected.");
2939 for (
unsigned i = 0; i != NumParams; ++i)
2948 Profile(ID, getReturnType(), param_type_begin(), NumParams, getExtProtoInfo(),
2953 return getDecl()->getUnderlyingType();
2957 :
Type(TypeOfExpr, can, E->isTypeDependent(),
2958 E->isInstantiationDependent(),
2976 E->
Profile(ID, Context,
true);
2983 :
Type(Decltype, can, E->isInstantiationDependent(),
2984 E->isInstantiationDependent(),
2987 E(E), UnderlyingType(underlyingType) {}
2999 :
DecltypeType(E, Context.DependentTy), Context(Context) {}
3003 E->
Profile(ID, Context,
true);
3014 BaseType(BaseType), UnderlyingType(UnderlyingType), UKind(UKind) {}
3029 for (
auto I : decl->
redecls()) {
3030 if (I->isCompleteDefinition() || I->isBeingDefined())
3052 if (FieldRecTy->hasConstFields())
3059 switch (getAttrKind()) {
3102 llvm_unreachable(
"bad attributed type kind");
3106 switch (getAttrKind()) {
3107 default:
return false;
3114 llvm_unreachable(
"invalid attr kind");
3118 switch (getAttrKind()) {
3123 case attr_address_space:
3125 case attr_vector_size:
3126 case attr_neon_vector_type:
3127 case attr_neon_polyvector_type:
3129 case attr_objc_ownership:
3130 case attr_objc_inert_unsafe_unretained:
3133 case attr_ns_returns_retained:
3135 case attr_null_unspecified:
3136 case attr_objc_kindof:
3146 case attr_swiftcall:
3147 case attr_vectorcall:
3151 case attr_inteloclbicc:
3152 case attr_preserve_most:
3153 case attr_preserve_all:
3156 llvm_unreachable(
"invalid attr kind");
3167 SubstTemplateTypeParmPackType::
3171 :
Type(SubstTemplateTypeParmPack, Canon,
true,
true,
false,
true),
3180 Profile(ID, getReplacedParameter(), getArgumentPack());
3186 ID.AddPointer(Replaced);
3189 ID.AddPointer(
P.getAsType().getAsOpaquePtr());
3194 bool &InstantiationDependent) {
3195 return anyDependentTemplateArguments(Args.
arguments(),
3196 InstantiationDependent);
3201 bool &InstantiationDependent) {
3203 if (ArgLoc.getArgument().isDependent()) {
3204 InstantiationDependent =
true;
3208 if (ArgLoc.getArgument().isInstantiationDependent())
3209 InstantiationDependent =
true;
3214 TemplateSpecializationType::
3218 :
Type(TemplateSpecialization,
3224 Template(T), NumArgs(Args.size()), TypeAlias(!AliasedType.
isNull()) {
3226 "Use DependentTemplateSpecializationType for dependent template-name");
3230 "Unexpected template name for TemplateSpecializationType");
3243 if (Arg.isInstantiationDependent())
3246 Arg.getAsType()->isVariablyModifiedType())
3248 if (Arg.containsUnexpandedParameterPack())
3256 *
reinterpret_cast<QualType*
>(Begin + getNumArgs()) = AliasedType;
3267 Arg.Profile(ID, Context);
3272 if (!hasNonFastQualifiers())
3280 if (!hasNonFastQualifiers())
3281 return QualType(T, getFastQualifiers());
3292 ID.AddInteger(typeArgs.size());
3293 for (
auto typeArg : typeArgs)
3294 ID.AddPointer(typeArg.getAsOpaquePtr());
3295 ID.AddInteger(protocols.size());
3296 for (
auto proto : protocols)
3297 ID.AddPointer(proto);
3298 ID.AddBoolean(isKindOf);
3302 Profile(ID, getBaseType(), getTypeArgsAsWritten(),
3303 llvm::makeArrayRef(qual_begin(), getNumProtocols()),
3304 isKindOfTypeAsWritten());
3310 ID.AddPointer(OTPDecl);
3311 ID.AddInteger(protocols.size());
3312 for (
auto proto : protocols)
3313 ID.AddPointer(proto);
3318 llvm::makeArrayRef(qual_begin(), getNumProtocols()));
3324 class CachedProperties {
3329 CachedProperties(
Linkage L,
bool local) : L(L), local(local) {}
3332 bool hasLocalOrUnnamedType()
const {
return local; }
3334 friend CachedProperties merge(CachedProperties L, CachedProperties R) {
3336 return CachedProperties(MergedLinkage,
3337 L.hasLocalOrUnnamedType() | R.hasLocalOrUnnamedType());
3353 return get(T.getTypePtr());
3356 static CachedProperties
get(
const Type *
T) {
3358 return CachedProperties(T->
TypeBits.getLinkage(),
3359 T->
TypeBits.hasLocalOrUnnamedType());
3364 if (T->
TypeBits.isCacheValid())
return;
3380 T->
TypeBits.CachedLinkage = Result.getLinkage();
3381 T->
TypeBits.CachedLocalOrUnnamed = Result.hasLocalOrUnnamedType();
3400 #define TYPE(Class,Base) 3401 #define NON_CANONICAL_TYPE(Class,Base) case Type::Class: 3402 #include "clang/AST/TypeNodes.def" 3403 llvm_unreachable(
"didn't expect a non-canonical type here");
3405 #define TYPE(Class,Base) 3406 #define DEPENDENT_TYPE(Class,Base) case Type::Class: 3407 #define NON_CANONICAL_UNLESS_DEPENDENT_TYPE(Class,Base) case Type::Class: 3408 #include "clang/AST/TypeNodes.def" 3414 case Type::DeducedTemplateSpecialization:
3434 bool IsLocalOrUnnamed =
3437 return CachedProperties(L, IsLocalOrUnnamed);
3444 return Cache::get(cast<ComplexType>(T)->getElementType());
3447 case Type::BlockPointer:
3449 case Type::LValueReference:
3450 case Type::RValueReference:
3452 case Type::MemberPointer: {
3457 case Type::ConstantArray:
3458 case Type::IncompleteArray:
3459 case Type::VariableArray:
3460 return Cache::get(cast<ArrayType>(T)->getElementType());
3462 case Type::ExtVector:
3463 return Cache::get(cast<VectorType>(T)->getElementType());
3464 case Type::FunctionNoProto:
3465 return Cache::get(cast<FunctionType>(T)->getReturnType());
3466 case Type::FunctionProto: {
3473 case Type::ObjCInterface: {
3475 return CachedProperties(L,
false);
3477 case Type::ObjCObject:
3478 return Cache::get(cast<ObjCObjectType>(T)->getBaseType());
3479 case Type::ObjCObjectPointer:
3482 return Cache::get(cast<AtomicType>(T)->getValueType());
3484 return Cache::get(cast<PipeType>(T)->getElementType());
3487 llvm_unreachable(
"unhandled type class");
3498 return TypeBits.hasLocalOrUnnamedType();
3503 #define TYPE(Class,Base) 3504 #define NON_CANONICAL_TYPE(Class,Base) case Type::Class: 3505 #include "clang/AST/TypeNodes.def" 3506 llvm_unreachable(
"didn't expect a non-canonical type here");
3508 #define TYPE(Class,Base) 3509 #define DEPENDENT_TYPE(Class,Base) case Type::Class: 3510 #define NON_CANONICAL_UNLESS_DEPENDENT_TYPE(Class,Base) case Type::Class: 3511 #include "clang/AST/TypeNodes.def" 3520 case Type::DeducedTemplateSpecialization:
3525 return getDeclLinkageAndVisibility(cast<TagType>(T)->
getDecl());
3528 return computeTypeLinkageInfo(cast<ComplexType>(T)->getElementType());
3530 return computeTypeLinkageInfo(cast<PointerType>(T)->
getPointeeType());
3531 case Type::BlockPointer:
3532 return computeTypeLinkageInfo(cast<BlockPointerType>(T)->
getPointeeType());
3533 case Type::LValueReference:
3534 case Type::RValueReference:
3535 return computeTypeLinkageInfo(cast<ReferenceType>(T)->
getPointeeType());
3536 case Type::MemberPointer: {
3542 case Type::ConstantArray:
3543 case Type::IncompleteArray:
3544 case Type::VariableArray:
3545 return computeTypeLinkageInfo(cast<ArrayType>(T)->getElementType());
3547 case Type::ExtVector:
3548 return computeTypeLinkageInfo(cast<VectorType>(T)->getElementType());
3549 case Type::FunctionNoProto:
3550 return computeTypeLinkageInfo(cast<FunctionType>(T)->getReturnType());
3551 case Type::FunctionProto: {
3555 LV.
merge(computeTypeLinkageInfo(ai));
3558 case Type::ObjCInterface:
3559 return getDeclLinkageAndVisibility(cast<ObjCInterfaceType>(T)->
getDecl());
3560 case Type::ObjCObject:
3561 return computeTypeLinkageInfo(cast<ObjCObjectType>(T)->getBaseType());
3562 case Type::ObjCObjectPointer:
3563 return computeTypeLinkageInfo(
3566 return computeTypeLinkageInfo(cast<AtomicType>(T)->getValueType());
3568 return computeTypeLinkageInfo(cast<PipeType>(T)->getElementType());
3571 llvm_unreachable(
"unhandled type class");
3602 if (
auto attributed = dyn_cast<AttributedType>(type.
getTypePtr())) {
3603 if (
auto nullability = attributed->getImmediateNullability())
3621 #define NON_CANONICAL_TYPE(Class, Parent) \ 3623 llvm_unreachable("non-canonical type"); 3624 #define TYPE(Class, Parent) 3625 #include "clang/AST/TypeNodes.def" 3629 case Type::BlockPointer:
3630 case Type::MemberPointer:
3631 case Type::ObjCObjectPointer:
3635 case Type::UnresolvedUsing:
3636 case Type::TypeOfExpr:
3638 case Type::Decltype:
3639 case Type::UnaryTransform:
3640 case Type::TemplateTypeParm:
3641 case Type::SubstTemplateTypeParmPack:
3642 case Type::DependentName:
3643 case Type::DependentTemplateSpecialization:
3645 return ResultIfUnknown;
3650 case Type::TemplateSpecialization:
3652 = cast<TemplateSpecializationType>(type.
getTypePtr())
3653 ->getTemplateName().getAsTemplateDecl()) {
3654 if (isa<ClassTemplateDecl>(templateDecl))
3657 return ResultIfUnknown;
3662 #define SIGNED_TYPE(Id, SingletonId) case BuiltinType::Id: 3663 #define UNSIGNED_TYPE(Id, SingletonId) case BuiltinType::Id: 3664 #define FLOATING_TYPE(Id, SingletonId) case BuiltinType::Id: 3665 #define BUILTIN_TYPE(Id, SingletonId) 3666 #include "clang/AST/BuiltinTypes.def" 3670 case BuiltinType::Dependent:
3671 case BuiltinType::Overload:
3672 case BuiltinType::BoundMember:
3673 case BuiltinType::PseudoObject:
3674 case BuiltinType::UnknownAny:
3675 case BuiltinType::ARCUnbridgedCast:
3676 return ResultIfUnknown;
3678 case BuiltinType::Void:
3679 case BuiltinType::ObjCId:
3680 case BuiltinType::ObjCClass:
3681 case BuiltinType::ObjCSel:
3682 #define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \ 3683 case BuiltinType::Id: 3684 #include "clang/Basic/OpenCLImageTypes.def" 3685 case BuiltinType::OCLSampler:
3686 case BuiltinType::OCLEvent:
3687 case BuiltinType::OCLClkEvent:
3688 case BuiltinType::OCLQueue:
3689 case BuiltinType::OCLReserveID:
3690 case BuiltinType::BuiltinFn:
3691 case BuiltinType::NullPtr:
3692 case BuiltinType::OMPArraySection:
3695 llvm_unreachable(
"unknown builtin type");
3699 case Type::LValueReference:
3700 case Type::RValueReference:
3701 case Type::ConstantArray:
3702 case Type::IncompleteArray:
3703 case Type::VariableArray:
3704 case Type::DependentSizedArray:
3705 case Type::DependentSizedExtVector:
3707 case Type::ExtVector:
3708 case Type::DependentAddressSpace:
3709 case Type::FunctionProto:
3710 case Type::FunctionNoProto:
3712 case Type::DeducedTemplateSpecialization:
3714 case Type::InjectedClassName:
3715 case Type::PackExpansion:
3716 case Type::ObjCObject:
3717 case Type::ObjCInterface:
3722 llvm_unreachable(
"bad type kind!");
3736 if (
auto attributed = dyn_cast<AttributedType>(T.
getTypePtr())) {
3737 if (
auto nullability = attributed->getImmediateNullability()) {
3738 T = attributed->getModifiedType();
3787 "cannot query implicit lifetime for non-inferrable type");
3792 while (
const ArrayType *array = dyn_cast<ArrayType>(canon))
3793 canon = array->getElementType().getTypePtr();
3796 = dyn_cast<ObjCObjectPointerType>(canon)) {
3798 if (opt->getObjectType()->isObjCClass())
3806 const Type *cur =
this;
3809 return typedefType->getDecl()->hasAttr<ObjCNSObjectAttr>();
3813 if (next.getTypePtr() == cur)
return false;
3814 cur = next.getTypePtr();
3820 return typedefType->getDecl()->hasAttr<ObjCIndependentClassAttr>();
3833 if (
const PointerType *OPT = getAs<PointerType>())
3834 return OPT->getPointeeType()->isObjCIndirectLifetimeType();
3836 return Ref->getPointeeType()->isObjCIndirectLifetimeType();
3838 return MemPtr->getPointeeType()->isObjCIndirectLifetimeType();
3845 const Type *type =
this;
3847 type = array->getElementType().getTypePtr();
3859 const PointerType *Pointer = getAs<PointerType>();
3870 if (
const PointerType *ptr = getAs<PointerType>())
3871 return ptr->getPointeeType()->hasSizedVLAType();
3873 return ref->getPointeeType()->hasSizedVLAType();
3875 if (isa<VariableArrayType>(arr) &&
3876 cast<VariableArrayType>(arr)->getSizeExpr())
3879 return arr->getElementType()->hasSizedVLAType();
3893 return DK_objc_strong_lifetime;
3895 return DK_objc_weak_lifetime;
3903 return DK_cxx_destructor;
unsigned char getOpaqueValue() const
DecltypeType(Expr *E, QualType underlyingType, QualType can=QualType())
static StringRef getKeywordName(ElaboratedTypeKeyword Keyword)
const ObjCInterfaceType * getInterfaceType() const
If this pointer points to an Objective C @interface type, gets the type for that interface.
const internal::VariadicAllOfMatcher< Type > type
Matches Types in the clang AST.
Defines the clang::ASTContext interface.
bool hasDefinition() const
Determine whether this class has been defined.
bool isNonWeakInMRRWithObjCWeak(const ASTContext &Context) const
QualType getDeducedType() const
Get the type deduced for this placeholder type, or null if it's either not been deduced or was deduce...
Represents a type that was referred to using an elaborated type keyword, e.g., struct S...
const Type * Ty
The locally-unqualified type.
QualType getObjCObjectType(QualType Base, ObjCProtocolDecl *const *Protocols, unsigned NumProtocols) const
Legacy interface: cannot provide type arguments or __kindof.
void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Ctx)
An instance of this class is created to represent a function declaration or definition.
bool isKindOfTypeAsWritten() const
Whether this is a "__kindof" type as written.
External linkage, which indicates that the entity can be referred to from other translation units...
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 "enum" keyword introduces the elaborated-type-specifier.
bool isObjCQualifiedIdType() const
True if this is equivalent to 'id.
void setDependent(bool D=true)
bool isTemplateVariadic() const
Determines whether this function prototype contains a parameter pack at the end.
StringRef getName(const PrintingPolicy &Policy) const
PointerType - C99 6.7.5.1 - Pointer Declarators.
ArrayRef< QualType > getTypeArgsAsWritten() const
Retrieve the type arguments of this object type as they were written.
QualType getPointeeType() const
A (possibly-)qualified type.
bool isBlockPointerType() const
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 isPODType(const ASTContext &Context) const
Determine whether this is a Plain Old Data (POD) type (C++ 3.9p10).
bool isUnsignedIntegerOrEnumerationType() const
Determines whether this is an integer type that is unsigned or an enumeration types whose underlying ...
static QualType getObjectType(APValue::LValueBase B)
Retrieves the "underlying object type" of the given expression, as used by __builtin_object_size.
QualType getDesugaredType(const ASTContext &Context) const
Return the specified type with any "sugar" removed from the type.
void Profile(llvm::FoldingSetNodeID &ID) const
bool isArithmeticType() const
void setInstantiationDependent(bool D=true)
Stmt - This represents one statement.
FunctionType - C99 6.7.5.3 - Function Declarators.
bool isObjCClassOrClassKindOfType() const
Whether the type is Objective-C 'Class' or a __kindof type of an Class type, e.g., __kindof Class <NSCopying>.
QualType getPointeeType() const
If this is a pointer, ObjC object pointer, or block pointer, this returns the respective pointee...
bool isElaboratedTypeSpecifier() const
Determine wither this type is a C++ elaborated-type-specifier.
unsigned MSWChar
When true, print the built-in wchar_t type as __wchar_t.
bool isRealFloatingType() const
Floating point categories.
C Language Family Type Representation.
Represents a qualified type name for which the type name is dependent.
bool isObjCARCBridgableType() const
Determine whether the given type T is a "bridgable" Objective-C type, which is either an Objective-C ...
void Profile(llvm::FoldingSetNodeID &ID)
bool isRecordType() const
QualType getQualifiedType(SplitQualType split) const
Un-split a SplitQualType.
const ObjCObjectType * getAsObjCInterfaceType() const
QualType getLValueReferenceType(QualType T, bool SpelledAsLValue=true) const
Return the uniqued reference to the type for an lvalue reference to the specified type...
Decl - This represents one declaration (or definition), e.g.
TagDecl * getDecl() const
ObjCObjectTypeBitfields ObjCObjectTypeBits
const RecordType * getAsStructureType() const
Defines the C++ template declaration subclasses.
Represents a C++11 auto or C++14 decltype(auto) type.
QualType desugar() const
Remove a single level of sugar.
void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Ctx)
ObjCTypeParamList * getTypeParamList() const
Retrieve the type parameters of this class.
static ElaboratedTypeKeyword getKeywordForTagTypeKind(TagTypeKind Tag)
Converts a TagTypeKind into an elaborated type keyword.
QualType getBlockPointerType(QualType T) const
Return the uniqued reference to the type for a block of the specified type.
The base class of the type hierarchy.
CanThrowResult canThrow(const ASTContext &Ctx) const
Determine whether this function type has a non-throwing exception specification.
Represents an array type, per C99 6.7.5.2 - Array Declarators.
bool isObjCBoxableRecordType() const
const ObjCObjectPointerType * getAsObjCInterfacePointerType() const
DependentDecltypeType(const ASTContext &Context, Expr *E)
const TargetInfo & getTargetInfo() const
RefQualifierKind RefQualifier
QualType getValueType() const
Gets the type contained by this atomic type, i.e.
bool isCARCBridgableType() const
Determine whether the given type T is a "bridgeable" C type.
bool isUnspecialized() const
Determine whether this object type is "unspecialized", meaning that it has no type arguments...
Linkage getLinkage() const
Determine the linkage of this type.
QualType getAtomicType(QualType T) const
Return the uniqued reference to the atomic type for the specified type.
A template template parameter that has been substituted for some other template name.
QualType getElementType() const
bool isCompleteDefinition() const
isCompleteDefinition - Return true if this decl has its body fully specified.
const RecordType * getAsUnionType() const
NOTE: getAs*ArrayType are methods on ASTContext.
QualType withFastQualifiers(unsigned TQs) const
static CachedProperties computeCachedProperties(const Type *T)
bool isTrivialType(const ASTContext &Context) const
Return true if this is a trivial type per (C++0x [basic.types]p9)
bool isUnsignedIntegerType() const
Return true if this is an integer type that is unsigned, according to C99 6.2.5p6 [which returns true...
bool isStructureType() const
bool isEnumeralType() const
bool isFixed() const
Returns true if this is an Objective-C, C++11, or Microsoft-style enumeration with a fixed underlying...
const T * getAs() const
Member-template getAs<specific type>'.
Extra information about a function prototype.
const ArrayType * castAsArrayTypeUnsafe() const
A variant of castAs<> for array type which silently discards qualifiers from the outermost type...
void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Context, bool Canonical) const
Produce a unique representation of the given statement.
The "__interface" keyword.
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 ...
bool isChar32Type() const
bool isCallingConv() const
Describes how types, statements, expressions, and declarations should be printed. ...
LinkageInfo computeTypeLinkageInfo(const Type *T)
bool hasDefinition() 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...
bool isStandardLayoutType() const
Test if this type is a standard-layout type.
The collection of all-type qualifiers we support.
bool isVariableArrayType() const
bool isSugared() const
Returns whether this type directly provides sugar.
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.
void Profile(llvm::FoldingSetNodeID &ID)
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.
IdentifierInfo * getIdentifier() const
getIdentifier - Get the identifier that names this declaration, if there is one.
RecordDecl - Represents a struct/union/class.
QualType getSubstTemplateTypeParmType(const TemplateTypeParmType *Replaced, QualType Replacement) const
Retrieve a substitution-result type.
QualType getOriginalType() const
bool isWideCharType() const
FunctionType::ExtInfo ExtInfo
One of these records is kept for each identifier that is lexed.
TargetCXXABI getCXXABI() const
Get the C++ ABI currently in use.
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...
QualType IgnoreParens() const
Returns the specified type after dropping any outer-level parentheses.
Represents a class type in Objective C.
bool isObjCIndependentClassType() const
QualType getPointeeType() const
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
bool isStdByteType() const
ArrayRef< QualType > getParamTypes() const
bool isObjCLifetimeType() const
Returns true if objects of this type have lifetime semantics under ARC.
static bool anyDependentTemplateArguments(ArrayRef< TemplateArgumentLoc > Args, bool &InstantiationDependent)
Determine whether any of the given template arguments are dependent.
bool isSpelledAsLValue() const
FieldDecl - An instance of this class is created by Sema::ActOnField to represent a member of a struc...
bool isCanonicalUnqualified() const
Determines if this type would be canonical if it had no further qualification.
Defines the ExceptionSpecificationType enumeration and various utility functions. ...
NoexceptResult
Result type of getNoexceptSpec().
const ObjCObjectPointerType * getAsObjCQualifiedIdType() const
bool isReferenceType() const
qual_iterator qual_begin() const
const AstTypeMatcher< TypedefType > typedefType
Matches typedef types.
const ObjCObjectPointerType * stripObjCKindOfTypeAndQuals(const ASTContext &ctx) const
Strip off the Objective-C "kindof" type and (with it) any protocol qualifiers.
Values of this type can be null.
void Profile(llvm::FoldingSetNodeID &ID)
Type(TypeClass tc, QualType canon, bool Dependent, bool InstantiationDependent, bool VariablyModified, bool ContainsUnexpandedParameterPack)
An rvalue reference type, per C++11 [dcl.ref].
bool isMSTypeSpec() const
const ObjCObjectType * getAsObjCQualifiedInterfaceType() 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...
A convenient class for passing around template argument information.
ArrayRef< QualType > getTypeArgs() const
Retrieve the type arguments of this object type (semantically).
bool isTriviallyCopyableType(const ASTContext &Context) const
Return true if this is a trivially copyable type (C++0x [basic.types]p9)
bool hasAddressSpace() const
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified...
const ArrayType * getAsArrayTypeUnsafe() const
A variant of getAs<> for array types which silently discards qualifiers from the outermost type...
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.
const ObjCObjectPointerType * getAsObjCQualifiedClassType() const
bool containsUnexpandedParameterPack() const
Whether this type is or contains an unexpanded parameter pack, used to support C++0x variadic templat...
LangAS getAddressSpace() const
const Type * getClass() const
CXXRecordDecl * getDecl() const
Values of this type can never be null.
Expr * getSizeExpr() const
const Type * getTypePtr() const
Retrieves a pointer to the underlying (unqualified) type.
LinkageInfo getTypeLinkageAndVisibility(const Type *T)
static QualType simpleTransform(ASTContext &ctx, QualType type, F &&f)
Perform a simple type transformation that does not change the semantics of the type.
static unsigned getNumAddressingBits(const ASTContext &Context, QualType ElementType, const llvm::APInt &NumElements)
Determine the number of bits required to address a member of.
Defines the Linkage enumeration and various utility functions.
static TagDecl * getInterestingTagDecl(TagDecl *decl)
bool hasNameForLinkage() const
Is this tag type named, either directly or via being defined in a typedef of this type...
unsigned Half
When true, print the half-precision floating-point type as 'half' instead of '__fp16'.
Represents an Objective-C protocol declaration.
bool isBlockCompatibleObjCPointerType(ASTContext &ctx) const
bool hasTrivialDestructor() const
Determine whether this class has a trivial destructor (C++ [class.dtor]p3)
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.
bool isScalarType() const
void * getAsOpaquePtr() const
Represents an ObjC class declaration.
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.
ObjCInterfaceDecl * getInterface() const
Gets the interface declaration for this object type, if the base type really is an interface...
bool isKindOfType() const
Whether this is a "__kindof" type.
FunctionDecl * SourceDecl
The function whose exception specification this is, for EST_Unevaluated and EST_Uninstantiated.
SplitQualType getSplitDesugaredType() const
QualType getPointeeTypeAsWritten() const
TagType(TypeClass TC, const TagDecl *D, QualType can)
unsigned getNumProtocols() const
Return the number of qualifying protocols in this type, or 0 if there are none.
QualType getElementType() const
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.
Represents an extended vector type where either the type or size is dependent.
This object can be modified without requiring retains or releases.
Defines the clang::Visibility enumeration and various utility functions.
bool isIntegralOrUnscopedEnumerationType() const
Determine whether this type is an integral or unscoped enumeration type.
Represents a K&R-style 'int foo()' function, which has no information available about its arguments...
Provides definitions for the various language-specific address spaces.
bool isSpecializedAsWritten() const
Determine whether this object type was written with type arguments.
QualType getBaseType() const
Gets the base type of this object type.
static void ensure(const Type *T)
bool acceptsObjCTypeParams() const
Determines if this is an ObjC interface type that may accept type parameters.
bool containsUnexpandedParameterPack() const
Determines whether this template name contains an unexpanded parameter pack (for C++0x variadic templ...
bool isPromotableIntegerType() const
More type predicates useful for type checking/promotion.
CXXRecordDecl * getMostRecentDecl()
CXXRecordDecl * getAsCXXRecordDecl() const
Retrieves the CXXRecordDecl that this type refers to, either because the type is a RecordType or beca...
Represents a prototype with parameter type info, e.g.
const ObjCObjectType * getSuperClassType() const
Retrieve the superclass type.
static bool KeywordIsTagTypeKind(ElaboratedTypeKeyword Keyword)
QualType applyObjCProtocolQualifiers(QualType type, ArrayRef< ObjCProtocolDecl *> protocols, bool &hasError, bool allowOnPointerType=false) const
Apply Objective-C protocol qualifiers to the given type.
bool isComplexType() const
isComplexType() does not include complex integers (a GCC extension).
ArraySizeModifier
Capture whether this is a normal array (e.g.
QuantityType getQuantity() const
getQuantity - Get the raw integer representation of this quantity.
Defines the TargetCXXABI class, which abstracts details of the C++ ABI that we're targeting...
QualType getElementType() const
IdentifierInfo * getIdentifier() const
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.
Expr - This represents one expression.
Defines the clang::LangOptions interface.
The "typename" keyword precedes the qualified type name, e.g., typename T::type.
const FunctionProtoType * T
bool isObjCARCImplicitlyUnretainedType() const
Determines if this type, which must satisfy isObjCLifetimeType(), is implicitly __unsafe_unretained r...
const CXXRecordDecl * getPointeeCXXRecordDecl() const
If this is a pointer or reference to a RecordType, return the CXXRecordDecl that that type refers to...
const IdentifierInfo * getBaseTypeIdentifier() const
Retrieves a pointer to the name of the base type.
const T * castAs() const
Member-template castAs<specific type>.
ElaboratedTypeKeyword
The elaboration keyword that precedes a qualified type name or introduces an elaborated-type-specifie...
bool isObjCRetainableType() const
const internal::VariadicAllOfMatcher< Decl > decl
Matches declarations.
QualType getParenType(QualType NamedType) const
ObjCSubstitutionContext
The kind of type we are substituting Objective-C type arguments into.
bool isChar16Type() const
const char * getTypeClassName() const
Linkage getLinkage() const
ObjCLifetime getObjCLifetime() const
DeclContext * getDeclContext()
bool isObjCIdType() const
True if this is equivalent to the 'id' type, i.e.
bool isAnyComplexType() const
void Profile(llvm::FoldingSetNodeID &ID)
static TagTypeKind getTagTypeKindForTypeSpec(unsigned TypeSpec)
Converts a type specifier (DeclSpec::TST) into a tag type kind.
ObjCObjectType(QualType Canonical, QualType Base, ArrayRef< QualType > typeArgs, ArrayRef< ObjCProtocolDecl *> protocols, bool isKindOf)
ScalarTypeKind getScalarTypeKind() const
Given that this is a scalar type, classify it.
Represents a C++ template name within the type system.
Represents the type decltype(expr) (C++11).
A std::pair-like structure for storing a qualified type split into its local qualifiers and its local...
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.
QualType desugar() const
Remove a single level of sugar.
bool isFunctionOrMethod() const
static Optional< NullabilityKind > stripOuterNullability(QualType &T)
Strip off the top-level nullability annotation on the given type, if it's there.
TagDecl * getAsTagDecl() const
Retrieves the TagDecl that this type refers to, either because the type is a TagType or because it is...
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...
Qualifiers Quals
The local qualifiers.
bool isSpecifierType() const
Returns true if this type can be represented by some set of type specifiers.
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...
#define TRIVIAL_TYPE_CLASS(Class)
bool isObjCInertUnsafeUnretainedType() const
Was this type written with the special inert-in-MRC __unsafe_unretained qualifier?
bool hasInstantiationDependentExceptionSpec() const
Return whether this function has an instantiation-dependent exception spec.
A helper class for Type nodes having an ElaboratedTypeKeyword.
QualType getObjCInterfaceType(const ObjCInterfaceDecl *Decl, ObjCInterfaceDecl *PrevDecl=nullptr) const
getObjCInterfaceType - Return the unique reference to the type for the specified ObjC interface decl...
QualType getFunctionType(QualType ResultTy, ArrayRef< QualType > Args, const FunctionProtoType::ExtProtoInfo &EPI) const
Return a normal function type with a typed argument list.
Represents a GCC generic vector type.
ArraySizeModifier getSizeModifier() const
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...
const Type * getBaseElementTypeUnsafe() const
Get the base element type of this type, potentially discarding type qualifiers.
The result type of a method or function.
IdentifierInfo * getNSObjectName()
Retrieve the identifier 'NSObject'.
bool isNull() const
Return true if this QualType doesn't point to a type yet.
bool hasAutoForTrailingReturnType() const
Determine whether this type was written with a leading 'auto' corresponding to a trailing return type...
CallingConv
CallingConv - Specifies the calling convention that a function uses.
static LinkageInfo external()
Expr * getUnderlyingExpr() const
bool isVoidPointerType() const
bool isConstQualified() const
Determine whether this type is const-qualified.
IdentifierInfo * getNSCopyingName()
Retrieve the identifier 'NSCopying'.
QualType getAutoType(QualType DeducedType, AutoTypeKeyword Keyword, bool IsDependent) const
C++11 deduced auto type.
bool hasTrailingReturn() const
SplitQualType split() const
Divides a QualType into its unqualified type and a set of local qualifiers.
RecordDecl * getDecl() const
LinkageInfo getLinkageAndVisibility() const
Determine the linkage and visibility of this type.
unsigned Bool
Whether we can use 'bool' rather than '_Bool' (even if the language doesn't actually have 'bool'...
bool isStructureOrClassType() 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.
bool containsUnexpandedParameterPack() const
Whether this nested-name-specifier contains an unexpanded parameter pack (for C++11 variadic template...
Assigning into this object requires the old value to be released and the new value to be retained...
QualType getCanonicalType() const
ExceptionSpecificationType Type
The kind of exception specification this is.
bool isInstantiationDependent() const
Whether this expression is instantiation-dependent, meaning that it depends in some way on a template...
param_type_range param_types() const
bool isSpecialized() const
Determine whether this object type is "specialized", meaning that it has type arguments.
ExtProtoInfo getExtProtoInfo() const
redecl_range redecls() const
Returns an iterator range for all the redeclarations of the same decl.
const ExtParameterInfo * ExtParameterInfos
Encodes a location in the source.
Sugar for parentheses used when specifying types.
QualType getAdjustedType() const
QualType getReturnType() const
bool isLinkageValid() const
True if the computed linkage is valid.
A helper class that allows the use of isa/cast/dyncast to detect TagType objects of enums...
LangAS getAddressSpace() const
Return the address space of this type.
QualType getSingleStepDesugaredType(const ASTContext &Context) const
Return the specified type with one level of "sugar" removed from the type.
Interfaces are the core concept in Objective-C for object oriented design.
bool isVariablyModifiedType() const
Whether this type is a variably-modified type (C99 6.7.5).
bool isObjCQualifiedClassType() const
True if this is equivalent to 'Class.
const ComplexType * getAsComplexIntegerType() const
bool isLiteralType(const ASTContext &Ctx) const
Return true if this is a literal type (C++11 [basic.types]p10)
TagDecl - Represents the declaration of a struct/union/class/enum.
TemplateArgument getArgumentPack() const
ASTContext & getASTContext() const LLVM_READONLY
QualType getElementType() const
QualType getBaseElementType(const ArrayType *VAT) const
Return the innermost element type of an array type.
bool isIntegralType(const ASTContext &Ctx) const
Determine whether this type is an integral type.
QualType getLocallyUnqualifiedSingleStepDesugaredType() const
Pull a single level of sugar off of this locally-unqualified type.
void initialize(ArrayRef< ObjCProtocolDecl * > protocols)
QualType getExtVectorType(QualType VectorType, unsigned NumElts) const
Return the unique reference to an extended vector type of the specified element type and size...
Represents a C++ nested name specifier, such as "\::std::vector<int>::".
const ArrayType * getAsArrayType(QualType T) const
Type Query functions.
ObjCCategoryDecl - Represents a category declaration.
unsigned pack_size() const
The number of template arguments in the given template argument pack.
bool isSignedIntegerOrEnumerationType() const
Determines whether this is an integer type that is signed or an enumeration types whose underlying ty...
QualType getEquivalentType() const
void Profile(llvm::FoldingSetNodeID &ID)
bool isValueDependent() const
isValueDependent - Determines whether this expression is value-dependent (C++ [temp.dep.constexpr]).
QualType getInnerType() const
bool isObjCObjectPointerType() const
AutoTypeKeyword getKeyword() const
TypeClass getTypeClass() const
QualType getAttributedType(AttributedType::Kind attrKind, QualType modifiedType, QualType equivalentType)
bool isAnyCharacterType() const
Determine whether this type is any of the built-in character types.
QualType getSuperClassType() const
Retrieve the type of the superclass of this object type.
EnumDecl * getDecl() const
bool isVectorType() const
bool hasConstFields() const
Recursively check all fields in the record for const-ness.
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)
DependentTemplateName * getAsDependentTemplateName() const
Retrieve the underlying dependent template name structure, if any.
TypeOfExprType(Expr *E, QualType can=QualType())
bool isInstantiationDependentType() const
Determine whether this type is an instantiation-dependent type, meaning that the type involves a temp...
Linkage getLinkageInternal() const
Determine what kind of linkage this entity has.
Represents a pointer type decayed from an array or function type.
Represents a pack expansion of types.
ArrayRef< TemplateArgument > pack_elements() const
Iterator range referencing all of the elements of a template argument pack.
Defines various enumerations that describe declaration and type specifiers.
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.
CXXRecordDecl * getMostRecentCXXRecordDecl() const
Represents a template argument.
Represents a type which was implicitly adjusted by the semantic engine for arbitrary reasons...
TagTypeKind
The kind of a tag type.
QualType getDecayedType(QualType T) const
Return the uniqued reference to the decayed version of the given type.
CanQualType ObjCBuiltinIdTy
Dataflow Directional Tag Classes.
bool isObjCQualifiedInterfaceType() const
DeducedType * getContainedDeducedType() const
Get the DeducedType whose type will be deduced for a variable with an initializer of this type...
ExtInfo getExtInfo() const
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...
void setContainsUnexpandedParameterPack(bool PP=true)
The base class of all kinds of template declarations (e.g., class, function, etc.).
bool hasUnnamedOrLocalType() const
Whether this type is or contains a local or unnamed type.
static CachedProperties get(QualType T)
bool hasDependentExceptionSpec() const
Return whether this function has a dependent exception spec.
bool isObjCClassType() const
True if this is equivalent to the 'Class' type, i.e.
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 isDependent() const
Whether this nested name specifier refers to a dependent type or not.
QualType stripObjCKindOfType(const ASTContext &ctx) const
Strip Objective-C "__kindof" types from the given type.
QualType getUnderlyingType() 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)
VectorKind getVectorKind() const
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 getFunctionNoProtoType(QualType ResultTy, const FunctionType::ExtInfo &Info) const
Return a K&R style C function type like 'int()'.
void Profile(llvm::FoldingSetNodeID &ID)
void Profile(llvm::FoldingSetNodeID &ID)
bool isObjCIndirectLifetimeType() const
const ObjCObjectType * getObjectType() const
Gets the type pointed to by this ObjC pointer.
The "class" keyword introduces the elaborated-type-specifier.
bool isKindOfType() const
Whether this ia a "__kindof" type (semantically).
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.
A pointer to member type per C++ 8.3.3 - Pointers to members.
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...
bool hasObjCLifetime() const
bool isAggregateType() const
Determines whether the type is a C++ aggregate type or C aggregate or union type. ...
bool isQualifier() const
Does this attribute behave like a type qualifier?
llvm::ArrayRef< TemplateArgumentLoc > arguments() const
QualType apply(const ASTContext &Context, QualType QT) const
Apply the collected qualifiers to the given type.
pack_iterator pack_begin() const
Iterator referencing the first argument of a template argument pack.
const TemplateTypeParmType * getReplacedParameter() const
Gets the template parameter that was substituted for.
void addConsistentQualifiers(Qualifiers qs)
Add the qualifiers from the given set to this set, given that they don't conflict.
QualType getModifiedType() const
Represents a pointer to an Objective C object.
bool isSugared() const
Returns whether this type directly provides sugar.
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.
unsigned getIndexTypeCVRQualifiers() const
bool isConstantSizeType() const
Return true if this is not a variable sized type, according to the rules of C99 6.7.5p3.
ObjCInterfaceDecl * getInterfaceDecl() const
If this pointer points to an Objective @interface type, gets the declaration for that interface...
QualType getCanonicalTypeInternal() const
QualType getAtomicUnqualifiedType() const
Remove all qualifiers including _Atomic.
bool isIntegerType() const
isIntegerType() does not include complex integers (a GCC extension).
const llvm::APInt & getSize() const
VectorTypeBitfields VectorTypeBits
ExtVectorType - Extended vector type.
Base for LValueReferenceType and RValueReferenceType.
SourceRange getBracketsRange() const
The template argument is a type.
ExceptionSpecificationType
The various types of exception specifications that exist in C++11.
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...
Optional< NullabilityKind > getNullability(const ASTContext &context) const
Determine the nullability of the given type.
QualType getNonLValueExprType(const ASTContext &Context) const
Determine the type of a (typically non-lvalue) expression with the specified result type...
bool isBeingDefined() const
Determines whether this type is in the process of being defined.
char __ovld __cnfn max(char x, char y)
Returns y if x < y, otherwise it returns x.
uint64_t getTypeSize(QualType T) const
Return the size of the specified (complete) type T, in bits.
ArrayRef< QualType > Exceptions
Explicitly-specified list of exception types.
void merge(LinkageInfo other)
Merge both linkage and visibility.
bool isIncompleteType(NamedDecl **Def=nullptr) const
Types are partitioned into 3 broad categories (C99 6.2.5p1): object types, function types...
bool hasObjCGCAttr() const
TypedefNameDecl * getDecl() const
Reading or writing from this object requires a barrier call.
Expr * NoexceptExpr
Noexcept expression, if this is EST_ComputedNoexcept.
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 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.
Represents a C++ struct/union/class.
Represents a template specialization type whose template cannot be resolved, e.g. ...
QualType getRValueReferenceType(QualType T) const
Return the uniqued reference to the type for an rvalue reference to the specified type...
Represents a C array with an unspecified size.
QualType stripObjCKindOfTypeAndQuals(const ASTContext &ctx) const
Strip off the Objective-C "kindof" type and (with it) any protocol qualifiers.
bool hasIntegerRepresentation() const
Determine whether this type has an integer representation of some sort, e.g., it is an integer type o...
The parameter type of a method or function.
QualType getNamedType() const
Retrieve the type named by the qualified-id.
QualType getReplacementType() const
Gets the type that was substituted for the template parameter.
bool containsUnexpandedParameterPack() const
Whether this expression contains an unexpanded parameter pack (for C++11 variadic templates)...
void Profile(llvm::FoldingSetNodeID &ID)
Qualifiers::ObjCLifetime getObjCARCImplicitLifetime() const
Return the implicit lifetime for this type, which must not be dependent.
Stores a list of Objective-C type parameters for a parameterized class or a category/extension thereo...
QualType getPointerType(QualType T) const
Return the uniqued reference to the type for a pointer to the specified type.
This class is used for builtin types like 'int'.
Defines the clang::TargetInfo interface.
bool isComplexIntegerType() const
ASTContext & getParentASTContext() const
bool isMicrosoft() const
Is this ABI an MSVC-compatible ABI?
static Decl::Kind getKind(const Decl *D)
unsigned getNumElements() const
QualType getSuperClassType() const
Retrieve the type of the superclass of this object pointer type.
bool isDependentType() const
Whether this type is a dependent type, meaning that its definition somehow depends on a template para...
Represents a type template specialization; the template must be a class template, a type alias templa...
bool isPointerType() const
CharUnits getTypeSizeInChars(QualType T) const
Return the size of the specified (complete) type T, in characters.
static StringRef getNameForCallConv(CallingConv CC)
bool isFloatingType() const
NoexceptResult getNoexceptSpec(const ASTContext &Ctx) const
Get the meaning of the noexcept spec on this function, if any.
A trivial tuple used to represent a source range.
VectorType(QualType vecType, unsigned nElements, QualType canonType, VectorKind vecKind)
FunctionDecl * getCanonicalDecl() override
Retrieves the "canonical" declaration of the given declaration.
void computeSuperClassTypeSlow() const
NamedDecl - This represents a decl with a name.
QualType getObjCObjectPointerType(QualType OIT) const
Return a ObjCObjectPointerType type for the given ObjCObjectType.
Represents a C array with a specified size that is not an integer-constant-expression.
No keyword precedes the qualified type name.
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 isConstant(const ASTContext &Ctx) const
bool isInterfaceType() const
void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Context)
const LangOptions & getLangOpts() const
unsigned size() const
Determine the number of type parameters in this list.
llvm::Optional< NullabilityKind > getImmediateNullability() const
The "__interface" keyword introduces the elaborated-type-specifier.
The superclass of a type.
Represents the canonical version of C arrays with a specified constant size.
ExceptionSpecInfo ExceptionSpec
QualType getAdjustedType(QualType Orig, QualType New) const
Return the uniqued reference to a type adjusted from the original type to a new type.
bool isObjCNSObjectType() const
bool hasSizedVLAType() const
Whether this type involves a variable-length array type with a definite size.
QualType getPointeeType() const
A single template declaration.
bool isBeingDefined() const
isBeingDefined - Return true if this decl is currently being defined.
static QualType getParamType(Sema &SemaRef, ArrayRef< ResultCandidate > Candidates, unsigned N)
Get the type of the Nth parameter from a given set of overload candidates.
QualType getComplexType(QualType T) const
Return the uniqued reference to the type for a complex number with the specified element type...
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...
CanQualType getSizeType() const
Return the unique type for "size_t" (C99 7.17), defined in <stddef.h>.
Qualifiers::ObjCLifetime getObjCLifetime() const
Returns lifetime attribute of this type.
QualType getPointeeType() const
Gets the type pointed to by this ObjC pointer.