Change return type of getEnumTag in value witness table

make it actually matches the description above
This commit is contained in:
Tongjie Wang
2022-07-13 20:40:45 -07:00
parent ff210236ed
commit d34e086c79
4 changed files with 9 additions and 10 deletions

View File

@@ -262,7 +262,7 @@ END_VALUE_WITNESS_RANGE(TypeLayoutWitness,
/// [0..NumElements-1].
FUNCTION_VALUE_WITNESS(getEnumTag,
GetEnumTag,
INT_TYPE,
UINT_TYPE,
(IMMUTABLE_VALUE_TYPE, TYPE_TYPE))
BEGIN_VALUE_WITNESS_RANGE(EnumValueWitness,

View File

@@ -228,8 +228,7 @@ void ClangValueTypePrinter::printValueTypeDecl(
"metadata._0);\n";
os << " return _getOpaquePointer();\n";
os << " }\n";
// FIXME: (tongjie) return type should be unsigned
os << " inline int _getEnumTag() const {\n";
os << " inline unsigned _getEnumTag() const {\n";
printEnumVWTableVariable();
os << " return enumVWTable->getEnumTag(_getOpaquePointer(), "
"metadata._0);\n";

View File

@@ -53,7 +53,7 @@
// CHECK-NEXT: unsigned extraInhabitantCount;
// CHECK-NEXT: };
// CHECK-EMPTY:
// CHECK-NEXT: using EnumValueWitnessGetEnumTagTy = int(* __ptrauth_swift_value_witness_function_pointer(41909))(const void * _Nonnull, void * _Nonnull) SWIFT_NOEXCEPT_FUNCTION_PTR;
// CHECK-NEXT: using EnumValueWitnessGetEnumTagTy = unsigned(* __ptrauth_swift_value_witness_function_pointer(41909))(const void * _Nonnull, void * _Nonnull) SWIFT_NOEXCEPT_FUNCTION_PTR;
// CHECK-NEXT: using EnumValueWitnessDestructiveProjectEnumDataTy = void(* __ptrauth_swift_value_witness_function_pointer(1053))(void * _Nonnull, void * _Nonnull) SWIFT_NOEXCEPT_FUNCTION_PTR;
// CHECK-NEXT: using EnumValueWitnessDestructiveInjectEnumTagTy = void(* __ptrauth_swift_value_witness_function_pointer(45796))(void * _Nonnull, unsigned, void * _Nonnull) SWIFT_NOEXCEPT_FUNCTION_PTR;
// CHECK-EMPTY:

View File

@@ -170,7 +170,7 @@ public func checkIntDoubleOrBignum(_ x: IntDoubleOrBignum, tag: Int) -> Bool {
// CHECK-NEXT: inline bool isThird() const {
// CHECK-NEXT: return *this == cases::third;
// CHECK-NEXT: }
// CHECK: inline int _getEnumTag() const {
// CHECK: inline unsigned _getEnumTag() const {
// CHECK-NEXT: auto metadata = _impl::$s5Enums12BoolWithCaseOMa(0);
// CHECK-NEXT: auto *vwTableAddr = reinterpret_cast<swift::_impl::ValueWitnessTable **>(metadata._0) - 1;
// CHECK-NEXT: #ifdef __arm64e__
@@ -201,7 +201,7 @@ public func checkIntDoubleOrBignum(_ x: IntDoubleOrBignum, tag: Int) -> Bool {
// CHECK: inline bool isThree() const {
// CHECK-NEXT: return *this == cases::three;
// CHECK-NEXT: }
// CHECK: inline int _getEnumTag() const {
// CHECK: inline unsigned _getEnumTag() const {
// CHECK-NEXT: auto metadata = _impl::$s5Enums9CLikeEnumOMa(0);
// CHECK-NEXT: auto *vwTableAddr = reinterpret_cast<swift::_impl::ValueWitnessTable **>(metadata._0) - 1;
// CHECK-NEXT: #ifdef __arm64e__
@@ -224,7 +224,7 @@ public func checkIntDoubleOrBignum(_ x: IntDoubleOrBignum, tag: Int) -> Bool {
// CHECK-NEXT: inline bool isOne() const {
// CHECK-NEXT: return *this == cases::one;
// CHECK-NEXT: }
// CHECK: inline int _getEnumTag() const {
// CHECK: inline unsigned _getEnumTag() const {
// CHECK-NEXT: auto metadata = _impl::$s5Enums8DataCaseOMa(0);
// CHECK-NEXT: auto *vwTableAddr = reinterpret_cast<swift::_impl::ValueWitnessTable **>(metadata._0) - 1;
// CHECK-NEXT: #ifdef __arm64e__
@@ -255,7 +255,7 @@ public func checkIntDoubleOrBignum(_ x: IntDoubleOrBignum, tag: Int) -> Bool {
// CHECK: inline bool isBignum() const {
// CHECK-NEXT: return *this == cases::Bignum;
// CHECK-NEXT: }
// CHECK: inline int _getEnumTag() const {
// CHECK: inline unsigned _getEnumTag() const {
// CHECK-NEXT: auto metadata = _impl::$s5Enums17IntDoubleOrBignumOMa(0);
// CHECK-NEXT: auto *vwTableAddr = reinterpret_cast<swift::_impl::ValueWitnessTable **>(metadata._0) - 1;
// CHECK-NEXT: #ifdef __arm64e__
@@ -286,7 +286,7 @@ public func checkIntDoubleOrBignum(_ x: IntDoubleOrBignum, tag: Int) -> Bool {
// CHECK: inline bool isPosInfinity() const {
// CHECK-NEXT: return *this == cases::PosInfinity;
// CHECK-NEXT: }
// CHECK: inline int _getEnumTag() const {
// CHECK: inline unsigned _getEnumTag() const {
// CHECK-NEXT: auto metadata = _impl::$s5Enums13IntOrInfinityOMa(0);
// CHECK-NEXT: auto *vwTableAddr = reinterpret_cast<swift::_impl::ValueWitnessTable **>(metadata._0) - 1;
// CHECK-NEXT: #ifdef __arm64e__
@@ -321,7 +321,7 @@ public func checkIntDoubleOrBignum(_ x: IntDoubleOrBignum, tag: Int) -> Bool {
// CHECK-NEXT: inline bool isFourth() const {
// CHECK-NEXT: return *this == cases::fourth;
// CHECK-NEXT: }
// CHECK: inline int _getEnumTag() const {
// CHECK: inline unsigned _getEnumTag() const {
// CHECK-NEXT: auto metadata = _impl::$s5Enums20MultipleBoolWithCaseOMa(0);
// CHECK-NEXT: auto *vwTableAddr = reinterpret_cast<swift::_impl::ValueWitnessTable **>(metadata._0) - 1;
// CHECK-NEXT: #ifdef __arm64e__