mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Use intptr_t instead of ssize_t and more test fixes
This commit is contained in:
@@ -1059,7 +1059,7 @@ SWIFT_RUNTIME_EXPORT
|
||||
void swift_initRawStructMetadata(StructMetadata *self,
|
||||
StructLayoutFlags structLayoutFlags,
|
||||
const TypeLayout *likeType,
|
||||
ssize_t count,
|
||||
intptr_t count,
|
||||
RawLayoutFlags rawLayoutFlags);
|
||||
|
||||
/// Check if the given generic arguments are valid inputs for the generic type
|
||||
|
||||
@@ -2825,7 +2825,7 @@ FUNCTION(GenericInstantiateLayoutString,
|
||||
// void swift_initRawStructMetadata(Metadata *structType,
|
||||
// StructLayoutFlags structLayoutFlags,
|
||||
// const TypeLayout *likeType,
|
||||
// ssize_t count,
|
||||
// intptr_t count,
|
||||
// RawLayoutFlags rawLayoutFlags);
|
||||
FUNCTION(InitRawStructMetadata,
|
||||
swift_initRawStructMetadata,
|
||||
|
||||
@@ -5682,7 +5682,7 @@ GenericTypeParamDecl *GenericTypeParamDecl::create(
|
||||
|
||||
auto numTypeReprs = 0;
|
||||
|
||||
if (opaqueTypeRepr)
|
||||
if (isOpaqueType)
|
||||
numTypeReprs = 1;
|
||||
|
||||
auto numSourceLocs = 0;
|
||||
|
||||
@@ -3030,7 +3030,7 @@ SWIFT_RUNTIME_EXPORT
|
||||
void swift::swift_initRawStructMetadata(StructMetadata *structType,
|
||||
StructLayoutFlags structLayoutFlags,
|
||||
const TypeLayout *likeTypeLayout,
|
||||
ssize_t count,
|
||||
intptr_t count,
|
||||
RawLayoutFlags rawLayoutFlags) {
|
||||
auto vwtable = getMutableVWTableForInit(structType, structLayoutFlags);
|
||||
|
||||
@@ -3042,7 +3042,8 @@ void swift::swift_initRawStructMetadata(StructMetadata *structType,
|
||||
auto extraInhabitantCount = likeTypeLayout->extraInhabitantCount;
|
||||
|
||||
if (isRawLayoutArray(rawLayoutFlags)) {
|
||||
stride *= std::min(count, (ssize_t)0);
|
||||
// Our count value may be negative, so use 0 if that's the case.
|
||||
stride *= std::max(count, (intptr_t)0);
|
||||
size = stride;
|
||||
}
|
||||
|
||||
@@ -3050,13 +3051,27 @@ void swift::swift_initRawStructMetadata(StructMetadata *structType,
|
||||
vwtable->stride = stride;
|
||||
vwtable->flags = ValueWitnessFlags()
|
||||
.withAlignmentMask(alignMask)
|
||||
.withCopyable(false);
|
||||
.withCopyable(false)
|
||||
.withBitwiseTakable(true); // All raw layouts are assumed
|
||||
// to be bitwise takable unless
|
||||
// movesAsLike is present.
|
||||
vwtable->extraInhabitantCount = extraInhabitantCount;
|
||||
|
||||
if (shouldRawLayoutMoveAsLike(rawLayoutFlags)) {
|
||||
vwtable->flags = vwtable->flags
|
||||
.withBitwiseTakable(likeTypeLayout->flags.isBitwiseTakable())
|
||||
.withBitwiseTakable(likeTypeLayout->flags.isBitwiseTakable());
|
||||
}
|
||||
|
||||
// If the calculated size of this raw layout type is available to be put in
|
||||
// value buffers, then set the inline storage bit if our like type is also
|
||||
// able to be put into inline storage.
|
||||
if (size <= NumWords_ValueBuffer) {
|
||||
vwtable->flags = vwtable->flags
|
||||
.withInlineStorage(likeTypeLayout->flags.isInlineStorage());
|
||||
} else {
|
||||
// Otherwise, we're too big to fit in inline storage regardless of the like
|
||||
// type's ability to be put in inline storage.
|
||||
vwtable->flags = vwtable->flags.withInlineStorage(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -428,7 +428,7 @@ entry(%0 : $*Cell<T>):
|
||||
|
||||
// CHECK-LABEL: define {{.*}} void @"$s10raw_layout18ConcreteMoveAsLikeVwxx"(ptr {{.*}} %object, ptr %ConcreteMoveAsLike)
|
||||
// CHECK: [[OBJ_CELL:%.*]] = getelementptr inbounds %T10raw_layout18ConcreteMoveAsLikeV, ptr %object, i32 0, i32 0
|
||||
// CHECK: {{invoke void|invoke ptr|call ptr}} @{{.*}}(ptr [[OBJ_CELL]])
|
||||
// CHECK: {{invoke void|invoke ptr|call void}} @{{.*}}(ptr [[OBJ_CELL]])
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// ConcreteMoveAsLike initializeWithTake
|
||||
@@ -555,7 +555,7 @@ entry(%0 : $*Cell<T>):
|
||||
// CHECK: [[NEW_I:%.*]] = add {{i64|i32}} [[I]], 1
|
||||
// CHECK: store {{i64|i32}} [[NEW_I]], ptr [[I_ALLOCA]]
|
||||
// CHECK: [[OBJECT:%.*]] = getelementptr inbounds %TSo24NonBitwiseTakableCXXTypeV, ptr [[OBJ_VECTOR]], {{i64|i32}} [[I]]
|
||||
// CHECK-NEXT: {{invoke void|invoke ptr|call ptr}} @{{.*}}(ptr [[OBJECT]])
|
||||
// CHECK-NEXT: {{invoke void|invoke ptr|call void}} @{{.*}}(ptr [[OBJECT]])
|
||||
|
||||
// This may or may not be in the loop_br
|
||||
// CHECK: [[EQ_CMP:%.*]] = icmp eq {{i64|i32}} [[NEW_I]], 2
|
||||
@@ -747,7 +747,7 @@ entry(%0 : $*Cell<T>):
|
||||
// CHECK: [[NEW_I:%.*]] = add {{i64|i32}} [[I]], 1
|
||||
// CHECK: store {{i64|i32}} [[NEW_I]], ptr [[I_ALLOCA]]
|
||||
// CHECK: [[OBJECT:%.*]] = getelementptr inbounds %TSo24NonBitwiseTakableCXXTypeV, ptr [[OBJ_VECTOR]], {{i64|i32}} [[I]]
|
||||
// CHECK-NEXT: {{invoke void|invoke ptr|call ptr}} @{{.*}}(ptr [[OBJECT]])
|
||||
// CHECK-NEXT: {{invoke void|invoke ptr|call void}} @{{.*}}(ptr [[OBJECT]])
|
||||
|
||||
// This may or may not be in the loop_br
|
||||
// CHECK: [[EQ_CMP:%.*]] = icmp eq {{i64|i32}} [[NEW_I]], 4
|
||||
|
||||
Reference in New Issue
Block a user