Skip to content

[4.0] [ClangImporter] Classify enums using flag_enum and enum_extensibility #8998

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

jrose-apple
Copy link
Contributor

Get #8910 and #8992 into the 4.0 branch a little faster than waiting for a merge, that's all.

…swiftlang#8910)

These new Clang attributes identify whether an enum is intended to
represent an option set or not, and whether the set of cases listed in
the enum declaration is exhaustive. (Swift doesn't currently have a
closed/open distinction for enums, so treat any C enum with
enum_extensibility as a proper closed Swift enum, like we do with
NS_ENUM.)

Enums with neither attribute will continue to be imported as unique
types.

rdar://problem/28476618
…wiftlang#8992)

(and similar for flag_enum)

This commit prepares the importer for a world in which NS_ENUM and
NS_OPTIONS have adopted the new Clang attributes 'enum_extensibility'
and 'flag_enum', but API notes are used to reverse the effect. Without
this there would be no transition path for adopting the standard Cocoa
macros, which have applied unconditionally up to now.

rdar://problem/18744821
@jrose-apple
Copy link
Contributor Author

@swift-ci Please test and merge

@swift-ci swift-ci merged commit 3887db1 into swiftlang:swift-4.0-branch Apr 25, 2017
@jrose-apple jrose-apple deleted the 4.0-enums-using-attributes branch April 25, 2017 18:04
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