Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SR-264] Sort out lazy emission of accessors for fixed-layout structs #42886

Closed
slavapestov opened this issue Dec 17, 2015 · 2 comments
Closed
Assignees
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself

Comments

@slavapestov
Copy link
Member

Previous ID SR-264
Radar None
Original Reporter @slavapestov
Type Bug
Status Resolved
Resolution Done
Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug
Assignee @slavapestov
Priority Medium

md5: a748a3ef108d58e45c52a48fb78d412a

blocks:

  • SR-257 Resilient value type support -- umbrella bug

Issue Description:

Define this in file a.swift:

struct S {
var x: Int
}

And this in b.swift:

protocol P {
var x: Int { get }
}
extension S : P {}

When built without whole-module optimization, Sema lazily creates the accessor for S.x but SILGen never emits this.

This is an easy fix, just requires tightening up semantics of ASTContext.ExternalDefinitions and related code.

Probably also the accessor needs to be emitted with shared linkage even if the struct is public, to avoid clashes if it is re-emitted from another module. This is OK since the struct is fixed-layout.

@slavapestov
Copy link
Member Author

rdar://20648441

@slavapestov
Copy link
Member Author

This was resolved in a ham-fisted manner (always emit the accessors). I'm not sure we want to do anything fancier.

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself
Projects
None yet
Development

No branches or pull requests

1 participant