Skip to content

[Clang Importer] Import ns_error_domain attribute with _BridgedNSError #1192

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

Closed
wants to merge 2 commits into from

Conversation

milseman
Copy link
Member

@milseman milseman commented Feb 3, 2016

Two changes. First is a refactoring of some of the common enum reasoning which also lays down a base for ns_error_domain handling. Second introduces support for ns_error_domain.

Introduces new class, EnumInfo, just for the implementation of the
ClangImporter to encapsulate various computed information about the
enum we're importing.

This helps refactor some functionality, aids clarity, and also
prevents us from repeating calculations multiple times, as we were
doing with classifyEnum's macro-expansion tracking. Provides a base
where we can add more heavy lifting in classifyEnum in the future.
@milseman
Copy link
Member Author

milseman commented Feb 3, 2016

@swift-ci please test

1 similar comment
@milseman
Copy link
Member Author

milseman commented Feb 3, 2016

@swift-ci please test

ns_error_domain can now be used to communicate with the ClangImporter
when an enum has an associated error domain string. In this case, when
we import it as a Swift enum, we can also synthesize a conformance to
_BridgedNSError.

This allows the creation of something like NS_ERROR_ENUM, in which the
developer can declare an enum for the purposes of error handling. Adds
Sema and executable tests demonstrating this funcionality.
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