Alex Lorenz
0be1ad1a02
Merge pull request #65339 from hyp/eng/opaque-layout-ok-struct
...
[interop][SwiftToCxx] do not assert when emitting non-resilient struc…
2023-04-21 09:30:18 -07:00
Alex Lorenz
e6e43c6b80
[interop][SwiftToCxx] do not assert when emitting non-resilient structs with opaque layout
2023-04-20 18:46:07 -07:00
Dave Lee
39bb7bfe44
[AST] Convert ASTContext::getSwiftName to a free function
...
The only state `getSwiftName` uses is its argument, and can be made a free function. Of
note the inverse operation, `getKnownFoundationEntity`, is also a free function. This
removes the requirement that callers have an `ASTContext` instance.
(cherry-picked from commit fb524c0b86 )
2023-04-14 11:43:13 -06: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
a854550fa2
[interop] fix test failure after c4cc9e8e42
...
rdar://107445101
2023-03-30 16:34:50 -07:00
Alex Lorenz
c4cc9e8e42
[interop][SwiftToCxx] do not error out on -Wnon-modular-include-in-framework-module clang diagnostic when importing the generated header as part of a framework back into C++ via a Clang module
2023-03-30 08:40:40 -07:00
Alex Lorenz
580dd22c49
[interop] NFC, bump up the experimental version in the JSON file
2023-03-20 19:58:21 -07:00
Alex Lorenz
ce9648476d
[interop][SwiftToCxx] ensure all emitted 'swift' namespaces are marked as swift_private
2023-03-18 17:50:57 -07:00
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