Commit Graph

454 Commits

Author SHA1 Message Date
Tongjie Wang
00598e8019 [interop][SwiftToCxx] add initial support for passing/returning enums 2022-06-20 00:45:07 -07:00
Alex Lorenz
71065e94d3 [interop][SwiftToCxx] emit struct initializers
They're emtited as static init methods in the C++ class
2022-06-17 16:00:23 -07:00
Alex Lorenz
b47bb5b66e [interop][SwiftToCxx] support mutating struct methods in C++ 2022-06-17 07:58:19 -07:00
Alex Lorenz
0c909c2f26 Merge pull request #59482 from hyp/eng/emit-resilient-structs
[interop][SwiftToCxx] Add support for emitting resilient struct bindings
2022-06-16 20:20:52 -07:00
Alex Lorenz
b8ee625f77 [interop][SwiftToCxx] fix aligned allocation refs 2022-06-16 14:14:40 -07:00
Alex Lorenz
5c3b4ca1da [interop][SwiftToCxx] annotate OpaqueStorage with noexcept 2022-06-15 21:56:25 -07:00
Alex Lorenz
38387ad500 [interop][SwiftToCxx] add _Nonnull to resilient struct constructor that takes in VWT 2022-06-15 21:51:11 -07:00
Alex Lorenz
61e484c410 [interop][SwiftToCxx] correctly align allocation for opaque Swift value 2022-06-15 21:47:39 -07:00
Alex Lorenz
f577330b40 [interop][SwiftToCxx] fix copy constructor for resilient structs 2022-06-15 20:56:42 -07:00
Alex Lorenz
5474d7e54d [interop][SwiftToCxx] Add support for emitting resilient struct bindings 2022-06-15 20:33:23 -07:00
Alex Lorenz
562e221f8d Merge pull request #59461 from hyp/eng/emit-instance-struct-methods
[interop][SwiftToCxx] emit non-mutating instance methods for structs
2022-06-15 20:06:30 -07:00
Alex Lorenz
0d5c138821 [interop][SwiftToCxx] place ptrauth attribute on the function type itself for value witness function types
Fixes rdar://95224817
2022-06-15 16:07:19 -07:00
Alex Lorenz
f2b4a43c06 [interop][SwiftToCxx] emit non-mutating instance methods for structs 2022-06-15 07:35:13 -07:00
Alex Lorenz
d7fd1233a9 [interop][SwiftToCxx] emit instance property getters for structs 2022-06-14 17:20:37 -07:00
Alex Lorenz
776c5d6ba0 Merge pull request #59418 from WANGJIEKE/cxx-interop-inout-struct
[interop][SwiftToCxx] Pass struct to function as inout
2022-06-14 17:06:16 -07:00
Alex Lorenz
4d0d4afcbc Merge pull request #59419 from apple/eng/copy-destroy-swift-value-in-cxx
[interop][SwiftToCxx] destroy and initWithCopy Swift structs in C++
2022-06-14 12:05:24 -07:00
Tongjie Wang
0505266ef7 fix printing for inout type with nullability 2022-06-14 11:20:19 -07:00
Alex Lorenz
3533686605 [interop][SwiftToCxx] emit copy constructor that calls value witness initWithCopy function for Swift structs 2022-06-13 15:33:43 -07:00
Alex Lorenz
1a337ea99c Merge pull request #59406 from hyp/eng/type-metadata-access-f-interop
[interop][SwiftToCxx] emit swift type metadata access function declar…
2022-06-13 15:03:09 -07:00
Alex Lorenz
b787172302 [interop][SwiftToCxx] emit destructor that calls value witness destroy function for Swift structs 2022-06-13 15:02:55 -07:00
Tongjie Wang
f033aad3c1 [interop][SwiftToCxx] pass struct to function as inout 2022-06-13 14:40:55 -07:00
Alex Lorenz
a65ddbe997 [interop][SwiftToCxx] print out value witness table definition in swift::_impl 2022-06-13 14:26:25 -07:00
Alex Lorenz
9254c47b2c [interop][SwiftToCxx] emit swift type metadata access function declaration for structs 2022-06-13 09:16:17 -07:00
Alex Lorenz
ddf92684f3 Merge pull request #59292 from WANGJIEKE/cxx-interop-not-expose-async-and-transparent-func
[cxx-interop] Don't expose async or @_alwaysEmitIntoClient functions
2022-06-10 15:13:51 -07:00
Tongjie Wang
96da7dbe0c disable availability checking for async test 2022-06-09 10:06:33 -07:00
Tongjie Wang
f6443f0684 fix test case for concurrency availability 2022-06-08 10:37:19 -07:00
Alex Lorenz
132729906c [interop][SwiftToCxx] pass / return Swift struct values between C/C++ and Swift 2022-06-08 07:03:24 -07:00
Tongjie Wang
abfccd1613 expose @_transparent; don't expose @_alwaysEmitIntoClient and async 2022-06-07 16:21:58 -07:00
Tongjie Wang
c295db47ec [cxx-interop] Don't expose unsupported top-level async or @_transparent functions 2022-06-06 20:43:57 -07:00
Alex Lorenz
c7eaeb0182 Merge pull request #59119 from hyp/eng/swift-struct-layout-in-cxx
[interop][SwiftToCxx] Gather initial struct layout information and em…
2022-06-02 21:05:58 -07:00
Alex Lorenz
0591246907 Merge pull request #59217 from Robertorosmaninho/interop/SwiftToCXXErrorTest
[Interop] [SwiftToCxx] New Throw Error Test
2022-06-02 19:41:33 -07:00
Roberto Rosmaninho
c4ca064327 Creating new test to check that a function don't throws when it should throw 2022-06-02 00:46:01 -03:00
Alex Lorenz
db5119fdef fix testcase to avoid -emit-ir 2022-06-01 14:09:06 -07:00
Alex Lorenz
42c6ff63b8 [interop][SwiftToCxx] Gather initial struct layout information and emit struct stubs with storage in C++
This change extends the clang header printer to start emitting C++ classes for Swift struct types with the correct struct layout in them (size + alignment)
2022-06-01 14:06:25 -07:00
Tongjie Wang
fb926800f7 add test for generated C declaration 2022-06-01 11:14:35 -07:00
Tongjie Wang
b9c492aed4 print as pointer type in C layer 2022-05-31 20:23:04 -07:00
Tongjie Wang
ba2dcfb389 [cxx-interop] support inout params as cxx references 2022-05-29 20:55:13 -07:00
Alex Lorenz
a7053e458f [interop][swiftToCxx] emit empty skeleton C++ classes for Swift struct decls 2022-05-25 12:26:25 -07:00
Tongjie Wang
3adb9d3888 add pass through test for simd vector cxx interop 2022-04-12 04:37:48 -07:00
Alex Lorenz
8d4366b2d5 [cxx-interop] emit correct parameter name in the inline C++ function when the identifier conflicts with a keyword 2022-03-30 10:08:49 -07:00
Alex Lorenz
f7902a6095 [cxx-interop] Emit C++ inline function thunks that with correct primitive types 2022-03-29 13:37:01 -07:00
Alex Lorenz
80bc75ab9b [cxx-interop] Emit C++ declarations only when '-clang-header-expose-public-decl' is enabled
This fix also ensures that we only emit C++ functions for now
2022-03-20 20:22:02 -07:00
Alex Lorenz
2e3aa87737 Revert "Revert "Merge pull request #41831 from hyp/unify-header""
This reverts commit 4c9582c295.
2022-03-19 13:36:28 -07:00
Alex Lorenz
4c9582c295 Revert "Merge pull request #41831 from hyp/unify-header"
This reverts commit cd93d23bac, reversing
changes made to f9f5476e9a.
2022-03-18 10:03:07 -07:00
Alex Lorenz
9d52099d5b [cxx-interop] start to emitting a unified header file for a Swift module
This change removes the -emit-cxx-header option, and adds a new -emit-clang-header-path option instead. It's aliased to -emit-objc-header-path for now, but in the future, -emit-objc-header-path will alias to it. After this change Swift can start emitting a single header file that can be expose declarations to C, Objective-C, or C++. For now C++ interface is generated (for all public decls) only when -enable-cxx-interop flag is passed, but that behavior will change once  attribute is supported.
2022-03-17 10:34:47 -07:00
Alex Lorenz
6b8108bf59 [cxx-interop] use SWIFT_EXTERN for Swift function prototypes
This will allow these functions to be used from C.
2022-03-13 12:11:35 -07:00
Alex Lorenz
858a847d27 [cxx-interop] use SWIFT_NOEXCEPT for Swift function prototypes
This will allow these functions to be used from C.

Also add a static_assert to verify that noexcept is actually used.
2022-03-13 11:08:32 -07:00
Alex Lorenz
2c2fa566d8 [cxx-interop][test] add %check-interop-cxx-header-in-clang test command substitution to parse and validated generated C++ header in multiple C++ language modes
This ensures that we validate C++14, C++17, and C++20
2022-03-11 20:51:24 -08:00
Alex Lorenz
ebcf2f707a [interop] fixup the interop build test substitutions 2022-03-10 10:19:06 -08:00
Alex Lorenz
07a1f569c6 [interop] add target-interop-clangxx test expansion to build C++ file with /MD msvc mode 2022-03-10 09:27:05 -08:00