eeckstein
4285d8a87c
Revert "[cxx-interop] Add test for lifetimebound annotation in ctor"
2024-09-24 20:00:37 +02:00
Gabor Horvath
cbd8cdfe95
[cxx-interop] Add rules to recognize escapability of aggregates
...
For now, this logic is used for importing fewer unannotated types as
unsafe. In the future, this logic will be used by escapability inference
for other (non-aggregate) types.
2024-09-24 16:41:00 +01:00
swift-ci
2bd533ccda
Merge remote-tracking branch 'origin/main' into rebranch
2024-09-24 07:55:58 -07:00
Gábor Horváth
40529912a9
Merge pull request #76668 from swiftlang/gaborh/lifetimebound-off-by-one
...
[cxx-interop] Fix off-by-one error when importing lifetimebound attrs
2024-09-24 15:49:19 +01:00
Gábor Horváth
289a4f5e35
Merge pull request #76653 from swiftlang/gaborh/unsafe_reference
...
[cxx-interop] Import SWIFT_UNSAFE_REFERENCE types as @unsafe
2024-09-24 15:48:45 +01:00
Gabor Horvath
72ce39ce07
[cxx-interop] Fix off-by-one error when importing lifetimebound attrs
2024-09-24 12:01:26 +01:00
Gabor Horvath
e8aea32c95
[cxx-interop] Import SWIFT_UNSAFE_REFERENCE types as @unsafe
2024-09-23 16:51:01 +01:00
Gabor Horvath
8c3849b192
[cxx-interop] Add test for lifetimebound annotation in ctor
...
It looks like everything worked out of the box, no code changes
required. Added a test to avoid regressions.
2024-09-23 16:06:44 +01:00
swift-ci
df338c19a8
Merge remote-tracking branch 'origin/main' into rebranch
2024-09-19 09:34:45 -07:00
Gabor Horvath
929c0ca7d8
[cxx-interop] Introduce a safe C++ interop mode
...
In this mode all C++ types are imported as unsafe by default. Users
explicitly marking types are escapable or not escapable can make them
imported as safe. In the future, we also want to import unannotated
functions as unsafe and add more logic to infer types that are actually
safe, like agregates of escapable types.
2024-09-19 12:34:07 +01:00
swift-ci
72a4f929b0
Merge remote-tracking branch 'origin/main' into rebranch
2024-09-18 07:33:29 -07:00
Gábor Horváth
ffa1014c30
Merge pull request #76311 from swiftlang/gaborh/import-lifetimebound
...
[cxx-interop] Teach importer to interpret lifetimebound annotations
2024-09-18 15:24:32 +01:00
Gabor Horvath
16e012bb5e
[cxx-interop] Teach importer to interpret lifetimebound annotations
...
The lifetimebound annotations are now imported as lifetime dependencies.
This works for basic cases but there are still some parts missing:
* Support lifeitmebound annotations on constructors
* A way to represent immortal/static lifetimes on the C++ side
2024-09-18 10:51:05 +01:00
swift-ci
fb897e5c7b
Merge remote-tracking branch 'origin/main' into rebranch
2024-09-17 09:55:08 -07:00
Egor Zhdan
56b3275ff4
Merge pull request #76459 from rjmansfield/check-libcxx-version
...
[test] Set _LIBCPP_VERSION check in check-libcxx-version.cpp to include 170004
2024-09-17 17:45:17 +01:00
Ben Barham
a7b50f357f
Merge remote-tracking branch 'origin/main' into manual-main-merge
...
Conflicts:
- `lib/Driver/ToolChains.cpp` conflicting with the `addAllArgs` rename
for multiple options
2024-09-16 13:53:18 -07:00
Hiroshi Yamauchi
7633c00764
Merge pull request #76433 from hjyamauchi/issue74866-2
...
Ensure that BridgedTypeArray is indirectly returned
2024-09-16 11:46:29 -07:00
Ryan Mansfield
6989653b4f
[test] Set _LIBCPP_VERSION check in check-libcxx-version.cpp to include 170004.
...
This fixes test failures of libcxx-module-interface.swift and
libcxx-symbolic-module-interface.swift where the std module was split.
e.g building against a MacOS 14.4 SDK.
2024-09-13 14:33:56 -04:00
Hiroshi Yamauchi
f815e1429e
Ensure that BridgedTypeArray is indirectly returned
...
On Windows ARM64, how a struct value type is returned is sensitive to
conditions including whether a user-defined constructor exists,
etc. See
https://learn.microsoft.com/en-us/cpp/build/arm64-windows-abi-conventions?view=msvc-170#return-values
That caused a calling convention mismatch between the
non-USED_IN_CPP_SOURCE (Swift) side and the USE_IN_CPP_SOURCE (C++)
side and a crash.
Add this constructor so that the calling convention matches.
This is a fix for the OnoneSimplification crash in
https://github.com/swiftlang/swift/issues/74866#issuecomment-2319618579
and is a partial fix for
https://github.com/swiftlang/swift/issues/74866#issuecomment-2319618579
2024-09-12 10:46:55 -07:00
Akira Hatanaka
380f319371
Relax check strings ( #76421 )
...
rdar://135165028
2024-09-12 10:35:36 -07:00
fahadnayyar
7753ad0885
Merge pull request #76131 from fahadnayyar/cxx-interop-frt-retain-release-diagnostics
...
Fixed diagnostics for incorrect parameters of retain/release function…
2024-09-11 10:24:20 -07:00
fahadnayyar
f3f4e1913b
Fixed diagnostics for incorrect signature of retain/release functions of SWIFT_SHARED_REFERENCE C++ types.
2024-09-10 16:15:07 -07:00
Alex Lorenz
9bc2689ef1
[rebranch][cxx-interop] fix MSVC testcase check line for indirect return
2024-09-10 09:37:07 -07:00
Egor Zhdan
a745ccaaa4
Merge pull request #76343 from swiftlang/egorzhdan/rebranch-windows-test
...
[cxx-interop][rebranch] Fix test on Windows
2024-09-09 21:03:00 +01:00
Akira Hatanaka
7aaed1efea
Pass --dump-input-filter=all to debug failing test ( #76333 )
2024-09-09 10:47:31 -07:00
Egor Zhdan
0e57d02e5d
[cxx-interop][rebranch] Fix test on Windows
...
rdar://135318900
2024-09-09 17:51:51 +01:00
swift-ci
f3fac46bbc
Merge remote-tracking branch 'origin/main' into rebranch
2024-09-09 08:35:46 -07:00
Alex Lorenz
8ea7569b14
Merge pull request #76286 from hyp/eng/bodyParamsimport
...
[cxx-interop] do not rely on bodyParams being always non-null when im…
2024-09-09 08:24:30 -07:00
swift-ci
9573e8fd3e
Merge remote-tracking branch 'origin/main' into rebranch
2024-09-06 13:11:52 -07:00
Egor Zhdan
a0fb54ce28
Merge pull request #76313 from swiftlang/egorzhdan/std-vector-string-comparable
...
[cxx-interop] Add a `MutableCollection` test that relies on `std::string` being `Comparable`
2024-09-06 21:05:45 +01:00
swift-ci
9717c082ca
Merge remote-tracking branch 'origin/main' into rebranch
2024-09-06 09:16:29 -07:00
fahadnayyar
e3ea4e1b54
Merge pull request #75897 from fahadnayyar/f-dev-frt-return-ownership-annotations-pr
...
[cxx-interop] Add SWIFT_RETURNS_RETAINED and SWIFT_RETURNS_UNRETAINED…
2024-09-06 09:16:08 -07:00
Egor Zhdan
dd78e3b10e
[cxx-interop] Add a MutableCollection test that relies on std::string being Comparable
...
This is possible after https://github.com/swiftlang/swift/pull/76223 .
2024-09-06 17:02:38 +01:00
swift-ci
93b400de6d
Merge remote-tracking branch 'origin/main' into rebranch
2024-09-05 14:14:34 -07:00
Hiroshi Yamauchi
273f5fdc36
Merge pull request #76159 from hjyamauchi/issue74866
...
Add the inreg attribute to sreg when present.
2024-09-05 13:59:53 -07:00
fahadnayyar
ea4328384d
[cxx-interop] Add SWIFT_RETURNS_RETAINED and SWIFT_RETURNS_UNRETAINED annotations to specify ownership of FRT returned by a C++ method or function
...
rdar://135306908
2024-09-05 11:44:31 -07:00
Alex Lorenz
86886d96c9
[cxx-interop] do not rely on bodyParams being always non-null when importing function's name
...
This change fixes a swift-ide-test crash that occured in the Interop\Cxx\stdlib\msvcprt-module-interface.swift testcase with a newer MSVC, as one of its operator() had a parameter with a type that couldn't have been imported. The change ensures that body params are not used if they're null.
2024-09-05 10:54:52 -07:00
swift-ci
db2417963d
Merge remote-tracking branch 'origin/main' into rebranch
2024-09-05 04:56:41 -07:00
Egor Zhdan
9ac56f2f05
Merge pull request #76249 from swiftlang/egorzhdan/simd-template-param
...
[cxx-interop] Disambiguate template instantiations with SIMD parameters
2024-09-05 12:46:50 +01:00
Hiroshi Yamauchi
3f0de5787e
Add the inreg attribute to sreg when present.
...
On Windows/AArch64, a different register is used between when an
arugment is both inreg and sret (X0 or X1) and when it is just sret
(X8) as the following comment indicates:
46fe36a429/llvm/lib/Target/AArch64/AArch64CallingConvention.td (L42)
```
// In AAPCS, an SRet is passed in X8, not X0 like a normal pointer parameter.
// However, on windows, in some circumstances, the SRet is passed in X0 or X1
// instead. The presence of the inreg attribute indicates that SRet is
// passed in the alternative register (X0 or X1), not X8:
// - X0 for non-instance methods.
// - X1 for instance methods.
// The "sret" attribute identifies indirect returns.
// The "inreg" attribute identifies non-aggregate types.
// The position of the "sret" attribute identifies instance/non-instance
// methods.
// "sret" on argument 0 means non-instance methods.
// "sret" on argument 1 means instance methods.
CCIfInReg<CCIfType<[i64],
CCIfSRet<CCIfType<[i64], CCAssignToReg<[X0, X1]>>>>>,
CCIfSRet<CCIfType<[i64], CCAssignToReg<[X8]>>>,
```
So missing/dropping inreg can cause a codegen bug.
This is a partial fix for #74866
2024-09-04 18:00:36 -07:00
swift-ci
8fc7ad929f
Merge remote-tracking branch 'origin/main' into rebranch
2024-09-04 17:14:41 -07:00
Akira Hatanaka
f81d2e67f7
Fix a test that was failing on armv7k ( #76259 )
...
rdar://135165028
2024-09-04 17:06:20 -07:00
swift-ci
3d86372f8a
Merge remote-tracking branch 'origin/main' into rebranch
2024-09-04 13:55:08 -07:00
Egor Zhdan
92c65f5c2f
Merge pull request #76252 from swiftlang/egorzhdan/static-call
...
[cxx-interop] Do not crash for `static operator()`
2024-09-04 21:01:03 +01:00
Egor Zhdan
7a5154f4a9
[cxx-interop] Add a test for static operator()
...
Extracted from https://github.com/swiftlang/swift/pull/76235 .
Co-authored-by: Alex Lorenz <arphaman@gmail.com >
2024-09-04 16:51:58 +01:00
Egor Zhdan
d19c9eb32b
[cxx-interop] Disambiguate template instantiations with SIMD parameters
...
When converting a C++ class template instantiation name into Swift, we previously didn't account for possible SIMD types. Those types were printed as `_`. This meant that e.g. `std::vector<simd::float3>` and `std::vector<simd::float4>` would get the same Swift name, causing compiler errors down the road.
rdar://134214091
2024-09-04 16:46:23 +01:00
swift-ci
4945054e44
Merge remote-tracking branch 'origin/main' into rebranch
2024-09-04 04:55:26 -07:00
Egor Zhdan
03abb1f0f8
Merge pull request #76223 from ishon19/76220-string-should-conform-to-comparable
...
Add comparable conformance for C++ strings
2024-09-04 12:50:44 +01:00
Gábor Horváth
ecd5803ee4
Merge pull request #75923 from swiftlang/gaborh/smart-ptr-move-only
...
[cxx-interop] Add tests for move-only objects behind smart pointers
2024-09-04 12:47:31 +01:00
swift-ci
ec365a63eb
Merge remote-tracking branch 'origin/main' into rebranch
2024-09-03 19:55:40 -07:00