[cxx-interop] Workaround compiler error when importing CoreGraphics with C++ interop

The CoreGraphics overlay refers to symbols declared via `CF_OPTIONS` macro, which is causing issues in C++ language mode due to the macro definition being different.

This teaches the module interface loader to drop the C++ interop flag when rebuilding the CoreGraphics overlay from its interface.

rdar://142762174
This commit is contained in:
Egor Zhdan
2025-01-14 19:25:40 +00:00
parent 5f79319c45
commit d72006e265
2 changed files with 12 additions and 1 deletions

View File

@@ -2202,7 +2202,9 @@ InterfaceSubContextDelegateImpl::runInSubCompilerInstance(StringRef moduleName,
// FIXME: Hack for Darwin.swiftmodule, which cannot be rebuilt with C++
// interop enabled by the Swift CI because it uses an old host SDK.
if (moduleName == "Darwin") {
// FIXME: Hack for CoreGraphics.swiftmodule, which cannot be rebuilt because
// of a CF_OPTIONS bug (rdar://142762174).
if (moduleName == "Darwin" || moduleName == "CoreGraphics") {
subInvocation.getLangOptions().EnableCXXInterop = false;
subInvocation.getLangOptions().cxxInteropCompatVersion = {};
BuildArgs.erase(llvm::remove_if(BuildArgs,