mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Replace Greg's r14771 with a slightly less outrageous hack.
Implicit conversions to and from an unsigned long long enum class give us the calling convention we want for swift_allocBox without totally destroying the API for C callers. Swift SVN r14919
This commit is contained in:
@@ -82,7 +82,7 @@ namespace {
|
||||
};
|
||||
}
|
||||
|
||||
BoxPair
|
||||
BoxPair::Return
|
||||
swift::swift_allocPOD(size_t dataSize, size_t dataAlignmentMask) {
|
||||
// Allocate the heap object.
|
||||
size_t valueOffset = PODBox::getValueOffset(dataSize, dataAlignmentMask);
|
||||
@@ -92,7 +92,7 @@ swift::swift_allocPOD(size_t dataSize, size_t dataAlignmentMask) {
|
||||
static_cast<PODBox*>(obj)->allocatedSize = size;
|
||||
// Get the address of the value inside.
|
||||
auto *data = reinterpret_cast<char*>(obj) + valueOffset;
|
||||
return MakeBoxPair(obj, reinterpret_cast<OpaqueValue*>(data));
|
||||
return BoxPair{obj, reinterpret_cast<OpaqueValue*>(data)};
|
||||
}
|
||||
|
||||
namespace {
|
||||
@@ -161,7 +161,7 @@ static const FullMetadata<HeapMetadata> GenericBoxHeapMetadata{
|
||||
HeapMetadata{{MetadataKind::HeapLocalVariable}}
|
||||
};
|
||||
|
||||
BoxPair
|
||||
BoxPair::Return
|
||||
swift::swift_allocBox(Metadata const *type) {
|
||||
// NB: Special cases here need to also be checked for and handled in
|
||||
// swift_deallocBox.
|
||||
@@ -183,7 +183,7 @@ swift::swift_allocBox(Metadata const *type) {
|
||||
box->type = type;
|
||||
|
||||
// Return the box and the value pointer.
|
||||
return MakeBoxPair(box, box->getValuePointer());
|
||||
return BoxPair{box, box->getValuePointer()};
|
||||
}
|
||||
|
||||
void swift::swift_deallocBox(HeapObject *box, Metadata const *type) {
|
||||
|
||||
Reference in New Issue
Block a user