Skip to content

[semantic-sil] ObjC metatypes as metatypes are trivial. Only once converted to objects do they have @owned ownership. #6833

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

gottesmm
Copy link
Contributor

[semantic-sil] ObjC metatypes as metatypes are trivial. Only once converted to objects do they have @owned ownership.

This commit cleans up a few places in bridging code, where we were treating
metatypes as if they had non-invalid cleanups.

rdar://29791263

…verted to objects do they have @owned ownership.

This commit cleans up a few places in bridging code, where we were treating
metatypes as if they had non-invalid cleanups.

rdar://29791263
@gottesmm
Copy link
Contributor Author

@jckarter I believe I am correct here. But I would like to just double/triple check that I am correct about the objc metatypes.

@gottesmm
Copy link
Contributor Author

@swift-ci Please test

@gottesmm
Copy link
Contributor Author

Also, I have been reading this code for a little bit. It is incredibly misleading and borderline incorrect.

We have just been getting lucky since objective-c initializers will take their parameter at +1. So even though we were writing code as if the metatype had a cleanup and were passing through the cleanup (which was not anything). If we were not always passing the alloc_ref_dynamic into an initializer, we definitely would have a leak since a destroy would never have been inserted.

@gottesmm gottesmm requested a review from jckarter January 16, 2017 05:03
@gottesmm
Copy link
Contributor Author

Actually, after reading this more and thinking about the change. I feel comfortable committing it. But still a second pair of eyes, can't hurt.

@gottesmm gottesmm merged commit 4db6f81 into swiftlang:master Jan 16, 2017
@gottesmm gottesmm deleted the metatype_are_trivial_treat_them_so branch January 16, 2017 06:04
Copy link
Contributor

@jckarter jckarter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, this is fine. There shouldn't be any functionality change since a thick metatype wouldn't have had a cleanup to begin with either.

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