Skip to content

Commit a5d8172

Browse files
committed
[build-script-impl] Rename swift-enable-lto => swift-tools-enable-lto
This makes it clear to the user that they are enabling lto only for swift tools, not for the swift standard library/runtime. rdar://24717107
1 parent c7c5003 commit a5d8172

File tree

5 files changed

+10
-10
lines changed

5 files changed

+10
-10
lines changed

CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ set(SWIFT_NATIVE_CLANG_TOOLS_PATH "" CACHE STRING
140140
set(SWIFT_NATIVE_SWIFT_TOOLS_PATH "" CACHE STRING
141141
"Path to the directory that contains Swift tools that are executable on the build machine")
142142

143-
option(SWIFT_ENABLE_LTO
143+
option(SWIFT_TOOLS_ENABLE_LTO
144144
"If set to true, build the swift compiler with link time optimization enabled" FALSE)
145145

146146
# The following only works with the Ninja generator in CMake >= 3.0.
@@ -743,7 +743,7 @@ endif()
743743
message(STATUS "Building host Swift tools for ${SWIFT_HOST_VARIANT_SDK} ${SWIFT_HOST_VARIANT_ARCH}")
744744
message(STATUS " Build type: ${CMAKE_BUILD_TYPE}")
745745
message(STATUS " Assertions: ${LLVM_ENABLE_ASSERTIONS}")
746-
message(STATUS " LTO: ${SWIFT_ENABLE_LTO}")
746+
message(STATUS " LTO: ${SWIFT_TOOLS_ENABLE_LTO}")
747747
message(STATUS "")
748748

749749
message(STATUS "Building Swift standard library and SDK overlays for SDKs: ${SWIFT_SDKS}")

cmake/modules/AddSwift.cmake

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ function(_add_variant_c_compile_flags)
131131
ARCH "${CFLAGS_ARCH}"
132132
BUILD_TYPE "${CFLAGS_BUILD_TYPE}"
133133
ENABLE_ASSERTIONS "${CFLAGS_ENABLE_ASSERTIONS}"
134-
ENABLE_LTO "${SWIFT_ENABLE_LTO}"
134+
ENABLE_LTO "${SWIFT_TOOLS_ENABLE_LTO}"
135135
ANALYZE_CODE_COVERAGE FALSE
136136
DEPLOYMENT_VERSION_IOS "${CFLAGS_DEPLOYMENT_VERSION_IOS}"
137137
RESULT_VAR_NAME result)
@@ -150,7 +150,7 @@ function(_add_variant_c_compile_flags)
150150

151151
is_build_type_with_debuginfo("${CFLAGS_BUILD_TYPE}" debuginfo)
152152
if(debuginfo)
153-
if(SWIFT_ENABLE_LTO)
153+
if(SWIFT_TOOLS_ENABLE_LTO)
154154
list(APPEND result "-gline-tables-only")
155155
else()
156156
list(APPEND result "-g")
@@ -236,7 +236,7 @@ function(_add_variant_link_flags)
236236
ARCH "${LFLAGS_ARCH}"
237237
BUILD_TYPE "${LFLAGS_BUILD_TYPE}"
238238
ENABLE_ASSERTIONS "${LFLAGS_ENABLE_ASSERTIONS}"
239-
ENABLE_LTO "${SWIFT_ENABLE_LTO}"
239+
ENABLE_LTO "${SWIFT_TOOLS_ENABLE_LTO}"
240240
ANALYZE_CODE_COVERAGE "${LFLAGS_ANALYZE_CODE_COVERAGE}"
241241
DEPLOYMENT_VERSION_IOS "${LFLAGS_DEPLOYMENT_VERSION_IOS}"
242242
RESULT_VAR_NAME result)

test/lit.site.cfg.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ if "@SWIFT_ASAN_BUILD@" == "TRUE":
2626
else:
2727
config.available_features.add('no_asan')
2828

29-
if '@SWIFT_ENABLE_LTO@' == 'TRUE':
29+
if '@SWIFT_TOOLS_ENABLE_LTO@' == 'TRUE':
3030
config.available_features.add('lto')
3131
else:
3232
config.available_features.add('no_lto')

utils/build-script

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1455,7 +1455,7 @@ details of the setups of other systems or automated environments.""")
14551455
if args.lto:
14561456
build_script_impl_args += [
14571457
"--llvm-enable-lto",
1458-
"--swift-enable-lto"
1458+
"--swift-tools-enable-lto"
14591459
]
14601460

14611461
build_script_impl_args += args.build_script_impl_args

utils/build-script-impl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ KNOWN_SETTINGS=(
7474
swift-build-type "Debug" "the CMake build variant for Swift"
7575
swift-enable-assertions "1" "enable assertions in Swift"
7676
swift-analyze-code-coverage "not-merged" "Code coverage analysis mode for Swift (false, not-merged, merged). Defaults to false if the argument is not present, and not-merged if the argument is present without a modifier."
77-
swift-enable-lto "0" "enable LTO compilation of just Swift."
77+
swift-tools-enable-lto "0" "enable LTO compilation of Swift tools. *NOTE* This does not include the swift standard library and runtime."
7878
llvm-enable-lto "0" "enable LTO compilation of LLVM/Clang."
7979
swift-stdlib-build-type "Debug" "the CMake build variant for Swift"
8080
swift-stdlib-enable-assertions "1" "enable assertions in Swift"
@@ -642,7 +642,7 @@ function set_build_options_for_host() {
642642
)
643643
fi
644644

645-
if [[ $(true_false "${SWIFT_ENABLE_LTO}") = "TRUE" ]]; then
645+
if [[ $(true_false "${SWIFT_TOOLS_ENABLE_LTO}") = "TRUE" ]]; then
646646
if [[ $(cmake_needs_to_specify_standard_computed_defaults) = "TRUE" ]]; then
647647
swift_cmake_options+=(
648648
"-DCMAKE_C_STANDARD_COMPUTED_DEFAULT=AppleClang"
@@ -1900,7 +1900,7 @@ for host in "${ALL_HOSTS[@]}"; do
19001900
-DSWIFT_INCLUDE_TESTS:BOOL=$(true_false "${build_tests_this_time}")
19011901
-DSWIFT_INSTALL_COMPONENTS:STRING="${SWIFT_INSTALL_COMPONENTS}"
19021902
-DSWIFT_EMBED_BITCODE_SECTION:BOOL=$(true_false "${EMBED_BITCODE_SECTION}")
1903-
-DSWIFT_ENABLE_LTO:BOOL=$(true_false "${SWIFT_ENABLE_LTO}")
1903+
-DSWIFT_TOOLS_ENABLE_LTO:BOOL=$(true_false "${SWIFT_TOOLS_ENABLE_LTO}")
19041904
-DSWIFT_BUILD_RUNTIME_WITH_HOST_COMPILER:BOOL=$(true_false "${BUILD_RUNTIME_WITH_HOST_COMPILER}")
19051905
"${swift_cmake_options[@]}"
19061906
)

0 commit comments

Comments
 (0)