|
4 | 4 |
|
5 | 5 | // RUN: %check-generic-interop-cxx-header-in-clang(%t/functions.h -Wno-unused-function)
|
6 | 6 |
|
| 7 | +// RUN: %target-swift-frontend %s -typecheck -module-name Functions -enable-library-evolution -clang-header-expose-public-decls -emit-clang-header-path %t/functions-evo.h |
| 8 | +// RUN: %FileCheck %s < %t/functions-evo.h |
| 9 | + |
| 10 | +// RUN: %check-generic-interop-cxx-header-in-clang(%t/functions-evo.h -Wno-unused-function) |
7 | 11 |
|
8 | 12 | public func genericPrintFunctionTwoArg<T>(_ x: T, _ y: Int) {
|
9 | 13 | print("X:", x)
|
@@ -87,43 +91,43 @@ public func createTestSmallStruct(_ x: UInt32) -> TestSmallStruct {
|
87 | 91 | // CHECK: template<class T>
|
88 | 92 | // CHECK-NEXT: requires swift::isUsableInGenericContext<T>
|
89 | 93 | // CHECK-NEXT: inline void genericPrintFunction(const T & x) noexcept {
|
90 |
| -// CHECK-NEXT: return _impl::$s9Functions20genericPrintFunctionyyxlF(reinterpret_cast<const void *>(&x), swift::getTypeMetadata<T>()); |
| 94 | +// CHECK-NEXT: return _impl::$s9Functions20genericPrintFunctionyyxlF(swift::_impl::getOpaquePointer(x), swift::getTypeMetadata<T>()); |
91 | 95 | // CHECK-NEXT: }
|
92 | 96 |
|
93 | 97 |
|
94 | 98 | // CHECK: template<class T1, class T2>
|
95 | 99 | // CHECK-NEXT: requires swift::isUsableInGenericContext<T1> && swift::isUsableInGenericContext<T2>
|
96 | 100 | // CHECK-NEXT: inline void genericPrintFunctionMultiGeneric(swift::Int x, const T1 & t1, const T1 & t1p, swift::Int y, const T2 & t2) noexcept {
|
97 |
| -// CHECK-NEXT: return _impl::$s9Functions32genericPrintFunctionMultiGenericyySi_xxSiq_tr0_lF(x, reinterpret_cast<const void *>(&t1), reinterpret_cast<const void *>(&t1p), y, reinterpret_cast<const void *>(&t2), swift::getTypeMetadata<T1>(), swift::getTypeMetadata<T2>()); |
| 101 | +// CHECK-NEXT: return _impl::$s9Functions32genericPrintFunctionMultiGenericyySi_xxSiq_tr0_lF(x, swift::_impl::getOpaquePointer(t1), swift::_impl::getOpaquePointer(t1p), y, swift::_impl::getOpaquePointer(t2), swift::getTypeMetadata<T1>(), swift::getTypeMetadata<T2>()); |
98 | 102 | // CHECK-NEXT: }
|
99 | 103 |
|
100 | 104 |
|
101 | 105 | // CHECK: template<class T>
|
102 | 106 | // CHECK-NEXT: requires swift::isUsableInGenericContext<T>
|
103 | 107 | // CHECK-NEXT: inline void genericPrintFunctionTwoArg(const T & x, swift::Int y) noexcept {
|
104 |
| -// CHECK-NEXT: return _impl::$s9Functions26genericPrintFunctionTwoArgyyx_SitlF(reinterpret_cast<const void *>(&x), y, swift::getTypeMetadata<T>()); |
| 108 | +// CHECK-NEXT: return _impl::$s9Functions26genericPrintFunctionTwoArgyyx_SitlF(swift::_impl::getOpaquePointer(x), y, swift::getTypeMetadata<T>()); |
105 | 109 | // CHECK-NEXT: }
|
106 | 110 |
|
107 | 111 | // CHECK: template<class T>
|
108 | 112 | // CHECK-NEXT: requires swift::isUsableInGenericContext<T>
|
109 | 113 | // CHECK-NEXT: inline T genericRet(const T & x) noexcept SWIFT_WARN_UNUSED_RESULT {
|
110 | 114 | // CHECK-NEXT: if constexpr (std::is_base_of<::swift::_impl::RefCountedClass, T>::value) {
|
111 | 115 | // CHECK-NEXT: void *returnValue;
|
112 |
| -// CHECK-NEXT: _impl::$s9Functions10genericRetyxxlF(reinterpret_cast<void *>(&returnValue), reinterpret_cast<const void *>(&x), swift::getTypeMetadata<T>()); |
| 116 | +// CHECK-NEXT: _impl::$s9Functions10genericRetyxxlF(reinterpret_cast<void *>(&returnValue), swift::_impl::getOpaquePointer(x), swift::getTypeMetadata<T>()); |
113 | 117 | // CHECK-NEXT: return ::swift::_impl::implClassFor<T>::type::makeRetained(returnValue);
|
114 | 118 | // CHECK-NEXT: } else if constexpr (::swift::_impl::isValueType<T>) {
|
115 | 119 | // CHECK-NEXT: return ::swift::_impl::implClassFor<T>::type::returnNewValue([&](void * _Nonnull returnValue) {
|
116 |
| -// CHECK-NEXT: _impl::$s9Functions10genericRetyxxlF(returnValue, reinterpret_cast<const void *>(&x), swift::getTypeMetadata<T>()); |
| 120 | +// CHECK-NEXT: _impl::$s9Functions10genericRetyxxlF(returnValue, swift::_impl::getOpaquePointer(x), swift::getTypeMetadata<T>()); |
117 | 121 | // CHECK-NEXT: });
|
118 | 122 | // CHECK-NEXT: } else {
|
119 | 123 | // CHECK-NEXT: T returnValue;
|
120 |
| -// CHECK-NEXT: _impl::$s9Functions10genericRetyxxlF(reinterpret_cast<void *>(&returnValue), reinterpret_cast<const void *>(&x), swift::getTypeMetadata<T>()); |
| 124 | +// CHECK-NEXT: _impl::$s9Functions10genericRetyxxlF(reinterpret_cast<void *>(&returnValue), swift::_impl::getOpaquePointer(x), swift::getTypeMetadata<T>()); |
121 | 125 | // CHECK-NEXT: return returnValue;
|
122 | 126 | // CHECK-NEXT: }
|
123 | 127 | // CHECK-NEXT: }
|
124 | 128 |
|
125 | 129 | // CHECK: template<class T>
|
126 | 130 | // CHECK-NEXT: requires swift::isUsableInGenericContext<T>
|
127 | 131 | // CHECK-NEXT: inline void genericSwap(T & x, T & y) noexcept {
|
128 |
| -// CHECK-NEXT: return _impl::$s9Functions11genericSwapyyxz_xztlF(reinterpret_cast<void *>(&x), reinterpret_cast<void *>(&y), swift::getTypeMetadata<T>()); |
| 132 | +// CHECK-NEXT: return _impl::$s9Functions11genericSwapyyxz_xztlF(swift::_impl::getOpaquePointer(x), swift::_impl::getOpaquePointer(y), swift::getTypeMetadata<T>()); |
129 | 133 | // CHECK-NEXT: }
|
0 commit comments