Skip to content

Commit da3be5d

Browse files
author
Gabor Horvath
committed
[cxx-interop] Add safe wrapper test with a member function
1 parent 95dca81 commit da3be5d

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

test/Interop/Cxx/stdlib/Inputs/std-span.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,14 @@ inline ConstSpanOfInt funcWithSafeWrapper2(ConstSpanOfInt s
6262
[[clang::lifetimebound]]) {
6363
return s;
6464
}
65+
6566
inline ConstSpanOfInt funcWithSafeWrapper3(const VecOfInt &v
6667
[[clang::lifetimebound]]) {
6768
return ConstSpanOfInt(v.data(), v.size());
6869
}
6970

71+
struct X {
72+
inline void methodWithSafeWrapper(ConstSpanOfInt s [[clang::noescape]]) {}
73+
};
74+
7075
#endif // TEST_INTEROP_CXX_STDLIB_INPUTS_STD_SPAN_H

test/Interop/Cxx/stdlib/std-span-interface.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@ import CxxStdlib
1717
// CHECK: func funcWithSafeWrapper(_ s: ConstSpanOfInt)
1818
// CHECK-NEXT: func funcWithSafeWrapper2(_ s: borrowing ConstSpanOfInt) -> ConstSpanOfInt
1919
// CHECK-NEXT: func funcWithSafeWrapper3(_ v: borrowing VecOfInt) -> ConstSpanOfInt
20+
// CHECK: struct X {
21+
// CHECK-NEXT: init()
22+
// CHECK-NEXT: @_alwaysEmitIntoClient public mutating func methodWithSafeWrapper(_ s: Span<CInt>)
23+
// CHECK-NEXT: mutating func methodWithSafeWrapper(_ s: ConstSpanOfInt)
24+
// CHECK-NEXT: }
2025
// CHECK-NEXT: @_alwaysEmitIntoClient public func funcWithSafeWrapper(_ s: Span<CInt>)
2126
// CHECK-NEXT: @lifetime(s)
2227
// CHECK-NEXT: @_alwaysEmitIntoClient public func funcWithSafeWrapper2(_ s: borrowing Span<CInt>) -> Span<CInt>

0 commit comments

Comments
 (0)