Commit Graph

1876 Commits

Author SHA1 Message Date
Akira Hatanaka
7cdbb64567 Disable test on arm64e (#76229)
rdar://135165028
2024-09-03 19:51:32 -07:00
Shreyans Pathak
49d9067d3e feat: add comparable conformance for C++ strings 2024-09-03 13:47:27 -04:00
Gabor Horvath
a8dde60a4e [cxx-interop] Add tests for move-only objects behind smart pointers 2024-09-03 11:38:24 +01:00
swift-ci
c1cf74dc47 Merge remote-tracking branch 'origin/main' into rebranch 2024-09-03 03:15:02 -07:00
Egor Zhdan
eee3947d43 Merge pull request #76210 from swiftlang/egorzhdan/faster-test
[cxx-interop] Make a test run faster
2024-09-03 11:02:51 +01:00
swift-ci
f1877410ef Merge remote-tracking branch 'origin/main' into rebranch 2024-09-03 02:53:13 -07:00
Gábor Horváth
54efb012f9 Merge pull request #76209 from swiftlang/gaborh/nonescapable-attr
[cxx-interop] Add a SWIFT_NONESCAPABLE attribute to the bridging header
2024-09-03 10:48:55 +01:00
swift-ci
df4acdf89a Merge remote-tracking branch 'origin/main' into rebranch 2024-09-02 10:54:25 -07:00
Susana Monteiro
467f25992f Merge pull request #76208 from swiftlang/susmonteiro/cxx-span-tests-hardening
[cxx-interop] change hardening level in `std::span` test
2024-09-02 18:35:54 +01:00
Egor Zhdan
7532390910 [cxx-interop] Make a test run faster
`foundation-and-std-module.swift` has started timing out in some CI jobs. This change makes the test run faster to stay within the 600 sec timeout.

rdar://134328721
2024-09-02 14:56:24 +01:00
Gabor Horvath
738b4c6d8d [cxx-interop] Add a SWIFT_NONESCAPABLE attribute to the bridging header
This makes it easier to experiment with noescapable types in interop.
Moreover, we always wanted to have this annotation for completeness,
similar to SWIFT_NONCOPYABLE.
2024-09-02 14:51:27 +01:00
swift-ci
e984fa4cbf Merge remote-tracking branch 'origin/main' into rebranch 2024-09-02 03:54:41 -07:00
Egor Zhdan
39b8b3c67e Merge pull request #76106 from swiftlang/egorzhdan/cxx-mutable-rac
[cxx-interop] Add `CxxMutableRandomAccessCollection` protocol
2024-09-02 11:35:43 +01:00
smonteiro2
2e2bd2f4d4 Change hardening level in std::span test
Fix rdar://134730449
2024-09-02 11:21:10 +01:00
swift-ci
ad02892842 Merge remote-tracking branch 'origin/main' into rebranch 2024-08-30 09:14:26 -07:00
Egor Zhdan
ec09fa773f Merge pull request #76124 from swiftlang/egorzhdan/maccatalyst-deployment-target
[build] Do not override macOS deployment target when macCatalyst is enabled
2024-08-30 17:02:35 +01:00
swift-ci
1b23f6a9b2 Merge remote-tracking branch 'origin/main' into rebranch 2024-08-29 20:55:52 -07:00
Akira Hatanaka
5bd7a27e96 [cxx-interop] Do not over-release objects returned by synthesized C++ methods (#76139)
Call Sema::BuildReturnStmt instead of ReturnStmt::Create so that an
implicit cast of kind ARCProduceObject is inserted in the AST.

rdar://133731973
2024-08-29 20:45:16 -07:00
swift-ci
859e629da4 Merge remote-tracking branch 'origin/main' into rebranch 2024-08-29 08:55:03 -07:00
Egor Zhdan
74b3221042 Merge pull request #76108 from rjmansfield/enable-static-init-runtime-test
[Tests] Enable staticMemberInitializedAtRuntime in inline-static-member-var.swift.
2024-08-29 16:41:44 +01:00
swift-ci
4d062ca332 Merge remote-tracking branch 'origin/main' into rebranch 2024-08-28 09:53:27 -07:00
Alexander Cyon
db0b5db54e [test/Interop] Fix typos (#75032) 2024-08-28 09:41:09 -07:00
Egor Zhdan
e1bff808d7 [build] Do not override macOS deployment target when macCatalyst is enabled
Cxx.swiftmodule should built with a macOS deployment target set to 10.9, the minimum possible version. Since we enabled macCatalyst for this target, it inadvertently started being built with a deployment target set to 13.0, which is too new and is causing build errors in certain projects.

This change makes sure that for Swift targets within the Swift project that explicitly specify `DEPLOYMENT_VERSION_OSX`, the macCatalyst build logic doesn't silently discard this flag.

rdar://133008827
2024-08-28 15:37:00 +01:00
Egor Zhdan
0ab681514b [cxx-interop] Add CxxMutableRandomAccessCollection protocol
This conforms mutable C++ container types, such as `std::vector`, to `MutableCollection` via a new overlay protocol `CxxMutableRandomAccessCollection`.

rdar://134531554
2024-08-28 12:43:42 +01:00
Ryan Mansfield
6234dd159d [Tests] Enable staticMemberInitializedAtRuntime in inline-static-member-var.swift.
apple/swift#30914 has been merged so this part of the test can be enabled.
2024-08-27 15:00:30 -04:00
Egor Zhdan
118ac185d9 Merge pull request #75907 from swiftlang/egorzhdan/rebranch-static-call
[cxx-interop][rebranch] Do not crash for `static operator()`
2024-08-19 14:26:50 +01:00
Egor Zhdan
fc4f6480a8 [cxx-interop][rebranch] Do not crash for static operator()
This fixes an assertion failure:
```
Assertion failed: (isInstance() && "No 'this' for static methods!"), function getThisType, file DeclCXX.cpp, line 2636.
```

Clang changed it's handling of member call expressions in af4751738d causing the assertion to fail when synthesizing a forwarding function declaration for `static operator()`.

rdar://133257179
2024-08-15 16:31:17 +01:00
swift-ci
ce455dbe4f Merge remote-tracking branch 'origin/main' into rebranch 2024-08-14 13:53:52 -07:00
Egor Zhdan
8e2f0e2d50 Merge pull request #75877 from swiftlang/egorzhdan/std-map-init
[cxx-interop] Allow initializing `std::map` from Swift Dictionary
2024-08-14 21:49:56 +01:00
Egor Zhdan
9fe13ece49 [cxx-interop] Allow initializing std::map from Swift Dictionary
This adds initializers for `std::map` and `std::unordered_map` that take a Swift dictionary as a single parameter.

rdar://133691563
2024-08-14 13:32:30 +01:00
swift-ci
94e7afbd33 Merge remote-tracking branch 'origin/main' into rebranch 2024-08-12 08:34:54 -07:00
Alex Lorenz
d35af38ce4 Merge pull request #75721 from hyp/eng/75691
[windows] split out complex module from ucrt module, to allow new swi…
2024-08-12 08:30:47 -07:00
swift-ci
89b0d01955 Merge remote-tracking branch 'origin/main' into rebranch 2024-08-09 16:16:12 -07:00
Akira Hatanaka
0e2a8bd0de Fix a test that was failing on 32-bit platforms (#75808)
rdar://133549324
2024-08-09 16:14:35 -07:00
Ben Barham
467e528200 Merge remote-tracking branch 'origin/main' into manual-rebranch-merge
Conflicts:
  - `lib/Serialization/ModuleFormat.h` bumped version to account for
    differences between main and rebranch.
2024-08-09 15:22:39 -07:00
Egor Zhdan
bfe72b4be9 Merge pull request #75589 from swiftlang/egorzhdan/linux-libcxx-interop
[cxx-interop] Allow compiling with libc++ on Linux
2024-08-09 13:42:29 +01:00
Ben Barham
df81d0a450 [Tests] XFAIL the remaining test failures on rebranch
Only a few tests remaining. XFAIL so we can test the rest of the
toolchain.
2024-08-08 14:47:18 -07:00
Egor Zhdan
059f0f97d1 [cxx-interop] Allow compiling with libc++ on Linux
This makes sure that Swift respects `-Xcc -stdlib=libc++` flags.

Clang already has existing logic to discover the system-wide libc++ installation on Linux. We rely on that logic here.

Importing a Swift module that was built with a different C++ stdlib is not supported and emits an error.

The Cxx module can be imported when compiling with any C++ stdlib. The synthesized conformances, e.g. to CxxRandomAccessCollection also work. However, CxxStdlib currently cannot be imported when compiling with libc++, since on Linux it refers to symbols from libstdc++ which have different mangled names in libc++.

rdar://118357548 / https://github.com/swiftlang/swift/issues/69825
2024-08-08 16:24:58 +01:00
Akira Hatanaka
e21c117831 [cxx-interop] Use unowned return convention for ObjC methods returning foreign reference types (#75640)
This fixes a runtime crash that occurs when a pointer to a foreign
reference type is passed to objc_retainAutoreleasedReturnValue.

This reverts 335cec0e8d.

rdar://117353222
2024-08-07 21:16:47 -07:00
Alex Hoppen
66104395d7 [Sema/SourceKit] Emit same diagnostics for missing protocol requirements on the command line and in SourceKit
Some editors use diagnostics from SourceKit to replace build issues. This causes issues if the diagnostics from SourceKit are formatted differently than the build issues. Make sure they are rendered the same way, removing most uses of `DiagnosticsEditorMode`.

To do so, always emit the `add stubs for conformance` note (which previously was only emitted in editor mode) and remove all `; add <something>` suffixes from notes that state which requirements are missing.

rdar://129283608
2024-08-07 14:01:30 -07:00
Alex Lorenz
b62eafd866 [windows] split out complex module from ucrt module, to allow new swift-foundation to import ucrt when C++ interoperability is enabled
Fixes https://github.com/swiftlang/swift/issues/75691
2024-08-06 11:33:03 -07:00
Akira Hatanaka
658de4ae65 Fix a test that was failing on arm64e (#75550)
rdar://130759216
2024-07-29 20:39:24 -07:00
Andrew Trick
030f2b8e90 Merge pull request #75050 from atrick/vardecl_lifetime
[SILGen] Create SIL variable declaration scopes for trivial values.
2024-07-26 16:23:07 -07:00
Ben Barham
d281fb8868 Merge pull request #74883 from finagolfin/droid
[android] Enable several C++ Interop and other tests
2024-07-26 11:18:07 -07:00
Andrew Trick
a1fe258692 Update tests for new trivial moves and extend_lifetimes. 2024-07-26 08:27:48 -07:00
Susana Monteiro
7bda2b3e81 Merge pull request #75474 from swiftlang/susmonteiro/cxx-span-tests
[cxx-interop] Test: initialize std::span in C++ from Swift array
2024-07-25 18:09:26 +01:00
smonteiro2
2541735714 [cxx-interop] Test: initialize std::span in C++ from Swift array 2024-07-25 15:05:57 +01:00
smonteiro2
0ef50125a3 [cxx-interop] Constructor Span(baseAddress, count) is deprecated
This constructor is unsafe, as it allows creating a `std::span` with a count higher than the size of the sequence of objects it refers to. Therefore, when hardening is enabled, an out-of-bounds access won't trap.
We make it deprecated to discourage its use.
2024-07-25 11:48:50 +01:00
Egor Zhdan
71c27a9d17 Merge pull request #75395 from swiftlang/egorzhdan/std-function-test
[cxx-interop] Add one more test for `std::function`
2024-07-22 19:28:45 +01:00
Egor Zhdan
d7212ff7f5 [cxx-interop] Add one more test for std::function
While initializing a `std::function` that takes `const std::string&` as a parameter currently crashes, changing the parameter type to `std::string` should work fine.
2024-07-22 13:54:09 +01:00