[cxx-interop] Enable foreign reference types in C interop

Most of the logic for C++ foreign reference types can be applied to C types as well. Swift had a compiler flag `-Xfrontend -experimental-c-foreign-reference-types` for awhile now which enables foreign reference types without having to enable C++ interop. This change makes it the default behavior.

Since we don't expect anyone to pass `experimental-c-foreign-reference-types` currently, this also removes the frontend flag.

rdar://150308819
(cherry picked from commit 9178af3ec7)
This commit is contained in:
Egor Zhdan
2025-07-01 13:02:27 +01:00
committed by Doug Gregor
parent 5cc6f245d0
commit 7a67b350e9
6 changed files with 14 additions and 13 deletions

View File

@@ -353,8 +353,6 @@ namespace swift {
return CXXStdlib == PlatformDefaultCXXStdlib;
}
bool CForeignReferenceTypes = false;
/// Imports getters and setters as computed properties.
bool CxxInteropGettersSettersAsProperties = false;

View File

@@ -871,7 +871,7 @@ def cxx_interoperability_mode :
def experimental_c_foreign_reference_types :
Flag<["-"], "experimental-c-foreign-reference-types">,
Flags<[FrontendOption, HelpHidden, ModuleInterfaceOption]>,
HelpText<"Enable experimental C foreign references types (with reference counting).">;
HelpText<"Enable experimental C foreign references types. Deprecated, has no effect.">;
def experimental_hermetic_seal_at_link:
Flag<["-"], "experimental-hermetic-seal-at-link">,