-
Notifications
You must be signed in to change notification settings - Fork 10.5k
IRGen: Make resilient enum's tag indices resilient #15208
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
IRGen: Make resilient enum's tag indices resilient #15208
Conversation
@swift-ci Please test |
Please add a test to validation-test/Evolution that shows this working at run time! :-) |
@swift-ci Please test |
Build failed |
Build failed |
@swift-ci Please test |
Build failed |
This allows reordering enum cases resiliently. rdar://24057946
dc43d78
to
9d8c381
Compare
@swift-ci Please test |
Build failed |
Build failed |
Hmm, after the rebase everything fails ... must have introduced new code since ... |
@@ -6107,6 +6105,15 @@ void IRGenModule::emitEnumDecl(EnumDecl *theEnum) { | |||
} | |||
|
|||
emitFieldMetadataRecord(theEnum); | |||
|
|||
if (isResilient(theEnum, ResilienceExpansion::Maximal)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't you want to return if its not resilient?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code below emits the global variables for resilient enum tags. I only want to proceed to this code if we are within the same resilience domain not outside.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When are we ever resilient here? Isn’t this the code for emitting an enum definition_? How can you define an enum that’s resilient to yourself?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point. Rethinking that logic should we test if the enum is resilient and only then emit the globals (like you initially suggested)? Assuming, the transition from non-resilient to resilient is not allowed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Like so: #15401
Can you file a bug to have me or Huon update TBDGen as well? Or you can do it, it's trivial. You just have to emit the link entities when visiting an EnumDecl, and add a test case. |
I can take a look |
Please test |
@swift-ci Please test |
Build failed |
Build failed |
@swift-ci Please test source compatibility |
Successful source compatibility run is here: https://ci.swift.org/view/Pull%20Request/job/swift-PR-source-compat-suite/914/console |
This allows reordering enum cases resiliently.
rdar://24057946