5
5
6
6
// swift-ide-test doesn't currently typecheck the macro expansions, so run the compiler as well
7
7
// RUN: %empty-directory(%t)
8
- // RUN: %target-swift-frontend -emit-module -plugin-path %swift-plugin-dir -o %t/CountedByNoEscape.swiftmodule -I %S/Inputs -enable-experimental-feature SafeInteropWrappers %s
8
+ // RUN: %target-swift-frontend -emit-module -plugin-path %swift-plugin-dir -o %t/CountedByNoEscape.swiftmodule -I %S/Inputs -enable-experimental-feature SafeInteropWrappers -enable-experimental-feature LifetimeDependence %s
9
9
10
10
// Check that ClangImporter correctly infers and expands @_SwiftifyImport macros for functions with __counted_by __noescape parameters.
11
11
@@ -17,6 +17,8 @@ import CountedByNoEscapeClang
17
17
// CHECK-NEXT: @_alwaysEmitIntoClient public func nonnull(_ p: inout MutableSpan<Int32>)
18
18
// CHECK-NEXT: @lifetime(p: copy p)
19
19
// CHECK-NEXT: @_alwaysEmitIntoClient public func nullUnspecified(_ p: inout MutableSpan<Int32>)
20
+ // CHECK-NEXT: @lifetime(p: copy p)
21
+ // CHECK-NEXT: @_alwaysEmitIntoClient public func nullable(_ p: inout MutableSpan<Int32>?)
20
22
// CHECK-NEXT: @lifetime(copy p)
21
23
// CHECK-NEXT: @lifetime(p: copy p)
22
24
// CHECK-NEXT: @_alwaysEmitIntoClient public func returnLifetimeBound(_ len1: Int32, _ p: inout MutableSpan<Int32>) -> MutableSpan<Int32>
@@ -29,9 +31,57 @@ import CountedByNoEscapeClang
29
31
// CHECK-NEXT: @lifetime(p: copy p)
30
32
// CHECK-NEXT: @_alwaysEmitIntoClient public func swiftAttr(_ p: inout MutableSpan<Int32>)
31
33
34
+ @lifetime ( p: copy p)
35
+ @inlinable
36
+ public func callComplexExpr( _ p: inout MutableSpan < CInt > ) {
37
+ complexExpr ( CInt ( p. count) , 1 , & p)
38
+ }
39
+
40
+ @lifetime ( p: copy p)
41
+ @inlinable
42
+ public func callNonnull( _ p: inout MutableSpan < CInt > ) {
43
+ nonnull ( & p)
44
+ }
45
+
46
+ @lifetime ( p: copy p)
47
+ @inlinable
48
+ public func callNullUnspecified( _ p: inout MutableSpan < CInt > ) {
49
+ nullUnspecified ( & p)
50
+ }
51
+
52
+ @lifetime ( p: copy p)
53
+ @inlinable
54
+ public func callNullable( _ p: inout MutableSpan < CInt > ? ) {
55
+ nullable ( & p)
56
+ }
57
+
58
+ @lifetime ( p: copy p)
59
+ @inlinable
60
+ public func callReturnLifetimeBound( _ p: inout MutableSpan < CInt > ) {
61
+ let a : MutableSpan < CInt > = returnLifetimeBound ( 2 , & p)
62
+ }
63
+
32
64
@inlinable
33
65
public func callReturnPointer( ) {
34
66
let a : UnsafeMutableBufferPointer < CInt > ? = returnPointer ( 4 ) // call wrapper
35
67
let b : UnsafeMutablePointer < CInt > ? = returnPointer ( 4 ) // call unsafe interop
36
68
}
37
69
70
+ @lifetime ( p: copy p)
71
+ @lifetime ( p2: copy p2 )
72
+ @inlinable
73
+ public func callShared( _ p: inout MutableSpan < CInt > , _ p2: inout MutableSpan < CInt > ) {
74
+ shared ( CInt ( p. count) , & p, & p2)
75
+ }
76
+
77
+ @lifetime ( p: copy p)
78
+ @inlinable
79
+ public func callSimple( _ p: inout MutableSpan < CInt > ) {
80
+ simple ( & p)
81
+ }
82
+
83
+ @lifetime ( p: copy p)
84
+ @inlinable
85
+ public func callSwiftAttr( _ p: inout MutableSpan < CInt > ) {
86
+ swiftAttr ( & p)
87
+ }
0 commit comments