IRGen: Work around RemoteMirror bug generating reflection info for empty builtin types.#29037
Merged
Merged
Conversation
…pty builtin types. The RemoteMirror library in shipping versions of macOS/iOS/tvOS/watchOS crashes if the compiler emits a BuiltinTypeDescriptor with size zero. Although this is fixed in top-of-tree RemoteMirror, we want binaries built with the new compiler to still be inspectable when run on older OSes. Generate the metadata as an empty struct with no fields when deploying back to these older platforms, which should be functionally equivalent for most purposes. Fixes rdar://problem/57924984.
Contributor
Author
|
@swift-ci Please test |
Contributor
slavapestov
approved these changes
Jan 7, 2020
|
|
||
| import EmptyStruct | ||
|
|
||
| @_alignment(1) struct EmptyStruct { } |
Contributor
There was a problem hiding this comment.
Why are you declaring the alignment here?
Contributor
Author
There was a problem hiding this comment.
The compiler always generates BuiltinTypeDescriptors for types with declared alignment (because the normal layout algorithm would mis-align them), so this is just to exercise that code path. An empty type should not be able to affect the layout of its enclosing aggregate regardless of its supposed alignment, so it should be OK to fall back to an empty struct layout.
mikeash
approved these changes
Jan 7, 2020
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The RemoteMirror library in shipping versions of macOS/iOS/tvOS/watchOS crashes if the compiler
emits a BuiltinTypeDescriptor with size zero. Although this is fixed in top-of-tree RemoteMirror,
we want binaries built with the new compiler to still be inspectable when run on older OSes.
Generate the metadata as an empty struct with no fields when deploying back to these older
platforms, which should be functionally equivalent for most purposes.
Fixes rdar://problem/57924984.