Commit Graph

171 Commits

Author SHA1 Message Date
Alex Lorenz
7caf34c190 [interop][SwiftToCxx] apply inline and artificial attributes to lambdas used with returnNewValue 2023-03-03 11:45:46 -08:00
Alex Lorenz
f8c3895f32 [interop][SwiftToCxx] print availability attributes for Swift decls in C++ 2023-02-27 12:07:36 -08:00
Alex Lorenz
3948a2a5d3 [interop][SwiftToCxx] annotate inline thunks with SWIFT_INLINE_THUNK
This macro applies always_inline in addition to inline. It also applies artificial, which lets debugger know that this is an artificial function. The used attribute is added in debug builds to ensure that the symbol is emitted in the binary so that LLDB can invoke it.
2023-02-24 11:23:46 -08:00
Alex Lorenz
c9f9d9025b [interop][SwiftToCxx] fix offset computation for 32 bit platforms for vtable dispatch 2023-02-13 10:30:38 -08:00
Alex Lorenz
540202fed8 [interop][SwiftToCxx] dispatch virtual Swift methods using a relative offset into the vtable for classes deriving from resilient classes 2023-02-13 10:30:32 -08:00
Alex Lorenz
981e828b2a [interop][SwiftToCxx] dispatch swift class methods using signed isa and signed method pointer on arm64e 2023-02-11 14:05:59 -08:00
Alex Lorenz
b63577d89e [interop][SwiftToCxx] use vtable/thunk to dispatch class subscript getters 2023-02-11 05:55:54 -08:00
Alex Lorenz
71e4462508 [interop][SwiftToCxx] use vtable offset/thunk to dispatch class property accessors 2023-02-11 05:55:47 -08:00
Alex Lorenz
9e32761578 [interop][SwiftToCxx] dispatch virtual calls via thunks for resilient classes 2023-02-10 16:32:54 -08:00
Alex Lorenz
b7007cb748 [interop][SwiftToCxx] dispatch Swift class methods correctly using the vtable 2023-02-09 20:20:53 -08:00
Alex Lorenz
0b0cc99c98 [interop][SwiftToCxx] avoid -Wshadow warning for C++ representation of enum member parameters 2023-02-08 12:33:18 -08:00
Alex Lorenz
8305c7d5de [interop][SwiftToCxx] add C++ bindings for static methods 2023-02-08 10:25:17 -08:00
Alex Lorenz
3b3d6c825a [interop][SwiftToCxx] Annotate emitted declarations with Clang's external_source_symbol attribute
Each emitted declaration is annotated with the external_source_symbol with its own USR, to allow Clang's indexer to recognize this declaration as a Swift declaration with a specific USR
2023-01-12 12:15:01 -08:00
Alex Lorenz
1d7c0ee7a5 [interop][SwiftToCxx] NFC, make 'noexcept' a function signature modifier 2023-01-11 11:47:09 -08:00
Roberto Rosmaninho
fc68fb304e Refactoring the C++ thunk to directly return the Swift::Expected intead od the SWIFT_RETURN_THUNK macro 2022-12-19 19:48:35 -03:00
Roberto Rosmaninho
80e75469bf [Interop][SwiftToCxx] Replacing static by inline on _SwiftStdlibCxxOverlay.h and fixing code duplication on PrintClangFunction.cpp 2022-12-14 12:07:43 -03:00
Roberto Rosmaninho
ce666ac592 [Interop][SwiftToCxx] Adding support to return Swift::Expected when exceptions are not available. 2022-12-14 12:07:43 -03:00
Slava Pestov
65d2d4d621 IRGen: Encapsulate fields of GenericRequirement better 2022-12-11 22:14:37 -05:00
Alex Lorenz
510b7675f4 [interop][CxxToSwiftToCxx] fix the tests for unsupported class template instantions; emit C++ type metadata accessors for type aliased templates 2022-12-08 21:28:29 -08:00
Roberto Rosmaninho
f652c8ef63 [Interop][SwiftToCxx] Passing swift::Error declaration from _SwiftCxxInteroperability.h to Swift::Error in _SwiftStdlibCxxOverlay.h 2022-11-18 22:16:00 -03:00
Alex Lorenz
8336edd344 [interop][SwiftToCxx] add support for constructing generic enum cases in C++
We only support cases with no payload, or one associated value still
2022-11-03 12:21:27 -07:00
Alex Lorenz
a66cc52109 [interop][SwiftToCxx] add static_assert type checking for generic functions in pre-C++20 mode
In the future we should also use enable_if to correctly resolve overloads
2022-11-01 17:21:01 -07:00
Alex Lorenz
4b52ae08fa [interop][SwiftToCxx] check that generics can be built in C++17/C++14 mode 2022-11-01 16:40:42 -07:00
Alex Lorenz
8710c2685a [interop][SwiftToCxx] Fix a bug with bridging class initializer in version Swift 5 2022-10-03 16:40:28 -07:00
Alex Lorenz
e3a51c74dd [interop][SwiftToCxx] support interop with FRT in the generated C++ bindings 2022-09-27 10:37:46 -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
bded6c5bc2 [interop][SwiftToCxx] bridge ObjC class types to C++ too (without ObjC guards first) 2022-09-25 13:19:37 -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
88913c1d65 [interop][SwiftToCxx] expose generic type traits for C++ types in generated header before it's used first 2022-09-13 07:47:30 -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
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
Alex Lorenz
26e5742fe7 [interop][SwiftToCxx] emit generic type traits for C++ types bridged into Swift and then back to C++ 2022-09-12 12:39:30 -07:00
Alex Lorenz
0db14574c1 [interop][SwiftToCxx] pass C++ value types into Swift correctly 2022-09-12 07:12:50 -07:00
Alex Lorenz
b4d7a0c208 [interop][SwiftToCxx] bridge returned C++ record types back to C++ from Swift 2022-09-11 18:42:41 -07:00
Alex Lorenz
661ae6bd1a [interop][SwiftToCxx] cleanup the function signature stuff 2022-09-07 14:06:28 -07:00
Alex Lorenz
c351f3a550 [interop][SwiftToCxx] error result param should be handled by lowered function signature 2022-09-07 12:55:12 -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
0592894e33 [interop][SwiftToCxx] move generic additional type parameters into lowered function signature 2022-09-07 12:22:04 -07:00
Alex Lorenz
4520c52ac6 [interop][SwiftToCxx] handle indirect result values as part of parameter list 2022-09-07 11:59:25 -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