-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Infer imports for linking #16317
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
Infer imports for linking #16317
Conversation
…m inlinable functions Completes the fix for <rdar://problem/39338239>.
…d import' A module might be visible indirectly, because it's @_exported by one of the modules we import (either in Swift, or with the C module map equivalent). In this case, we have to add it to our direct list of imports so that it can be autolinked. This isn't as clean as the previous version because now there's a /second/ list of imports in a SourceFile, but trying to use the regular list of imports to also track modules used from inlinable functions resulted in name lookup /actually looking into these modules/. The other possibility I considered (suggested by Slava) was to make UsableFromInline imports not participate in lookup at all, but that seemed trickier to get right. More rdar://problem/39338239.
@swift-ci Please test |
@swift-ci Please test source compatibility |
@swift-ci Please smoke test compiler performance |
#16211 added the notion of "usable from inline imports", by the way, if you're looking for the context. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Discussed on chat, this looks sensible to me (as far as I can understand it and its backstory).
LGTM |
Build failed |
I have a fix for this particular issue but now I'm foreseeing problems with using this within Apple due to the way we lay out certain SDK content. I'll talk with Graydon and Doug about it tomorrow. |
Closing in favor of #16349. |
Alternate version of #16299. Checks what modules are being used in inlinable code, and adds them to the "usable from inline" list for autolinking purposes.
This isn't quite as clean as the version Slava had, but that one started affecting name lookup, and so I went for a more heavy-handed version.
rdar://problem/39338239