-
Notifications
You must be signed in to change notification settings - Fork 787
Implement _ExtInt as an extended int type specifier. #1067
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -2117,6 +2117,7 @@ class alignas(8) Type : public ExtQualsTypeCommonBase { | |||||
bool isOCLExtOpaqueType() const; // Any OpenCL extension type | ||||||
|
||||||
bool isPipeType() const; // OpenCL pipe type | ||||||
bool isExtIntType() const; // Extended Int Type | ||||||
bool isOpenCLSpecificType() const; // Any OpenCL specific type | ||||||
|
||||||
/// Determines if this type, which must satisfy | ||||||
|
@@ -6162,6 +6163,63 @@ class PipeType : public Type, public llvm::FoldingSetNode { | |||||
bool isReadOnly() const { return isRead; } | ||||||
}; | ||||||
|
||||||
// A fixed int type of a specified bitwidth. | ||||||
class ExtIntType : public Type, public llvm::FoldingSetNode { | ||||||
friend class ASTContext; | ||||||
bool IsUnsigned; | ||||||
unsigned NumBits; | ||||||
|
||||||
protected: | ||||||
ExtIntType(bool isUnsigned, unsigned NumBits); | ||||||
|
||||||
public: | ||||||
bool isUnsigned() const { return IsUnsigned; } | ||||||
unsigned getNumBits() const { return NumBits; } | ||||||
|
||||||
bool isSugared() const { return false; } | ||||||
QualType desugar() const { return QualType(this, 0); } | ||||||
|
||||||
void Profile(llvm::FoldingSetNodeID &ID) { | ||||||
Profile(ID, isUnsigned(), getNumBits()); | ||||||
} | ||||||
|
||||||
static void Profile(llvm::FoldingSetNodeID &ID, bool IsUnsigned, | ||||||
unsigned NumBits) { | ||||||
ID.AddBoolean(IsUnsigned); | ||||||
ID.AddInteger(NumBits); | ||||||
} | ||||||
|
||||||
static bool classof(const Type *T) { return T->getTypeClass() == ExtInt; } | ||||||
}; | ||||||
|
||||||
class DependentExtIntType : public Type, public llvm::FoldingSetNode { | ||||||
friend class ASTContext; | ||||||
const ASTContext &Context; | ||||||
bool IsUnsigned; | ||||||
Expr *NumBitsExpr; | ||||||
|
||||||
protected: | ||||||
DependentExtIntType(const ASTContext &Context, bool IsUnsigned, | ||||||
Expr *NumBits); | ||||||
|
||||||
public: | ||||||
bool isUnsigned() const { return IsUnsigned; } | ||||||
Expr *getNumBitsExpr() const { return NumBitsExpr; } | ||||||
|
||||||
bool isSugared() const { return false; } | ||||||
QualType desugar() const { return QualType(this, 0); } | ||||||
|
||||||
void Profile(llvm::FoldingSetNodeID &ID) { | ||||||
Profile(ID, Context, isUnsigned(), getNumBitsExpr()); | ||||||
} | ||||||
static void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Context, | ||||||
bool IsUnsigned, Expr *NumBitsExpr); | ||||||
|
||||||
static bool classof(const Type *T) { | ||||||
return T->getTypeClass() == DependentExtInt; | ||||||
} | ||||||
}; | ||||||
|
||||||
/// A qualifier set is used to build a set of qualifiers. | ||||||
class QualifierCollector : public Qualifiers { | ||||||
public: | ||||||
|
@@ -6681,6 +6739,10 @@ inline bool Type::isPipeType() const { | |||||
return isa<PipeType>(CanonicalType); | ||||||
} | ||||||
|
||||||
inline bool Type::isExtIntType() const { | ||||||
return isa<ExtIntType>(CanonicalType); | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
} | ||||||
|
||||||
#define EXT_OPAQUE_TYPE(ExtType, Id, Ext) \ | ||||||
inline bool Type::is##Id##Type() const { \ | ||||||
return isSpecificBuiltinType(BuiltinType::Id); \ | ||||||
|
@@ -6788,7 +6850,7 @@ inline bool Type::isIntegerType() const { | |||||
return IsEnumDeclComplete(ET->getDecl()) && | ||||||
!IsEnumDeclScoped(ET->getDecl()); | ||||||
} | ||||||
return false; | ||||||
return isExtIntType(); | ||||||
} | ||||||
|
||||||
inline bool Type::isFixedPointType() const { | ||||||
|
@@ -6845,7 +6907,8 @@ inline bool Type::isScalarType() const { | |||||
isa<BlockPointerType>(CanonicalType) || | ||||||
isa<MemberPointerType>(CanonicalType) || | ||||||
isa<ComplexType>(CanonicalType) || | ||||||
isa<ObjCObjectPointerType>(CanonicalType); | ||||||
isa<ObjCObjectPointerType>(CanonicalType) || | ||||||
isExtIntType(); | ||||||
} | ||||||
|
||||||
inline bool Type::isIntegralOrEnumerationType() const { | ||||||
|
@@ -6858,7 +6921,7 @@ inline bool Type::isIntegralOrEnumerationType() const { | |||||
if (const auto *ET = dyn_cast<EnumType>(CanonicalType)) | ||||||
return IsEnumDeclComplete(ET->getDecl()); | ||||||
|
||||||
return false; | ||||||
return isExtIntType(); | ||||||
} | ||||||
|
||||||
inline bool Type::isBooleanType() const { | ||||||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel like it's possible to define only
DependentExtIntType
class here. But it will come in cost of extraisInstantiationDependent()
in the code.