Skip to content

Conversation

@xymus
Copy link
Contributor

@xymus xymus commented Aug 19, 2025

Enforce using the raw type of @cdecl enums for their memory layout. This brings the same behavior to @cdecl enum as what we have for @objc enums.

Resolves #83738

@xymus
Copy link
Contributor Author

xymus commented Aug 19, 2025

@swift-ci Please smoke test

Copy link
Member

Choose a reason for hiding this comment

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

There are 4 places where we're checking "isObjC or isCDeclEnum". Can we coalesce those into a single "is C-compatible enum" predicate?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good idea, I added a isCCompatibleEnum for this. Most of the implementation is shared between @cdecl and @objc enums so most call sites use this new service.

@xymus xymus force-pushed the cdecl-enum-layout branch from cae0575 to a8cf1a4 Compare August 19, 2025 20:40
@xymus
Copy link
Contributor Author

xymus commented Aug 19, 2025

@swift-ci Please smoke test

@xymus xymus merged commit 7642d41 into swiftlang:main Aug 20, 2025
3 checks passed
@xymus xymus deleted the cdecl-enum-layout branch August 20, 2025 17:39
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.

@cdecl enum should have the same layout as its raw representation

3 participants