Skip to content

Commit 9078714

Browse files
committed
[BasicBriding] Use assumingMemoryBound(to:)
For accessing elements in BridgedArrayRef in Swift code.
1 parent 7a5c957 commit 9078714

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

SwiftCompilerSources/Sources/Basic/Utils.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ extension Optional where Wrapped == UnsafeMutablePointer<BridgedSwiftObject> {
173173

174174
extension BridgedArrayRef {
175175
public func withElements<T, R>(ofType ty: T.Type, _ c: (UnsafeBufferPointer<T>) -> R) -> R {
176-
let start = data?.bindMemory(to: ty, capacity: count)
176+
let start = data?.assumingMemoryBound(to: ty)
177177
let buffer = UnsafeBufferPointer(start: start, count: count)
178178
return c(buffer)
179179
}

lib/ASTGen/Sources/ASTGen/Bridge.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ extension ConcatCollection: LazyCollectionProtocol {
313313

314314
extension BridgedArrayRef {
315315
public func withElements<T, R>(ofType ty: T.Type, _ c: (UnsafeBufferPointer<T>) -> R) -> R {
316-
let start = data?.bindMemory(to: ty, capacity: count)
316+
let start = data?.assumingMemoryBound(to: ty)
317317
let buffer = UnsafeBufferPointer(start: start, count: count)
318318
return c(buffer)
319319
}

0 commit comments

Comments
 (0)