|
| 1 | +// REQUIRES: swift_swift_parser |
| 2 | + |
| 3 | +// RUN: %target-swift-frontend %s -swift-version 5 -module-name main -disable-availability-checking -typecheck -plugin-path %swift-plugin-dir -dump-macro-expansions 2>&1 | %FileCheck --match-full-lines %s |
| 4 | + |
| 5 | +@_SwiftifyImport(.countedBy(pointer: 1, count: "len")) |
| 6 | +func ptrNamed(ptr: UnsafePointer<CInt>, _ len: CInt) { |
| 7 | +} |
| 8 | + |
| 9 | +@_SwiftifyImport(.countedBy(pointer: 1, count: "len")) |
| 10 | +func ptrNamedOther(buf ptr: UnsafePointer<CInt>, _ len: CInt) { |
| 11 | +} |
| 12 | + |
| 13 | +@_SwiftifyImport(.countedBy(pointer: 1, count: "len")) |
| 14 | +func lenNamed(_ ptr: UnsafePointer<CInt>, len: CInt) { |
| 15 | +} |
| 16 | + |
| 17 | +@_SwiftifyImport(.countedBy(pointer: 1, count: "len")) |
| 18 | +func lenNamedOther(_ ptr: UnsafePointer<CInt>, count len: CInt) { |
| 19 | +} |
| 20 | + |
| 21 | +@_SwiftifyImport(.countedBy(pointer: 1, count: "len")) |
| 22 | +func allNamed(ptr: UnsafePointer<CInt>, len: CInt) { |
| 23 | +} |
| 24 | + |
| 25 | +@_SwiftifyImport(.countedBy(pointer: 1, count: "len")) |
| 26 | +func allNamedOther(buf ptr: UnsafePointer<CInt>, count len: CInt) { |
| 27 | +} |
| 28 | + |
| 29 | +// CHECK: @_alwaysEmitIntoClient |
| 30 | +// CHECK-NEXT: func ptrNamed(ptr: UnsafeBufferPointer<CInt>) { |
| 31 | +// CHECK-NEXT: return ptrNamed(ptr: ptr.baseAddress!, CInt(exactly: ptr.count)!) |
| 32 | +// CHECK-NEXT: } |
| 33 | + |
| 34 | +// CHECK: @_alwaysEmitIntoClient |
| 35 | +// CHECK-NEXT: func ptrNamedOther(buf ptr: UnsafeBufferPointer<CInt>) { |
| 36 | +// CHECK-NEXT: return ptrNamedOther(buf: ptr.baseAddress!, CInt(exactly: ptr.count)!) |
| 37 | +// CHECK-NEXT: } |
| 38 | + |
| 39 | +// CHECK: @_alwaysEmitIntoClient |
| 40 | +// CHECK-NEXT: func lenNamed(_ ptr: UnsafeBufferPointer<CInt>) { |
| 41 | +// CHECK-NEXT: return lenNamed(ptr.baseAddress!, len: CInt(exactly: ptr.count)!) |
| 42 | +// CHECK-NEXT: } |
| 43 | + |
| 44 | +// CHECK: @_alwaysEmitIntoClient |
| 45 | +// CHECK-NEXT: func lenNamedOther(_ ptr: UnsafeBufferPointer<CInt>) { |
| 46 | +// CHECK-NEXT: return lenNamedOther(ptr.baseAddress!, count: CInt(exactly: ptr.count)!) |
| 47 | +// CHECK-NEXT: } |
| 48 | + |
| 49 | +// CHECK: @_alwaysEmitIntoClient |
| 50 | +// CHECK-NEXT: func allNamed(ptr: UnsafeBufferPointer<CInt>) { |
| 51 | +// CHECK-NEXT: return allNamed(ptr: ptr.baseAddress!, len: CInt(exactly: ptr.count)!) |
| 52 | +// CHECK-NEXT: } |
| 53 | + |
| 54 | +// CHECK: @_alwaysEmitIntoClient |
| 55 | +// CHECK-NEXT: func allNamedOther(buf ptr: UnsafeBufferPointer<CInt>) { |
| 56 | +// CHECK-NEXT: return allNamedOther(buf: ptr.baseAddress!, count: CInt(exactly: ptr.count)!) |
| 57 | +// CHECK-NEXT: } |
| 58 | + |
0 commit comments