Commit Graph

22 Commits

Author SHA1 Message Date
Alex Lorenz
ab948f4897 [interop][SwiftToCxx] ensure that buffers for heap allocated Swift values are released after parameter copy is consumed 2023-10-29 17:08:02 -07:00
Alex Lorenz
4e519a8d8b [interop][SwiftToCxx] consuming parameters should be passed using an additional copy
Fixes https://github.com/apple/swift/issues/69372
2023-10-27 17:29:52 -07:00
Alex Lorenz
39d86bc701 [interop][SwiftToCxx] the not yet implemented move constructor for Swift value types should lead to link error when a move is used in Swift, not runtime error 2023-05-07 08:55:28 -07:00
Alex Lorenz
16b1fe173f [interop][SwiftToCxx] moving a Swift class in C++ performs a copy
C++ does not have a consuming move, so fallback to copy instead

Resolves https://github.com/apple/swift/issues/64702
2023-05-07 08:55:20 -07:00
Augusto Noronha
cfb3e5abae Reintroduce alwaysinline and nodebug as fallbacks to SWIFT_INLINE_THUNK_ATTRIBUTES
If the C++ compiler doesn't support the transparent_stepping attribute,
fallback to annotating inline thunks with the alwaysinline and nodebug
attributes.
2023-04-04 10:42:02 -07:00
Augusto Noronha
7c8523cfec Use "transparent_stepping" attribute in C++ compiler generated interop
Use transparent_stepping instead of nodebug and alwaysinline in compiler
generated C++ code from Swift. This attribute allow for annotated
functions to be used in expression evaluation, which is an advantage
over the former two.
2023-03-31 12:53:14 -07:00
Alex Lorenz
94c1de7611 [interop][SwiftToCxx] use 'SWIFT_INLINE_PRIVATE_HELPER' macro for static returnNewValue functions to ensure attribute(used) isn't applied to them 2023-03-15 09:13:38 -07:00
Alex Lorenz
0dc90d38c1 [interop][SwiftToCxx] emit Swift's stdlib inside of 'swift' namespace 2023-03-09 17:32:43 -08:00
Alex Lorenz
eeaba69df0 [interop][SwiftToCxx] use 'nodebug' instead of articial for interop thunks
a combination of always_inline and nodebug allows LLDB to skip over thunks
2023-03-03 13:21:46 -08:00
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
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
f4e7e1c53e [interop][SwiftToCxx] update external_source_symbol check for USR clause following Clang changes 2023-02-07 14:51:33 -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
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
Roberto Rosmaninho
c92dc41c41 Deleting unnecessary includes and compilation flags 2022-10-21 17:29:00 -03:00
Roberto Rosmaninho
cb31700d03 Renaming testErrorCall to getErrorMetadata 2022-10-21 14:35:42 -03:00
Alex Lorenz
8636720706 Get closer to a working dynamic cast for error 2022-10-20 17:24:05 -07:00
Roberto Rosmaninho
5b8a2e213e [SwiftToCxx] Fixing as signature 2022-10-19 17:12:55 -03:00
Roberto Rosmaninho
5af07a470c test/Interop/SwiftToCxx/functions/swift-functions-errors.swift 2022-10-18 18:53:30 -03:00
Alex Lorenz
391b92fff7 [interop][SwiftToCxx] add some helper methods to work with Swift's Optional in C++ 2022-10-05 14:21:13 -07:00
Alex Lorenz
a24ebeaa51 [interop][SwiftToCxx] install _SwiftCxxInteroperability.h header as part of compiler build, not stdlib
The _SwiftCxxInteroperability.h is too tightly coupled to the compiler right now and should not be shipped with the standard library. In the future it could be moved back to the standard library.
2022-09-28 16:14:33 -07:00