@@ -2101,6 +2101,7 @@ class alignas(8) Type : public ExtQualsTypeCommonBase {
21012101 bool isOCLExtOpaqueType () const ; // Any OpenCL extension type
21022102
21032103 bool isPipeType () const ; // OpenCL pipe type
2104+ bool isExtIntType () const ; // Extended Int Type
21042105 bool isOpenCLSpecificType () const ; // Any OpenCL specific type
21052106
21062107 // / Determines if this type, which must satisfy
@@ -6127,6 +6128,64 @@ class PipeType : public Type, public llvm::FoldingSetNode {
61276128 bool isReadOnly () const { return isRead; }
61286129};
61296130
6131+ // / A fixed int type of a specified bitwidth.
6132+ class ExtIntType final : public Type, public llvm::FoldingSetNode {
6133+ friend class ASTContext ;
6134+ unsigned IsUnsigned : 1 ;
6135+ unsigned NumBits : 24 ;
6136+
6137+ protected:
6138+ ExtIntType (bool isUnsigned, unsigned NumBits);
6139+
6140+ public:
6141+ bool isUnsigned () const { return IsUnsigned; }
6142+ bool isSigned () const { return !IsUnsigned; }
6143+ unsigned getNumBits () const { return NumBits; }
6144+
6145+ bool isSugared () const { return false ; }
6146+ QualType desugar () const { return QualType (this , 0 ); }
6147+
6148+ void Profile (llvm::FoldingSetNodeID &ID) {
6149+ Profile (ID, isUnsigned (), getNumBits ());
6150+ }
6151+
6152+ static void Profile (llvm::FoldingSetNodeID &ID, bool IsUnsigned,
6153+ unsigned NumBits) {
6154+ ID.AddBoolean (IsUnsigned);
6155+ ID.AddInteger (NumBits);
6156+ }
6157+
6158+ static bool classof (const Type *T) { return T->getTypeClass () == ExtInt; }
6159+ };
6160+
6161+ class DependentExtIntType final : public Type, public llvm::FoldingSetNode {
6162+ friend class ASTContext ;
6163+ const ASTContext &Context;
6164+ llvm::PointerIntPair<Expr*, 1 , bool > ExprAndUnsigned;
6165+
6166+ protected:
6167+ DependentExtIntType (const ASTContext &Context, bool IsUnsigned,
6168+ Expr *NumBits);
6169+
6170+ public:
6171+ bool isUnsigned () const ;
6172+ bool isSigned () const { return !isUnsigned (); }
6173+ Expr *getNumBitsExpr () const ;
6174+
6175+ bool isSugared () const { return false ; }
6176+ QualType desugar () const { return QualType (this , 0 ); }
6177+
6178+ void Profile (llvm::FoldingSetNodeID &ID) {
6179+ Profile (ID, Context, isUnsigned (), getNumBitsExpr ());
6180+ }
6181+ static void Profile (llvm::FoldingSetNodeID &ID, const ASTContext &Context,
6182+ bool IsUnsigned, Expr *NumBitsExpr);
6183+
6184+ static bool classof (const Type *T) {
6185+ return T->getTypeClass () == DependentExtInt;
6186+ }
6187+ };
6188+
61306189// / A qualifier set is used to build a set of qualifiers.
61316190class QualifierCollector : public Qualifiers {
61326191public:
@@ -6646,6 +6705,10 @@ inline bool Type::isPipeType() const {
66466705 return isa<PipeType>(CanonicalType);
66476706}
66486707
6708+ inline bool Type::isExtIntType () const {
6709+ return isa<ExtIntType>(CanonicalType);
6710+ }
6711+
66496712#define EXT_OPAQUE_TYPE (ExtType, Id, Ext ) \
66506713 inline bool Type::is##Id##Type() const { \
66516714 return isSpecificBuiltinType (BuiltinType::Id); \
@@ -6741,7 +6804,7 @@ inline bool Type::isIntegerType() const {
67416804 return IsEnumDeclComplete (ET->getDecl ()) &&
67426805 !IsEnumDeclScoped (ET->getDecl ());
67436806 }
6744- return false ;
6807+ return isExtIntType () ;
67456808}
67466809
67476810inline bool Type::isFixedPointType () const {
@@ -6798,7 +6861,8 @@ inline bool Type::isScalarType() const {
67986861 isa<BlockPointerType>(CanonicalType) ||
67996862 isa<MemberPointerType>(CanonicalType) ||
68006863 isa<ComplexType>(CanonicalType) ||
6801- isa<ObjCObjectPointerType>(CanonicalType);
6864+ isa<ObjCObjectPointerType>(CanonicalType) ||
6865+ isExtIntType ();
68026866}
68036867
68046868inline bool Type::isIntegralOrEnumerationType () const {
@@ -6811,7 +6875,7 @@ inline bool Type::isIntegralOrEnumerationType() const {
68116875 if (const auto *ET = dyn_cast<EnumType>(CanonicalType))
68126876 return IsEnumDeclComplete (ET->getDecl ());
68136877
6814- return false ;
6878+ return isExtIntType () ;
68156879}
68166880
68176881inline bool Type::isBooleanType () const {
0 commit comments