Commit Graph

572 Commits

Author SHA1 Message Date
Alex Lorenz
538ee30efb Merge pull request #60331 from hyp/eng/i/shimsInt
[interop][SwiftToCxx] NFC, move swift::Int&UInt declarations into shi…
2022-08-01 15:55:06 +01:00
Alex Lorenz
51f907675f [interop][SwiftToCxx] NFC, move swift::Int&UInt declarations into shims headers 2022-08-01 10:38:05 +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
32f2b71fdf [interop][SwiftToCxx] include <new> after <stdlib.h> (fixes local tests) 2022-07-28 20:43:36 +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
Alex Lorenz
c9bd89b115 [interop][SwiftToCxx] NFC, extract code to remap a property name to its own function 2022-07-26 14:21:30 +01:00
Alex Lorenz
760d59e8e1 [interop][SwiftToCxx] NFC, use FunctionSignatureModifiers to print 'static' 2022-07-26 14:20:30 +01:00
Alex Lorenz
5aafe4599c [interop][SwiftToCxx] NFC, use FunctionSignatureModifiers to print 'inline' 2022-07-26 14:08:09 +01:00
Alex Lorenz
6f86d60e54 [interop][SwiftToCxx] NFC, use FunctionSignatureModifiers to print 'const' 2022-07-26 14:04:23 +01:00
Alex Lorenz
a170eaf0fc [interop][SwiftToCxx] NFC, init FunctionSignatureModifiers values inline 2022-07-26 13:57:25 +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
Tongjie Wang
c2e8ec96eb Add variable name and indent parameter...
... to value witness table access sequence function
2022-07-18 18:28:58 -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
42b2cd2dd4 NFC, PrintAsClang: remove superfluous include 2022-07-15 17:14:35 +01: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
3dc7ff2084 stop printing if the enum is empty 2022-07-01 14:29:59 -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
Holly Borla
0053526c5d Merge pull request #41909 from hborla/existential-any-anyobject
[Sema] Use `ExistentialType` for `Any` and `AnyObject`.
2022-06-24 20:51:50 -07:00
Tongjie Wang
7c962b2d65 Improve C++ case printing 2022-06-24 04:01:41 -07:00
Becca Royal-Gordon
dfb8d7452a Merge pull request #59672 from beccadax/what-is-the-protocol-for-generating-sendable
Ignore Sendable conformances in PrintAsClang
2022-06-23 17:15:09 -07:00
Becca Royal-Gordon
8a8e71ea09 Ignore Sendable conformances in PrintAsClang
PrintAsClang previously tried to print Sendable conformances, which tripped an assertion and failed. Skip them instead.

Fixes rdar://95241184.
2022-06-23 13:16:41 -07:00
Tongjie Wang
d3cee061be use getNameStr() to retrieve identifier instead 2022-06-23 12:52:28 -07:00
Tongjie Wang
b98bb6adc2 [Interop][SwiftToCxx] emit helper cases class in C++ for Swift enum 2022-06-23 11:22:56 -07:00
Tongjie Wang
890ef3d269 clang-format on TODO 2022-06-21 20:25:02 -07:00
Tongjie Wang
c26e6b062b Improve test cases and change a FIXME to TODO 2022-06-21 15:56:49 -07:00
Tongjie Wang
00598e8019 [interop][SwiftToCxx] add initial support for passing/returning enums 2022-06-20 00:45:07 -07:00
Alex Lorenz
af8ae5973b Merge pull request #59547 from hyp/eng/struct-init
[interop][SwiftToCxx] emit struct initializers
2022-06-18 06:37:58 -07:00
Holly Borla
429488f6c9 [Sema] Use ExistentialType for Any and AnyObject. 2022-06-17 18:29:15 -07:00