Commit Graph

454 Commits

Author SHA1 Message Date
Alex Lorenz
3a9b6dce9d [interop][SwiftToCxx] add support for emitting Swift stdlib dependency in one header file
This is the default behavior. You can disable this by specifying the -clang-header-expose-decls= flag explicitly when generating the header
2022-09-28 08:08:48 -07:00
Alex Lorenz
c193a63fd4 [interop][SwiftToCxx] add -enable-experimental-cxx-interop-in-clang-header flag that lets you enable reverse interop only 2022-09-27 11:26:21 -07:00
swift-ci
f49c2f1cd9 Merge pull request #61308 from hyp/eng/raw-enum-test
[interop][SwiftToCxx] NFC, add a test for raw representable enum
2022-09-26 22:03:26 -07:00
Alex Lorenz
717c29992d [interop][SwiftToCxx] NFC, add a test for raw representable enum 2022-09-26 19:37:27 -07:00
Alex Lorenz
5736daf1f1 [interop][SwiftToCxx] support initializers for classes 2022-09-26 17:04:40 -07:00
Alex Lorenz
6f9b683617 [interop][SwiftToCxx] add support for bridging static properties 2022-09-26 12:50:13 -07:00
Alex Lorenz
ae549531ac Merge pull request #61225 from hyp/eng/fwd-generic-trait
[interop][SwiftToCxx] Declare the generic usability type trait before…
2022-09-21 15:56:14 -07:00
Alex Lorenz
2a05109c58 [interop][SwiftToCxx] Declare the generic usability type trait before the C++ class that represents the Swift type
This allows you to import a method that returns the type of the context in which the method is declared when such
type is a generic parameter in another type. This means that it's now possible to bridge the initializer for
RawRepresentable enums.
2022-09-21 07:57:32 -07:00
Alex Lorenz
1d6d3ff970 [interop][SwiftToCxx] trap on moves of Swift values for now
Move support will be added later
2022-09-21 06:59:29 -07:00
Alex Lorenz
2132cc91d0 [interop][SwiftToCxx] do not use std::move to move the returned C++ value
move needs <utility>, which is not includable in the test SDK.
2022-09-19 12:25:42 -07:00
Alex Lorenz
143ce1e682 [interop][SwiftToCxx] bridge Swift's Optional type in an experimental manner 2022-09-15 12:35:33 -07:00
Alex Lorenz
b96bcb4691 [interop][SwiftToCxx] prohibit empty tuple param type 2022-09-15 11:22:22 -07:00
Alex Lorenz
7925701ed3 [interop][SwiftToCxx] support returning class values in enum's generic associated value getter 2022-09-14 12:37:27 -07:00
Alex Lorenz
773a0436cf [interop][SwiftToCxx] extract generic associated value from enum 2022-09-14 12:21:18 -07:00
Alex Lorenz
07337cdaf6 [interop][SwiftToCxx] initial generic enum support 2022-09-14 11:37:50 -07:00
Alex Lorenz
b410886223 Merge pull request #61067 from hyp/eng/array-interface
[interop][SwiftToCxx] experimentally expose exposable Swift's Array members to C++
2022-09-13 07:20:50 -07:00
Alex Lorenz
8c48d268d5 [interop][SwiftToCxx] expose subscript getter for Array's operator [] 2022-09-12 21:13:44 -07:00
Alex Lorenz
d5c531fefc [interop][SwiftToCxx] experimentally expose exposable Swift's Array members to C++ 2022-09-12 20:42:16 -07:00
Alex Lorenz
1a449f5904 [interop][SwiftToCxx] emit members in extensions for same-type 2022-09-12 20:38:21 -07:00
Alex Lorenz
6ed62904d3 Merge pull request #61053 from hyp/i/cxx-type-in-generic-ctx
[interop] use C++ value types bridged to Swift in Swift generic context from C++
2022-09-12 18:59:42 -07:00
Alex Lorenz
0fea0c4eca [interop][SwiftToCxx] handle Swift tuples are unsupported types for now 2022-09-12 17:24:20 -07:00
Alex Lorenz
0dcb8b58e5 [interop][SwiftToCxx] use C++ types bridged to Swift in Swift generic context from C++ ♾ 2022-09-12 13:05:49 -07:00
Tongjie Wang
90e8d16794 [Introp][SwiftToCxx] Fix enum implementation test related to stub struct 2022-09-09 23:48:22 -07:00
Alex Lorenz
a975241c1b Merge pull request #61004 from WANGJIEKE/cxx-interop-enum-property-method
[Interop][SwiftToCxx] Support printing methods and properties for enums
2022-09-09 09:22:19 -07:00
Tongjie Wang
5a55cd7ba2 [Interop][SwiftToCxx] Support printing methods and properties for enums 2022-09-08 11:05:20 -07:00
Alex Lorenz
1d164039b1 [interop][SwiftToCxx] experimentally expose Swift's Array type
This is done without annotations on the stdlib yet while @_expose is still experimental
2022-09-08 11:04:03 -07:00
Alex Lorenz
4c7015ad68 [interop][SwiftToCxx] ensure LoadableByAddress lowering is done on the SILFunction for while we're lowering the signature for
This correctly now passes self parameters for direct values that are too large to be direct
2022-09-07 17:42:50 -07:00
Alex Lorenz
f4de75ae2c [interop][SwiftToCxx] 'self' param should be handled by type param visitor 2022-09-07 12:45:38 -07:00
Alex Lorenz
1696f94223 [interop][SwiftToCxx] reimplement function lowering to correctly distinguish between direct/indirect return values and parameters 2022-09-07 11:43:38 -07:00
Alex Lorenz
e98d908ff5 Merge pull request #60858 from Robertorosmaninho/cxx-interop/SwiftToCxxErrorHandling
[SwiftToCxx] Including Cxx representation of Swift's Error
2022-09-07 08:55:27 -07:00
Roberto Rosmaninho
68bfbddf14 [SwiftToCxx] Creating new test case and fixing namespace 2022-09-05 10:38:28 -03:00
Alex Lorenz
3e4b52c42a [interop][SwiftToCxx] add support for generic methods in generic structs ♺ 2022-09-01 13:01:26 -07:00
Alex Lorenz
6e8b0be181 [interop][SwiftToCxx] add test to cover initializer in generic struct 2022-09-01 12:35:51 -07:00
Alex Lorenz
d9f4c072cc [interop][SwiftToCxx] correctly invoke property accessors in generic structs 2022-09-01 06:57:49 -07:00
Alex Lorenz
a5043c354d [interop][SwiftToCxx] add support for invoking methods in generic structs 2022-08-31 20:19:19 -07:00
Alex Lorenz
ef5d11aab8 [interop][SwiftToCxx] NFC, Make swift::getTypeMetadata accessor part of struct template
This allows partial template specializations for adding metadata accessor for generic types 🤩
2022-08-31 17:16:45 -07:00
Alex Lorenz
4154b56745 [interop][SwiftToCxx] unify generic function printing with generic struct printing
This is a pre-requisite for supporting methods in generic structs.
2022-08-31 15:31:04 -07:00
Alex Lorenz
983588851e [interop][SwiftToCxx] fix function_with_array.swift test 2022-08-31 15:31:04 -07:00
Alex Lorenz
907b3a949c [interop][SwiftToCxx] NFC, test remove unused warning flag 2022-08-31 14:02:17 -07:00
Alex Lorenz
f89f64a5cb [interop][SwiftToCxx] add support for passing generic structs with concrete type params 2022-08-31 14:02:17 -07:00
Alex Lorenz
031b779031 [interop][SwiftToCxx] add support for returning generic types bounded to concrete generic params 2022-08-31 14:02:17 -07:00
Alex Lorenz
c526ac8a0d [interop][SwiftToCxx] add 'inout' support for passing generic struct 2022-08-31 14:02:17 -07:00
Alex Lorenz
7012efd2cd [interop][SwiftToCxx] add a testcase for generic struct passthrough 2022-08-31 14:02:17 -07:00
Alex Lorenz
6f43efe264 [interop][SwiftToCxx] add a restriction for calling only supported type metadata accessor function for generic types 2022-08-31 14:02:17 -07:00
Alex Lorenz
9f26709ffc [interop][SwiftToCxx] cleanup generic struct tests 2022-08-31 14:02:17 -07:00
Alex Lorenz
7d6cdbc445 [interop][SwiftToCxx] pass generic type to a function by value (non specialized generic though) 2022-08-31 14:02:17 -07:00
Alex Lorenz
ebd8dea0fd [interop][SwiftToCxx] return generic structs without concrete type specialization 2022-08-31 14:02:17 -07:00
Alex Lorenz
45d209fe1c [interop][SwiftToCxx] initial generic struct support 2022-08-31 14:02:15 -07:00
Alex Lorenz
8214b85f6b Merge pull request #60842 from WANGJIEKE/cxx-interop-enum-creation
[Interop][SwiftToCxx] Support enum creation from Cxx
2022-08-31 14:00:50 -07:00
Doug Gregor
28644db815 Merge pull request #60851 from DougGregor/print-cxx-sugared-types
[Print as C++] Don't crash on sugared types
2022-08-30 22:52:47 -07:00