Skip to content

Commit a415b1f

Browse files
authored
Merge pull request #61889 from DougGregor/astgen-no-import-string-processing
[ASTGen] Disable implicit import of _StringProcessing in ASTGen.
2 parents d059735 + 85e4243 commit a415b1f

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

lib/ASTGen/CMakeLists.txt

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,23 @@
11
if (SWIFT_SWIFT_PARSER)
2+
# Ensure that we do not link the _StringProcessing module. But we can
3+
# only pass this flag for new-enough compilers that support it.
4+
file(WRITE "${CMAKE_BINARY_DIR}/tmp/empty-check-string-processing.swift" "")
5+
execute_process(
6+
COMMAND
7+
"${CMAKE_Swift_COMPILER}"
8+
-Xfrontend -disable-implicit-string-processing-module-import
9+
-c - -o /dev/null
10+
INPUT_FILE
11+
"${CMAKE_BINARY_DIR}/tmp/empty-check-string-processing.swift"
12+
OUTPUT_QUIET ERROR_QUIET
13+
RESULT_VARIABLE
14+
SWIFT_SUPPORTS_DISABLE_IMPLICIT_STRING_PROCESSING_MODULE_IMPORT)
15+
if (NOT SWIFT_SUPPORTS_DISABLE_IMPLICIT_STRING_PROCESSING_MODULE_IMPORT)
16+
add_compile_options(
17+
$<$<COMPILE_LANGUAGE:Swift>:-Xfrontend>
18+
$<$<COMPILE_LANGUAGE:Swift>:-disable-implicit-string-processing-module-import>)
19+
endif()
20+
221
add_library(swiftASTGen STATIC
322
Sources/ASTGen/ASTGen.swift
423
Sources/ASTGen/Decls.swift

0 commit comments

Comments
 (0)