Skip to content
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

Swift: skip declarations marked as unavailable #14437

Merged
merged 1 commit into from
Oct 12, 2023

Conversation

AlexDenisov
Copy link
Contributor

@AlexDenisov AlexDenisov commented Oct 11, 2023

Technically, this is a no-op for our test suite, though I'm not sure why the order has changed.
This is required for #14261 as it fixes a crash when we try to extract certain unavailable declarations.

@github-actions github-actions bot added the Swift label Oct 11, 2023
@AlexDenisov AlexDenisov marked this pull request as ready for review October 11, 2023 10:17
@AlexDenisov AlexDenisov requested a review from a team as a code owner October 11, 2023 10:17
Copy link
Contributor

@geoffw0 geoffw0 left a comment

Choose a reason for hiding this comment

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

Changes LGTM.

You mentioned an upgrade script - but the .dbscheme hasn't changed - what does this need to do exactly?

I definitely want to see a DCA run before this is merged, to confirm no unintended consequences.

@AlexDenisov
Copy link
Contributor Author

Changes LGTM.

You mentioned an upgrade script - but the .dbscheme hasn't changed - what does this need to do exactly?

I definitely want to see a DCA run before this is merged, to confirm no unintended consequences.

DCA is in progress. dbscheme change is in the other PR which is not strictly related to these changes.

Copy link
Contributor

@redsun82 redsun82 left a comment

Choose a reason for hiding this comment

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

LGTM, with a sad note about how it seems we can't use full C++20 just yet 🙄

Comment on lines +282 to +287
for (auto member : decl.getMembers()) {
if (swift::AvailableAttr::isUnavailable(member)) {
continue;
}
entry.members.emplace_back(dispatcher.fetchLabel(member));
}
Copy link
Contributor

@redsun82 redsun82 Oct 11, 2023

Choose a reason for hiding this comment

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

I was about to suggest using C++20's views like this

Suggested change
for (auto member : decl.getMembers()) {
if (swift::AvailableAttr::isUnavailable(member)) {
continue;
}
entry.members.emplace_back(dispatcher.fetchLabel(member));
}
entry.members =
dispatcher.fetchRepeatedLabels(decl.getAllMembers()
| std::views::filter(std::not_fn(swift::AvailableAttr::isUnavailable)));

until I tried it out and stumbled upon llvm/llvm-project#52696

The code above requires at least clang-16 to compile 😭

I guess this might be an input to the self contained toolchain, that we should upgrade clang in the process (including on Linux)

@AlexDenisov AlexDenisov merged commit 6ab2de1 into main Oct 12, 2023
14 checks passed
@AlexDenisov AlexDenisov deleted the alexdenisov/ignore-unavailable-declarations branch October 12, 2023 18:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants