Skip to content

[6.2] Serialization: Encode custom availability domains #80641

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

Conversation

tshortli
Copy link
Contributor

@tshortli tshortli commented Apr 8, 2025

  • Explanation: When serializing @available attributes, if the attribute applies to a custom domain include enough information to deserialize the reference to that domain. Additionally, remove the now unnecessary ClangImporter Swift lookup table support for availability domains. Clang now handles looking up serialized availability domain declarations in precompiled modules itself. Finally, when printing .swiftinterface files, guard declarations that use the CustomAvailability feature.
  • Scope: Serialization and printing of @available attributes.
  • Issue/Radar: rdar://138441265
  • Original PR: Serialization: Encode custom availability domains #80616
  • Risk: Low. Most of the new behavior in this PR are only active when the experimental feature CustomAvailability is enabled, and there are no adopters. The serialization format changes to accommodate custom domains will always be active, but serializing and deserializing existing kinds of AvailableAttr is very well tested by the standard library build and test suite.
  • Testing: New compiler tests.
  • Reviewer: @xymus @artemcm

@tshortli tshortli marked this pull request as ready for review April 8, 2025 17:09
@tshortli tshortli requested a review from a team as a code owner April 8, 2025 17:09
@tshortli tshortli requested a review from nkcsgexi April 8, 2025 17:11
tshortli added 4 commits April 8, 2025 10:35
The `#import` directive is not supported by Clang in MSVC compatibility mode,
so use `#include` instead for compatibility in the ClangImporter tests for
custom availability domains.

Resolves rdar://147122406.
Partially revert swiftlang#80035 now that Clang
has its own APIs for querying serialized modules for the decl representing the
availability domain with a given name.
When serializing `@available` attributes, if the attribute applies to a custom
domain include enough information to deserialize the reference to that domain.

Resolves rdar://138441265.
@tshortli tshortli force-pushed the availability-domain-serialization-6.2 branch from a587891 to 38e56fc Compare April 8, 2025 17:35
@tshortli
Copy link
Contributor Author

tshortli commented Apr 8, 2025

@swift-ci please test

Copy link
Contributor

@nkcsgexi nkcsgexi left a comment

Choose a reason for hiding this comment

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

We need to integrate this to perform end-to-end test of library-provided availability.

@tshortli tshortli enabled auto-merge April 8, 2025 17:52
@tshortli tshortli merged commit 494e597 into swiftlang:release/6.2 Apr 9, 2025
5 checks passed
@tshortli tshortli deleted the availability-domain-serialization-6.2 branch April 9, 2025 05:17
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