mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[Swiftify] Add MutableSpan support for std::span, and disable it (#80315)
__counted_by already had MutableSpan support, so add it for std::span for parity. But since MutableSpan hasn't landed in the standard library yet, disable emitting it to prevent compilation errors in expansions. rdar://147882736
This commit is contained in:
@@ -1,15 +1,15 @@
|
||||
// REQUIRES: swift_swift_parser
|
||||
|
||||
// RUN: not %target-swift-frontend %s -swift-version 5 -module-name main -disable-availability-checking -typecheck -plugin-path %swift-plugin-dir -strict-memory-safety -warnings-as-errors -dump-macro-expansions > %t.log 2>&1
|
||||
// RUN: %target-swift-frontend %s -swift-version 5 -module-name main -disable-availability-checking -typecheck -plugin-path %swift-plugin-dir -strict-memory-safety -warnings-as-errors -dump-macro-expansions > %t.log 2>&1
|
||||
// RUN: %FileCheck --match-full-lines %s < %t.log
|
||||
|
||||
@_SwiftifyImport(.sizedBy(pointer: .param(1), size: "size"), .nonescaping(pointer: .param(1)))
|
||||
func myFunc(_ ptr: UnsafeMutableRawPointer, _ size: CInt) {
|
||||
}
|
||||
|
||||
// Emits UnsafeMutableRawBufferPointer until MutableRawSpan has landed
|
||||
|
||||
// CHECK: @_alwaysEmitIntoClient
|
||||
// CHECK-NEXT: func myFunc(_ ptr: MutableRawSpan) {
|
||||
// CHECK-NEXT: return unsafe ptr.withUnsafeBytes { _ptrPtr in
|
||||
// CHECK-NEXT: return unsafe myFunc(_ptrPtr.baseAddress!, CInt(exactly: ptr.byteCount)!)
|
||||
// CHECK-NEXT: }
|
||||
// CHECK-NEXT: func myFunc(_ ptr: UnsafeMutableRawBufferPointer) {
|
||||
// CHECK-NEXT: return unsafe myFunc(ptr.baseAddress!, CInt(exactly: ptr.count)!)
|
||||
// CHECK-NEXT: }
|
||||
|
||||
Reference in New Issue
Block a user