17 #ifndef LLVM_CLANG_AST_TYPE_H 18 #define LLVM_CLANG_AST_TYPE_H 32 #include "llvm/ADT/APInt.h" 33 #include "llvm/ADT/APSInt.h" 34 #include "llvm/ADT/ArrayRef.h" 35 #include "llvm/ADT/FoldingSet.h" 36 #include "llvm/ADT/None.h" 37 #include "llvm/ADT/Optional.h" 38 #include "llvm/ADT/PointerIntPair.h" 39 #include "llvm/ADT/PointerUnion.h" 40 #include "llvm/ADT/StringRef.h" 41 #include "llvm/ADT/Twine.h" 42 #include "llvm/ADT/iterator_range.h" 43 #include "llvm/Support/Casting.h" 44 #include "llvm/Support/Compiler.h" 45 #include "llvm/Support/ErrorHandling.h" 46 #include "llvm/Support/PointerLikeTypeTraits.h" 47 #include "llvm/Support/type_traits.h" 48 #include "llvm/Support/TrailingObjects.h" 54 #include <type_traits> 102 template <
typename>
class CanQual;
107 class ExtQualsTypeCommonBase;
109 class IdentifierInfo;
111 class ObjCInterfaceDecl;
112 class ObjCProtocolDecl;
113 class ObjCTypeParamDecl;
114 struct PrintingPolicy;
118 class TemplateArgument;
119 class TemplateArgumentListInfo;
120 class TemplateArgumentLoc;
121 class TemplateTypeParmDecl;
122 class TypedefNameDecl;
123 class UnresolvedUsingTypenameDecl;
128 #define TYPE(Class, Base) class Class##Type; 129 #include "clang/AST/TypeNodes.def" 143 CVRMask = Const | Volatile | Restrict
177 MaxAddressSpace = 0x7fffffu,
183 FastMask = (1 << FastWidth) - 1
190 if (!(L.Mask & ~CVRMask) && !(R.Mask & ~CVRMask)) {
192 Q.Mask = L.Mask & R.Mask;
274 assert(!(mask & ~CVRMask) &&
"bitmask contains non-CVR bits");
275 Mask = (Mask & ~CVRMask) | mask;
278 assert(!(mask & ~CVRMask) &&
"bitmask contains non-CVR bits");
282 removeCVRQualifiers(CVRMask);
285 assert(!(mask & ~CVRMask) &&
"bitmask contains non-CVR bits");
289 assert(!(mask & ~CVRMask & ~UMask) &&
"bitmask contains non-CVRU bits");
295 Mask = (Mask & ~UMask) | (flag ? UMask : 0);
303 Mask = (Mask & ~GCAttrMask) | (type << GCAttrShift);
328 return ObjCLifetime((Mask & LifetimeMask) >> LifetimeShift);
331 Mask = (Mask & ~LifetimeMask) | (type << LifetimeShift);
336 assert(!hasObjCLifetime());
337 Mask |= (type << LifetimeShift);
343 return (lifetime > OCL_ExplicitNone);
349 return (lifetime == OCL_Strong || lifetime == OCL_Weak);
354 return static_cast<LangAS>(Mask >> AddressSpaceShift);
361 auto Addr = getAddressSpace();
374 assert((
unsigned)space <= MaxAddressSpace);
375 Mask = (Mask & ~AddressSpaceMask)
376 | (((uint32_t) space) << AddressSpaceShift);
381 setAddressSpace(space);
389 assert(!(mask & ~FastMask) &&
"bitmask contains non-fast qualifier bits");
390 Mask = (Mask & ~FastMask) | mask;
393 assert(!(mask & ~FastMask) &&
"bitmask contains non-fast qualifier bits");
397 removeFastQualifiers(FastMask);
400 assert(!(mask & ~FastMask) &&
"bitmask contains non-fast qualifier bits");
415 bool empty()
const {
return !Mask; }
421 if (!(Q.Mask & ~CVRMask))
424 Mask |= (Q.Mask & CVRMask);
438 if (!(Q.Mask & ~CVRMask))
441 Mask &= ~(Q.Mask & CVRMask);
445 removeObjCLifetime();
447 removeAddressSpace();
481 return isAddressSpaceSupersetOf(getAddressSpace(), other.
getAddressSpace());
488 return isAddressSpaceSupersetOf(other) &&
491 (getObjCGCAttr() == other.
getObjCGCAttr() || !hasObjCGCAttr() ||
496 (((Mask & CVRMask) | (other.Mask & CVRMask)) == (Mask & CVRMask)) &&
512 if (getObjCLifetime() == OCL_Weak || other.
getObjCLifetime() == OCL_Weak)
515 if (getObjCLifetime() == OCL_None || other.
getObjCLifetime() == OCL_None)
523 bool isStrictSupersetOf(
Qualifiers Other)
const;
528 explicit operator bool()
const {
return hasQualifiers(); }
558 bool appendSpaceIfNonEmpty =
false)
const;
569 static const uint32_t UMask = 0x8;
570 static const uint32_t UShift = 3;
571 static const uint32_t GCAttrMask = 0x30;
572 static const uint32_t GCAttrShift = 4;
573 static const uint32_t LifetimeMask = 0x1C0;
574 static const uint32_t LifetimeShift = 6;
575 static const uint32_t AddressSpaceMask =
576 ~(CVRMask | UMask | GCAttrMask | LifetimeMask);
577 static const uint32_t AddressSpaceShift = 9;
595 std::pair<const Type *,Qualifiers>
asPair()
const {
596 return std::pair<const Type *, Qualifiers>(Ty, Quals);
647 llvm::PointerIntPair<llvm::PointerUnion<const Type *, const ExtQuals *>,
650 const ExtQuals *getExtQualsUnsafe()
const {
651 return Value.getPointer().get<
const ExtQuals*>();
654 const Type *getTypePtrUnsafe()
const {
655 return Value.getPointer().get<
const Type*>();
659 assert(!isNull() &&
"Cannot retrieve a NULL type pointer");
660 auto CommonPtrVal =
reinterpret_cast<uintptr_t>(Value.getOpaqueValue());
677 const Type *getTypePtr()
const;
679 const Type *getTypePtrOrNull()
const;
692 T.Value.setFromOpaqueValue(const_cast<void*>(Ptr));
697 return *getTypePtr();
704 bool isCanonical()
const;
705 bool isCanonicalAsParam()
const;
709 return Value.getPointer().isNull();
720 bool isConstQualified()
const;
730 bool isRestrictQualified()
const;
740 bool isVolatileQualified()
const;
746 return getLocalFastQualifiers() || hasLocalNonFastQualifiers();
750 bool hasQualifiers()
const;
756 return Value.getPointer().is<
const ExtQuals*>();
771 return getLocalFastQualifiers();
776 unsigned getCVRQualifiers()
const;
783 bool isPODType(
const ASTContext &Context)
const;
787 bool isCXX98PODType(
const ASTContext &Context)
const;
793 bool isCXX11PODType(
const ASTContext &Context)
const;
796 bool isTrivialType(
const ASTContext &Context)
const;
799 bool isTriviallyCopyableType(
const ASTContext &Context)
const;
803 bool mayBeDynamicClass()
const;
806 bool mayBeNotDynamicClass()
const;
836 return withFastQualifiers(CVR);
841 &&
"non-fast qualifier bits set in mask!");
842 Value.setInt(Value.getInt() | TQs);
845 void removeLocalConst();
846 void removeLocalVolatile();
847 void removeLocalRestrict();
848 void removeLocalCVRQualifiers(
unsigned Mask);
853 Value.setInt(Value.getInt() & ~Mask);
902 inline QualType getUnqualifiedType()
const;
917 bool isMoreQualifiedThan(
QualType Other)
const;
921 bool isAtLeastAsQualifiedAs(
QualType Other)
const;
923 QualType getNonReferenceType()
const;
944 return getDesugaredType(*
this, Context);
948 return getSplitDesugaredType(*
this);
957 return getSingleStepDesugaredTypeImpl(*
this, Context);
963 if (isa<ParenType>(*
this))
970 return LHS.Value == RHS.Value;
973 return LHS.Value != RHS.Value;
987 const Twine &PlaceHolder = Twine(),
988 unsigned Indentation = 0)
const;
992 unsigned Indentation = 0) {
993 return print(split.
Ty, split.
Quals, OS, policy, PlaceHolder, Indentation);
998 const Twine &PlaceHolder,
999 unsigned Indentation = 0);
1001 void getAsStringInternal(std::string &Str,
1006 return getAsStringInternal(split.
Ty, split.
Quals, out, policy);
1016 const Twine &PlaceHolder;
1017 unsigned Indentation;
1021 const Twine &PlaceHolder,
unsigned Indentation)
1022 : T(T), Policy(Policy), PlaceHolder(PlaceHolder),
1023 Indentation(Indentation) {}
1027 SQT.T.
print(OS, SQT.Policy, SQT.PlaceHolder, SQT.Indentation);
1033 const Twine &PlaceHolder = Twine(),
1034 unsigned Indentation = 0)
const {
1038 void dump(
const char *s)
const;
1040 void dump(llvm::raw_ostream &OS)
const;
1043 ID.AddPointer(getAsOpaquePtr());
1047 inline LangAS getAddressSpace()
const;
1076 bool isNonWeakInMRRWithObjCWeak(
const ASTContext &Context)
const;
1102 isNonTrivialToPrimitiveDefaultInitialize()
const;
1150 DK_nontrivial_c_struct
1158 return isDestructedTypeImpl(*
this);
1165 bool hasNonTrivialToPrimitiveDefaultInitializeCUnion()
const;
1170 bool hasNonTrivialToPrimitiveDestructCUnion()
const;
1175 bool hasNonTrivialToPrimitiveCopyCUnion()
const;
1187 bool isCForbiddenLValueType()
const;
1235 QualType getAtomicUnqualifiedType()
const;
1251 static bool hasNonTrivialToPrimitiveDefaultInitializeCUnion(
const RecordDecl *RD);
1252 static bool hasNonTrivialToPrimitiveDestructCUnion(
const RecordDecl *RD);
1253 static bool hasNonTrivialToPrimitiveCopyCUnion(
const RecordDecl *RD);
1282 enum { NumLowBitsAvailable = 0 };
1302 const Type *
const BaseType;
1308 : BaseType(baseType), CanonicalType(canon) {}
1344 canon.isNull() ?
QualType(this_(), 0) : canon),
1347 &&
"ExtQuals created with no fast qualifiers");
1349 &&
"ExtQuals created with fast qualifiers");
1369 Profile(ID, getBaseType(), Quals);
1373 const Type *BaseType,
1376 ID.AddPointer(BaseType);
1436 #define TYPE(Class, Base) Class, 1437 #define LAST_TYPE(Class) TypeLast = Class, 1438 #define ABSTRACT_TYPE(Class, Base) 1439 #include "clang/AST/TypeNodes.def" 1440 TagFirst = Record, TagLast = Enum
1445 class TypeBitfields {
1453 unsigned Dependent : 1;
1457 unsigned InstantiationDependent : 1;
1460 unsigned VariablyModified : 1;
1464 unsigned ContainsUnexpandedParameterPack : 1;
1468 mutable unsigned CacheValid : 1;
1471 mutable unsigned CachedLinkage : 3;
1474 mutable unsigned CachedLocalOrUnnamed : 1;
1477 mutable unsigned FromAST : 1;
1479 bool isCacheValid()
const {
1484 assert(isCacheValid() &&
"getting linkage from invalid cache");
1485 return static_cast<Linkage>(CachedLinkage);
1488 bool hasLocalOrUnnamedType()
const {
1489 assert(isCacheValid() &&
"getting linkage from invalid cache");
1490 return CachedLocalOrUnnamed;
1493 enum { NumTypeBits = 18 };
1502 unsigned : NumTypeBits;
1506 unsigned IndexTypeQuals : 3;
1511 unsigned SizeModifier : 3;
1517 unsigned : NumTypeBits;
1530 unsigned : NumTypeBits;
1534 unsigned ExtInfo : 12;
1539 unsigned RefQualifier : 2;
1549 unsigned HasExtQuals : 1;
1555 unsigned NumParams : 16;
1558 unsigned ExceptionSpecType : 4;
1561 unsigned HasExtParameterInfos : 1;
1564 unsigned Variadic : 1;
1567 unsigned HasTrailingReturn : 1;
1573 unsigned : NumTypeBits;
1576 unsigned NumTypeArgs : 7;
1579 unsigned NumProtocols : 6;
1582 unsigned IsKindOf : 1;
1588 unsigned : NumTypeBits;
1601 unsigned SpelledAsLValue : 1;
1605 unsigned InnerRef : 1;
1611 unsigned : NumTypeBits;
1614 unsigned Keyword : 8;
1617 enum { NumTypeWithKeywordBits = 8 };
1622 unsigned : NumTypeBits;
1623 unsigned : NumTypeWithKeywordBits;
1626 unsigned HasOwnedTagDecl : 1;
1633 unsigned : NumTypeBits;
1637 unsigned VecKind : 3;
1640 unsigned NumElements : 29 - NumTypeBits;
1642 enum { MaxNumElements = (1 << (29 - NumTypeBits)) - 1 };
1648 unsigned : NumTypeBits;
1651 unsigned AttrKind : 32 - NumTypeBits;
1657 unsigned : NumTypeBits;
1661 unsigned Keyword : 2;
1667 unsigned : NumTypeBits;
1682 unsigned : NumTypeBits;
1685 unsigned TypeAlias : 1;
1700 unsigned : NumTypeBits;
1701 unsigned : NumTypeWithKeywordBits;
1716 unsigned : NumTypeBits;
1729 unsigned NumExpansions;
1750 static_assert(
sizeof(TypeBitfields) <= 8,
1751 "TypeBitfields is larger than 8 bytes!");
1753 "ArrayTypeBitfields is larger than 8 bytes!");
1755 "AttributedTypeBitfields is larger than 8 bytes!");
1757 "AutoTypeBitfields is larger than 8 bytes!");
1759 "BuiltinTypeBitfields is larger than 8 bytes!");
1761 "FunctionTypeBitfields is larger than 8 bytes!");
1763 "ObjCObjectTypeBitfields is larger than 8 bytes!");
1765 "ReferenceTypeBitfields is larger than 8 bytes!");
1767 "TypeWithKeywordBitfields is larger than 8 bytes!");
1769 "ElaboratedTypeBitfields is larger than 8 bytes!");
1771 "VectorTypeBitfields is larger than 8 bytes!");
1773 "SubstTemplateTypeParmPackTypeBitfields is larger" 1776 "TemplateSpecializationTypeBitfields is larger" 1779 "DependentTemplateSpecializationTypeBitfields is larger" 1782 "PackExpansionTypeBitfields is larger than 8 bytes");
1789 void setFromAST(
bool V =
true)
const {
1790 TypeBits.FromAST =
V;
1797 bool InstantiationDependent,
bool VariablyModified,
1798 bool ContainsUnexpandedParameterPack)
1800 canon.isNull() ?
QualType(this_(), 0) : canon) {
1802 TypeBits.Dependent = Dependent;
1803 TypeBits.InstantiationDependent = Dependent || InstantiationDependent;
1804 TypeBits.VariablyModified = VariablyModified;
1805 TypeBits.ContainsUnexpandedParameterPack = ContainsUnexpandedParameterPack;
1806 TypeBits.CacheValid =
false;
1807 TypeBits.CachedLocalOrUnnamed =
false;
1809 TypeBits.FromAST =
false;
1816 TypeBits.Dependent = D;
1818 TypeBits.InstantiationDependent =
true;
1822 TypeBits.InstantiationDependent = D; }
1827 TypeBits.ContainsUnexpandedParameterPack = PP;
1836 Type &operator=(
const Type &) =
delete;
1860 return TypeBits.ContainsUnexpandedParameterPack;
1866 return CanonicalType ==
QualType(
this, 0);
1872 QualType getLocallyUnqualifiedSingleStepDesugaredType()
const;
1885 bool isIncompleteType(
NamedDecl **Def =
nullptr)
const;
1890 return !isFunctionType();
1898 return !isReferenceType() && !isFunctionType() && !isVoidType();
1903 bool isLiteralType(
const ASTContext &Ctx)
const;
1907 bool isStandardLayoutType()
const;
1913 bool isBuiltinType()
const;
1916 bool isSpecificBuiltinType(
unsigned K)
const;
1921 bool isPlaceholderType()
const;
1925 bool isSpecificPlaceholderType(
unsigned K)
const;
1929 bool isNonOverloadPlaceholderType()
const;
1933 bool isIntegerType()
const;
1934 bool isEnumeralType()
const;
1937 bool isScopedEnumeralType()
const;
1940 bool isWideCharType()
const;
1941 bool isChar8Type()
const;
1942 bool isChar16Type()
const;
1943 bool isChar32Type()
const;
1944 bool isAnyCharacterType()
const;
1945 bool isIntegralType(
const ASTContext &Ctx)
const;
1948 bool isIntegralOrEnumerationType()
const;
1951 bool isIntegralOrUnscopedEnumerationType()
const;
1954 bool isRealFloatingType()
const;
1957 bool isComplexType()
const;
1958 bool isAnyComplexType()
const;
1959 bool isFloatingType()
const;
1960 bool isHalfType()
const;
1961 bool isFloat16Type()
const;
1962 bool isFloat128Type()
const;
1963 bool isRealType()
const;
1964 bool isArithmeticType()
const;
1965 bool isVoidType()
const;
1966 bool isScalarType()
const;
1967 bool isAggregateType()
const;
1968 bool isFundamentalType()
const;
1969 bool isCompoundType()
const;
1973 bool isFunctionType()
const;
1976 bool isPointerType()
const;
1977 bool isAnyPointerType()
const;
1978 bool isBlockPointerType()
const;
1979 bool isVoidPointerType()
const;
1980 bool isReferenceType()
const;
1981 bool isLValueReferenceType()
const;
1982 bool isRValueReferenceType()
const;
1983 bool isFunctionPointerType()
const;
1984 bool isFunctionReferenceType()
const;
1985 bool isMemberPointerType()
const;
1986 bool isMemberFunctionPointerType()
const;
1987 bool isMemberDataPointerType()
const;
1988 bool isArrayType()
const;
1989 bool isConstantArrayType()
const;
1990 bool isIncompleteArrayType()
const;
1991 bool isVariableArrayType()
const;
1992 bool isDependentSizedArrayType()
const;
1994 bool isClassType()
const;
1995 bool isStructureType()
const;
1996 bool isObjCBoxableRecordType()
const;
1997 bool isInterfaceType()
const;
1998 bool isStructureOrClassType()
const;
1999 bool isUnionType()
const;
2000 bool isComplexIntegerType()
const;
2001 bool isVectorType()
const;
2002 bool isExtVectorType()
const;
2003 bool isDependentAddressSpaceType()
const;
2004 bool isObjCObjectPointerType()
const;
2005 bool isObjCRetainableType()
const;
2006 bool isObjCLifetimeType()
const;
2007 bool isObjCIndirectLifetimeType()
const;
2008 bool isObjCNSObjectType()
const;
2009 bool isObjCIndependentClassType()
const;
2012 bool isObjCObjectType()
const;
2013 bool isObjCQualifiedInterfaceType()
const;
2014 bool isObjCQualifiedIdType()
const;
2015 bool isObjCQualifiedClassType()
const;
2016 bool isObjCObjectOrInterfaceType()
const;
2017 bool isObjCIdType()
const;
2018 bool isDecltypeType()
const;
2026 return hasAttr(attr::ObjCInertUnsafeUnretained);
2036 bool isObjCIdOrObjectKindOfType(
const ASTContext &ctx,
2039 bool isObjCClassType()
const;
2047 bool isObjCClassOrClassKindOfType()
const;
2049 bool isBlockCompatibleObjCPointerType(
ASTContext &ctx)
const;
2050 bool isObjCSelType()
const;
2051 bool isObjCBuiltinType()
const;
2052 bool isObjCARCBridgableType()
const;
2053 bool isCARCBridgableType()
const;
2054 bool isTemplateTypeParmType()
const;
2055 bool isNullPtrType()
const;
2056 bool isAlignValT()
const;
2057 bool isStdByteType()
const;
2058 bool isAtomicType()
const;
2060 #define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \ 2061 bool is##Id##Type() const; 2062 #include "clang/Basic/OpenCLImageTypes.def" 2064 bool isImageType()
const;
2066 bool isSamplerT()
const;
2067 bool isEventT()
const;
2068 bool isClkEventT()
const;
2069 bool isQueueT()
const;
2070 bool isReserveIDT()
const;
2072 #define EXT_OPAQUE_TYPE(ExtType, Id, Ext) \ 2073 bool is##Id##Type() const; 2074 #include "clang/Basic/OpenCLExtensionTypes.def" 2076 bool isOCLIntelSubgroupAVCType()
const;
2077 bool isOCLExtOpaqueType()
const;
2079 bool isPipeType()
const;
2080 bool isOpenCLSpecificType()
const;
2085 bool isObjCARCImplicitlyUnretainedType()
const;
2115 return TypeBits.InstantiationDependent;
2121 bool isUndeducedType()
const;
2128 bool hasSizedVLAType()
const;
2131 bool hasUnnamedOrLocalType()
const;
2133 bool isOverloadableType()
const;
2136 bool isElaboratedTypeSpecifier()
const;
2138 bool canDecayToPointerType()
const;
2143 bool hasPointerRepresentation()
const;
2147 bool hasObjCPointerRepresentation()
const;
2151 bool hasIntegerRepresentation()
const;
2155 bool hasSignedIntegerRepresentation()
const;
2159 bool hasUnsignedIntegerRepresentation()
const;
2163 bool hasFloatingRepresentation()
const;
2168 const RecordType *getAsStructureType()
const;
2171 const ComplexType *getAsComplexIntegerType()
const;
2192 TagDecl *getAsTagDecl()
const;
2210 return dyn_cast_or_null<AutoType>(getContainedDeducedType());
2216 bool hasAutoForTrailingReturnType()
const;
2224 template <
typename T>
const T *getAs()
const;
2231 template <
typename T>
const T *getAsAdjusted()
const;
2235 const ArrayType *getAsArrayTypeUnsafe()
const;
2243 template <
typename T>
const T *castAs()
const;
2247 const ArrayType *castAsArrayTypeUnsafe()
const;
2256 const Type *getBaseElementTypeUnsafe()
const;
2261 const Type *getArrayElementTypeNoTypeQual()
const;
2266 const Type *getPointeeOrArrayElementType()
const;
2274 const Type *getUnqualifiedDesugaredType()
const;
2277 bool isPromotableIntegerType()
const;
2282 bool isSignedIntegerType()
const;
2287 bool isUnsignedIntegerType()
const;
2291 bool isSignedIntegerOrEnumerationType()
const;
2295 bool isUnsignedIntegerOrEnumerationType()
const;
2299 bool isFixedPointType()
const;
2302 bool isFixedPointOrIntegerType()
const;
2306 bool isSaturatedFixedPointType()
const;
2310 bool isUnsaturatedFixedPointType()
const;
2314 bool isSignedFixedPointType()
const;
2318 bool isUnsignedFixedPointType()
const;
2323 bool isConstantSizeType()
const;
2327 bool isSpecifierType()
const;
2334 return getLinkageAndVisibility().getVisibility();
2339 return getLinkageAndVisibility().isVisibilityExplicit();
2347 bool isLinkageValid()
const;
2361 bool canHaveNullability(
bool ResultIfUnknown =
true)
const;
2379 getObjCSubstitutions(
const DeclContext *dc)
const;
2383 bool acceptsObjCTypeParams()
const;
2385 const char *getTypeClassName()
const;
2388 return CanonicalType;
2393 void dump(llvm::raw_ostream &OS)
const;
2411 #define TYPE(Class, Base) 2412 #define LEAF_TYPE(Class) \ 2413 template <> inline const Class##Type *Type::getAs() const { \ 2414 return dyn_cast<Class##Type>(CanonicalType); \ 2416 template <> inline const Class##Type *Type::castAs() const { \ 2417 return cast<Class##Type>(CanonicalType); \ 2419 #include "clang/AST/TypeNodes.def" 2427 #define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) Id, 2428 #include "clang/Basic/OpenCLImageTypes.def" 2430 #define EXT_OPAQUE_TYPE(ExtType, Id, Ext) Id, 2431 #include "clang/Basic/OpenCLExtensionTypes.def" 2433 #define BUILTIN_TYPE(Id, SingletonId) Id, 2434 #define LAST_BUILTIN_TYPE(Id) LastKind = Id 2435 #include "clang/AST/BuiltinTypes.def" 2446 BuiltinTypeBits.Kind = K;
2455 StringRef str =
getName(Policy);
2456 assert(!str.empty() && str.data()[str.size()] ==
'\0');
2481 return K >= Overload;
2488 return isPlaceholderTypeKind(
getKind());
2515 :
Type(
Complex, CanonicalPtr, Element->isDependentType(),
2516 Element->isInstantiationDependentType(),
2517 Element->isVariablyModifiedType(),
2518 Element->containsUnexpandedParameterPack()),
2519 ElementType(Element) {}
2528 Profile(ID, getElementType());
2545 :
Type(
Paren, CanonType, InnerType->isDependentType(),
2546 InnerType->isInstantiationDependentType(),
2547 InnerType->isVariablyModifiedType(),
2548 InnerType->containsUnexpandedParameterPack()),
2558 Profile(ID, getInnerType());
2575 :
Type(
Pointer, CanonicalPtr, Pointee->isDependentType(),
2576 Pointee->isInstantiationDependentType(),
2577 Pointee->isVariablyModifiedType(),
2578 Pointee->containsUnexpandedParameterPack()),
2579 PointeeType(Pointee) {}
2604 Profile(ID, getPointeeType());
2626 :
Type(TC, CanonicalPtr, OriginalTy->isDependentType(),
2627 OriginalTy->isInstantiationDependentType(),
2628 OriginalTy->isVariablyModifiedType(),
2629 OriginalTy->containsUnexpandedParameterPack()),
2630 OriginalTy(OriginalTy), AdjustedTy(AdjustedTy) {}
2640 Profile(ID, OriginalTy, AdjustedTy);
2663 inline QualType getPointeeType()
const;
2678 :
Type(BlockPointer, CanonicalCls, Pointee->isDependentType(),
2679 Pointee->isInstantiationDependentType(),
2680 Pointee->isVariablyModifiedType(),
2681 Pointee->containsUnexpandedParameterPack()),
2682 PointeeType(Pointee) {}
2692 Profile(ID, getPointeeType());
2710 bool SpelledAsLValue)
2711 :
Type(tc, CanonicalRef, Referencee->isDependentType(),
2712 Referencee->isInstantiationDependentType(),
2713 Referencee->isVariablyModifiedType(),
2714 Referencee->containsUnexpandedParameterPack()),
2715 PointeeType(Referencee) {
2716 ReferenceTypeBits.SpelledAsLValue = SpelledAsLValue;
2731 return T->PointeeType;
2735 Profile(ID, PointeeType, isSpelledAsLValue());
2740 bool SpelledAsLValue) {
2742 ID.AddBoolean(SpelledAsLValue);
2756 bool SpelledAsLValue)
2798 :
Type(MemberPointer, CanonicalPtr,
2799 Cls->isDependentType() || Pointee->isDependentType(),
2800 (Cls->isInstantiationDependentType() ||
2801 Pointee->isInstantiationDependentType()),
2802 Pointee->isVariablyModifiedType(),
2803 (Cls->containsUnexpandedParameterPack() ||
2804 Pointee->containsUnexpandedParameterPack())),
2805 PointeeType(Pointee), Class(Cls) {}
2829 Profile(ID, getPointeeType(), getClass());
2833 const Type *Class) {
2835 ID.AddPointer(Class);
2868 bool ContainsUnexpandedParameterPack)
2869 :
Type(tc, can, et->isDependentType() || tc == DependentSizedArray,
2870 et->isInstantiationDependentType() || tc == DependentSizedArray,
2871 (tc == VariableArray || et->isVariablyModifiedType()),
2872 ContainsUnexpandedParameterPack),
2874 ArrayTypeBits.IndexTypeQuals = tq;
2875 ArrayTypeBits.SizeModifier = sm;
2890 return ArrayTypeBits.IndexTypeQuals;
2909 :
ArrayType(ConstantArray, et, can, sm, tq,
2918 :
ArrayType(tc, et, can, sm, tq, et->containsUnexpandedParameterPack()),
2922 const llvm::APInt &
getSize()
const {
return Size; }
2928 static unsigned getNumAddressingBits(
const ASTContext &Context,
2930 const llvm::APInt &NumElements);
2934 static unsigned getMaxSizeBits(
const ASTContext &Context);
2937 Profile(ID, getElementType(), getSize(),
2938 getSizeModifier(), getIndexTypeCVRQualifiers());
2943 unsigned TypeQuals) {
2945 ID.AddInteger(ArraySize.getZExtValue());
2946 ID.AddInteger(SizeMod);
2947 ID.AddInteger(TypeQuals);
2963 :
ArrayType(IncompleteArray, et, can, sm, tq,
2964 et->containsUnexpandedParameterPack()) {}
2977 Profile(ID, getElementType(), getSizeModifier(),
2978 getIndexTypeCVRQualifiers());
2984 ID.AddInteger(SizeMod);
2985 ID.AddInteger(TypeQuals);
3016 :
ArrayType(VariableArray, et, can, sm, tq,
3017 et->containsUnexpandedParameterPack()),
3018 SizeExpr((
Stmt*) e), Brackets(brackets) {}
3026 return (
Expr*) SizeExpr;
3041 llvm_unreachable(
"Cannot unique VariableArrayTypes.");
3083 return (
Expr*) SizeExpr;
3098 Profile(ID, Context, getElementType(),
3099 getSizeModifier(), getIndexTypeCVRQualifiers(), getSizeExpr());
3102 static void Profile(llvm::FoldingSetNodeID &
ID,
const ASTContext &Context,
3104 unsigned TypeQuals,
Expr *E);
3122 Expr *AddrSpaceExpr;
3143 Profile(ID, Context, getPointeeType(), getAddrSpaceExpr());
3146 static void Profile(llvm::FoldingSetNodeID &
ID,
const ASTContext &Context,
3187 Profile(ID, Context, getElementType(), getSizeExpr());
3190 static void Profile(llvm::FoldingSetNodeID &
ID,
const ASTContext &Context,
3239 return NumElements > VectorTypeBitfields::MaxNumElements;
3250 Profile(ID, getElementType(), getNumElements(),
3251 getTypeClass(), getVectorKind());
3258 ID.AddInteger(NumElements);
3259 ID.AddInteger(TypeClass);
3260 ID.AddInteger(VecKind);
3305 Profile(ID, Context, getElementType(), getSizeExpr(), getVectorKind());
3308 static void Profile(llvm::FoldingSetNodeID &
ID,
const ASTContext &Context,
3323 :
VectorType(ExtVector, vecType, nElements, canonType, GenericVector) {}
3329 case 'x':
case 'r':
return 0;
3330 case 'y':
case 'g':
return 1;
3331 case 'z':
case 'b':
return 2;
3332 case 'w':
case 'a':
return 3;
3350 case 'a':
return 10;
3352 case 'b':
return 11;
3354 case 'c':
return 12;
3356 case 'd':
return 13;
3358 case 'e':
return 14;
3360 case 'f':
return 15;
3365 if (isNumericAccessor)
3366 return getNumericAccessorIdx(c);
3368 return getPointAccessorIdx(c);
3372 if (
int idx = getAccessorIdx(c, isNumericAccessor)+1)
3373 return unsigned(idx-1) < getNumElements();
3417 HasPassObjSize = 0x20,
3420 unsigned char Data = 0;
3429 copy.Data = (copy.Data & ~ABIMask) |
unsigned(kind);
3439 copy.Data |= IsConsumed;
3441 copy.Data &= ~IsConsumed;
3448 Copy.Data |= HasPassObjSize;
3456 Copy.Data |= IsNoEscape;
3458 Copy.Data &= ~IsNoEscape;
3470 return lhs.Data == rhs.Data;
3474 return lhs.Data != rhs.Data;
3509 enum { CallConvMask = 0x1F };
3510 enum { NoReturnMask = 0x20 };
3511 enum { ProducesResultMask = 0x40 };
3512 enum { NoCallerSavedRegsMask = 0x80 };
3513 enum { NoCfCheckMask = 0x800 };
3515 RegParmMask = ~(CallConvMask | NoReturnMask | ProducesResultMask |
3516 NoCallerSavedRegsMask | NoCfCheckMask),
3519 uint16_t Bits =
CC_C;
3521 ExtInfo(
unsigned Bits) : Bits(static_cast<uint16_t>(Bits)) {}
3527 bool producesResult,
bool noCallerSavedRegs,
bool NoCfCheck) {
3528 assert((!hasRegParm || regParm < 7) &&
"Invalid regparm value");
3529 Bits = ((unsigned)cc) | (noReturn ? NoReturnMask : 0) |
3530 (producesResult ? ProducesResultMask : 0) |
3531 (noCallerSavedRegs ? NoCallerSavedRegsMask : 0) |
3532 (hasRegParm ? ((regParm + 1) << RegParmOffset) : 0) |
3533 (NoCfCheck ? NoCfCheckMask : 0);
3551 unsigned RegParm = (Bits & RegParmMask) >> RegParmOffset;
3560 return Bits == Other.Bits;
3563 return Bits != Other.Bits;
3571 return ExtInfo(Bits | NoReturnMask);
3573 return ExtInfo(Bits & ~NoReturnMask);
3578 return ExtInfo(Bits | ProducesResultMask);
3580 return ExtInfo(Bits & ~ProducesResultMask);
3584 if (noCallerSavedRegs)
3585 return ExtInfo(Bits | NoCallerSavedRegsMask);
3587 return ExtInfo(Bits & ~NoCallerSavedRegsMask);
3592 return ExtInfo(Bits | NoCfCheckMask);
3594 return ExtInfo(Bits & ~NoCfCheckMask);
3598 assert(RegParm < 7 &&
"Invalid regparm value");
3599 return ExtInfo((Bits & ~RegParmMask) |
3600 ((RegParm + 1) << RegParmOffset));
3604 return ExtInfo((Bits & ~CallConvMask) | (
unsigned) cc);
3608 ID.AddInteger(Bits);
3630 QualType Canonical,
bool Dependent,
3631 bool InstantiationDependent,
3632 bool VariablyModified,
bool ContainsUnexpandedParameterPack,
3634 :
Type(tc, Canonical, Dependent, InstantiationDependent, VariablyModified,
3635 ContainsUnexpandedParameterPack),
3637 FunctionTypeBits.ExtInfo = Info.Bits;
3659 "Const, volatile and restrict are assumed to be a subset of " 3660 "the fast qualifiers.");
3662 bool isConst()
const {
return getFastTypeQuals().hasConst(); }
3663 bool isVolatile()
const {
return getFastTypeQuals().hasVolatile(); }
3664 bool isRestrict()
const {
return getFastTypeQuals().hasRestrict(); }
3672 static StringRef getNameForCallConv(
CallingConv CC);
3688 Result->isVariablyModifiedType(),
3698 Profile(ID, getReturnType(), getExtInfo());
3721 public llvm::FoldingSetNode,
3723 FunctionProtoType, QualType, FunctionType::FunctionTypeExtraBitfields,
3724 FunctionType::ExceptionType, Expr *, FunctionDecl *,
3725 FunctionType::ExtParameterInfo, Qualifiers> {
3806 const ExtParameterInfo *ExtParameterInfos =
nullptr;
3811 : ExtInfo(CC), Variadic(
false), HasTrailingReturn(
false) {}
3821 unsigned numTrailingObjects(OverloadToken<QualType>)
const {
3822 return getNumParams();
3825 unsigned numTrailingObjects(OverloadToken<FunctionTypeExtraBitfields>)
const {
3826 return hasExtraBitfields();
3829 unsigned numTrailingObjects(OverloadToken<ExceptionType>)
const {
3830 return getExceptionSpecSize().NumExceptionType;
3833 unsigned numTrailingObjects(OverloadToken<Expr *>)
const {
3834 return getExceptionSpecSize().NumExprPtr;
3837 unsigned numTrailingObjects(OverloadToken<FunctionDecl *>)
const {
3838 return getExceptionSpecSize().NumFunctionDeclPtr;
3841 unsigned numTrailingObjects(OverloadToken<ExtParameterInfo>)
const {
3842 return hasExtParameterInfos() ? getNumParams() : 0;
3847 static bool containsAnyUnexpandedParameterPack(
const QualType *ArgArray,
3849 for (
unsigned Idx = 0; Idx < numArgs; ++Idx)
3850 if (ArgArray[Idx]->containsUnexpandedParameterPack())
3862 struct ExceptionSpecSizeHolder {
3863 unsigned NumExceptionType;
3864 unsigned NumExprPtr;
3865 unsigned NumFunctionDeclPtr;
3870 static ExceptionSpecSizeHolder
3882 return {NumExceptions, 0, 0};
3895 llvm_unreachable(
"bad exception specification kind");
3900 ExceptionSpecSizeHolder getExceptionSpecSize()
const {
3901 return getExceptionSpecSize(getExceptionSpecType(), getNumExceptions());
3912 bool hasExtraBitfields()
const {
3913 return hasExtraBitfields(getExceptionSpecType());
3916 bool hasExtQualifiers()
const {
3917 return FunctionTypeBits.HasExtQuals;
3924 assert(i < getNumParams() &&
"invalid parameter index");
3925 return param_type_begin()[
i];
3929 return llvm::makeArrayRef(param_type_begin(), param_type_end());
3957 FunctionTypeBits.ExceptionSpecType);
3974 bool hasDependentExceptionSpec()
const;
3978 bool hasInstantiationDependentExceptionSpec()
const;
3983 ? getTrailingObjects<FunctionTypeExtraBitfields>()
3990 assert(i < getNumExceptions() &&
"Invalid exception number!");
3991 return exception_begin()[
i];
3999 return *getTrailingObjects<Expr *>();
4010 return getTrailingObjects<FunctionDecl *>()[0];
4020 return getTrailingObjects<FunctionDecl *>()[1];
4031 return ResultIfDependent ? canThrow() !=
CT_Can : canThrow() ==
CT_Cannot;
4043 bool isTemplateVariadic()
const;
4049 if (hasExtQualifiers())
4050 return *getTrailingObjects<Qualifiers>();
4052 return getFastTypeQuals();
4068 return getTrailingObjects<QualType>();
4072 return param_type_begin() + getNumParams();
4078 return llvm::makeArrayRef(exception_begin(), exception_end());
4083 getTrailingObjects<ExceptionType>());
4087 return exception_begin() + getNumExceptions();
4093 return FunctionTypeBits.HasExtParameterInfos;
4097 assert(hasExtParameterInfos());
4106 if (!hasExtParameterInfos())
4108 return getTrailingObjects<ExtParameterInfo>();
4112 assert(I < getNumParams() &&
"parameter index out of range");
4113 if (hasExtParameterInfos())
4114 return getTrailingObjects<ExtParameterInfo>()[I];
4119 assert(I < getNumParams() &&
"parameter index out of range");
4120 if (hasExtParameterInfos())
4121 return getTrailingObjects<ExtParameterInfo>()[I].getABI();
4126 assert(I < getNumParams() &&
"parameter index out of range");
4127 if (hasExtParameterInfos())
4128 return getTrailingObjects<ExtParameterInfo>()[I].isConsumed();
4135 void printExceptionSpecification(raw_ostream &OS,
4142 void Profile(llvm::FoldingSetNodeID &
ID,
const ASTContext &Ctx);
4175 return Profile(ID, Decl);
4191 :
Type(tc, can, can->isDependentType(),
4192 can->isInstantiationDependentType(),
4193 can->isVariablyModifiedType(),
4196 assert(!isa<TypedefType>(can) &&
"Invalid canonical type");
4218 :
Type(MacroQualified, CanonTy, UnderlyingTy->isDependentType(),
4219 UnderlyingTy->isInstantiationDependentType(),
4220 UnderlyingTy->isVariablyModifiedType(),
4221 UnderlyingTy->containsUnexpandedParameterPack()),
4222 UnderlyingTy(UnderlyingTy), MacroII(MacroII) {
4223 assert(isa<AttributedType>(UnderlyingTy) &&
4224 "Expected a macro qualified type to only wrap attributed types.");
4259 bool isSugared()
const;
4279 Profile(ID, Context, getUnderlyingExpr());
4282 static void Profile(llvm::FoldingSetNodeID &
ID,
const ASTContext &Context,
4293 :
Type(TypeOf, can, T->isDependentType(),
4294 T->isInstantiationDependentType(),
4295 T->isVariablyModifiedType(),
4296 T->containsUnexpandedParameterPack()),
4298 assert(!isa<TypedefType>(can) &&
"Invalid canonical type");
4331 bool isSugared()
const;
4349 Profile(ID, Context, getUnderlyingExpr());
4352 static void Profile(llvm::FoldingSetNodeID &
ID,
const ASTContext &Context,
4399 public llvm::FoldingSetNode {
4405 Profile(ID, getBaseType(), getUTTKind());
4411 ID.AddInteger((
unsigned)UKind);
4429 bool isBeingDefined()
const;
4454 bool hasConstFields()
const;
4505 :
Type(Attributed, canon, equivalent->isDependentType(),
4506 equivalent->isInstantiationDependentType(),
4507 equivalent->isVariablyModifiedType(),
4508 equivalent->containsUnexpandedParameterPack()),
4509 ModifiedType(modified), EquivalentType(equivalent) {
4510 AttributedTypeBits.AttrKind = attrKind;
4515 return static_cast<Kind>(AttributedTypeBits.AttrKind);
4539 bool isQualifier()
const;
4541 bool isMSTypeSpec()
const;
4543 bool isCallingConv()
const;
4552 return attr::TypeNonNull;
4555 return attr::TypeNullable;
4558 return attr::TypeNullUnspecified;
4560 llvm_unreachable(
"Unknown nullability kind.");
4575 Profile(ID, getAttrKind(), ModifiedType, EquivalentType);
4580 ID.AddInteger(attrKind);
4594 struct CanonicalTTPTInfo {
4595 unsigned Depth : 15;
4596 unsigned ParameterPack : 1;
4597 unsigned Index : 16;
4610 :
Type(TemplateTypeParm, Canon,
true,
4613 Canon->containsUnexpandedParameterPack()),
4622 CanTTPTInfo.Depth = D;
4623 CanTTPTInfo.Index = I;
4624 CanTTPTInfo.ParameterPack = PP;
4627 const CanonicalTTPTInfo& getCanTTPTInfo()
const {
4628 QualType Can = getCanonicalTypeInternal();
4633 unsigned getDepth()
const {
return getCanTTPTInfo().Depth; }
4634 unsigned getIndex()
const {
return getCanTTPTInfo().Index; }
4638 return isCanonicalUnqualified() ? nullptr : TTPDecl;
4647 Profile(ID, getDepth(), getIndex(), isParameterPack(), getDecl());
4651 unsigned Index,
bool ParameterPack,
4653 ID.AddInteger(Depth);
4654 ID.AddInteger(Index);
4655 ID.AddBoolean(ParameterPack);
4656 ID.AddPointer(TTPDecl);
4678 :
Type(SubstTemplateTypeParm, Canon, Canon->isDependentType(),
4679 Canon->isInstantiationDependentType(),
4680 Canon->isVariablyModifiedType(),
4681 Canon->containsUnexpandedParameterPack()),
4693 return getCanonicalTypeInternal();
4700 Profile(ID, getReplacedParameter(), getReplacementType());
4706 ID.AddPointer(Replaced);
4750 return SubstTemplateTypeParmPackTypeBits.NumArgs;
4758 void Profile(llvm::FoldingSetNodeID &
ID);
4759 static void Profile(llvm::FoldingSetNodeID &ID,
4780 bool IsInstantiationDependent,
bool ContainsParameterPack)
4783 DeducedAsType.isNull() ?
QualType(this, 0)
4784 : DeducedAsType.getCanonicalType(),
4785 IsDependent, IsInstantiationDependent,
4786 false, ContainsParameterPack) {
4787 if (!DeducedAsType.
isNull()) {
4791 setInstantiationDependent();
4793 setContainsUnexpandedParameterPack();
4798 bool isSugared()
const {
return !isCanonicalUnqualified(); }
4804 return !isCanonicalUnqualified() ? getCanonicalTypeInternal() :
QualType();
4807 return !isCanonicalUnqualified() || isDependentType();
4821 bool IsDeducedAsDependent,
bool IsDeducedAsPack)
4823 IsDeducedAsDependent, IsDeducedAsPack) {
4824 AutoTypeBits.Keyword = (unsigned)Keyword;
4837 Profile(ID, getDeducedType(), getKeyword(), isDependentType(),
4838 containsUnexpandedParameterPack());
4844 ID.AddInteger((
unsigned)Keyword);
4845 ID.AddBoolean(IsDependent);
4846 ID.AddBoolean(IsPack);
4856 public llvm::FoldingSetNode {
4864 bool IsDeducedAsDependent)
4865 :
DeducedType(DeducedTemplateSpecialization, DeducedAsType,
4866 IsDeducedAsDependent || Template.isDependent(),
4867 IsDeducedAsDependent || Template.isInstantiationDependent(),
4868 Template.containsUnexpandedParameterPack()),
4869 Template(Template) {}
4876 Profile(ID, getTemplateName(), getDeducedType(), isDependentType());
4880 QualType Deduced,
bool IsDependent) {
4883 ID.AddBoolean(IsDependent);
4887 return T->
getTypeClass() == DeducedTemplateSpecialization;
4913 public llvm::FoldingSetNode {
4933 bool &InstantiationDependent);
4936 bool &InstantiationDependent);
4941 return isa<InjectedClassNameType>(getCanonicalTypeInternal());
4959 bool isTypeAlias()
const {
return TemplateSpecializationTypeBits.TypeAlias; }
4964 assert(isTypeAlias() &&
"not a type alias template specialization");
4965 return *
reinterpret_cast<const QualType*
>(end());
4983 return TemplateSpecializationTypeBits.NumArgs;
4991 return {getArgs(), getNumArgs()};
4995 return !isDependentType() || isCurrentInstantiation() || isTypeAlias();
4999 return isTypeAlias() ? getAliasedType() : getCanonicalTypeInternal();
5003 Profile(ID, Template, template_arguments(), Ctx);
5005 getAliasedType().Profile(ID);
5073 Decl(D), InjectedType(TST) {
5074 assert(isa<TemplateSpecializationType>(TST));
5083 return cast<TemplateSpecializationType>(InjectedType.
getTypePtr());
5087 return getInjectedTST()->getTemplateName();
5151 QualType Canonical,
bool Dependent,
5152 bool InstantiationDependent,
bool VariablyModified,
5153 bool ContainsUnexpandedParameterPack)
5154 :
Type(tc, Canonical, Dependent, InstantiationDependent, VariablyModified,
5155 ContainsUnexpandedParameterPack) {
5156 TypeWithKeywordBits.Keyword = Keyword;
5169 static TagTypeKind getTagTypeKindForTypeSpec(
unsigned TypeSpec);
5184 return getKeywordName(getKeywordForTagTypeKind(Kind));
5201 public llvm::FoldingSetNode,
5219 NamedType->isDependentType(),
5220 NamedType->isInstantiationDependentType(),
5221 NamedType->isVariablyModifiedType(),
5222 NamedType->containsUnexpandedParameterPack()),
5223 NNS(NNS), NamedType(NamedType) {
5224 ElaboratedTypeBits.HasOwnedTagDecl =
false;
5226 ElaboratedTypeBits.HasOwnedTagDecl =
true;
5227 *getTrailingObjects<TagDecl *>() = OwnedTagDecl;
5229 assert(!(Keyword ==
ETK_None && NNS ==
nullptr) &&
5230 "ElaboratedType cannot have elaborated type keyword " 5231 "and name qualifier both null.");
5250 return ElaboratedTypeBits.HasOwnedTagDecl ? *getTrailingObjects<TagDecl *>()
5255 Profile(ID, getKeyword(), NNS, NamedType, getOwnedTagDecl());
5261 ID.AddInteger(Keyword);
5264 ID.AddPointer(OwnedTagDecl);
5296 NNS->containsUnexpandedParameterPack()),
5297 NNS(NNS), Name(Name) {}
5316 Profile(ID, getKeyword(), NNS, Name);
5321 ID.AddInteger(Keyword);
5323 ID.AddPointer(Name);
5336 public llvm::FoldingSetNode {
5365 return getArgBuffer();
5370 return DependentTemplateSpecializationTypeBits.NumArgs;
5376 return {getArgs(), getNumArgs()};
5388 Profile(ID, Context, getKeyword(), NNS, Name, {getArgs(), getNumArgs()});
5391 static void Profile(llvm::FoldingSetNodeID &
ID,
5399 return T->
getTypeClass() == DependentTemplateSpecialization;
5433 :
Type(PackExpansion, Canon, Pattern->isDependentType(),
5435 Pattern->isVariablyModifiedType(),
5438 PackExpansionTypeBits.NumExpansions =
5439 NumExpansions ? *NumExpansions + 1 : 0;
5451 if (PackExpansionTypeBits.NumExpansions)
5452 return PackExpansionTypeBits.NumExpansions - 1;
5460 Profile(ID, getPattern(), getNumExpansions());
5466 ID.AddBoolean(NumExpansions.hasValue());
5468 ID.AddInteger(*NumExpansions);
5488 return static_cast<T*
>(
this)->getProtocolStorageImpl();
5492 static_cast<T*
>(
this)->setNumProtocolsImpl(N);
5496 setNumProtocols(protocols.size());
5497 assert(getNumProtocols() == protocols.size() &&
5498 "bitfield overflow in protocol count");
5499 if (!protocols.empty())
5500 memcpy(getProtocolStorage(), protocols.data(),
5517 return static_cast<const T*
>(
this)->getNumProtocolsImpl();
5522 assert(I < getNumProtocols() &&
"Out-of-range protocol access");
5523 return qual_begin()[I];
5536 public llvm::FoldingSetNode {
5541 unsigned NumProtocols : 6;
5552 unsigned getNumProtocolsImpl()
const {
5553 return NumProtocols;
5556 void setNumProtocolsImpl(
unsigned N) {
5572 void Profile(llvm::FoldingSetNodeID &
ID);
5573 static void Profile(llvm::FoldingSetNodeID &ID,
5628 mutable llvm::PointerIntPair<const ObjCObjectType *, 1, bool>
5629 CachedSuperClassType;
5632 const QualType *getTypeArgStorage()
const {
5639 unsigned getNumProtocolsImpl()
const {
5640 return ObjCObjectTypeBits.NumProtocols;
5642 void setNumProtocolsImpl(
unsigned N) {
5643 ObjCObjectTypeBits.NumProtocols = N;
5657 ObjCObjectTypeBits.NumProtocols = 0;
5658 ObjCObjectTypeBits.NumTypeArgs = 0;
5659 ObjCObjectTypeBits.IsKindOf = 0;
5662 void computeSuperClassTypeSlow()
const;
5674 return getBaseType()->isSpecificBuiltinType(BuiltinType::ObjCId);
5678 return getBaseType()->isSpecificBuiltinType(BuiltinType::ObjCClass);
5684 if (!qual_empty())
return false;
5685 if (
const BuiltinType *T = getBaseType()->getAs<BuiltinType>())
5686 return T->getKind() == BuiltinType::ObjCId ||
5687 T->getKind() == BuiltinType::ObjCClass;
5699 bool isSpecialized()
const;
5703 return ObjCObjectTypeBits.NumTypeArgs > 0;
5720 return llvm::makeArrayRef(getTypeArgStorage(),
5721 ObjCObjectTypeBits.NumTypeArgs);
5728 bool isKindOfType()
const;
5737 if (!CachedSuperClassType.getInt())
5738 computeSuperClassTypeSlow();
5740 assert(CachedSuperClassType.getInt() &&
"Superclass not set?");
5741 return QualType(CachedSuperClassType.getPointer(), 0);
5771 :
ObjCObjectType(Canonical, Base, typeArgs, protocols, isKindOf) {}
5774 void Profile(llvm::FoldingSetNodeID &
ID);
5775 static void Profile(llvm::FoldingSetNodeID &
ID,
5782 inline QualType *ObjCObjectType::getTypeArgStorage() {
5788 getTypeArgStorage() + ObjCObjectTypeBits.NumTypeArgs);
5846 if (
const auto *T = dyn_cast<ObjCInterfaceType>(ObjT))
5847 return T->getDecl();
5849 baseType = ObjT->getBaseType();
5870 :
Type(ObjCObjectPointer, Canonical,
5871 Pointee->isDependentType(),
5872 Pointee->isInstantiationDependentType(),
5873 Pointee->isVariablyModifiedType(),
5874 Pointee->containsUnexpandedParameterPack()),
5875 PointeeType(Pointee) {}
6018 QualType getSuperClassType()
const;
6026 Profile(ID, getPointeeType());
6044 :
Type(Atomic, Canonical, ValTy->isDependentType(),
6045 ValTy->isInstantiationDependentType(),
6046 ValTy->isVariablyModifiedType(),
6047 ValTy->containsUnexpandedParameterPack()),
6059 Profile(ID, getValueType());
6079 :
Type(Pipe, CanonicalPtr, elemType->isDependentType(),
6080 elemType->isInstantiationDependentType(),
6081 elemType->isVariablyModifiedType(),
6082 elemType->containsUnexpandedParameterPack()),
6083 ElementType(elemType), isRead(isRead) {}
6093 Profile(ID, getElementType(), isReadOnly());
6098 ID.AddBoolean(isRead);
6119 return type.getTypePtrUnsafe();
6121 const ExtQuals *extQuals = type.getExtQualsUnsafe();
6137 Ty->getLocallyUnqualifiedSingleStepDesugaredType().split();
6143 return getCommonPtr()->BaseType;
6147 return (isNull() ?
nullptr : getCommonPtr()->BaseType);
6151 if (!hasLocalNonFastQualifiers())
6155 const ExtQuals *eq = getExtQualsUnsafe();
6163 if (hasLocalNonFastQualifiers())
6164 Quals = getExtQualsUnsafe()->getQualifiers();
6170 Qualifiers quals = getCommonPtr()->CanonicalType.getLocalQualifiers();
6176 unsigned cvr = getCommonPtr()->CanonicalType.getLocalCVRQualifiers();
6177 cvr |= getLocalCVRQualifiers();
6182 QualType canon = getCommonPtr()->CanonicalType;
6187 return getTypePtr()->isCanonicalUnqualified();
6191 if (!isCanonical())
return false;
6192 if (hasLocalQualifiers())
return false;
6194 const Type *T = getTypePtr();
6198 return !isa<FunctionType>(T) && !isa<ArrayType>(T);
6202 return isLocalConstQualified() ||
6203 getCommonPtr()->CanonicalType.isLocalConstQualified();
6207 return isLocalRestrictQualified() ||
6208 getCommonPtr()->CanonicalType.isLocalRestrictQualified();
6213 return isLocalVolatileQualified() ||
6214 getCommonPtr()->CanonicalType.isLocalVolatileQualified();
6218 return hasLocalQualifiers() ||
6219 getCommonPtr()->CanonicalType.hasLocalQualifiers();
6223 if (!getTypePtr()->getCanonicalTypeInternal().hasLocalQualifiers())
6226 return QualType(getSplitUnqualifiedTypeImpl(*this).Ty, 0);
6230 if (!getTypePtr()->getCanonicalTypeInternal().hasLocalQualifiers())
6233 return getSplitUnqualifiedTypeImpl(*
this);
6251 "Fast bits differ from CVR bits!");
6254 removeLocalFastQualifiers(Mask);
6259 return getQualifiers().getAddressSpace();
6264 return getQualifiers().getObjCGCAttr();
6268 if (
auto *RD = getTypePtr()->getBaseElementTypeUnsafe()->getAsRecordDecl())
6269 return hasNonTrivialToPrimitiveDefaultInitializeCUnion(RD);
6274 if (
auto *RD = getTypePtr()->getBaseElementTypeUnsafe()->getAsRecordDecl())
6275 return hasNonTrivialToPrimitiveDestructCUnion(RD);
6280 if (
auto *RD = getTypePtr()->getBaseElementTypeUnsafe()->getAsRecordDecl())
6281 return hasNonTrivialToPrimitiveCopyCUnion(RD);
6287 if (
const auto *FT = PT->getPointeeType()->getAs<
FunctionType>())
6288 return FT->getExtInfo();
6290 return FT->getExtInfo();
6318 if (getUnqualifiedType()->isVoidType())
6321 return getQualifiers().compatiblyIncludes(OtherQuals);
6341 return ((getTypePtr()->isVoidType() && !hasQualifiers()) ||
6342 getTypePtr()->isFunctionType());
6349 return isVoidType() ||
6352 (isArithmeticType() && !isEnumeralType());
6362 return isArrayType() ||
6368 isReferenceType() ||
6377 isMemberPointerType();
6381 return isa<FunctionType>(CanonicalType);
6385 return isa<PointerType>(CanonicalType);
6389 return isPointerType() || isObjCObjectPointerType();
6393 return isa<BlockPointerType>(CanonicalType);
6397 return isa<ReferenceType>(CanonicalType);
6401 return isa<LValueReferenceType>(CanonicalType);
6405 return isa<RValueReferenceType>(CanonicalType);
6409 if (
const auto *T = getAs<PointerType>())
6410 return T->getPointeeType()->isFunctionType();
6416 if (
const auto *T = getAs<ReferenceType>())
6417 return T->getPointeeType()->isFunctionType();
6423 return isa<MemberPointerType>(CanonicalType);
6427 if (
const auto *T = getAs<MemberPointerType>())
6428 return T->isMemberFunctionPointer();
6434 if (
const auto *T = getAs<MemberPointerType>())
6435 return T->isMemberDataPointer();
6441 return isa<ArrayType>(CanonicalType);
6445 return isa<ConstantArrayType>(CanonicalType);
6449 return isa<IncompleteArrayType>(CanonicalType);
6453 return isa<VariableArrayType>(CanonicalType);
6457 return isa<DependentSizedArrayType>(CanonicalType);
6461 return isa<BuiltinType>(CanonicalType);
6465 return isa<RecordType>(CanonicalType);
6469 return isa<EnumType>(CanonicalType);
6473 return isa<ComplexType>(CanonicalType);
6477 return isa<VectorType>(CanonicalType);
6481 return isa<ExtVectorType>(CanonicalType);
6485 return isa<DependentAddressSpaceType>(CanonicalType);
6489 return isa<ObjCObjectPointerType>(CanonicalType);
6493 return isa<ObjCObjectType>(CanonicalType);
6497 return isa<ObjCInterfaceType>(CanonicalType) ||
6498 isa<ObjCObjectType>(CanonicalType);
6502 return isa<AtomicType>(CanonicalType);
6506 if (
const auto *OPT = getAs<ObjCObjectPointerType>())
6507 return OPT->isObjCQualifiedIdType();
6512 if (
const auto *OPT = getAs<ObjCObjectPointerType>())
6513 return OPT->isObjCQualifiedClassType();
6518 if (
const auto *OPT = getAs<ObjCObjectPointerType>())
6519 return OPT->isObjCIdType();
6524 if (
const auto *OPT = getAs<ObjCObjectPointerType>())
6525 return OPT->isObjCClassType();
6530 if (
const auto *OPT = getAs<PointerType>())
6531 return OPT->getPointeeType()->isSpecificBuiltinType(BuiltinType::ObjCSel);
6536 return isObjCIdType() || isObjCClassType() || isObjCSelType();
6540 return isa<DecltypeType>(
this);
6543 #define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \ 6544 inline bool Type::is##Id##Type() const { \ 6545 return isSpecificBuiltinType(BuiltinType::Id); \ 6547 #include "clang/Basic/OpenCLImageTypes.def" 6550 return isSpecificBuiltinType(BuiltinType::OCLSampler);
6554 return isSpecificBuiltinType(BuiltinType::OCLEvent);
6558 return isSpecificBuiltinType(BuiltinType::OCLClkEvent);
6562 return isSpecificBuiltinType(BuiltinType::OCLQueue);
6566 return isSpecificBuiltinType(BuiltinType::OCLReserveID);
6570 #define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) is##Id##Type() || 6572 #include "clang/Basic/OpenCLImageTypes.def" 6577 return isa<PipeType>(CanonicalType);
6580 #define EXT_OPAQUE_TYPE(ExtType, Id, Ext) \ 6581 inline bool Type::is##Id##Type() const { \ 6582 return isSpecificBuiltinType(BuiltinType::Id); \ 6584 #include "clang/Basic/OpenCLExtensionTypes.def" 6587 #define INTEL_SUBGROUP_AVC_TYPE(ExtType, Id) \ 6588 isOCLIntelSubgroupAVC##Id##Type() || 6590 #include "clang/Basic/OpenCLExtensionTypes.def" 6595 #define EXT_OPAQUE_TYPE(ExtType, Id, Ext) is##Id##Type() || 6597 #include "clang/Basic/OpenCLExtensionTypes.def" 6602 return isSamplerT() || isEventT() || isImageType() || isClkEventT() ||
6603 isQueueT() || isReserveIDT() || isPipeType() || isOCLExtOpaqueType();
6607 return isa<TemplateTypeParmType>(CanonicalType);
6618 if (
const auto *BT = dyn_cast<BuiltinType>(
this))
6619 return BT->isPlaceholderType();
6624 if (
const auto *BT = dyn_cast<BuiltinType>(
this))
6625 if (BT->isPlaceholderType())
6632 if (
const auto *BT = dyn_cast<BuiltinType>(
this))
6638 if (
const auto *BT = dyn_cast<BuiltinType>(
this))
6639 return BT->isNonOverloadPlaceholderType();
6644 if (
const auto *BT = dyn_cast<BuiltinType>(CanonicalType))
6645 return BT->getKind() == BuiltinType::Void;
6650 if (
const auto *BT = dyn_cast<BuiltinType>(CanonicalType))
6651 return BT->getKind() == BuiltinType::Half;
6657 if (
const auto *BT = dyn_cast<BuiltinType>(CanonicalType))
6658 return BT->getKind() == BuiltinType::Float16;
6663 if (
const auto *BT = dyn_cast<BuiltinType>(CanonicalType))
6664 return BT->getKind() == BuiltinType::Float128;
6669 if (
const auto *BT = getAs<BuiltinType>())
6670 return BT->getKind() == BuiltinType::NullPtr;
6678 if (
const auto *BT = dyn_cast<BuiltinType>(CanonicalType))
6679 return BT->getKind() >= BuiltinType::Bool &&
6680 BT->getKind() <= BuiltinType::Int128;
6681 if (
const EnumType *ET = dyn_cast<EnumType>(CanonicalType)) {
6691 if (
const auto *BT = dyn_cast<BuiltinType>(CanonicalType)) {
6692 return BT->getKind() >= BuiltinType::ShortAccum &&
6693 BT->getKind() <= BuiltinType::SatULongFract;
6699 return isFixedPointType() || isIntegerType();
6703 if (
const auto *BT = dyn_cast<BuiltinType>(CanonicalType)) {
6704 return BT->getKind() >= BuiltinType::SatShortAccum &&
6705 BT->getKind() <= BuiltinType::SatULongFract;
6711 return isFixedPointType() && !isSaturatedFixedPointType();
6715 if (
const auto *BT = dyn_cast<BuiltinType>(CanonicalType)) {
6716 return ((BT->getKind() >= BuiltinType::ShortAccum &&
6717 BT->getKind() <= BuiltinType::LongAccum) ||
6718 (BT->getKind() >= BuiltinType::ShortFract &&
6719 BT->getKind() <= BuiltinType::LongFract) ||
6720 (BT->getKind() >= BuiltinType::SatShortAccum &&
6721 BT->getKind() <= BuiltinType::SatLongAccum) ||
6722 (BT->getKind() >= BuiltinType::SatShortFract &&
6723 BT->getKind() <= BuiltinType::SatLongFract));
6729 return isFixedPointType() && !isSignedFixedPointType();
6733 if (
const auto *BT = dyn_cast<BuiltinType>(CanonicalType))
6734 return BT->getKind() > BuiltinType::Void &&
6735 BT->getKind() <= BuiltinType::NullPtr;
6736 if (
const EnumType *ET = dyn_cast<EnumType>(CanonicalType))
6740 return isa<PointerType>(CanonicalType) ||
6741 isa<BlockPointerType>(CanonicalType) ||
6742 isa<MemberPointerType>(CanonicalType) ||
6743 isa<ComplexType>(CanonicalType) ||
6744 isa<ObjCObjectPointerType>(CanonicalType);
6748 if (
const auto *BT = dyn_cast<BuiltinType>(CanonicalType))
6749 return BT->getKind() >= BuiltinType::Bool &&
6750 BT->getKind() <= BuiltinType::Int128;
6754 if (
const auto *ET = dyn_cast<EnumType>(CanonicalType))
6761 if (
const auto *BT = dyn_cast<BuiltinType>(CanonicalType))
6762 return BT->getKind() == BuiltinType::Bool;
6767 auto *DT = getContainedDeducedType();
6768 return DT && !DT->isDeduced();
6774 return isDependentType() ||
isRecordType() || isEnumeralType();
6779 return isFunctionType() || isArrayType();
6783 return (isPointerType() || isReferenceType() || isBlockPointerType() ||
6784 isObjCObjectPointerType() || isNullPtrType());
6788 return isObjCObjectPointerType();
6794 type =
arrayType->getElementType().getTypePtr();
6812 DiagnosticsEngine::ArgumentKind::ak_qual);
6821 DiagnosticsEngine::ArgumentKind::ak_qual);
6845 template <
typename T>
6847 std::integral_constant<bool, std::is_same<T, ArrayType>::value ||
6848 std::is_base_of<ArrayType, T>::value>;
6853 "ArrayType cannot be used with getAs!");
6856 if (
const auto *Ty = dyn_cast<T>(
this))
6860 if (!isa<T>(CanonicalType))
6865 return cast<T>(getUnqualifiedDesugaredType());
6872 if (
const auto *Ty = dyn_cast<T>(
this))
6876 if (!isa<T>(CanonicalType))
6881 const Type *Ty =
this;
6883 if (
const auto *A = dyn_cast<AttributedType>(Ty))
6884 Ty = A->getModifiedType().getTypePtr();
6885 else if (
const auto *E = dyn_cast<ElaboratedType>(Ty))
6886 Ty = E->desugar().getTypePtr();
6887 else if (
const auto *
P = dyn_cast<ParenType>(Ty))
6888 Ty =
P->desugar().getTypePtr();
6889 else if (
const auto *A = dyn_cast<AdjustedType>(Ty))
6890 Ty = A->desugar().getTypePtr();
6891 else if (
const auto *M = dyn_cast<MacroQualifiedType>(Ty))
6892 Ty = M->desugar().getTypePtr();
6899 return dyn_cast<T>(Ty);
6904 if (
const auto *arr = dyn_cast<ArrayType>(
this))
6908 if (!isa<ArrayType>(CanonicalType))
6913 return cast<ArrayType>(getUnqualifiedDesugaredType());
6918 "ArrayType cannot be used with castAs!");
6920 if (
const auto *ty = dyn_cast<T>(
this))
return ty;
6921 assert(isa<T>(CanonicalType));
6922 return cast<T>(getUnqualifiedDesugaredType());
6926 assert(isa<ArrayType>(CanonicalType));
6927 if (
const auto *arr = dyn_cast<ArrayType>(
this))
return arr;
6928 return cast<ArrayType>(getUnqualifiedDesugaredType());
6933 :
AdjustedType(Decayed, OriginalType, DecayedPtr, CanonicalPtr) {
6935 QualType Adjusted = getAdjustedType();
6937 assert(isa<PointerType>(Adjusted));
6942 QualType Decayed = getDecayedType();
6944 return cast<PointerType>(Decayed)->getPointeeType();
6956 #endif // LLVM_CLANG_AST_TYPE_H
bool isDynamicExceptionSpec(ExceptionSpecificationType ESpecType)
Internal representation of canonical, dependent typeof(expr) types.
QualType getPattern() const
Retrieve the pattern of this pack expansion, which is the type that will be repeatedly instantiated w...
const internal::VariadicAllOfMatcher< Type > type
Matches Types in the clang AST.
bool isFloatingPoint() 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.
void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Ctx)
Represents a function declaration or definition.
static bool classof(const Type *T)
static void print(SplitQualType split, raw_ostream &OS, const PrintingPolicy &policy, const Twine &PlaceHolder, unsigned Indentation=0)
static Qualifiers fromCVRUMask(unsigned CVRU)
bool isFixedPointType() const
Return true if this is a fixed point type according to ISO/IEC JTC1 SC22 WG14 N1169.
const TemplateSpecializationType * getInjectedTST() const
bool isKindOfTypeAsWritten() const
Whether this is a "__kindof" type as written.
The "enum" keyword introduces the elaborated-type-specifier.
bool isObjCQualifiedIdType() const
True if this is equivalent to 'id.
void setDependent(bool D=true)
no exception specification
IdentifierInfo * getIdentifier() const
const Type & operator*() const
RefQualifierKind getRefQualifier() const
Retrieve the ref-qualifier associated with this function type.
PointerType - C99 6.7.5.1 - Pointer Declarators.
ArrayRef< QualType > getTypeArgsAsWritten() const
Retrieve the type arguments of this object type as they were written.
bool operator==(Qualifiers Other) const
QualType getElementType() const
void Profile(llvm::FoldingSetNodeID &ID)
QualType getPointeeType() const
Represents the dependent type named by a dependently-scoped typename using declaration, e.g.
A (possibly-)qualified type.
bool isBlockPointerType() const
bool hasNonTrivialToPrimitiveCopyCUnion() const
Check if this is or contains a C union that is non-trivial to copy, which is a union that has a membe...
static void Profile(llvm::FoldingSetNodeID &ID, QualType Pointee)
ExtProtoInfo(CallingConv CC)
bool getNoCfCheck() const
bool isMemberPointerType() const
QualType getInjectedSpecializationType() const
unsigned getNumExceptions() const
Return the number of types in the exception specification.
unsigned getNumArgs() const
static QualType getObjectType(APValue::LValueBase B)
Retrieves the "underlying object type" of the given expression, as used by __builtin_object_size.
QualType getDecayedType() const
__auto_type (GNU extension)
bool isMemberDataPointerType() const
QualType getDesugaredType(const ASTContext &Context) const
Return the specified type with any "sugar" removed from the type.
bool isCForbiddenLValueType() const
Determine whether expressions of the given type are forbidden from being lvalues in C...
LangAS getAddressSpace() const
void Profile(llvm::FoldingSetNodeID &ID) const
void Profile(llvm::FoldingSetNodeID &ID) const
ExtInfo withNoCallerSavedRegs(bool noCallerSavedRegs) const
Specialize PointerLikeTypeTraits to allow LazyGenerationalUpdatePtr to be placed into a PointerUnion...
bool isOCLExtOpaqueType() const
Expr * getUnderlyingExpr() const
ObjCProtocolDecl *const * qual_iterator
ParameterABI getParameterABI(unsigned I) const
bool IsEnumDeclScoped(EnumDecl *ED)
Check if the given decl is scoped.
AutoTypeKeyword
Which keyword(s) were used to create an AutoType.
void setInstantiationDependent(bool D=true)
Stmt - This represents one statement.
NullabilityKind
Describes the nullability of a particular type.
FunctionType - C99 6.7.5.3 - Function Declarators.
QualType getPointeeType() const
If this is a pointer, ObjC object pointer, or block pointer, this returns the respective pointee...
static void Profile(llvm::FoldingSetNodeID &ID, Kind attrKind, QualType modified, QualType equivalent)
void Profile(llvm::FoldingSetNodeID &ID)
ExtInfo withNoCfCheck(bool noCfCheck) const
bool hasExtParameterInfos() const
Is there any interesting extra information for any of the parameters of this function type...
static void Profile(llvm::FoldingSetNodeID &ID, QualType Inner)
No linkage, which means that the entity is unique and can only be referred to from within its scope...
Qualifiers::GC getObjCGCAttr() const
void Profile(llvm::FoldingSetNodeID &ID)
void addConst()
Add the const type qualifier to this QualType.
bool hasStrongOrWeakObjCLifetime() const
True if the lifetime is either strong or weak.
Qualifiers getFastTypeQuals() const
Represents a qualified type name for which the type name is dependent.
CanonicalTTPTInfo CanTTPTInfo
void setObjCLifetime(ObjCLifetime type)
bool isRecordType() const
friend Qualifiers operator-(Qualifiers L, Qualifiers R)
Compute the difference between two qualifier sets.
ConstantArrayType(TypeClass tc, QualType et, QualType can, const llvm::APInt &size, ArraySizeModifier sm, unsigned tq)
static bool classof(const Type *T)
bool isSpecificPlaceholderType(unsigned K) const
Test for a specific placeholder type.
static bool classof(const Type *T)
NestedNameSpecifier * getQualifier() const
Retrieve the qualification on this type.
bool isDecltypeAuto() const
QualType getUnderlyingType() const
static void Profile(llvm::FoldingSetNodeID &ID, QualType T)
SourceLocation getRBracketLoc() const
Decl - This represents one declaration (or definition), e.g.
void AddTaggedVal(intptr_t V, DiagnosticsEngine::ArgumentKind Kind) const
bool isVariadic() const
Whether this function prototype is variadic.
TagDecl * getDecl() const
ObjCObjectTypeBitfields ObjCObjectTypeBits
bool isExtVectorType() const
SubstTemplateTypeParmPackTypeBitfields SubstTemplateTypeParmPackTypeBits
static bool classof(const Type *T)
Represents a C++11 auto or C++14 decltype(auto) type.
A class providing a concrete implementation of ObjCObjectType, so as to not increase the footprint of...
void removeQualifiers(Qualifiers Q)
Remove the qualifiers from the given set from this set.
QualType getNonReferenceType() const
If Type is a reference type (e.g., const int&), returns the type that the reference refers to ("const...
static bool classof(const Type *T)
const DiagnosticBuilder & operator<<(const DiagnosticBuilder &DB, const Attr *At)
The base class of the type hierarchy.
ObjCObjectType(enum Nonce_ObjCInterface)
void setObjCGCAttr(GC type)
Represents an array type, per C99 6.7.5.2 - Array Declarators.
void Profile(llvm::FoldingSetNodeID &ID)
AdjustedType(TypeClass TC, QualType OriginalTy, QualType AdjustedTy, QualType CanonicalPtr)
bool isRestrictQualified() const
Determine whether this type is restrict-qualified.
bool isPlaceholderType() const
Determines whether this type is a placeholder type, i.e.
static bool classof(const Type *T)
void Profile(llvm::FoldingSetNodeID &ID)
QualType withConst() const
bool getNoReturnAttr() const
Determine whether this function type includes the GNU noreturn attribute.
QualType ElementType
The element type of the vector.
RefQualifierKind RefQualifier
bool getHasRegParm() const
QualType getValueType() const
Gets the type contained by this atomic type, i.e.
exception_iterator exception_end() const
SourceLocation getAttributeLoc() const
bool isUnspecialized() const
Determine whether this object type is "unspecialized", meaning that it has no type arguments...
ObjCProtocolDecl * getProtocol(unsigned I) const
Fetch a protocol by index.
bool isUnspecialized() const
Whether this type is unspecialized, meaning that is has no type arguments.
TemplateTypeParmDecl * getDecl() const
Qualifiers & operator+=(Qualifiers R)
static void Profile(llvm::FoldingSetNodeID &ID, QualType ET, const llvm::APInt &ArraySize, ArraySizeModifier SizeMod, unsigned TypeQuals)
QualType getElementType() const
bool hasLocalNonFastQualifiers() const
Determine whether this particular QualType instance has any "non-fast" qualifiers, e.g., those that are stored in an ExtQualType instance.
TemplateName getTemplateName() const
Retrieve the name of the template that we are deducing.
QualType withFastQualifiers(unsigned TQs) const
The type would be trivial except that it is volatile-qualified.
static Qualifiers fromOpaqueValue(unsigned opaque)
ArrayRef< ObjCProtocolDecl * > getProtocols() const
Retrieve all of the protocol qualifiers.
void removeObjCLifetime()
bool isParamConsumed(unsigned I) const
unsigned getNumParams() const
bool isEnumeralType() const
const T * getAs() const
Member-template getAs<specific type>'.
bool isOverloadableType() const
Determines whether this is a type for which one can define an overloaded operator.
The width of the "fast" qualifier mask.
bool hasPointerRepresentation() const
Whether this type is represented natively as a pointer.
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...
LangAS
Defines the address space values used by the address space qualifier of QualType. ...
ArrayTypeBitfields ArrayTypeBits
Represents a C++17 deduced template specialization type.
The "__interface" keyword.
ExtInfo withProducesResult(bool producesResult) const
SourceLocation getLBracketLoc() const
static Qualifiers fromFastMask(unsigned Mask)
static StringRef getTagTypeKindName(TagTypeKind Kind)
ExtParameterInfo withIsConsumed(bool consumed) const
QualType(const Type *Ptr, unsigned Quals)
Describes how types, statements, expressions, and declarations should be printed. ...
static void * getAsVoidPointer(::clang::Type *P)
bool isSpecializedAsWritten() const
Whether this type is specialized, meaning that it has type arguments.
Represents the result of substituting a type for a template type parameter.
void Profile(llvm::FoldingSetNodeID &ID)
QualType getLocalUnqualifiedType() const
Return this type with all of the instance-specific qualifiers removed, but without removing any quali...
Linkage
Describes the different kinds of linkage (C++ [basic.link], C99 6.2.2) that an entity may have...
noexcept(expression), value-dependent
QualType desugar() const
Remove a single level of sugar.
The collection of all-type qualifiers we support.
bool isVariableArrayType() const
bool isNoexceptExceptionSpec(ExceptionSpecificationType ESpecType)
bool isObjCObjectOrInterfaceType() const
bool isDependentSizedArrayType() const
void Profile(llvm::FoldingSetNodeID &ID)
SourceLocation getAttributeLoc() const
ElaboratedTypeBitfields ElaboratedTypeBits
Represents a struct/union/class.
void AddTaggedVal(intptr_t V, DiagnosticsEngine::ArgumentKind Kind) const
DependentTypeOfExprType(const ASTContext &Context, Expr *E)
PackExpansionTypeBitfields PackExpansionTypeBits
QualType getOriginalType() const
FunctionType::ExtInfo ExtInfo
One of these records is kept for each identifier that is lexed.
bool operator==(ExtInfo Other) const
bool isObjCQualifiedClass() const
bool isLocalRestrictQualified() const
Determine whether this particular QualType instance has the "restrict" qualifier set, without looking through typedefs that may have added "restrict" at a different level.
bool isNothrow(bool ResultIfDependent=false) const
Determine whether this function type has a non-throwing exception specification.
unsigned getRegParm() const
QualType IgnoreParens() const
Returns the specified type after dropping any outer-level parentheses.
Represents a class type in Objective C.
QualType getPointeeType() const
std::pair< const Type *, Qualifiers > asPair() const
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
ArrayRef< QualType > getParamTypes() const
ArrayRef< ExtParameterInfo > getExtParameterInfos() const
static bool classof(const Type *T)
bool isObjCInertUnsafeUnretainedType() const
Was this type written with the special inert-in-ARC __unsafe_unretained qualifier?
bool isSpelledAsLValue() const
bool isObjCIdType() const
TemplateName getTemplateName() const
Retrieve the name of the template that we are specializing.
bool isCanonicalUnqualified() const
Determines if this type would be canonical if it had no further qualification.
Defines the ExceptionSpecificationType enumeration and various utility functions. ...
QualType desugar() const
Remove a single level of sugar.
void Profile(llvm::FoldingSetNodeID &ID)
static bool classof(const Type *T)
const IdentifierInfo * getMacroIdentifier() const
void setLocalFastQualifiers(unsigned Quals)
bool isReferenceType() const
Base class that is common to both the ExtQuals and Type classes, which allows QualType to access the ...
static bool classof(const Type *T)
static bool classof(const Type *T)
Represents the result of substituting a set of types for a template type parameter pack...
TagDecl * getOwnedTagDecl() const
Return the (re)declaration of this type owned by this occurrence of this type, or nullptr if there is...
static void Profile(llvm::FoldingSetNodeID &ID, QualType Deduced, AutoTypeKeyword Keyword, bool IsDependent, bool IsPack)
friend bool operator!=(ExtParameterInfo lhs, ExtParameterInfo rhs)
bool isSpecialized() const
Whether this type is specialized, meaning that it has type arguments.
bool hasNonTrivialObjCLifetime() const
True if the lifetime is neither None or ExplicitNone.
bool isSpecificBuiltinType(unsigned K) const
Test for a particular builtin type.
qual_iterator qual_begin() const
static void Profile(llvm::FoldingSetNodeID &ID, QualType ElementType, unsigned NumElements, TypeClass TypeClass, VectorKind VecKind)
Defines the clang::attr::Kind enum.
static int getPointAccessorIdx(char c)
bool isObjCSelType() const
unsigned char getOpaqueValue() const
static void Profile(llvm::FoldingSetNodeID &ID, QualType Referencee, bool SpelledAsLValue)
bool isObjCQualifiedClassType() const
void Profile(llvm::FoldingSetNodeID &ID)
bool isAtLeastAsQualifiedAs(QualType Other) const
Determine whether this type is at least as qualified as the other given type, requiring exact equalit...
bool isIntegralOrEnumerationType() const
Determine whether this type is an integral or enumeration type.
bool isUnspecializedAsWritten() const
Determine whether this object type is "unspecialized" as written, meaning that it has no type argumen...
static bool classof(const Type *T)
ReferenceType(TypeClass tc, QualType Referencee, QualType CanonicalRef, bool SpelledAsLValue)
Qualifiers getLocalQualifiers() const
Retrieve the set of qualifiers local to this particular QualType instance, not including any qualifie...
FunctionType(TypeClass tc, QualType res, QualType Canonical, bool Dependent, bool InstantiationDependent, bool VariablyModified, bool ContainsUnexpandedParameterPack, ExtInfo Info)
Values of this type can be null.
void addRestrict()
Add the restrict qualifier to this QualType.
bool getProducesResult() const
static bool classof(const Type *T)
void Profile(llvm::FoldingSetNodeID &ID)
bool isObjCUnqualifiedClass() const
Type(TypeClass tc, QualType canon, bool Dependent, bool InstantiationDependent, bool VariablyModified, bool ContainsUnexpandedParameterPack)
An rvalue reference type, per C++11 [dcl.ref].
static bool classof(const Type *T)
UnresolvedUsingTypenameDecl * getDecl() const
qual_iterator qual_end() const
static bool classof(const Type *T)
bool hasAddressSpace() const
An lvalue ref-qualifier was provided (&).
void addObjCGCAttr(GC type)
Microsoft throw(...) extension.
A convenient class for passing around template argument information.
static bool classof(const Type *T)
TemplateName getTemplateName() const
static void dump(llvm::raw_ostream &OS, StringRef FunctionName, ArrayRef< CounterExpression > Expressions, ArrayRef< CounterMappingRegion > Regions)
QualType getExceptionType(unsigned i) const
Return the ith exception type, where 0 <= i < getNumExceptions().
bool hasAddressSpace() const
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified...
void print(raw_ostream &OS, const PrintingPolicy &Policy, const Twine &PlaceHolder=Twine(), unsigned Indentation=0) const
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.
TypeWithKeyword(ElaboratedTypeKeyword Keyword, TypeClass tc, QualType Canonical, bool Dependent, bool InstantiationDependent, bool VariablyModified, bool ContainsUnexpandedParameterPack)
Whether values of this type can be null is (explicitly) unspecified.
bool isCurrentInstantiation() const
True if this template specialization type matches a current instantiation in the context in which it ...
Visibility
Describes the different kinds of visibility that a declaration may have.
bool isTypeAlias() const
Determine if this template specialization type is for a type alias template that has been substituted...
unsigned toTargetAddressSpace(LangAS AS)
Visibility getVisibility() const
Determine the visibility of this type.
Sugar type that represents a type that was qualified by a qualifier written as a macro invocation...
llvm::iterator_range< param_type_iterator > param_type_range
Represents a typeof (or typeof) expression (a GCC extension).
bool containsUnexpandedParameterPack() const
Whether this type is or contains an unexpanded parameter pack, used to support C++0x variadic templat...
static bool isRecordType(QualType T)
QualType withExactLocalFastQualifiers(unsigned TQs) const
void addCVRQualifiers(unsigned mask)
bool isNonOverloadPlaceholderType() const
Determines whether this type is a placeholder type other than Overload.
bool isVolatileQualified() const
Determine whether this type is volatile-qualified.
bool hasNonTrivialToPrimitiveDestructCUnion() const
Check if this is or contains a C union that is non-trivial to destruct, which is a union that has a m...
LangAS getAddressSpace() const
ObjCProtocolDecl *const * getProtocolStorage() const
FunctionTypeBitfields store various bits belonging to FunctionProtoType.
const Type * getClass() const
bool isRValueReferenceType() const
void Profile(llvm::FoldingSetNodeID &ID)
Defines the Diagnostic-related interfaces.
The type is an Objective-C retainable pointer type that is qualified with the ARC __strong qualifier...
QualType getPointeeType() const
Values of this type can never be null.
Expr * getSizeExpr() const
static Qualifiers removeCommonQualifiers(Qualifiers &L, Qualifiers &R)
Returns the common set of qualifiers while removing them from the given sets.
const Type * getTypePtr() const
Retrieves a pointer to the underlying (unqualified) type.
static bool classof(const Type *T)
const TemplateArgument * getArgs() const
Retrieve the template arguments.
param_type_iterator param_type_begin() const
TemplateTypeParmDecl * TTPDecl
void addQualifiers(Qualifiers Q)
Add the qualifiers from the given set to this set.
The type is an Objective-C retainable pointer type that is qualified with the ARC __strong qualifier...
bool hasDynamicExceptionSpec() const
Return whether this function has a dynamic (throw) exception spec.
static bool isBooleanType(QualType Ty)
Defines the Linkage enumeration and various utility functions.
static bool classof(const Type *T)
const T * getAsAdjusted() const
Member-template getAsAdjusted<specific type>.
Represents an Objective-C protocol declaration.
const Type * operator->() const
void setUnaligned(bool flag)
bool isFloat128Type() const
static bool classof(const Type *T)
bool isScalarType() const
void * getAsOpaquePtr() const
bool compatiblyIncludesObjCLifetime(Qualifiers other) const
Determines if these qualifiers compatibly include another set of qualifiers from the narrow perspecti...
friend Qualifiers operator+(Qualifiers L, Qualifiers R)
void addCVRUQualifiers(unsigned mask)
Represents an ObjC class declaration.
ObjCInterfaceDecl * getInterface() const
Gets the interface declaration for this object type, if the base type really is an interface...
friend bool operator==(const QualType &LHS, const QualType &RHS)
Indicate whether the specified types and qualifiers are identical.
bool isKindOfType() const
Whether this is a "__kindof" type.
PrimitiveDefaultInitializeKind
FunctionDecl * SourceDecl
The function whose exception specification this is, for EST_Unevaluated and EST_Uninstantiated.
SplitQualType getSplitDesugaredType() const
The type does not fall into any of the following categories.
void setFastQualifiers(unsigned mask)
Expr * getSizeExpr() const
bool getNoCallerSavedRegs() const
QualType getPointeeTypeAsWritten() const
Expr * getSizeExpr() const
unsigned getNumProtocols() const
Return the number of qualifying protocols in this type, or 0 if there are none.
QualType getElementType() const
bool isUnsignedFixedPointType() const
Return true if this is a fixed point type that is unsigned according to ISO/IEC JTC1 SC22 WG14 N1169...
static void Profile(llvm::FoldingSetNodeID &ID, const TemplateTypeParmType *Replaced, QualType Replacement)
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.
The type does not fall into any of the following categories.
Qualifiers withoutObjCGCAttr() const
static void Profile(llvm::FoldingSetNodeID &ID, ElaboratedTypeKeyword Keyword, NestedNameSpecifier *NNS, const IdentifierInfo *Name)
static bool classof(const Type *T)
ExtInfo withCallingConv(CallingConv cc) const
friend bool operator==(ExtParameterInfo lhs, ExtParameterInfo rhs)
Represents a K&R-style 'int foo()' function, which has no information available about its arguments...
Expr * getAddrSpaceExpr() const
Provides definitions for the various language-specific address spaces.
bool hasObjCLifetime() const
void Profile(llvm::FoldingSetNodeID &ID)
bool isSpecializedAsWritten() const
Determine whether this object type was written with type arguments.
QualType getBaseType() const
Gets the base type of this object type.
unsigned getLocalFastQualifiers() const
void Profile(llvm::FoldingSetNodeID &ID)
A little helper class used to produce diagnostics.
ExtQuals(const Type *baseType, QualType canon, Qualifiers quals)
FunctionDecl * getExceptionSpecDecl() const
If this function type has an exception specification which hasn't been determined yet (either because...
Represents a prototype with parameter type info, e.g.
bool hasOnlyVolatile() const
bool compatiblyIncludes(Qualifiers other) const
Determines if these qualifiers compatibly include another set.
bool isSugared() const
Returns whether this type directly provides sugar.
bool isMoreQualifiedThan(QualType Other) const
Determine whether this type is more qualified than the other given type, requiring exact equality for...
bool isNonOverloadPlaceholderType() const
Test for a placeholder type other than Overload; see BuiltinType::isNonOverloadPlaceholderType.
This class wraps the list of protocol qualifiers.
Qualifiers getQualifiers() const
ArraySizeModifier
Capture whether this is a normal array (e.g.
const Type * getPointeeOrArrayElementType() const
If this is a pointer type, return the pointee type.
static ExtParameterInfo getFromOpaqueValue(unsigned char data)
bool hasQualifiers() const
Determine whether this type has any qualifiers.
void addObjCLifetime(ObjCLifetime type)
ObjCTypeParamDecl * getDecl() const
bool isSaturatedFixedPointType() const
Return true if this is a saturated fixed point type according to ISO/IEC JTC1 SC22 WG14 N1169...
ObjCProtocolDecl ** getProtocolStorage()
DependentTemplateSpecializationTypeBitfields DependentTemplateSpecializationTypeBits
void Profile(llvm::FoldingSetNodeID &ID)
static void Profile(llvm::FoldingSetNodeID &ID, ElaboratedTypeKeyword Keyword, NestedNameSpecifier *NNS, QualType NamedType, TagDecl *OwnedTagDecl)
Represents an array type in C++ whose size is a value-dependent expression.
static bool classof(const Type *T)
RecordType(TypeClass TC, RecordDecl *D)
static bool classof(const Type *T)
QualType getElementType() const
IdentifierInfo * getIdentifier() const
bool hasOnlyConst() const
ExtParameterInfo withIsNoEscape(bool NoEscape) const
unsigned getNumArgs() const
Retrieve the number of template arguments.
bool isObjCGCStrong() const
true when Type is objc's strong.
This represents one expression.
QualType getPointeeType() const
static void getAsStringInternal(SplitQualType split, std::string &out, const PrintingPolicy &policy)
static bool classof(const Type *T)
The "typename" keyword precedes the qualified type name, e.g., typename T::type.
bool isFunctionNoProtoType() const
llvm::StringRef getAsString(SyncScope S)
unsigned getAsOpaqueValue() const
static Kind getNullabilityAttrKind(NullabilityKind kind)
Retrieve the attribute kind corresponding to the given nullability kind.
Declaration of a template type parameter.
unsigned getIndex() const
Internal representation of canonical, dependent decltype(expr) types.
bool getHasRegParm() const
friend bool operator!=(const QualType &LHS, const QualType &RHS)
bool isObjCBuiltinType() const
const T * castAs() const
Member-template castAs<specific type>.
static bool classof(const Type *T)
ElaboratedTypeKeyword
The elaboration keyword that precedes a qualified type name or introduces an elaborated-type-specifie...
static bool classof(const Type *T)
__UINTPTR_TYPE__ uintptr_t
An unsigned integer type with the property that any valid pointer to void can be converted to this ty...
void Profile(llvm::FoldingSetNodeID &ID)
Qualifiers::GC getObjCGCAttr() const
Returns gc attribute of this type.
const internal::VariadicAllOfMatcher< Decl > decl
Matches declarations.
bool isFunctionReferenceType() const
ObjCSubstitutionContext
The kind of type we are substituting Objective-C type arguments into.
bool isSignedInteger() const
bool isNullPtrType() const
bool hasFastQualifiers() const
unsigned getFastQualifiers() const
static bool classof(const Type *T)
void Profile(llvm::FoldingSetNodeID &ID) const
ObjCLifetime getObjCLifetime() const
void removeFastQualifiers(unsigned mask)
bool isObjCClassType() const
bool canDecayToPointerType() const
Determines whether this type can decay to a pointer type.
void Profile(llvm::FoldingSetNodeID &ID)
bool isSugared() const
Returns whether this type directly provides sugar.
bool isObjCIdType() const
True if this is equivalent to the 'id' type, i.e.
bool isAnyComplexType() const
const IdentifierInfo * getIdentifier() const
Retrieve the type named by the typename specifier as an identifier.
void Profile(llvm::FoldingSetNodeID &ID)
ArrayType(TypeClass tc, QualType et, QualType can, ArraySizeModifier sm, unsigned tq, bool ContainsUnexpandedParameterPack)
Represents a C++ template name within the type system.
Represents the type decltype(expr) (C++11).
void removeLocalVolatile()
void printTemplateArgumentList(raw_ostream &OS, ArrayRef< TemplateArgument > Args, const PrintingPolicy &Policy)
Print a template argument list, including the '<' and '>' enclosing the template arguments.
ObjCProtocolDecl * getProtocol(unsigned I) const
Retrieve a qualifying protocol by index on the object type.
const AstTypeMatcher< ArrayType > arrayType
Matches all kinds of arrays.
AutoType * getContainedAutoType() const
Get the AutoType whose type will be deduced for a variable with an initializer of this type...
A std::pair-like structure for storing a qualified type split into its local qualifiers and its local...
void Profile(llvm::FoldingSetNodeID &ID)
static Optional< NullabilityKind > stripOuterNullability(QualType &T)
Strip off the top-level nullability annotation on the given type, if it's there.
The type is an Objective-C retainable pointer type that is qualified with the ARC __weak qualifier...
static bool classof(const Type *T)
Qualifiers Quals
The local qualifiers.
void setAddressSpace(LangAS space)
bool isObjCUnqualifiedId() const
static bool classof(const Type *T)
A helper class for Type nodes having an ElaboratedTypeKeyword.
SourceLocation getEnd() const
Represents a GCC generic vector type.
ArraySizeModifier getSizeModifier() const
An lvalue reference type, per C++11 [dcl.ref].
unsigned getNumProtocols() const
Return the number of qualifying protocols on the object type.
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.
const BuiltinType * getAsPlaceholderType() const
bool hasTargetSpecificAddressSpace() const
ObjCObjectType::qual_iterator qual_iterator
An iterator over the qualifiers on the object type.
The result type of a method or function.
bool hasNonTrivialToPrimitiveDefaultInitializeCUnion() const
Check if this is or contains a C union that is non-trivial to default-initialize, which is a union th...
static bool classof(const Type *T)
void removeLocalCVRQualifiers(unsigned Mask)
ExtInfo(bool noReturn, bool hasRegParm, unsigned regParm, CallingConv cc, bool producesResult, bool noCallerSavedRegs, bool NoCfCheck)
QualType withoutLocalFastQualifiers() const
bool isNull() const
Return true if this QualType doesn't point to a type yet.
bool IsEnumDeclComplete(EnumDecl *ED)
Check if the given decl is complete.
void removeCVRQualifiers(unsigned mask)
static StringRef getIdentifier(const Token &Tok)
CallingConv
CallingConv - Specifies the calling convention that a function uses.
Expr * getUnderlyingExpr() const
bool hasOnlyRestrict() const
unsigned getCVRQualifiers() const
Retrieve the set of CVR (const-volatile-restrict) qualifiers applied to this type.
bool isSignedFixedPointType() const
Return true if this is a fixed point type that is signed according to ISO/IEC JTC1 SC22 WG14 N1169...
ExtInfo withNoReturn(bool noReturn) const
bool isConstQualified() const
Determine whether this type is const-qualified.
bool hasTrailingReturn() const
Whether this function prototype has a trailing return type.
bool hasQualifiers() const
Return true if the set contains any qualifiers.
SplitQualType split() const
Divides a QualType into its unqualified type and a set of local qualifiers.
RecordDecl * getDecl() const
static void Profile(llvm::FoldingSetNodeID &ID, QualType Pointee)
noexcept(expression), evals to 'false'
llvm::iterator_range< qual_iterator > qual_range
static void * getAsVoidPointer(::clang::ExtQuals *P)
bool operator!=(ExtInfo Other) const
ArrayRef< QualType > getTypeArgsAsWritten() const
Retrieve the type arguments for this type.
CanThrowResult
Possible results from evaluation of a noexcept expression.
static void * getAsVoidPointer(clang::QualType P)
bool isComputedNoexcept(ExceptionSpecificationType ESpecType)
There is no lifetime qualification on this type.
static void Profile(llvm::FoldingSetNodeID &ID, QualType ResultType, ExtInfo Info)
void setNumProtocols(unsigned N)
is AltiVec 'vector Pixel'
Assigning into this object requires the old value to be released and the new value to be retained...
QualType getCanonicalType() const
bool isBuiltinType() const
Helper methods to distinguish type categories.
not a target-specific vector type
ExceptionSpecificationType Type
The kind of exception specification this is.
static bool classof(const Type *T)
param_type_range param_types() const
static bool classof(const Type *T)
ExtParameterInfo getExtParameterInfo(unsigned I) const
ElaboratedTypeKeyword getKeyword() const
ExtProtoInfo getExtProtoInfo() const
bool isAccessorWithinNumElements(char c, bool isNumericAccessor) const
const ExtParameterInfo * ExtParameterInfos
Encodes a location in the source.
ObjCInterfaceDecl * getDecl() const
Get the declaration of this interface.
void addVolatile()
Add the volatile type qualifier to this QualType.
Sugar for parentheses used when specifying types.
QualType getAdjustedType() const
QualType getReturnType() const
A helper class that allows the use of isa/cast/dyncast to detect TagType objects of enums...
bool isMemberDataPointer() const
Returns true if the member type (i.e.
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.
Represents typeof(type), a GCC extension.
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).
static inline ::clang::ExtQuals * getFromVoidPointer(void *P)
bool isObjCQualifiedClassType() const
True if this is equivalent to 'Class.
static bool classof(const Type *T)
bool hasObjCGCAttr() const
static bool classof(const Type *T)
ParameterABI getABI() const
Return the ABI treatment of this parameter.
Represents the declaration of a struct/union/class/enum.
static bool isPlaceholderTypeKind(Kind K)
Determines whether the given kind corresponds to a placeholder type.
CallingConv getCC() const
static bool classof(const Type *T)
void Profile(llvm::FoldingSetNodeID &ID)
QualType getElementType() const
static QualType getUnderlyingType(const SubRegion *R)
static void Profile(llvm::FoldingSetNodeID &ID, QualType T)
Represents a vector type where either the type or size is dependent.
static bool classof(const Type *T)
unsigned getLocalCVRQualifiers() const
Retrieve the set of CVR (const-volatile-restrict) qualifiers local to this particular QualType instan...
void FixedPointValueToString(SmallVectorImpl< char > &Str, llvm::APSInt Val, unsigned Scale)
static bool hasAttr(const FunctionDecl *D, bool IgnoreImplicitAttr)
void initialize(ArrayRef< ObjCProtocolDecl *> protocols)
bool hasExceptionSpec() const
Return whether this function has any kind of exception spec.
bool hasObjCPointerRepresentation() const
Whether this type can represent an objective pointer type for the purpose of GC'ability.
void Profile(llvm::FoldingSetNodeID &ID)
Represents a C++ nested name specifier, such as "\::std::vector<int>::".
static void Profile(llvm::FoldingSetNodeID &ID, const Type *BaseType, Qualifiers Quals)
No ref-qualifier was provided.
bool isParameterPack() const
Qualifiers getMethodQuals() const
const TemplateTypeParmType * getReplacedParameter() const
Gets the template parameter that was substituted for.
QualType getEquivalentType() const
Expr * getNoexceptExpr() const
Return the expression inside noexcept(expression), or a null pointer if there is none (because the ex...
CanQual< Type > CanQualType
Represents a canonical, potentially-qualified type.
void Profile(llvm::FoldingSetNodeID &ID)
AttributedTypeBitfields AttributedTypeBits
QualType getInnerType() const
Qualifiers withoutObjCLifetime() const
ExceptionSpecInfo(ExceptionSpecificationType EST)
bool isMemberFunctionPointerType() const
bool isObjCObjectPointerType() const
bool isAnyPointerType() const
bool isDecltypeType() const
is AltiVec 'vector bool ...'
RefQualifierKind
The kind of C++11 ref-qualifier associated with a function type.
SplitQualType getSplitUnqualifiedType() const
Retrieve the unqualified variant of the given type, removing as little sugar as possible.
ExtParameterInfo withHasPassObjectSize() const
NestedNameSpecifier * getQualifier() const
Retrieve the qualification on this type.
bool isFunctionProtoType() const
DestructionKind isDestructedType() const
Returns a nonzero value if objects of this type require non-trivial work to clean up after...
static bool classof(const Type *T)
AutoTypeKeyword getKeyword() const
bool isAddressSpaceOverlapping(const PointerType &other) const
Returns true if address spaces of pointers overlap.
Qualifiers getIndexTypeQualifiers() const
bool isFixedPointOrIntegerType() const
Return true if this is a fixed point or integer type.
TypeClass getTypeClass() const
Qualifiers & operator-=(Qualifiers R)
ArrayRef< TemplateArgument > template_arguments() const
QualType getSuperClassType() const
Retrieve the type of the superclass of this object type.
bool isTargetAddressSpace(LangAS AS)
static bool isVectorSizeTooLarge(unsigned NumElements)
EnumDecl * getDecl() const
const char * getNameAsCString(const PrintingPolicy &Policy) const
bool isVectorType() const
__DEVICE__ void * memcpy(void *__a, const void *__b, size_t __c)
An rvalue ref-qualifier was provided (&&).
SourceRange getBracketsRange() const
void addFastQualifiers(unsigned TQs)
TemplateSpecializationTypeBitfields TemplateSpecializationTypeBits
bool hasPassObjectSize() const
Optional< unsigned > getNumExpansions() const
Retrieve the number of expansions that this pack expansion will generate, if known.
static QualType getFromOpaquePtr(const void *Ptr)
void setVariablyModified(bool VM=true)
ParameterABI
Kinds of parameter ABI.
bool isLocalVolatileQualified() const
Determine whether this particular QualType instance has the "volatile" qualifier set, without looking through typedefs that may have added "volatile" at a different level.
bool isInstantiationDependentType() const
Determine whether this type is an instantiation-dependent type, meaning that the type involves a temp...
void Profile(llvm::FoldingSetNodeID &ID)
bool isTemplateTypeParmType() const
ExceptionSpecificationType getExceptionSpecType() const
Get the kind of exception specification on this function.
Represents a pointer type decayed from an array or function type.
The type is an Objective-C retainable pointer type that is qualified with the ARC __weak qualifier...
The injected class name of a C++ class template or class template partial specialization.
exception_iterator exception_begin() const
QualType getPointeeType() const
Represents a pack expansion of types.
Defines various enumerations that describe declaration and type specifiers.
bool isPlaceholderType() const
Test for a type which does not represent an actual type-system type but is instead used as a placehol...
bool isObjCGCWeak() const
true when Type is objc's weak.
Base class for declarations which introduce a typedef-name.
QualType withVolatile() const
friend bool operator!=(SplitQualType a, SplitQualType b)
Represents a template argument.
static bool classof(const Type *T)
Represents a type which was implicitly adjusted by the semantic engine for arbitrary reasons...
QualType withRestrict() const
TagTypeKind
The kind of a tag type.
Optional< types::ID > Type
StreamedQualTypeHelper stream(const PrintingPolicy &Policy, const Twine &PlaceHolder=Twine(), unsigned Indentation=0) const
Dataflow Directional Tag Classes.
bool isUnsaturatedFixedPointType() const
Return true if this is a saturated fixed point type according to ISO/IEC JTC1 SC22 WG14 N1169...
SourceLocation getRBracketLoc() const
bool isFloat16Type() const
ExtInfo getExtInfo() const
bool isObjCIdOrClassType() const
True if this is equivalent to the 'id' or 'Class' type,.
not evaluated yet, for special member function
A qualifier set is used to build a set of qualifiers.
NestedNameSpecifier * getQualifier() const
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
void setContainsUnexpandedParameterPack(bool PP=true)
ExtParameterInfo withABI(ParameterABI kind) const
static bool classof(const Type *T)
TypeWithKeywordBitfields TypeWithKeywordBits
static std::string getName(const CallEvent &Call)
ArrayRef< QualType > getTypeArgs() const
Retrieve the type arguments for this type.
void removeLocalFastQualifiers()
static bool classof(const Type *T)
static bool classof(const Type *T)
const TemplateArgument * getArgs() const
Retrieve the template arguments.
bool isObjCClassType() const
True if this is equivalent to the 'Class' type, i.e.
Reads an AST files chain containing the contents of a translation unit.
TypedefType(TypeClass tc, const TypedefNameDecl *D, QualType can)
bool isDependentAddressSpaceType() const
Interesting information about a specific parameter that can't simply be reflected in parameter's type...
StreamedQualTypeHelper(const QualType &T, const PrintingPolicy &Policy, const Twine &PlaceHolder, unsigned Indentation)
bool hasLocalQualifiers() const
Determine whether this particular QualType instance has any qualifiers, without looking through any t...
QualType getUnderlyingType() const
const Type * getBaseType() const
Represents a dependent using declaration which was marked with typename.
Represents the declaration of an Objective-C type parameter.
VectorKind getVectorKind() const
ArrayRef< QualType > exceptions() const
static std::string getAsString(SplitQualType split, const PrintingPolicy &Policy)
The "union" keyword introduces the elaborated-type-specifier.
bool isBooleanType() const
const Type * strip(QualType type)
Collect any qualifiers on the given type and return an unqualified type.
void Profile(llvm::FoldingSetNodeID &ID)
Qualifiers withoutAddressSpace() const
const ObjCObjectType * getObjectType() const
Gets the type pointed to by this ObjC pointer.
The "class" keyword introduces the elaborated-type-specifier.
friend raw_ostream & operator<<(raw_ostream &OS, const StreamedQualTypeHelper &SQT)
ReferenceTypeBitfields ReferenceTypeBits
FunctionType::ExtInfo getFunctionExtInfo(const Type &t)
void Profile(llvm::FoldingSetNodeID &ID)
QualType(const ExtQuals *Ptr, unsigned Quals)
A pointer to member type per C++ 8.3.3 - Pointers to members.
QualType getCallResultType(const ASTContext &Context) const
Determine the type of an expression that calls a function of this type.
bool hasObjCLifetime() const
SplitQualType getSingleStepDesugaredType() const
void setCVRQualifiers(unsigned mask)
static void Profile(llvm::FoldingSetNodeID &ID, QualType Orig, QualType New)
static void Profile(llvm::FoldingSetNodeID &ID, QualType Pattern, Optional< unsigned > NumExpansions)
ExtProtoInfo withExceptionSpec(const ExceptionSpecInfo &ESI)
const TemplateTypeParmType * getReplacedParameter() const
Gets the template parameter that was substituted for.
void Profile(llvm::FoldingSetNodeID &ID)
bool isUndeducedType() const
Determine whether this type is an undeduced type, meaning that it somehow involves a C++11 'auto' typ...
Qualifiers::ObjCLifetime getObjCLifetime() const
static bool classof(const Type *T)
void Profile(llvm::FoldingSetNodeID &ID) const
void addConsistentQualifiers(Qualifiers qs)
Add the qualifiers from the given set to this set, given that they don't conflict.
bool hasCVRQualifiers() const
bool isObjCUnqualifiedIdOrClass() const
void removeCVRQualifiers()
QualType getModifiedType() const
static void Profile(llvm::FoldingSetNodeID &ID, QualType T, bool isRead)
Represents a pointer to an Objective C object.
static bool classof(const Type *T)
bool isUnspecializedAsWritten() const
Determine whether this object type is "unspecialized" as written, meaning that it has no type argumen...
FunctionTypeBitfields FunctionTypeBits
bool isIncompleteArrayType() const
FunctionDecl * SourceTemplate
The function template whose exception specification this is instantiated from, for EST_Uninstantiated...
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.
unsigned getIndexTypeCVRQualifiers() const
static bool classof(const Type *T)
unsigned getNumArgs() const
Retrieve the number of template arguments.
static bool classof(const Type *T)
bool isObjCQualifiedId() const
static bool classof(const OMPClause *T)
ObjCInterfaceDecl * getInterfaceDecl() const
If this pointer points to an Objective @interface type, gets the declaration for that interface...
QualType getCanonicalTypeInternal() const
AutoTypeBitfields AutoTypeBits
static bool classof(const Type *T)
bool isReserveIDT() const
unsigned getCVRUQualifiers() const
bool isIntegerType() const
isIntegerType() does not include complex integers (a GCC extension).
bool hasNonTrivialObjCLifetime() const
bool isFromAST() const
Whether this type comes from an AST file.
void Profile(llvm::FoldingSetNodeID &ID)
static bool classof(const Type *T)
const llvm::APInt & getSize() const
bool isAtomicType() const
bool isFunctionType() const
bool hasNonFastQualifiers() const
Return true if the set contains any qualifiers which require an ExtQuals node to be allocated...
bool isAddressSpaceSupersetOf(Qualifiers other) const
Returns true if the address space in these qualifiers is equal to or a superset of the address space ...
VectorTypeBitfields VectorTypeBits
bool isObjCQualifiedIdType() const
std::integral_constant< bool, std::is_same< T, ArrayType >::value||std::is_base_of< ArrayType, T >::value > TypeIsArrayType
static bool classof(const Type *T)
llvm::iterator_range< qual_iterator > qual_range
ExtVectorType - Extended vector type.
Base for LValueReferenceType and RValueReferenceType.
SourceRange getBracketsRange() const
ExceptionSpecificationType
The various types of exception specifications that exist in C++11.
Holds information about the various types of exception specification.
QualType getUnderlyingType() const
static bool classof(const Type *T)
static bool classof(const Type *T)
Implements a partial diagnostic that can be emitted anwyhere in a DiagnosticBuilder stream...
bool isConstantArrayType() const
QualType getNonLValueExprType(const ASTContext &Context) const
Determine the type of a (typically non-lvalue) expression with the specified result type...
static clang::QualType getFromVoidPointer(void *P)
const Type * getTypePtrOrNull() const
bool isObjectType() const
Determine whether this type is an object type.
ArrayRef< QualType > Exceptions
Explicitly-specified list of exception types.
bool isObjCObjectType() const
bool hasObjCGCAttr() const
bool hasNoexceptExceptionSpec() const
Return whether this function has a noexcept exception spec.
QualType withCVRQualifiers(unsigned CVR) const
bool isLValueReferenceType() const
VectorType::VectorKind getVectorKind() const
TypedefNameDecl * getDecl() const
Reading or writing from this object requires a barrier call.
Expr * NoexceptExpr
Noexcept expression, if this is a computed noexcept specification.
static void Profile(llvm::FoldingSetNodeID &ID, QualType Pointee, const Type *Class)
unsigned getDepth() const
An attributed type is a type to which a type attribute has been applied.
QualType getParamType(unsigned i) const
Represents a type parameter type in Objective C.
bool isCanonicalAsParam() const
CallingConv getCallConv() const
Defines the clang::SourceLocation class and associated facilities.
void Profile(llvm::FoldingSetNodeID &ID)
QualType getAliasedType() const
Get the aliased type, if this is a specialization of a type alias template.
QualType getUnqualifiedType() const
Retrieve the unqualified variant of the given type, removing as little sugar as possible.
bool hasUnaligned() const
Represents a C++ struct/union/class.
void removeLocalRestrict()
Represents a template specialization type whose template cannot be resolved, e.g. ...
ArrayRef< TemplateArgument > template_arguments() const
bool isMemberFunctionPointer() const
Returns true if the member type (i.e.
bool isLocalConstQualified() const
Determine whether this particular QualType instance has the "const" qualifier set, without looking through typedefs that may have added "const" at a different level.
bool hasStrongOrWeakObjCLifetime() const
qual_iterator qual_end() const
static bool classof(const Type *T)
Represents a C array with an unspecified size.
SplitQualType(const Type *ty, Qualifiers qs)
void removeFastQualifiers()
static inline ::clang::Type * getFromVoidPointer(void *P)
Qualifiers getQualifiers() const
Retrieve the set of qualifiers applied to this type.
The parameter type of a method or function.
QualType getNamedType() const
Retrieve the type named by the qualified-id.
DeducedType(TypeClass TC, QualType DeducedAsType, bool IsDependent, bool IsInstantiationDependent, bool ContainsParameterPack)
QualType getReplacementType() const
Gets the type that was substituted for the template parameter.
void Profile(llvm::FoldingSetNodeID &ID)
static bool isAddressSpaceSupersetOf(LangAS A, LangAS B)
Returns true if address space A is equal to or a superset of B.
qual_iterator qual_begin() const
unsigned kind
All of the diagnostics that can be emitted by the frontend.
This class is used for builtin types like 'int'.
Writes an AST file containing the contents of a translation unit.
unsigned getRegParmType() const
static bool isCharType(QualType T)
void Profile(llvm::FoldingSetNodeID &ID)
static bool classof(const Type *T)
Qualifiers getNonFastQualifiers() const
bool isVisibilityExplicit() const
Return true if the visibility was explicitly set is the code.
void removeLocalFastQualifiers(unsigned Mask)
unsigned getCVRQualifiers() const
bool isOCLIntelSubgroupAVCType() const
static Qualifiers fromCVRMask(unsigned CVR)
SourceLocation getLBracketLoc() const
static Decl::Kind getKind(const Decl *D)
unsigned getNumElements() const
bool isFundamentalType() const
Tests whether the type is categorized as a fundamental type.
Microsoft __declspec(nothrow) extension.
bool isDependentType() const
Whether this type is a dependent type, meaning that its definition somehow depends on a template para...
Represents an extended address space qualifier where the input address space value is dependent...
Represents a type template specialization; the template must be a class template, a type alias templa...
bool isPointerType() const
static void Profile(llvm::FoldingSetNodeID &ID, QualType Element)
unsigned getAddressSpaceAttributePrintValue() const
Get the address space attribute value to be printed by diagnostics.
void addAddressSpace(LangAS space)
RecordType(const RecordDecl *D)
static void Profile(llvm::FoldingSetNodeID &ID, QualType ET, ArraySizeModifier SizeMod, unsigned TypeQuals)
static SimpleType getSimplifiedValue(::clang::QualType Val)
We can encode up to four bits in the low bits of a type pointer, but there are many more type qualifi...
bool isConsumed() const
Is this parameter considered "consumed" by Objective-C ARC? Consumed parameters must have retainable ...
BuiltinTypeBitfields BuiltinTypeBits
static int getNumericAccessorIdx(char c)
A trivial tuple used to represent a source range.
This represents a decl that may have a name.
A simple holder for a QualType representing a type in an exception specification. ...
void addFastQualifiers(unsigned mask)
bool isOpenCLSpecificType() const
FunctionDecl * getExceptionSpecTemplate() const
If this function type has an uninstantiated exception specification, this is the function whose excep...
Represents a C array with a specified size that is not an integer-constant-expression.
No keyword precedes the qualified type name.
bool isConstant(const ASTContext &Ctx) const
static int getAccessorIdx(char c, bool isNumericAccessor)
SourceLocation getAttributeLoc() const
void Profile(llvm::FoldingSetNodeID &ID)
QualType getElementType() const
void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Context)
const ExtParameterInfo * getExtParameterInfosOrNull() const
Return a pointer to the beginning of the array of extra parameter information, if present...
bool isFunctionPointerType() const
friend bool operator==(SplitQualType a, SplitQualType b)
static void Profile(llvm::FoldingSetNodeID &ID, UnresolvedUsingTypenameDecl *D)
void removeAddressSpace()
SourceLocation getBegin() const
QualifierCollector(Qualifiers Qs=Qualifiers())
bool operator!=(Qualifiers Other) 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
bool isUnsignedInteger() const
static bool classof(const Type *T)
ExtInfo withRegParm(unsigned RegParm) const
A class which abstracts out some details necessary for making a call.
static bool classof(const Type *T)
bool isIncompleteOrObjectType() const
Return true if this is an incomplete or object type, in other words, not a function type...
bool hasSizedVLAType() const
Whether this type involves a variable-length array type with a definite size.
static void Profile(llvm::FoldingSetNodeID &ID, unsigned Depth, unsigned Index, bool ParameterPack, TemplateTypeParmDecl *TTPDecl)
QualType getPointeeType() const
void Profile(llvm::FoldingSetNodeID &ID)
noexcept(expression), evals to 'true'
const IdentifierInfo * getIdentifier() const
Expr * getSizeExpr() const
Qualifiers::ObjCLifetime getObjCLifetime() const
Returns lifetime attribute of this type.
param_type_iterator param_type_end() const
static void Profile(llvm::FoldingSetNodeID &ID, TemplateName Template, QualType Deduced, bool IsDependent)
bool isCompoundType() const
Tests whether the type is categorized as a compound type.
QualType getPointeeType() const
Gets the type pointed to by this ObjC pointer.