Skip to content

Commit 16b2808

Browse files
committed
[cxx-interop] Do not install binary .swiftmodule files for the overlays
This fixes a deserialization failure in the compiler that occurred while loading the CxxStdlib overlay module: ``` Cross-reference to module 'Swift' ... Optional ... some ... with type <τ_0_0 where τ_0_0 : ~Copyable, τ_0_0 : ~Escapable> (Optional<τ_0_0>.Type) -> (τ_0_0) -> Optional<τ_0_0> ``` This was happening because the overlays were built against a different version of the Swift stdlib than is being used. The compiler is able to rebuild the Cxx and CxxStdlib modules from their textual interfaces. Let's use that feature unconditionally in production toolchains to avoid this kind of binary incompatibilities. rdar://150416863
1 parent 6ad5c40 commit 16b2808

File tree

3 files changed

+5
-1
lines changed

3 files changed

+5
-1
lines changed

stdlib/cmake/modules/SwiftSource.cmake

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -749,7 +749,9 @@ function(_compile_swift_files
749749
endif()
750750

751751
set(exclude_binary_swiftmodule_installation_args "")
752-
if(NOT SWIFTFILE_INSTALL_BINARY_SWIFTMODULE)
752+
if(NOT SWIFTFILE_INSTALL_BINARY_SWIFTMODULE OR
753+
(SWIFTFILE_INSTALL_BINARY_SWIFTMODULE STREQUAL "NON_DARWIN_ONLY" AND
754+
SWIFTFILE_SDK IN_LIST SWIFT_DARWIN_PLATFORMS))
753755
list(APPEND
754756
exclude_binary_swiftmodule_installation_args
755757
"REGEX" "${SWIFTFILE_MODULE_NAME}.swiftmodule/[^/]*\\.swiftmodule$" EXCLUDE)

stdlib/public/Cxx/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ add_swift_target_library(swiftCxx STATIC NO_LINK_NAME IS_STDLIB IS_SWIFT_ONLY
3939
DEPENDS ${SWIFT_CXX_DEPS}
4040
MACCATALYST_BUILD_FLAVOR zippered
4141
INSTALL_IN_COMPONENT compiler
42+
INSTALL_BINARY_SWIFTMODULE NON_DARWIN_ONLY
4243
INSTALL_WITH_SHARED)
4344

4445
add_subdirectory(libstdcxx)

stdlib/public/Cxx/std/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,5 +81,6 @@ add_swift_target_library(swiftCxxStdlib STATIC NO_LINK_NAME IS_STDLIB IS_SWIFT_O
8181
TARGET_SDKS ALL_APPLE_PLATFORMS LINUX WINDOWS ANDROID
8282
MACCATALYST_BUILD_FLAVOR zippered
8383
INSTALL_IN_COMPONENT compiler
84+
INSTALL_BINARY_SWIFTMODULE NON_DARWIN_ONLY
8485
INSTALL_WITH_SHARED
8586
DEPENDS libstdcxx-modulemap libcxxshim_modulemap CxxStdlib-apinotes)

0 commit comments

Comments
 (0)