Commit Graph

454 Commits

Author SHA1 Message Date
Alex Lorenz
e03903cb51 [interop][SwiftToCxx] add a test to verify class reference can't be directly constructed from a void * 2022-08-02 18:59:58 +01:00
Alex Lorenz
0ca61069ea [interop][SwiftToCxx] Add a base ref counted Swift class type to _SwiftCxxInteroperability.h header 2022-08-02 18:54:14 +01:00
Alex Lorenz
c332a90a8a [interop][SwiftToCxx] retain & release class values when a C++ class reference is copy assigned 2022-08-02 17:52:49 +01:00
Alex Lorenz
e289865861 [interop][SwiftToCxx] retain class values when a C++ class reference is copy constructed 2022-08-02 17:34:21 +01:00
Alex Lorenz
e1d812a848 [interop][SwiftToCxx] pass class parameter types by 'inout' 2022-08-02 16:48:12 +01:00
Alex Lorenz
51c0a3ff05 [interop][SwiftToCxx] add support for passing class types to Swift functions 2022-08-02 15:22:16 +01:00
Alex Lorenz
a8ed297e8b [interop][SwiftToCxx] class bridging: use makeRetained to return a class value from Swift 2022-08-02 14:55:58 +01:00
Alex Lorenz
26d55a2b83 [interop][SwiftToCxx] start emitting bindings for Swift class types
This includes release on destruction, and correctly returning class values from Swift to C++.
2022-08-02 09:25:35 +01:00
Alex Lorenz
613b3223d9 Merge pull request #60333 from hyp/i/test-xref-enums
[interop][SwiftToCxx] NFC, add test to cover cross-module enum refs
2022-08-01 18:47:19 +01:00
Alex Lorenz
702713fb5c [interop][SwiftToCxx] NFC, add test to cover cross-module enum refs 2022-08-01 14:19:34 +01:00
Alex Lorenz
af32bbf8f3 [interop][SwiftToCxx] generics: add support for returning primitive generic types 2022-08-01 10:28:03 +01:00
Alex Lorenz
ea9276fb60 Merge pull request #60298 from hyp/i/gen/inout
[interop][SwiftToCxx] generics: support inOut generic param
2022-08-01 08:31:20 +01:00
Alex Lorenz
fbccda98ad Merge pull request #60304 from hyp/eng/generic-trait-move-hdr
[interop][SwiftToCxx] NFC, move generic traits declarations to shims …
2022-07-31 12:29:44 +01:00
Alex Lorenz
3f1dd13cac Merge pull request #60300 from WANGJIEKE/cxx-interop-fix-pointer-annotation
[Interop][SwiftToCxx] Add pointer nullability annotation for inout function
2022-07-31 12:29:34 +01:00
Alex Lorenz
9ff7f94865 [interop][SwiftToCxx] NFC, move generic traits declarations to shims header 2022-07-29 13:59:04 +01:00
Tongjie Wang
19c7d79540 Add missing pointer nullability annotation for inout function 2022-07-29 02:29:15 -07:00
Alex Lorenz
c31b6cfb0c [interop][SwiftToCxx] generics: support inOut generic param 2022-07-29 09:15:40 +01:00
Alex Lorenz
567bb850cc [interop][SwiftToCxx] add _SwiftCxxInteroperability.h shims header and import it for C++ header mode 2022-07-29 08:54:27 +01:00
Alex Lorenz
32723f7e67 [interop][SwiftToCxx] initial generic function support: pass generic parameters
Only primitive types are supported at the moment from C++ as the type traits aren't emitted for all types yet
2022-07-28 22:52:21 +01:00
Alex Lorenz
fa99c7864e [interop][SwiftToCxx] re-enable enum runtime tests on ARM64e 2022-07-28 12:13:49 +01:00
Alex Lorenz
8da01aa0f1 Merge pull request #60087 from WANGJIEKE/cxx-interop-extract-enum-payload
[Interop][SwiftToCxx] Initial support for getting associated values from enum
2022-07-28 12:06:44 +01:00
Alex Lorenz
0edddde7ae [interop][SwiftToCxx] Add inout support for UnsafePointer/UnsafeMutablePointer param types 2022-07-26 15:39:29 +01:00
Alex Lorenz
9a80d78263 [interop][SwiftToCxx] pass and return UnsafePointer/UnsafeMutablePointer types 2022-07-26 15:30:14 +01:00
Alex Lorenz
3b4c6bffd8 [interop][SwiftToCxx] remap bool is/has property getters directly as is/has methods in C++ 2022-07-26 14:34:40 +01:00
Tongjie Wang
5b2c6e5b53 use placement new so we don't destory an enum twice 2022-07-25 08:27:19 -07:00
Alex Lorenz
7e0c2a987d Merge pull request #60079 from Robertorosmaninho/cxx-interop/SwiftToCxxErrorHandling
[Interop] [SwiftToCxx] Implementing a naive exception to be thrown in C++ if an Error is thrown in Swift
2022-07-20 15:54:48 +01:00
Roberto Rosmaninho
da8847d907 Replacing iostream by cstdio and cout by printf 2022-07-19 15:03:31 -03:00
Tongjie Wang
38b6947fdd update test case for arm64e value witness table authentication 2022-07-18 18:21:12 -07:00
Tongjie Wang
290e527b0b [Interop][SwiftToCxx] Initial support for getting associated values from enum
improve test cases

add support for primitive types
2022-07-18 18:19:00 -07:00
Alex Lorenz
23ed6e8c9f [interop][SwiftToCxx] support instance property setters in C++ 2022-07-18 17:49:51 +01:00
Alex Lorenz
5b05d3dc67 [interop][SwiftToCxx] arm64e: authenticate value witness table in C++
Fixes arm64e test failures for C++ interop tests
2022-07-18 13:50:32 +01:00
Roberto Rosmaninho
b15c6a5537 Implementing a naive exception to be thrown in C++ if an Error is thrown in Swift
Creating new Interop - SwiftToCxx test
2022-07-15 20:14:13 -03:00
Alex Lorenz
88c55c1778 [interop][SwiftToCxx] add support for passing/returning value types from other modules 2022-07-15 17:14:35 +01:00
Alex Lorenz
ceb093df12 Merge pull request #59787 from Robertorosmaninho/cxx-interop/SwiftToCxxErrorHandling
[Interop] [SwiftToCxx] Using the hardcode noexcept flags on the compiler only to non throwing functions
2022-07-15 13:42:44 +01:00
Roberto Rosmaninho
ff222acebc Setting hardcode SWIFT_NOEXCEPT and noexcept flags only to
non-throwing functions.
Activating swift-functions-errors tests
Inserting macros and additional parameters in C and C++ functions following the pattern to lowering to LLVM IR.
2022-07-14 12:34:53 -03:00
Alex Lorenz
f49e26ee37 [interop][SwiftToCxx] mark value witness table functions as noexcept
This is only supported in C++17, so C++14 mode will still not be noexcept
2022-07-14 15:42:27 +01:00
Alex Lorenz
12f6d970b7 [interop][SwiftToCxx] mark the alloc/free heap allocation functions as noexcept 2022-07-14 15:16:07 +01:00
Tongjie Wang
23d60acbc2 sort cases based on their assigned tag indices before printing 2022-07-06 12:46:11 -07:00
Tongjie Wang
e7ea37f7d6 print C's abort in default branch 2022-07-05 12:06:38 -07:00
Tongjie Wang
7ebcb7b33a [Interop][SwiftToCxx] Implement enum case switching 2022-06-30 22:41:15 -07:00
Alex Lorenz
0dae89613a Merge pull request #59669 from WANGJIEKE/cxx-interop-enum-cases-class
[Interop][SwiftToCxx] Emit helper cases class in C++ for Swift enum
2022-06-25 11:00:28 +01:00
Tongjie Wang
7c962b2d65 Improve C++ case printing 2022-06-24 04:01:41 -07:00
Tongjie Wang
b5721806fb [Interop][SwiftToCxx] Fix small enum tests 2022-06-23 14:17:04 -07:00
Tongjie Wang
b98bb6adc2 [Interop][SwiftToCxx] emit helper cases class in C++ for Swift enum 2022-06-23 11:22:56 -07:00
Alex Lorenz
c6ff96f853 Merge pull request #59584 from WANGJIEKE/cxx-interop-enum-pass-return
[interop][SwiftToCxx] Add initial support for passing/returning enums
2022-06-23 17:02:35 +01:00
Tongjie Wang
db8940cbd0 add UNSUPPORTED: CPU=arm64e to tests 2022-06-22 14:28:04 -07:00
Alex Lorenz
8fa37c214d Mark SwiftToCxx execution tests as unsupported on arm64e for now 2022-06-22 22:19:10 +01:00
Alex Lorenz
0f0039a04c Merge pull request #59622 from hyp/eng/test-frozen-struct
[interop][SwiftToCxx] NFC, add a test case for emitting @frozen structs
2022-06-22 06:07:34 -07:00
Alex Lorenz
455007e63e [interop][SwiftToCxx] NFC, add a test case for emitting @frozen structs 2022-06-21 16:53:59 -07:00
Tongjie Wang
c26e6b062b Improve test cases and change a FIXME to TODO 2022-06-21 15:56:49 -07:00