-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Remove unsafeAddress(of:) #3644
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
@gribozavr Do you mind reviewing this patch? |
@@ -296,7 +296,7 @@ internal func reflect(instanceAddress: UInt, kind: InstanceKind) { | |||
/// This reflects the stored properties of the immediate class. | |||
/// The superclass is not (yet?) visited. | |||
public func reflect(object: AnyObject) { | |||
let address = unsafeAddress(of: object) | |||
var address = Unmanaged.passUnretained(object).toOpaque() |
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.
This two pieces of code in SwiftReflectionTest.swift
look buggy to me. They need at least a fixLifetime
, could you add it? (defer { _fixLifetime(object) }
at the beginning of the method.)
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.
Will do
Just small comments, LGTM otherwise! Thank you! |
} | ||
#endif | ||
|
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.
@gribozavr Is it what you meant? Specially, is it correct to put @_version
just before the non _ObjC
version?
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.
Yes, I think that's the right way to do it.
@gribozavr I incorporated all of your comments and force-pushed the new version. |
@swiftix LGTM, thank you! |
@gribozavr BTW, do we need to provide a deprecated attribute with a message like: "Unmanaged.passUnretained(x).toOpaque()" instead? Or do we just silently remove the APIs? |
@swiftix Yes, it would be great if we could provide migration attributes for both |
@gribozavr OK, I'll add those to the methods and use |
@swift-ci Please test |
This is formally approved by means of a swift-evolution process now. |
@parkera This PR is removing a |
@parkera Forgot to provide the link to the compilation errors |
@swiftix Put up a PR on swift-corelibs-foundation and I'll merge it. |
@swift-ci Please smoke test Linux. |
@swift-ci Please test |
rdar://problem/18589289
@swift-ci Please smoke test Linux. |
Test failures seem to be unrelated. |
@gribozavr Can you please review for CCC? There are virtually no changes since last review. I just fixed merge conflicts and force-pushed again. |
LGTM. |
What's in this pull request?
The is a patch for the upcoming Swift evolution proposal.
rdar://problem/18589289
Resolves #44566