Skip to content

[4.1] [ClangImporter] Handle ns_error_domain on nameless enums with typedefs #14108

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

  • Explanation: Using the ns_error_domain, enum_extensibility, or flag_enum Clang attributes on an anonymous C enum that's immediately given a name via a typedef led to an assertion failure. In no-asserts builds, I suspect the enum elements weren't properly prefix-stripped, but I don't actually have such a build around to check. These enums are rare but that doesn't mean we shouldn't support them, and we ran into one in an Apple-internal project.
  • Scope: Only affects imported enums, and only in these particular circumstances.
  • Issue: rdar://problem/36799009
  • Reviewed by: @milseman
  • Risk: Low. This has lived on master for a while now.
  • Testing: Added a compiler regression test, verified that the project with the problem gets past the issue.

This doesn't come up when using the NS_ERROR_ENUM macro, but it
shouldn't crash the compiler, and it was easy enough to fix.

rdar://problem/36799009

(cherry picked from commit 138304a)
@jrose-apple
Copy link
Contributor Author

@swift-ci Please test

@jrose-apple
Copy link
Contributor Author

@swift-ci Please nominate

@jrose-apple jrose-apple merged commit c54efad into swiftlang:swift-4.1-branch Jan 24, 2018
@jrose-apple jrose-apple deleted the 4.1-EnumInfo-improvements branch January 24, 2018 04:05
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.

1 participant