Skip to content

IRGen: Only emit resilient tag numbers for resilient enums #15401

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

Conversation

aschwaighofer
Copy link
Contributor

rdar://24057946

@aschwaighofer
Copy link
Contributor Author

@swift-ci Please test

@slavapestov
Copy link
Contributor

I’m surprised this wasn’t caught by tests - are you sure this whole check isn’t dead somehow?

@slavapestov
Copy link
Contributor

Or can you add IRGen tests ensuring the tag numbers are emitted in the right circumstances?

@aschwaighofer
Copy link
Contributor Author

I will add positive and negative tests for the globals.

Here is my understanding. Before this commit:
The check if( isResilient(theEnum, ResilienceExpansion::Maximal)) return; -- if this definition is resilient in the local domain was a no-op (as you pointed out) and so we are always emitting globals even for non-resilient enums.

After this commit:
if (!isResilient(theEnum, ResilienceExpansion::Minimal))) return -- if this definition is not resilient in the minimal expansion then we have a fragile enum for which we should not emit a global. (resilient class thunk emission uses the same test)

@aschwaighofer aschwaighofer force-pushed the irgen_fix_resilient_tag_number_emission branch from 96fe8fa to 71a1709 Compare March 21, 2018 21:03
@aschwaighofer
Copy link
Contributor Author

@swift-ci Please smoke test

@slavapestov
Copy link
Contributor

Oh you’re absolutely right. Thanks for the explanation. Now I see that only negative tests would’ve caught this (or TBD tests actually, since it’s an error to have an IRGen symbol that’s not in the TBD).

@aschwaighofer
Copy link
Contributor Author

@swift-ci Please smoke test

@aschwaighofer aschwaighofer merged commit e374553 into swiftlang:master Mar 23, 2018
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