Commit Graph

6 Commits

Author SHA1 Message Date
Egor Zhdan
bac5d0e9a1 [cxx-interop] Zero-initialize C++ structs when calling their default constructors
When Swift imports C structs, it synthesizes an initializer that takes no arguments and zero-initializes the C struct.

When C++ interop is enabled, Clang treats all C structs as if they were C++ structs. This means that some of the C structs will get a default constructor implicitly generated by Clang. This implicit default constructor will not zero-initialize trivial fields of the struct.

This is a common source of confusion and subtle bugs for developers who try to enable C++ interop in existing projects that use C interop and rely on zero-initialization of C structs.

rdar://115909532
2024-04-16 13:42:02 +01:00
finagolfin
75bfa4422a [android][test] Fix five tests that are failing on the community Android CI (#69189)
Update the Android doc with info about the latest LTS NDK not working.
2023-10-16 10:44:56 -07:00
Finagolfin
30ba49e7fa [android][test] Fix a handful of tests and disable one CxxToSwiftToCxx bridging test
Also, make the analogous change to apple/swift-driver#1372, which gets the
sanitizer tests working on Android again, and remove the lld_lto feature in the
tests, which is now unused.
2023-08-12 16:36:35 +05:30
Butta
9e3492cef1 [android][test] Fix two C++ Interop tests that were recently updated on macOS
These flags were recently added to the macOS versions of these tests in #63809.
2023-03-07 18:57:09 +05:30
Butta
4b22ca1550 [android][test] Fix two C++ Interop tests that were split off for Android, enable two more new ones, and set an executable_test
Also, make some related changes, like updating a path in the Android doc, making sure the
`unknown` vendor is always used, and using `CPU` instead of `CODEGENERATOR`.
2022-11-08 22:13:36 +05:30
Egor Zhdan
5a3bb14d83 [cxx-interop] Fix tests that passed -module-name Swift
`Swift` is the name of the Swift standard library module. Creating another module with this name breaks assumptions in the compiler and caused these two tests to fail.
2022-10-19 15:00:50 +01:00