Commit Graph

2 Commits

Author SHA1 Message Date
Egor Zhdan
00e6b360d5 [cxx-interop] Assume that plain-C enums are resilient
This fixes sudden compiler errors that are emitted when trying to use CoreText.framework with C++ interop enabled.

When Swift is trying to rebuild a dependency module from its textual interface, it should not complain on usages of C enums in public Swift APIs.

This still leaves the resilience safety guardrail enabled for C++ scoped enums.

rdar://143215914
2025-01-21 18:57:10 +00:00
Egor Zhdan
8859b629fa [cxx-interop] Allow using C-like structs in public Swift interfaces
When compiling with C++ interop enabled, we enable extra safety checks to prevent library authors from accidentally exposing ABI-fragile C++ symbols in resilient Swift interfaces.

The heuristic we use is overly strict, and it prevents the compiler from being able to typecheck various modules from their interfaces when C++ interop is enabled. Darwin and System are two of such modules.

The underlying challenge is that there isn't a good distinction between C structs and C++ structs: whenever parsing a header file in C++ language mode, Clang assumes that every struct is a C++ struct.

This relaxes the heuristic to allow exposing C-like structs in resilient interfaces.

rdar://140203932
2024-12-06 20:18:53 +00:00