Commit Graph

21 Commits

Author SHA1 Message Date
Andrew Sukach
a6d356d9a9 XFAIL Interop/cxx/stdlib/use-std-function.swift on Amazon Linux 2023
(cherry picked from commit 1a144932a7)
2025-09-24 20:44:36 -07:00
Max Desiatov
d6b376b722 XFAIL Cxx/stdlib/use-std-function.swift on Fedora 41 (#81102)
Unblocks toolchain builds which fail on this test https://ci.swift.org/job/oss-swift-package-fedora-41/2/console

(cherry picked from commit 5d7aa4df8a)
2025-09-09 22:49:43 -07:00
Egor Zhdan
28eceb4c2c [cxx-interop] Temporarily disable a test for std::function on UBI 9
Similar to 0a4eeabd.

rdar://151476434
(cherry picked from commit 30649f2391)
2025-05-28 14:49:39 -04:00
Egor Zhdan
0a4eeabd8d [cxx-interop] Temporarily disable a test for std::function on UBI 9
rdar://139839740
2024-11-14 13:45:25 +00:00
Akira Hatanaka
f73c2e51bd Revert "[SILGen] Fix the type of closure thunks that are passed const reference structs (#76903)" (#77309)
This reverts commit 9c44b79189.

The commit caused swift's deserialization code to crash.

rdar://138726860
2024-10-31 15:16:00 -07:00
Akira Hatanaka
a0b5e930b5 Disable use-std-function.swift on ubuntu-24.04 (#77101)
This fixes 9850a28ace, which was checking
for the wrong Ubuntu version.

rdar://138183421
2024-10-18 15:35:26 -07:00
Akira Hatanaka
9850a28ace Disable use-std-function.swift on ubuntu-24.10 (#77002)
The test is failing because a templated constructor of std::function
with an rvalue-reference parameter is called, which isn't supported yet.

rdar://137637142
2024-10-17 16:21:25 -07:00
Akira Hatanaka
9c44b79189 [SILGen] Fix the type of closure thunks that are passed const reference structs (#76903)
The thunk's parameter needs the @in_guaranteed convention if it's a
const reference parameter. However, that convention wasn't being used
because clang importer was removing the const reference from the
type and SILGen was computing the type of the parameter based on the
type without const reference.

This commit fixes the bug by passing the clang function type to
SILDeclRef so that it can be used to compute the correct thunk type.

This fixes a crash when a closure is passed to a C function taking a
pointer to a function that has a const reference struct parameter.

This recommits e074426 with fixes to
serialization/deserialization of function types. The fixes prevent clang
types of functions from being dropped during serialization.

rdar://131321096
2024-10-08 23:44:49 -07:00
Slava Pestov
9632979879 Revert "[SILGen] Fix the type of closure thunks that are passed const referen…"
This reverts commit e074426058.
2024-09-29 22:32:04 -04:00
Akira Hatanaka
e074426058 [SILGen] Fix the type of closure thunks that are passed const reference structs (#75491)
The thunk's parameter needs the @in_guaranteed convention if it's a
const reference parameter. However, that convention wasn't being used
because clang importer was removing the const reference from the
type and SILGen was computing the type of the parameter based on the
type without const reference.

This commit fixes the bug by passing the clang function type to
SILDeclRef so that it can be used to compute the correct thunk type.

This fixes a crash when a closure is passed to a C function taking a
pointer to a function that has a const reference struct parameter.

rdar://131321096
2024-09-27 07:04:47 -07:00
Egor Zhdan
530f705c92 [cxx-interop] Disable a test for std::function on Debian 12
Debian 12 ships with a version of libstdc++ that declares a templated constructor of `std::function` with an rvalue-reference parameter. This is not yet supported by Swift.

rdar://125816354
2024-09-25 14:53:47 +01:00
Egor Zhdan
d7212ff7f5 [cxx-interop] Add one more test for std::function
While initializing a `std::function` that takes `const std::string&` as a parameter currently crashes, changing the parameter type to `std::string` should work fine.
2024-07-22 13:54:09 +01:00
Egor Zhdan
b7fc492b14 [cxx-interop] Conditionally re-enable a test for std::function, pt 3
This also disables the test on Fedora.

rdar://125816354
2024-07-05 16:12:40 +01:00
Egor Zhdan
6c17565bd3 [cxx-interop] Conditionally re-enable a test for std::function, pt 2
The post-commit CI uses a slightly different version of UBI.

rdar://125816354
2024-07-04 15:28:49 +01:00
Egor Zhdan
af311ff003 [cxx-interop] Conditionally re-enable a test for std::function
Let's re-enable the test on all platforms except Ubuntu 22.04 and UBI 9, which are shipped with libstdc++11.

rdar://125816354
2024-07-03 12:36:13 +01:00
Pavel Yaskevich
0987555a9c [Tests] NFC: Temporarily disable test/Interop/Cxx/stdlib/use-std-function.swift
The test is blocking nightly toolchains.
2024-06-27 21:12:40 -07:00
Egor Zhdan
3243228897 [cxx-interop] Allow initializing std::function from Swift closures
This adds a Swift initializer to instantiations of `std::function` that accepts a Swift closure with `@convention(c)`.

rdar://103979602
2024-06-14 19:05:45 +01:00
Egor Zhdan
1be7230876 [cxx-interop] Use C++17 standard by default
Clang is using C++17 standard version by default since Clang 16.

Swift’s ClangImporter should do the same, to make sure that clients who run clang and then swiftc without explicit std version see consistent behavior.

rdar://125777068
2024-04-02 16:23:32 +01:00
Egor Zhdan
19a257b36b [cxx-interop] Test stdlib support with newer C++ standards 2024-03-21 16:44:38 +00:00
Egor Zhdan
78b9de1391 [cxx-interop] Run tests with swift-6 compat mode 2024-02-23 16:24:14 +00:00
Egor Zhdan
2d0863aba2 [cxx-interop] Initial tests for std::function usage
This makes sure that `std::function` is imported consistently on supported platforms, and that it allows basic usage: calling a function with `callAsFunction`, initializing an empty function, and passing a function retrieved from C++ back to C++ as a parameter.

rdar://103979602
2024-01-11 12:02:12 +00:00