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:
Joe Groff
2014-03-11 16:01:13 +00:00
parent 0c44aa4c5e
commit 0c55845cc1
3 changed files with 43 additions and 43 deletions

View File

@@ -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) {