Commit Graph

19 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
Alexander Cyon
db0b5db54e [test/Interop] Fix typos (#75032) 2024-08-28 09:41:09 -07:00
Egor Zhdan
6ea561c4ec [cxx-interop] Fix a test on 32-bit platforms, pt 2
rdar://128673905
2024-05-30 16:01:49 +01:00
Hamish Knight
d18bd49f8b [test] Disable small-structs-pass-return-direct-in-c.swift for 32 bit 2024-05-29 14:33:55 +01:00
Egor Zhdan
2c6e58fa44 [cxx-interop] Fix a test on 32-bit platforms
rdar://102147255
2024-05-17 17:24:55 +01:00
Saleem Abdulrasool
d61b8855e9 stdlib: map wchar_t to UInt16 on Windows
This is an ABI breaking change for Windows.  `WCHAR` on Windows is
mapped to `short` (`-fshort-wchar` makes it `unsigned short`).  When C++
interop is enabled, `WCHAR` will be mapped to `wchar_t` which is then
mapped to `short` (or `unsigned short` if `-fshort-wchar` is specified).
Correct the mapping type to get the desired behaviour.
2023-10-09 20:02:48 -07: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
Andrew Trick
940c676796 Temporarily disable an Interop test on 32-bit
See rdar://102147255
(Swift CI: [main] 1. OSS - Swift (Tools Opt+Assert, Stdlib DebInfo+Assert, Test Device non_executable)
TEST 'Swift(watchos-armv7k) :: Interop/SwiftToC/structs/small-structs-pass-return-direct-in-c.swift' FAILED)
2022-11-09 10:03:41 -08:00
Erik Eckstein
70981cf95f tests: fix misspelled check prefixes
Fix the common error of using underscores instead of dashes.
In the rebranch this is an error (lit got more picky), but it also makes sense to fix the tests in the main branch
2022-11-08 17:27:48 +01: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
1696f94223 [interop][SwiftToCxx] reimplement function lowering to correctly distinguish between direct/indirect return values and parameters 2022-09-07 11:43:38 -07:00
Alex Lorenz
d7fd1233a9 [interop][SwiftToCxx] emit instance property getters for structs 2022-06-14 17:20:37 -07:00
Alex Lorenz
550de968d5 split the failing test to 64 bit only test file and unified file 2022-06-09 17:32:22 -07:00
Alex Lorenz
c7265f3b40 fix the macos tests 2022-06-09 08:52:22 -07:00
Alex Lorenz
132729906c [interop][SwiftToCxx] pass / return Swift struct values between C/C++ and Swift 2022-06-08 07:03:24 -07:00
Alex Lorenz
68fc606510 [interop] NFC, add a method to print out identifier to clang syntax printer 2022-03-24 21:54:44 -07:00
Alex Lorenz
146f9e84ee [interop][SwiftToC] print out nullability specifiers for primitive C types 2022-03-24 10:53:48 -07:00
Alex Lorenz
5a02fde5ca [interop] separate out CLong and CUnsignedLong interop test into separate file to make it work on LP64 targets only 2022-03-23 21:35:06 -07:00
Alex Lorenz
81a9cade88 [interop] generate C interfaces for Swift top-level functions that use primitive types 2022-03-22 16:13:42 -07:00