Skip to content

AST/Sema: Introduce AvailabilityContext #77083

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 2 commits into from
Oct 18, 2024

Conversation

tshortli
Copy link
Contributor

AvailabilityContext is designed to be a compact representation of the active availability constraints in a specific scope. For now, it only models platform introduction availability but it will soon be updated to cover additional availability constraints, like platform unavailability.

TypeRefinementContext now represents availability constraints using AvailabilityContext instead of just an AvailabilityRange representing only platform introduction versions. In anticipation of the memory requirements for AvailabilityContext growing, a cache of uniqued instances of AvailabilityContext are stored in a
llvm::FoldingSet on ASTContext.

There should be no functional changes since this just changes the representation of the existing information stored by TypeRefinementContext. However, in the future AvailabilityContext will be expanded to represent additional availability constraints.

This class is designed to be a compact representation of the active
availability constraints in a specific scope. For now, it only models platform
introduction availability but it will soon be updated to cover additional
availability constraints, like platform unavailability.

In anticipation of needing to reference `AvailabilityContext`s from
`TypeRefinementContext`s and increasing memory requirements for these contexts,
a cache of uniqued instances of `AvailabilityContext` are stored in a
`llvm::FoldingSet` on `ASTContext`.
@tshortli
Copy link
Contributor Author

@swift-ci please smoke test

@tshortli
Copy link
Contributor Author

@swift-ci please smoke test Windows

@tshortli tshortli force-pushed the introduce-availability-context branch from 6e8215a to 0eb2917 Compare October 17, 2024 22:56
@tshortli
Copy link
Contributor Author

@swift-ci please smoke test

Begin using `AvailabilityContext` as the availability representation in
`TypeRefinementContext`, instead of only storing platform introduction
availability ranges.

There should be no functional changes since this just changes the
representation of the existing information stored by `TypeRefinementContext`.
However, in the future `AvailabilityContext` will be expanded to represent
additional availability constraints.
@tshortli tshortli force-pushed the introduce-availability-context branch from 0eb2917 to 47e4185 Compare October 18, 2024 00:32
@tshortli
Copy link
Contributor Author

@swift-ci please smoke test

@tshortli tshortli merged commit 1e7cc98 into swiftlang:main Oct 18, 2024
3 checks passed
@tshortli tshortli deleted the introduce-availability-context branch October 18, 2024 16:07
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.

1 participant