Skip to content

Funnel all "get local conformances" queries through a request. #36223

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

DougGregor
Copy link
Member

LookupAllConformancesInContextRequest caches the results of performing
lookup of all of the conformances ascribed to a given iterable
declaration context. However, it was only used in a small number of
places, with most clients using a different API
(getLocalConformances()) that does not provide
caching, cycle detection, or dependency tracking.

Sink LookupAllConformancesInContextRequest lower in the stack, and
reimplement getLocalConformances() on top of it. This ensures that
all of the various queries go through the cached request and get the
benefits of the request-evaluator infrastructure.

LookupAllConformancesInContextRequest caches the results of performing
lookup of all of the conformances ascribed to a given iterable
declaration context. However, it was only used in a small number of
places, with most clients using a different API
(`getLocalConformances()`) that does not provide
caching, cycle detection, or dependency tracking.

Sink LookupAllConformancesInContextRequest lower in the stack, and
reimplement `getLocalConformances()` on top of it. This ensures that
all of the various queries go through the cached request and get the
benefits of the request-evaluator infrastructure.
…formances()

The uncached, rarely-used getLocalProtocols() does not benefit from
having its own distinct implementation. Reimplement it on top of
getLocalConformances() to simplify things and benefit from the
request-evaluator infrastructure.
@DougGregor
Copy link
Member Author

@swift-ci please smoke test

@DougGregor
Copy link
Member Author

@swift-ci please test source compatibility


// Copy all of the conformances we want.
SmallVector<ProtocolConformance *, 2> result;
std::copy_if(
Copy link
Contributor

Choose a reason for hiding this comment

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

You could bypass the copy_if() if the lookupKind is All, which is the default here.

Copy link
Member Author

Choose a reason for hiding this comment

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

I have a silly SmallVector-vs-vector difference to deal with as well, but yes, thanks!

@DougGregor DougGregor merged commit 8a6e07d into swiftlang:main Mar 2, 2021
@DougGregor DougGregor deleted the lookup-all-conformances-request branch March 2, 2021 14:35
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