Alex Lorenz
3adf16eb28
Merge pull request #64083 from hyp/eng/api-stdlib-arg-labels
...
[interop][SwiftToCxx] incorporate argument labels into Stdlib API nam…
2023-03-03 21:37:40 -08:00
Alex Lorenz
97dc2758d7
Merge pull request #64075 from hyp/eng/lambda-attrs
...
[interop][SwiftToCxx] use 'nodebug' for inline thunks and apply inline and artificial attributes to lambd…
2023-03-03 21:37:25 -08:00
Alex Lorenz
13a63f4b05
[interop][SwiftToCxx] incorporate argument labels into Stdlib API names in C++
...
This allows easier use and more wider API exposure from the Swift stdlib
In the future, all functions and method should incorporate argument labels, but it's not yet clear how
2023-03-03 14:15:48 -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
Mishal Shah
aced44a84b
Merge pull request #63187 from apple/rebranch
...
Merge `rebranch` into `main` to support `stable/20221013` llvm-project branch
2023-03-03 11:01:34 -08:00
Alex Lorenz
ba34e4f4e7
Merge pull request #64046 from hyp/eng/cxx-interop-no-expose
...
[interop][SwiftToCxx] do not require @_expose when generating C++ interface for a Swift module
2023-03-02 20:55:31 -08:00
Alex Lorenz
c2a93f0480
[interop][SwiftToCxx] allow emission of overloaded functions with the same name
2023-03-02 16:34:06 -08:00
Alex Lorenz
62c1f4afe8
[interop] bump up experimental interop version
2023-03-02 15:23:58 -08:00
Alex Lorenz
2dcbeb0bc9
[interop][SwiftToCxx] do not require @_expose when generating C++ interface for a Swift module
...
Instead, we emit API bindings for all supported public APIs, when -enable-experimental-cxx-interop is enabled
2023-03-02 14:06:47 -08:00
Alex Lorenz
4c24669c66
[interop][SwiftToCxx] add 'has-expose-attr-or-stdlib' mode to -clang-header-expose-decls flag
...
This mode allows the user to fallback to the old behavior that required @expose annotations, while still having standard library interfaces emitted in one header
2023-03-02 13:58:23 -08:00
Alex Lorenz
65a467420e
Revert "[interop][SwiftToCxx] add -enable-experimental-cxx-interop-in-clang-header flag that lets you enable reverse interop only"
...
This reverts commit c193a63fd4 .
2023-03-02 13:19:34 -08:00
Augusto Noronha
6f68fb0dde
Merge pull request #63950 from augusto2112/print-debug-name
...
Print debug name
2023-03-01 15:14:55 -08:00
Becca Royal-Gordon
1629521b12
Exclude @objcImpl member impls from PrintAsObjC
...
PrintAsClang was not aware of @objcImplementation. Teach it to skip over both member implementations (which are declared in handwritten headers, so printing them would be a redeclaration) and overrides (which may not be valid in a category, if e.g. they are declaring a designated initializer).
Fixes rdar://106035578.
2023-02-28 21:34:25 -08:00
Alex Lorenz
8bce678200
[interop][SwiftToCxx] diagnose when certain generic decls can not yet be exposed to C++
2023-02-28 09:17:31 -08:00
Augusto Noronha
8790a9e0cf
Revert "Revert "Print the Swift mangled name as a field in C++ interop generated classes""
...
This reverts commit 773a2aac96 .
2023-02-27 14:23:08 -08:00
Alex Lorenz
f8c3895f32
[interop][SwiftToCxx] print availability attributes for Swift decls in C++
2023-02-27 12:07:36 -08:00
Augusto Noronha
773a2aac96
Revert "Print the Swift mangled name as a field in C++ interop generated classes"
...
This reverts commit 5b12a156f0 .
2023-02-27 10:58:48 -08:00
Augusto Noronha
d7278e1d30
Always print ignored Cxx17 diag when printing name for debugger
2023-02-27 10:26:07 -08:00
Augusto Noronha
239d4e23cb
Rename __swift_mangled_name to $__swift_mangled_name
2023-02-27 10:14:21 -08:00
Augusto Noronha
5b12a156f0
Print the Swift mangled name as a field in C++ interop generated classes
...
Print the Swift mangled name as a constexpr static char as a field in
compiler generated types so LLDB can display them nicely to users.
2023-02-24 14:01:31 -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
327b989e84
[interop][SwiftToCxx] NFC, refactor printKnownCType method to ClangSyntaxPrinter for reuse
2023-02-13 10:30:25 -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
b70ba0963d
[interop][SwiftToCxx] remove extraneous ';' from generated header
2023-02-08 12:43:30 -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
f4e7e1c53e
[interop][SwiftToCxx] update external_source_symbol check for USR clause following Clang changes
2023-02-07 14:51:33 -08:00
Alex Lorenz
13ff3fe0b6
Merge pull request #62952 from WANGJIEKE/cxx-interop-enum-associated-value-class-type
...
[Interop][SwiftToCxx] Add class type support for enum with associated value
2023-01-19 12:47:37 -08:00
Alex Lorenz
cc5b557cee
[interop][SwiftToCxx] Attach SWIFT_SYMBOL to C++ enum case declarations
2023-01-12 14:01:30 -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
Tongjie Wang
3aea6a8977
[Interop][SwiftToCxx] Add class type support for enum with associated value
2023-01-10 13:40:34 -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
Egor Zhdan
abfd790bb4
Merge pull request #62575 from apple/egorzhdan/cxx-disambiguate
...
[cxx-interop] Disambiguate const and non-const methods consistently
2022-12-19 17:36:03 +00:00
Egor Zhdan
168ef490af
[cxx-interop] Disambiguate const and non-const methods consistently
...
When importing a C++ struct that contains two methods that only differ in const-ness, we append `Mutating` to the name of the non-const method to make it possible to call from Swift unambiguously.
Unfortunately that logic was dependent on the order in which we import methods of a class: the `Mutating` suffix was added when another method with the same name was already imported.
This caused lookup failures, and the behavior was incorrect when the pair of methods return instances of an unsafe type: the const overload was renamed as `Unsafe` properly, but the non-const overload was not renamed.
2022-12-19 15:03:04 +00:00
Alex Lorenz
2c83ff7643
Merge pull request #61823 from Robertorosmaninho/interop/ExpectedClassForErrorHandling
...
[Interop][SwiftToCxx] Introduces swift::Expected
2022-12-16 17:47:28 -08:00
Alex Lorenz
6d0dd0e7cb
[interop][SwiftToCxx] workaround windows failure with Error new use in SwiftToCxxToSwift/hide-swift-module-namespace-in-swift.swift
2022-12-16 11:55:56 -08:00
Alex Lorenz
244ca4e242
Merge pull request #62597 from hyp/eng/string-to-std-string
...
[interop][SwiftToCxx] make it possible to convert Swift String to a std::string in C++
2022-12-15 14:14:16 -08:00
Alex Lorenz
c77249c38d
[interop][SwiftToCxx] NFC, use elif defined instead of elifdef for _SwiftStdlibCxxOverlay.h
2022-12-14 16:36:13 -08:00
Alex Lorenz
5e09a5c30b
[interop][SwiftToCxx] move std::string -> Swift String constructor to the overlay header
2022-12-14 16:27:29 -08:00
Alex Lorenz
28af8bef55
[interop][SwiftToCxx] make it possible to convert Swift String to a std::string in C++
...
This is done by exposing nested Index and UTF8View type in String. Nested types aren't
supported yet, so we need to employ a number of hacks to emit them.
2022-12-14 16:22:41 -08:00
Roberto Rosmaninho
5fc55b6e4f
Add <new> into every bridge header
2022-12-14 12:59:00 -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