mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
IRGen: EmptyBoxType's representation cannot be nil because of a conflict with extra inhabitant assumption in indirect enums (#10326)
* IRGen: EmptyBoxType's representation cannot be nil because of a conflict with extra inhabitant assumption in indirect enums We map nil to the .None case of Optional. Instead use a singleton object. SR-5148 rdar://32618580
This commit is contained in:
committed by
GitHub
parent
6f3b8ca60f
commit
48e889b51b
@@ -169,6 +169,10 @@ SWIFT_RUNTIME_EXPORT
|
||||
BoxPair::Return swift_makeBoxUnique(OpaqueValue *buffer, Metadata const *type,
|
||||
size_t alignMask);
|
||||
|
||||
/// Returns the address of a heap object representing all empty box types.
|
||||
SWIFT_RUNTIME_EXPORT
|
||||
HeapObject* swift_allocEmptyBox();
|
||||
|
||||
// Allocate plain old memory. This is the generalized entry point
|
||||
// Never returns nil. The returned memory is uninitialized.
|
||||
//
|
||||
|
||||
@@ -1761,6 +1761,9 @@ struct TargetHeapLocalVariableMetadata
|
||||
static bool classof(const TargetMetadata<Runtime> *metadata) {
|
||||
return metadata->getKind() == MetadataKind::HeapLocalVariable;
|
||||
}
|
||||
constexpr TargetHeapLocalVariableMetadata()
|
||||
: TargetHeapMetadata<Runtime>(MetadataKind::HeapLocalVariable),
|
||||
OffsetToFirstCapture(0), CaptureDescription(nullptr) {}
|
||||
};
|
||||
using HeapLocalVariableMetadata
|
||||
= TargetHeapLocalVariableMetadata<InProcess>;
|
||||
|
||||
@@ -73,6 +73,11 @@ FUNCTION(ProjectBox, swift_projectBox, DefaultCC,
|
||||
ARGS(RefCountedPtrTy),
|
||||
ATTRS(NoUnwind, ReadNone))
|
||||
|
||||
FUNCTION(AllocEmptyBox, swift_allocEmptyBox, DefaultCC,
|
||||
RETURNS(RefCountedPtrTy),
|
||||
ARGS(),
|
||||
ATTRS(NoUnwind))
|
||||
|
||||
// RefCounted *swift_allocObject(Metadata *type, size_t size, size_t alignMask);
|
||||
FUNCTION_WITH_GLOBAL_SYMBOL_AND_IMPL(AllocObject, swift_allocObject,
|
||||
_swift_allocObject, _swift_allocObject_, RegisterPreservingCC,
|
||||
|
||||
Reference in New Issue
Block a user