Skip to content

Commit 44fa650

Browse files
authored
Merge pull request swiftlang#78945 from swiftlang/gaborh/wrapper-method
[cxx-interop] Add safe wrapper test with a member function
2 parents cf8a5bd + da3be5d commit 44fa650

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
@@ -68,9 +68,14 @@ inline ConstSpanOfInt funcWithSafeWrapper2(ConstSpanOfInt s
6868
[[clang::lifetimebound]]) {
6969
return s;
7070
}
71+
7172
inline ConstSpanOfInt funcWithSafeWrapper3(const VecOfInt &v
7273
[[clang::lifetimebound]]) {
7374
return ConstSpanOfInt(v.data(), v.size());
7475
}
7576

77+
struct X {
78+
inline void methodWithSafeWrapper(ConstSpanOfInt s [[clang::noescape]]) {}
79+
};
80+
7681
#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
@@ -22,6 +22,11 @@ import CxxStdlib
2222
// CHECK: func funcWithSafeWrapper(_ s: ConstSpanOfInt)
2323
// CHECK-NEXT: func funcWithSafeWrapper2(_ s: borrowing ConstSpanOfInt) -> ConstSpanOfInt
2424
// CHECK-NEXT: func funcWithSafeWrapper3(_ v: borrowing VecOfInt) -> ConstSpanOfInt
25+
// CHECK: struct X {
26+
// CHECK-NEXT: init()
27+
// CHECK-NEXT: @_alwaysEmitIntoClient public mutating func methodWithSafeWrapper(_ s: Span<CInt>)
28+
// CHECK-NEXT: mutating func methodWithSafeWrapper(_ s: ConstSpanOfInt)
29+
// CHECK-NEXT: }
2530
// CHECK-NEXT: @_alwaysEmitIntoClient public func funcWithSafeWrapper(_ s: Span<CInt>)
2631
// CHECK-NEXT: @lifetime(s)
2732
// CHECK-NEXT: @_alwaysEmitIntoClient public func funcWithSafeWrapper2(_ s: borrowing Span<CInt>) -> Span<CInt>

0 commit comments

Comments
 (0)