Skip to content

[PrintAsCxx] Fix printing of C++ enum args #74637

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 1 commit into from
Jun 24, 2024
Merged

Conversation

beccadax
Copy link
Contributor

Because imported enums are @objc, they were treated as unsupported in C++ and therefore ineligible to be printed in a C++ generated header. Narrow this logic so that only @objc classes are excluded, and update related printing logic to support enums correctly.

Fixes rdar://124262637.

Because imported enums are @objc, they were treated as unsupported in C++ and therefore ineligible to be printed in a C++ generated header. Narrow this logic so that only @objc *classes* are excluded, and update related printing logic to support enums correctly.

Fixes rdar://124262637.
@beccadax beccadax added c++ interop Feature: Interoperability with C++ swift to c++ Feature → c++ interop: swift to c++ enums c++ labels Jun 21, 2024
@beccadax
Copy link
Contributor Author

@swift-ci please test

!VD->getAttrs().hasAttribute<ImplementationOnlyAttr>() &&
!isAsyncAlternativeOfOtherDecl(VD) &&
!excludeForObjCImplementation(VD);
if (VD->isInvalid())
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The change to this function is NFC; I simply found the gigantic (and ever-growing, if you look at its version history!) expression hard to understand and even harder to debug.

Copy link
Contributor

@Xazax-hun Xazax-hun left a comment

Choose a reason for hiding this comment

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

LGTM!

Copy link
Contributor

@rjmccall rjmccall left a comment

Choose a reason for hiding this comment

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

LGTM

@beccadax beccadax merged commit 9f18481 into swiftlang:main Jun 24, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c++ interop Feature: Interoperability with C++ swift to c++ Feature → c++ interop: swift to c++
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants