Skip to content

Commit 2b1bfe3

Browse files
committed
Foundation overlay: Don't rely on URL struct being a single reference
If the struct is resilient, it is passed indirectly. Even if we decide to make it fixed layout, it's best to remove as many implicit ABI assumptions as possible from @_silgen_name function calls. Fixes <rdar://problem/28673618>.
1 parent 47f0c3a commit 2b1bfe3

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

stdlib/public/SDK/Foundation/Data.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ internal func __NSDataInvokeDeallocatorUnmap(_ mem: UnsafeMutableRawPointer, _ l
2222
internal func __NSDataInvokeDeallocatorFree(_ mem: UnsafeMutableRawPointer, _ length: Int) -> Void
2323

2424
@_silgen_name("_NSWriteDataToFile_Swift")
25-
internal func _NSWriteDataToFile_Swift(url: URL, data: NSData, options: UInt, error: NSErrorPointer) -> Bool
25+
internal func _NSWriteDataToFile_Swift(url: NSURL, data: NSData, options: UInt, error: NSErrorPointer) -> Bool
2626

2727
internal final class _SwiftNSData : _SwiftNativeNSData, _SwiftNativeFoundationType {
2828
internal typealias ImmutableType = NSData
@@ -385,7 +385,7 @@ public struct Data : ReferenceConvertible, Equatable, Hashable, RandomAccessColl
385385
try _mapUnmanaged {
386386
if _shouldUseNonAtomicWriteReimplementation(options: options) {
387387
var error : NSError?
388-
if !_NSWriteDataToFile_Swift(url: url, data: $0, options: options.rawValue, error: &error) {
388+
if !_NSWriteDataToFile_Swift(url: url as NSURL, data: $0, options: options.rawValue, error: &error) {
389389
throw error!
390390
}
391391
} else {

0 commit comments

Comments
 (0)