Skip to content

Commit c94b24c

Browse files
committed
Merge branch 'main' of github.com:apple/swift into main
2 parents e3e115f + d43ea45 commit c94b24c

File tree

26 files changed

+189
-80
lines changed

26 files changed

+189
-80
lines changed

CMakeLists.txt

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -612,10 +612,15 @@ set(SWIFT_DARWIN_VARIANTS "^(macosx|iphoneos|iphonesimulator|appletvos|appletvsi
612612
set(SWIFT_DARWIN_EMBEDDED_VARIANTS "^(iphoneos|iphonesimulator|appletvos|appletvsimulator|watchos|watchsimulator)")
613613

614614
# A convenient list to match Darwin SDKs. Example:
615-
# if("${SWIFT_HOST_VARIANT_SDK}" IN_LIST SWIFT_APPLE_PLATFORMS)
615+
# if("${SWIFT_HOST_VARIANT_SDK}" IN_LIST SWIFT_DARWIN_PLATFORMS)
616616
# ...
617617
# endif()
618-
set(SWIFT_APPLE_PLATFORMS "IOS" "IOS_SIMULATOR" "TVOS" "TVOS_SIMULATOR" "WATCHOS" "WATCHOS_SIMULATOR" "OSX")
618+
set(SWIFT_DARWIN_PLATFORMS "IOS" "IOS_SIMULATOR" "TVOS" "TVOS_SIMULATOR" "WATCHOS" "WATCHOS_SIMULATOR" "OSX")
619+
620+
set(SWIFT_APPLE_PLATFORMS ${SWIFT_DARWIN_PLATFORMS})
621+
if(SWIFT_FREESTANDING_FLAVOR STREQUAL "apple")
622+
list(APPEND SWIFT_APPLE_PLATFORMS "FREESTANDING")
623+
endif()
619624

620625
# Configuration flags passed to all of our invocations of gyb. Try to
621626
# avoid making up new variable names here if you can find a CMake

cmake/modules/AddSwift.cmake

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ endfunction()
110110
# Usage:
111111
# _add_host_variant_c_compile_link_flags(name)
112112
function(_add_host_variant_c_compile_link_flags name)
113-
if(SWIFT_HOST_VARIANT_SDK IN_LIST SWIFT_APPLE_PLATFORMS)
113+
if(SWIFT_HOST_VARIANT_SDK IN_LIST SWIFT_DARWIN_PLATFORMS)
114114
set(DEPLOYMENT_VERSION "${SWIFT_SDK_${SWIFT_HOST_VARIANT_SDK}_DEPLOYMENT_VERSION}")
115115
endif()
116116

@@ -153,7 +153,7 @@ function(_add_host_variant_c_compile_link_flags name)
153153
endif()
154154
endif()
155155

156-
if(SWIFT_HOST_VARIANT_SDK IN_LIST SWIFT_APPLE_PLATFORMS)
156+
if(SWIFT_HOST_VARIANT_SDK IN_LIST SWIFT_DARWIN_PLATFORMS)
157157
# We collate -F with the framework path to avoid unwanted deduplication
158158
# of options by target_compile_options -- this way no undesired
159159
# side effects are introduced should a new search path be added.
@@ -537,7 +537,7 @@ function(add_swift_host_library name)
537537
BINARY_DIR ${SWIFT_RUNTIME_OUTPUT_INTDIR}
538538
LIBRARY_DIR ${SWIFT_LIBRARY_OUTPUT_INTDIR})
539539
540-
if(SWIFT_HOST_VARIANT_SDK IN_LIST SWIFT_APPLE_PLATFORMS)
540+
if(SWIFT_HOST_VARIANT_SDK IN_LIST SWIFT_DARWIN_PLATFORMS)
541541
set_target_properties(${name} PROPERTIES
542542
INSTALL_NAME_DIR "@rpath")
543543
elseif(SWIFT_HOST_VARIANT_SDK STREQUAL LINUX)
@@ -596,7 +596,7 @@ function(add_swift_host_library name)
596596
set_target_properties(${name} PROPERTIES LINKER_LANGUAGE CXX)
597597
endif()
598598
599-
if(${SWIFT_HOST_VARIANT_SDK} IN_LIST SWIFT_APPLE_PLATFORMS)
599+
if(${SWIFT_HOST_VARIANT_SDK} IN_LIST SWIFT_DARWIN_PLATFORMS)
600600
target_link_options(${name} PRIVATE
601601
"LINKER:-compatibility_version,1")
602602
if(SWIFT_COMPILER_VERSION)
@@ -723,7 +723,7 @@ function(add_libswift name)
723723
724724
set(build_dir ${CMAKE_CURRENT_BINARY_DIR})
725725
726-
if(SWIFT_HOST_VARIANT_SDK IN_LIST SWIFT_APPLE_PLATFORMS)
726+
if(SWIFT_HOST_VARIANT_SDK IN_LIST SWIFT_DARWIN_PLATFORMS)
727727
set(deployment_version "${SWIFT_SDK_${SWIFT_HOST_VARIANT_SDK}_DEPLOYMENT_VERSION}")
728728
endif()
729729
get_versioned_target_triple(target ${SWIFT_HOST_VARIANT_SDK}
@@ -821,7 +821,7 @@ function(add_swift_host_tool executable)
821821
set_target_properties(${executable} PROPERTIES
822822
JOB_POOL_LINK swift_link_job_pool)
823823
endif()
824-
if(${SWIFT_HOST_VARIANT_SDK} IN_LIST SWIFT_APPLE_PLATFORMS)
824+
if(${SWIFT_HOST_VARIANT_SDK} IN_LIST SWIFT_DARWIN_PLATFORMS)
825825
# If we found a swift compiler and are going to use swift code in swift
826826
# host side tools but link with clang, add the appropriate -L paths so we
827827
# find all of the necessary swift libraries on Darwin.

cmake/modules/Libdispatch.cmake

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ endif()
4646

4747
# Build any target libdispatch if needed.
4848
foreach(sdk ${SWIFT_SDKS})
49-
# Apple targets have libdispatch available, do not build it.
50-
if(NOT "${sdk}" IN_LIST SWIFT_APPLE_PLATFORMS)
49+
# Darwin targets have libdispatch available, do not build it.
50+
if(NOT "${sdk}" IN_LIST SWIFT_DARWIN_PLATFORMS)
5151
list(APPEND DISPATCH_SDKS "${sdk}")
5252
endif()
5353
endforeach()

cmake/modules/StandaloneOverlay.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ set(CMAKE_INSTALL_PREFIX
9090
"${SWIFT_DEST_ROOT}${TOOLCHAIN_DIR}/usr")
9191

9292

93-
set(SWIFT_APPLE_PLATFORMS
93+
set(SWIFT_DARWIN_PLATFORMS
9494
OSX IOS IOS_SIMULATOR TVOS TVOS_SIMULATOR WATCHOS WATCHOS_SIMULATOR)
9595

9696
# Flags used to indicate we are building a standalone overlay.

cmake/modules/SwiftConfigureSDK.cmake

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ function(_report_sdk prefix)
2424
message(STATUS " ${CMAKE_BUILD_TYPE} VC++ CRT: MD")
2525
endif()
2626
endif()
27-
if(prefix IN_LIST SWIFT_APPLE_PLATFORMS)
27+
if(prefix IN_LIST SWIFT_DARWIN_PLATFORMS)
2828
message(STATUS " Version: ${SWIFT_SDK_${prefix}_VERSION}")
2929
message(STATUS " Build number: ${SWIFT_SDK_${prefix}_BUILD_NUMBER}")
3030
message(STATUS " Deployment version: ${SWIFT_SDK_${prefix}_DEPLOYMENT_VERSION}")
@@ -60,7 +60,7 @@ function(_report_sdk prefix)
6060
endforeach()
6161
endif()
6262

63-
if(NOT prefix IN_LIST SWIFT_APPLE_PLATFORMS)
63+
if(NOT prefix IN_LIST SWIFT_DARWIN_PLATFORMS)
6464
foreach(arch ${SWIFT_SDK_${prefix}_ARCHITECTURES})
6565
message(STATUS " ${arch} libc header path: ${SWIFT_SDK_${prefix}_ARCH_${arch}_LIBC_INCLUDE_DIRECTORY}")
6666
message(STATUS " ${arch} libc architecture specific header path: ${SWIFT_SDK_${prefix}_ARCH_${arch}_LIBC_ARCHITECTURE_INCLUDE_DIRECTORY}")

include/swift/Runtime/Concurrent.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -639,7 +639,7 @@ struct ConcurrentReadableHashMap {
639639
/// Otherwise, just return the passed-in size, which is always valid even if
640640
/// not necessarily optimal.
641641
static size_t goodSize(size_t size) {
642-
#if defined(__APPLE__) && defined(__MACH__)
642+
#if defined(__APPLE__) && defined(__MACH__) && SWIFT_STDLIB_HAS_DARWIN_LIBMALLOC
643643
return malloc_good_size(size);
644644
#else
645645
return size;

lib/IDE/Refactoring.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7214,7 +7214,7 @@ class AsyncConverter : private SourceEntityWalker {
72147214
/*Success=*/true);
72157215

72167216
addAwaitCall(CE, ArgList.ref(), Blocks.SuccessBlock, SuccessParams,
7217-
InlinePatterns, HandlerDesc, /*AddDeclarations*/ true);
7217+
InlinePatterns, HandlerDesc, /*AddDeclarations=*/true);
72187218
printOutOfLineBindingPatterns(Blocks.SuccessBlock, InlinePatterns);
72197219
convertNodes(Blocks.SuccessBlock.nodesToPrint());
72207220
clearNames(SuccessParams);
@@ -7225,7 +7225,8 @@ class AsyncConverter : private SourceEntityWalker {
72257225

72267226
// Always use the ErrParam name if none is bound.
72277227
prepareNames(Blocks.ErrorBlock, llvm::makeArrayRef(ErrParam),
7228-
ErrInlinePatterns, HandlerDesc.Type != HandlerType::RESULT);
7228+
ErrInlinePatterns,
7229+
/*AddIfMissing=*/HandlerDesc.Type != HandlerType::RESULT);
72297230
preparePlaceholdersAndUnwraps(HandlerDesc, SuccessParams, ErrParam,
72307231
/*Success=*/false);
72317232

@@ -7506,7 +7507,7 @@ class AsyncConverter : private SourceEntityWalker {
75067507
void addCatch(const ParamDecl *ErrParam) {
75077508
OS << "\n" << tok::r_brace << " " << tok::kw_catch << " ";
75087509
auto ErrName = newNameFor(ErrParam, false);
7509-
if (!ErrName.empty()) {
7510+
if (!ErrName.empty() && ErrName != "_") {
75107511
OS << tok::kw_let << " " << ErrName << " ";
75117512
}
75127513
OS << tok::l_brace;
@@ -7590,6 +7591,8 @@ class AsyncConverter : private SourceEntityWalker {
75907591
/// other names in the current scope.
75917592
Identifier createUniqueName(StringRef Name) {
75927593
Identifier Ident = getASTContext().getIdentifier(Name);
7594+
if (Name == "_")
7595+
return Ident;
75937596

75947597
auto &CurrentNames = Scopes.back().Names;
75957598
if (CurrentNames.count(Ident)) {

lib/IRGen/GenDecl.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -570,8 +570,14 @@ emitGlobalList(IRGenModule &IGM, ArrayRef<llvm::WeakTrackingVH> handles,
570570
auto var = new llvm::GlobalVariable(IGM.Module, varTy, isConstant, linkage,
571571
init, name);
572572
var->setSection(section);
573-
var->setAlignment(llvm::MaybeAlign(alignment.getValue()));
574-
disableAddressSanitizer(IGM, var);
573+
574+
// Do not set alignment and don't set disableAddressSanitizer on @llvm.used
575+
// and @llvm.compiler.used. Doing so confuses LTO (merging) and they're not
576+
// going to end up as real global symbols in the binary anyways.
577+
if (name != "llvm.used" && name != "llvm.compiler.used") {
578+
var->setAlignment(llvm::MaybeAlign(alignment.getValue()));
579+
disableAddressSanitizer(IGM, var);
580+
}
575581

576582
// Mark the variable as used if doesn't have external linkage.
577583
// (Note that we'd specifically like to not put @llvm.used in itself.)

stdlib/CMakeLists.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,10 @@ option(SWIFT_RUNTIME_MACHO_NO_DYLD
7575
"Build stdlib assuming the runtime environment uses Mach-O but does not support dynamic modules."
7676
FALSE)
7777

78+
option(SWIFT_STDLIB_HAS_DARWIN_LIBMALLOC
79+
"Build stdlib assuming the Darwin build of stdlib can use extended libmalloc APIs"
80+
)
81+
7882
option(SWIFT_STDLIB_SINGLE_THREADED_RUNTIME
7983
"Build the standard libraries assuming that they will be used in an environment with only a single thread."
8084
FALSE)
@@ -165,7 +169,7 @@ if(SWIFT_BUILD_DYNAMIC_STDLIB)
165169
list(APPEND SWIFT_STDLIB_LIBRARY_BUILD_TYPES SHARED)
166170
endif()
167171
if(SWIFT_BUILD_STATIC_STDLIB)
168-
list_intersect("${SWIFT_APPLE_PLATFORMS}" "${SWIFT_SDKS}" building_darwin_sdks)
172+
list_intersect("${SWIFT_DARWIN_PLATFORMS}" "${SWIFT_SDKS}" building_darwin_sdks)
169173
if(building_darwin_sdks)
170174
message(SEND_ERROR "cannot build static standard library for Darwin SDKs")
171175
else()

stdlib/cmake/modules/AddSwiftStdlib.cmake

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ function(_add_target_variant_c_compile_link_flags)
4949

5050
set(result ${${CFLAGS_RESULT_VAR_NAME}})
5151

52-
if("${CFLAGS_SDK}" IN_LIST SWIFT_APPLE_PLATFORMS)
52+
if("${CFLAGS_SDK}" IN_LIST SWIFT_DARWIN_PLATFORMS)
5353
# Check if there's a specific OS deployment version needed for this invocation
5454
if("${CFLAGS_SDK}" STREQUAL "OSX")
5555
if(DEFINED maccatalyst_build_flavor)
@@ -102,7 +102,7 @@ function(_add_target_variant_c_compile_link_flags)
102102
endif()
103103
endif()
104104

105-
if("${CFLAGS_SDK}" IN_LIST SWIFT_APPLE_PLATFORMS)
105+
if("${CFLAGS_SDK}" IN_LIST SWIFT_DARWIN_PLATFORMS)
106106
# We collate -F with the framework path to avoid unwanted deduplication
107107
# of options by target_compile_options -- this way no undesired
108108
# side effects are introduced should a new search path be added.
@@ -320,6 +320,12 @@ function(_add_target_variant_c_compile_flags)
320320
list(APPEND result "-DSWIFT_RUNTIME_MACHO_NO_DYLD")
321321
endif()
322322

323+
if(SWIFT_STDLIB_HAS_DARWIN_LIBMALLOC)
324+
list(APPEND result "-DSWIFT_STDLIB_HAS_DARWIN_LIBMALLOC=1")
325+
else()
326+
list(APPEND result "-DSWIFT_STDLIB_HAS_DARWIN_LIBMALLOC=0")
327+
endif()
328+
323329
if(SWIFT_STDLIB_SINGLE_THREADED_RUNTIME)
324330
list(APPEND result "-DSWIFT_STDLIB_SINGLE_THREADED_RUNTIME")
325331
endif()
@@ -827,7 +833,7 @@ function(_add_swift_target_library_single target name)
827833
endif()
828834

829835
# Only build the modules for any arch listed in the *_MODULE_ARCHITECTURES.
830-
if(SWIFTLIB_SINGLE_SDK IN_LIST SWIFT_APPLE_PLATFORMS
836+
if(SWIFTLIB_SINGLE_SDK IN_LIST SWIFT_DARWIN_PLATFORMS
831837
AND SWIFTLIB_SINGLE_ARCHITECTURE IN_LIST SWIFT_SDK_${SWIFTLIB_SINGLE_SDK}_MODULE_ARCHITECTURES)
832838
# Create dummy target to hook up the module target dependency.
833839
add_custom_target("${target}"
@@ -959,7 +965,7 @@ function(_add_swift_target_library_single target name)
959965
endforeach()
960966
endif()
961967

962-
if(SWIFTLIB_SINGLE_SDK IN_LIST SWIFT_APPLE_PLATFORMS)
968+
if(SWIFTLIB_SINGLE_SDK IN_LIST SWIFT_DARWIN_PLATFORMS)
963969
set(install_name_dir "@rpath")
964970

965971
if(SWIFTLIB_SINGLE_IS_STDLIB)
@@ -1194,7 +1200,7 @@ function(_add_swift_target_library_single target name)
11941200

11951201
# Configure plist creation for OS X.
11961202
set(PLIST_INFO_PLIST "Info.plist" CACHE STRING "Plist name")
1197-
if("${SWIFTLIB_SINGLE_SDK}" IN_LIST SWIFT_APPLE_PLATFORMS AND SWIFTLIB_SINGLE_IS_STDLIB)
1203+
if("${SWIFTLIB_SINGLE_SDK}" IN_LIST SWIFT_DARWIN_PLATFORMS AND SWIFTLIB_SINGLE_IS_STDLIB)
11981204
set(PLIST_INFO_NAME ${name})
11991205
set(PLIST_INFO_UTI "com.apple.dt.runtime.${name}")
12001206
set(PLIST_INFO_VERSION "${SWIFT_VERSION}")
@@ -1251,7 +1257,7 @@ function(_add_swift_target_library_single target name)
12511257
${c_compile_flags})
12521258
target_link_options(${target} PRIVATE
12531259
${link_flags})
1254-
if(${SWIFTLIB_SINGLE_SDK} IN_LIST SWIFT_APPLE_PLATFORMS)
1260+
if(${SWIFTLIB_SINGLE_SDK} IN_LIST SWIFT_DARWIN_PLATFORMS)
12551261
target_link_options(${target} PRIVATE
12561262
"LINKER:-compatibility_version,1")
12571263
if(SWIFT_COMPILER_VERSION)
@@ -1614,7 +1620,7 @@ function(add_swift_target_library name)
16141620
if("${SWIFTLIB_TARGET_SDKS}" STREQUAL "")
16151621
set(SWIFTLIB_TARGET_SDKS ${SWIFT_SDKS})
16161622
endif()
1617-
list_replace(SWIFTLIB_TARGET_SDKS ALL_APPLE_PLATFORMS "${SWIFT_APPLE_PLATFORMS}")
1623+
list_replace(SWIFTLIB_TARGET_SDKS ALL_APPLE_PLATFORMS "${SWIFT_DARWIN_PLATFORMS}")
16181624

16191625
# All Swift code depends on the standard library, except for the standard
16201626
# library itself.
@@ -1832,7 +1838,7 @@ function(add_swift_target_library name)
18321838
list(APPEND swiftlib_link_flags_all "-Wl,-z,defs")
18331839
endif()
18341840
# Setting back linker flags which are not supported when making Android build on macOS cross-compile host.
1835-
if(SWIFTLIB_SHARED AND sdk IN_LIST SWIFT_APPLE_PLATFORMS)
1841+
if(SWIFTLIB_SHARED AND sdk IN_LIST SWIFT_DARWIN_PLATFORMS)
18361842
list(APPEND swiftlib_link_flags_all "-dynamiclib -Wl,-headerpad_max_install_names")
18371843
endif()
18381844

@@ -1952,7 +1958,7 @@ function(add_swift_target_library name)
19521958
list(APPEND swiftlib_link_flags_all "-F${ios_support_frameworks_path}")
19531959
endif()
19541960

1955-
if(sdk IN_LIST SWIFT_APPLE_PLATFORMS AND SWIFTLIB_IS_SDK_OVERLAY)
1961+
if(sdk IN_LIST SWIFT_DARWIN_PLATFORMS AND SWIFTLIB_IS_SDK_OVERLAY)
19561962
set(swiftlib_swift_compile_private_frameworks_flag "-Fsystem" "${SWIFT_SDK_${sdk}_ARCH_${arch}_PATH}/System/Library/PrivateFrameworks/")
19571963
foreach(tbd_lib ${SWIFTLIB_SWIFT_MODULE_DEPENDS_FROM_SDK})
19581964
list(APPEND swiftlib_link_flags_all "${SWIFT_SDK_${sdk}_ARCH_${arch}_PATH}/usr/lib/swift/libswift${tbd_lib}.tbd")
@@ -2066,8 +2072,7 @@ function(add_swift_target_library name)
20662072
endif()
20672073
endif()
20682074

2069-
if((sdk IN_LIST SWIFT_APPLE_PLATFORMS)
2070-
OR (sdk STREQUAL "FREESTANDING"))
2075+
if(sdk IN_LIST SWIFT_APPLE_PLATFORMS)
20712076
# In the past, we relied on unsetting globally
20722077
# CMAKE_OSX_ARCHITECTURES to ensure that CMake would
20732078
# not add the -arch flag
@@ -2174,7 +2179,7 @@ function(add_swift_target_library name)
21742179
endif()
21752180

21762181
set(optional_arg)
2177-
if(sdk IN_LIST SWIFT_APPLE_PLATFORMS)
2182+
if(sdk IN_LIST SWIFT_DARWIN_PLATFORMS)
21782183
# Allow installation of stdlib without building all variants on Darwin.
21792184
set(optional_arg "OPTIONAL")
21802185
endif()
@@ -2434,7 +2439,7 @@ function(_add_swift_target_executable_single name)
24342439
if (SWIFT_PARALLEL_LINK_JOBS)
24352440
set_property(TARGET ${name} PROPERTY JOB_POOL_LINK swift_link_job_pool)
24362441
endif()
2437-
if(${SWIFTEXE_SINGLE_SDK} IN_LIST SWIFT_APPLE_PLATFORMS)
2442+
if(${SWIFTEXE_SINGLE_SDK} IN_LIST SWIFT_DARWIN_PLATFORMS)
24382443
set_target_properties(${name} PROPERTIES
24392444
BUILD_WITH_INSTALL_RPATH YES
24402445
INSTALL_RPATH "@executable_path/../lib/swift/${SWIFT_SDK_${SWIFTEXE_SINGLE_SDK}_LIB_SUBDIR}")
@@ -2516,8 +2521,7 @@ function(add_swift_target_executable name)
25162521
EXCLUDE_FROM_ALL TRUE)
25172522
endif()
25182523

2519-
if((${sdk} IN_LIST SWIFT_APPLE_PLATFORMS)
2520-
OR (sdk STREQUAL "FREESTANDING"))
2524+
if(${sdk} IN_LIST SWIFT_APPLE_PLATFORMS)
25212525
# In the past, we relied on unsetting globally
25222526
# CMAKE_OSX_ARCHITECTURES to ensure that CMake would
25232527
# not add the -arch flag

stdlib/cmake/modules/SwiftSource.cmake

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ function(handle_swift_sources
113113
# FIXME: We shouldn't /have/ to build things in a single process.
114114
# <rdar://problem/15972329>
115115
list(APPEND swift_compile_flags "-whole-module-optimization")
116-
if(sdk IN_LIST SWIFT_APPLE_PLATFORMS OR sdk STREQUAL "MACCATALYST")
116+
if(sdk IN_LIST SWIFT_DARWIN_PLATFORMS OR sdk STREQUAL "MACCATALYST")
117117
list(APPEND swift_compile_flags "-save-optimization-record=bitstream")
118118
endif()
119119
if (SWIFTSOURCES_ENABLE_LTO)
@@ -218,7 +218,7 @@ function(_add_target_variant_swift_compile_flags
218218
list(APPEND result "-sdk" "${SWIFT_SDK_${sdk}_ARCH_${arch}_PATH}")
219219
endif()
220220

221-
if("${sdk}" IN_LIST SWIFT_APPLE_PLATFORMS)
221+
if("${sdk}" IN_LIST SWIFT_DARWIN_PLATFORMS)
222222
set(sdk_deployment_version "${SWIFT_SDK_${sdk}_DEPLOYMENT_VERSION}")
223223
get_target_triple(target target_variant "${sdk}" "${arch}"
224224
MACCATALYST_BUILD_FLAVOR "${VARIANT_MACCATALYST_BUILD_FLAVOR}"
@@ -237,7 +237,7 @@ function(_add_target_variant_swift_compile_flags
237237
list(APPEND result "-resource-dir" "${SWIFTLIB_DIR}")
238238
endif()
239239

240-
if("${sdk}" IN_LIST SWIFT_APPLE_PLATFORMS)
240+
if("${sdk}" IN_LIST SWIFT_DARWIN_PLATFORMS)
241241
# We collate -F with the framework path to avoid unwanted deduplication
242242
# of options by target_compile_options -- this way no undesired
243243
# side effects are introduced should a new search path be added.
@@ -543,7 +543,7 @@ function(_compile_swift_files
543543
endif()
544544

545545
set(optional_arg)
546-
if(SWIFTFILE_SDK IN_LIST SWIFT_APPLE_PLATFORMS OR
546+
if(SWIFTFILE_SDK IN_LIST SWIFT_DARWIN_PLATFORMS OR
547547
SWIFTFILE_SDK STREQUAL "MACCATALYST")
548548
# Allow installation of stdlib without building all variants on Darwin.
549549
set(optional_arg "OPTIONAL")

stdlib/public/core/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ set(swift_core_link_flags "${SWIFT_RUNTIME_SWIFT_LINK_FLAGS}")
233233
set(swift_core_framework_depends)
234234
set(swift_core_private_link_libraries)
235235
set(swift_stdlib_compile_flags "${SWIFT_RUNTIME_SWIFT_COMPILE_FLAGS}")
236-
if(SWIFT_PRIMARY_VARIANT_SDK IN_LIST SWIFT_APPLE_PLATFORMS)
236+
if(SWIFT_PRIMARY_VARIANT_SDK IN_LIST SWIFT_DARWIN_PLATFORMS)
237237
list(APPEND swift_core_link_flags "-all_load")
238238
list(APPEND swift_core_private_link_libraries icucore)
239239
else()

stdlib/public/runtime/Bincompat.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
#include <stdint.h>
1919

2020
// If this is an Apple OS, use the Apple binary compatibility rules
21-
#if __has_include(<mach-o/dyld_priv.h>)
21+
#if __has_include(<mach-o/dyld_priv.h>) && defined(SWIFT_RUNTIME_OS_VERSIONING)
2222
#include <mach-o/dyld_priv.h>
2323
#ifndef BINARY_COMPATIBILITY_APPLE
2424
#define BINARY_COMPATIBILITY_APPLE 1

0 commit comments

Comments
 (0)