55
66// swift-ide-test doesn't currently typecheck the macro expansions, so run the compiler as well
77// 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
99
1010// Check that ClangImporter correctly infers and expands @_SwiftifyImport macros for functions with __counted_by __noescape parameters.
1111
@@ -17,6 +17,8 @@ import CountedByNoEscapeClang
1717// CHECK-NEXT: @_alwaysEmitIntoClient public func nonnull(_ p: inout MutableSpan<Int32>)
1818// CHECK-NEXT: @lifetime(p: copy p)
1919// 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>?)
2022// CHECK-NEXT: @lifetime(copy p)
2123// CHECK-NEXT: @lifetime(p: copy p)
2224// CHECK-NEXT: @_alwaysEmitIntoClient public func returnLifetimeBound(_ len1: Int32, _ p: inout MutableSpan<Int32>) -> MutableSpan<Int32>
@@ -29,9 +31,57 @@ import CountedByNoEscapeClang
2931// CHECK-NEXT: @lifetime(p: copy p)
3032// CHECK-NEXT: @_alwaysEmitIntoClient public func swiftAttr(_ p: inout MutableSpan<Int32>)
3133
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+
3264@inlinable
3365public func callReturnPointer( ) {
3466 let a : UnsafeMutableBufferPointer < CInt > ? = returnPointer ( 4 ) // call wrapper
3567 let b : UnsafeMutablePointer < CInt > ? = returnPointer ( 4 ) // call unsafe interop
3668}
3769
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