Skip to content

Commit 59feb67

Browse files
committed
[build-script] Add support for running sil-verify-all only on macOS x86_64.
This will let us save some build time without losing the coverage of sil-verify-all everywhere since much of the code in all of the stdlibs are the same.
1 parent c4da432 commit 59feb67

File tree

3 files changed

+14
-0
lines changed

3 files changed

+14
-0
lines changed

CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -363,6 +363,10 @@ option(SWIFT_SIL_VERIFY_ALL
363363
"Run SIL verification after each transform when building Swift files in the build process"
364364
FALSE)
365365

366+
option(SWIFT_SIL_VERIFY_ALL_MACOS_ONLY
367+
"Run SIL verification after each transform when building the macOS stdlib"
368+
FALSE)
369+
366370
option(SWIFT_EMIT_SORTED_SIL_OUTPUT
367371
"Sort SIL output by name to enable diffing of output"
368372
FALSE)

stdlib/cmake/modules/SwiftSource.cmake

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -457,6 +457,14 @@ function(_compile_swift_files
457457
list(APPEND swift_flags "-Xfrontend" "-sil-verify-all")
458458
endif()
459459

460+
if(SWIFT_SIL_VERIFY_ALL_MACOS_ONLY)
461+
# Only add if we have a macOS build triple
462+
if (STREQUAL "${SWIFTFILE_SDK}" "OSX" AND
463+
STREQUAL "${SWIFTFILE_ARCHITECTURE}" "x86_64")
464+
list(APPEND swift_flags "-Xfrontend" "-sil-verify-all")
465+
endif()
466+
endif()
467+
460468
# The standard library and overlays are built with -requirement-machine-protocol-signatures=verify.
461469
if(SWIFTFILE_IS_STDLIB)
462470
list(APPEND swift_flags "-Xfrontend" "-requirement-machine-protocol-signatures=verify")

utils/build-script-impl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,7 @@ KNOWN_SETTINGS=(
196196
extra-swift-args "" "Extra arguments to pass to swift modules which match regex. Assumed to be a flattened cmake list consisting of [module_regexp, args, module_regexp, args, ...]"
197197
report-statistics "0" "set to 1 to generate compilation statistics files for swift libraries"
198198
sil-verify-all "0" "If enabled, run the SIL verifier after each transform when building Swift files during this build process"
199+
sil-verify-all-macos-only "0" "If enabled, run the SIL verifier after each transform when building Swift files during this build process when building a macos stdlib"
199200
stdlib-deployment-targets "" "space-separated list of targets to configure the Swift standard library to be compiled or cross-compiled for"
200201
swift-objc-interop "" "whether to enable interoperability with Objective-C, default is 1 on Darwin platforms, 0 otherwise"
201202
swift-enable-dispatch "1" "whether to enable use of libdispatch"
@@ -1690,6 +1691,7 @@ for host in "${ALL_HOSTS[@]}"; do
16901691
"${swift_cmake_options[@]}"
16911692
-DSWIFT_AST_VERIFIER:BOOL=$(true_false "${SWIFT_ENABLE_AST_VERIFIER}")
16921693
-DSWIFT_SIL_VERIFY_ALL:BOOL=$(true_false "${SIL_VERIFY_ALL}")
1694+
-DSWIFT_SIL_VERIFY_ALL_MACOS_ONLY:BOOL=$(true_false "${SIL_VERIFY_ALL_MACOS_ONLY}")
16931695
-DSWIFT_RUNTIME_ENABLE_LEAK_CHECKER:BOOL=$(true_false "${SWIFT_RUNTIME_ENABLE_LEAK_CHECKER}")
16941696
)
16951697

0 commit comments

Comments
 (0)