Commit Graph

572 Commits

Author SHA1 Message Date
Alex Lorenz
70b982f9ca Merge pull request #64468 from hyp/eng/limit-stdlib-exposure
[interop][SwiftToCxx] ensure we always expose limited set of APIs fro…
2023-03-18 12:14:44 -07:00
Alex Lorenz
5ca0b5a0c5 [interop][SwiftToCxx] ensure we always expose limited set of APIs from Swift's standard library to C++
Fixes https://github.com/apple/swift/issues/64340
2023-03-17 18:24:38 -07:00
Alex Lorenz
90d1c24674 [interop] 'conforms_to' attribute should be qualified with module name
Also, improve the diagnostics for 'conforms_to'
2023-03-17 15:09:27 -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
30f1912cf8 [interop][SwiftToCxx] use unconditional noexcept for C++ collection overlay
accessing collection in noexcept is wrong
2023-03-14 11:41:39 -07:00
Alex Lorenz
6f4feebd34 [interop] bump up experimental version 2023-03-12 11:49:14 -07:00
Alex Lorenz
3cce09e769 [interop][SwiftToCxx] annotate several value members types as 'noexcept'
C++/clang is more strict about requiring noexcept in templates so we need some explicit annotations
2023-03-12 11:49:14 -07:00
Alex Lorenz
0b265c725c [interop][SwiftToCxx] CollectionIterator in the stdlib overlay should have 'noexcept' annotations 2023-03-12 11:49:14 -07:00
Alex Lorenz
c7873490d2 Merge pull request #64290 from hyp/eng/fix-interop-xmodule-imports
[interop][SwiftToCxx] do not expose APIs with imported declarations w…
2023-03-11 06:08:40 -08:00
John McCall
ee0e38a5a0 Merge pull request #64273 from rjmccall/variadic-generic-type-metadata
Omnibus fixes to IRGen for variadic generic type metadata
2023-03-11 00:10:56 -05:00
Alex Lorenz
4fda7f4a9a [interop][SwiftToCxx] do not expose APIs with imported declarations whose modules do not have a generated header as specified by the user
The frontend option '-clang-header-expose-module' allows the user to specify that APIs from an imported module have been exposed in another generated header, and thus APIs that depend on them can be safely exposed in the current generated header.
2023-03-10 12:34:02 -08:00
John McCall
0e932329c3 Fix fulfillments for type metadata and witness table packs
A lot of the fixes here are adjustments to compensate in the
fulfillment and metadata-path subsystems for the recent pack
substitutions representation change.  I think these adjustments
really make the case for why the change was the right one to make:
the code was clearly not considering the possibility of packs
in these positions, and the need to handle packs makes everything
work out much more cleanly.

There's still some work that needs to happen around type packs;
in particular, we're not caching them or fulfilling them as a
whole, and we do have the setup to do that properly now.
2023-03-10 12:52:37 -05:00
Alex Lorenz
75fd11cffc [interop][SwiftToCxx] hide swift::Error APIs by default in C++ Swift stdlib overlay
They're still experimental
2023-03-10 08:34:45 -08:00
Alex Lorenz
910174dcda Merge pull request #64263 from hyp/eng/bumpupv13
[interop] bump up the experimental version in JSON file
2023-03-10 06:40:42 -08:00
Alex Lorenz
0dc90d38c1 [interop][SwiftToCxx] emit Swift's stdlib inside of 'swift' namespace 2023-03-09 17:32:43 -08:00
Alex Lorenz
e174e59af2 [interop] bump up the experimental version in JSON file 2023-03-09 16:52:49 -08:00
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