[SE-0458] Enable strict memory safety in the Swift standard library

This commit is contained in:
Doug Gregor
2024-12-27 08:01:56 -08:00
parent 7977e4682c
commit 50d3913086
4 changed files with 4 additions and 3 deletions

View File

@@ -182,7 +182,7 @@ add_compile_options(
"$<$<COMPILE_LANGUAGE:Swift>:SHELL:-enable-experimental-feature NoncopyableGenerics2>" "$<$<COMPILE_LANGUAGE:Swift>:SHELL:-enable-experimental-feature NoncopyableGenerics2>"
"$<$<COMPILE_LANGUAGE:Swift>:SHELL:-enable-experimental-feature SuppressedAssociatedTypes>" "$<$<COMPILE_LANGUAGE:Swift>:SHELL:-enable-experimental-feature SuppressedAssociatedTypes>"
"$<$<COMPILE_LANGUAGE:Swift>:SHELL:-enable-experimental-feature SE427NoInferenceOnExtension>" "$<$<COMPILE_LANGUAGE:Swift>:SHELL:-enable-experimental-feature SE427NoInferenceOnExtension>"
"$<$<COMPILE_LANGUAGE:Swift>:SHELL:-enable-experimental-feature AllowUnsafeAttribute>" "$<$<COMPILE_LANGUAGE:Swift>:SHELL:-strict-memory-safety>"
"$<$<COMPILE_LANGUAGE:Swift>:SHELL:-enable-experimental-feature NonescapableTypes>" "$<$<COMPILE_LANGUAGE:Swift>:SHELL:-enable-experimental-feature NonescapableTypes>"
"$<$<COMPILE_LANGUAGE:Swift>:SHELL:-enable-experimental-feature LifetimeDependence>" "$<$<COMPILE_LANGUAGE:Swift>:SHELL:-enable-experimental-feature LifetimeDependence>"
"$<$<COMPILE_LANGUAGE:Swift>:SHELL:-enable-experimental-feature MemberImportVisibility>" "$<$<COMPILE_LANGUAGE:Swift>:SHELL:-enable-experimental-feature MemberImportVisibility>"

View File

@@ -628,7 +628,7 @@ function(_compile_swift_files
list(APPEND swift_flags "-enable-experimental-feature" "NoncopyableGenerics2") list(APPEND swift_flags "-enable-experimental-feature" "NoncopyableGenerics2")
list(APPEND swift_flags "-enable-experimental-feature" "SuppressedAssociatedTypes") list(APPEND swift_flags "-enable-experimental-feature" "SuppressedAssociatedTypes")
list(APPEND swift_flags "-enable-experimental-feature" "SE427NoInferenceOnExtension") list(APPEND swift_flags "-enable-experimental-feature" "SE427NoInferenceOnExtension")
list(APPEND swift_flags "-enable-experimental-feature" "AllowUnsafeAttribute")
list(APPEND swift_flags "-enable-experimental-feature" "NonescapableTypes") list(APPEND swift_flags "-enable-experimental-feature" "NonescapableTypes")
list(APPEND swift_flags "-enable-experimental-feature" "LifetimeDependence") list(APPEND swift_flags "-enable-experimental-feature" "LifetimeDependence")

View File

@@ -7,7 +7,7 @@ set(swiftOnoneSupport_common_options
"${SWIFT_SOURCE_DIR}/stdlib/linker-support/magic-symbols-for-install-name.c" "${SWIFT_SOURCE_DIR}/stdlib/linker-support/magic-symbols-for-install-name.c"
SWIFT_COMPILE_FLAGS "-parse-stdlib" "-Xllvm" "-sil-inline-generics=false" "-Xfrontend" "-validate-tbd-against-ir=none" "-Xfrontend" "-check-onone-completeness" "-Xfrontend" "-disable-access-control" "${SWIFT_RUNTIME_SWIFT_COMPILE_FLAGS}" "${SWIFT_STANDARD_LIBRARY_SWIFT_FLAGS}" SWIFT_COMPILE_FLAGS "-parse-stdlib" "-Xllvm" "-sil-inline-generics=false" "-Xfrontend" "-validate-tbd-against-ir=none" "-Xfrontend" "-check-onone-completeness" "-Xfrontend" "-disable-access-control" "-strict-memory-safety" "${SWIFT_RUNTIME_SWIFT_COMPILE_FLAGS}" "${SWIFT_STANDARD_LIBRARY_SWIFT_FLAGS}"
LINK_FLAGS "${SWIFT_RUNTIME_SWIFT_LINK_FLAGS}") LINK_FLAGS "${SWIFT_RUNTIME_SWIFT_LINK_FLAGS}")
if(CMAKE_BUILD_TYPE STREQUAL "Debug" AND BOOTSTRAPPING_MODE STREQUAL "BOOTSTRAPPING") if(CMAKE_BUILD_TYPE STREQUAL "Debug" AND BOOTSTRAPPING_MODE STREQUAL "BOOTSTRAPPING")

View File

@@ -322,6 +322,7 @@ list(APPEND swift_stdlib_compile_flags "-enable-experimental-feature" "BitwiseCo
list(APPEND swift_stdlib_compile_flags "-enable-experimental-feature" "ValueGenerics") list(APPEND swift_stdlib_compile_flags "-enable-experimental-feature" "ValueGenerics")
list(APPEND swift_stdlib_compile_flags "-enable-experimental-feature" "AddressableParameters") list(APPEND swift_stdlib_compile_flags "-enable-experimental-feature" "AddressableParameters")
list(APPEND swift_stdlib_compile_flags "-enable-experimental-feature" "AddressableTypes") list(APPEND swift_stdlib_compile_flags "-enable-experimental-feature" "AddressableTypes")
list(APPEND swift_stdlib_compile_flags "-strict-memory-safety")
if("${SWIFT_NATIVE_SWIFT_TOOLS_PATH}" STREQUAL "") if("${SWIFT_NATIVE_SWIFT_TOOLS_PATH}" STREQUAL "")
set(swift_bin_dir "${CMAKE_BINARY_DIR}/bin") set(swift_bin_dir "${CMAKE_BINARY_DIR}/bin")