17 #ifndef LLVM_CLANG_AST_TYPE_H
18 #define LLVM_CLANG_AST_TYPE_H
30 #include "llvm/ADT/APInt.h"
31 #include "llvm/ADT/FoldingSet.h"
32 #include "llvm/ADT/Optional.h"
33 #include "llvm/ADT/PointerIntPair.h"
34 #include "llvm/ADT/PointerUnion.h"
35 #include "llvm/ADT/Twine.h"
36 #include "llvm/ADT/iterator_range.h"
37 #include "llvm/Support/ErrorHandling.h"
51 class PointerLikeTypeTraits;
72 struct isPodLike<clang::QualType> {
static const bool value =
true; };
77 class TypedefNameDecl;
79 class TemplateTypeParmDecl;
80 class NonTypeTemplateParmDecl;
81 class TemplateTemplateParmDecl;
88 class ObjCInterfaceDecl;
89 class ObjCProtocolDecl;
91 class UnresolvedUsingTypenameDecl;
95 class StmtIteratorBase;
96 class TemplateArgument;
97 class TemplateArgumentLoc;
98 class TemplateArgumentListInfo;
101 class ExtQualsTypeCommonBase;
102 struct PrintingPolicy;
104 template <
typename>
class CanQual;
108 #define TYPE(Class, Base) class Class##Type;
109 #include "clang/AST/TypeNodes.def"
174 Q.Mask = L.Mask & R.Mask;
260 assert(!(mask & ~
CVRMask) &&
"bitmask contains non-CVR bits");
261 Mask = (Mask & ~
CVRMask) | mask;
264 assert(!(mask & ~
CVRMask) &&
"bitmask contains non-CVR bits");
271 assert(!(mask & ~
CVRMask) &&
"bitmask contains non-CVR bits");
275 assert(!(mask & ~
CVRMask & ~UMask) &&
"bitmask contains non-CVRU bits");
281 Mask = (Mask & ~UMask) | (flag ? UMask : 0);
289 Mask = (Mask & ~GCAttrMask) | (type << GCAttrShift);
309 return ObjCLifetime((Mask & LifetimeMask) >> LifetimeShift);
312 Mask = (Mask & ~LifetimeMask) | (type << LifetimeShift);
318 Mask |= (type << LifetimeShift);
337 Mask = (Mask & ~AddressSpaceMask)
338 | (((uint32_t) space) << AddressSpaceShift);
351 assert(!(mask & ~
FastMask) &&
"bitmask contains non-fast qualifier bits");
355 assert(!(mask & ~
FastMask) &&
"bitmask contains non-fast qualifier bits");
362 assert(!(mask & ~
FastMask) &&
"bitmask contains non-fast qualifier bits");
377 bool empty()
const {
return !Mask; }
516 bool appendSpaceIfNonEmpty =
false)
const;
528 static const uint32_t UMask = 0x8;
529 static const uint32_t UShift = 3;
530 static const uint32_t GCAttrMask = 0x30;
531 static const uint32_t GCAttrShift = 4;
532 static const uint32_t LifetimeMask = 0x1C0;
533 static const uint32_t LifetimeShift = 6;
534 static const uint32_t AddressSpaceMask =
535 ~(
CVRMask | UMask | GCAttrMask | LifetimeMask);
536 static const uint32_t AddressSpaceShift = 9;
554 std::pair<const Type *,Qualifiers>
asPair()
const {
555 return std::pair<const Type *, Qualifiers>(Ty, Quals);
600 llvm::PointerIntPair<llvm::PointerUnion<const Type*,const ExtQuals*>,
603 const ExtQuals *getExtQualsUnsafe()
const {
607 const Type *getTypePtrUnsafe()
const {
608 return Value.getPointer().get<
const Type*>();
612 assert(!isNull() &&
"Cannot retrieve a NULL type pointer");
624 :
Value(Ptr, Quals) {}
626 :
Value(Ptr, Quals) {}
635 const Type *getTypePtr()
const;
637 const Type *getTypePtrOrNull()
const;
649 T.Value.setFromOpaqueValue(const_cast<void*>(Ptr));
654 return *getTypePtr();
661 bool isCanonical()
const;
662 bool isCanonicalAsParam()
const;
666 return Value.getPointer().isNull();
677 bool isConstQualified()
const;
687 bool isRestrictQualified()
const;
697 bool isVolatileQualified()
const;
703 return getLocalFastQualifiers() || hasLocalNonFastQualifiers();
728 return getLocalFastQualifiers();
785 return withFastQualifiers(CVR);
790 &&
"non-fast qualifier bits set in mask!");
794 void removeLocalConst();
795 void removeLocalVolatile();
796 void removeLocalRestrict();
797 void removeLocalCVRQualifiers(
unsigned Mask);
851 inline QualType getUnqualifiedType()
const;
866 bool isMoreQualifiedThan(
QualType Other)
const;
870 bool isAtLeastAsQualifiedAs(
QualType Other)
const;
872 QualType getNonReferenceType()
const;
893 return getDesugaredType(*
this, Context);
897 return getSplitDesugaredType(*
this);
906 return getSingleStepDesugaredTypeImpl(*
this, Context);
912 if (isa<ParenType>(*
this))
919 return LHS.Value == RHS.Value;
922 return LHS.Value != RHS.Value;
935 const Twine &PlaceHolder = Twine(),
936 unsigned Indentation = 0)
const {
937 print(split(), OS, Policy, PlaceHolder, Indentation);
941 unsigned Indentation = 0) {
942 return print(split.
Ty, split.
Quals, OS, policy, PlaceHolder, Indentation);
946 const Twine &PlaceHolder,
947 unsigned Indentation = 0);
951 return getAsStringInternal(split(), Str, Policy);
955 return getAsStringInternal(split.
Ty, split.
Quals, out, policy);
964 const Twine &PlaceHolder;
965 unsigned Indentation;
968 const Twine &PlaceHolder,
unsigned Indentation)
969 : T(T), Policy(Policy), PlaceHolder(PlaceHolder),
970 Indentation(Indentation) { }
974 SQT.T.
print(OS, SQT.Policy, SQT.PlaceHolder, SQT.Indentation);
980 const Twine &PlaceHolder = Twine(),
981 unsigned Indentation = 0)
const {
985 void dump(
const char *s)
const;
989 ID.AddPointer(getAsOpaquePtr());
1010 return getQualifiers().getObjCLifetime();
1014 return getQualifiers().hasNonTrivialObjCLifetime();
1018 return getQualifiers().hasStrongOrWeakObjCLifetime();
1025 DK_objc_weak_lifetime
1033 return isDestructedTypeImpl(*
this);
1046 bool isCForbiddenLValueType()
const;
1094 QualType getAtomicUnqualifiedType()
const;
1107 static DestructionKind isDestructedTypeImpl(
QualType type);
1133 enum { NumLowBitsAvailable = 0 };
1146 : BaseType(baseType), CanonicalType(canon) {}
1153 const Type *
const BaseType;
1196 canon.isNull() ?
QualType(this_(), 0) : canon),
1200 &&
"ExtQuals created with no fast qualifiers");
1202 &&
"ExtQuals created with fast qualifiers");
1225 const Type *BaseType,
1228 ID.AddPointer(BaseType);
1284 #define TYPE(Class, Base) Class,
1285 #define LAST_TYPE(Class) TypeLast = Class,
1286 #define ABSTRACT_TYPE(Class, Base)
1287 #include "clang/AST/TypeNodes.def"
1293 void operator=(
const Type &) =
delete;
1296 class TypeBitfields {
1304 unsigned Dependent : 1;
1308 unsigned InstantiationDependent : 1;
1311 unsigned VariablyModified : 1;
1315 unsigned ContainsUnexpandedParameterPack : 1;
1319 mutable unsigned CacheValid : 1;
1322 mutable unsigned CachedLinkage : 3;
1325 mutable unsigned CachedLocalOrUnnamed : 1;
1328 mutable unsigned FromAST : 1;
1330 bool isCacheValid()
const {
1334 assert(isCacheValid() &&
"getting linkage from invalid cache");
1335 return static_cast<Linkage>(CachedLinkage);
1337 bool hasLocalOrUnnamedType()
const {
1338 assert(isCacheValid() &&
"getting linkage from invalid cache");
1339 return CachedLocalOrUnnamed;
1342 enum { NumTypeBits = 18 };
1351 unsigned : NumTypeBits;
1355 unsigned IndexTypeQuals : 3;
1360 unsigned SizeModifier : 3;
1366 unsigned : NumTypeBits;
1376 unsigned : NumTypeBits;
1388 unsigned TypeQuals : 4;
1393 unsigned RefQualifier : 2;
1399 unsigned : NumTypeBits;
1402 unsigned NumTypeArgs : 7;
1405 unsigned NumProtocols : 6;
1408 unsigned IsKindOf : 1;
1410 static_assert(NumTypeBits + 7 + 6 + 1 <= 32,
"Does not fit in an unsigned");
1415 unsigned : NumTypeBits;
1428 unsigned SpelledAsLValue : 1;
1432 unsigned InnerRef : 1;
1438 unsigned : NumTypeBits;
1441 unsigned Keyword : 8;
1447 unsigned : NumTypeBits;
1451 unsigned VecKind : 3;
1454 unsigned NumElements : 29 - NumTypeBits;
1456 enum { MaxNumElements = (1 << (29 - NumTypeBits)) - 1 };
1462 unsigned : NumTypeBits;
1465 unsigned AttrKind : 32 - NumTypeBits;
1471 unsigned : NumTypeBits;
1475 unsigned Keyword : 2;
1493 void setFromAST(
bool V =
true)
const {
1503 bool InstantiationDependent,
bool VariablyModified,
1504 bool ContainsUnexpandedParameterPack)
1509 TypeBits.InstantiationDependent = Dependent || InstantiationDependent;
1510 TypeBits.VariablyModified = VariablyModified;
1511 TypeBits.ContainsUnexpandedParameterPack = ContainsUnexpandedParameterPack;
1513 TypeBits.CachedLocalOrUnnamed =
false;
1522 TypeBits.InstantiationDependent =
true;
1525 TypeBits.InstantiationDependent = D; }
1529 TypeBits.ContainsUnexpandedParameterPack = PP;
1554 return TypeBits.ContainsUnexpandedParameterPack;
1560 return CanonicalType ==
QualType(
this, 0);
1734 #define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \
1735 bool is##Id##Type() const;
1736 #include "clang/Basic/OpenCLImageTypes.def"
1781 return TypeBits.InstantiationDependent;
1873 template <
typename T>
const T *
getAs()
const;
1885 template <
typename T>
const T *
castAs()
const;
2002 return CanonicalType;
2026 #define TYPE(Class, Base)
2027 #define LEAF_TYPE(Class) \
2028 template <> inline const Class##Type *Type::getAs() const { \
2029 return dyn_cast<Class##Type>(CanonicalType); \
2031 template <> inline const Class##Type *Type::castAs() const { \
2032 return cast<Class##Type>(CanonicalType); \
2034 #include "clang/AST/TypeNodes.def"
2043 #define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) Id,
2044 #include "clang/Basic/OpenCLImageTypes.def"
2046 #define BUILTIN_TYPE(Id, SingletonId) Id,
2047 #define LAST_BUILTIN_TYPE(Id) LastKind = Id
2048 #include "clang/AST/BuiltinTypes.def"
2064 StringRef str =
getName(Policy);
2065 assert(!str.empty() && str.data()[str.size()] ==
'\0');
2090 return K >= Overload;
2126 ElementType(Element) {
2187 PointeeType(Pointee) {
2238 OriginalTy(OriginalTy), AdjustedTy(AdjustedTy) {}
2250 Profile(ID, OriginalTy, AdjustedTy);
2266 :
AdjustedType(Decayed, OriginalType, DecayedPtr, CanonicalPtr) {
2293 PointeeType(Pointee) {
2324 bool SpelledAsLValue) :
2329 PointeeType(Referencee)
2345 return T->PointeeType;
2353 bool SpelledAsLValue) {
2355 ID.AddBoolean(SpelledAsLValue);
2368 bool SpelledAsLValue) :
2369 ReferenceType(LValueReference, Referencee, CanonicalRef, SpelledAsLValue)
2385 ReferenceType(RValueReference, Referencee, CanonicalRef,
false) {
2408 Type(MemberPointer, CanonicalPtr,
2415 PointeeType(Pointee), Class(Cls) {
2444 const Type *Class) {
2446 ID.AddPointer(Class);
2477 bool ContainsUnexpandedParameterPack)
2481 ContainsUnexpandedParameterPack),
2517 :
ArrayType(ConstantArray, et, can, sm, tq,
2527 const llvm::APInt &
getSize()
const {
return Size; }
2536 const llvm::APInt &NumElements);
2548 unsigned TypeQuals) {
2550 ID.AddInteger(ArraySize.getZExtValue());
2551 ID.AddInteger(SizeMod);
2552 ID.AddInteger(TypeQuals);
2566 :
ArrayType(IncompleteArray, et, can, sm, tq,
2587 ID.AddInteger(SizeMod);
2588 ID.AddInteger(TypeQuals);
2617 :
ArrayType(VariableArray, et, can, sm, tq,
2619 SizeExpr((
Stmt*) e), Brackets(brackets) {}
2626 return (
Expr*) SizeExpr;
2642 llvm_unreachable(
"Cannot unique VariableArrayTypes.");
2682 return (
Expr*) SizeExpr;
2705 unsigned TypeQuals,
Expr *
E);
2783 return NumElements > VectorTypeBitfields::MaxNumElements;
2801 ID.AddInteger(NumElements);
2802 ID.AddInteger(TypeClass);
2803 ID.AddInteger(VecKind);
2844 case 'a':
return 10;
2846 case 'b':
return 11;
2848 case 'c':
return 12;
2850 case 'd':
return 13;
2852 case 'e':
return 14;
2854 case 'f':
return 15;
2913 enum { CallConvMask = 0xF };
2914 enum { NoReturnMask = 0x10 };
2915 enum { ProducesResultMask = 0x20 };
2916 enum { RegParmMask = ~(CallConvMask | NoReturnMask | ProducesResultMask),
2917 RegParmOffset = 6 };
2921 ExtInfo(
unsigned Bits) : Bits(static_cast<uint16_t>(Bits)) {}
2929 bool producesResult) {
2930 assert((!hasRegParm || regParm < 7) &&
"Invalid regparm value");
2932 (noReturn ? NoReturnMask : 0) |
2933 (producesResult ? ProducesResultMask : 0) |
2934 (hasRegParm ? ((regParm + 1) << RegParmOffset) : 0);
2949 unsigned RegParm = Bits >> RegParmOffset;
2957 return Bits == Other.Bits;
2960 return Bits != Other.Bits;
2968 return ExtInfo(Bits | NoReturnMask);
2970 return ExtInfo(Bits & ~NoReturnMask);
2975 return ExtInfo(Bits | ProducesResultMask);
2977 return ExtInfo(Bits & ~ProducesResultMask);
2981 assert(RegParm < 7 &&
"Invalid regparm value");
2982 return ExtInfo((Bits & ~RegParmMask) |
2983 ((RegParm + 1) << RegParmOffset));
2987 return ExtInfo((Bits & ~CallConvMask) | (
unsigned) cc);
2991 ID.AddInteger(Bits);
2997 QualType Canonical,
bool Dependent,
2998 bool InstantiationDependent,
2999 bool VariablyModified,
bool ContainsUnexpandedParameterPack,
3001 :
Type(tc, Canonical, Dependent, InstantiationDependent, VariablyModified,
3002 ContainsUnexpandedParameterPack),
3109 copy.Data = (copy.Data & ~ABIMask) |
unsigned(kind);
3116 return (Data & IsConsumed);
3121 copy.Data |= IsConsumed;
3123 copy.Data &= ~IsConsumed;
3136 return lhs.Data == rhs.Data;
3139 return lhs.Data != rhs.Data;
3146 SourceDecl(nullptr), SourceTemplate(nullptr) {}
3149 :
Type(EST), NoexceptExpr(nullptr), SourceDecl(nullptr),
3150 SourceTemplate(nullptr) {}
3169 : Variadic(
false), HasTrailingReturn(
false), TypeQuals(0),
3170 RefQualifier(
RQ_None), ExtParameterInfos(nullptr) {}
3174 RefQualifier(
RQ_None), ExtParameterInfos(nullptr) {}
3184 bool HasTrailingReturn : 1;
3194 static bool containsAnyUnexpandedParameterPack(
const QualType *ArgArray,
3196 for (
unsigned Idx = 0; Idx < numArgs; ++Idx)
3204 QualType canonical,
const ExtProtoInfo &epi);
3207 unsigned NumParams : 15;
3210 unsigned NumExceptions : 9;
3213 unsigned ExceptionSpecType : 4;
3216 unsigned HasExtParameterInfos : 1;
3219 unsigned Variadic : 1;
3222 unsigned HasTrailingReturn : 1;
3246 assert(hasExtParameterInfos());
3249 const char *ptr =
reinterpret_cast<const char *
>(exception_begin());
3250 ptr += getExceptionSpecSize();
3255 size_t getExceptionSpecSize()
const {
3256 switch (getExceptionSpecType()) {
3267 llvm_unreachable(
"bad exception specification kind");
3273 assert(i < NumParams &&
"invalid parameter index");
3274 return param_type_begin()[i];
3277 return llvm::makeArrayRef(param_type_begin(), param_type_end());
3298 if (hasExtParameterInfos())
3309 return getExceptionSpecType() !=
EST_None;
3320 bool hasDependentExceptionSpec()
const;
3330 NoexceptResult getNoexceptSpec(
const ASTContext &Ctx)
const;
3333 assert(i < NumExceptions &&
"Invalid exception number!");
3334 return exception_begin()[i];
3340 return *
reinterpret_cast<Expr *
const *
>(param_type_end());
3350 return reinterpret_cast<FunctionDecl *
const *
>(param_type_end())[0];
3359 return reinterpret_cast<FunctionDecl *
const *
>(param_type_end())[1];
3364 bool isNothrow(
const ASTContext &Ctx,
bool ResultIfDependent =
false)
const;
3374 bool isTemplateVariadic()
const;
3393 return reinterpret_cast<const QualType *
>(
this+1);
3396 return param_type_begin() + NumParams;
3402 return llvm::makeArrayRef(exception_begin(), exception_end());
3406 return param_type_end();
3410 return exception_begin();
3411 return exception_begin() + NumExceptions;
3418 assert(hasExtParameterInfos());
3426 if (!hasExtParameterInfos())
3428 return getExtParameterInfosBuffer();
3432 assert(I < getNumParams() &&
"parameter index out of range");
3433 if (hasExtParameterInfos())
3434 return getExtParameterInfosBuffer()[
I];
3439 assert(I < getNumParams() &&
"parameter index out of range");
3440 if (hasExtParameterInfos())
3441 return getExtParameterInfosBuffer()[
I].getABI();
3446 assert(I < getNumParams() &&
"parameter index out of range");
3447 if (hasExtParameterInfos())
3448 return getExtParameterInfosBuffer()[
I].isConsumed();
3455 void printExceptionSpecification(raw_ostream &OS,
3464 param_type_iterator ArgTys,
unsigned NumArgs,
3479 Decl(const_cast<UnresolvedUsingTypenameDecl*>(D)) {}
3511 assert(!isa<TypedefType>(can) &&
"Invalid canonical type");
3574 assert(!isa<TypedefType>(can) &&
"Invalid canonical type");
3623 Profile(ID, Context, getUnderlyingExpr());
3669 public llvm::FoldingSetNode {
3674 Profile(ID, getBaseType(), getUTTKind());
3680 ID.AddInteger((
unsigned)UKind);
3698 bool isBeingDefined()
const;
3773 FirstExprOperandKind = attr_address_space,
3774 LastExprOperandKind = attr_neon_polyvector_type,
3782 FirstEnumOperandKind = attr_objc_gc,
3783 LastEnumOperandKind = attr_pcs_vfp,
3822 ModifiedType(modified), EquivalentType(equivalent) {
3852 bool isQualifier()
const;
3854 bool isMSTypeSpec()
const;
3856 bool isCallingConv()
const;
3865 return attr_nonnull;
3868 return attr_nullable;
3871 return attr_null_unspecified;
3873 llvm_unreachable(
"Unknown nullability kind.");
3888 Profile(ID, getAttrKind(), ModifiedType, EquivalentType);
3893 ID.AddInteger(attrKind);
3905 struct CanonicalTTPTInfo {
3906 unsigned Depth : 15;
3907 unsigned ParameterPack : 1;
3908 unsigned Index : 16;
3920 :
Type(TemplateTypeParm, Canon,
true,
3924 TTPDecl(TTPDecl) { }
3927 TemplateTypeParmType(
unsigned D,
unsigned I,
bool PP)
3928 : Type(TemplateTypeParm,
QualType(this, 0),
3932 CanTTPTInfo.Depth = D;
3933 CanTTPTInfo.Index =
I;
3934 CanTTPTInfo.ParameterPack = PP;
3939 const CanonicalTTPTInfo& getCanTTPTInfo()
const {
3945 unsigned getDepth()
const {
return getCanTTPTInfo().Depth; }
3946 unsigned getIndex()
const {
return getCanTTPTInfo().Index; }
3959 Profile(ID, getDepth(), getIndex(), isParameterPack(), getDecl());
3963 unsigned Index,
bool ParameterPack,
3965 ID.AddInteger(Depth);
3966 ID.AddInteger(Index);
3967 ID.AddBoolean(ParameterPack);
3968 ID.AddPointer(TTPDecl);
4012 Profile(ID, getReplacedParameter(), getReplacementType());
4017 ID.AddPointer(Replaced);
4047 unsigned NumArguments;
4068 void Profile(llvm::FoldingSetNodeID &
ID);
4069 static void Profile(llvm::FoldingSetNodeID &
ID,
4087 IsDependent, IsDependent,
4091 assert((DeducedType.
isNull() || !IsDependent) &&
4092 "auto deduced to dependent type");
4125 ID.AddInteger((
unsigned)Keyword);
4126 ID.AddBoolean(IsDependent);
4156 public llvm::FoldingSetNode {
4183 bool &InstantiationDependent);
4186 bool &InstantiationDependent);
4193 bool SkipBrackets =
false);
4229 assert(
isTypeAlias() &&
"not a type alias template specialization");
4251 const TemplateArgument &
getArg(
unsigned Idx)
const;
4268 static void Profile(llvm::FoldingSetNodeID &
ID, TemplateName T,
4269 ArrayRef<TemplateArgument> Args,
4319 Decl(D), InjectedType(TST) {
4320 assert(isa<TemplateSpecializationType>(TST));
4328 return cast<TemplateSpecializationType>(InjectedType.getTypePtr());
4382 QualType Canonical,
bool Dependent,
4383 bool InstantiationDependent,
bool VariablyModified,
4384 bool ContainsUnexpandedParameterPack)
4385 :
Type(tc, Canonical, Dependent, InstantiationDependent, VariablyModified,
4386 ContainsUnexpandedParameterPack) {
4400 static TagTypeKind getTagTypeKindForTypeSpec(
unsigned TypeSpec);
4415 return getKeywordName(getKeywordForTagTypeKind(Kind));
4445 NNS(NNS), NamedType(NamedType) {
4446 assert(!(Keyword ==
ETK_None && NNS ==
nullptr) &&
4447 "ElaboratedType cannot have elaborated type keyword "
4448 "and name qualifier both null.");
4469 Profile(ID, getKeyword(), NNS, NamedType);
4474 ID.AddInteger(Keyword);
4510 NNS(NNS),
Name(Name) {}
4531 Profile(ID, getKeyword(), NNS, Name);
4536 ID.AddInteger(Keyword);
4538 ID.AddPointer(Name);
4551 public llvm::FoldingSetNode {
4567 return reinterpret_cast<TemplateArgument*
>(
this+1);
4571 NestedNameSpecifier *NNS,
4572 const IdentifierInfo *
Name,
4573 ArrayRef<TemplateArgument> Args,
4583 const TemplateArgument *
getArgs()
const {
4590 const TemplateArgument &
getArg(
unsigned Idx)
const;
4596 typedef const TemplateArgument *
iterator;
4600 bool isSugared()
const {
return false; }
4607 static void Profile(llvm::FoldingSetNodeID &ID,
4610 NestedNameSpecifier *Qualifier,
4611 const IdentifierInfo *
Name,
4612 ArrayRef<TemplateArgument> Args);
4614 static bool classof(
const Type *T) {
4615 return T->getTypeClass() == DependentTemplateSpecialization;
4651 unsigned NumExpansions;
4660 NumExpansions(NumExpansions? *NumExpansions + 1: 0) { }
4674 return NumExpansions - 1;
4683 Profile(ID, getPattern(), getNumExpansions());
4689 ID.AddBoolean(NumExpansions.hasValue());
4691 ID.AddInteger(*NumExpansions);
4744 mutable llvm::PointerIntPair<const ObjCObjectType *, 1, bool>
4745 CachedSuperClassType;
4752 const QualType *getTypeArgStorage()
const {
4773 void computeSuperClassTypeSlow()
const;
4785 return getBaseType()->isSpecificBuiltinType(BuiltinType::ObjCId);
4788 return getBaseType()->isSpecificBuiltinType(BuiltinType::ObjCClass);
4793 if (!qual_empty())
return false;
4794 if (
const BuiltinType *T = getBaseType()->getAs<BuiltinType>())
4795 return T->getKind() == BuiltinType::ObjCId ||
4796 T->getKind() == BuiltinType::ObjCClass;
4808 bool isSpecialized()
const;
4829 return llvm::makeArrayRef(getTypeArgStorage(),
4848 assert(I < getNumProtocols() &&
"Out-of-range protocol access");
4849 return qual_begin()[
I];
4861 bool isKindOfType()
const;
4870 if (!CachedSuperClassType.getInt())
4871 computeSuperClassTypeSlow();
4873 assert(CachedSuperClassType.getInt() &&
"Superclass not set?");
4874 return QualType(CachedSuperClassType.getPointer(), 0);
4904 :
ObjCObjectType(Canonical, Base, typeArgs, protocols, isKindOf) {}
4907 void Profile(llvm::FoldingSetNodeID &ID);
4908 static void Profile(llvm::FoldingSetNodeID &ID,
4915 inline QualType *ObjCObjectType::getTypeArgStorage() {
4916 return reinterpret_cast<QualType *
>(
static_cast<ObjCObjectTypeImpl*
>(
this)+1);
4919 inline ObjCProtocolDecl **ObjCObjectType::getProtocolStorage() {
4920 return reinterpret_cast<ObjCProtocolDecl**
>(
4941 Decl(const_cast<ObjCInterfaceDecl*>(D)) {}
4974 return T->getDecl();
4976 baseType = ObjT->getBaseType();
4995 :
Type(ObjCObjectPointer, Canonical,
5000 PointeeType(Pointee) {}
5141 QualType getSuperClassType()
const;
5198 ElementType(elemType) {}
5210 Profile(ID, getElementType());
5235 return type.getTypePtrUnsafe();
5237 const ExtQuals *extQuals = type.getExtQualsUnsafe();
5260 return getCommonPtr()->BaseType;
5264 return (isNull() ?
nullptr : getCommonPtr()->BaseType);
5268 if (!hasLocalNonFastQualifiers())
5272 const ExtQuals *eq = getExtQualsUnsafe();
5280 if (hasLocalNonFastQualifiers())
5281 Quals = getExtQualsUnsafe()->getQualifiers();
5287 Qualifiers quals = getCommonPtr()->CanonicalType.getLocalQualifiers();
5293 unsigned cvr = getCommonPtr()->CanonicalType.getLocalCVRQualifiers();
5294 cvr |= getLocalCVRQualifiers();
5299 QualType canon = getCommonPtr()->CanonicalType;
5304 return getTypePtr()->isCanonicalUnqualified();
5308 if (!isCanonical())
return false;
5309 if (hasLocalQualifiers())
return false;
5311 const Type *T = getTypePtr();
5315 return !isa<FunctionType>(T) && !isa<ArrayType>(T);
5319 return isLocalConstQualified() ||
5320 getCommonPtr()->CanonicalType.isLocalConstQualified();
5324 return isLocalRestrictQualified() ||
5325 getCommonPtr()->CanonicalType.isLocalRestrictQualified();
5330 return isLocalVolatileQualified() ||
5331 getCommonPtr()->CanonicalType.isLocalVolatileQualified();
5335 return hasLocalQualifiers() ||
5336 getCommonPtr()->CanonicalType.hasLocalQualifiers();
5343 return QualType(getSplitUnqualifiedTypeImpl(*this).Ty, 0);
5350 return getSplitUnqualifiedTypeImpl(*
this);
5368 "Fast bits differ from CVR bits!");
5371 removeLocalFastQualifiers(Mask);
5376 return getQualifiers().getAddressSpace();
5381 return getQualifiers().getObjCGCAttr();
5387 return FT->getExtInfo();
5389 return FT->getExtInfo();
5420 return getQualifiers().compatiblyIncludes(OtherQuals);
5440 return ((getTypePtr()->
isVoidType() && !hasQualifiers()) ||
5480 return isa<FunctionType>(CanonicalType);
5483 return isa<PointerType>(CanonicalType);
5489 return isa<BlockPointerType>(CanonicalType);
5492 return isa<ReferenceType>(CanonicalType);
5495 return isa<LValueReferenceType>(CanonicalType);
5498 return isa<RValueReferenceType>(CanonicalType);
5502 return T->getPointeeType()->isFunctionType();
5507 return isa<MemberPointerType>(CanonicalType);
5511 return T->isMemberFunctionPointer();
5517 return T->isMemberDataPointer();
5522 return isa<ArrayType>(CanonicalType);
5525 return isa<ConstantArrayType>(CanonicalType);
5528 return isa<IncompleteArrayType>(CanonicalType);
5531 return isa<VariableArrayType>(CanonicalType);
5534 return isa<DependentSizedArrayType>(CanonicalType);
5537 return isa<BuiltinType>(CanonicalType);
5540 return isa<RecordType>(CanonicalType);
5543 return isa<EnumType>(CanonicalType);
5546 return isa<ComplexType>(CanonicalType);
5549 return isa<VectorType>(CanonicalType);
5552 return isa<ExtVectorType>(CanonicalType);
5555 return isa<ObjCObjectPointerType>(CanonicalType);
5558 return isa<ObjCObjectType>(CanonicalType);
5561 return isa<ObjCInterfaceType>(CanonicalType) ||
5562 isa<ObjCObjectType>(CanonicalType);
5565 return isa<AtomicType>(CanonicalType);
5570 return OPT->isObjCQualifiedIdType();
5575 return OPT->isObjCQualifiedClassType();
5580 return OPT->isObjCIdType();
5585 return OPT->isObjCClassType();
5589 if (
const PointerType *OPT = getAs<PointerType>())
5590 return OPT->getPointeeType()->isSpecificBuiltinType(BuiltinType::ObjCSel);
5597 #define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \
5598 inline bool Type::is##Id##Type() const { \
5599 return isSpecificBuiltinType(BuiltinType::Id); \
5601 #include "clang/Basic/OpenCLImageTypes.def"
5628 #define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) is##Id##Type() ||
5630 #include "clang/Basic/OpenCLImageTypes.def"
5635 return isa<PipeType>(CanonicalType);
5644 return isa<TemplateTypeParmType>(CanonicalType);
5655 if (
const BuiltinType *BT = dyn_cast<BuiltinType>(
this))
5656 return BT->isPlaceholderType();
5661 if (
const BuiltinType *BT = dyn_cast<BuiltinType>(
this))
5662 if (BT->isPlaceholderType())
5669 if (
const BuiltinType *BT = dyn_cast<BuiltinType>(
this))
5675 if (
const BuiltinType *BT = dyn_cast<BuiltinType>(
this))
5676 return BT->isNonOverloadPlaceholderType();
5681 if (
const BuiltinType *BT = dyn_cast<BuiltinType>(CanonicalType))
5682 return BT->getKind() == BuiltinType::Void;
5687 if (
const BuiltinType *BT = dyn_cast<BuiltinType>(CanonicalType))
5688 return BT->getKind() == BuiltinType::Half;
5695 return BT->getKind() == BuiltinType::NullPtr;
5703 if (
const BuiltinType *BT = dyn_cast<BuiltinType>(CanonicalType))
5704 return BT->getKind() >= BuiltinType::Bool &&
5705 BT->getKind() <= BuiltinType::Int128;
5706 if (
const EnumType *ET = dyn_cast<EnumType>(CanonicalType)) {
5716 if (
const BuiltinType *BT = dyn_cast<BuiltinType>(CanonicalType))
5717 return BT->getKind() > BuiltinType::Void &&
5718 BT->getKind() <= BuiltinType::NullPtr;
5719 if (
const EnumType *ET = dyn_cast<EnumType>(CanonicalType))
5723 return isa<PointerType>(CanonicalType) ||
5724 isa<BlockPointerType>(CanonicalType) ||
5725 isa<MemberPointerType>(CanonicalType) ||
5726 isa<ComplexType>(CanonicalType) ||
5727 isa<ObjCObjectPointerType>(CanonicalType);
5731 if (
const BuiltinType *BT = dyn_cast<BuiltinType>(CanonicalType))
5732 return BT->getKind() >= BuiltinType::Bool &&
5733 BT->getKind() <= BuiltinType::Int128;
5737 if (
const EnumType *ET = dyn_cast<EnumType>(CanonicalType))
5744 if (
const BuiltinType *BT = dyn_cast<BuiltinType>(CanonicalType))
5745 return BT->getKind() == BuiltinType::Bool;
5777 type = arrayType->getElementType().getTypePtr();
5810 template <typename T, bool isArrayType = (std::is_same<T, ArrayType>::value ||
5811 std::is_base_of<ArrayType, T>::value)>
5814 template<
typename T>
5823 if (
const T *Ty = dyn_cast<T>(
this))
5827 if (!isa<T>(CanonicalType))
5837 if (
const ArrayType *arr = dyn_cast<ArrayType>(
this))
5841 if (!isa<ArrayType>(CanonicalType))
5853 if (
const T *ty = dyn_cast<T>(
this))
return ty;
5854 assert(isa<T>(CanonicalType));
5859 assert(isa<ArrayType>(CanonicalType));
5860 if (
const ArrayType *arr = dyn_cast<ArrayType>(
this))
return arr;
bool isDynamicExceptionSpec(ExceptionSpecificationType ESpecType)
bool isObjCSelType() const
bool isPlaceholderType() const
Determines whether this type is a placeholder type, i.e.
Internal representation of canonical, dependent typeof(expr) types.
unsigned getNumElements() const
bool hasObjCGCAttr() const
unsigned getAddressSpace() const
Return the address space of this type.
const ComplexType * getAsComplexIntegerType() const
bool isUnspecialized() const
Determine whether this object type is "unspecialized", meaning that it has no type arguments...
bool compatiblyIncludesObjCLifetime(Qualifiers other) const
Determines if these qualifiers compatibly include another set of qualifiers from the narrow perspecti...
void Profile(llvm::FoldingSetNodeID &ID) const
bool isObjCObjectOrInterfaceType() const
class LLVM_ALIGNAS(8) Decl
Decl - This represents one declaration (or definition), e.g.
QualType getExceptionType(unsigned i) const
Represents a type that was referred to using an elaborated type keyword, e.g., struct S...
SourceLocation getEnd() const
const ExtParameterInfo * getExtParameterInfosOrNull() const
Return a pointer to the beginning of the array of extra parameter information, if present...
typedefconst::clang::Type * SimpleType
Expr * getSizeExpr() const
QualType getUnderlyingType() const
Qualifiers getLocalQualifiers() const
Retrieve the set of qualifiers local to this particular QualType instance, not including any qualifie...
const Type * Ty
The locally-unqualified type.
ObjCInterfaceDecl * getDecl() const
Get the declaration of this interface.
FunctionDecl - An instance of this class is created to represent a function declaration or definition...
Qualifiers getNonFastQualifiers() const
static bool classof(const Type *T)
static void print(SplitQualType split, raw_ostream &OS, const PrintingPolicy &policy, const Twine &PlaceHolder, unsigned Indentation=0)
static Qualifiers fromCVRUMask(unsigned CVRU)
bool isNullPtrType() const
ExtParameterInfo getExtParameterInfo(unsigned I) const
The "enum" keyword introduces the elaborated-type-specifier.
bool containsUnexpandedParameterPack() const
Whether this nested-name-specifier contains an unexpanded parameter pack (for C++11 variadic template...
unsigned getDepth() const
void setDependent(bool D=true)
no exception specification
bool canDecayToPointerType() const
Determines whether this type can decay to a pointer type.
bool isNonOverloadPlaceholderType() const
Test for a placeholder type other than Overload; see BuiltinType::isNonOverloadPlaceholderType.
PointerType - C99 6.7.5.1 - Pointer Declarators.
void Profile(llvm::FoldingSetNodeID &ID)
Represents the dependent type named by a dependently-scoped typename using declaration, e.g.
bool isAtLeastAsQualifiedAs(QualType Other) const
Determine whether this type is at least as qualified as the other given type, requiring exact equalit...
A (possibly-)qualified type.
bool isConstantArrayType() const
const Type * getPointeeOrArrayElementType() const
If this is a pointer type, return the pointee type.
static void Profile(llvm::FoldingSetNodeID &ID, QualType Pointee)
ExtProtoInfo(CallingConv CC)
SourceRange getBracketsRange() const
QualType getCallResultType(const ASTContext &Context) const
Determine the type of an expression that calls a function of this type.
bool isCanonicalUnqualified() const
Determines if this type would be canonical if it had no further qualification.
bool isSpecificBuiltinType(unsigned K) const
Test for a particular builtin type.
bool operator==(Qualifiers Other) const
bool hasFloatingRepresentation() const
Determine whether this type has a floating-point representation of some sort, e.g., it is a floating-point type or a vector thereof.
ExtInfo withCallingConv(CallingConv cc) const
bool isConsumed() const
Is this parameter considered "consumed" by Objective-C ARC? Consumed parameters must have retainable ...
ArrayRef< QualType > getTypeArgs() const
Retrieve the type arguments for this type.
DestructionKind isDestructedType() const
Returns a nonzero value if objects of this type require non-trivial work to clean up after...
static QualType getObjectType(APValue::LValueBase B)
Retrieves the "underlying object type" of the given expression, as used by __builtin_object_size.
bool isMemberPointerType() const
FunctionDecl * getExceptionSpecDecl() const
If this function type has an exception specification which hasn't been determined yet (either because...
__auto_type (GNU extension)
bool isKindOfTypeAsWritten() const
Whether this is a "__kindof" type as written.
bool isInstantiationDependentType() const
Determine whether this type is an instantiation-dependent type, meaning that the type involves a temp...
unsigned getFastQualifiers() const
QualType getNonLValueExprType(const ASTContext &Context) const
Determine the type of a (typically non-lvalue) expression with the specified result type...
ParameterABI getParameterABI(unsigned I) const
Qualifiers::ObjCLifetime getObjCARCImplicitLifetime() const
Return the implicit lifetime for this type, which must not be dependent.
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)
NullabilityKind
Describes the nullability of a particular type.
bool isAnyCharacterType() const
Determine whether this type is any of the built-in character types.
FunctionType - C99 6.7.5.3 - Function Declarators.
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.
static void Profile(llvm::FoldingSetNodeID &ID, Kind attrKind, QualType modified, QualType equivalent)
void Profile(llvm::FoldingSetNodeID &ID)
bool canHaveNullability() const
Determine whether the given type can have a nullability specifier applied to it, i.e., if it is any kind of pointer type or a dependent type that could instantiate to any kind of pointer type.
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...
void Profile(llvm::FoldingSetNodeID &ID)
void addConst()
Add the const type qualifier to this QualType.
Qualifiers::GC getObjCGCAttr() const
Returns gc attribute of this type.
Represents a qualified type name for which the type name is dependent.
CanonicalTTPTInfo CanTTPTInfo
void setObjCLifetime(ObjCLifetime type)
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)
ArrayRef< ObjCProtocolDecl * > getProtocols() const
Retrieve all of the protocol qualifiers.
static bool classof(const Type *T)
static bool classof(const Type *T)
static std::string getAsString(SplitQualType split)
bool isRecordType() const
static void Profile(llvm::FoldingSetNodeID &ID, QualType T)
bool isChar16Type() const
ObjCObjectTypeBitfields ObjCObjectTypeBits
bool isLiteralType(const ASTContext &Ctx) const
Return true if this is a literal type (C++11 [basic.types]p10)
AutoType * getContainedAutoType() const
Get the AutoType whose type will be deduced for a variable with an initializer of this type...
bool isVoidPointerType() const
Represents a C++11 auto or C++14 decltype(auto) type.
bool isObjCQualifiedId() const
bool isEnumeralType() const
void Profile(llvm::FoldingSetNodeID &ID) const
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.
static bool classof(const Type *T)
std::string getAsString() const
const DiagnosticBuilder & operator<<(const DiagnosticBuilder &DB, const Attr *At)
bool hasExtParameterInfos() const
Is there any interesting extra information for any of the parameters of this function type...
QualType getPointeeType() const
The base class of the type hierarchy.
ObjCObjectType(enum Nonce_ObjCInterface)
bool isObjCQualifiedClassType() const
bool isElaboratedTypeSpecifier() const
Determine wither this type is a C++ elaborated-type-specifier.
unsigned getCVRQualifiers() const
Retrieve the set of CVR (const-volatile-restrict) qualifiers applied to this type.
void setObjCGCAttr(GC type)
DependentTemplateSpecializationType(ElaboratedTypeKeyword Keyword, NestedNameSpecifier *NNS, const IdentifierInfo *Name, ArrayRef< TemplateArgument > Args, QualType Canon)
Represents an array type, per C99 6.7.5.2 - Array Declarators.
void Profile(llvm::FoldingSetNodeID &ID)
const ObjCObjectType * getObjectType() const
Gets the type pointed to by this ObjC pointer.
AdjustedType(TypeClass TC, QualType OriginalTy, QualType AdjustedTy, QualType CanonicalPtr)
static bool classof(const Type *T)
void Profile(llvm::FoldingSetNodeID &ID)
bool isDecltypeAuto() const
bool isBooleanType() const
static clang::QualType getFromVoidPointer(void *P)
bool compatiblyIncludes(Qualifiers other) const
Determines if these qualifiers compatibly include another set.
QualType ElementType
The element type of the vector.
RefQualifierKind RefQualifier
const QualType * param_type_iterator
unsigned getIndex() const
bool getHasRegParm() const
bool isBlockPointerType() const
const ObjCObjectPointerType * getAsObjCQualifiedClassType() const
StreamedQualTypeHelper stream(const PrintingPolicy &Policy, const Twine &PlaceHolder=Twine(), unsigned Indentation=0) const
bool isCForbiddenLValueType() const
Determine whether expressions of the given type are forbidden from being lvalues in C...
bool isUnspecialized() const
Whether this type is unspecialized, meaning that is has no type arguments.
Qualifiers & operator+=(Qualifiers R)
bool isSpelledAsLValue() const
static inline::clang::ExtQuals * getFromVoidPointer(void *P)
static void Profile(llvm::FoldingSetNodeID &ID, QualType ET, const llvm::APInt &ArraySize, ArraySizeModifier SizeMod, unsigned TypeQuals)
bool hasUnsignedIntegerRepresentation() const
Determine whether this type has an unsigned integer representation of some sort, e.g., it is an unsigned integer type or a vector.
bool hasStrongOrWeakObjCLifetime() const
True if the lifetime is either strong or weak.
const llvm::APInt & getSize() const
void * getAsOpaquePtr() const
static Qualifiers fromOpaqueValue(unsigned opaque)
The noexcept specifier has a bad expression.
void removeObjCLifetime()
ObjCLifetime getObjCLifetime() const
Extra information about a function prototype.
CallingConv getCallConv() const
std::string getAsString() const
AutoTypeKeyword getKeyword() const
Qualifiers::ObjCLifetime getObjCLifetime() const
ArrayTypeBitfields ArrayTypeBits
bool isSpecialized() const
Whether this type is specialized, meaning that it has type arguments.
The "__interface" keyword.
TemplateTypeParmDecl * getDecl() const
void addAddressSpace(unsigned space)
QualType getOriginalType() const
bool isMemberDataPointerType() 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. ...
void getAsStringInternal(std::string &Str, const PrintingPolicy &Policy) const
const BuiltinType * getAsPlaceholderType() const
Qualifiers getIndexTypeQualifiers() const
bool containsUnexpandedParameterPack() const
Whether this type is or contains an unexpanded parameter pack, used to support C++0x variadic templat...
bool isObjCRetainableType() const
Represents the result of substituting a type for a template type parameter.
void Profile(llvm::FoldingSetNodeID &ID)
Linkage
Describes the different kinds of linkage (C++ [basic.link], C99 6.2.2) that an entity may have...
const Type * getUnqualifiedDesugaredType() const
Return the specified type with any "sugar" removed from the type, removing any typedefs, typeofs, etc., as well as any qualifiers.
The collection of all-type qualifiers we support.
bool isNoexceptExceptionSpec(ExceptionSpecificationType ESpecType)
static int getAccessorIdx(char c)
void AddTaggedVal(intptr_t V, DiagnosticsEngine::ArgumentKind Kind) const
void Profile(llvm::FoldingSetNodeID &ID)
bool operator==(ExtInfo Other) const
QualType getPointeeType() const
unsigned getNumParams() const
RecordDecl - Represents a struct/union/class.
Visibility getVisibility() const
bool isOpenCLSpecificType() const
DependentTypeOfExprType(const ASTContext &Context, Expr *E)
const IdentifierInfo * getIdentifier() const
Retrieve the type named by the typename specifier as an identifier.
QualType getElementType() const
FunctionType::ExtInfo ExtInfo
One of these records is kept for each identifier that is lexed.
unsigned getIndexTypeCVRQualifiers() const
ExtInfo withProducesResult(bool producesResult) const
bool isScalarType() const
Defines the Linkage enumeration and various utility functions.
ParameterABI getABI() const
Return the ABI treatment of this parameter.
bool hasObjCPointerRepresentation() const
Whether this type can represent an objective pointer type for the purpose of GC'ability.
TagDecl * getAsTagDecl() const
Retrieves the TagDecl that this type refers to, either because the type is a TagType or because it is...
class LLVM_ALIGNAS(8) DependentTemplateSpecializationType const IdentifierInfo * Name
Represents a template specialization type whose template cannot be resolved, e.g. ...
Represents a class type in Objective C.
Expr * getSizeExpr() const
ArrayRef< TemplateArgument > template_arguments() const
bool isVariablyModifiedType() const
Whether this type is a variably-modified type (C99 6.7.5).
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
ArrayRef< QualType > getParamTypes() const
bool isObjCARCImplicitlyUnretainedType() const
Determines if this type, which must satisfy isObjCLifetimeType(), is implicitly __unsafe_unretained r...
bool isReferenceType() const
bool isStructureOrClassType() const
bool isAnyPointerType() const
Defines the ExceptionSpecificationType enumeration and various utility functions. ...
bool isSugared() const
Returns whether this type directly provides sugar.
const TemplateArgument * getArgs() const
Retrieve the template arguments.
NoexceptResult
Result type of getNoexceptSpec().
void Profile(llvm::FoldingSetNodeID &ID)
static bool classof(const Type *T)
const internal::VariadicAllOfMatcher< Decl > decl
Matches declarations.
void setLocalFastQualifiers(unsigned Quals)
bool isChar32Type() const
const CXXRecordDecl * getPointeeCXXRecordDecl() const
If this is a pointer or reference to a RecordType, return the CXXRecordDecl that that type refers to...
ObjCObjectType::qual_iterator qual_iterator
An iterator over the qualifiers on the object type.
Base class that is common to both the ExtQuals and Type classes, which allows QualType to access the ...
NestedNameSpecifier * getQualifier() const
Retrieve the qualification on this type.
unsigned getCVRQualifiers() const
static bool classof(const Type *T)
Interesting information about a specific parameter that can't simply be reflected in parameter's type...
ArrayRef< ExtParameterInfo > getExtParameterInfos() const
static bool classof(const Type *T)
Represents the result of substituting a set of types for a template type parameter pack...
ArrayRef< QualType > getTypeArgsAsWritten() const
Retrieve the type arguments for this type.
ObjCProtocolDecl *const * qual_iterator
const RecordType * getAsUnionType() const
NOTE: getAs*ArrayType are methods on ASTContext.
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.
static void Profile(llvm::FoldingSetNodeID &ID, QualType ElementType, unsigned NumElements, TypeClass TypeClass, VectorKind VecKind)
static int getPointAccessorIdx(char c)
unsigned getAsOpaqueValue() const
ObjCProtocolDecl * getProtocol(unsigned I) const
Retrieve a qualifying protocol by index on the object type.
unsigned getRegParm() const
bool hasStrongOrWeakObjCLifetime() const
static void Profile(llvm::FoldingSetNodeID &ID, QualType Referencee, bool SpelledAsLValue)
bool isParamConsumed(unsigned I) const
void Profile(llvm::FoldingSetNodeID &ID)
QualType getUnderlyingType() const
ReferenceType(TypeClass tc, QualType Referencee, QualType CanonicalRef, bool SpelledAsLValue)
Expr * getUnderlyingExpr() const
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.
const Type & operator*() const
static bool classof(const Type *T)
unsigned getRegParmType() const
Type(TypeClass tc, QualType canon, bool Dependent, bool InstantiationDependent, bool VariablyModified, bool ContainsUnexpandedParameterPack)
bool isIntegralOrUnscopedEnumerationType() const
Determine whether this type is an integral or unscoped enumeration type.
bool hasNonFastQualifiers() const
Return true if the set contains any qualifiers which require an ExtQuals node to be allocated...
TemplateName getTemplateName() const
Retrieve the name of the template that we are specializing.
An rvalue reference type, per C++11 [dcl.ref].
static bool classof(const Type *T)
param_type_range param_types() const
static bool classof(const Type *T)
An lvalue ref-qualifier was provided (&).
bool isSpecificPlaceholderType(unsigned K) const
Test for a specific placeholder type.
void addObjCGCAttr(GC type)
bool isFundamentalType() const
Tests whether the type is categorized as a fundamental type.
Microsoft throw(...) extension.
A convenient class for passing around template argument information.
Qualifiers withoutObjCGCAttr() const
void setRestrict(bool flag)
static bool classof(const Type *T)
LinkageInfo getLinkageAndVisibility() const
Determine the linkage and visibility of this type.
QualType getBaseType() const
Gets the base type of this object type.
static void dump(llvm::raw_ostream &OS, StringRef FunctionName, ArrayRef< CounterExpression > Expressions, ArrayRef< CounterMappingRegion > Regions)
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified...
QualType getReturnType() const
The "struct" keyword introduces the elaborated-type-specifier.
const TemplateArgument & getArg(unsigned Idx) const
Retrieve a specific template argument as a type.
UnresolvedUsingTypenameDecl * getDecl() const
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.
Visibility
Describes the different kinds of visibility that a declaration may have.
SplitQualType getSplitUnqualifiedType() const
Retrieve the unqualified variant of the given type, removing as little sugar as possible.
bool isObjCLifetimeType() const
Returns true if objects of this type have lifetime semantics under ARC.
Represents a typeof (or typeof) expression (a GCC extension).
void addCVRQualifiers(unsigned mask)
Expr * getNoexceptExpr() const
unsigned getNumProtocols() const
Return the number of qualifying protocols on the object type.
RecordDecl * getDecl() const
QualType withoutLocalFastQualifiers() const
ObjCInterfaceDecl * getInterface() const
Gets the interface declaration for this object type, if the base type really is an interface...
bool isUnsignedIntegerType() const
Return true if this is an integer type that is unsigned, according to C99 6.2.5p6 [which returns true...
void Profile(llvm::FoldingSetNodeID &ID)
const ObjCObjectType * getAsObjCInterfaceType() const
Values of this type can never be null.
void print(raw_ostream &OS, const PrintingPolicy &Policy, const Twine &PlaceHolder=Twine(), unsigned Indentation=0) const
static Qualifiers removeCommonQualifiers(Qualifiers &L, Qualifiers &R)
Returns the common set of qualifiers while removing them from the given sets.
static bool classof(const Type *T)
TemplateTypeParmDecl * TTPDecl
void addQualifiers(Qualifiers Q)
Add the qualifiers from the given set to this set.
static unsigned getNumAddressingBits(const ASTContext &Context, QualType ElementType, const llvm::APInt &NumElements)
Determine the number of bits required to address a member of.
NestedNameSpecifier * getQualifier() const
Retrieve the qualification on this type.
TypeClass getTypeClass() const
bool isStructureType() const
Represents an Objective-C protocol declaration.
bool isObjCIndependentClassType() const
bool isIncompleteType(NamedDecl **Def=nullptr) const
Types are partitioned into 3 broad categories (C99 6.2.5p1): object types, function types...
QualType withVolatile() const
void setUnaligned(bool flag)
static bool classof(const Type *T)
void print(raw_ostream &OS, const PrintingPolicy &Policy, bool appendSpaceIfNonEmpty=false) const
const TemplateSpecializationType * getInjectedTST() const
friend Qualifiers operator+(Qualifiers L, Qualifiers R)
void addCVRUQualifiers(unsigned mask)
Represents an ObjC class declaration.
bool isExtVectorType() const
static void * getAsVoidPointer(clang::QualType P)
friend bool operator==(const QualType &LHS, const QualType &RHS)
Indicate whether the specified types and qualifiers are identical.
detail::InMemoryDirectory::const_iterator I
is ARM Neon polynomial vector
FunctionDecl * SourceDecl
The function whose exception specification this is, for EST_Unevaluated and EST_Uninstantiated.
bool operator!=(ExtInfo Other) const
bool isFromAST() const
Whether this type comes from an AST file.
QualType getCanonicalTypeInternal() const
void setFastQualifiers(unsigned mask)
static void Profile(llvm::FoldingSetNodeID &ID, const TemplateTypeParmType *Replaced, QualType Replacement)
bool isMemberFunctionPointer() const
Returns true if the member type (i.e.
ObjCProtocolDecl * getProtocol(unsigned I) const
Fetch a protocol by index.
Represents an extended vector type where either the type or size is dependent.
This object can be modified without requiring retains or releases.
const TemplateTypeParmType * getReplacedParameter() const
Gets the template parameter that was substituted for.
bool isLinkageValid() const
True if the computed linkage is valid.
Defines the clang::Visibility enumeration and various utility functions.
static void Profile(llvm::FoldingSetNodeID &ID, ElaboratedTypeKeyword Keyword, NestedNameSpecifier *NNS, const IdentifierInfo *Name)
static bool classof(const Type *T)
const ArrayType * getAsArrayTypeUnsafe() const
A variant of getAs<> for array types which silently discards qualifiers from the outermost type...
EnumDecl * getDecl() const
Represents a K&R-style 'int foo()' function, which has no information available about its arguments...
Provides definitions for the various language-specific address spaces.
void Profile(llvm::FoldingSetNodeID &ID)
llvm::iterator_range< qual_iterator > qual_range
QualType getValueType() const
Gets the type contained by this atomic type, i.e.
QualType getInjectedSpecializationType() const
bool isObjCUnqualifiedId() const
const Type * getBaseType() const
ExtInfo getExtInfo() const
const ArrayType * castAsArrayTypeUnsafe() const
A variant of castAs<> for array type which silently discards qualifiers from the outermost type...
void Profile(llvm::FoldingSetNodeID &ID)
A little helper class used to produce diagnostics.
CanQualType getCanonicalTypeUnqualified() const
ExtQuals(const Type *baseType, QualType canon, Qualifiers quals)
Optional< ArrayRef< QualType > > getObjCSubstitutions(const DeclContext *dc) const
Retrieve the set of substitutions required when accessing a member of the Objective-C receiver type t...
QualType getParamType(unsigned i) const
Represents a prototype with parameter type info, e.g.
ExceptionSpecificationType getExceptionSpecType() const
Get the kind of exception specification on this function.
QualType getAliasedType() const
Get the aliased type, if this is a specialization of a type alias template.
bool isTypeAlias() const
Determine if this template specialization type is for a type alias template that has been substituted...
bool isFloatingPoint() const
const Type * operator->() const
qual_iterator qual_end() const
Qualifiers::ObjCLifetime getObjCLifetime() const
Returns lifetime attribute of this type.
param_type_iterator param_type_begin() const
bool isUnspecializedAsWritten() const
Determine whether this object type is "unspecialized" as written, meaning that it has no type argumen...
ArraySizeModifier
Capture whether this is a normal array (e.g.
void addObjCLifetime(ObjCLifetime type)
bool isMoreQualifiedThan(QualType Other) const
Determine whether this type is more qualified than the other given type, requiring exact equality for...
bool hasFastQualifiers() const
QualType getPointeeType() const
If this is a pointer, ObjC object pointer, or block pointer, this returns the respective pointee...
bool isFunctionPointerType() const
void Profile(llvm::FoldingSetNodeID &ID)
bool hasLocalQualifiers() const
Determine whether this particular QualType instance has any qualifiers, without looking through any t...
bool hasUnaligned() const
bool hasSizedVLAType() const
Whether this type involves a variable-length array type with a definite size.
bool isRealFloatingType() const
Floating point categories.
bool isObjCInertUnsafeUnretainedType() const
Was this type written with the special inert-in-MRC __unsafe_unretained qualifier?
static void * getAsVoidPointer(::clang::ExtQuals *P)
bool isSignedInteger() const
bool isKindOfType() const
Whether this is a "__kindof" type.
Represents an array type in C++ whose size is a value-dependent expression.
bool isSignedIntegerOrEnumerationType() const
Determines whether this is an integer type that is signed or an enumeration types whose underlying ty...
static bool classof(const Type *T)
RecordType(TypeClass TC, RecordDecl *D)
SplitQualType split() const
Divides a QualType into its unqualified type and a set of local qualifiers.
static bool classof(const Type *T)
const Type * getTypePtrOrNull() const
Qualifiers::GC getObjCGCAttr() const
QualType getSuperClassType() const
Retrieve the type of the superclass of this object type.
QualType getPointeeType() const
bool isUndeducedType() const
Determine whether this type is an undeduced type, meaning that it somehow involves a C++11 'auto' typ...
Expr - This represents one expression.
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.
QualType desugar() const
Remove a single level of sugar.
bool isAnyComplexType() const
static Kind getNullabilityAttrKind(NullabilityKind kind)
Retrieve the attribute kind corresponding to the given nullability kind.
bool isObjCClassType() const
Declaration of a template type parameter.
Internal representation of canonical, dependent decltype(expr) types.
bool hasObjCGCAttr() const
bool hasCVRQualifiers() const
friend bool operator!=(const QualType &LHS, const QualType &RHS)
QualType getLocallyUnqualifiedSingleStepDesugaredType() const
Pull a single level of sugar off of this locally-unqualified type.
ElaboratedTypeKeyword
The elaboration keyword that precedes a qualified type name or introduces an elaborated-type-specifie...
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 isAtomicType() const
bool isUnsignedInteger() const
void Profile(llvm::FoldingSetNodeID &ID)
void setAddressSpace(unsigned space)
ObjCSubstitutionContext
The kind of type we are substituting Objective-C type arguments into.
bool isObjCGCWeak() const
true when Type is objc's weak.
llvm::iterator_range< param_type_iterator > param_type_range
Expr * getUnderlyingExpr() const
bool isVariableArrayType() const
bool hasObjCLifetime() const
QualType getNamedType() const
Retrieve the type named by the qualified-id.
ExtProtoInfo getExtProtoInfo() const
ExtProtoInfo withExceptionSpec(const ExceptionSpecInfo &O)
static bool classof(const Type *T)
void removeFastQualifiers(unsigned mask)
void Profile(llvm::FoldingSetNodeID &ID)
bool isFloatingType() const
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()
bool isFunctionNoProtoType() const
unsigned getTypeQuals() const
QualType getDesugaredType(const ASTContext &Context) const
Return the specified type with any "sugar" removed from the type.
There is no noexcept specifier.
bool isObjCIdType() const
A std::pair-like structure for storing a qualified type split into its local qualifiers and its local...
static inline::clang::Type * getFromVoidPointer(void *P)
SourceLocation getAttributeLoc() const
bool isDependentType() const
Whether this type is a dependent type, meaning that its definition somehow depends on a template para...
static bool classof(const Type *T)
bool hasTrailingReturn() const
Qualifiers Quals
The local qualifiers.
bool isObjCQualifiedIdType() const
True if this is equivalent to 'id.
static bool classof(const Type *T)
SourceLocation getRBracketLoc() const
A helper class for Type nodes having an ElaboratedTypeKeyword.
QualType withFastQualifiers(unsigned TQs) const
Represents a GCC generic vector type.
An lvalue reference type, per C++11 [dcl.ref].
ExtParameterInfo withABI(ParameterABI kind) const
bool isCurrentInstantiation() const
True if this template specialization type matches a current instantiation in the context in which it ...
class LLVM_ALIGNAS(8) TemplateSpecializationType unsigned NumArgs
Represents a type template specialization; the template must be a class template, a type alias templa...
llvm::iterator_range< qual_iterator > qual_range
QualType getElementType() const
bool isStrictSupersetOf(Qualifiers Other) const
Determine whether this set of qualifiers is a strict superset of another set of qualifiers, not considering qualifier compatibility.
bool isComplexIntegerType() const
The result type of a method or function.
static bool classof(const Type *T)
void removeLocalCVRQualifiers(unsigned Mask)
unsigned getLocalCVRQualifiers() const
Retrieve the set of CVR (const-volatile-restrict) qualifiers local to this particular QualType instan...
bool IsEnumDeclComplete(EnumDecl *ED)
Check if the given decl is complete.
bool isUnsignedIntegerOrEnumerationType() const
Determines whether this is an integer type that is unsigned or an enumeration types whose underlying ...
static ExtParameterInfo getFromOpaqueValue(unsigned char data)
void removeCVRQualifiers(unsigned mask)
__UINTPTR_TYPE__ uintptr_t
An unsigned integer type with the property that any valid pointer to void can be converted to this ty...
QualType getReplacementType() const
Gets the type that was substituted for the template parameter.
CallingConv
CallingConv - Specifies the calling convention that a function uses.
bool isTemplateTypeParmType() const
bool isObjectType() const
Determine whether this type is an object type.
bool hasObjCLifetime() const
bool isEmptyWhenPrinted(const PrintingPolicy &Policy) const
SourceRange getBracketsRange() const
bool hasUnnamedOrLocalType() const
Whether this type is or contains a local or unnamed type.
static void Profile(llvm::FoldingSetNodeID &ID, QualType Pointee)
unsigned getLocalFastQualifiers() const
bool getNoReturnAttr() const
Determine whether this function type includes the GNU noreturn attribute.
static void Profile(llvm::FoldingSetNodeID &ID, ElaboratedTypeKeyword Keyword, NestedNameSpecifier *NNS, QualType NamedType)
const TemplateTypeParmType * getReplacedParameter() const
Gets the template parameter that was substituted for.
bool isDependentSizedArrayType() const
CXXRecordDecl * getMostRecentCXXRecordDecl() const
static void Profile(llvm::FoldingSetNodeID &ID, QualType T)
There is no lifetime qualification on this type.
exception_iterator exception_begin() const
ExtInfo withRegParm(unsigned RegParm) const
bool hasNoexceptExceptionSpec() const
Return whether this function has a noexcept exception spec.
static void Profile(llvm::FoldingSetNodeID &ID, QualType ResultType, ExtInfo Info)
is AltiVec 'vector Pixel'
Assigning into this object requires the old value to be released and the new value to be retained...
bool isIntegralOrEnumerationType() const
Determine whether this type is an integral or enumeration type.
not a target-specific vector type
ExceptionSpecificationType Type
The kind of exception specification this is.
static bool classof(const Type *T)
static bool classof(const Type *T)
void setVolatile(bool flag)
const ExtParameterInfo * ExtParameterInfos
const char * getNameAsCString(const PrintingPolicy &Policy) const
Encodes a location in the source.
bool hasIntegerRepresentation() const
Determine whether this type has an integer representation of some sort, e.g., it is an integer type o...
void addVolatile()
Add the volatile type qualifier to this QualType.
bool isObjCIdOrClassType() const
True if this is equivalent to the 'id' or 'Class' type,.
Sugar for parentheses used when specifying types.
A helper class that allows the use of isa/cast/dyncast to detect TagType objects of enums...
const Type * getTypePtr() const
Retrieves a pointer to the underlying (unqualified) type.
Visibility getVisibility() const
Determine the visibility of this type.
const TemplateArgument * iterator
QualType getElementType() const
QualType withCVRQualifiers(unsigned CVR) const
bool isConstant(const ASTContext &Ctx) const
RefQualifierKind getRefQualifier() const
Retrieve the ref-qualifier associated with this function type.
SourceLocation getLBracketLoc() const
Represents typeof(type), a GCC extension.
Interfaces are the core concept in Objective-C for object oriented design.
static bool anyDependentTemplateArguments(ArrayRef< TemplateArgumentLoc > Args, bool &InstantiationDependent)
Determine whether any of the given template arguments are dependent.
static bool classof(const Type *T)
bool isComplexType() const
isComplexType() does not include complex integers (a GCC extension).
bool isBuiltinType() const
Helper methods to distinguish type categories.
static bool classof(const Type *T)
TagDecl - Represents the declaration of a struct/union/class/enum.
bool isConstantSizeType() const
Return true if this is not a variable sized type, according to the rules of C99 6.7.5p3.
static bool isPlaceholderTypeKind(Kind K)
Determines whether the given kind corresponds to a placeholder type.
static bool classof(const Type *T)
void Profile(llvm::FoldingSetNodeID &ID)
static QualType getUnderlyingType(const SubRegion *R)
bool isObjCUnqualifiedIdOrClass() const
static void Profile(llvm::FoldingSetNodeID &ID, QualType T)
VectorKind getVectorKind() const
unsigned getAddressSpace() const
QualType withConst() const
bool isObjCBuiltinType() const
bool isObjCClassOrClassKindOfType() const
Whether the type is Objective-C 'Class' or a __kindof type of an Class type, e.g., __kindof Class <NSCopying>.
bool isVisibilityExplicit() const
Return true if the visibility was explicitly set is the code.
The width of the "fast" qualifier mask.
const TemplateArgument * getArgBuffer() const
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.
ExtInfo withNoReturn(bool noReturn) const
void AddTaggedVal(intptr_t V, DiagnosticsEngine::ArgumentKind Kind) const
bool isIntegralType(const ASTContext &Ctx) const
Determine whether this type is an integral type.
const Type * getArrayElementTypeNoTypeQual() const
If this is an array type, return the element type of the array, potentially with type qualifiers miss...
bool isObjCBoxableRecordType() const
void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Ctx)
Represents a canonical, potentially-qualified type.
CanQual< Type > CanQualType
Represents a canonical, potentially-qualified type.
FunctionDecl * getExceptionSpecTemplate() const
If this function type has an uninstantiated exception specification, this is the function whose excep...
bool hasConstFields() const
AttributedTypeBitfields AttributedTypeBits
SplitQualType getSplitDesugaredType() const
static void Profile(llvm::FoldingSetNodeID &ID, QualType Deduced, AutoTypeKeyword Keyword, bool IsDependent)
ExceptionSpecInfo(ExceptionSpecificationType EST)
const Type * getBaseElementTypeUnsafe() const
Get the base element type of this type, potentially discarding type qualifiers.
is AltiVec 'vector bool ...'
bool acceptsObjCTypeParams() const
Determines if this is an ObjC interface type that may accept type parameters.
bool isSpecializedAsWritten() const
Determine whether this object type was written with type arguments.
qual_iterator qual_begin() const
RefQualifierKind
The kind of C++11 ref-qualifier associated with a function type.
bool isReserveIDT() const
bool isMemberDataPointer() const
Returns true if the member type (i.e.
TypedefNameDecl * getDecl() const
unsigned getNumProtocols() const
Return the number of qualifying protocols in this interface type, or 0 if there are none...
bool isObjCQualifiedClassType() const
True if this is equivalent to 'Class.
SourceLocation getBegin() const
const T * castAs() const
Member-template castAs<specific type>.
static bool classof(const Type *T)
qual_iterator qual_begin() const
const IdentifierInfo * getIdentifier() const
Qualifiers & operator-=(Qualifiers R)
static void PrintTemplateArgumentList(raw_ostream &OS, ArrayRef< TemplateArgument > Args, const PrintingPolicy &Policy, bool SkipBrackets=false)
Print a template argument list, including the '<' and '>' enclosing the template arguments...
bool isVectorType() const
friend bool operator!=(ExtParameterInfo lhs, ExtParameterInfo rhs)
static bool isVectorSizeTooLarge(unsigned NumElements)
bool isPromotableIntegerType() const
More type predicates useful for type checking/promotion.
bool isMemberFunctionPointerType() const
An rvalue ref-qualifier was provided (&&).
Assigning into this object requires a lifetime extension.
void addFastQualifiers(unsigned TQs)
bool isVolatileQualified() const
Determine whether this type is volatile-qualified.
static QualType getFromOpaquePtr(const void *Ptr)
void setVariablyModified(bool VM=true)
unsigned TypeAlias
Whether this template specialization type is a substituted type alias.
ParameterABI
Kinds of parameter ABI.
bool isAccessorWithinNumElements(char c) const
void Profile(llvm::FoldingSetNodeID &ID)
bool isObjCQualifiedClass() const
Represents a pointer type decayed from an array or function type.
bool isFunctionProtoType() const
The injected class name of a C++ class template or class template partial specialization.
QualType getPointeeType() const
Represents a pack expansion of types.
ArrayRef< QualType > getTypeArgsAsWritten() const
Retrieve the type arguments of this object type as they were written.
Defines various enumerations that describe declaration and type specifiers.
Expr * getSizeExpr() const
const char * getTypeClassName() const
static unsigned getMaxSizeBits(const ASTContext &Context)
Determine the maximum number of active bits that an array's size can require, which limits the maximu...
Base class for declarations which introduce a typedef-name.
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...
TagTypeKind
The kind of a tag type.
not evaluated yet, for special member function
A qualifier set is used to build a set of qualifiers.
Qualifiers withoutObjCLifetime() const
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
bool isAggregateType() const
Determines whether the type is a C++ aggregate type or C aggregate or union type. ...
void setContainsUnexpandedParameterPack(bool PP=true)
static bool classof(const Type *T)
TypeWithKeywordBitfields TypeWithKeywordBits
const internal::VariadicAllOfMatcher< Type > type
Matches Types in the clang AST.
void removeLocalFastQualifiers()
bool hasLocalNonFastQualifiers() const
Determine whether this particular QualType instance has any "non-fast" qualifiers, e.g., those that are stored in an ExtQualType instance.
static bool classof(const Type *T)
static bool classof(const Type *T)
QualType IgnoreParens() const
Returns the specified type after dropping any outer-level parentheses.
Reads an AST files chain containing the contents of a translation unit.
bool getProducesResult() const
bool hasNonTrivialObjCLifetime() const
True if the lifetime is neither None or ExplicitNone.
TypedefType(TypeClass tc, const TypedefNameDecl *D, QualType can)
QualType getEquivalentType() const
StreamedQualTypeHelper(const QualType &T, const PrintingPolicy &Policy, const Twine &PlaceHolder, unsigned Indentation)
bool isParameterPack() const
bool isStandardLayoutType() const
Test if this type is a standard-layout type.
Represents a dependent using declaration which was marked with typename.
The maximum supported address space number.
The "union" keyword introduces the elaborated-type-specifier.
CallingConv getCC() const
const Type * strip(QualType type)
Collect any qualifiers on the given type and return an unqualified type.
void Profile(llvm::FoldingSetNodeID &ID)
param_type_iterator param_type_end() const
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)
detail::InMemoryDirectory::const_iterator E
A pointer to member type per C++ 8.3.3 - Pointers to members.
QualType getModifiedType() const
void setCVRQualifiers(unsigned mask)
static void Profile(llvm::FoldingSetNodeID &ID, QualType Orig, QualType New)
bool isLValueReferenceType() const
static void Profile(llvm::FoldingSetNodeID &ID, QualType Pattern, Optional< unsigned > NumExpansions)
unsigned char getOpaqueValue() const
bool isCanonicalAsParam() const
void Profile(llvm::FoldingSetNodeID &ID)
static bool classof(const Type *T)
void addConsistentQualifiers(Qualifiers qs)
Add the qualifiers from the given set to this set, given that they don't conflict.
const RecordType * getAsStructureType() const
bool isWideCharType() const
Defines the Diagnostic-related interfaces.
bool isRValueReferenceType() const
bool isVisibilityExplicit() const
void removeCVRQualifiers()
QualType getPointeeType() const
Gets the type pointed to by this ObjC pointer.
QualType getNonReferenceType() const
If Type is a reference type (e.g., const int&), returns the type that the reference refers to ("const...
Represents a pointer to an Objective C object.
static bool classof(const Type *T)
bool isObjCObjectType() const
bool operator!=(Qualifiers Other) const
FunctionTypeBitfields FunctionTypeBits
QualType getLocalUnqualifiedType() const
Return this type with all of the instance-specific qualifiers removed, but without removing any quali...
FunctionDecl * SourceTemplate
The function template whose exception specification this is instantiated from, for EST_Uninstantiated...
const QualType * exception_iterator
A helper class that allows the use of isa/cast/dyncast to detect TagType objects of structs/unions/cl...
qual_iterator qual_end() const
Complex values, per C99 6.2.5p11.
static bool classof(const Type *T)
static bool classof(const Type *T)
bool isObjCNSObjectType() const
QualType withExactLocalFastQualifiers(unsigned TQs) const
const T * getAs() const
Member-template getAs<specific type>'.
AutoTypeBitfields AutoTypeBits
unsigned getTypeQuals() const
bool isAddressSpaceOverlapping(const PointerType &other) const
Returns true if address spaces of pointers overlap.
QualType getCanonicalType() const
static bool classof(const Type *T)
bool isSpecifierType() const
Returns true if this type can be represented by some set of type specifiers.
ObjCInterfaceDecl * getInterfaceDecl() const
If this pointer points to an Objective @interface type, gets the declaration for that interface...
const ObjCObjectType * getAsObjCQualifiedInterfaceType() const
void Profile(llvm::FoldingSetNodeID &ID)
static bool classof(const Type *T)
bool isObjCQualifiedIdType() const
VectorTypeBitfields VectorTypeBits
static bool classof(const Type *T)
bool isFunctionType() const
NestedNameSpecifier * getQualifier() const
ExtVectorType - Extended vector type.
QualType getInnerType() const
The noexcept specifier evaluates to false.
Base for LValueReferenceType and RValueReferenceType.
friend bool operator==(ExtParameterInfo lhs, ExtParameterInfo rhs)
CXXRecordDecl * getAsCXXRecordDecl() const
Retrieves the CXXRecordDecl that this type refers to, either because the type is a RecordType or beca...
QualType desugar() const
Remove a single level of sugar.
unsigned getAddressSpace() const
ExtInfo(bool noReturn, bool hasRegParm, unsigned regParm, CallingConv cc, bool producesResult)
QualType withRestrict() const
bool isRestrictQualified() const
Determine whether this type is restrict-qualified.
ExceptionSpecificationType
The various types of exception specifications that exist in C++11.
static bool classof(const Type *T)
Implements a partial diagnostic that can be emitted anwyhere in a DiagnosticBuilder stream...
QualType getPointeeType() const
ArrayRef< QualType > Exceptions
Explicitly-specified list of exception types.
Linkage getLinkage() const
Determine the linkage of this type.
bool hasNonTrivialObjCLifetime() const
bool isObjCGCStrong() const
true when Type is objc's strong.
const Type * getClass() 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)
An attributed type is a type to which a type attribute has been applied.
bool hasAddressSpace() const
bool isBlockCompatibleObjCPointerType(ASTContext &ctx) const
bool isObjCClassType() const
True if this is equivalent to the 'Class' type, i.e.
bool isCARCBridgableType() const
Determine whether the given type T is a "bridgeable" C type.
QualType getUnqualifiedType() const
Retrieve the unqualified variant of the given type, removing as little sugar as possible.
std::pair< const Type *, Qualifiers > asPair() const
Represents a C++ struct/union/class.
void removeLocalRestrict()
bool hasQualifiers() const
Return true if the set contains any qualifiers.
bool isObjCObjectPointerType() const
bool isPlaceholderType() const
Test for a type which does not represent an actual type-system type but is instead used as a placehol...
static bool classof(const Type *T)
Represents a C array with an unspecified size.
bool isObjCUnqualifiedClass() const
SplitQualType(const Type *ty, Qualifiers qs)
void removeFastQualifiers()
bool isCompoundType() const
Tests whether the type is categorized as a compound type.
The parameter type of a method or function.
ArraySizeModifier getSizeModifier() const
ElaboratedTypeKeyword getKeyword() const
bool hasDynamicExceptionSpec() const
Return whether this function has a dynamic (throw) exception spec.
bool isOverloadableType() const
Determines whether this is a type for which one can define an overloaded operator.
void Profile(llvm::FoldingSetNodeID &ID)
unsigned kind
All of the diagnostics that can be emitted by the frontend.
This class is used for builtin types like 'int'.
exception_iterator exception_end() const
Writes an AST file containing the contents of a translation unit.
SourceLocation getLBracketLoc() const
QualType getAdjustedType() const
void Profile(llvm::FoldingSetNodeID &ID)
static bool classof(const Type *T)
void removeLocalFastQualifiers(unsigned Mask)
QualType getPattern() const
Retrieve the pattern of this pack expansion, which is the type that will be repeatedly instantiated w...
bool isSpecializedAsWritten() const
Whether this type is specialized, meaning that it has type arguments.
QualType getDecayedType() const
static Qualifiers fromCVRMask(unsigned CVR)
QualType getPointeeTypeAsWritten() const
bool getHasRegParm() const
TagDecl * getDecl() const
bool isObjCIndirectLifetimeType() const
bool isIncompleteArrayType() const
SourceLocation getRBracketLoc() const
Qualifiers getQualifiers() const
void Profile(llvm::FoldingSetNodeID &ID) const
QualType getElementType() const
QualType getElementType() const
static void Profile(llvm::FoldingSetNodeID &ID, QualType Element)
bool hasQualifiers() const
Determine whether this type has any qualifiers.
ExtParameterInfo withIsConsumed(bool consumed) const
SplitQualType getSingleStepDesugaredType() const
RecordType(const RecordDecl *D)
bool hasExceptionSpec() const
Return whether this function has any kind of exception spec.
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...
IdentifierInfo * getIdentifier() const
static StringRef getNameForCallConv(CallingConv CC)
bool isObjCARCBridgableType() const
Determine whether the given type T is a "bridgable" Objective-C type, which is either an Objective-C ...
BuiltinTypeBitfields BuiltinTypeBits
static int getNumericAccessorIdx(char c)
bool isInterfaceType() const
A trivial tuple used to represent a source range.
VectorType(QualType vecType, unsigned nElements, QualType canonType, VectorKind vecKind)
static void * getAsVoidPointer(::clang::Type *P)
NamedDecl - This represents a decl with a name.
bool isNonOverloadPlaceholderType() const
Determines whether this type is a placeholder type other than Overload.
void addFastQualifiers(unsigned mask)
StringRef getName(const PrintingPolicy &Policy) const
Represents a C array with a specified size that is not an integer-constant-expression.
bool isObjCIdOrObjectKindOfType(const ASTContext &ctx, const ObjCObjectType *&bound) const
Whether the type is Objective-C 'id' or a __kindof type of an object type, e.g., __kindof NSView * or...
bool isArithmeticType() const
No keyword precedes the qualified type name.
bool isSignedIntegerType() const
Return true if this is an integer type that is signed, according to C99 6.2.5p4 [char, signed char, short, int, long..], or an enum decl which has a signed representation.
void Profile(llvm::FoldingSetNodeID &ID)
bool isConstQualified() const
Determine whether this type is const-qualified.
bool hasSignedIntegerRepresentation() const
Determine whether this type has an signed integer representation of some sort, e.g., it is an signed integer type or a vector.
bool isUnspecializedAsWritten() const
Determine whether this object type is "unspecialized" as written, meaning that it has no type argumen...
bool isNull() const
Return true if this QualType doesn't point to a type yet.
const ObjCObjectPointerType * getAsObjCInterfacePointerType() const
friend bool operator==(SplitQualType a, SplitQualType b)
bool isObjCIdType() const
True if this is equivalent to the 'id' type, i.e.
The noexcept specifier is dependent.
bool isSugared() const
Returns whether this type directly provides sugar.
static void Profile(llvm::FoldingSetNodeID &ID, UnresolvedUsingTypenameDecl *D)
void removeAddressSpace()
Optional< NullabilityKind > getNullability(const ASTContext &context) const
Determine the nullability of the given type.
QualType getSingleStepDesugaredType(const ASTContext &Context) const
Return the specified type with one level of "sugar" removed from the type.
QualifierCollector(Qualifiers Qs=Qualifiers())
TemplateSpecializationType(TemplateName T, ArrayRef< TemplateArgument > Args, QualType Canon, QualType Aliased)
The "__interface" keyword introduces the elaborated-type-specifier.
Optional< unsigned > getNumExpansions() const
Retrieve the number of expansions that this pack expansion will generate, if known.
ArrayRef< QualType > exceptions() const
The superclass of a type.
Represents the canonical version of C arrays with a specified constant size.
ExceptionSpecInfo ExceptionSpec
static bool classof(const Type *T)
A class which abstracts out some details necessary for making a call.
bool isObjCQualifiedInterfaceType() const
static bool classof(const Type *T)
unsigned getNumArgs() const
Retrieve the number of template arguments.
ScalarTypeKind getScalarTypeKind() const
Given that this is a scalar type, classify it.
bool hasPointerRepresentation() const
Whether this type is represented natively as a pointer.
static void Profile(llvm::FoldingSetNodeID &ID, unsigned Depth, unsigned Index, bool ParameterPack, TemplateTypeParmDecl *TTPDecl)
void Profile(llvm::FoldingSetNodeID &ID)
bool isIntegerType() const
isIntegerType() does not include complex integers (a GCC extension).
const ObjCObjectPointerType * getAsObjCQualifiedIdType() const
void Profile(llvm::FoldingSetNodeID &ID) const
bool hasAddressSpace() const
bool isAddressSpaceSupersetOf(Qualifiers other) const
Returns true if this address space is a superset of the other one.
Qualifiers getQualifiers() const
Retrieve the set of qualifiers applied to this type.
bool isPointerType() const
unsigned getNumExceptions() const
bool isIncompleteOrObjectType() const
Return true if this is an incomplete or object type, in other words, not a function type...
QualType getDeducedType() const
Get the type deduced for this auto type, or null if it's either not been deduced or was deduced to a ...