Ben Barham
e0b976d150
[CxxInterop] Change C++ interop header ordering
...
Consider the case of a toolchain that includes clang is being used to
compile Swift. With the current ordering, the header will be found
relative to that toolchain, which could be out of date as compared to
tip. This is the case today if eg. a 5.7 toolchain is used to build
main/5.9 as the shim header is missing a definition.
2023-08-17 09:46:28 -07:00
Alex Lorenz
85a431eedf
[interop][SwiftToCxx] ensure swift::Int and swift::UInt are usable in generic context
...
Fixes https://github.com/apple/swift/issues/63452
2023-07-12 12:47:49 -07:00
Alex Lorenz
de10b4155e
[interop][SwiftToCxx] support copy-assignment operation for Swift value types and prohibit move assignment explicitly
...
Fixes https://github.com/apple/swift/issues/66324
Note: move semantics for Swift value types are not yet supported in C++
2023-06-06 15:55:30 -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
a1dc63ec46
Merge pull request #65728 from hyp/eng/safe-overloads-and-unavailable-unemitted-decls-in-cxx
...
[interop][SwiftToCxx] avoid emitting ambiguous C++ overloads and emit unavailable type stubs for top level types that could not be emitted in the C++ section of the generated header
2023-05-07 06:25:03 -07:00
Alex Lorenz
ace328af62
Merge pull request #65683 from hyp/swift-string-from-literal
...
[interop][SwiftToCxx] add swift::String overlay constructor for const…
2023-05-06 09:41:13 -07:00
Alex Lorenz
4010357ae1
[interop][SwiftToCxx] fix foundation-type-not-exposed-by-default-to-cxx.swift test on Linux and Windows
2023-05-06 06:55:48 -07:00
Alex Lorenz
bf35e3f55a
[interop][SwiftToCxx] provide a clear unavailable message for protocol decls in C++
2023-05-05 17:03:28 -07:00
Alex Lorenz
aff3568a12
[interop][SwiftToCxx] emit unavailable type stubs for top level types that could not be emitted in the C++ section of the generated header
2023-05-05 17:03:26 -07:00
Alex Lorenz
c41774188c
[interop][SwiftToCxx] add swift::String overlay constructor for constructing it directly from a C string literal
...
resolves https://github.com/apple/swift/issues/63448
2023-05-05 06:29:59 -07:00
Alex Lorenz
f4f6f7a408
[interop][SwiftToCxx] avoid importing C++ stdlib in C++ section of generated header inside of 'pragma clang attribute' block
2023-05-04 17:01:39 -07:00
Alex Lorenz
7efae9a74c
[interop][SwiftToCxx] add additional type representation emission check for associated enum element types
...
This ensures that we do not try to emit enums whose associated values come from dependent modules that don't have a C++ representation
2023-04-24 12:31:30 -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
f405fb0fa8
[interop][SwiftToCxx] do not expose @alwaysEmitIntoClient properties to C++
2023-03-15 10:01:37 -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
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
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
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
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
Arnold Schwaighofer
1dfc30eb1f
Merge remote-tracking branch 'origin/main' into rebranch
2023-02-27 09:18:56 -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
swift-ci
2c2900a229
Merge remote-tracking branch 'origin/main' into rebranch
2023-02-09 06:33:03 -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
swift-ci
7fc8b1111d
Merge remote-tracking branch 'origin/main' into rebranch
2023-01-17 17:15:15 -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
swift-ci
efb80004f1
Merge remote-tracking branch 'origin/main' into rebranch
2022-12-15 14:33:36 -08:00
Alex Lorenz
15b100784b
[interop][SwiftToCxx] relax the swift-stdlib-in-cxx.swift testcase
2022-12-15 07:15:52 -08:00
Alex Lorenz
a7ec9f1fcb
[interop][SwiftToCxx] also test for UTF8View API in the test
2022-12-14 16:30:59 -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
swift-ci
8df84bd87a
Merge remote-tracking branch 'origin/main' into rebranch
2022-12-13 20:54:17 -08:00
Alex Lorenz
5c703b4f5c
[interop][SwiftToCxx] support std::string -> Swift::String conversion in C++
2022-12-13 13:13:05 -08:00
Erik Eckstein
d89c6b2d70
Merge remote-tracking branch 'origin/main' into rebranch
2022-12-01 07:48:51 +01:00
Alex Lorenz
cd67584015
[interop][SwiftToCxx] support NSString -> Swift String bridging in C++
2022-11-29 16:52:50 -08:00
Alex Lorenz
83db71b64e
[interop][SwiftToCxx] use the more appropriate String -> NSString bridging invocation
...
This fixes some CI failures
2022-11-29 15:19:26 -08:00
Erik Eckstein
f811676220
rebranch: some test fixes
2022-11-09 18:26:26 +01: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
6df54eb24a
[interop][SwiftToCxx] NFC, add a test that operates on generic Array in C++17 mode
2022-11-01 17:39:08 -07:00
Alex Lorenz
c179e23b19
[interop][SwiftToCxx] add static_assert type checking for generic types in pre-C++20 mode
2022-11-01 17:36:37 -07:00
Alex Lorenz
a66cc52109
[interop][SwiftToCxx] add static_assert type checking for generic functions in pre-C++20 mode
...
In the future we should also use enable_if to correctly resolve overloads
2022-11-01 17:21:01 -07:00
Alex Lorenz
4b52ae08fa
[interop][SwiftToCxx] check that generics can be built in C++17/C++14 mode
2022-11-01 16:40:42 -07:00
Alex Lorenz
953c124ceb
[interop][SwiftToCxx] guard 'requires' clauses in __cpp_concepts #ifdefs
2022-11-01 16:17:10 -07:00