Skip to content

Commit 9c3ea84

Browse files
committed
[Backtracing] Disable implicit imports for executable builds.
Implicit imports were off for library builds already, but we need them off for executable builds too, otherwise we have problems with _StringProcessing.
1 parent 3ec2e67 commit 9c3ea84

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

stdlib/cmake/modules/AddSwiftStdlib.cmake

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2681,6 +2681,7 @@ function(add_swift_target_executable name)
26812681
SWIFT_MODULE_DEPENDS_MACCATALYST
26822682
SWIFT_MODULE_DEPENDS_MACCATALYST_UNZIPPERED
26832683
TARGET_SDKS
2684+
COMPILE_FLAGS
26842685
)
26852686

26862687
# Parse the arguments we were given.
@@ -2702,6 +2703,18 @@ function(add_swift_target_executable name)
27022703
set(install_in_component "${SWIFTEXE_TARGET_INSTALL_IN_COMPONENT}")
27032704
endif()
27042705

2706+
# Turn off implicit imports
2707+
list(APPEND SWIFTEXE_TARGET_COMPILE_FLAGS "-Xfrontend;-disable-implicit-concurrency-module-import")
2708+
2709+
if(SWIFT_ENABLE_EXPERIMENTAL_STRING_PROCESSING)
2710+
list(APPEND SWIFTEXE_TARGET_COMPILE_FLAGS
2711+
"-Xfrontend;-disable-implicit-string-processing-module-import")
2712+
endif()
2713+
2714+
if(SWIFT_IMPLICIT_BACKTRACING_IMPORT)
2715+
list(APPEND SWIFTEXE_TARGET_COMPILE_FLAGS "-Xfrontend;-disable-implicit-backtracing-module-import")
2716+
endif()
2717+
27052718
# All Swift executables depend on the standard library.
27062719
list(APPEND SWIFTEXE_TARGET_SWIFT_MODULE_DEPENDS Core)
27072720
# All Swift executables depend on the swiftSwiftOnoneSupport library.
@@ -2848,6 +2861,8 @@ function(add_swift_target_executable name)
28482861
${swiftexe_module_dependency_targets}
28492862
SDK "${sdk}"
28502863
ARCHITECTURE "${arch}"
2864+
COMPILE_FLAGS
2865+
${SWIFTEXE_TARGET_COMPILE_FLAGS}
28512866
INSTALL_IN_COMPONENT ${install_in_component})
28522867

28532868
_list_add_string_suffix(

0 commit comments

Comments
 (0)