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:
Arnold Schwaighofer
2017-06-17 09:33:41 -07:00
committed by GitHub
parent 6f3b8ca60f
commit 48e889b51b
13 changed files with 113 additions and 5 deletions

View File

@@ -35,6 +35,10 @@ ClassMetadata CLASS_METADATA_SYM(s27_RawNativeDictionaryStorage);
// _direct type metadata for Swift._RawNativeSetStorage
SWIFT_RUNTIME_STDLIB_INTERFACE
ClassMetadata CLASS_METADATA_SYM(s20_RawNativeSetStorage);
// _direct type metadata for Swift._EmptyBoxStorage
SWIFT_RUNTIME_STDLIB_INTERFACE
ClassMetadata CLASS_METADATA_SYM(s16_EmptyBoxStorage);
} // namespace swift
swift::_SwiftEmptyArrayStorage swift::_swiftEmptyArrayStorage = {
@@ -127,6 +131,18 @@ void swift::_swift_instantiateInertHeapObject(void *address,
::new (address) HeapObject{metadata};
}
swift::HeapLocalVariableMetadata _emptyBoxStorageMetadata;
/// The signleton empty box storage object.
swift::_SwiftEmptyBoxStorage swift::_EmptyBoxStorage = {
// HeapObject header;
{
&_emptyBoxStorageMetadata,
//&swift::CLASS_METADATA_SYM(s16_EmptyBoxStorage), // isa pointer
}
};
namespace llvm { namespace hashing { namespace detail {
// An extern variable expected by LLVM's hashing templates. We don't link any
// LLVM libs into the runtime, so define this here.