Skip to content

Move in-package resilience bypassing logic to a resilience check with accessing module #71663

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

Merged
merged 5 commits into from
Feb 16, 2024

Conversation

elsh
Copy link
Contributor

@elsh elsh commented Feb 15, 2024

isResilient() returns the decl's resilience by definition and should not be altered whether resilience bypassing optimization is enabled or not. The overloaded isResilient(ModuleDecl, ResilienceExpansion) is used for accessing a decl from a client module, which is the appropriate place to check for in-package resilience bypass optimization.

Resolves rdar://123031292

isResilient(ModuleDecl, ResilienceExpansion).

isResilient() returns the decl's resilience by definition
and should not be altered whether bypassing optimization
is enabled or not. The overloaded isResilient(ModuleDecl..)
is used for accessing a decl from a client module, which is
the appropriate place to opt in for non-resilience in package.

Resolves rdar://123031292
@elsh
Copy link
Contributor Author

elsh commented Feb 15, 2024

@swift-ci smoke test

@elsh
Copy link
Contributor Author

elsh commented Feb 15, 2024

@swift-ci smoke test

@elsh elsh changed the title Move bypassing in-package resilience logic to a resilience check with accessing module Move in-package resilience bypassing logic to a resilience check with accessing module Feb 15, 2024
@elsh
Copy link
Contributor Author

elsh commented Feb 15, 2024

@swift-ci smoke test

Copy link
Contributor

@slavapestov slavapestov left a comment

Choose a reason for hiding this comment

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

Thank you!

getModuleContext()->inSamePackage(accessingModule) &&
!getModuleContext()->isBuiltFromInterface() &&
getFormalAccessScope(/*useDC=*/nullptr,
/*treatUsableFromInlineAsPublic=*/true).isPackage();
Copy link
Contributor

Choose a reason for hiding this comment

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

I think you don't need the isPackage() check -- it should be safe to access public decls non-resiliently too across a package boundary.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll push a separate PR for that.

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.

3 participants