18 #ifndef LLVM_CLANG_AST_TYPE_H 19 #define LLVM_CLANG_AST_TYPE_H 32 #include "llvm/ADT/APInt.h" 33 #include "llvm/ADT/ArrayRef.h" 34 #include "llvm/ADT/FoldingSet.h" 35 #include "llvm/ADT/None.h" 36 #include "llvm/ADT/Optional.h" 37 #include "llvm/ADT/PointerIntPair.h" 38 #include "llvm/ADT/PointerUnion.h" 39 #include "llvm/ADT/StringRef.h" 40 #include "llvm/ADT/Twine.h" 41 #include "llvm/ADT/iterator_range.h" 42 #include "llvm/Support/Casting.h" 43 #include "llvm/Support/Compiler.h" 44 #include "llvm/Support/ErrorHandling.h" 45 #include "llvm/Support/PointerLikeTypeTraits.h" 46 #include "llvm/Support/type_traits.h" 52 #include <type_traits> 71 struct PointerLikeTypeTraits;
103 class AttributedType;
106 template <
typename>
class CanQual;
113 class ExtQualsTypeCommonBase;
115 class FunctionNoProtoType;
116 class FunctionProtoType;
117 class IdentifierInfo;
118 class InjectedClassNameType;
120 class ObjCInterfaceDecl;
121 class ObjCObjectPointerType;
122 class ObjCObjectType;
123 class ObjCProtocolDecl;
124 class ObjCTypeParamDecl;
126 struct PrintingPolicy;
131 class TemplateArgument;
132 class TemplateArgumentListInfo;
133 class TemplateArgumentLoc;
134 class TemplateSpecializationType;
135 class TemplateTypeParmDecl;
136 class TypedefNameDecl;
138 class UnresolvedUsingTypenameDecl;
143 #define TYPE(Class, Base) class Class##Type; 144 #include "clang/AST/TypeNodes.def" 158 CVRMask = Const | Volatile | Restrict
192 MaxAddressSpace = 0x7fffffu,
198 FastMask = (1 << FastWidth) - 1
205 if (!(L.Mask & ~CVRMask) && !(R.Mask & ~CVRMask)) {
207 Q.Mask = L.Mask & R.Mask;
271 Mask = (Mask & ~Const) | (flag ? Const : 0);
278 Mask = (Mask & ~Volatile) | (flag ? Volatile : 0);
285 Mask = (Mask & ~Restrict) | (flag ? Restrict : 0);
293 assert(!(mask & ~CVRMask) &&
"bitmask contains non-CVR bits");
294 Mask = (Mask & ~CVRMask) | mask;
297 assert(!(mask & ~CVRMask) &&
"bitmask contains non-CVR bits");
301 removeCVRQualifiers(CVRMask);
304 assert(!(mask & ~CVRMask) &&
"bitmask contains non-CVR bits");
308 assert(!(mask & ~CVRMask & ~UMask) &&
"bitmask contains non-CVRU bits");
314 Mask = (Mask & ~UMask) | (flag ? UMask : 0);
322 Mask = (Mask & ~GCAttrMask) | (type << GCAttrShift);
342 return ObjCLifetime((Mask & LifetimeMask) >> LifetimeShift);
345 Mask = (Mask & ~LifetimeMask) | (type << LifetimeShift);
350 assert(!hasObjCLifetime());
351 Mask |= (type << LifetimeShift);
357 return (lifetime > OCL_ExplicitNone);
363 return (lifetime == OCL_Strong || lifetime == OCL_Weak);
368 return static_cast<LangAS>(Mask >> AddressSpaceShift);
375 auto Addr = getAddressSpace();
388 assert((
unsigned)space <= MaxAddressSpace);
389 Mask = (Mask & ~AddressSpaceMask)
390 | (((uint32_t) space) << AddressSpaceShift);
395 setAddressSpace(space);
403 assert(!(mask & ~FastMask) &&
"bitmask contains non-fast qualifier bits");
404 Mask = (Mask & ~FastMask) | mask;
407 assert(!(mask & ~FastMask) &&
"bitmask contains non-fast qualifier bits");
411 removeFastQualifiers(FastMask);
414 assert(!(mask & ~FastMask) &&
"bitmask contains non-fast qualifier bits");
429 bool empty()
const {
return !Mask; }
435 if (!(Q.Mask & ~CVRMask))
438 Mask |= (Q.Mask & CVRMask);
452 if (!(Q.Mask & ~CVRMask))
455 Mask &= ~(Q.Mask & CVRMask);
459 removeObjCLifetime();
461 removeAddressSpace();
498 return isAddressSpaceSupersetOf(other) &&
501 (getObjCGCAttr() == other.
getObjCGCAttr() || !hasObjCGCAttr() ||
506 (((Mask & CVRMask) | (other.Mask & CVRMask)) == (Mask & CVRMask)) &&
522 if (getObjCLifetime() == OCL_Weak || other.
getObjCLifetime() == OCL_Weak)
525 if (getObjCLifetime() == OCL_None || other.
getObjCLifetime() == OCL_None)
533 bool isStrictSupersetOf(
Qualifiers Other)
const;
538 explicit operator bool()
const {
return hasQualifiers(); }
568 bool appendSpaceIfNonEmpty =
false)
const;
579 static const uint32_t UMask = 0x8;
580 static const uint32_t UShift = 3;
581 static const uint32_t GCAttrMask = 0x30;
582 static const uint32_t GCAttrShift = 4;
583 static const uint32_t LifetimeMask = 0x1C0;
584 static const uint32_t LifetimeShift = 6;
585 static const uint32_t AddressSpaceMask =
586 ~(CVRMask | UMask | GCAttrMask | LifetimeMask);
587 static const uint32_t AddressSpaceShift = 9;
605 std::pair<const Type *,Qualifiers>
asPair()
const {
606 return std::pair<const Type *, Qualifiers>(Ty, Quals);
657 llvm::PointerIntPair<llvm::PointerUnion<const Type *, const ExtQuals *>,
660 const ExtQuals *getExtQualsUnsafe()
const {
661 return Value.getPointer().get<
const ExtQuals*>();
664 const Type *getTypePtrUnsafe()
const {
665 return Value.getPointer().get<
const Type*>();
669 assert(!isNull() &&
"Cannot retrieve a NULL type pointer");
671 =
reinterpret_cast<uintptr_t>(Value.getOpaqueValue());
688 const Type *getTypePtr()
const;
690 const Type *getTypePtrOrNull()
const;
703 T.Value.setFromOpaqueValue(const_cast<void*>(Ptr));
708 return *getTypePtr();
715 bool isCanonical()
const;
716 bool isCanonicalAsParam()
const;
720 return Value.getPointer().isNull();
731 bool isConstQualified()
const;
741 bool isRestrictQualified()
const;
751 bool isVolatileQualified()
const;
757 return getLocalFastQualifiers() || hasLocalNonFastQualifiers();
761 bool hasQualifiers()
const;
767 return Value.getPointer().is<
const ExtQuals*>();
782 return getLocalFastQualifiers();
787 unsigned getCVRQualifiers()
const;
794 bool isPODType(
const ASTContext &Context)
const;
798 bool isCXX98PODType(
const ASTContext &Context)
const;
803 bool isCXX11PODType(
const ASTContext &Context)
const;
806 bool isTrivialType(
const ASTContext &Context)
const;
809 bool isTriviallyCopyableType(
const ASTContext &Context)
const;
839 return withFastQualifiers(CVR);
844 &&
"non-fast qualifier bits set in mask!");
845 Value.setInt(Value.getInt() | TQs);
848 void removeLocalConst();
849 void removeLocalVolatile();
850 void removeLocalRestrict();
851 void removeLocalCVRQualifiers(
unsigned Mask);
856 Value.setInt(Value.getInt() & ~Mask);
905 inline QualType getUnqualifiedType()
const;
920 bool isMoreQualifiedThan(
QualType Other)
const;
924 bool isAtLeastAsQualifiedAs(
QualType Other)
const;
926 QualType getNonReferenceType()
const;
947 return getDesugaredType(*
this, Context);
951 return getSplitDesugaredType(*
this);
960 return getSingleStepDesugaredTypeImpl(*
this, Context);
966 if (isa<ParenType>(*
this))
973 return LHS.Value == RHS.Value;
976 return LHS.Value != RHS.Value;
990 const Twine &PlaceHolder = Twine(),
991 unsigned Indentation = 0)
const {
992 print(split(), OS, Policy, PlaceHolder, Indentation);
997 unsigned Indentation = 0) {
998 return print(split.
Ty, split.
Quals, OS, policy, PlaceHolder, Indentation);
1003 const Twine &PlaceHolder,
1004 unsigned Indentation = 0);
1008 return getAsStringInternal(split(), Str, Policy);
1013 return getAsStringInternal(split.
Ty, split.
Quals, out, policy);
1023 const Twine &PlaceHolder;
1024 unsigned Indentation;
1028 const Twine &PlaceHolder,
unsigned Indentation)
1029 : T(T), Policy(Policy), PlaceHolder(PlaceHolder),
1030 Indentation(Indentation) {}
1034 SQT.T.
print(OS, SQT.Policy, SQT.PlaceHolder, SQT.Indentation);
1040 const Twine &PlaceHolder = Twine(),
1041 unsigned Indentation = 0)
const {
1045 void dump(
const char *s)
const;
1047 void dump(llvm::raw_ostream &OS)
const;
1050 ID.AddPointer(getAsOpaquePtr());
1054 inline LangAS getAddressSpace()
const;
1083 bool isNonWeakInMRRWithObjCWeak(
const ASTContext &Context)
const;
1089 DK_objc_weak_lifetime
1097 return isDestructedTypeImpl(*
this);
1110 bool isCForbiddenLValueType()
const;
1158 QualType getAtomicUnqualifiedType()
const;
1200 enum { NumLowBitsAvailable = 0 };
1220 const Type *
const BaseType;
1226 : BaseType(baseType), CanonicalType(canon) {}
1262 canon.isNull() ?
QualType(this_(), 0) : canon),
1265 &&
"ExtQuals created with no fast qualifiers");
1267 &&
"ExtQuals created with fast qualifiers");
1287 Profile(ID, getBaseType(), Quals);
1291 const Type *BaseType,
1294 ID.AddPointer(BaseType);
1354 #define TYPE(Class, Base) Class, 1355 #define LAST_TYPE(Class) TypeLast = Class, 1356 #define ABSTRACT_TYPE(Class, Base) 1357 #include "clang/AST/TypeNodes.def" 1358 TagFirst = Record, TagLast = Enum
1363 class TypeBitfields {
1371 unsigned Dependent : 1;
1375 unsigned InstantiationDependent : 1;
1378 unsigned VariablyModified : 1;
1382 unsigned ContainsUnexpandedParameterPack : 1;
1386 mutable unsigned CacheValid : 1;
1389 mutable unsigned CachedLinkage : 3;
1392 mutable unsigned CachedLocalOrUnnamed : 1;
1395 mutable unsigned FromAST : 1;
1397 bool isCacheValid()
const {
1402 assert(isCacheValid() &&
"getting linkage from invalid cache");
1403 return static_cast<Linkage>(CachedLinkage);
1406 bool hasLocalOrUnnamedType()
const {
1407 assert(isCacheValid() &&
"getting linkage from invalid cache");
1408 return CachedLocalOrUnnamed;
1411 enum { NumTypeBits = 18 };
1420 unsigned : NumTypeBits;
1424 unsigned IndexTypeQuals : 3;
1429 unsigned SizeModifier : 3;
1435 unsigned : NumTypeBits;
1445 unsigned : NumTypeBits;
1449 unsigned ExtInfo : 11;
1457 unsigned TypeQuals : 4;
1462 unsigned RefQualifier : 2;
1468 unsigned : NumTypeBits;
1471 unsigned NumTypeArgs : 7;
1474 unsigned NumProtocols : 6;
1477 unsigned IsKindOf : 1;
1480 static_assert(NumTypeBits + 7 + 6 + 1 <= 32,
"Does not fit in an unsigned");
1485 unsigned : NumTypeBits;
1498 unsigned SpelledAsLValue : 1;
1502 unsigned InnerRef : 1;
1508 unsigned : NumTypeBits;
1511 unsigned Keyword : 8;
1517 unsigned : NumTypeBits;
1521 unsigned VecKind : 3;
1524 unsigned NumElements : 29 - NumTypeBits;
1526 enum { MaxNumElements = (1 << (29 - NumTypeBits)) - 1 };
1532 unsigned : NumTypeBits;
1535 unsigned AttrKind : 32 - NumTypeBits;
1541 unsigned : NumTypeBits;
1545 unsigned Keyword : 2;
1565 void setFromAST(
bool V =
true)
const {
1566 TypeBits.FromAST = V;
1573 bool InstantiationDependent,
bool VariablyModified,
1574 bool ContainsUnexpandedParameterPack)
1576 canon.isNull() ?
QualType(this_(), 0) : canon) {
1578 TypeBits.Dependent = Dependent;
1579 TypeBits.InstantiationDependent = Dependent || InstantiationDependent;
1580 TypeBits.VariablyModified = VariablyModified;
1581 TypeBits.ContainsUnexpandedParameterPack = ContainsUnexpandedParameterPack;
1582 TypeBits.CacheValid =
false;
1583 TypeBits.CachedLocalOrUnnamed =
false;
1585 TypeBits.FromAST =
false;
1592 TypeBits.Dependent = D;
1594 TypeBits.InstantiationDependent =
true;
1598 TypeBits.InstantiationDependent = D; }
1603 TypeBits.ContainsUnexpandedParameterPack = PP;
1611 Type &operator=(
const Type &) =
delete;
1634 return TypeBits.ContainsUnexpandedParameterPack;
1640 return CanonicalType ==
QualType(
this, 0);
1646 QualType getLocallyUnqualifiedSingleStepDesugaredType()
const;
1659 bool isIncompleteType(
NamedDecl **Def =
nullptr)
const;
1664 return !isFunctionType();
1672 return !isReferenceType() && !isFunctionType() && !isVoidType();
1677 bool isLiteralType(
const ASTContext &Ctx)
const;
1681 bool isStandardLayoutType()
const;
1687 bool isBuiltinType()
const;
1690 bool isSpecificBuiltinType(
unsigned K)
const;
1695 bool isPlaceholderType()
const;
1699 bool isSpecificPlaceholderType(
unsigned K)
const;
1703 bool isNonOverloadPlaceholderType()
const;
1707 bool isIntegerType()
const;
1708 bool isEnumeralType()
const;
1711 bool isWideCharType()
const;
1712 bool isChar16Type()
const;
1713 bool isChar32Type()
const;
1714 bool isAnyCharacterType()
const;
1715 bool isIntegralType(
const ASTContext &Ctx)
const;
1718 bool isIntegralOrEnumerationType()
const;
1721 bool isIntegralOrUnscopedEnumerationType()
const;
1724 bool isRealFloatingType()
const;
1727 bool isComplexType()
const;
1728 bool isAnyComplexType()
const;
1729 bool isFloatingType()
const;
1730 bool isHalfType()
const;
1731 bool isRealType()
const;
1732 bool isArithmeticType()
const;
1733 bool isVoidType()
const;
1734 bool isScalarType()
const;
1735 bool isAggregateType()
const;
1736 bool isFundamentalType()
const;
1737 bool isCompoundType()
const;
1741 bool isFunctionType()
const;
1744 bool isPointerType()
const;
1745 bool isAnyPointerType()
const;
1746 bool isBlockPointerType()
const;
1747 bool isVoidPointerType()
const;
1748 bool isReferenceType()
const;
1749 bool isLValueReferenceType()
const;
1750 bool isRValueReferenceType()
const;
1751 bool isFunctionPointerType()
const;
1752 bool isMemberPointerType()
const;
1753 bool isMemberFunctionPointerType()
const;
1754 bool isMemberDataPointerType()
const;
1755 bool isArrayType()
const;
1756 bool isConstantArrayType()
const;
1757 bool isIncompleteArrayType()
const;
1758 bool isVariableArrayType()
const;
1759 bool isDependentSizedArrayType()
const;
1761 bool isClassType()
const;
1762 bool isStructureType()
const;
1763 bool isObjCBoxableRecordType()
const;
1764 bool isInterfaceType()
const;
1765 bool isStructureOrClassType()
const;
1766 bool isUnionType()
const;
1767 bool isComplexIntegerType()
const;
1768 bool isVectorType()
const;
1769 bool isExtVectorType()
const;
1770 bool isDependentAddressSpaceType()
const;
1771 bool isObjCObjectPointerType()
const;
1772 bool isObjCRetainableType()
const;
1773 bool isObjCLifetimeType()
const;
1774 bool isObjCIndirectLifetimeType()
const;
1775 bool isObjCNSObjectType()
const;
1776 bool isObjCIndependentClassType()
const;
1779 bool isObjCObjectType()
const;
1780 bool isObjCQualifiedInterfaceType()
const;
1781 bool isObjCQualifiedIdType()
const;
1782 bool isObjCQualifiedClassType()
const;
1783 bool isObjCObjectOrInterfaceType()
const;
1784 bool isObjCIdType()
const;
1785 bool isObjCInertUnsafeUnretainedType()
const;
1794 bool isObjCIdOrObjectKindOfType(
const ASTContext &ctx,
1797 bool isObjCClassType()
const;
1805 bool isObjCClassOrClassKindOfType()
const;
1807 bool isBlockCompatibleObjCPointerType(
ASTContext &ctx)
const;
1808 bool isObjCSelType()
const;
1809 bool isObjCBuiltinType()
const;
1810 bool isObjCARCBridgableType()
const;
1811 bool isCARCBridgableType()
const;
1812 bool isTemplateTypeParmType()
const;
1813 bool isNullPtrType()
const;
1814 bool isAlignValT()
const;
1815 bool isStdByteType()
const;
1816 bool isAtomicType()
const;
1818 #define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \ 1819 bool is##Id##Type() const; 1820 #include "clang/Basic/OpenCLImageTypes.def" 1822 bool isImageType()
const;
1824 bool isSamplerT()
const;
1825 bool isEventT()
const;
1826 bool isClkEventT()
const;
1827 bool isQueueT()
const;
1828 bool isReserveIDT()
const;
1830 bool isPipeType()
const;
1831 bool isOpenCLSpecificType()
const;
1836 bool isObjCARCImplicitlyUnretainedType()
const;
1865 return TypeBits.InstantiationDependent;
1871 bool isUndeducedType()
const;
1878 bool hasSizedVLAType()
const;
1881 bool hasUnnamedOrLocalType()
const;
1883 bool isOverloadableType()
const;
1886 bool isElaboratedTypeSpecifier()
const;
1888 bool canDecayToPointerType()
const;
1893 bool hasPointerRepresentation()
const;
1897 bool hasObjCPointerRepresentation()
const;
1901 bool hasIntegerRepresentation()
const;
1905 bool hasSignedIntegerRepresentation()
const;
1909 bool hasUnsignedIntegerRepresentation()
const;
1913 bool hasFloatingRepresentation()
const;
1918 const RecordType *getAsStructureType()
const;
1921 const ComplexType *getAsComplexIntegerType()
const;
1939 TagDecl *getAsTagDecl()
const;
1957 return dyn_cast_or_null<AutoType>(getContainedDeducedType());
1963 bool hasAutoForTrailingReturnType()
const;
1971 template <
typename T>
const T *getAs()
const;
1978 template <
typename T>
const T *getAsAdjusted()
const;
1982 const ArrayType *getAsArrayTypeUnsafe()
const;
1990 template <
typename T>
const T *castAs()
const;
1994 const ArrayType *castAsArrayTypeUnsafe()
const;
1999 const Type *getBaseElementTypeUnsafe()
const;
2004 const Type *getArrayElementTypeNoTypeQual()
const;
2009 const Type *getPointeeOrArrayElementType()
const;
2017 const Type *getUnqualifiedDesugaredType()
const;
2020 bool isPromotableIntegerType()
const;
2025 bool isSignedIntegerType()
const;
2030 bool isUnsignedIntegerType()
const;
2034 bool isSignedIntegerOrEnumerationType()
const;
2038 bool isUnsignedIntegerOrEnumerationType()
const;
2043 bool isConstantSizeType()
const;
2047 bool isSpecifierType()
const;
2054 return getLinkageAndVisibility().getVisibility();
2059 return getLinkageAndVisibility().isVisibilityExplicit();
2067 bool isLinkageValid()
const;
2081 bool canHaveNullability(
bool ResultIfUnknown =
true)
const;
2099 getObjCSubstitutions(
const DeclContext *dc)
const;
2103 bool acceptsObjCTypeParams()
const;
2105 const char *getTypeClassName()
const;
2108 return CanonicalType;
2113 void dump(llvm::raw_ostream &OS)
const;
2131 #define TYPE(Class, Base) 2132 #define LEAF_TYPE(Class) \ 2133 template <> inline const Class##Type *Type::getAs() const { \ 2134 return dyn_cast<Class##Type>(CanonicalType); \ 2136 template <> inline const Class##Type *Type::castAs() const { \ 2137 return cast<Class##Type>(CanonicalType); \ 2139 #include "clang/AST/TypeNodes.def" 2147 #define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) Id, 2148 #include "clang/Basic/OpenCLImageTypes.def" 2150 #define BUILTIN_TYPE(Id, SingletonId) Id, 2151 #define LAST_BUILTIN_TYPE(Id) LastKind = Id 2152 #include "clang/AST/BuiltinTypes.def" 2161 BuiltinTypeBits.Kind = K;
2169 StringRef str = getName(Policy);
2170 assert(!str.empty() && str.data()[str.size()] ==
'\0');
2195 return K >= Overload;
2202 return isPlaceholderTypeKind(
getKind());
2229 :
Type(Complex, CanonicalPtr, Element->isDependentType(),
2230 Element->isInstantiationDependentType(),
2231 Element->isVariablyModifiedType(),
2232 Element->containsUnexpandedParameterPack()),
2233 ElementType(Element) {}
2242 Profile(ID, getElementType());
2259 :
Type(
Paren, CanonType, InnerType->isDependentType(),
2260 InnerType->isInstantiationDependentType(),
2261 InnerType->isVariablyModifiedType(),
2262 InnerType->containsUnexpandedParameterPack()),
2272 Profile(ID, getInnerType());
2289 :
Type(Pointer, CanonicalPtr, Pointee->isDependentType(),
2290 Pointee->isInstantiationDependentType(),
2291 Pointee->isVariablyModifiedType(),
2292 Pointee->containsUnexpandedParameterPack()),
2293 PointeeType(Pointee) {}
2318 Profile(ID, getPointeeType());
2340 :
Type(TC, CanonicalPtr, OriginalTy->isDependentType(),
2341 OriginalTy->isInstantiationDependentType(),
2342 OriginalTy->isVariablyModifiedType(),
2343 OriginalTy->containsUnexpandedParameterPack()),
2344 OriginalTy(OriginalTy), AdjustedTy(AdjustedTy) {}
2354 Profile(ID, OriginalTy, AdjustedTy);
2377 inline QualType getPointeeType()
const;
2392 :
Type(BlockPointer, CanonicalCls, Pointee->isDependentType(),
2393 Pointee->isInstantiationDependentType(),
2394 Pointee->isVariablyModifiedType(),
2395 Pointee->containsUnexpandedParameterPack()),
2396 PointeeType(Pointee) {}
2406 Profile(ID, getPointeeType());
2424 bool SpelledAsLValue)
2425 :
Type(tc, CanonicalRef, Referencee->isDependentType(),
2426 Referencee->isInstantiationDependentType(),
2427 Referencee->isVariablyModifiedType(),
2428 Referencee->containsUnexpandedParameterPack()),
2429 PointeeType(Referencee) {
2430 ReferenceTypeBits.SpelledAsLValue = SpelledAsLValue;
2445 return T->PointeeType;
2449 Profile(ID, PointeeType, isSpelledAsLValue());
2454 bool SpelledAsLValue) {
2456 ID.AddBoolean(SpelledAsLValue);
2470 bool SpelledAsLValue)
2512 :
Type(MemberPointer, CanonicalPtr,
2513 Cls->isDependentType() || Pointee->isDependentType(),
2514 (Cls->isInstantiationDependentType() ||
2515 Pointee->isInstantiationDependentType()),
2516 Pointee->isVariablyModifiedType(),
2517 (Cls->containsUnexpandedParameterPack() ||
2518 Pointee->containsUnexpandedParameterPack())),
2519 PointeeType(Pointee), Class(Cls) {}
2543 Profile(ID, getPointeeType(), getClass());
2547 const Type *Class) {
2549 ID.AddPointer(Class);
2582 bool ContainsUnexpandedParameterPack)
2583 :
Type(tc, can, et->isDependentType() || tc == DependentSizedArray,
2584 et->isInstantiationDependentType() || tc == DependentSizedArray,
2585 (tc == VariableArray || et->isVariablyModifiedType()),
2586 ContainsUnexpandedParameterPack),
2588 ArrayTypeBits.IndexTypeQuals = tq;
2589 ArrayTypeBits.SizeModifier = sm;
2604 return ArrayTypeBits.IndexTypeQuals;
2623 :
ArrayType(ConstantArray, et, can, sm, tq,
2632 :
ArrayType(tc, et, can, sm, tq, et->containsUnexpandedParameterPack()),
2636 const llvm::APInt &
getSize()
const {
return Size; }
2642 static unsigned getNumAddressingBits(
const ASTContext &Context,
2644 const llvm::APInt &NumElements);
2648 static unsigned getMaxSizeBits(
const ASTContext &Context);
2651 Profile(ID, getElementType(), getSize(),
2652 getSizeModifier(), getIndexTypeCVRQualifiers());
2657 unsigned TypeQuals) {
2659 ID.AddInteger(ArraySize.getZExtValue());
2660 ID.AddInteger(SizeMod);
2661 ID.AddInteger(TypeQuals);
2677 :
ArrayType(IncompleteArray, et, can, sm, tq,
2678 et->containsUnexpandedParameterPack()) {}
2691 Profile(ID, getElementType(), getSizeModifier(),
2692 getIndexTypeCVRQualifiers());
2698 ID.AddInteger(SizeMod);
2699 ID.AddInteger(TypeQuals);
2730 :
ArrayType(VariableArray, et, can, sm, tq,
2731 et->containsUnexpandedParameterPack()),
2732 SizeExpr((
Stmt*) e), Brackets(brackets) {}
2740 return (
Expr*) SizeExpr;
2755 llvm_unreachable(
"Cannot unique VariableArrayTypes.");
2797 return (
Expr*) SizeExpr;
2812 Profile(ID, Context, getElementType(),
2813 getSizeModifier(), getIndexTypeCVRQualifiers(), getSizeExpr());
2816 static void Profile(llvm::FoldingSetNodeID &
ID,
const ASTContext &Context,
2818 unsigned TypeQuals,
Expr *E);
2836 Expr *AddrSpaceExpr;
2857 Profile(ID, Context, getPointeeType(), getAddrSpaceExpr());
2860 static void Profile(llvm::FoldingSetNodeID &
ID,
const ASTContext &Context,
2901 Profile(ID, Context, getElementType(), getSizeExpr());
2904 static void Profile(llvm::FoldingSetNodeID &
ID,
const ASTContext &Context,
2953 return NumElements > VectorTypeBitfields::MaxNumElements;
2964 Profile(ID, getElementType(), getNumElements(),
2965 getTypeClass(), getVectorKind());
2972 ID.AddInteger(NumElements);
2973 ID.AddInteger(TypeClass);
2974 ID.AddInteger(VecKind);
2992 :
VectorType(ExtVector, vecType, nElements, canonType, GenericVector) {}
2998 case 'x':
case 'r':
return 0;
2999 case 'y':
case 'g':
return 1;
3000 case 'z':
case 'b':
return 2;
3001 case 'w':
case 'a':
return 3;
3019 case 'a':
return 10;
3021 case 'b':
return 11;
3023 case 'c':
return 12;
3025 case 'd':
return 13;
3027 case 'e':
return 14;
3029 case 'f':
return 15;
3034 if (isNumericAccessor)
3035 return getNumericAccessorIdx(c);
3037 return getPointAccessorIdx(c);
3041 if (
int idx = getAccessorIdx(c, isNumericAccessor)+1)
3042 return unsigned(idx-1) < getNumElements();
3092 enum { CallConvMask = 0x1F };
3093 enum { NoReturnMask = 0x20 };
3094 enum { ProducesResultMask = 0x40 };
3095 enum { NoCallerSavedRegsMask = 0x80 };
3097 RegParmMask = ~(CallConvMask | NoReturnMask | ProducesResultMask |
3098 NoCallerSavedRegsMask),
3102 uint16_t Bits =
CC_C;
3104 ExtInfo(
unsigned Bits) : Bits(static_cast<uint16_t>(Bits)) {}
3110 bool producesResult,
bool noCallerSavedRegs) {
3111 assert((!hasRegParm || regParm < 7) &&
"Invalid regparm value");
3112 Bits = ((unsigned)cc) | (noReturn ? NoReturnMask : 0) |
3113 (producesResult ? ProducesResultMask : 0) |
3114 (noCallerSavedRegs ? NoCallerSavedRegsMask : 0) |
3115 (hasRegParm ? ((regParm + 1) << RegParmOffset) : 0);
3132 unsigned RegParm = Bits >> RegParmOffset;
3141 return Bits == Other.Bits;
3144 return Bits != Other.Bits;
3152 return ExtInfo(Bits | NoReturnMask);
3154 return ExtInfo(Bits & ~NoReturnMask);
3159 return ExtInfo(Bits | ProducesResultMask);
3161 return ExtInfo(Bits & ~ProducesResultMask);
3165 if (noCallerSavedRegs)
3166 return ExtInfo(Bits | NoCallerSavedRegsMask);
3168 return ExtInfo(Bits & ~NoCallerSavedRegsMask);
3172 assert(RegParm < 7 &&
"Invalid regparm value");
3173 return ExtInfo((Bits & ~RegParmMask) |
3174 ((RegParm + 1) << RegParmOffset));
3178 return ExtInfo((Bits & ~CallConvMask) | (
unsigned) cc);
3182 ID.AddInteger(Bits);
3188 QualType Canonical,
bool Dependent,
3189 bool InstantiationDependent,
3190 bool VariablyModified,
bool ContainsUnexpandedParameterPack,
3192 :
Type(tc, Canonical, Dependent, InstantiationDependent, VariablyModified,
3193 ContainsUnexpandedParameterPack),
3195 FunctionTypeBits.ExtInfo = Info.Bits;
3223 static StringRef getNameForCallConv(
CallingConv CC);
3239 Result->isVariablyModifiedType(),
3249 Profile(ID, getReturnType(), getExtInfo());
3293 HasPassObjSize = 0x20,
3296 unsigned char Data = 0;
3307 copy.Data = (copy.Data & ~ABIMask) |
unsigned(kind);
3314 return (Data & IsConsumed);
3319 copy.Data |= IsConsumed;
3321 copy.Data &= ~IsConsumed;
3327 return Data & HasPassObjSize;
3331 Copy.Data |= HasPassObjSize;
3336 return Data & IsNoEscape;
3342 Copy.Data |= IsNoEscape;
3344 Copy.Data &= ~IsNoEscape;
3356 return lhs.Data == rhs.Data;
3359 return lhs.Data != rhs.Data;
3391 unsigned char TypeQuals = 0;
3397 : Variadic(
false), HasTrailingReturn(
false) {}
3400 : ExtInfo(CC), Variadic(
false), HasTrailingReturn(
false) {}
3414 static bool containsAnyUnexpandedParameterPack(
const QualType *ArgArray,
3416 for (
unsigned Idx = 0; Idx < numArgs; ++Idx)
3417 if (ArgArray[Idx]->containsUnexpandedParameterPack())
3427 unsigned NumParams : 15;
3430 unsigned NumExceptions : 9;
3433 unsigned ExceptionSpecType : 4;
3436 unsigned HasExtParameterInfos : 1;
3439 unsigned Variadic : 1;
3442 unsigned HasTrailingReturn : 1;
3464 assert(hasExtParameterInfos());
3467 const char *ptr =
reinterpret_cast<const char *
>(exception_begin());
3468 ptr += getExceptionSpecSize();
3473 size_t getExceptionSpecSize()
const {
3474 switch (getExceptionSpecType()) {
3485 llvm_unreachable(
"bad exception specification kind");
3492 assert(i < NumParams &&
"invalid parameter index");
3493 return param_type_begin()[i];
3497 return llvm::makeArrayRef(param_type_begin(), param_type_end());
3506 EPI.
TypeQuals =
static_cast<unsigned char>(getTypeQuals());
3518 if (hasExtParameterInfos())
3530 return getExceptionSpecType() !=
EST_None;
3544 bool hasDependentExceptionSpec()
const;
3548 bool hasInstantiationDependentExceptionSpec()
const;
3572 assert(i < NumExceptions &&
"Invalid exception number!");
3573 return exception_begin()[i];
3579 return *
reinterpret_cast<Expr *
const *
>(param_type_end());
3590 return reinterpret_cast<FunctionDecl *
const *
>(param_type_end())[0];
3600 return reinterpret_cast<FunctionDecl *
const *
>(param_type_end())[1];
3611 return ResultIfDependent ? canThrow(Ctx) !=
CT_Can 3623 bool isTemplateVariadic()
const;
3642 return reinterpret_cast<const QualType *
>(
this+1);
3646 return param_type_begin() + NumParams;
3652 return llvm::makeArrayRef(exception_begin(), exception_end());
3657 return param_type_end();
3662 return exception_begin();
3663 return exception_begin() + NumExceptions;
3670 assert(hasExtParameterInfos());
3679 if (!hasExtParameterInfos())
3681 return getExtParameterInfosBuffer();
3685 assert(I < getNumParams() &&
"parameter index out of range");
3686 if (hasExtParameterInfos())
3687 return getExtParameterInfosBuffer()[I];
3692 assert(I < getNumParams() &&
"parameter index out of range");
3693 if (hasExtParameterInfos())
3694 return getExtParameterInfosBuffer()[I].getABI();
3699 assert(I < getNumParams() &&
"parameter index out of range");
3700 if (hasExtParameterInfos())
3701 return getExtParameterInfosBuffer()[I].isConsumed();
3708 void printExceptionSpecification(raw_ostream &OS,
3715 void Profile(llvm::FoldingSetNodeID &
ID,
const ASTContext &Ctx);
3748 return Profile(ID, Decl);
3764 :
Type(tc, can, can->isDependentType(),
3765 can->isInstantiationDependentType(),
3766 can->isVariablyModifiedType(),
3769 assert(!isa<TypedefType>(can) &&
"Invalid canonical type");
3797 bool isSugared()
const;
3817 Profile(ID, Context, getUnderlyingExpr());
3820 static void Profile(llvm::FoldingSetNodeID &
ID,
const ASTContext &Context,
3831 :
Type(TypeOf, can, T->isDependentType(),
3832 T->isInstantiationDependentType(),
3833 T->isVariablyModifiedType(),
3834 T->containsUnexpandedParameterPack()),
3836 assert(!isa<TypedefType>(can) &&
"Invalid canonical type");
3869 bool isSugared()
const;
3887 Profile(ID, Context, getUnderlyingExpr());
3890 static void Profile(llvm::FoldingSetNodeID &
ID,
const ASTContext &Context,
3937 public llvm::FoldingSetNode {
3943 Profile(ID, getBaseType(), getUTTKind());
3949 ID.AddInteger((
unsigned)UKind);
3967 bool isBeingDefined()
const;
3992 bool hasConstFields()
const;
4043 FirstExprOperandKind = attr_address_space,
4044 LastExprOperandKind = attr_neon_polyvector_type,
4052 FirstEnumOperandKind = attr_objc_gc,
4053 LastEnumOperandKind = attr_pcs_vfp,
4090 :
Type(Attributed, canon, equivalent->isDependentType(),
4091 equivalent->isInstantiationDependentType(),
4092 equivalent->isVariablyModifiedType(),
4093 equivalent->containsUnexpandedParameterPack()),
4094 ModifiedType(modified), EquivalentType(equivalent) {
4095 AttributedTypeBits.AttrKind = attrKind;
4100 return static_cast<Kind>(AttributedTypeBits.AttrKind);
4124 bool isQualifier()
const;
4126 bool isMSTypeSpec()
const;
4128 bool isCallingConv()
const;
4137 return attr_nonnull;
4140 return attr_nullable;
4143 return attr_null_unspecified;
4145 llvm_unreachable(
"Unknown nullability kind.");
4160 Profile(ID, getAttrKind(), ModifiedType, EquivalentType);
4165 ID.AddInteger(attrKind);
4179 struct CanonicalTTPTInfo {
4180 unsigned Depth : 15;
4181 unsigned ParameterPack : 1;
4182 unsigned Index : 16;
4195 :
Type(TemplateTypeParm, Canon,
true,
4198 Canon->containsUnexpandedParameterPack()),
4207 CanTTPTInfo.Depth = D;
4208 CanTTPTInfo.Index = I;
4209 CanTTPTInfo.ParameterPack = PP;
4212 const CanonicalTTPTInfo& getCanTTPTInfo()
const {
4213 QualType Can = getCanonicalTypeInternal();
4218 unsigned getDepth()
const {
return getCanTTPTInfo().Depth; }
4219 unsigned getIndex()
const {
return getCanTTPTInfo().Index; }
4223 return isCanonicalUnqualified() ? nullptr : TTPDecl;
4232 Profile(ID, getDepth(), getIndex(), isParameterPack(), getDecl());
4236 unsigned Index,
bool ParameterPack,
4238 ID.AddInteger(Depth);
4239 ID.AddInteger(Index);
4240 ID.AddBoolean(ParameterPack);
4241 ID.AddPointer(TTPDecl);
4263 :
Type(SubstTemplateTypeParm, Canon, Canon->isDependentType(),
4264 Canon->isInstantiationDependentType(),
4265 Canon->isVariablyModifiedType(),
4266 Canon->containsUnexpandedParameterPack()),
4278 return getCanonicalTypeInternal();
4285 Profile(ID, getReplacedParameter(), getReplacementType());
4291 ID.AddPointer(Replaced);
4323 unsigned NumArguments;
4342 void Profile(llvm::FoldingSetNodeID &
ID);
4343 static void Profile(llvm::FoldingSetNodeID &ID,
4364 bool IsInstantiationDependent,
bool ContainsParameterPack)
4367 DeducedAsType.isNull() ?
QualType(this, 0)
4368 : DeducedAsType.getCanonicalType(),
4369 IsDependent, IsInstantiationDependent,
4370 false, ContainsParameterPack) {
4371 if (!DeducedAsType.
isNull()) {
4375 setInstantiationDependent();
4377 setContainsUnexpandedParameterPack();
4382 bool isSugared()
const {
return !isCanonicalUnqualified(); }
4388 return !isCanonicalUnqualified() ? getCanonicalTypeInternal() :
QualType();
4391 return !isCanonicalUnqualified() || isDependentType();
4405 bool IsDeducedAsDependent)
4407 IsDeducedAsDependent,
false) {
4408 AutoTypeBits.Keyword = (unsigned)Keyword;
4421 Profile(ID, getDeducedType(), getKeyword(), isDependentType());
4427 ID.AddInteger((
unsigned)Keyword);
4428 ID.AddBoolean(IsDependent);
4438 public llvm::FoldingSetNode {
4446 bool IsDeducedAsDependent)
4447 :
DeducedType(DeducedTemplateSpecialization, DeducedAsType,
4448 IsDeducedAsDependent || Template.isDependent(),
4449 IsDeducedAsDependent || Template.isInstantiationDependent(),
4450 Template.containsUnexpandedParameterPack()),
4451 Template(Template) {}
4458 Profile(ID, getTemplateName(), getDeducedType(), isDependentType());
4462 QualType Deduced,
bool IsDependent) {
4465 ID.AddBoolean(IsDependent);
4469 return T->
getTypeClass() == DeducedTemplateSpecialization;
4495 public llvm::FoldingSetNode {
4509 unsigned NumArgs : 31;
4512 unsigned TypeAlias : 1;
4522 bool &InstantiationDependent);
4525 bool &InstantiationDependent);
4530 return isa<InjectedClassNameType>(getCanonicalTypeInternal());
4553 assert(isTypeAlias() &&
"not a type alias template specialization");
4554 return *
reinterpret_cast<const QualType*
>(end());
4578 return {getArgs(), NumArgs};
4582 return !isDependentType() || isCurrentInstantiation() || isTypeAlias();
4588 Profile(ID, Template, template_arguments(), Ctx);
4590 getAliasedType().Profile(ID);
4658 Decl(D), InjectedType(TST) {
4659 assert(isa<TemplateSpecializationType>(TST));
4668 return cast<TemplateSpecializationType>(InjectedType.
getTypePtr());
4672 return getInjectedTST()->getTemplateName();
4736 QualType Canonical,
bool Dependent,
4737 bool InstantiationDependent,
bool VariablyModified,
4738 bool ContainsUnexpandedParameterPack)
4739 :
Type(tc, Canonical, Dependent, InstantiationDependent, VariablyModified,
4740 ContainsUnexpandedParameterPack) {
4741 TypeWithKeywordBits.Keyword = Keyword;
4754 static TagTypeKind getTagTypeKindForTypeSpec(
unsigned TypeSpec);
4769 return getKeywordName(getKeywordForTagTypeKind(Kind));
4796 NamedType->isDependentType(),
4797 NamedType->isInstantiationDependentType(),
4798 NamedType->isVariablyModifiedType(),
4799 NamedType->containsUnexpandedParameterPack()),
4800 NNS(NNS), NamedType(NamedType) {
4801 assert(!(Keyword ==
ETK_None && NNS ==
nullptr) &&
4802 "ElaboratedType cannot have elaborated type keyword " 4803 "and name qualifier both null.");
4822 Profile(ID, getKeyword(), NNS, NamedType);
4827 ID.AddInteger(Keyword);
4863 NNS->containsUnexpandedParameterPack()),
4864 NNS(NNS), Name(Name) {}
4883 Profile(ID, getKeyword(), NNS, Name);
4888 ID.AddInteger(Keyword);
4890 ID.AddPointer(Name);
4903 public llvm::FoldingSetNode {
4936 return getArgBuffer();
4945 return {getArgs(), NumArgs};
4957 Profile(ID, Context, getKeyword(), NNS, Name, {getArgs(), NumArgs});
4960 static void Profile(llvm::FoldingSetNodeID &
ID,
4968 return T->
getTypeClass() == DependentTemplateSpecialization;
5006 unsigned NumExpansions;
5010 :
Type(PackExpansion, Canon, Pattern->isDependentType(),
5012 Pattern->isVariablyModifiedType(),
5015 NumExpansions(NumExpansions ? *NumExpansions + 1 : 0) {}
5027 return NumExpansions - 1;
5036 Profile(ID, getPattern(), getNumExpansions());
5042 ID.AddBoolean(NumExpansions.hasValue());
5044 ID.AddInteger(*NumExpansions);
5064 return static_cast<T*
>(
this)->getProtocolStorageImpl();
5068 static_cast<T*
>(
this)->setNumProtocolsImpl(N);
5072 setNumProtocols(protocols.size());
5073 assert(getNumProtocols() == protocols.size() &&
5074 "bitfield overflow in protocol count");
5075 if (!protocols.empty())
5076 memcpy(getProtocolStorage(), protocols.data(),
5093 return static_cast<const T*
>(
this)->getNumProtocolsImpl();
5098 assert(I < getNumProtocols() &&
"Out-of-range protocol access");
5099 return qual_begin()[I];
5112 public llvm::FoldingSetNode {
5117 unsigned NumProtocols : 6;
5128 unsigned getNumProtocolsImpl()
const {
5129 return NumProtocols;
5132 void setNumProtocolsImpl(
unsigned N) {
5148 void Profile(llvm::FoldingSetNodeID &
ID);
5149 static void Profile(llvm::FoldingSetNodeID &ID,
5204 mutable llvm::PointerIntPair<const ObjCObjectType *, 1, bool>
5205 CachedSuperClassType;
5208 const QualType *getTypeArgStorage()
const {
5215 unsigned getNumProtocolsImpl()
const {
5216 return ObjCObjectTypeBits.NumProtocols;
5218 void setNumProtocolsImpl(
unsigned N) {
5219 ObjCObjectTypeBits.NumProtocols = N;
5233 ObjCObjectTypeBits.NumProtocols = 0;
5234 ObjCObjectTypeBits.NumTypeArgs = 0;
5235 ObjCObjectTypeBits.IsKindOf = 0;
5238 void computeSuperClassTypeSlow()
const;
5250 return getBaseType()->isSpecificBuiltinType(BuiltinType::ObjCId);
5254 return getBaseType()->isSpecificBuiltinType(BuiltinType::ObjCClass);
5260 if (!qual_empty())
return false;
5261 if (
const BuiltinType *
T = getBaseType()->getAs<BuiltinType>())
5262 return T->getKind() == BuiltinType::ObjCId ||
5263 T->getKind() == BuiltinType::ObjCClass;
5275 bool isSpecialized()
const;
5279 return ObjCObjectTypeBits.NumTypeArgs > 0;
5296 return llvm::makeArrayRef(getTypeArgStorage(),
5297 ObjCObjectTypeBits.NumTypeArgs);
5304 bool isKindOfType()
const;
5313 if (!CachedSuperClassType.getInt())
5314 computeSuperClassTypeSlow();
5316 assert(CachedSuperClassType.getInt() &&
"Superclass not set?");
5317 return QualType(CachedSuperClassType.getPointer(), 0);
5347 :
ObjCObjectType(Canonical, Base, typeArgs, protocols, isKindOf) {}
5350 void Profile(llvm::FoldingSetNodeID &
ID);
5351 static void Profile(llvm::FoldingSetNodeID &
ID,
5358 inline QualType *ObjCObjectType::getTypeArgStorage() {
5364 getTypeArgStorage() + ObjCObjectTypeBits.NumTypeArgs);
5423 return T->getDecl();
5425 baseType = ObjT->getBaseType();
5446 :
Type(ObjCObjectPointer, Canonical,
5447 Pointee->isDependentType(),
5448 Pointee->isInstantiationDependentType(),
5449 Pointee->isVariablyModifiedType(),
5450 Pointee->containsUnexpandedParameterPack()),
5451 PointeeType(Pointee) {}
5594 QualType getSuperClassType()
const;
5602 Profile(ID, getPointeeType());
5620 :
Type(Atomic, Canonical, ValTy->isDependentType(),
5621 ValTy->isInstantiationDependentType(),
5622 ValTy->isVariablyModifiedType(),
5623 ValTy->containsUnexpandedParameterPack()),
5635 Profile(ID, getValueType());
5655 :
Type(Pipe, CanonicalPtr, elemType->isDependentType(),
5656 elemType->isInstantiationDependentType(),
5657 elemType->isVariablyModifiedType(),
5658 elemType->containsUnexpandedParameterPack()),
5659 ElementType(elemType), isRead(isRead) {}
5669 Profile(ID, getElementType(), isReadOnly());
5674 ID.AddBoolean(isRead);
5695 return type.getTypePtrUnsafe();
5697 const ExtQuals *extQuals = type.getExtQualsUnsafe();
5713 Ty->getLocallyUnqualifiedSingleStepDesugaredType().split();
5719 return getCommonPtr()->BaseType;
5723 return (isNull() ?
nullptr : getCommonPtr()->BaseType);
5727 if (!hasLocalNonFastQualifiers())
5731 const ExtQuals *eq = getExtQualsUnsafe();
5739 if (hasLocalNonFastQualifiers())
5740 Quals = getExtQualsUnsafe()->getQualifiers();
5746 Qualifiers quals = getCommonPtr()->CanonicalType.getLocalQualifiers();
5752 unsigned cvr = getCommonPtr()->CanonicalType.getLocalCVRQualifiers();
5753 cvr |= getLocalCVRQualifiers();
5758 QualType canon = getCommonPtr()->CanonicalType;
5767 if (!isCanonical())
return false;
5768 if (hasLocalQualifiers())
return false;
5770 const Type *
T = getTypePtr();
5774 return !isa<FunctionType>(
T) && !isa<ArrayType>(T);
5778 return isLocalConstQualified() ||
5779 getCommonPtr()->CanonicalType.isLocalConstQualified();
5783 return isLocalRestrictQualified() ||
5784 getCommonPtr()->CanonicalType.isLocalRestrictQualified();
5789 return isLocalVolatileQualified() ||
5790 getCommonPtr()->CanonicalType.isLocalVolatileQualified();
5794 return hasLocalQualifiers() ||
5795 getCommonPtr()->CanonicalType.hasLocalQualifiers();
5799 if (!getTypePtr()->getCanonicalTypeInternal().hasLocalQualifiers())
5802 return QualType(getSplitUnqualifiedTypeImpl(*this).Ty, 0);
5806 if (!getTypePtr()->getCanonicalTypeInternal().hasLocalQualifiers())
5809 return getSplitUnqualifiedTypeImpl(*
this);
5827 "Fast bits differ from CVR bits!");
5830 removeLocalFastQualifiers(Mask);
5846 return FT->getExtInfo();
5848 return FT->getExtInfo();
5876 if (getUnqualifiedType()->isVoidType())
5899 return ((getTypePtr()->isVoidType() && !hasQualifiers()) ||
5900 getTypePtr()->isFunctionType());
5907 return isVoidType() ||
5910 (isArithmeticType() && !isEnumeralType());
5920 return isArrayType() ||
5926 isReferenceType() ||
5935 isMemberPointerType();
5939 return isa<FunctionType>(CanonicalType);
5943 return isa<PointerType>(CanonicalType);
5947 return isPointerType() || isObjCObjectPointerType();
5951 return isa<BlockPointerType>(CanonicalType);
5955 return isa<ReferenceType>(CanonicalType);
5959 return isa<LValueReferenceType>(CanonicalType);
5963 return isa<RValueReferenceType>(CanonicalType);
5974 return isa<MemberPointerType>(CanonicalType);
5979 return T->isMemberFunctionPointer();
5986 return T->isMemberDataPointer();
5992 return isa<ArrayType>(CanonicalType);
5996 return isa<ConstantArrayType>(CanonicalType);
6000 return isa<IncompleteArrayType>(CanonicalType);
6004 return isa<VariableArrayType>(CanonicalType);
6008 return isa<DependentSizedArrayType>(CanonicalType);
6012 return isa<BuiltinType>(CanonicalType);
6016 return isa<RecordType>(CanonicalType);
6020 return isa<EnumType>(CanonicalType);
6024 return isa<ComplexType>(CanonicalType);
6028 return isa<VectorType>(CanonicalType);
6032 return isa<ExtVectorType>(CanonicalType);
6036 return isa<DependentAddressSpaceType>(CanonicalType);
6040 return isa<ObjCObjectPointerType>(CanonicalType);
6044 return isa<ObjCObjectType>(CanonicalType);
6048 return isa<ObjCInterfaceType>(CanonicalType) ||
6049 isa<ObjCObjectType>(CanonicalType);
6053 return isa<AtomicType>(CanonicalType);
6058 return OPT->isObjCQualifiedIdType();
6064 return OPT->isObjCQualifiedClassType();
6070 return OPT->isObjCIdType();
6076 return OPT->isObjCClassType();
6081 if (
const PointerType *OPT = getAs<PointerType>())
6082 return OPT->getPointeeType()->isSpecificBuiltinType(BuiltinType::ObjCSel);
6087 return isObjCIdType() || isObjCClassType() || isObjCSelType();
6090 #define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \ 6091 inline bool Type::is##Id##Type() const { \ 6092 return isSpecificBuiltinType(BuiltinType::Id); \ 6094 #include "clang/Basic/OpenCLImageTypes.def" 6097 return isSpecificBuiltinType(BuiltinType::OCLSampler);
6101 return isSpecificBuiltinType(BuiltinType::OCLEvent);
6105 return isSpecificBuiltinType(BuiltinType::OCLClkEvent);
6109 return isSpecificBuiltinType(BuiltinType::OCLQueue);
6113 return isSpecificBuiltinType(BuiltinType::OCLReserveID);
6117 #define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) is##Id##Type() || 6119 #include "clang/Basic/OpenCLImageTypes.def" 6124 return isa<PipeType>(CanonicalType);
6128 return isSamplerT() || isEventT() || isImageType() || isClkEventT() ||
6129 isQueueT() || isReserveIDT() || isPipeType();
6133 return isa<TemplateTypeParmType>(CanonicalType);
6144 if (
const BuiltinType *BT = dyn_cast<BuiltinType>(
this))
6145 return BT->isPlaceholderType();
6150 if (
const BuiltinType *BT = dyn_cast<BuiltinType>(
this))
6151 if (BT->isPlaceholderType())
6158 if (
const BuiltinType *BT = dyn_cast<BuiltinType>(
this))
6164 if (
const BuiltinType *BT = dyn_cast<BuiltinType>(
this))
6165 return BT->isNonOverloadPlaceholderType();
6170 if (
const BuiltinType *BT = dyn_cast<BuiltinType>(CanonicalType))
6171 return BT->getKind() == BuiltinType::Void;
6176 if (
const BuiltinType *BT = dyn_cast<BuiltinType>(CanonicalType))
6177 return BT->getKind() == BuiltinType::Half;
6184 return BT->getKind() == BuiltinType::NullPtr;
6192 if (
const BuiltinType *BT = dyn_cast<BuiltinType>(CanonicalType))
6193 return BT->getKind() >= BuiltinType::Bool &&
6194 BT->getKind() <= BuiltinType::Int128;
6195 if (
const EnumType *ET = dyn_cast<EnumType>(CanonicalType)) {
6205 if (
const BuiltinType *BT = dyn_cast<BuiltinType>(CanonicalType))
6206 return BT->getKind() > BuiltinType::Void &&
6207 BT->getKind() <= BuiltinType::NullPtr;
6208 if (
const EnumType *ET = dyn_cast<EnumType>(CanonicalType))
6212 return isa<PointerType>(CanonicalType) ||
6213 isa<BlockPointerType>(CanonicalType) ||
6214 isa<MemberPointerType>(CanonicalType) ||
6215 isa<ComplexType>(CanonicalType) ||
6216 isa<ObjCObjectPointerType>(CanonicalType);
6220 if (
const BuiltinType *BT = dyn_cast<BuiltinType>(CanonicalType))
6221 return BT->getKind() >= BuiltinType::Bool &&
6222 BT->getKind() <= BuiltinType::Int128;
6226 if (
const EnumType *ET = dyn_cast<EnumType>(CanonicalType))
6233 if (
const BuiltinType *BT = dyn_cast<BuiltinType>(CanonicalType))
6234 return BT->getKind() == BuiltinType::Bool;
6239 auto *DT = getContainedDeducedType();
6240 return DT && !DT->isDeduced();
6246 return isDependentType() ||
isRecordType() || isEnumeralType();
6251 return isFunctionType() || isArrayType();
6255 return (isPointerType() || isReferenceType() || isBlockPointerType() ||
6256 isObjCObjectPointerType() || isNullPtrType());
6260 return isObjCObjectPointerType();
6266 type =
arrayType->getElementType().getTypePtr();
6299 template <
typename T>
6301 std::integral_constant<bool, std::is_same<T, ArrayType>::value ||
6302 std::is_base_of<ArrayType, T>::value>;
6307 "ArrayType cannot be used with getAs!");
6310 if (
const T *Ty = dyn_cast<T>(
this))
6314 if (!isa<T>(CanonicalType))
6319 return cast<T>(getUnqualifiedDesugaredType());
6326 if (
const T *Ty = dyn_cast<T>(
this))
6330 if (!isa<T>(CanonicalType))
6335 const Type *Ty =
this;
6337 if (
const auto *A = dyn_cast<AttributedType>(Ty))
6338 Ty = A->getModifiedType().getTypePtr();
6339 else if (
const auto *E = dyn_cast<ElaboratedType>(Ty))
6340 Ty = E->desugar().getTypePtr();
6341 else if (
const auto *
P = dyn_cast<ParenType>(Ty))
6342 Ty =
P->desugar().getTypePtr();
6343 else if (
const auto *A = dyn_cast<AdjustedType>(Ty))
6344 Ty = A->desugar().getTypePtr();
6351 return dyn_cast<
T>(Ty);
6356 if (
const ArrayType *arr = dyn_cast<ArrayType>(
this))
6360 if (!isa<ArrayType>(CanonicalType))
6365 return cast<ArrayType>(getUnqualifiedDesugaredType());
6370 "ArrayType cannot be used with castAs!");
6372 if (
const T *ty = dyn_cast<T>(
this))
return ty;
6373 assert(isa<T>(CanonicalType));
6374 return cast<T>(getUnqualifiedDesugaredType());
6378 assert(isa<ArrayType>(CanonicalType));
6379 if (
const ArrayType *arr = dyn_cast<ArrayType>(
this))
return arr;
6380 return cast<ArrayType>(getUnqualifiedDesugaredType());
6385 :
AdjustedType(Decayed, OriginalType, DecayedPtr, CanonicalPtr) {
6387 QualType Adjusted = getAdjustedType();
6389 assert(isa<PointerType>(Adjusted));
6394 QualType Decayed = getDecayedType();
6396 return cast<PointerType>(Decayed)->getPointeeType();
6401 #endif // LLVM_CLANG_AST_TYPE_H
bool isDynamicExceptionSpec(ExceptionSpecificationType ESpecType)
Internal representation of canonical, dependent typeof(expr) types.
unsigned char getOpaqueValue() const
ParameterABI getABI() const
Return the ABI treatment of this parameter.
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)
An instance of this class is created to represent 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)
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 isMemberPointerType() const
QualType getInjectedSpecializationType() const
unsigned getNumExceptions() const
static QualType getObjectType(APValue::LValueBase B)
Retrieves the "underlying object type" of the given expression, as used by __builtin_object_size.
void print(raw_ostream &OS, const PrintingPolicy &Policy, const Twine &PlaceHolder=Twine(), unsigned Indentation=0) const
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...
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)
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.
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
TagDecl * getDecl() const
ObjCObjectTypeBitfields ObjCObjectTypeBits
bool isExtVectorType() const
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)
bool hasPassObjectSize() const
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
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)
ExtParameterInfo withIsNoEscape(bool NoEscape) const
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
static Qualifiers fromOpaqueValue(unsigned opaque)
The noexcept specifier has a bad expression.
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)
QualType(const Type *Ptr, unsigned Quals)
Describes how types, statements, expressions, and declarations should be printed. ...
static void * getAsVoidPointer(::clang::Type *P)
ExtParameterInfo withIsConsumed(bool consumed) const
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...
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
The width of the "fast" qualifier mask.
void Profile(llvm::FoldingSetNodeID &ID)
SourceLocation getAttributeLoc() const
RecordDecl - Represents a struct/union/class.
void AddTaggedVal(intptr_t V, DiagnosticsEngine::ArgumentKind Kind) const
DependentTypeOfExprType(const ASTContext &Context, Expr *E)
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.
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 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.
NoexceptResult
Result type of getNoexceptSpec().
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)
Interesting information about a specific parameter that can't simply be reflected in parameter's type...
static bool classof(const Type *T)
Represents the result of substituting a set of types for a template type parameter pack...
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)
static int getPointAccessorIdx(char c)
bool isObjCSelType() 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)
unsigned getTypeQuals() const
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.
void setRestrict(bool flag)
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
bool hasAddressSpace() const
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified...
const ArrayType * getAsArrayTypeUnsafe() const
A variant of getAs<> for array types which silently discards qualifiers from the outermost type...
The "struct" keyword introduces the elaborated-type-specifier.
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
const Type * getClass() const
bool isRValueReferenceType() const
void Profile(llvm::FoldingSetNodeID &ID)
Defines the Diagnostic-related interfaces.
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.
void getAsStringInternal(std::string &Str, const PrintingPolicy &Policy) const
static bool classof(const Type *T)
const TemplateArgument * getArgs() const
Retrieve the template arguments.
param_type_iterator param_type_begin() const
TemplateTypeParmDecl * TTPDecl
bool isNothrow(const ASTContext &Ctx, bool ResultIfDependent=false) const
Determine whether this function type has a non-throwing exception specification.
void addQualifiers(Qualifiers Q)
Add the qualifiers from the given set to this set.
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)
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.
FunctionDecl * SourceDecl
The function whose exception specification this is, for EST_Unevaluated and EST_Uninstantiated.
SplitQualType getSplitDesugaredType() const
void setFastQualifiers(unsigned mask)
Expr * getSizeExpr() const
bool getNoCallerSavedRegs() const
QualType getPointeeTypeAsWritten() const
unsigned getNumProtocols() const
Return the number of qualifying protocols in this type, or 0 if there are none.
QualType getElementType() const
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.
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
Represents a K&R-style 'int foo()' function, which has no information available about its arguments...
unsigned getTypeQuals() const
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 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.
bool hasQualifiers() const
Determine whether this type has any qualifiers.
void addObjCLifetime(ObjCLifetime type)
ObjCTypeParamDecl * getDecl() const
ObjCProtocolDecl ** getProtocolStorage()
void Profile(llvm::FoldingSetNodeID &ID)
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
unsigned getNumArgs() const
Retrieve the number of template arguments.
bool isObjCGCStrong() const
true when Type is objc's strong.
Expr - 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.
const FunctionProtoType * T
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
ExtProtoInfo withExceptionSpec(const ExceptionSpecInfo &O)
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.
There is no noexcept specifier.
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...
static Optional< NullabilityKind > stripOuterNullability(QualType &T)
Strip off the top-level nullability annotation on the given type, if it's there.
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)
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.
static ExtParameterInfo getFromOpaqueValue(unsigned char data)
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
unsigned getCVRQualifiers() const
Retrieve the set of CVR (const-volatile-restrict) qualifiers applied to this type.
ExtInfo withNoReturn(bool noReturn) const
bool isConstQualified() const
Determine whether this type is const-qualified.
bool hasTrailingReturn() const
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.
The l-value was considered opaque, so the alignment was determined from a type.
RecordDecl * getDecl() const
static void Profile(llvm::FoldingSetNodeID &ID, QualType Pointee)
llvm::iterator_range< qual_iterator > qual_range
static void Profile(llvm::FoldingSetNodeID &ID, ElaboratedTypeKeyword Keyword, NestedNameSpecifier *NNS, QualType NamedType)
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)
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
void setVolatile(bool flag)
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)
TagDecl - 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)
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 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 isConsumed() const
Is this parameter considered "consumed" by Objective-C ARC? Consumed parameters must have retainable ...
bool isParameterPack() const
const TemplateTypeParmType * getReplacedParameter() const
Gets the template parameter that was substituted for.
QualType getEquivalentType() const
Expr * getNoexceptExpr() const
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.
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.
friend bool operator!=(ExtParameterInfo lhs, ExtParameterInfo rhs)
bool isTargetAddressSpace(LangAS AS)
static bool isVectorSizeTooLarge(unsigned NumElements)
EnumDecl * getDecl() const
const char * getNameAsCString(const PrintingPolicy &Policy) const
bool isVectorType() const
An rvalue ref-qualifier was provided (&&).
SourceRange getBracketsRange() const
void addFastQualifiers(unsigned TQs)
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 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.
StreamedQualTypeHelper stream(const PrintingPolicy &Policy, const Twine &PlaceHolder=Twine(), unsigned Indentation=0) const
Dataflow Directional Tag Classes.
SourceLocation getRBracketLoc() 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)
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
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
EnumDecl - Represents an enum.
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)
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
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.
The noexcept specifier evaluates to false.
Base for LValueReferenceType and RValueReferenceType.
SourceRange getBracketsRange() const
friend bool operator==(ExtParameterInfo lhs, ExtParameterInfo rhs)
ExceptionSpecificationType
The various types of exception specifications that exist in C++11.
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.
ExtParameterInfo withHasPassObjectSize() const
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
TypedefNameDecl * getDecl() const
Reading or writing from this object requires a barrier call.
Expr * NoexceptExpr
Noexcept expression, if this is EST_ComputedNoexcept.
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
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.
ExtInfo(bool noReturn, bool hasRegParm, unsigned regParm, CallingConv cc, bool producesResult, bool noCallerSavedRegs)
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...
ExtParameterInfo withABI(ParameterABI kind) const
BuiltinTypeBitfields BuiltinTypeBits
static int getNumericAccessorIdx(char c)
A trivial tuple used to represent a source range.
NamedDecl - This represents a decl with a name.
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)
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)
The noexcept specifier is dependent.
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)
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.