11// REQUIRES: swift_feature_SafeInteropWrappers
22
3- // RUN: %target-swift-ide-test -print-module -module-to-print=CountedByClang -plugin-path %swift-plugin-dir -I %S/Inputs -source-filename=x -enable-experimental-feature SafeInteropWrappers -Xcc -Wno-nullability-completeness | %FileCheck %s
3+ // RUN: %target-swift-ide-test -print-module -module-to-print=CountedByClang -plugin-path %swift-plugin-dir -I %S/Inputs -source-filename=x -enable-experimental-feature SafeInteropWrappers -Xcc -Werror -Xcc - Wno-nullability-completeness -Xcc -Wno-div-by-zero -Xcc -Wno-pointer-to-int-cast | %FileCheck %s
44
55// swift-ide-test doesn't currently typecheck the macro expansions, so run the compiler as well
66// RUN: %empty-directory(%t)
7- // RUN: %target-swift-frontend -emit-module -plugin-path %swift-plugin-dir -o %t/CountedBy.swiftmodule -I %S/Inputs -enable-experimental-feature SafeInteropWrappers -strict-memory-safety -warnings-as-errors -Xcc -Werror -Xcc -Wno-nullability-completeness %s
7+ // RUN: %target-swift-frontend -emit-module -plugin-path %swift-plugin-dir -o %t/CountedBy.swiftmodule -I %S/Inputs -enable-experimental-feature SafeInteropWrappers -strict-memory-safety -warnings-as-errors -Xcc -Werror -Xcc -Wno-nullability-completeness -Xcc -Wno-div-by-zero -Xcc -Wno-pointer-to-int-cast %s
88
99// Check that ClangImporter correctly infers and expands @_SwiftifyImport macros for functions with __counted_by parameters.
1010
1111import CountedByClang
1212
1313
1414// CHECK: /// This is an auto-generated wrapper for safer interop
15+ // CHECK-NEXT: @_alwaysEmitIntoClient @_disfavoredOverload public func binaryLiteral(_ p: UnsafeMutableBufferPointer<Int32>)
16+
17+ // CHECK-NEXT: /// This is an auto-generated wrapper for safer interop
1518// CHECK-NEXT: @_alwaysEmitIntoClient @_disfavoredOverload public func bitshift(_ m: Int32, _ n: Int32, _ o: Int32, _ p: UnsafeMutableBufferPointer<Int32>)
1619
1720// CHECK-NEXT: /// This is an auto-generated wrapper for safer interop
@@ -26,6 +29,9 @@ import CountedByClang
2629// CHECK-NEXT: /// This is an auto-generated wrapper for safer interop
2730// CHECK-NEXT: @_alwaysEmitIntoClient @_disfavoredOverload public func constInt(_ p: UnsafeMutableBufferPointer<Int32>)
2831
32+ // CHECK-NEXT: /// This is an auto-generated wrapper for safer interop
33+ // CHECK-NEXT: @_alwaysEmitIntoClient @_disfavoredOverload public func hexLiteral(_ p: UnsafeMutableBufferPointer<Int32>)
34+
2935// CHECK-NEXT: /// This is an auto-generated wrapper for safer interop
3036// CHECK-NEXT: @_alwaysEmitIntoClient @_disfavoredOverload public func nonnull(_ p: UnsafeMutableBufferPointer<Int{{.*}}>)
3137
@@ -35,6 +41,9 @@ import CountedByClang
3541// CHECK-NEXT: /// This is an auto-generated wrapper for safer interop
3642// CHECK-NEXT: @_alwaysEmitIntoClient @_disfavoredOverload public func nullable(_ p: UnsafeMutableBufferPointer<Int{{.*}}>?)
3743
44+ // CHECK-NEXT: /// This is an auto-generated wrapper for safer interop
45+ // CHECK-NEXT: @_alwaysEmitIntoClient @_disfavoredOverload public func octalLiteral(_ p: UnsafeMutableBufferPointer<Int32>)
46+
3847// CHECK-NEXT: /// This is an auto-generated wrapper for safer interop
3948// CHECK-NEXT: @_alwaysEmitIntoClient @_disfavoredOverload public func offByOne(_ len: Int32, _ p: UnsafeMutableBufferPointer<Int32>)
4049
@@ -57,19 +66,28 @@ import CountedByClang
5766// CHECK-NEXT: @_alwaysEmitIntoClient @_disfavoredOverload public func simpleFlipped(_ p: UnsafeMutableBufferPointer<Int{{.*}}>)
5867
5968// CHECK-NEXT: /// This is an auto-generated wrapper for safer interop
60- // CHECK-NEXT: @_alwaysEmitIntoClient @_disfavoredOverload public func sizeofParam (_ p: UnsafeMutableBufferPointer<Int{{.*}}>)
69+ // CHECK-NEXT: @_alwaysEmitIntoClient @_disfavoredOverload public func swiftAttr (_ p: UnsafeMutableBufferPointer<Int{{.*}}>)
6170
62- // CHECK-NEXT: /// This is an auto-generated wrapper for safer interop
63- // CHECK-NEXT: @_alwaysEmitIntoClient @_disfavoredOverload public func sizeofType(_ p: UnsafeMutableBufferPointer<Int{{.*}}>)
71+ @inlinable
72+ public func callBitshift( _ m: CInt , n: CInt , o: CInt , _ p: UnsafeMutableBufferPointer < CInt > ) {
73+ unsafe bitshift ( m, n, o, p)
74+ }
6475
65- // CHECK-NEXT: /// This is an auto-generated wrapper for safer interop
66- // CHECK-NEXT: @_alwaysEmitIntoClient @_disfavoredOverload public func swiftAttr(_ p: UnsafeMutableBufferPointer<Int{{.*}}>)
76+ @inlinable
77+ public func callBitwise( _ m: CInt , n: CInt , o: CInt , _ p: UnsafeMutableBufferPointer < CInt > ) {
78+ unsafe bitwise( m, n, o, p)
79+ }
6780
6881@inlinable
6982public func callComplexExpr( _ p: UnsafeMutableBufferPointer < CInt > ) {
7083 unsafe complexExpr( CInt ( p. count) , 1 , p)
7184}
7285
86+ @inlinable
87+ public func callConstFloatCastedToInt( _ p: UnsafeMutableBufferPointer < CInt > ) {
88+ unsafe constFloatCastedToInt( p)
89+ }
90+
7391@inlinable
7492public func callConstInt( _ p: UnsafeMutableBufferPointer < CInt > ) {
7593 unsafe constInt( p)
@@ -90,11 +108,21 @@ public func callNullable(_ p: UnsafeMutableBufferPointer<CInt>?) {
90108 unsafe nullable( p)
91109}
92110
111+ @inlinable
112+ public func callOctalLiteral( _ p: UnsafeMutableBufferPointer < CInt > ) {
113+ unsafe octalLiteral( p)
114+ }
115+
93116@inlinable
94117public func callOffByOne( _ p: UnsafeMutableBufferPointer < CInt > ) {
95118 unsafe offByOne( 0 , p)
96119}
97120
121+ @inlinable
122+ public func callOffBySome( _ p: UnsafeMutableBufferPointer < CInt > ) {
123+ unsafe offBySome( 0 , 1 , p)
124+ }
125+
98126@inlinable
99127public func callReturnPointer( ) {
100128 let _: UnsafeMutableBufferPointer < CInt > ? = returnPointer ( 4 ) // call wrapper
0 commit comments