Skip to content

SIL: Fix TypeExpansionContext() constructor to get the right DeclContext from a SILFunction #33428

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

Conversation

slavapestov
Copy link
Contributor

Using the SILFunction's DeclContext produces the wrong result for
the @main function, because it returns the ModuleDecl even in
a non-WMO build.

Instead, let's always just use SILModule::getAssociatedContext(),
which also simplifies the code here.

Fixes rdar://problem/66791399.

…ext from a SILFunction

Using the SILFunction's DeclContext produces the wrong result for
the @main function, because it returns the ModuleDecl even in
a non-WMO build.

Instead, let's always just use SILModule::getAssociatedContext(),
which also simplifies the code here.

Fixes <rdar://problem/66791399>.
@slavapestov
Copy link
Contributor Author

@swift-ci Please smoke test

Copy link
Contributor

@aschwaighofer aschwaighofer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A quick grep of the SILModule constructor seems to indicate that we always initialize the associatedContextDecl (even though the doc comment for getAssociatedContext says it might be null). So I think this should be good.

@slavapestov slavapestov merged commit b04ec81 into swiftlang:master Aug 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants