[cxx-interop] Workaround compiler error when importing AppKit/UIKit with C++ interop

The AppKit/UIKit overlay refers to symbols declared via NS_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 AppKit and UIKit overlay
from its interface.

This is the same fix as #78636, but for different modules.

rdar://143033209
This commit is contained in:
Cassie Jones
2025-01-16 15:19:23 -08:00
parent 610d07e9ed
commit 7323a752b6
2 changed files with 20 additions and 1 deletions

View File

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