Commit Graph

9 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
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
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
d7fd1233a9 [interop][SwiftToCxx] emit instance property getters for structs 2022-06-14 17:20:37 -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