Gabor Horvath
53861a4e00
[cxx-interop] Avoid emitting methods that cause name clash
...
In Swift, we can have enum elements and methods with the same name, they are overloaded.
Unfortunately, this feature is not supported by C++ interop at the moment. This patch
avoids emitting the methods with name collisions to make sure the resulting header
can be compiler. A proper fix should follow in a later PR.
rdar://128162252
2024-06-10 12:35:44 +01:00
Meghana Gupta
5380f4d097
Disable an Interop test in CI
2024-04-09 11:01:33 -07:00
Becca Royal-Gordon
80f38be3b8
[PrintAsClang] Fix thunks for Never funcs
...
Swift-to-C++ thunk printing for functions didn’t really take into account Swift’s `Never` type. This type maps to `SWIFT_NORETURN`, but it also requires other tweaks to code generation, such as omitting the `return` keyword. (Removing that requires minor changes to many tests.)
Fixes rdar://124137073.
2024-03-29 22:12:19 -07:00
Alexis Laferrière
b03d4faec2
Tests: disable C++ interop test on armv7k
2024-03-12 11:20:48 -07:00
Doug Gregor
b5fc2fc036
[Generated header] Emit members of enum extensions into C++ class
...
As we do with Swift structs, emit the members of extensions of Swift
enums into the corresponding C++ class. This includes exposing more of
the Optional API from the standard library into Swift.
2024-03-05 21:54:47 -08:00
Alex Lorenz
71ef7e8d3d
[interop][SwiftToCxx] do not expose unsupported enums yet
...
This includes indirect enums, enums with multiple associated values, or enums whose associated value is a type we don't yet support
2023-04-20 18:05:00 -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
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
0dc90d38c1
[interop][SwiftToCxx] emit Swift's stdlib inside of 'swift' namespace
2023-03-09 17:32:43 -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
0b0cc99c98
[interop][SwiftToCxx] avoid -Wshadow warning for C++ representation of enum member parameters
2023-02-08 12:33:18 -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
Tongjie Wang
b27f35b1a0
improve test case: add retainCount check
2023-01-10 15:08:51 -08:00
Tongjie Wang
3aea6a8977
[Interop][SwiftToCxx] Add class type support for enum with associated value
2023-01-10 13:40:34 -08:00
Alex Lorenz
0312e0613d
[interop][SwiftToCxxToSwift] hide reverse interop module namespaces from forward interop
2022-11-07 15:52:04 -08: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
3a9b6dce9d
[interop][SwiftToCxx] add support for emitting Swift stdlib dependency in one header file
...
This is the default behavior. You can disable this by specifying the -clang-header-expose-decls= flag explicitly when generating the header
2022-09-28 08:08:48 -07:00
Alex Lorenz
2a05109c58
[interop][SwiftToCxx] Declare the generic usability type trait before the C++ class that represents the Swift type
...
This allows you to import a method that returns the type of the context in which the method is declared when such
type is a generic parameter in another type. This means that it's now possible to bridge the initializer for
RawRepresentable enums.
2022-09-21 07:57:32 -07:00
Tongjie Wang
90e8d16794
[Introp][SwiftToCxx] Fix enum implementation test related to stub struct
2022-09-09 23:48:22 -07:00
Tongjie Wang
5a55cd7ba2
[Interop][SwiftToCxx] Support printing methods and properties for enums
2022-09-08 11:05:20 -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
Tongjie Wang
911cfe9fbb
print static struct member as inline and improve test cases
2022-08-30 17:19:00 -07:00
Tongjie Wang
cbc23cbafc
[Interop][SwiftToCxx] Support enum creation from Cxx
2022-08-29 20:16:52 -07:00
Tongjie Wang
7f9fadb7d8
Fix type for resilient enum case global variables
2022-08-18 12:31:40 -07:00
Tongjie Wang
ae73a03ec0
Merge branch 'main' into fix-value-witness-table-type
2022-08-18 09:57:57 -07:00
Tongjie Wang
7115e64689
update test case
2022-08-15 20:24:40 -07:00
Tongjie Wang
482e1ac80f
[Interop][SwiftToCxx] Implement the new enum header design
2022-08-15 15:31:43 -07:00
Tongjie Wang
ff28b56e15
[Interop][SwiftToCxx] add support for resilient enum
2022-08-08 14:37:13 -07:00
Tongjie Wang
d34e086c79
Change return type of getEnumTag in value witness table
...
make it actually matches the description above
2022-08-04 18:41:16 -07:00
Alex Lorenz
fa99c7864e
[interop][SwiftToCxx] re-enable enum runtime tests on ARM64e
2022-07-28 12:13:49 +01:00
Tongjie Wang
5b2c6e5b53
use placement new so we don't destory an enum twice
2022-07-25 08:27:19 -07:00
Tongjie Wang
38b6947fdd
update test case for arm64e value witness table authentication
2022-07-18 18:21:12 -07:00
Tongjie Wang
290e527b0b
[Interop][SwiftToCxx] Initial support for getting associated values from enum
...
improve test cases
add support for primitive types
2022-07-18 18:19:00 -07:00
Alex Lorenz
5b05d3dc67
[interop][SwiftToCxx] arm64e: authenticate value witness table in C++
...
Fixes arm64e test failures for C++ interop tests
2022-07-18 13:50:32 +01:00
Tongjie Wang
23d60acbc2
sort cases based on their assigned tag indices before printing
2022-07-06 12:46:11 -07:00
Tongjie Wang
e7ea37f7d6
print C's abort in default branch
2022-07-05 12:06:38 -07:00
Tongjie Wang
7ebcb7b33a
[Interop][SwiftToCxx] Implement enum case switching
2022-06-30 22:41:15 -07:00
Alex Lorenz
0dae89613a
Merge pull request #59669 from WANGJIEKE/cxx-interop-enum-cases-class
...
[Interop][SwiftToCxx] Emit helper cases class in C++ for Swift enum
2022-06-25 11:00:28 +01:00
Tongjie Wang
7c962b2d65
Improve C++ case printing
2022-06-24 04:01:41 -07:00
Tongjie Wang
b5721806fb
[Interop][SwiftToCxx] Fix small enum tests
2022-06-23 14:17:04 -07:00
Tongjie Wang
b98bb6adc2
[Interop][SwiftToCxx] emit helper cases class in C++ for Swift enum
2022-06-23 11:22:56 -07:00
Tongjie Wang
db8940cbd0
add UNSUPPORTED: CPU=arm64e to tests
2022-06-22 14:28:04 -07:00
Tongjie Wang
c26e6b062b
Improve test cases and change a FIXME to TODO
2022-06-21 15:56:49 -07:00
Tongjie Wang
00598e8019
[interop][SwiftToCxx] add initial support for passing/returning enums
2022-06-20 00:45:07 -07:00