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 ObjCTypeParamDecl;
92 class UnresolvedUsingTypenameDecl;
96 class StmtIteratorBase;
97 class TemplateArgument;
98 class TemplateArgumentLoc;
99 class TemplateArgumentListInfo;
100 class ElaboratedType;
102 class ExtQualsTypeCommonBase;
103 struct PrintingPolicy;
105 template <
typename>
class CanQual;
109 #define TYPE(Class, Base) class Class##Type;
110 #include "clang/AST/TypeNodes.def"
175 Q.Mask = L.Mask & R.Mask;
261 assert(!(mask & ~
CVRMask) &&
"bitmask contains non-CVR bits");
262 Mask = (Mask & ~
CVRMask) | mask;
265 assert(!(mask & ~
CVRMask) &&
"bitmask contains non-CVR bits");
272 assert(!(mask & ~
CVRMask) &&
"bitmask contains non-CVR bits");
276 assert(!(mask & ~
CVRMask & ~UMask) &&
"bitmask contains non-CVRU bits");
282 Mask = (Mask & ~UMask) | (flag ? UMask : 0);
290 Mask = (Mask & ~GCAttrMask) | (type << GCAttrShift);
310 return ObjCLifetime((Mask & LifetimeMask) >> LifetimeShift);
313 Mask = (Mask & ~LifetimeMask) | (type << LifetimeShift);
319 Mask |= (type << LifetimeShift);
355 Mask = (Mask & ~AddressSpaceMask)
356 | (((uint32_t) space) << AddressSpaceShift);
369 assert(!(mask & ~
FastMask) &&
"bitmask contains non-fast qualifier bits");
373 assert(!(mask & ~
FastMask) &&
"bitmask contains non-fast qualifier bits");
380 assert(!(mask & ~
FastMask) &&
"bitmask contains non-fast qualifier bits");
395 bool empty()
const {
return !Mask; }
534 bool appendSpaceIfNonEmpty =
false)
const;
546 static const uint32_t UMask = 0x8;
547 static const uint32_t UShift = 3;
548 static const uint32_t GCAttrMask = 0x30;
549 static const uint32_t GCAttrShift = 4;
550 static const uint32_t LifetimeMask = 0x1C0;
551 static const uint32_t LifetimeShift = 6;
552 static const uint32_t AddressSpaceMask =
553 ~(
CVRMask | UMask | GCAttrMask | LifetimeMask);
554 static const uint32_t AddressSpaceShift = 9;
572 std::pair<const Type *,Qualifiers>
asPair()
const {
573 return std::pair<const Type *, Qualifiers>(Ty, Quals);
618 llvm::PointerIntPair<llvm::PointerUnion<const Type*,const ExtQuals*>,
621 const ExtQuals *getExtQualsUnsafe()
const {
625 const Type *getTypePtrUnsafe()
const {
626 return Value.getPointer().get<
const Type*>();
630 assert(!isNull() &&
"Cannot retrieve a NULL type pointer");
642 :
Value(Ptr, Quals) {}
644 :
Value(Ptr, Quals) {}
653 const Type *getTypePtr()
const;
655 const Type *getTypePtrOrNull()
const;
667 T.Value.setFromOpaqueValue(const_cast<void*>(Ptr));
672 return *getTypePtr();
679 bool isCanonical()
const;
680 bool isCanonicalAsParam()
const;
684 return Value.getPointer().isNull();
695 bool isConstQualified()
const;
705 bool isRestrictQualified()
const;
715 bool isVolatileQualified()
const;
721 return getLocalFastQualifiers() || hasLocalNonFastQualifiers();
746 return getLocalFastQualifiers();
803 return withFastQualifiers(CVR);
808 &&
"non-fast qualifier bits set in mask!");
812 void removeLocalConst();
813 void removeLocalVolatile();
814 void removeLocalRestrict();
815 void removeLocalCVRQualifiers(
unsigned Mask);
869 inline QualType getUnqualifiedType()
const;
884 bool isMoreQualifiedThan(
QualType Other)
const;
888 bool isAtLeastAsQualifiedAs(
QualType Other)
const;
890 QualType getNonReferenceType()
const;
911 return getDesugaredType(*
this, Context);
915 return getSplitDesugaredType(*
this);
924 return getSingleStepDesugaredTypeImpl(*
this, Context);
930 if (isa<ParenType>(*
this))
937 return LHS.Value == RHS.Value;
940 return LHS.Value != RHS.Value;
953 const Twine &PlaceHolder = Twine(),
954 unsigned Indentation = 0)
const {
955 print(split(), OS, Policy, PlaceHolder, Indentation);
959 unsigned Indentation = 0) {
960 return print(split.
Ty, split.
Quals, OS, policy, PlaceHolder, Indentation);
964 const Twine &PlaceHolder,
965 unsigned Indentation = 0);
969 return getAsStringInternal(split(), Str, Policy);
973 return getAsStringInternal(split.
Ty, split.
Quals, out, policy);
982 const Twine &PlaceHolder;
983 unsigned Indentation;
986 const Twine &PlaceHolder,
unsigned Indentation)
987 : T(T), Policy(Policy), PlaceHolder(PlaceHolder),
988 Indentation(Indentation) { }
992 SQT.T.
print(OS, SQT.Policy, SQT.PlaceHolder, SQT.Indentation);
998 const Twine &PlaceHolder = Twine(),
999 unsigned Indentation = 0)
const {
1003 void dump(
const char *s)
const;
1005 void dump(llvm::raw_ostream &OS)
const;
1008 ID.AddPointer(getAsOpaquePtr());
1029 return getQualifiers().getObjCLifetime();
1033 return getQualifiers().hasNonTrivialObjCLifetime();
1037 return getQualifiers().hasStrongOrWeakObjCLifetime();
1047 DK_objc_weak_lifetime
1055 return isDestructedTypeImpl(*
this);
1068 bool isCForbiddenLValueType()
const;
1116 QualType getAtomicUnqualifiedType()
const;
1129 static DestructionKind isDestructedTypeImpl(
QualType type);
1155 enum { NumLowBitsAvailable = 0 };
1168 : BaseType(baseType), CanonicalType(canon) {}
1175 const Type *
const BaseType;
1218 canon.isNull() ?
QualType(this_(), 0) : canon),
1222 &&
"ExtQuals created with no fast qualifiers");
1224 &&
"ExtQuals created with fast qualifiers");
1247 const Type *BaseType,
1250 ID.AddPointer(BaseType);
1306 #define TYPE(Class, Base) Class,
1307 #define LAST_TYPE(Class) TypeLast = Class,
1308 #define ABSTRACT_TYPE(Class, Base)
1309 #include "clang/AST/TypeNodes.def"
1315 void operator=(
const Type &) =
delete;
1318 class TypeBitfields {
1326 unsigned Dependent : 1;
1330 unsigned InstantiationDependent : 1;
1333 unsigned VariablyModified : 1;
1337 unsigned ContainsUnexpandedParameterPack : 1;
1341 mutable unsigned CacheValid : 1;
1344 mutable unsigned CachedLinkage : 3;
1347 mutable unsigned CachedLocalOrUnnamed : 1;
1350 mutable unsigned FromAST : 1;
1352 bool isCacheValid()
const {
1356 assert(isCacheValid() &&
"getting linkage from invalid cache");
1357 return static_cast<Linkage>(CachedLinkage);
1359 bool hasLocalOrUnnamedType()
const {
1360 assert(isCacheValid() &&
"getting linkage from invalid cache");
1361 return CachedLocalOrUnnamed;
1364 enum { NumTypeBits = 18 };
1373 unsigned : NumTypeBits;
1377 unsigned IndexTypeQuals : 3;
1382 unsigned SizeModifier : 3;
1388 unsigned : NumTypeBits;
1398 unsigned : NumTypeBits;
1402 unsigned ExtInfo : 11;
1410 unsigned TypeQuals : 4;
1415 unsigned RefQualifier : 2;
1421 unsigned : NumTypeBits;
1424 unsigned NumTypeArgs : 7;
1427 unsigned NumProtocols : 6;
1430 unsigned IsKindOf : 1;
1432 static_assert(NumTypeBits + 7 + 6 + 1 <= 32,
"Does not fit in an unsigned");
1437 unsigned : NumTypeBits;
1450 unsigned SpelledAsLValue : 1;
1454 unsigned InnerRef : 1;
1460 unsigned : NumTypeBits;
1463 unsigned Keyword : 8;
1469 unsigned : NumTypeBits;
1473 unsigned VecKind : 3;
1476 unsigned NumElements : 29 - NumTypeBits;
1478 enum { MaxNumElements = (1 << (29 - NumTypeBits)) - 1 };
1484 unsigned : NumTypeBits;
1487 unsigned AttrKind : 32 - NumTypeBits;
1493 unsigned : NumTypeBits;
1497 unsigned Keyword : 2;
1515 void setFromAST(
bool V =
true)
const {
1525 bool InstantiationDependent,
bool VariablyModified,
1526 bool ContainsUnexpandedParameterPack)
1531 TypeBits.InstantiationDependent = Dependent || InstantiationDependent;
1532 TypeBits.VariablyModified = VariablyModified;
1533 TypeBits.ContainsUnexpandedParameterPack = ContainsUnexpandedParameterPack;
1535 TypeBits.CachedLocalOrUnnamed =
false;
1544 TypeBits.InstantiationDependent =
true;
1547 TypeBits.InstantiationDependent = D; }
1551 TypeBits.ContainsUnexpandedParameterPack = PP;
1576 return TypeBits.ContainsUnexpandedParameterPack;
1582 return CanonicalType ==
QualType(
this, 0);
1758 #define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \
1759 bool is##Id##Type() const;
1760 #include "clang/Basic/OpenCLImageTypes.def"
1804 return TypeBits.InstantiationDependent;
1909 template <
typename T>
const T *
getAs()
const;
1928 template <
typename T>
const T *
castAs()
const;
2046 return CanonicalType;
2050 void dump(llvm::raw_ostream &OS)
const;
2071 #define TYPE(Class, Base)
2072 #define LEAF_TYPE(Class) \
2073 template <> inline const Class##Type *Type::getAs() const { \
2074 return dyn_cast<Class##Type>(CanonicalType); \
2076 template <> inline const Class##Type *Type::castAs() const { \
2077 return cast<Class##Type>(CanonicalType); \
2079 #include "clang/AST/TypeNodes.def"
2088 #define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) Id,
2089 #include "clang/Basic/OpenCLImageTypes.def"
2091 #define BUILTIN_TYPE(Id, SingletonId) Id,
2092 #define LAST_BUILTIN_TYPE(Id) LastKind = Id
2093 #include "clang/AST/BuiltinTypes.def"
2109 StringRef str =
getName(Policy);
2110 assert(!str.empty() && str.data()[str.size()] ==
'\0');
2135 return K >= Overload;
2171 ElementType(Element) {
2232 PointeeType(Pointee) {
2283 OriginalTy(OriginalTy), AdjustedTy(AdjustedTy) {}
2295 Profile(ID, OriginalTy, AdjustedTy);
2334 PointeeType(Pointee) {
2365 bool SpelledAsLValue) :
2370 PointeeType(Referencee)
2386 return T->PointeeType;
2394 bool SpelledAsLValue) {
2396 ID.AddBoolean(SpelledAsLValue);
2409 bool SpelledAsLValue) :
2410 ReferenceType(LValueReference, Referencee, CanonicalRef, SpelledAsLValue)
2426 ReferenceType(RValueReference, Referencee, CanonicalRef,
false) {
2449 Type(MemberPointer, CanonicalPtr,
2456 PointeeType(Pointee), Class(Cls) {
2485 const Type *Class) {
2487 ID.AddPointer(Class);
2518 bool ContainsUnexpandedParameterPack)
2522 ContainsUnexpandedParameterPack),
2558 :
ArrayType(ConstantArray, et, can, sm, tq,
2568 const llvm::APInt &
getSize()
const {
return Size; }
2577 const llvm::APInt &NumElements);
2589 unsigned TypeQuals) {
2591 ID.AddInteger(ArraySize.getZExtValue());
2592 ID.AddInteger(SizeMod);
2593 ID.AddInteger(TypeQuals);
2607 :
ArrayType(IncompleteArray, et, can, sm, tq,
2628 ID.AddInteger(SizeMod);
2629 ID.AddInteger(TypeQuals);
2658 :
ArrayType(VariableArray, et, can, sm, tq,
2660 SizeExpr((
Stmt*) e), Brackets(brackets) {}
2667 return (
Expr*) SizeExpr;
2683 llvm_unreachable(
"Cannot unique VariableArrayTypes.");
2723 return (
Expr*) SizeExpr;
2746 unsigned TypeQuals,
Expr *
E);
2824 return NumElements > VectorTypeBitfields::MaxNumElements;
2842 ID.AddInteger(NumElements);
2843 ID.AddInteger(TypeClass);
2844 ID.AddInteger(VecKind);
2866 case 'x':
case 'r':
return 0;
2867 case 'y':
case 'g':
return 1;
2868 case 'z':
case 'b':
return 2;
2869 case 'w':
case 'a':
return 3;
2886 case 'a':
return 10;
2888 case 'b':
return 11;
2890 case 'c':
return 12;
2892 case 'd':
return 13;
2894 case 'e':
return 14;
2896 case 'f':
return 15;
2901 if (isNumericAccessor)
2957 enum { CallConvMask = 0x1F };
2958 enum { NoReturnMask = 0x20 };
2959 enum { ProducesResultMask = 0x40 };
2960 enum { NoCallerSavedRegsMask = 0x80 };
2962 RegParmMask = ~(CallConvMask | NoReturnMask | ProducesResultMask |
2963 NoCallerSavedRegsMask),
2969 ExtInfo(
unsigned Bits) : Bits(static_cast<uint16_t>(Bits)) {}
2977 bool producesResult,
bool noCallerSavedRegs) {
2978 assert((!hasRegParm || regParm < 7) &&
"Invalid regparm value");
2979 Bits = ((
unsigned)cc) | (noReturn ? NoReturnMask : 0) |
2980 (producesResult ? ProducesResultMask : 0) |
2981 (noCallerSavedRegs ? NoCallerSavedRegsMask : 0) |
2982 (hasRegParm ? ((regParm + 1) << RegParmOffset) : 0);
2998 unsigned RegParm = Bits >> RegParmOffset;
3006 return Bits == Other.Bits;
3009 return Bits != Other.Bits;
3017 return ExtInfo(Bits | NoReturnMask);
3019 return ExtInfo(Bits & ~NoReturnMask);
3024 return ExtInfo(Bits | ProducesResultMask);
3026 return ExtInfo(Bits & ~ProducesResultMask);
3030 if (noCallerSavedRegs)
3031 return ExtInfo(Bits | NoCallerSavedRegsMask);
3033 return ExtInfo(Bits & ~NoCallerSavedRegsMask);
3037 assert(RegParm < 7 &&
"Invalid regparm value");
3038 return ExtInfo((Bits & ~RegParmMask) |
3039 ((RegParm + 1) << RegParmOffset));
3043 return ExtInfo((Bits & ~CallConvMask) | (
unsigned) cc);
3047 ID.AddInteger(Bits);
3053 QualType Canonical,
bool Dependent,
3054 bool InstantiationDependent,
3055 bool VariablyModified,
bool ContainsUnexpandedParameterPack,
3057 :
Type(tc, Canonical, Dependent, InstantiationDependent, VariablyModified,
3058 ContainsUnexpandedParameterPack),
3154 HasPassObjSize = 0x20,
3167 copy.Data = (copy.Data & ~ABIMask) |
unsigned(kind);
3174 return (Data & IsConsumed);
3179 copy.Data |= IsConsumed;
3181 copy.Data &= ~IsConsumed;
3187 return Data & HasPassObjSize;
3191 Copy.Data |= HasPassObjSize;
3203 return lhs.Data == rhs.Data;
3206 return lhs.Data != rhs.Data;
3213 SourceDecl(nullptr), SourceTemplate(nullptr) {}
3216 :
Type(EST), NoexceptExpr(nullptr), SourceDecl(nullptr),
3217 SourceTemplate(nullptr) {}
3236 : Variadic(
false), HasTrailingReturn(
false), TypeQuals(0),
3237 RefQualifier(
RQ_None), ExtParameterInfos(nullptr) {}
3241 RefQualifier(
RQ_None), ExtParameterInfos(nullptr) {}
3251 bool HasTrailingReturn : 1;
3261 static bool containsAnyUnexpandedParameterPack(
const QualType *ArgArray,
3263 for (
unsigned Idx = 0; Idx < numArgs; ++Idx)
3271 QualType canonical,
const ExtProtoInfo &epi);
3274 unsigned NumParams : 15;
3277 unsigned NumExceptions : 9;
3280 unsigned ExceptionSpecType : 4;
3283 unsigned HasExtParameterInfos : 1;
3286 unsigned Variadic : 1;
3289 unsigned HasTrailingReturn : 1;
3313 assert(hasExtParameterInfos());
3316 const char *ptr =
reinterpret_cast<const char *
>(exception_begin());
3317 ptr += getExceptionSpecSize();
3322 size_t getExceptionSpecSize()
const {
3323 switch (getExceptionSpecType()) {
3334 llvm_unreachable(
"bad exception specification kind");
3340 assert(i < NumParams &&
"invalid parameter index");
3341 return param_type_begin()[i];
3344 return llvm::makeArrayRef(param_type_begin(), param_type_end());
3365 if (hasExtParameterInfos())
3376 return getExceptionSpecType() !=
EST_None;
3387 bool hasDependentExceptionSpec()
const;
3390 bool hasInstantiationDependentExceptionSpec()
const;
3400 NoexceptResult getNoexceptSpec(
const ASTContext &Ctx)
const;
3403 assert(i < NumExceptions &&
"Invalid exception number!");
3404 return exception_begin()[i];
3410 return *
reinterpret_cast<Expr *
const *
>(param_type_end());
3420 return reinterpret_cast<FunctionDecl *
const *
>(param_type_end())[0];
3429 return reinterpret_cast<FunctionDecl *
const *
>(param_type_end())[1];
3438 return ResultIfDependent ? canThrow(Ctx) !=
CT_Can
3450 bool isTemplateVariadic()
const;
3469 return reinterpret_cast<const QualType *
>(
this+1);
3472 return param_type_begin() + NumParams;
3478 return llvm::makeArrayRef(exception_begin(), exception_end());
3482 return param_type_end();
3486 return exception_begin();
3487 return exception_begin() + NumExceptions;
3494 assert(hasExtParameterInfos());
3502 if (!hasExtParameterInfos())
3504 return getExtParameterInfosBuffer();
3508 assert(I < getNumParams() &&
"parameter index out of range");
3509 if (hasExtParameterInfos())
3510 return getExtParameterInfosBuffer()[
I];
3515 assert(I < getNumParams() &&
"parameter index out of range");
3516 if (hasExtParameterInfos())
3517 return getExtParameterInfosBuffer()[
I].getABI();
3522 assert(I < getNumParams() &&
"parameter index out of range");
3523 if (hasExtParameterInfos())
3524 return getExtParameterInfosBuffer()[
I].isConsumed();
3531 void printExceptionSpecification(raw_ostream &OS,
3538 void Profile(llvm::FoldingSetNodeID &
ID,
const ASTContext &Ctx);
3540 param_type_iterator ArgTys,
unsigned NumArgs,
3556 Decl(const_cast<UnresolvedUsingTypenameDecl*>(D)) {}
3570 return Profile(ID,
Decl);
3588 assert(!isa<TypedefType>(can) &&
"Invalid canonical type");
3615 bool isSugared()
const;
3635 Profile(ID,
Context, getUnderlyingExpr());
3651 assert(!isa<TypedefType>(can) &&
"Invalid canonical type");
3682 bool isSugared()
const;
3700 Profile(ID, Context, getUnderlyingExpr());
3703 static void Profile(llvm::FoldingSetNodeID &
ID,
const ASTContext &Context,
3746 public llvm::FoldingSetNode {
3751 Profile(ID, getBaseType(), getUTTKind());
3757 ID.AddInteger((
unsigned)UKind);
3775 bool isBeingDefined()
const;
3850 FirstExprOperandKind = attr_address_space,
3851 LastExprOperandKind = attr_neon_polyvector_type,
3859 FirstEnumOperandKind = attr_objc_gc,
3860 LastEnumOperandKind = attr_pcs_vfp,
3901 ModifiedType(modified), EquivalentType(equivalent) {
3931 bool isQualifier()
const;
3933 bool isMSTypeSpec()
const;
3935 bool isCallingConv()
const;
3944 return attr_nonnull;
3947 return attr_nullable;
3950 return attr_null_unspecified;
3952 llvm_unreachable(
"Unknown nullability kind.");
3967 Profile(ID, getAttrKind(), ModifiedType, EquivalentType);
3972 ID.AddInteger(attrKind);
3984 struct CanonicalTTPTInfo {
3985 unsigned Depth : 15;
3986 unsigned ParameterPack : 1;
3987 unsigned Index : 16;
3999 :
Type(TemplateTypeParm, Canon,
true,
4003 TTPDecl(TTPDecl) { }
4006 TemplateTypeParmType(
unsigned D,
unsigned I,
bool PP)
4007 : Type(TemplateTypeParm,
QualType(this, 0),
4011 CanTTPTInfo.Depth = D;
4012 CanTTPTInfo.Index =
I;
4013 CanTTPTInfo.ParameterPack = PP;
4018 const CanonicalTTPTInfo& getCanTTPTInfo()
const {
4024 unsigned getDepth()
const {
return getCanTTPTInfo().Depth; }
4025 unsigned getIndex()
const {
return getCanTTPTInfo().Index; }
4038 Profile(ID, getDepth(), getIndex(), isParameterPack(), getDecl());
4042 unsigned Index,
bool ParameterPack,
4044 ID.AddInteger(Depth);
4045 ID.AddInteger(Index);
4046 ID.AddBoolean(ParameterPack);
4047 ID.AddPointer(TTPDecl);
4091 Profile(ID, getReplacedParameter(), getReplacementType());
4096 ID.AddPointer(Replaced);
4126 unsigned NumArguments;
4147 void Profile(llvm::FoldingSetNodeID &
ID);
4148 static void Profile(llvm::FoldingSetNodeID &
ID,
4169 bool IsInstantiationDependent,
bool ContainsParameterPack)
4172 DeducedAsType.isNull() ?
QualType(this, 0)
4173 : DeducedAsType.getCanonicalType(),
4174 IsDependent, IsInstantiationDependent,
4175 false, ContainsParameterPack) {
4176 if (!DeducedAsType.
isNull()) {
4208 bool IsDeducedAsDependent)
4210 IsDeducedAsDependent,
false) {
4231 ID.AddInteger((
unsigned)Keyword);
4232 ID.AddBoolean(IsDependent);
4242 public llvm::FoldingSetNode {
4248 bool IsDeducedAsDependent)
4249 :
DeducedType(DeducedTemplateSpecialization, DeducedAsType,
4253 Template(Template) {}
4266 QualType Deduced,
bool IsDependent) {
4269 ID.AddBoolean(IsDependent);
4273 return T->
getTypeClass() == DeducedTemplateSpecialization;
4299 public llvm::FoldingSetNode {
4311 unsigned NumArgs : 31;
4314 unsigned TypeAlias : 1;
4326 bool &InstantiationDependent);
4329 bool &InstantiationDependent);
4333 static void PrintTemplateArgumentList(raw_ostream &OS,
4336 bool SkipBrackets =
false);
4338 static void PrintTemplateArgumentList(raw_ostream &OS,
4342 static void PrintTemplateArgumentList(raw_ostream &OS,
4372 assert(isTypeAlias() &&
"not a type alias template specialization");
4373 return *
reinterpret_cast<const QualType*
>(end());
4379 iterator end()
const;
4397 return {getArgs(), NumArgs};
4401 return !
isDependentType() || isCurrentInstantiation() || isTypeAlias();
4406 Profile(ID, Template, template_arguments(), Ctx);
4408 getAliasedType().Profile(ID);
4462 Decl(D), InjectedType(TST) {
4463 assert(isa<TemplateSpecializationType>(TST));
4471 return cast<TemplateSpecializationType>(InjectedType.getTypePtr());
4474 return getInjectedTST()->getTemplateName();
4528 QualType Canonical,
bool Dependent,
4529 bool InstantiationDependent,
bool VariablyModified,
4530 bool ContainsUnexpandedParameterPack)
4531 :
Type(tc, Canonical, Dependent, InstantiationDependent, VariablyModified,
4532 ContainsUnexpandedParameterPack) {
4546 static TagTypeKind getTagTypeKindForTypeSpec(
unsigned TypeSpec);
4561 return getKeywordName(getKeywordForTagTypeKind(Kind));
4591 NNS(NNS), NamedType(NamedType) {
4592 assert(!(Keyword ==
ETK_None && NNS ==
nullptr) &&
4593 "ElaboratedType cannot have elaborated type keyword "
4594 "and name qualifier both null.");
4615 Profile(ID, getKeyword(), NNS, NamedType);
4620 ID.AddInteger(Keyword);
4656 NNS(NNS),
Name(Name) {}
4677 Profile(ID, getKeyword(), NNS, Name);
4682 ID.AddInteger(Keyword);
4684 ID.AddPointer(Name);
4697 public llvm::FoldingSetNode {
4730 return getArgBuffer();
4739 return {getArgs(), NumArgs};
4744 iterator end()
const;
4750 Profile(ID, Context, getKeyword(), NNS, Name, {getArgs(), NumArgs});
4753 static void Profile(llvm::FoldingSetNodeID &
ID,
4761 return T->
getTypeClass() == DependentTemplateSpecialization;
4797 unsigned NumExpansions;
4806 NumExpansions(NumExpansions? *NumExpansions + 1: 0) { }
4820 return NumExpansions - 1;
4829 Profile(ID, getPattern(), getNumExpansions());
4835 ID.AddBoolean(NumExpansions.hasValue());
4837 ID.AddInteger(*NumExpansions);
4856 return static_cast<T*
>(
this)->getProtocolStorageImpl();
4859 static_cast<T*
>(
this)->setNumProtocolsImpl(N);
4862 setNumProtocols(protocols.size());
4863 assert(getNumProtocols() == protocols.size() &&
4864 "bitfield overflow in protocol count");
4865 if (!protocols.empty())
4866 memcpy(getProtocolStorage(), protocols.data(),
4883 return static_cast<const T*
>(
this)->getNumProtocolsImpl();
4888 assert(I < getNumProtocols() &&
"Out-of-range protocol access");
4889 return qual_begin()[
I];
4902 public llvm::FoldingSetNode {
4907 unsigned NumProtocols : 6;
4916 unsigned getNumProtocolsImpl()
const {
4917 return NumProtocols;
4919 void setNumProtocolsImpl(
unsigned N) {
4922 ObjCTypeParamType(
const ObjCTypeParamDecl *D,
4924 ArrayRef<ObjCProtocolDecl *> protocols);
4933 void Profile(llvm::FoldingSetNodeID &
ID);
4934 static void Profile(llvm::FoldingSetNodeID &
ID,
4988 mutable llvm::PointerIntPair<const ObjCObjectType *, 1, bool>
4989 CachedSuperClassType;
4992 const QualType *getTypeArgStorage()
const {
4999 unsigned getNumProtocolsImpl()
const {
5002 void setNumProtocolsImpl(
unsigned N) {
5008 ArrayRef<QualType> typeArgs,
5009 ArrayRef<ObjCProtocolDecl *> protocols,
5021 void computeSuperClassTypeSlow()
const;
5033 return getBaseType()->isSpecificBuiltinType(BuiltinType::ObjCId);
5036 return getBaseType()->isSpecificBuiltinType(BuiltinType::ObjCClass);
5041 if (!qual_empty())
return false;
5042 if (
const BuiltinType *T = getBaseType()->getAs<BuiltinType>())
5043 return T->getKind() == BuiltinType::ObjCId ||
5044 T->getKind() == BuiltinType::ObjCClass;
5056 bool isSpecialized()
const;
5077 return llvm::makeArrayRef(getTypeArgStorage(),
5085 bool isKindOfType()
const;
5094 if (!CachedSuperClassType.getInt())
5095 computeSuperClassTypeSlow();
5097 assert(CachedSuperClassType.getInt() &&
"Superclass not set?");
5098 return QualType(CachedSuperClassType.getPointer(), 0);
5128 :
ObjCObjectType(Canonical, Base, typeArgs, protocols, isKindOf) {}
5131 void Profile(llvm::FoldingSetNodeID &
ID);
5132 static void Profile(llvm::FoldingSetNodeID &
ID,
5139 inline QualType *ObjCObjectType::getTypeArgStorage() {
5140 return reinterpret_cast<QualType *
>(
static_cast<ObjCObjectTypeImpl*
>(
this)+1);
5143 inline ObjCProtocolDecl **ObjCObjectType::getProtocolStorageImpl() {
5144 return reinterpret_cast<ObjCProtocolDecl**
>(
5148 inline ObjCProtocolDecl **ObjCTypeParamType::getProtocolStorageImpl() {
5149 return reinterpret_cast<ObjCProtocolDecl**
>(
5150 static_cast<ObjCTypeParamType*
>(
this)+1);
5170 Decl(const_cast<ObjCInterfaceDecl*>(D)) {}
5203 return T->getDecl();
5205 baseType = ObjT->getBaseType();
5224 :
Type(ObjCObjectPointer, Canonical,
5229 PointeeType(Pointee) {}
5370 QualType getSuperClassType()
const;
5408 Profile(ID, getValueType());
5428 ElementType(elemType), isRead(isRead) {}
5439 Profile(ID, getElementType(), isReadOnly());
5444 ID.AddBoolean(isRead);
5465 return type.getTypePtrUnsafe();
5467 const ExtQuals *extQuals = type.getExtQualsUnsafe();
5484 Ty->getLocallyUnqualifiedSingleStepDesugaredType().split();
5490 return getCommonPtr()->BaseType;
5494 return (isNull() ?
nullptr : getCommonPtr()->BaseType);
5498 if (!hasLocalNonFastQualifiers())
5502 const ExtQuals *eq = getExtQualsUnsafe();
5510 if (hasLocalNonFastQualifiers())
5511 Quals = getExtQualsUnsafe()->getQualifiers();
5517 Qualifiers quals = getCommonPtr()->CanonicalType.getLocalQualifiers();
5523 unsigned cvr = getCommonPtr()->CanonicalType.getLocalCVRQualifiers();
5524 cvr |= getLocalCVRQualifiers();
5529 QualType canon = getCommonPtr()->CanonicalType;
5534 return getTypePtr()->isCanonicalUnqualified();
5538 if (!isCanonical())
return false;
5539 if (hasLocalQualifiers())
return false;
5541 const Type *T = getTypePtr();
5545 return !isa<FunctionType>(T) && !isa<ArrayType>(T);
5549 return isLocalConstQualified() ||
5550 getCommonPtr()->CanonicalType.isLocalConstQualified();
5554 return isLocalRestrictQualified() ||
5555 getCommonPtr()->CanonicalType.isLocalRestrictQualified();
5560 return isLocalVolatileQualified() ||
5561 getCommonPtr()->CanonicalType.isLocalVolatileQualified();
5565 return hasLocalQualifiers() ||
5566 getCommonPtr()->CanonicalType.hasLocalQualifiers();
5573 return QualType(getSplitUnqualifiedTypeImpl(*this).Ty, 0);
5580 return getSplitUnqualifiedTypeImpl(*
this);
5598 "Fast bits differ from CVR bits!");
5601 removeLocalFastQualifiers(Mask);
5606 return getQualifiers().getAddressSpace();
5611 return getQualifiers().getObjCGCAttr();
5617 return FT->getExtInfo();
5619 return FT->getExtInfo();
5650 return getQualifiers().compatiblyIncludes(OtherQuals);
5670 return ((getTypePtr()->
isVoidType() && !hasQualifiers()) ||
5710 return isa<FunctionType>(CanonicalType);
5713 return isa<PointerType>(CanonicalType);
5719 return isa<BlockPointerType>(CanonicalType);
5722 return isa<ReferenceType>(CanonicalType);
5725 return isa<LValueReferenceType>(CanonicalType);
5728 return isa<RValueReferenceType>(CanonicalType);
5732 return T->getPointeeType()->isFunctionType();
5737 return isa<MemberPointerType>(CanonicalType);
5741 return T->isMemberFunctionPointer();
5747 return T->isMemberDataPointer();
5752 return isa<ArrayType>(CanonicalType);
5755 return isa<ConstantArrayType>(CanonicalType);
5758 return isa<IncompleteArrayType>(CanonicalType);
5761 return isa<VariableArrayType>(CanonicalType);
5764 return isa<DependentSizedArrayType>(CanonicalType);
5767 return isa<BuiltinType>(CanonicalType);
5770 return isa<RecordType>(CanonicalType);
5773 return isa<EnumType>(CanonicalType);
5776 return isa<ComplexType>(CanonicalType);
5779 return isa<VectorType>(CanonicalType);
5782 return isa<ExtVectorType>(CanonicalType);
5785 return isa<ObjCObjectPointerType>(CanonicalType);
5788 return isa<ObjCObjectType>(CanonicalType);
5791 return isa<ObjCInterfaceType>(CanonicalType) ||
5792 isa<ObjCObjectType>(CanonicalType);
5795 return isa<AtomicType>(CanonicalType);
5800 return OPT->isObjCQualifiedIdType();
5805 return OPT->isObjCQualifiedClassType();
5810 return OPT->isObjCIdType();
5815 return OPT->isObjCClassType();
5819 if (
const PointerType *OPT = getAs<PointerType>())
5820 return OPT->getPointeeType()->isSpecificBuiltinType(BuiltinType::ObjCSel);
5827 #define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \
5828 inline bool Type::is##Id##Type() const { \
5829 return isSpecificBuiltinType(BuiltinType::Id); \
5831 #include "clang/Basic/OpenCLImageTypes.def"
5854 #define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) is##Id##Type() ||
5856 #include "clang/Basic/OpenCLImageTypes.def"
5861 return isa<PipeType>(CanonicalType);
5870 return isa<TemplateTypeParmType>(CanonicalType);
5881 if (
const BuiltinType *BT = dyn_cast<BuiltinType>(
this))
5882 return BT->isPlaceholderType();
5887 if (
const BuiltinType *BT = dyn_cast<BuiltinType>(
this))
5888 if (BT->isPlaceholderType())
5895 if (
const BuiltinType *BT = dyn_cast<BuiltinType>(
this))
5901 if (
const BuiltinType *BT = dyn_cast<BuiltinType>(
this))
5902 return BT->isNonOverloadPlaceholderType();
5907 if (
const BuiltinType *BT = dyn_cast<BuiltinType>(CanonicalType))
5908 return BT->getKind() == BuiltinType::Void;
5913 if (
const BuiltinType *BT = dyn_cast<BuiltinType>(CanonicalType))
5914 return BT->getKind() == BuiltinType::Half;
5921 return BT->getKind() == BuiltinType::NullPtr;
5929 if (
const BuiltinType *BT = dyn_cast<BuiltinType>(CanonicalType))
5930 return BT->getKind() >= BuiltinType::Bool &&
5931 BT->getKind() <= BuiltinType::Int128;
5932 if (
const EnumType *ET = dyn_cast<EnumType>(CanonicalType)) {
5942 if (
const BuiltinType *BT = dyn_cast<BuiltinType>(CanonicalType))
5943 return BT->getKind() > BuiltinType::Void &&
5944 BT->getKind() <= BuiltinType::NullPtr;
5945 if (
const EnumType *ET = dyn_cast<EnumType>(CanonicalType))
5949 return isa<PointerType>(CanonicalType) ||
5950 isa<BlockPointerType>(CanonicalType) ||
5951 isa<MemberPointerType>(CanonicalType) ||
5952 isa<ComplexType>(CanonicalType) ||
5953 isa<ObjCObjectPointerType>(CanonicalType);
5957 if (
const BuiltinType *BT = dyn_cast<BuiltinType>(CanonicalType))
5958 return BT->getKind() >= BuiltinType::Bool &&
5959 BT->getKind() <= BuiltinType::Int128;
5963 if (
const EnumType *ET = dyn_cast<EnumType>(CanonicalType))
5970 if (
const BuiltinType *BT = dyn_cast<BuiltinType>(CanonicalType))
5971 return BT->getKind() == BuiltinType::Bool;
5977 return DT && !DT->isDeduced();
6003 type = arrayType->getElementType().getTypePtr();
6036 template <
typename T>
6038 std::integral_constant<bool, std::is_same<T, ArrayType>::value ||
6039 std::is_base_of<ArrayType, T>::value>;
6044 "ArrayType cannot be used with getAs!");
6047 if (
const T *Ty = dyn_cast<T>(
this))
6051 if (!isa<T>(CanonicalType))
6063 if (
const T *Ty = dyn_cast<T>(
this))
6067 if (!isa<T>(CanonicalType))
6072 const Type *Ty =
this;
6074 if (
const auto *A = dyn_cast<AttributedType>(Ty))
6075 Ty = A->getModifiedType().getTypePtr();
6076 else if (
const auto *
E = dyn_cast<ElaboratedType>(Ty))
6077 Ty =
E->desugar().getTypePtr();
6078 else if (
const auto *
P = dyn_cast<ParenType>(Ty))
6079 Ty =
P->desugar().getTypePtr();
6080 else if (
const auto *A = dyn_cast<AdjustedType>(Ty))
6081 Ty = A->desugar().getTypePtr();
6088 return dyn_cast<T>(Ty);
6093 if (
const ArrayType *arr = dyn_cast<ArrayType>(
this))
6097 if (!isa<ArrayType>(CanonicalType))
6107 "ArrayType cannot be used with castAs!");
6109 if (
const T *ty = dyn_cast<T>(
this))
return ty;
6110 assert(isa<T>(CanonicalType));
6115 assert(isa<ArrayType>(CanonicalType));
6116 if (
const ArrayType *arr = dyn_cast<ArrayType>(
this))
return arr;
6122 :
AdjustedType(Decayed, OriginalType, DecayedPtr, CanonicalPtr) {
6124 QualType Adjusted = getAdjustedType();
6126 assert(isa<PointerType>(Adjusted));
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
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.
void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Ctx)
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)
TemplateName getTemplateName() const
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.
const TemplateArgument * iterator
static void Profile(llvm::FoldingSetNodeID &ID, QualType Pointee)
const T * getAsAdjusted() const
Member-template getAsAdjusted<specific type>.
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)
Stmt - This represents one statement.
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.
unsigned getNumArgs() const
Retrieve the number of template arguments.
static void Profile(llvm::FoldingSetNodeID &ID, Kind attrKind, QualType modified, QualType equivalent)
void Profile(llvm::FoldingSetNodeID &ID)
bool hasAutoForTrailingReturnType() const
Determine whether this type was written with a leading 'auto' corresponding to a trailing return 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...
ObjCProtocolDecl *const * getProtocolStorage() const
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)
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)
Decl - This represents one declaration (or definition), e.g.
bool isChar16Type() const
ObjCObjectTypeBitfields ObjCObjectTypeBits
bool isLiteralType(const ASTContext &Ctx) const
Return true if this is a literal type (C++11 [basic.types]p10)
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)
ExtInfo withNoCallerSavedRegs(bool noCallerSavedRegs) const
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)
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 isAccessorWithinNumElements(char c, bool isNumericAccessor) 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()
ObjCProtocolDecl *const * qual_iterator
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
Represents a C++17 deduced template specialization type.
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 canHaveNullability(bool ResultIfUnknown=true) const
Determine whether the given type can have a nullability specifier applied to it, i.e., if it is any kind of pointer type.
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...
unsigned getNumArgs() const
Retrieve the number of template arguments.
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)
void AddTaggedVal(intptr_t V, DiagnosticsEngine::ArgumentKind Kind) const
The width of the "fast" qualifier mask.
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
AutoType * getContainedAutoType() const
Get the AutoType whose type will be deduced for a variable with an initializer of this type...
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.
const TemplateArgument * iterator
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...
Represents a class type in Objective C.
qual_iterator qual_begin() const
Expr * getSizeExpr() 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...
static bool classof(const Type *T)
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.
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.
bool hasTargetSpecificAddressSpace() const
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)
static bool classof(const Type *T)
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...
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)
ArrayRef< ObjCProtocolDecl * > getProtocols() const
Retrieve all of the protocol qualifiers.
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)
TemplateName getTemplateName() const
Retrieve the name of the template that we are specializing.
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.
UnresolvedUsingTypenameDecl * getDecl() const
ExtParameterInfo withHasPassObjectSize() 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)
Defines the Diagnostic-related interfaces.
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
QualType getAliasedType() const
Get the aliased type, if this is a specialization of a type alias template.
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.
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.
bool containsUnexpandedParameterPack() const
Determines whether this template name contains an unexpanded parameter pack (for C++0x variadic templ...
bool isFloatingPoint() const
const Type * operator->() const
Qualifiers::ObjCLifetime getObjCLifetime() const
Returns lifetime attribute of this type.
param_type_iterator param_type_begin() const
This class wraps the list of protocol qualifiers.
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)
ObjCProtocolDecl ** getProtocolStorage()
bool getNoCallerSavedRegs() const
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.
static bool classof(const Type *T)
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.
static bool classof(const Type *T)
bool isAtomicType() const
bool isUnsignedInteger() const
void Profile(llvm::FoldingSetNodeID &ID)
void setAddressSpace(unsigned space)
bool isTypeAlias() const
Determine if this template specialization type is for a type alias template that has been substituted...
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
bool isInstantiationDependent() const
Determines whether this is a template name that somehow depends on a template parameter.
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)
bool hasPassObjectSize() const
SourceLocation getAttributeLoc() const
static Optional< NullabilityKind > stripOuterNullability(QualType &T)
Strip off the top-level nullability annotation on the given type, if it's there.
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
Common base class for placeholders for types that get replaced by placeholder type deduction: C++11 a...
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)
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...
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
const IdentifierInfo * getIdentifier() const
CXXRecordDecl * getMostRecentCXXRecordDecl() const
CanThrowResult
Possible results from evaluation of a noexcept expression.
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)
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...
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.
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 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.
TemplateName getTemplateName() const
Retrieve the name of the template that we are deducing.
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.
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.
bool isNothrow(const ASTContext &Ctx, bool ResultIfDependent=false) const
Determine whether this function type has a non-throwing exception specification.
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
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...
void Profile(llvm::FoldingSetNodeID &ID)
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
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)
Qualifiers & operator-=(Qualifiers R)
bool isVectorType() const
ObjCProtocolDecl * getProtocol(unsigned I) const
Fetch a protocol by index.
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
ArrayRef< TemplateArgument > template_arguments() 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)
ParameterABI
Kinds of parameter ABI.
ObjCTypeParamDecl * getDecl() const
DeducedType * getContainedDeducedType() const
Get the DeducedType whose type will be deduced for a variable with an initializer of this type...
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.
bool isStdByteType() 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...
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
bool isDependent() const
Determines whether this is a dependent template name.
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.
Represents the declaration of an Objective-C type parameter.
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
The maximum supported address space number.
A pointer to member type per C++ 8.3.3 - Pointers to members.
unsigned getNumProtocols() const
Return the number of qualifying protocols in this type, or 0 if there are none.
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
bool isCurrentInstantiation() const
True if this template specialization type matches a current instantiation in the context in which it ...
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
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...
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 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
const TemplateArgument * getArgs() const
Retrieve the template arguments.
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)
qual_iterator qual_end() const
bool isObjCNSObjectType() const
llvm::iterator_range< qual_iterator > qual_range
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
std::integral_constant< bool, std::is_same< T, ArrayType >::value||std::is_base_of< ArrayType, T >::value > TypeIsArrayType
static bool classof(const Type *T)
bool isFunctionType() const
ExtVectorType - Extended vector type.
ArrayRef< TemplateArgument > template_arguments() const
QualType getInnerType() const
const TemplateArgument * getArgs() const
Retrieve the template arguments.
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
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)
static bool classof(const Type *T)
Implements a partial diagnostic that can be emitted anwyhere in a DiagnosticBuilder stream...
NestedNameSpecifier * getQualifier() const
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
Represents a type parameter type in Objective C.
bool isBlockCompatibleObjCPointerType(ASTContext &ctx) const
bool isObjCClassType() const
True if this is equivalent to the 'Class' type, i.e.
void Profile(llvm::FoldingSetNodeID &ID)
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()
Represents a template specialization type whose template cannot be resolved, e.g. ...
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
DeducedType(TypeClass TC, QualType DeducedAsType, bool IsDependent, bool IsInstantiationDependent, bool ContainsParameterPack)
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 getDeducedType() const
Get the type deduced for this placeholder type, or null if it's either not been deduced or was deduce...
QualType getPointeeTypeAsWritten() const
bool getHasRegParm() const
TagDecl * getDecl() const
bool isObjCIndirectLifetimeType() const
bool isIncompleteArrayType() const
unsigned getAddressSpaceAttributePrintValue() const
Get the address space attribute value to be printed by diagnostics.
SourceLocation getRBracketLoc() const
Qualifiers getQualifiers() const
void initialize(ArrayRef< ObjCProtocolDecl * > protocols)
void Profile(llvm::FoldingSetNodeID &ID) const
Represents a type template specialization; the template must be a class template, a type alias templa...
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
ExtInfo(bool noReturn, bool hasRegParm, unsigned regParm, CallingConv cc, bool producesResult, bool noCallerSavedRegs)
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.
static int getAccessorIdx(char c, bool isNumericAccessor)
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.
void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Context)
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())
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)
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
static void Profile(llvm::FoldingSetNodeID &ID, TemplateName Template, QualType Deduced, bool IsDependent)
bool isIncompleteOrObjectType() const
Return true if this is an incomplete or object type, in other words, not a function type...