Commit Graph

52 Commits

Author SHA1 Message Date
Becca Royal-Gordon
da07ff577c [PrintAsClang] Warn about unstable decl order
PrintAsClang is supposed to emit declarations in the same order regardless of the compiler’s internal state, but we have repeatedly found that our current criteria are inadequate, resulting in non-functionality-affecting changes to generated header content. Add a diagnostic that’s emitted when this happens soliciting a bug report.

Since there *should* be no cases where the compiler fails to order declarations, this diagnostic is never actually emitted. Instead, we test this change by enabling `-verify` on nearly all PrintAsClang tests to make sure they are unaffected.

This did demonstrate a missing criterion that only mattered in C++ mode: extensions that varied only in their generic signature were not sorted stably. Add a sort criterion for this.
2025-02-14 21:41:36 -08:00
Daniel Rodríguez Troitiño
ba68faaed5 [test] Mark tests that use experimental/upcoming features as such
Find all the usages of `--enable-experimental-feature` or
`--enable-upcoming-feature` in the tests and replace some of the
`REQUIRES: asserts` to use `REQUIRES: swift-feature-Foo` instead, which
should correctly apply to depending on the asserts/noasserts mode of the
toolchain for each feature.

Remove some comments that talked about enabling asserts since they don't
apply anymore (but I might had miss some).

All this was done with an automated script, so some formatting weirdness
might happen, but I hope I fixed most of those.

There might be some tests that were `REQUIRES: asserts` that might run
in `noasserts` toolchains now. This will normally be because their
feature went from experimental to upcoming/base and the tests were not
updated.
2024-11-02 11:46:46 -07:00
Rintaro Ishizaki
adb833754b [Test] Add 'REQUIRES: embedded_stdlib' to an embedded test 2024-10-11 15:24:15 -07:00
Egor Zhdan
11268dd188 [cxx-interop] Print inline instead of static inline for template specializations
This fixes a number of test failures in reverse C++ interop.

Clang's behavior was changed in https://github.com/llvm/llvm-project/pull/93873, and it no longer accepts the C++ headers that Swift generates.

rdar://132283247
2024-08-09 15:46:48 +01:00
Gabor Horvath
a05b3051fa [cxx-interop] Fix crash with reverse interop in Embedded Swift
Embedded Swift has a minimal runtime, some type metadata is not
available. This patch works around a crash that tries to emit C++
briding to this non-existent Swift metadata. It is very likely that
there will be more fallout in reverse interop, but this patch should fix
the most glaring issue, crashing on an empty Embedded Swift project.

rdar://129030521
2024-08-05 10:47:09 +01:00
Finagolfin
15e1c73969 [android][test] Enable several C++ Interop and other tests
Also, fix lit.cfg for running the test suite natively in Android and mark one
SILOptimizer executable_test as such.
2024-07-20 17:56:51 +05:30
Alex Lorenz
a3a0a70899 [interop][SwiftToCxx] NFC, add additional test for https://github.com/apple/swift/pull/67241 2023-07-13 13:02:45 -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
swift-ci
9b492d8f0d Merge pull request #64235 from buttaface/droid
[android][test] Disable a SwiftToCxx Interop test that fails with clang 14 in the current LTS NDK 25
2023-03-10 11:47:41 -08:00
Alex Lorenz
0dc90d38c1 [interop][SwiftToCxx] emit Swift's stdlib inside of 'swift' namespace 2023-03-09 17:32:43 -08:00
Butta
12f20ec754 [android][test] Disable a SwiftToCxx Interop test that fails with clang 14 in the current LTS NDK 25
Marking as expected to fail so it's enabled again once we update the NDK and have a new clang
2023-03-09 16:04:09 +05:30
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
Saleem Abdulrasool
7eb4a9254d Merge pull request #63026 from compnerd/untyped
test: adjust for untyped pointers in LLVM
2023-01-18 10:45:41 -08:00
swift-ci
7fc8b1111d Merge remote-tracking branch 'origin/main' into rebranch 2023-01-17 17:15:15 -08:00
Saleem Abdulrasool
e7a3c4dbd9 test: adjust for untyped pointers in LLVM
The LLVM IR has begun migration towards untyped pointers.  Adjust the
test to follow suit.  This was identified when working towards Windows
support for the rebranch.
2023-01-13 12:37:33 -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
c2c0601fd6 Merge remote-tracking branch 'origin/main' into rebranch 2022-11-29 15:54:37 -08:00
Roberto Rosmaninho
fdc1d0ce90 [Interop][SwiftToCxx] Erasing NaiveException call and result on core test 2022-11-18 22:16:00 -03: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
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
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
e98d908ff5 Merge pull request #60858 from Robertorosmaninho/cxx-interop/SwiftToCxxErrorHandling
[SwiftToCxx] Including Cxx representation of Swift's Error
2022-09-07 08:55:27 -07:00
Alex Lorenz
ef5d11aab8 [interop][SwiftToCxx] NFC, Make swift::getTypeMetadata accessor part of struct template
This allows partial template specializations for adding metadata accessor for generic types 🤩
2022-08-31 17:16:45 -07:00
Alex Lorenz
64ab6fcb5e [test] update SwiftToCxx unsigned-return-type-no-zext.cpp test to work without noundef 2022-08-30 13:11:59 -07:00
Roberto Rosmaninho
17ae63592f [SwiftToCxx] Implementing the Swift Error representation in C++ 2022-08-30 14:14:21 -03:00
Alex Lorenz
0a6974072e [test] update SwiftToCxx unsigned-return-type-no-zext.cpp test to
work on Amazon Linux

Zeroext is optional
2022-08-29 22:52:57 -07:00
Tongjie Wang
baac27d04c update test case for windows 2022-08-25 11:37:21 -07:00
Tongjie Wang
be01f28f77 update test case 2022-08-18 12:32:29 -07:00
Tongjie Wang
ae73a03ec0 Merge branch 'main' into fix-value-witness-table-type 2022-08-18 09:57:57 -07:00
Alex Lorenz
34b5ead2e0 [interop][SwiftToCxx] add a test that verifies that we can emit C++ header from previously built swiftinterface 2022-08-15 11:56:06 -07:00
Alex Lorenz
c864087b1f [interop][SwiftToCxx] add a test that verifies that we can emit C++ header from previously built swiftmodule 2022-08-15 11:50:58 -07:00
Alex Lorenz
c537cd2383 [interop][SwiftToCxx] NFC, move swift::_impl::OpaqueStorage into _SwiftCxxInteroperability shims header 2022-08-09 13:57:34 -07:00
Tongjie Wang
a1907f499e add test case checking return type 2022-08-08 12:13:40 -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
9ff7f94865 [interop][SwiftToCxx] NFC, move generic traits declarations to shims header 2022-07-29 13:59:04 +01:00
Alex Lorenz
567bb850cc [interop][SwiftToCxx] add _SwiftCxxInteroperability.h shims header and import it for C++ header mode 2022-07-29 08:54:27 +01:00
Alex Lorenz
32723f7e67 [interop][SwiftToCxx] initial generic function support: pass generic parameters
Only primitive types are supported at the moment from C++ as the type traits aren't emitted for all types yet
2022-07-28 22:52:21 +01:00
Roberto Rosmaninho
b15c6a5537 Implementing a naive exception to be thrown in C++ if an Error is thrown in Swift
Creating new Interop - SwiftToCxx test
2022-07-15 20:14:13 -03:00
Alex Lorenz
f49e26ee37 [interop][SwiftToCxx] mark value witness table functions as noexcept
This is only supported in C++17, so C++14 mode will still not be noexcept
2022-07-14 15:42:27 +01:00
Alex Lorenz
12f6d970b7 [interop][SwiftToCxx] mark the alloc/free heap allocation functions as noexcept 2022-07-14 15:16:07 +01:00
Tongjie Wang
7ebcb7b33a [Interop][SwiftToCxx] Implement enum case switching 2022-06-30 22:41:15 -07:00
Alex Lorenz
0c909c2f26 Merge pull request #59482 from hyp/eng/emit-resilient-structs
[interop][SwiftToCxx] Add support for emitting resilient struct bindings
2022-06-16 20:20:52 -07:00
Alex Lorenz
b8ee625f77 [interop][SwiftToCxx] fix aligned allocation refs 2022-06-16 14:14:40 -07:00
Alex Lorenz
5c3b4ca1da [interop][SwiftToCxx] annotate OpaqueStorage with noexcept 2022-06-15 21:56:25 -07:00
Alex Lorenz
61e484c410 [interop][SwiftToCxx] correctly align allocation for opaque Swift value 2022-06-15 21:47:39 -07:00
Alex Lorenz
f577330b40 [interop][SwiftToCxx] fix copy constructor for resilient structs 2022-06-15 20:56:42 -07:00
Alex Lorenz
5474d7e54d [interop][SwiftToCxx] Add support for emitting resilient struct bindings 2022-06-15 20:33:23 -07:00
Alex Lorenz
0d5c138821 [interop][SwiftToCxx] place ptrauth attribute on the function type itself for value witness function types
Fixes rdar://95224817
2022-06-15 16:07:19 -07:00