[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
This commit is contained in:
Egor Zhdan
2025-07-01 13:02:27 +01:00
parent 1cf426c905
commit 9178af3ec7
6 changed files with 14 additions and 13 deletions

View File

@@ -1580,8 +1580,9 @@ static bool ParseLangArgs(LangOptions &Opts, ArgList &Args,
Args.hasFlag(OPT_enable_objc_interop, OPT_disable_objc_interop,
Target.isOSDarwin() && !Opts.hasFeature(Feature::Embedded));
Opts.CForeignReferenceTypes =
Args.hasArg(OPT_experimental_c_foreign_reference_types);
if (Args.hasArg(OPT_experimental_c_foreign_reference_types))
Diags.diagnose(SourceLoc(), diag::warn_flag_deprecated,
"-experimental-c-foreign-reference-types");
Opts.CxxInteropGettersSettersAsProperties = Args.hasArg(OPT_cxx_interop_getters_setters_as_properties);
Opts.RequireCxxInteropToImportCxxInteropModule =