18 #ifndef LLVM_CLANG_AST_TYPE_H 19 #define LLVM_CLANG_AST_TYPE_H 33 #include "llvm/ADT/APInt.h" 34 #include "llvm/ADT/APSInt.h" 35 #include "llvm/ADT/ArrayRef.h" 36 #include "llvm/ADT/FoldingSet.h" 37 #include "llvm/ADT/None.h" 38 #include "llvm/ADT/Optional.h" 39 #include "llvm/ADT/PointerIntPair.h" 40 #include "llvm/ADT/PointerUnion.h" 41 #include "llvm/ADT/StringRef.h" 42 #include "llvm/ADT/Twine.h" 43 #include "llvm/ADT/iterator_range.h" 44 #include "llvm/Support/Casting.h" 45 #include "llvm/Support/Compiler.h" 46 #include "llvm/Support/ErrorHandling.h" 47 #include "llvm/Support/PointerLikeTypeTraits.h" 48 #include "llvm/Support/type_traits.h" 49 #include "llvm/Support/TrailingObjects.h" 55 #include <type_traits> 75 struct PointerLikeTypeTraits;
106 template <
typename>
class CanQual;
111 class ExtQualsTypeCommonBase;
113 class IdentifierInfo;
115 class ObjCInterfaceDecl;
116 class ObjCProtocolDecl;
117 class ObjCTypeParamDecl;
118 struct PrintingPolicy;
122 class TemplateArgument;
123 class TemplateArgumentListInfo;
124 class TemplateArgumentLoc;
125 class TemplateTypeParmDecl;
126 class TypedefNameDecl;
127 class UnresolvedUsingTypenameDecl;
132 #define TYPE(Class, Base) class Class##Type; 133 #include "clang/AST/TypeNodes.def" 147 CVRMask = Const | Volatile | Restrict
181 MaxAddressSpace = 0x7fffffu,
187 FastMask = (1 << FastWidth) - 1
194 if (!(L.Mask & ~CVRMask) && !(R.Mask & ~CVRMask)) {
196 Q.Mask = L.Mask & R.Mask;
278 assert(!(mask & ~CVRMask) &&
"bitmask contains non-CVR bits");
279 Mask = (Mask & ~CVRMask) | mask;
282 assert(!(mask & ~CVRMask) &&
"bitmask contains non-CVR bits");
286 removeCVRQualifiers(CVRMask);
289 assert(!(mask & ~CVRMask) &&
"bitmask contains non-CVR bits");
293 assert(!(mask & ~CVRMask & ~UMask) &&
"bitmask contains non-CVRU bits");
299 Mask = (Mask & ~UMask) | (flag ? UMask : 0);
307 Mask = (Mask & ~GCAttrMask) | (type << GCAttrShift);
327 return ObjCLifetime((Mask & LifetimeMask) >> LifetimeShift);
330 Mask = (Mask & ~LifetimeMask) | (type << LifetimeShift);
335 assert(!hasObjCLifetime());
336 Mask |= (type << LifetimeShift);
342 return (lifetime > OCL_ExplicitNone);
348 return (lifetime == OCL_Strong || lifetime == OCL_Weak);
353 return static_cast<LangAS>(Mask >> AddressSpaceShift);
360 auto Addr = getAddressSpace();
373 assert((
unsigned)space <= MaxAddressSpace);
374 Mask = (Mask & ~AddressSpaceMask)
375 | (((uint32_t) space) << AddressSpaceShift);
380 setAddressSpace(space);
388 assert(!(mask & ~FastMask) &&
"bitmask contains non-fast qualifier bits");
389 Mask = (Mask & ~FastMask) | mask;
392 assert(!(mask & ~FastMask) &&
"bitmask contains non-fast qualifier bits");
396 removeFastQualifiers(FastMask);
399 assert(!(mask & ~FastMask) &&
"bitmask contains non-fast qualifier bits");
414 bool empty()
const {
return !Mask; }
420 if (!(Q.Mask & ~CVRMask))
423 Mask |= (Q.Mask & CVRMask);
437 if (!(Q.Mask & ~CVRMask))
440 Mask &= ~(Q.Mask & CVRMask);
444 removeObjCLifetime();
446 removeAddressSpace();
483 return isAddressSpaceSupersetOf(other) &&
486 (getObjCGCAttr() == other.
getObjCGCAttr() || !hasObjCGCAttr() ||
491 (((Mask & CVRMask) | (other.Mask & CVRMask)) == (Mask & CVRMask)) &&
507 if (getObjCLifetime() == OCL_Weak || other.
getObjCLifetime() == OCL_Weak)
510 if (getObjCLifetime() == OCL_None || other.
getObjCLifetime() == OCL_None)
518 bool isStrictSupersetOf(
Qualifiers Other)
const;
523 explicit operator bool()
const {
return hasQualifiers(); }
553 bool appendSpaceIfNonEmpty =
false)
const;
564 static const uint32_t UMask = 0x8;
565 static const uint32_t UShift = 3;
566 static const uint32_t GCAttrMask = 0x30;
567 static const uint32_t GCAttrShift = 4;
568 static const uint32_t LifetimeMask = 0x1C0;
569 static const uint32_t LifetimeShift = 6;
570 static const uint32_t AddressSpaceMask =
571 ~(CVRMask | UMask | GCAttrMask | LifetimeMask);
572 static const uint32_t AddressSpaceShift = 9;
590 std::pair<const Type *,Qualifiers>
asPair()
const {
591 return std::pair<const Type *, Qualifiers>(Ty, Quals);
642 llvm::PointerIntPair<llvm::PointerUnion<const Type *, const ExtQuals *>,
645 const ExtQuals *getExtQualsUnsafe()
const {
646 return Value.getPointer().get<
const ExtQuals*>();
649 const Type *getTypePtrUnsafe()
const {
650 return Value.getPointer().get<
const Type*>();
654 assert(!isNull() &&
"Cannot retrieve a NULL type pointer");
655 auto CommonPtrVal =
reinterpret_cast<uintptr_t>(Value.getOpaqueValue());
672 const Type *getTypePtr()
const;
674 const Type *getTypePtrOrNull()
const;
687 T.Value.setFromOpaqueValue(const_cast<void*>(Ptr));
692 return *getTypePtr();
699 bool isCanonical()
const;
700 bool isCanonicalAsParam()
const;
704 return Value.getPointer().isNull();
715 bool isConstQualified()
const;
725 bool isRestrictQualified()
const;
735 bool isVolatileQualified()
const;
741 return getLocalFastQualifiers() || hasLocalNonFastQualifiers();
745 bool hasQualifiers()
const;
751 return Value.getPointer().is<
const ExtQuals*>();
766 return getLocalFastQualifiers();
771 unsigned getCVRQualifiers()
const;
778 bool isPODType(
const ASTContext &Context)
const;
782 bool isCXX98PODType(
const ASTContext &Context)
const;
788 bool isCXX11PODType(
const ASTContext &Context)
const;
791 bool isTrivialType(
const ASTContext &Context)
const;
794 bool isTriviallyCopyableType(
const ASTContext &Context)
const;
798 bool mayBeDynamicClass()
const;
801 bool mayBeNotDynamicClass()
const;
831 return withFastQualifiers(CVR);
836 &&
"non-fast qualifier bits set in mask!");
837 Value.setInt(Value.getInt() | TQs);
840 void removeLocalConst();
841 void removeLocalVolatile();
842 void removeLocalRestrict();
843 void removeLocalCVRQualifiers(
unsigned Mask);
848 Value.setInt(Value.getInt() & ~Mask);
897 inline QualType getUnqualifiedType()
const;
912 bool isMoreQualifiedThan(
QualType Other)
const;
916 bool isAtLeastAsQualifiedAs(
QualType Other)
const;
918 QualType getNonReferenceType()
const;
939 return getDesugaredType(*
this, Context);
943 return getSplitDesugaredType(*
this);
952 return getSingleStepDesugaredTypeImpl(*
this, Context);
958 if (isa<ParenType>(*
this))
965 return LHS.Value == RHS.Value;
968 return LHS.Value != RHS.Value;
982 const Twine &PlaceHolder = Twine(),
983 unsigned Indentation = 0)
const;
987 unsigned Indentation = 0) {
988 return print(split.
Ty, split.
Quals, OS, policy, PlaceHolder, Indentation);
993 const Twine &PlaceHolder,
994 unsigned Indentation = 0);
996 void getAsStringInternal(std::string &Str,
1001 return getAsStringInternal(split.
Ty, split.
Quals, out, policy);
1011 const Twine &PlaceHolder;
1012 unsigned Indentation;
1016 const Twine &PlaceHolder,
unsigned Indentation)
1017 : T(T), Policy(Policy), PlaceHolder(PlaceHolder),
1018 Indentation(Indentation) {}
1022 SQT.T.
print(OS, SQT.Policy, SQT.PlaceHolder, SQT.Indentation);
1028 const Twine &PlaceHolder = Twine(),
1029 unsigned Indentation = 0)
const {
1033 void dump(
const char *s)
const;
1035 void dump(llvm::raw_ostream &OS)
const;
1038 ID.AddPointer(getAsOpaquePtr());
1042 inline LangAS getAddressSpace()
const;
1071 bool isNonWeakInMRRWithObjCWeak(
const ASTContext &Context)
const;
1097 isNonTrivialToPrimitiveDefaultInitialize()
const;
1145 DK_nontrivial_c_struct
1153 return isDestructedTypeImpl(*
this);
1166 bool isCForbiddenLValueType()
const;
1214 QualType getAtomicUnqualifiedType()
const;
1256 enum { NumLowBitsAvailable = 0 };
1276 const Type *
const BaseType;
1282 : BaseType(baseType), CanonicalType(canon) {}
1318 canon.isNull() ?
QualType(this_(), 0) : canon),
1321 &&
"ExtQuals created with no fast qualifiers");
1323 &&
"ExtQuals created with fast qualifiers");
1343 Profile(ID, getBaseType(), Quals);
1347 const Type *BaseType,
1350 ID.AddPointer(BaseType);
1410 #define TYPE(Class, Base) Class, 1411 #define LAST_TYPE(Class) TypeLast = Class, 1412 #define ABSTRACT_TYPE(Class, Base) 1413 #include "clang/AST/TypeNodes.def" 1414 TagFirst = Record, TagLast = Enum
1419 class TypeBitfields {
1427 unsigned Dependent : 1;
1431 unsigned InstantiationDependent : 1;
1434 unsigned VariablyModified : 1;
1438 unsigned ContainsUnexpandedParameterPack : 1;
1442 mutable unsigned CacheValid : 1;
1445 mutable unsigned CachedLinkage : 3;
1448 mutable unsigned CachedLocalOrUnnamed : 1;
1451 mutable unsigned FromAST : 1;
1453 bool isCacheValid()
const {
1458 assert(isCacheValid() &&
"getting linkage from invalid cache");
1459 return static_cast<Linkage>(CachedLinkage);
1462 bool hasLocalOrUnnamedType()
const {
1463 assert(isCacheValid() &&
"getting linkage from invalid cache");
1464 return CachedLocalOrUnnamed;
1467 enum { NumTypeBits = 18 };
1476 unsigned : NumTypeBits;
1480 unsigned IndexTypeQuals : 3;
1485 unsigned SizeModifier : 3;
1491 unsigned : NumTypeBits;
1504 unsigned : NumTypeBits;
1508 unsigned ExtInfo : 12;
1513 unsigned RefQualifier : 2;
1523 unsigned HasExtQuals : 1;
1529 unsigned NumParams : 16;
1532 unsigned ExceptionSpecType : 4;
1535 unsigned HasExtParameterInfos : 1;
1538 unsigned Variadic : 1;
1541 unsigned HasTrailingReturn : 1;
1547 unsigned : NumTypeBits;
1550 unsigned NumTypeArgs : 7;
1553 unsigned NumProtocols : 6;
1556 unsigned IsKindOf : 1;
1562 unsigned : NumTypeBits;
1575 unsigned SpelledAsLValue : 1;
1579 unsigned InnerRef : 1;
1585 unsigned : NumTypeBits;
1588 unsigned Keyword : 8;
1591 enum { NumTypeWithKeywordBits = 8 };
1596 unsigned : NumTypeBits;
1597 unsigned : NumTypeWithKeywordBits;
1600 unsigned HasOwnedTagDecl : 1;
1607 unsigned : NumTypeBits;
1611 unsigned VecKind : 3;
1614 unsigned NumElements : 29 - NumTypeBits;
1616 enum { MaxNumElements = (1 << (29 - NumTypeBits)) - 1 };
1622 unsigned : NumTypeBits;
1625 unsigned AttrKind : 32 - NumTypeBits;
1631 unsigned : NumTypeBits;
1635 unsigned Keyword : 2;
1641 unsigned : NumTypeBits;
1656 unsigned : NumTypeBits;
1659 unsigned TypeAlias : 1;
1674 unsigned : NumTypeBits;
1675 unsigned : NumTypeWithKeywordBits;
1690 unsigned : NumTypeBits;
1703 unsigned NumExpansions;
1724 static_assert(
sizeof(TypeBitfields) <= 8,
1725 "TypeBitfields is larger than 8 bytes!");
1727 "ArrayTypeBitfields is larger than 8 bytes!");
1729 "AttributedTypeBitfields is larger than 8 bytes!");
1731 "AutoTypeBitfields is larger than 8 bytes!");
1733 "BuiltinTypeBitfields is larger than 8 bytes!");
1735 "FunctionTypeBitfields is larger than 8 bytes!");
1737 "ObjCObjectTypeBitfields is larger than 8 bytes!");
1739 "ReferenceTypeBitfields is larger than 8 bytes!");
1741 "TypeWithKeywordBitfields is larger than 8 bytes!");
1743 "ElaboratedTypeBitfields is larger than 8 bytes!");
1745 "VectorTypeBitfields is larger than 8 bytes!");
1747 "SubstTemplateTypeParmPackTypeBitfields is larger" 1750 "TemplateSpecializationTypeBitfields is larger" 1753 "DependentTemplateSpecializationTypeBitfields is larger" 1756 "PackExpansionTypeBitfields is larger than 8 bytes");
1763 void setFromAST(
bool V =
true)
const {
1764 TypeBits.FromAST = V;
1771 bool InstantiationDependent,
bool VariablyModified,
1772 bool ContainsUnexpandedParameterPack)
1774 canon.isNull() ?
QualType(this_(), 0) : canon) {
1776 TypeBits.Dependent = Dependent;
1777 TypeBits.InstantiationDependent = Dependent || InstantiationDependent;
1778 TypeBits.VariablyModified = VariablyModified;
1779 TypeBits.ContainsUnexpandedParameterPack = ContainsUnexpandedParameterPack;
1780 TypeBits.CacheValid =
false;
1781 TypeBits.CachedLocalOrUnnamed =
false;
1783 TypeBits.FromAST =
false;
1790 TypeBits.Dependent = D;
1792 TypeBits.InstantiationDependent =
true;
1796 TypeBits.InstantiationDependent = D; }
1801 TypeBits.ContainsUnexpandedParameterPack = PP;
1809 Type &operator=(
const Type &) =
delete;
1832 return TypeBits.ContainsUnexpandedParameterPack;
1838 return CanonicalType ==
QualType(
this, 0);
1844 QualType getLocallyUnqualifiedSingleStepDesugaredType()
const;
1857 bool isIncompleteType(
NamedDecl **Def =
nullptr)
const;
1862 return !isFunctionType();
1870 return !isReferenceType() && !isFunctionType() && !isVoidType();
1875 bool isLiteralType(
const ASTContext &Ctx)
const;
1879 bool isStandardLayoutType()
const;
1885 bool isBuiltinType()
const;
1888 bool isSpecificBuiltinType(
unsigned K)
const;
1893 bool isPlaceholderType()
const;
1897 bool isSpecificPlaceholderType(
unsigned K)
const;
1901 bool isNonOverloadPlaceholderType()
const;
1905 bool isIntegerType()
const;
1906 bool isEnumeralType()
const;
1909 bool isScopedEnumeralType()
const;
1912 bool isWideCharType()
const;
1913 bool isChar8Type()
const;
1914 bool isChar16Type()
const;
1915 bool isChar32Type()
const;
1916 bool isAnyCharacterType()
const;
1917 bool isIntegralType(
const ASTContext &Ctx)
const;
1920 bool isIntegralOrEnumerationType()
const;
1923 bool isIntegralOrUnscopedEnumerationType()
const;
1926 bool isRealFloatingType()
const;
1929 bool isComplexType()
const;
1930 bool isAnyComplexType()
const;
1931 bool isFloatingType()
const;
1932 bool isHalfType()
const;
1933 bool isFloat16Type()
const;
1934 bool isFloat128Type()
const;
1935 bool isRealType()
const;
1936 bool isArithmeticType()
const;
1937 bool isVoidType()
const;
1938 bool isScalarType()
const;
1939 bool isAggregateType()
const;
1940 bool isFundamentalType()
const;
1941 bool isCompoundType()
const;
1945 bool isFunctionType()
const;
1948 bool isPointerType()
const;
1949 bool isAnyPointerType()
const;
1950 bool isBlockPointerType()
const;
1951 bool isVoidPointerType()
const;
1952 bool isReferenceType()
const;
1953 bool isLValueReferenceType()
const;
1954 bool isRValueReferenceType()
const;
1955 bool isFunctionPointerType()
const;
1956 bool isMemberPointerType()
const;
1957 bool isMemberFunctionPointerType()
const;
1958 bool isMemberDataPointerType()
const;
1959 bool isArrayType()
const;
1960 bool isConstantArrayType()
const;
1961 bool isIncompleteArrayType()
const;
1962 bool isVariableArrayType()
const;
1963 bool isDependentSizedArrayType()
const;
1965 bool isClassType()
const;
1966 bool isStructureType()
const;
1967 bool isObjCBoxableRecordType()
const;
1968 bool isInterfaceType()
const;
1969 bool isStructureOrClassType()
const;
1970 bool isUnionType()
const;
1971 bool isComplexIntegerType()
const;
1972 bool isVectorType()
const;
1973 bool isExtVectorType()
const;
1974 bool isDependentAddressSpaceType()
const;
1975 bool isObjCObjectPointerType()
const;
1976 bool isObjCRetainableType()
const;
1977 bool isObjCLifetimeType()
const;
1978 bool isObjCIndirectLifetimeType()
const;
1979 bool isObjCNSObjectType()
const;
1980 bool isObjCIndependentClassType()
const;
1983 bool isObjCObjectType()
const;
1984 bool isObjCQualifiedInterfaceType()
const;
1985 bool isObjCQualifiedIdType()
const;
1986 bool isObjCQualifiedClassType()
const;
1987 bool isObjCObjectOrInterfaceType()
const;
1988 bool isObjCIdType()
const;
1997 return hasAttr(attr::ObjCInertUnsafeUnretained);
2007 bool isObjCIdOrObjectKindOfType(
const ASTContext &ctx,
2010 bool isObjCClassType()
const;
2018 bool isObjCClassOrClassKindOfType()
const;
2020 bool isBlockCompatibleObjCPointerType(
ASTContext &ctx)
const;
2021 bool isObjCSelType()
const;
2022 bool isObjCBuiltinType()
const;
2023 bool isObjCARCBridgableType()
const;
2024 bool isCARCBridgableType()
const;
2025 bool isTemplateTypeParmType()
const;
2026 bool isNullPtrType()
const;
2027 bool isAlignValT()
const;
2028 bool isStdByteType()
const;
2029 bool isAtomicType()
const;
2031 #define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \ 2032 bool is##Id##Type() const; 2033 #include "clang/Basic/OpenCLImageTypes.def" 2035 bool isImageType()
const;
2037 bool isSamplerT()
const;
2038 bool isEventT()
const;
2039 bool isClkEventT()
const;
2040 bool isQueueT()
const;
2041 bool isReserveIDT()
const;
2043 #define EXT_OPAQUE_TYPE(ExtType, Id, Ext) \ 2044 bool is##Id##Type() const; 2045 #include "clang/Basic/OpenCLExtensionTypes.def" 2047 bool isOCLIntelSubgroupAVCType()
const;
2048 bool isOCLExtOpaqueType()
const;
2050 bool isPipeType()
const;
2051 bool isOpenCLSpecificType()
const;
2056 bool isObjCARCImplicitlyUnretainedType()
const;
2086 return TypeBits.InstantiationDependent;
2092 bool isUndeducedType()
const;
2099 bool hasSizedVLAType()
const;
2102 bool hasUnnamedOrLocalType()
const;
2104 bool isOverloadableType()
const;
2107 bool isElaboratedTypeSpecifier()
const;
2109 bool canDecayToPointerType()
const;
2114 bool hasPointerRepresentation()
const;
2118 bool hasObjCPointerRepresentation()
const;
2122 bool hasIntegerRepresentation()
const;
2126 bool hasSignedIntegerRepresentation()
const;
2130 bool hasUnsignedIntegerRepresentation()
const;
2134 bool hasFloatingRepresentation()
const;
2139 const RecordType *getAsStructureType()
const;
2142 const ComplexType *getAsComplexIntegerType()
const;
2163 TagDecl *getAsTagDecl()
const;
2181 return dyn_cast_or_null<AutoType>(getContainedDeducedType());
2187 bool hasAutoForTrailingReturnType()
const;
2195 template <
typename T>
const T *getAs()
const;
2202 template <
typename T>
const T *getAsAdjusted()
const;
2206 const ArrayType *getAsArrayTypeUnsafe()
const;
2214 template <
typename T>
const T *castAs()
const;
2218 const ArrayType *castAsArrayTypeUnsafe()
const;
2227 const Type *getBaseElementTypeUnsafe()
const;
2232 const Type *getArrayElementTypeNoTypeQual()
const;
2237 const Type *getPointeeOrArrayElementType()
const;
2245 const Type *getUnqualifiedDesugaredType()
const;
2248 bool isPromotableIntegerType()
const;
2253 bool isSignedIntegerType()
const;
2258 bool isUnsignedIntegerType()
const;
2262 bool isSignedIntegerOrEnumerationType()
const;
2266 bool isUnsignedIntegerOrEnumerationType()
const;
2270 bool isFixedPointType()
const;
2274 bool isSaturatedFixedPointType()
const;
2278 bool isUnsaturatedFixedPointType()
const;
2282 bool isSignedFixedPointType()
const;
2286 bool isUnsignedFixedPointType()
const;
2291 bool isConstantSizeType()
const;
2295 bool isSpecifierType()
const;
2302 return getLinkageAndVisibility().getVisibility();
2307 return getLinkageAndVisibility().isVisibilityExplicit();
2315 bool isLinkageValid()
const;
2329 bool canHaveNullability(
bool ResultIfUnknown =
true)
const;
2347 getObjCSubstitutions(
const DeclContext *dc)
const;
2351 bool acceptsObjCTypeParams()
const;
2353 const char *getTypeClassName()
const;
2356 return CanonicalType;
2361 void dump(llvm::raw_ostream &OS)
const;
2379 #define TYPE(Class, Base) 2380 #define LEAF_TYPE(Class) \ 2381 template <> inline const Class##Type *Type::getAs() const { \ 2382 return dyn_cast<Class##Type>(CanonicalType); \ 2384 template <> inline const Class##Type *Type::castAs() const { \ 2385 return cast<Class##Type>(CanonicalType); \ 2387 #include "clang/AST/TypeNodes.def" 2395 #define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) Id, 2396 #include "clang/Basic/OpenCLImageTypes.def" 2398 #define EXT_OPAQUE_TYPE(ExtType, Id, Ext) Id, 2399 #include "clang/Basic/OpenCLExtensionTypes.def" 2401 #define BUILTIN_TYPE(Id, SingletonId) Id, 2402 #define LAST_BUILTIN_TYPE(Id) LastKind = Id 2403 #include "clang/AST/BuiltinTypes.def" 2414 BuiltinTypeBits.Kind = K;
2424 assert(!str.empty() && str.data()[str.size()] ==
'\0');
2449 return K >= Overload;
2456 return isPlaceholderTypeKind(
getKind());
2483 :
Type(
Complex, CanonicalPtr, Element->isDependentType(),
2484 Element->isInstantiationDependentType(),
2485 Element->isVariablyModifiedType(),
2486 Element->containsUnexpandedParameterPack()),
2487 ElementType(Element) {}
2496 Profile(ID, getElementType());
2513 :
Type(
Paren, CanonType, InnerType->isDependentType(),
2514 InnerType->isInstantiationDependentType(),
2515 InnerType->isVariablyModifiedType(),
2516 InnerType->containsUnexpandedParameterPack()),
2526 Profile(ID, getInnerType());
2543 :
Type(
Pointer, CanonicalPtr, Pointee->isDependentType(),
2544 Pointee->isInstantiationDependentType(),
2545 Pointee->isVariablyModifiedType(),
2546 Pointee->containsUnexpandedParameterPack()),
2547 PointeeType(Pointee) {}
2572 Profile(ID, getPointeeType());
2594 :
Type(TC, CanonicalPtr, OriginalTy->isDependentType(),
2595 OriginalTy->isInstantiationDependentType(),
2596 OriginalTy->isVariablyModifiedType(),
2597 OriginalTy->containsUnexpandedParameterPack()),
2598 OriginalTy(OriginalTy), AdjustedTy(AdjustedTy) {}
2608 Profile(ID, OriginalTy, AdjustedTy);
2631 inline QualType getPointeeType()
const;
2646 :
Type(BlockPointer, CanonicalCls, Pointee->isDependentType(),
2647 Pointee->isInstantiationDependentType(),
2648 Pointee->isVariablyModifiedType(),
2649 Pointee->containsUnexpandedParameterPack()),
2650 PointeeType(Pointee) {}
2660 Profile(ID, getPointeeType());
2678 bool SpelledAsLValue)
2679 :
Type(tc, CanonicalRef, Referencee->isDependentType(),
2680 Referencee->isInstantiationDependentType(),
2681 Referencee->isVariablyModifiedType(),
2682 Referencee->containsUnexpandedParameterPack()),
2683 PointeeType(Referencee) {
2684 ReferenceTypeBits.SpelledAsLValue = SpelledAsLValue;
2699 return T->PointeeType;
2703 Profile(ID, PointeeType, isSpelledAsLValue());
2708 bool SpelledAsLValue) {
2710 ID.AddBoolean(SpelledAsLValue);
2724 bool SpelledAsLValue)
2766 :
Type(MemberPointer, CanonicalPtr,
2767 Cls->isDependentType() || Pointee->isDependentType(),
2768 (Cls->isInstantiationDependentType() ||
2769 Pointee->isInstantiationDependentType()),
2770 Pointee->isVariablyModifiedType(),
2771 (Cls->containsUnexpandedParameterPack() ||
2772 Pointee->containsUnexpandedParameterPack())),
2773 PointeeType(Pointee), Class(Cls) {}
2797 Profile(ID, getPointeeType(), getClass());
2801 const Type *Class) {
2803 ID.AddPointer(Class);
2836 bool ContainsUnexpandedParameterPack)
2837 :
Type(tc, can, et->isDependentType() || tc == DependentSizedArray,
2838 et->isInstantiationDependentType() || tc == DependentSizedArray,
2839 (tc == VariableArray || et->isVariablyModifiedType()),
2840 ContainsUnexpandedParameterPack),
2842 ArrayTypeBits.IndexTypeQuals = tq;
2843 ArrayTypeBits.SizeModifier = sm;
2858 return ArrayTypeBits.IndexTypeQuals;
2877 :
ArrayType(ConstantArray, et, can, sm, tq,
2886 :
ArrayType(tc, et, can, sm, tq, et->containsUnexpandedParameterPack()),
2890 const llvm::APInt &
getSize()
const {
return Size; }
2896 static unsigned getNumAddressingBits(
const ASTContext &Context,
2898 const llvm::APInt &NumElements);
2902 static unsigned getMaxSizeBits(
const ASTContext &Context);
2905 Profile(ID, getElementType(), getSize(),
2906 getSizeModifier(), getIndexTypeCVRQualifiers());
2911 unsigned TypeQuals) {
2913 ID.AddInteger(ArraySize.getZExtValue());
2914 ID.AddInteger(SizeMod);
2915 ID.AddInteger(TypeQuals);
2931 :
ArrayType(IncompleteArray, et, can, sm, tq,
2932 et->containsUnexpandedParameterPack()) {}
2945 Profile(ID, getElementType(), getSizeModifier(),
2946 getIndexTypeCVRQualifiers());
2952 ID.AddInteger(SizeMod);
2953 ID.AddInteger(TypeQuals);
2984 :
ArrayType(VariableArray, et, can, sm, tq,
2985 et->containsUnexpandedParameterPack()),
2986 SizeExpr((
Stmt*) e), Brackets(brackets) {}
2994 return (
Expr*) SizeExpr;
3009 llvm_unreachable(
"Cannot unique VariableArrayTypes.");
3051 return (
Expr*) SizeExpr;
3066 Profile(ID, Context, getElementType(),
3067 getSizeModifier(), getIndexTypeCVRQualifiers(), getSizeExpr());
3070 static void Profile(llvm::FoldingSetNodeID &
ID,
const ASTContext &Context,
3072 unsigned TypeQuals,
Expr *E);
3090 Expr *AddrSpaceExpr;
3111 Profile(ID, Context, getPointeeType(), getAddrSpaceExpr());
3114 static void Profile(llvm::FoldingSetNodeID &
ID,
const ASTContext &Context,
3155 Profile(ID, Context, getElementType(), getSizeExpr());
3158 static void Profile(llvm::FoldingSetNodeID &
ID,
const ASTContext &Context,
3207 return NumElements > VectorTypeBitfields::MaxNumElements;
3218 Profile(ID, getElementType(), getNumElements(),
3219 getTypeClass(), getVectorKind());
3226 ID.AddInteger(NumElements);
3227 ID.AddInteger(TypeClass);
3228 ID.AddInteger(VecKind);
3273 Profile(ID, Context, getElementType(), getSizeExpr(), getVectorKind());
3276 static void Profile(llvm::FoldingSetNodeID &
ID,
const ASTContext &Context,
3291 :
VectorType(ExtVector, vecType, nElements, canonType, GenericVector) {}
3297 case 'x':
case 'r':
return 0;
3298 case 'y':
case 'g':
return 1;
3299 case 'z':
case 'b':
return 2;
3300 case 'w':
case 'a':
return 3;
3318 case 'a':
return 10;
3320 case 'b':
return 11;
3322 case 'c':
return 12;
3324 case 'd':
return 13;
3326 case 'e':
return 14;
3328 case 'f':
return 15;
3333 if (isNumericAccessor)
3334 return getNumericAccessorIdx(c);
3336 return getPointAccessorIdx(c);
3340 if (
int idx = getAccessorIdx(c, isNumericAccessor)+1)
3341 return unsigned(idx-1) < getNumElements();
3385 HasPassObjSize = 0x20,
3388 unsigned char Data = 0;
3397 copy.Data = (copy.Data & ~ABIMask) |
unsigned(kind);
3407 copy.Data |= IsConsumed;
3409 copy.Data &= ~IsConsumed;
3416 Copy.Data |= HasPassObjSize;
3424 Copy.Data |= IsNoEscape;
3426 Copy.Data &= ~IsNoEscape;
3438 return lhs.Data == rhs.Data;
3442 return lhs.Data != rhs.Data;
3477 enum { CallConvMask = 0x1F };
3478 enum { NoReturnMask = 0x20 };
3479 enum { ProducesResultMask = 0x40 };
3480 enum { NoCallerSavedRegsMask = 0x80 };
3481 enum { NoCfCheckMask = 0x800 };
3483 RegParmMask = ~(CallConvMask | NoReturnMask | ProducesResultMask |
3484 NoCallerSavedRegsMask | NoCfCheckMask),
3487 uint16_t Bits =
CC_C;
3489 ExtInfo(
unsigned Bits) : Bits(static_cast<uint16_t>(Bits)) {}
3495 bool producesResult,
bool noCallerSavedRegs,
bool NoCfCheck) {
3496 assert((!hasRegParm || regParm < 7) &&
"Invalid regparm value");
3497 Bits = ((unsigned)cc) | (noReturn ? NoReturnMask : 0) |
3498 (producesResult ? ProducesResultMask : 0) |
3499 (noCallerSavedRegs ? NoCallerSavedRegsMask : 0) |
3500 (hasRegParm ? ((regParm + 1) << RegParmOffset) : 0) |
3501 (NoCfCheck ? NoCfCheckMask : 0);
3519 unsigned RegParm = (Bits & RegParmMask) >> RegParmOffset;
3528 return Bits == Other.Bits;
3531 return Bits != Other.Bits;
3539 return ExtInfo(Bits | NoReturnMask);
3541 return ExtInfo(Bits & ~NoReturnMask);
3546 return ExtInfo(Bits | ProducesResultMask);
3548 return ExtInfo(Bits & ~ProducesResultMask);
3552 if (noCallerSavedRegs)
3553 return ExtInfo(Bits | NoCallerSavedRegsMask);
3555 return ExtInfo(Bits & ~NoCallerSavedRegsMask);
3560 return ExtInfo(Bits | NoCfCheckMask);
3562 return ExtInfo(Bits & ~NoCfCheckMask);
3566 assert(RegParm < 7 &&
"Invalid regparm value");
3567 return ExtInfo((Bits & ~RegParmMask) |
3568 ((RegParm + 1) << RegParmOffset));
3572 return ExtInfo((Bits & ~CallConvMask) | (
unsigned) cc);
3576 ID.AddInteger(Bits);
3598 QualType Canonical,
bool Dependent,
3599 bool InstantiationDependent,
3600 bool VariablyModified,
bool ContainsUnexpandedParameterPack,
3602 :
Type(tc, Canonical, Dependent, InstantiationDependent, VariablyModified,
3603 ContainsUnexpandedParameterPack),
3605 FunctionTypeBits.ExtInfo = Info.Bits;
3627 "Const, volatile and restrict are assumed to be a subset of " 3628 "the fast qualifiers.");
3630 bool isConst()
const {
return getFastTypeQuals().hasConst(); }
3631 bool isVolatile()
const {
return getFastTypeQuals().hasVolatile(); }
3632 bool isRestrict()
const {
return getFastTypeQuals().hasRestrict(); }
3640 static StringRef getNameForCallConv(
CallingConv CC);
3656 Result->isVariablyModifiedType(),
3666 Profile(ID, getReturnType(), getExtInfo());
3689 public llvm::FoldingSetNode,
3691 FunctionProtoType, QualType, FunctionType::FunctionTypeExtraBitfields,
3692 FunctionType::ExceptionType, Expr *, FunctionDecl *,
3693 FunctionType::ExtParameterInfo, Qualifiers> {
3774 const ExtParameterInfo *ExtParameterInfos =
nullptr;
3779 : ExtInfo(CC), Variadic(
false), HasTrailingReturn(
false) {}
3789 unsigned numTrailingObjects(OverloadToken<QualType>)
const {
3790 return getNumParams();
3793 unsigned numTrailingObjects(OverloadToken<FunctionTypeExtraBitfields>)
const {
3794 return hasExtraBitfields();
3797 unsigned numTrailingObjects(OverloadToken<ExceptionType>)
const {
3798 return getExceptionSpecSize().NumExceptionType;
3801 unsigned numTrailingObjects(OverloadToken<Expr *>)
const {
3802 return getExceptionSpecSize().NumExprPtr;
3805 unsigned numTrailingObjects(OverloadToken<FunctionDecl *>)
const {
3806 return getExceptionSpecSize().NumFunctionDeclPtr;
3809 unsigned numTrailingObjects(OverloadToken<ExtParameterInfo>)
const {
3810 return hasExtParameterInfos() ? getNumParams() : 0;
3815 static bool containsAnyUnexpandedParameterPack(
const QualType *ArgArray,
3817 for (
unsigned Idx = 0; Idx < numArgs; ++Idx)
3818 if (ArgArray[Idx]->containsUnexpandedParameterPack())
3830 struct ExceptionSpecSizeHolder {
3831 unsigned NumExceptionType;
3832 unsigned NumExprPtr;
3833 unsigned NumFunctionDeclPtr;
3838 static ExceptionSpecSizeHolder
3849 return {NumExceptions, 0, 0};
3862 llvm_unreachable(
"bad exception specification kind");
3867 ExceptionSpecSizeHolder getExceptionSpecSize()
const {
3868 return getExceptionSpecSize(getExceptionSpecType(), getNumExceptions());
3879 bool hasExtraBitfields()
const {
3880 return hasExtraBitfields(getExceptionSpecType());
3883 bool hasExtQualifiers()
const {
3884 return FunctionTypeBits.HasExtQuals;
3891 assert(i < getNumParams() &&
"invalid parameter index");
3892 return param_type_begin()[i];
3896 return llvm::makeArrayRef(param_type_begin(), param_type_end());
3924 FunctionTypeBits.ExceptionSpecType);
3941 bool hasDependentExceptionSpec()
const;
3945 bool hasInstantiationDependentExceptionSpec()
const;
3950 ? getTrailingObjects<FunctionTypeExtraBitfields>()
3957 assert(i < getNumExceptions() &&
"Invalid exception number!");
3958 return exception_begin()[i];
3966 return *getTrailingObjects<Expr *>();
3977 return getTrailingObjects<FunctionDecl *>()[0];
3987 return getTrailingObjects<FunctionDecl *>()[1];
3998 return ResultIfDependent ? canThrow() !=
CT_Can : canThrow() ==
CT_Cannot;
4010 bool isTemplateVariadic()
const;
4016 if (hasExtQualifiers())
4017 return *getTrailingObjects<Qualifiers>();
4019 return getFastTypeQuals();
4035 return getTrailingObjects<QualType>();
4039 return param_type_begin() + getNumParams();
4045 return llvm::makeArrayRef(exception_begin(), exception_end());
4050 getTrailingObjects<ExceptionType>());
4054 return exception_begin() + getNumExceptions();
4060 return FunctionTypeBits.HasExtParameterInfos;
4064 assert(hasExtParameterInfos());
4073 if (!hasExtParameterInfos())
4075 return getTrailingObjects<ExtParameterInfo>();
4079 assert(I < getNumParams() &&
"parameter index out of range");
4080 if (hasExtParameterInfos())
4081 return getTrailingObjects<ExtParameterInfo>()[I];
4086 assert(I < getNumParams() &&
"parameter index out of range");
4087 if (hasExtParameterInfos())
4088 return getTrailingObjects<ExtParameterInfo>()[I].getABI();
4093 assert(I < getNumParams() &&
"parameter index out of range");
4094 if (hasExtParameterInfos())
4095 return getTrailingObjects<ExtParameterInfo>()[I].isConsumed();
4102 void printExceptionSpecification(raw_ostream &OS,
4109 void Profile(llvm::FoldingSetNodeID &
ID,
const ASTContext &Ctx);
4142 return Profile(ID, Decl);
4158 :
Type(tc, can, can->isDependentType(),
4159 can->isInstantiationDependentType(),
4160 can->isVariablyModifiedType(),
4163 assert(!isa<TypedefType>(can) &&
"Invalid canonical type");
4191 bool isSugared()
const;
4211 Profile(ID, Context, getUnderlyingExpr());
4214 static void Profile(llvm::FoldingSetNodeID &
ID,
const ASTContext &Context,
4225 :
Type(TypeOf, can, T->isDependentType(),
4226 T->isInstantiationDependentType(),
4227 T->isVariablyModifiedType(),
4228 T->containsUnexpandedParameterPack()),
4230 assert(!isa<TypedefType>(can) &&
"Invalid canonical type");
4263 bool isSugared()
const;
4281 Profile(ID, Context, getUnderlyingExpr());
4284 static void Profile(llvm::FoldingSetNodeID &
ID,
const ASTContext &Context,
4331 public llvm::FoldingSetNode {
4337 Profile(ID, getBaseType(), getUTTKind());
4343 ID.AddInteger((
unsigned)UKind);
4361 bool isBeingDefined()
const;
4386 bool hasConstFields()
const;
4437 :
Type(Attributed, canon, equivalent->isDependentType(),
4438 equivalent->isInstantiationDependentType(),
4439 equivalent->isVariablyModifiedType(),
4440 equivalent->containsUnexpandedParameterPack()),
4441 ModifiedType(modified), EquivalentType(equivalent) {
4442 AttributedTypeBits.AttrKind = attrKind;
4447 return static_cast<Kind>(AttributedTypeBits.AttrKind);
4471 bool isQualifier()
const;
4473 bool isMSTypeSpec()
const;
4475 bool isCallingConv()
const;
4484 return attr::TypeNonNull;
4487 return attr::TypeNullable;
4490 return attr::TypeNullUnspecified;
4492 llvm_unreachable(
"Unknown nullability kind.");
4507 Profile(ID, getAttrKind(), ModifiedType, EquivalentType);
4512 ID.AddInteger(attrKind);
4526 struct CanonicalTTPTInfo {
4527 unsigned Depth : 15;
4528 unsigned ParameterPack : 1;
4529 unsigned Index : 16;
4542 :
Type(TemplateTypeParm, Canon,
true,
4545 Canon->containsUnexpandedParameterPack()),
4554 CanTTPTInfo.Depth = D;
4555 CanTTPTInfo.Index = I;
4556 CanTTPTInfo.ParameterPack = PP;
4559 const CanonicalTTPTInfo& getCanTTPTInfo()
const {
4560 QualType Can = getCanonicalTypeInternal();
4565 unsigned getDepth()
const {
return getCanTTPTInfo().Depth; }
4566 unsigned getIndex()
const {
return getCanTTPTInfo().Index; }
4570 return isCanonicalUnqualified() ? nullptr : TTPDecl;
4579 Profile(ID, getDepth(), getIndex(), isParameterPack(), getDecl());
4583 unsigned Index,
bool ParameterPack,
4585 ID.AddInteger(Depth);
4586 ID.AddInteger(Index);
4587 ID.AddBoolean(ParameterPack);
4588 ID.AddPointer(TTPDecl);
4610 :
Type(SubstTemplateTypeParm, Canon, Canon->isDependentType(),
4611 Canon->isInstantiationDependentType(),
4612 Canon->isVariablyModifiedType(),
4613 Canon->containsUnexpandedParameterPack()),
4625 return getCanonicalTypeInternal();
4632 Profile(ID, getReplacedParameter(), getReplacementType());
4638 ID.AddPointer(Replaced);
4682 return SubstTemplateTypeParmPackTypeBits.NumArgs;
4690 void Profile(llvm::FoldingSetNodeID &
ID);
4691 static void Profile(llvm::FoldingSetNodeID &ID,
4712 bool IsInstantiationDependent,
bool ContainsParameterPack)
4715 DeducedAsType.isNull() ?
QualType(this, 0)
4716 : DeducedAsType.getCanonicalType(),
4717 IsDependent, IsInstantiationDependent,
4718 false, ContainsParameterPack) {
4719 if (!DeducedAsType.
isNull()) {
4723 setInstantiationDependent();
4725 setContainsUnexpandedParameterPack();
4730 bool isSugared()
const {
return !isCanonicalUnqualified(); }
4736 return !isCanonicalUnqualified() ? getCanonicalTypeInternal() :
QualType();
4739 return !isCanonicalUnqualified() || isDependentType();
4753 bool IsDeducedAsDependent)
4755 IsDeducedAsDependent,
false) {
4756 AutoTypeBits.Keyword = (unsigned)Keyword;
4769 Profile(ID, getDeducedType(), getKeyword(), isDependentType());
4775 ID.AddInteger((
unsigned)Keyword);
4776 ID.AddBoolean(IsDependent);
4786 public llvm::FoldingSetNode {
4794 bool IsDeducedAsDependent)
4795 :
DeducedType(DeducedTemplateSpecialization, DeducedAsType,
4796 IsDeducedAsDependent || Template.isDependent(),
4797 IsDeducedAsDependent || Template.isInstantiationDependent(),
4798 Template.containsUnexpandedParameterPack()),
4799 Template(Template) {}
4806 Profile(ID, getTemplateName(), getDeducedType(), isDependentType());
4810 QualType Deduced,
bool IsDependent) {
4813 ID.AddBoolean(IsDependent);
4817 return T->
getTypeClass() == DeducedTemplateSpecialization;
4843 public llvm::FoldingSetNode {
4863 bool &InstantiationDependent);
4866 bool &InstantiationDependent);
4871 return isa<InjectedClassNameType>(getCanonicalTypeInternal());
4889 bool isTypeAlias()
const {
return TemplateSpecializationTypeBits.TypeAlias; }
4894 assert(isTypeAlias() &&
"not a type alias template specialization");
4895 return *
reinterpret_cast<const QualType*
>(end());
4913 return TemplateSpecializationTypeBits.NumArgs;
4921 return {getArgs(), getNumArgs()};
4925 return !isDependentType() || isCurrentInstantiation() || isTypeAlias();
4929 return isTypeAlias() ? getAliasedType() : getCanonicalTypeInternal();
4933 Profile(ID, Template, template_arguments(), Ctx);
4935 getAliasedType().Profile(ID);
5003 Decl(D), InjectedType(TST) {
5004 assert(isa<TemplateSpecializationType>(TST));
5013 return cast<TemplateSpecializationType>(InjectedType.
getTypePtr());
5017 return getInjectedTST()->getTemplateName();
5081 QualType Canonical,
bool Dependent,
5082 bool InstantiationDependent,
bool VariablyModified,
5083 bool ContainsUnexpandedParameterPack)
5084 :
Type(tc, Canonical, Dependent, InstantiationDependent, VariablyModified,
5085 ContainsUnexpandedParameterPack) {
5086 TypeWithKeywordBits.Keyword = Keyword;
5099 static TagTypeKind getTagTypeKindForTypeSpec(
unsigned TypeSpec);
5114 return getKeywordName(getKeywordForTagTypeKind(Kind));
5131 public llvm::FoldingSetNode,
5149 NamedType->isDependentType(),
5150 NamedType->isInstantiationDependentType(),
5151 NamedType->isVariablyModifiedType(),
5152 NamedType->containsUnexpandedParameterPack()),
5153 NNS(NNS), NamedType(NamedType) {
5154 ElaboratedTypeBits.HasOwnedTagDecl =
false;
5156 ElaboratedTypeBits.HasOwnedTagDecl =
true;
5157 *getTrailingObjects<TagDecl *>() = OwnedTagDecl;
5159 assert(!(Keyword ==
ETK_None && NNS ==
nullptr) &&
5160 "ElaboratedType cannot have elaborated type keyword " 5161 "and name qualifier both null.");
5180 return ElaboratedTypeBits.HasOwnedTagDecl ? *getTrailingObjects<TagDecl *>()
5185 Profile(ID, getKeyword(), NNS, NamedType, getOwnedTagDecl());
5191 ID.AddInteger(Keyword);
5194 ID.AddPointer(OwnedTagDecl);
5226 NNS->containsUnexpandedParameterPack()),
5227 NNS(NNS), Name(Name) {}
5246 Profile(ID, getKeyword(), NNS, Name);
5251 ID.AddInteger(Keyword);
5253 ID.AddPointer(Name);
5266 public llvm::FoldingSetNode {
5295 return getArgBuffer();
5300 return DependentTemplateSpecializationTypeBits.NumArgs;
5306 return {getArgs(), getNumArgs()};
5318 Profile(ID, Context, getKeyword(), NNS, Name, {getArgs(), getNumArgs()});
5321 static void Profile(llvm::FoldingSetNodeID &
ID,
5329 return T->
getTypeClass() == DependentTemplateSpecialization;
5363 :
Type(PackExpansion, Canon, Pattern->isDependentType(),
5365 Pattern->isVariablyModifiedType(),
5368 PackExpansionTypeBits.NumExpansions =
5369 NumExpansions ? *NumExpansions + 1 : 0;
5381 if (PackExpansionTypeBits.NumExpansions)
5382 return PackExpansionTypeBits.NumExpansions - 1;
5390 Profile(ID, getPattern(), getNumExpansions());
5396 ID.AddBoolean(NumExpansions.hasValue());
5398 ID.AddInteger(*NumExpansions);
5418 return static_cast<T*
>(
this)->getProtocolStorageImpl();
5422 static_cast<T*
>(
this)->setNumProtocolsImpl(N);
5426 setNumProtocols(protocols.size());
5427 assert(getNumProtocols() == protocols.size() &&
5428 "bitfield overflow in protocol count");
5429 if (!protocols.empty())
5430 memcpy(getProtocolStorage(), protocols.data(),
5447 return static_cast<const T*
>(
this)->getNumProtocolsImpl();
5452 assert(I < getNumProtocols() &&
"Out-of-range protocol access");
5453 return qual_begin()[I];
5466 public llvm::FoldingSetNode {
5471 unsigned NumProtocols : 6;
5482 unsigned getNumProtocolsImpl()
const {
5483 return NumProtocols;
5486 void setNumProtocolsImpl(
unsigned N) {
5502 void Profile(llvm::FoldingSetNodeID &
ID);
5503 static void Profile(llvm::FoldingSetNodeID &ID,
5558 mutable llvm::PointerIntPair<const ObjCObjectType *, 1, bool>
5559 CachedSuperClassType;
5562 const QualType *getTypeArgStorage()
const {
5569 unsigned getNumProtocolsImpl()
const {
5570 return ObjCObjectTypeBits.NumProtocols;
5572 void setNumProtocolsImpl(
unsigned N) {
5573 ObjCObjectTypeBits.NumProtocols = N;
5587 ObjCObjectTypeBits.NumProtocols = 0;
5588 ObjCObjectTypeBits.NumTypeArgs = 0;
5589 ObjCObjectTypeBits.IsKindOf = 0;
5592 void computeSuperClassTypeSlow()
const;
5604 return getBaseType()->isSpecificBuiltinType(BuiltinType::ObjCId);
5608 return getBaseType()->isSpecificBuiltinType(BuiltinType::ObjCClass);
5614 if (!qual_empty())
return false;
5615 if (
const BuiltinType *T = getBaseType()->getAs<BuiltinType>())
5616 return T->getKind() == BuiltinType::ObjCId ||
5617 T->getKind() == BuiltinType::ObjCClass;
5629 bool isSpecialized()
const;
5633 return ObjCObjectTypeBits.NumTypeArgs > 0;
5650 return llvm::makeArrayRef(getTypeArgStorage(),
5651 ObjCObjectTypeBits.NumTypeArgs);
5658 bool isKindOfType()
const;
5667 if (!CachedSuperClassType.getInt())
5668 computeSuperClassTypeSlow();
5670 assert(CachedSuperClassType.getInt() &&
"Superclass not set?");
5671 return QualType(CachedSuperClassType.getPointer(), 0);
5701 :
ObjCObjectType(Canonical, Base, typeArgs, protocols, isKindOf) {}
5704 void Profile(llvm::FoldingSetNodeID &
ID);
5705 static void Profile(llvm::FoldingSetNodeID &
ID,
5712 inline QualType *ObjCObjectType::getTypeArgStorage() {
5718 getTypeArgStorage() + ObjCObjectTypeBits.NumTypeArgs);
5776 if (
const auto *T = dyn_cast<ObjCInterfaceType>(ObjT))
5777 return T->getDecl();
5779 baseType = ObjT->getBaseType();
5800 :
Type(ObjCObjectPointer, Canonical,
5801 Pointee->isDependentType(),
5802 Pointee->isInstantiationDependentType(),
5803 Pointee->isVariablyModifiedType(),
5804 Pointee->containsUnexpandedParameterPack()),
5805 PointeeType(Pointee) {}
5948 QualType getSuperClassType()
const;
5956 Profile(ID, getPointeeType());
5974 :
Type(Atomic, Canonical, ValTy->isDependentType(),
5975 ValTy->isInstantiationDependentType(),
5976 ValTy->isVariablyModifiedType(),
5977 ValTy->containsUnexpandedParameterPack()),
5989 Profile(ID, getValueType());
6009 :
Type(Pipe, CanonicalPtr, elemType->isDependentType(),
6010 elemType->isInstantiationDependentType(),
6011 elemType->isVariablyModifiedType(),
6012 elemType->containsUnexpandedParameterPack()),
6013 ElementType(elemType), isRead(isRead) {}
6023 Profile(ID, getElementType(), isReadOnly());
6028 ID.AddBoolean(isRead);
6049 return type.getTypePtrUnsafe();
6051 const ExtQuals *extQuals = type.getExtQualsUnsafe();
6067 Ty->getLocallyUnqualifiedSingleStepDesugaredType().split();
6073 return getCommonPtr()->BaseType;
6077 return (isNull() ?
nullptr : getCommonPtr()->BaseType);
6081 if (!hasLocalNonFastQualifiers())
6085 const ExtQuals *eq = getExtQualsUnsafe();
6093 if (hasLocalNonFastQualifiers())
6094 Quals = getExtQualsUnsafe()->getQualifiers();
6100 Qualifiers quals = getCommonPtr()->CanonicalType.getLocalQualifiers();
6106 unsigned cvr = getCommonPtr()->CanonicalType.getLocalCVRQualifiers();
6107 cvr |= getLocalCVRQualifiers();
6112 QualType canon = getCommonPtr()->CanonicalType;
6117 return getTypePtr()->isCanonicalUnqualified();
6121 if (!isCanonical())
return false;
6122 if (hasLocalQualifiers())
return false;
6124 const Type *T = getTypePtr();
6128 return !isa<FunctionType>(T) && !isa<ArrayType>(T);
6132 return isLocalConstQualified() ||
6133 getCommonPtr()->CanonicalType.isLocalConstQualified();
6137 return isLocalRestrictQualified() ||
6138 getCommonPtr()->CanonicalType.isLocalRestrictQualified();
6143 return isLocalVolatileQualified() ||
6144 getCommonPtr()->CanonicalType.isLocalVolatileQualified();
6148 return hasLocalQualifiers() ||
6149 getCommonPtr()->CanonicalType.hasLocalQualifiers();
6153 if (!getTypePtr()->getCanonicalTypeInternal().hasLocalQualifiers())
6156 return QualType(getSplitUnqualifiedTypeImpl(*this).Ty, 0);
6160 if (!getTypePtr()->getCanonicalTypeInternal().hasLocalQualifiers())
6163 return getSplitUnqualifiedTypeImpl(*
this);
6181 "Fast bits differ from CVR bits!");
6184 removeLocalFastQualifiers(Mask);
6189 return getQualifiers().getAddressSpace();
6194 return getQualifiers().getObjCGCAttr();
6199 if (
const auto *FT = PT->getPointeeType()->getAs<
FunctionType>())
6200 return FT->getExtInfo();
6202 return FT->getExtInfo();
6230 if (getUnqualifiedType()->isVoidType())
6233 return getQualifiers().compatiblyIncludes(OtherQuals);
6253 return ((getTypePtr()->isVoidType() && !hasQualifiers()) ||
6254 getTypePtr()->isFunctionType());
6261 return isVoidType() ||
6264 (isArithmeticType() && !isEnumeralType());
6274 return isArrayType() ||
6280 isReferenceType() ||
6289 isMemberPointerType();
6293 return isa<FunctionType>(CanonicalType);
6297 return isa<PointerType>(CanonicalType);
6301 return isPointerType() || isObjCObjectPointerType();
6305 return isa<BlockPointerType>(CanonicalType);
6309 return isa<ReferenceType>(CanonicalType);
6313 return isa<LValueReferenceType>(CanonicalType);
6317 return isa<RValueReferenceType>(CanonicalType);
6321 if (
const auto *T = getAs<PointerType>())
6322 return T->getPointeeType()->isFunctionType();
6328 return isa<MemberPointerType>(CanonicalType);
6332 if (
const auto *T = getAs<MemberPointerType>())
6333 return T->isMemberFunctionPointer();
6339 if (
const auto *T = getAs<MemberPointerType>())
6340 return T->isMemberDataPointer();
6346 return isa<ArrayType>(CanonicalType);
6350 return isa<ConstantArrayType>(CanonicalType);
6354 return isa<IncompleteArrayType>(CanonicalType);
6358 return isa<VariableArrayType>(CanonicalType);
6362 return isa<DependentSizedArrayType>(CanonicalType);
6366 return isa<BuiltinType>(CanonicalType);
6370 return isa<RecordType>(CanonicalType);
6374 return isa<EnumType>(CanonicalType);
6378 return isa<ComplexType>(CanonicalType);
6382 return isa<VectorType>(CanonicalType);
6386 return isa<ExtVectorType>(CanonicalType);
6390 return isa<DependentAddressSpaceType>(CanonicalType);
6394 return isa<ObjCObjectPointerType>(CanonicalType);
6398 return isa<ObjCObjectType>(CanonicalType);
6402 return isa<ObjCInterfaceType>(CanonicalType) ||
6403 isa<ObjCObjectType>(CanonicalType);
6407 return isa<AtomicType>(CanonicalType);
6411 if (
const auto *OPT = getAs<ObjCObjectPointerType>())
6412 return OPT->isObjCQualifiedIdType();
6417 if (
const auto *OPT = getAs<ObjCObjectPointerType>())
6418 return OPT->isObjCQualifiedClassType();
6423 if (
const auto *OPT = getAs<ObjCObjectPointerType>())
6424 return OPT->isObjCIdType();
6429 if (
const auto *OPT = getAs<ObjCObjectPointerType>())
6430 return OPT->isObjCClassType();
6435 if (
const auto *OPT = getAs<PointerType>())
6436 return OPT->getPointeeType()->isSpecificBuiltinType(BuiltinType::ObjCSel);
6441 return isObjCIdType() || isObjCClassType() || isObjCSelType();
6444 #define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \ 6445 inline bool Type::is##Id##Type() const { \ 6446 return isSpecificBuiltinType(BuiltinType::Id); \ 6448 #include "clang/Basic/OpenCLImageTypes.def" 6451 return isSpecificBuiltinType(BuiltinType::OCLSampler);
6455 return isSpecificBuiltinType(BuiltinType::OCLEvent);
6459 return isSpecificBuiltinType(BuiltinType::OCLClkEvent);
6463 return isSpecificBuiltinType(BuiltinType::OCLQueue);
6467 return isSpecificBuiltinType(BuiltinType::OCLReserveID);
6471 #define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) is##Id##Type() || 6473 #include "clang/Basic/OpenCLImageTypes.def" 6478 return isa<PipeType>(CanonicalType);
6481 #define EXT_OPAQUE_TYPE(ExtType, Id, Ext) \ 6482 inline bool Type::is##Id##Type() const { \ 6483 return isSpecificBuiltinType(BuiltinType::Id); \ 6485 #include "clang/Basic/OpenCLExtensionTypes.def" 6488 #define INTEL_SUBGROUP_AVC_TYPE(ExtType, Id) \ 6489 isOCLIntelSubgroupAVC##Id##Type() || 6491 #include "clang/Basic/OpenCLExtensionTypes.def" 6496 #define EXT_OPAQUE_TYPE(ExtType, Id, Ext) is##Id##Type() || 6498 #include "clang/Basic/OpenCLExtensionTypes.def" 6503 return isSamplerT() || isEventT() || isImageType() || isClkEventT() ||
6504 isQueueT() || isReserveIDT() || isPipeType() || isOCLExtOpaqueType();
6508 return isa<TemplateTypeParmType>(CanonicalType);
6519 if (
const auto *BT = dyn_cast<BuiltinType>(
this))
6520 return BT->isPlaceholderType();
6525 if (
const auto *BT = dyn_cast<BuiltinType>(
this))
6526 if (BT->isPlaceholderType())
6533 if (
const auto *BT = dyn_cast<BuiltinType>(
this))
6539 if (
const auto *BT = dyn_cast<BuiltinType>(
this))
6540 return BT->isNonOverloadPlaceholderType();
6545 if (
const auto *BT = dyn_cast<BuiltinType>(CanonicalType))
6546 return BT->getKind() == BuiltinType::Void;
6551 if (
const auto *BT = dyn_cast<BuiltinType>(CanonicalType))
6552 return BT->getKind() == BuiltinType::Half;
6558 if (
const auto *BT = dyn_cast<BuiltinType>(CanonicalType))
6559 return BT->getKind() == BuiltinType::Float16;
6564 if (
const auto *BT = dyn_cast<BuiltinType>(CanonicalType))
6565 return BT->getKind() == BuiltinType::Float128;
6570 if (
const auto *BT = getAs<BuiltinType>())
6571 return BT->getKind() == BuiltinType::NullPtr;
6579 if (
const auto *BT = dyn_cast<BuiltinType>(CanonicalType))
6580 return BT->getKind() >= BuiltinType::Bool &&
6581 BT->getKind() <= BuiltinType::Int128;
6582 if (
const EnumType *ET = dyn_cast<EnumType>(CanonicalType)) {
6592 if (
const auto *BT = dyn_cast<BuiltinType>(CanonicalType)) {
6593 return BT->getKind() >= BuiltinType::ShortAccum &&
6594 BT->getKind() <= BuiltinType::SatULongFract;
6600 if (
const auto *BT = dyn_cast<BuiltinType>(CanonicalType)) {
6601 return BT->getKind() >= BuiltinType::SatShortAccum &&
6602 BT->getKind() <= BuiltinType::SatULongFract;
6608 return isFixedPointType() && !isSaturatedFixedPointType();
6612 if (
const auto *BT = dyn_cast<BuiltinType>(CanonicalType)) {
6613 return ((BT->getKind() >= BuiltinType::ShortAccum &&
6614 BT->getKind() <= BuiltinType::LongAccum) ||
6615 (BT->getKind() >= BuiltinType::ShortFract &&
6616 BT->getKind() <= BuiltinType::LongFract) ||
6617 (BT->getKind() >= BuiltinType::SatShortAccum &&
6618 BT->getKind() <= BuiltinType::SatLongAccum) ||
6619 (BT->getKind() >= BuiltinType::SatShortFract &&
6620 BT->getKind() <= BuiltinType::SatLongFract));
6626 return isFixedPointType() && !isSignedFixedPointType();
6630 if (
const auto *BT = dyn_cast<BuiltinType>(CanonicalType))
6631 return BT->getKind() > BuiltinType::Void &&
6632 BT->getKind() <= BuiltinType::NullPtr;
6633 if (
const EnumType *ET = dyn_cast<EnumType>(CanonicalType))
6637 return isa<PointerType>(CanonicalType) ||
6638 isa<BlockPointerType>(CanonicalType) ||
6639 isa<MemberPointerType>(CanonicalType) ||
6640 isa<ComplexType>(CanonicalType) ||
6641 isa<ObjCObjectPointerType>(CanonicalType);
6645 if (
const auto *BT = dyn_cast<BuiltinType>(CanonicalType))
6646 return BT->getKind() >= BuiltinType::Bool &&
6647 BT->getKind() <= BuiltinType::Int128;
6651 if (
const auto *ET = dyn_cast<EnumType>(CanonicalType))
6658 if (
const auto *BT = dyn_cast<BuiltinType>(CanonicalType))
6659 return BT->getKind() == BuiltinType::Bool;
6664 auto *DT = getContainedDeducedType();
6665 return DT && !DT->isDeduced();
6671 return isDependentType() ||
isRecordType() || isEnumeralType();
6676 return isFunctionType() || isArrayType();
6680 return (isPointerType() || isReferenceType() || isBlockPointerType() ||
6681 isObjCObjectPointerType() || isNullPtrType());
6685 return isObjCObjectPointerType();
6691 type =
arrayType->getElementType().getTypePtr();
6709 DiagnosticsEngine::ArgumentKind::ak_qual);
6718 DiagnosticsEngine::ArgumentKind::ak_qual);
6742 template <
typename T>
6744 std::integral_constant<bool, std::is_same<T, ArrayType>::value ||
6745 std::is_base_of<ArrayType, T>::value>;
6750 "ArrayType cannot be used with getAs!");
6753 if (
const auto *Ty = dyn_cast<T>(
this))
6757 if (!isa<T>(CanonicalType))
6762 return cast<T>(getUnqualifiedDesugaredType());
6769 if (
const auto *Ty = dyn_cast<T>(
this))
6773 if (!isa<T>(CanonicalType))
6778 const Type *Ty =
this;
6780 if (
const auto *A = dyn_cast<AttributedType>(Ty))
6781 Ty = A->getModifiedType().getTypePtr();
6782 else if (
const auto *E = dyn_cast<ElaboratedType>(Ty))
6783 Ty = E->desugar().getTypePtr();
6784 else if (
const auto *
P = dyn_cast<ParenType>(Ty))
6785 Ty =
P->desugar().getTypePtr();
6786 else if (
const auto *A = dyn_cast<AdjustedType>(Ty))
6787 Ty = A->desugar().getTypePtr();
6794 return dyn_cast<T>(Ty);
6799 if (
const auto *arr = dyn_cast<ArrayType>(
this))
6803 if (!isa<ArrayType>(CanonicalType))
6808 return cast<ArrayType>(getUnqualifiedDesugaredType());
6813 "ArrayType cannot be used with castAs!");
6815 if (
const auto *ty = dyn_cast<T>(
this))
return ty;
6816 assert(isa<T>(CanonicalType));
6817 return cast<T>(getUnqualifiedDesugaredType());
6821 assert(isa<ArrayType>(CanonicalType));
6822 if (
const auto *arr = dyn_cast<ArrayType>(
this))
return arr;
6823 return cast<ArrayType>(getUnqualifiedDesugaredType());
6828 :
AdjustedType(Decayed, OriginalType, DecayedPtr, CanonicalPtr) {
6830 QualType Adjusted = getAdjustedType();
6832 assert(isa<PointerType>(Adjusted));
6837 QualType Decayed = getDecayedType();
6839 return cast<PointerType>(Decayed)->getPointeeType();
6849 #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
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
DominatorTree GraphTraits specialization so the DominatorTree can be iterable by generic graph iterat...
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
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.
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
std::string getName(ArrayRef< StringRef > Parts) const
Get the platform-specific name separator.
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)
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...
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.
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.
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.
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
Qualifiers getTypeQuals() 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)
void Profile(llvm::FoldingSetNodeID &ID)
Qualifiers::GC getObjCGCAttr() const
Returns gc attribute of this type.
const internal::VariadicAllOfMatcher< Decl > decl
Matches declarations.
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.
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)
__UINTPTR_TYPE__ uintptr_t
An unsigned integer type with the property that any valid pointer to void can be converted to this ty...
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
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
static void Profile(llvm::FoldingSetNodeID &ID, QualType Deduced, AutoTypeKeyword Keyword, bool IsDependent)
ExceptionSpecInfo(ExceptionSpecificationType EST)
bool isMemberFunctionPointerType() const
bool isObjCObjectPointerType() const
bool isAnyPointerType() 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
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)
The width of the "fast" qualifier mask.
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
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)
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 this address space is a superset of the other one.
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)
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.
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.