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
@@ -31,6 +31,7 @@
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
#include <thread>
|
||||
#include "../SwiftShims/GlobalObjects.h"
|
||||
#include "../SwiftShims/RuntimeShims.h"
|
||||
#if SWIFT_OBJC_INTEROP
|
||||
# include <objc/NSObject.h>
|
||||
@@ -227,6 +228,12 @@ OpaqueValue *swift::swift_projectBox(HeapObject *o) {
|
||||
return metadata->project(o);
|
||||
}
|
||||
|
||||
HeapObject *swift::swift_allocEmptyBox() {
|
||||
auto heapObject = reinterpret_cast<HeapObject*>(&_EmptyBoxStorage);
|
||||
SWIFT_RT_ENTRY_CALL(swift_retain)(heapObject);
|
||||
return heapObject;
|
||||
}
|
||||
|
||||
// Forward-declare this, but define it after swift_release.
|
||||
extern "C" LLVM_LIBRARY_VISIBILITY LLVM_ATTRIBUTE_NOINLINE LLVM_ATTRIBUTE_USED
|
||||
void _swift_release_dealloc(HeapObject *object) SWIFT_CC(RegisterPreservingCC_IMPL);
|
||||
|
||||
Reference in New Issue
Block a user