Skip to content

Fix the build for newer Xcodes #75902

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions benchmark/cmake/modules/AddSwiftBenchmarkSuite.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -716,9 +716,6 @@ function(swift_benchmark_compile)

if(NOT SWIFT_BENCHMARK_BUILT_STANDALONE)
set(stdlib_dependencies "swift-frontend" "swiftCore-${SWIFT_SDK_${SWIFT_HOST_VARIANT_SDK}_LIB_SUBDIR}")
if(SWIFT_HOST_VARIANT_SDK IN_LIST SWIFT_DARWIN_PLATFORMS)
list(APPEND stdlib_dependencies "swiftDarwin-${SWIFT_SDK_${SWIFT_HOST_VARIANT_SDK}_LIB_SUBDIR}")
endif()
foreach(stdlib_dependency ${UNIVERSAL_LIBRARY_NAMES_${SWIFT_BENCHMARK_COMPILE_PLATFORM}})
string(FIND "${stdlib_dependency}" "Unittest" find_output)
if("${find_output}" STREQUAL "-1")
Expand Down
2 changes: 1 addition & 1 deletion cmake/modules/DarwinSDKs.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ if(swift_build_freestanding AND (SWIFT_FREESTANDING_FLAVOR STREQUAL "apple"))
configure_target_variant(FREESTANDING-R "FREESTANDING Release" FREESTANDING R "Release")
configure_target_variant(FREESTANDING-S "FREESTANDING MinSizeRelease" FREESTANDING S "MinSizeRelease")

set(SWIFT_FREESTANDING_TEST_DEPENDENCIES "Darwin")
set(SWIFT_FREESTANDING_TEST_DEPENDENCIES "")
endif()

# Compatible cross-compile SDKS for Darwin OSes: IOS, IOS_SIMULATOR, TVOS,
Expand Down
13 changes: 10 additions & 3 deletions lib/Basic/Platform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,20 @@ bool swift::tripleInfersSimulatorEnvironment(const llvm::Triple &triple) {
bool swift::triplesAreValidForZippering(const llvm::Triple &target,
const llvm::Triple &targetVariant) {
// The arch and vendor must match.
if (target.getArchName() != targetVariant.getArchName() ||
target.getArch() != targetVariant.getArch() ||
target.getSubArch() != targetVariant.getSubArch() ||
if (target.getArch() != targetVariant.getArch() ||
target.getVendor() != targetVariant.getVendor()) {
return false;
}

// Subarch must match, except that for arm64 we allow the case where
// one of them is arm64e and the other isn't.
if (target.getSubArch() != targetVariant.getSubArch() &&
(target.getArch() != llvm::Triple::aarch64 ||
(target.getSubArch() != llvm::Triple::AArch64SubArch_arm64e &&
targetVariant.getSubArch() != llvm::Triple::AArch64SubArch_arm64e))) {
return false;
}

// Allow a macOS target and an iOS-macabi target variant
// This is typically the case when zippering a library originally
// developed for macOS.
Expand Down
17 changes: 13 additions & 4 deletions lib/Parse/ParseDecl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2288,6 +2288,7 @@ bool Parser::parseBackDeployedAttribute(DeclAttributes &Attributes,
SourceLoc RightLoc;
ParserStatus Status;
bool SuppressLaterDiags = false;
bool VersionListWasEmpty = true;
llvm::SmallVector<PlatformAndVersion, 4> PlatformAndVersions;

{
Expand All @@ -2312,6 +2313,7 @@ bool Parser::parseBackDeployedAttribute(DeclAttributes &Attributes,
return parsePlatformVersionInList(
AtAttrName, PlatformAndVersions);
});
VersionListWasEmpty = false;
} while (Result == ParseListItemResult::Continue);
}
}
Expand All @@ -2324,12 +2326,14 @@ bool Parser::parseBackDeployedAttribute(DeclAttributes &Attributes,
return false;
}

if (PlatformAndVersions.empty()) {
// We can't just check PlatformAndVersions.empty(), because it's possible
// that the list contained entries we didn't understand, in which case this
// diagnostic would be incorrect.
if (VersionListWasEmpty) {
diagnose(Loc, diag::attr_availability_need_platform_version, AtAttrName);
return false;
}

assert(!PlatformAndVersions.empty());
auto AttrRange = SourceRange(Loc, RightLoc);
for (auto &Item : PlatformAndVersions) {
Attributes.add(new (Context) BackDeployedAttr(AtLoc, AttrRange, Item.first,
Expand Down Expand Up @@ -3445,6 +3449,7 @@ ParserStatus Parser::parseNewDeclAttribute(DeclAttributes &Attributes,

StringRef AttrName = "@_originallyDefinedIn";
bool SuppressLaterDiags = false;
bool VersionListWasEmpty = true;
if (parseList(tok::r_paren, LeftLoc, RightLoc, false,
diag::originally_defined_in_missing_rparen,
[&]() -> ParserStatus {
Expand Down Expand Up @@ -3488,6 +3493,7 @@ ParserStatus Parser::parseNewDeclAttribute(DeclAttributes &Attributes,
parsePlatformVersionInList(AttrName, PlatformAndVersions);
if (ListItemStatus.isErrorOrHasCompletion())
SuppressLaterDiags = true;
VersionListWasEmpty = false;
return ListItemStatus;
}
}
Expand All @@ -3499,13 +3505,16 @@ ParserStatus Parser::parseNewDeclAttribute(DeclAttributes &Attributes,
diagnose(AtLoc, diag::originally_defined_in_need_nonempty_module_name);
return makeParserSuccess();
}
if (PlatformAndVersions.empty()) {

// We can't just check PlatformAndVersions.empty(), because it's possible
// that the list contained entries we didn't understand, in which case this
// diagnostic would be incorrect.
if (VersionListWasEmpty) {
diagnose(AtLoc, diag::attr_availability_need_platform_version, AttrName);
return makeParserSuccess();
}

assert(!OriginalModuleName.empty());
assert(!PlatformAndVersions.empty());
assert(NK == NextSegmentKind::PlatformVersion);
AttrRange = SourceRange(Loc, RightLoc);
for (auto &Item: PlatformAndVersions) {
Expand Down
3 changes: 0 additions & 3 deletions stdlib/private/OSLog/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
set(swift_oslog_darwin_dependencies "")
if(SWIFT_BUILD_SDK_OVERLAY)
list(APPEND swift_oslog_darwin_dependencies "Darwin")
endif()
if (SWIFT_ENABLE_EXPERIMENTAL_CONCURRENCY)
list(APPEND swift_oslog_darwin_dependencies "_Concurrency")
endif()
Expand Down
12 changes: 0 additions & 12 deletions stdlib/private/StdlibUnittest/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
if(SWIFT_BUILD_SDK_OVERLAY)
set(swift_stdlib_unittest_darwin_dependencies Darwin)
else()
set(swift_stdlib_unittest_darwin_dependencies)
endif()

set(swift_stdlib_unittest_compile_flags
"-Xfrontend" "-disable-objc-attr-requires-foundation-module")
if (SWIFT_RUNTIME_ENABLE_LEAK_CHECKER)
Expand Down Expand Up @@ -55,12 +49,6 @@ add_swift_target_library(swiftStdlibUnittest ${SWIFT_STDLIB_LIBRARY_BUILD_TYPES}
TypeIndexed.swift

SWIFT_MODULE_DEPENDS SwiftPrivate SwiftPrivateThreadExtras SwiftPrivateLibcExtras ${swift_stdlib_unittest_modules}
SWIFT_MODULE_DEPENDS_IOS ${swift_stdlib_unittest_darwin_dependencies}
SWIFT_MODULE_DEPENDS_OSX ${swift_stdlib_unittest_darwin_dependencies}
SWIFT_MODULE_DEPENDS_TVOS ${swift_stdlib_unittest_darwin_dependencies}
SWIFT_MODULE_DEPENDS_WATCHOS ${swift_stdlib_unittest_darwin_dependencies}
SWIFT_MODULE_DEPENDS_XROS ${swift_stdlib_unittest_darwin_dependencies}
SWIFT_MODULE_DEPENDS_MACCATALYST ${swift_stdlib_unittest_darwin_dependencies}
SWIFT_MODULE_DEPENDS_FREESTANDING "${SWIFT_FREESTANDING_TEST_DEPENDENCIES}"
SWIFT_MODULE_DEPENDS_ANDROID Android
SWIFT_MODULE_DEPENDS_LINUX Glibc
Expand Down
11 changes: 0 additions & 11 deletions stdlib/private/SwiftPrivate/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,6 @@ set(swift_swiftprivate_compile_flags
"-parse-stdlib"
"-Xfrontend" "-disable-access-control")

if(SWIFT_BUILD_SDK_OVERLAY)
set(swift_swiftprivate_darwin_dependencies Darwin)
else()
set(swift_swiftprivate_darwin_dependencies)
endif()

add_swift_target_library(swiftSwiftPrivate ${SWIFT_STDLIB_LIBRARY_BUILD_TYPES} IS_STDLIB
# This file should be listed the first. Module name is inferred from the
# filename.
Expand All @@ -21,11 +15,6 @@ add_swift_target_library(swiftSwiftPrivate ${SWIFT_STDLIB_LIBRARY_BUILD_TYPES} I
GYB_SOURCES
AtomicInt.swift.gyb

SWIFT_MODULE_DEPENDS_OSX ${swift_swiftprivate_darwin_dependencies}
SWIFT_MODULE_DEPENDS_IOS ${swift_swiftprivate_darwin_dependencies}
SWIFT_MODULE_DEPENDS_TVOS ${swift_swiftprivate_darwin_dependencies}
SWIFT_MODULE_DEPENDS_WATCHOS ${swift_swiftprivate_darwin_dependencies}
SWIFT_MODULE_DEPENDS_MACCATALYST ${swift_swiftprivate_darwin_dependencies}
SWIFT_MODULE_DEPENDS_FREESTANDING "${SWIFT_FREESTANDING_TEST_DEPENDENCIES}"
SWIFT_MODULE_DEPENDS_ANDROID Android
SWIFT_MODULE_DEPENDS_LINUX Glibc
Expand Down
12 changes: 0 additions & 12 deletions stdlib/private/SwiftPrivateLibcExtras/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,6 @@ else()
set(swift_private_libc_extras_incorporate_object_libraries "swiftCommandLineSupport")
endif()

if(SWIFT_BUILD_SDK_OVERLAY)
set(swift_private_libc_extras_darwin_dependencies Darwin)
else()
set(swift_private_libc_extras_darwin_dependencies)
endif()

add_swift_target_library(swiftSwiftPrivateLibcExtras ${SWIFT_STDLIB_LIBRARY_BUILD_TYPES} IS_STDLIB
# This file should be listed the first. Module name is inferred from the
# filename.
Expand All @@ -31,12 +25,6 @@ add_swift_target_library(swiftSwiftPrivateLibcExtras ${SWIFT_STDLIB_LIBRARY_BUIL

SWIFT_MODULE_DEPENDS SwiftPrivate
SWIFT_COMPILE_FLAGS ${SWIFT_STANDARD_LIBRARY_SWIFT_FLAGS} ${swift_private_libc_extras_flags}
SWIFT_MODULE_DEPENDS_OSX ${swift_private_libc_extras_darwin_dependencies}
SWIFT_MODULE_DEPENDS_IOS ${swift_private_libc_extras_darwin_dependencies}
SWIFT_MODULE_DEPENDS_TVOS ${swift_private_libc_extras_darwin_dependencies}
SWIFT_MODULE_DEPENDS_WATCHOS ${swift_private_libc_extras_darwin_dependencies}
SWIFT_MODULE_DEPENDS_XROS ${swift_private_libc_extras_darwin_dependencies}
SWIFT_MODULE_DEPENDS_MACCATALYST ${swift_private_libc_extras_darwin_dependencies}
SWIFT_MODULE_DEPENDS_FREESTANDING "${SWIFT_FREESTANDING_TEST_DEPENDENCIES}"
SWIFT_MODULE_DEPENDS_ANDROID Android
SWIFT_MODULE_DEPENDS_LINUX Glibc
Expand Down
12 changes: 0 additions & 12 deletions stdlib/private/SwiftPrivateThreadExtras/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
if(SWIFT_BUILD_SDK_OVERLAY)
set(swift_private_thread_extras_darwin_dependencies Darwin)
else()
set(swift_private_thread_extras_darwin_dependencies)
endif()

add_swift_target_library(swiftSwiftPrivateThreadExtras ${SWIFT_STDLIB_LIBRARY_BUILD_TYPES} IS_STDLIB
# This file should be listed the first. Module name is inferred from the
# filename.
Expand All @@ -12,12 +6,6 @@ add_swift_target_library(swiftSwiftPrivateThreadExtras ${SWIFT_STDLIB_LIBRARY_BU

"${SWIFT_SOURCE_DIR}/stdlib/linker-support/magic-symbols-for-install-name.c"

SWIFT_MODULE_DEPENDS_IOS ${swift_private_thread_extras_darwin_dependencies}
SWIFT_MODULE_DEPENDS_OSX ${swift_private_thread_extras_darwin_dependencies}
SWIFT_MODULE_DEPENDS_TVOS ${swift_private_thread_extras_darwin_dependencies}
SWIFT_MODULE_DEPENDS_WATCHOS ${swift_private_thread_extras_darwin_dependencies}
SWIFT_MODULE_DEPENDS_XROS ${swift_private_thread_extras_darwin_dependencies}
SWIFT_MODULE_DEPENDS_MACCATALYST ${swift_private_thread_extras_darwin_dependencies}
SWIFT_MODULE_DEPENDS_FREESTANDING "${SWIFT_FREESTANDING_TEST_DEPENDENCIES}"
SWIFT_MODULE_DEPENDS_ANDROID Android
SWIFT_MODULE_DEPENDS_LINUX Glibc
Expand Down
11 changes: 0 additions & 11 deletions stdlib/private/SwiftReflectionTest/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,19 +1,8 @@
if(SWIFT_BUILD_SDK_OVERLAY)
set(swift_reflection_test_darwin_dependencies Darwin)
else()
set(swift_reflection_test_darwin_dependencies)
endif()

if (SWIFT_INCLUDE_TESTS AND SWIFT_BUILD_DYNAMIC_STDLIB)
add_swift_target_library(swiftSwiftReflectionTest ${SWIFT_STDLIB_LIBRARY_BUILD_TYPES} IS_STDLIB
SwiftReflectionTest.swift
SWIFT_COMPILE_FLAGS ${SWIFT_STANDARD_LIBRARY_SWIFT_FLAGS}
SWIFT_COMPILE_FLAGS_LINUX -Xcc -D_GNU_SOURCE
SWIFT_MODULE_DEPENDS_OSX ${swift_reflection_test_darwin_dependencies}
SWIFT_MODULE_DEPENDS_IOS ${swift_reflection_test_darwin_dependencies}
SWIFT_MODULE_DEPENDS_TVOS ${swift_reflection_test_darwin_dependencies}
SWIFT_MODULE_DEPENDS_WATCHOS ${swift_reflection_test_darwin_dependencies}
SWIFT_MODULE_DEPENDS_XROS ${swift_reflection_test_darwin_dependencies}
SWIFT_MODULE_DEPENDS_ANDROID Android
SWIFT_MODULE_DEPENDS_LINUX Glibc
SWIFT_MODULE_DEPENDS_LINUX_STATIC Musl
Expand Down
15 changes: 0 additions & 15 deletions stdlib/public/Cxx/std/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,6 @@ add_dependencies(sdk-overlay CxxStdlib-apinotes)
add_dependencies(compiler CxxStdlib-apinotes)


# Swift compiler currently assumes that the Darwin overlay is a dependency of
# CxxStdlib, and fails to build CxxStdlib if Darwin.swiftmodule in build dir
# is built with a different (older) version of the compiler. To workaround this,
# declare the Darwin overlay as a dependency of CxxStdlib.
set(swift_cxxstdlib_darwin_dependencies)
if(SWIFT_BUILD_STDLIB AND SWIFT_BUILD_SDK_OVERLAY)
set(swift_cxxstdlib_darwin_dependencies Darwin)
endif()

#
# C++ Standard Library Overlay.
#
Expand All @@ -39,12 +30,6 @@ add_swift_target_library(swiftCxxStdlib STATIC NO_LINK_NAME IS_STDLIB IS_SWIFT_O
String.swift

SWIFT_MODULE_DEPENDS Cxx
SWIFT_MODULE_DEPENDS_IOS ${swift_cxxstdlib_darwin_dependencies}
SWIFT_MODULE_DEPENDS_OSX ${swift_cxxstdlib_darwin_dependencies}
SWIFT_MODULE_DEPENDS_TVOS ${swift_cxxstdlib_darwin_dependencies}
SWIFT_MODULE_DEPENDS_WATCHOS ${swift_cxxstdlib_darwin_dependencies}
SWIFT_MODULE_DEPENDS_XROS ${swift_cxxstdlib_darwin_dependencies}
SWIFT_MODULE_DEPENDS_MACCATALYST ${swift_cxxstdlib_darwin_dependencies}
SWIFT_MODULE_DEPENDS_ANDROID Android

SWIFT_COMPILE_FLAGS ${SWIFT_RUNTIME_SWIFT_COMPILE_FLAGS} ${SWIFT_STANDARD_LIBRARY_SWIFT_FLAGS}
Expand Down
11 changes: 0 additions & 11 deletions stdlib/public/Differentiation/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,6 @@ else()
set(swiftDifferentiationSIMDFiles)
endif()

if(SWIFT_BUILD_SDK_OVERLAY)
set(swiftDifferentiationDarwinDependencies Darwin)
else()
set(swiftDifferentiationDarwinDependencies)
endif()

add_swift_target_library(swift_Differentiation ${SWIFT_STDLIB_LIBRARY_BUILD_TYPES} IS_STDLIB
Differentiable.swift
DifferentialOperators.swift
Expand All @@ -37,11 +31,6 @@ add_swift_target_library(swift_Differentiation ${SWIFT_STDLIB_LIBRARY_BUILD_TYPE
TgmathDerivatives.swift.gyb
${swiftDifferentiationSIMDFiles}

SWIFT_MODULE_DEPENDS_OSX ${swiftDifferentiationDarwinDependencies}
SWIFT_MODULE_DEPENDS_IOS ${swiftDifferentiationDarwinDependencies}
SWIFT_MODULE_DEPENDS_TVOS ${swiftDifferentiationDarwinDependencies}
SWIFT_MODULE_DEPENDS_WATCHOS ${swiftDifferentiationDarwinDependencies}
SWIFT_MODULE_DEPENDS_XROS ${swiftDifferentiationDarwinDependencies}
SWIFT_MODULE_DEPENDS_ANDROID Android
SWIFT_MODULE_DEPENDS_LINUX Glibc
SWIFT_MODULE_DEPENDS_LINUX_STATIC Musl
Expand Down
10 changes: 0 additions & 10 deletions stdlib/public/Distributed/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,6 @@
#
#===----------------------------------------------------------------------===#

if(SWIFT_BUILD_SDK_OVERLAY)
set(swift_distributed_darwin_dependencies Darwin)
else()
set(swift_distributed_darwin_dependencies)
endif()

set(swift_distributed_link_libraries
swiftCore)

Expand All @@ -30,10 +24,6 @@ add_swift_target_library(swiftDistributed ${SWIFT_STDLIB_LIBRARY_BUILD_TYPES} IS
DistributedMetadata.swift
LocalTestingDistributedActorSystem.swift

SWIFT_MODULE_DEPENDS_IOS ${swift_distributed_darwin_dependencies}
SWIFT_MODULE_DEPENDS_OSX ${swift_distributed_darwin_dependencies}
SWIFT_MODULE_DEPENDS_TVOS ${swift_distributed_darwin_dependencies}
SWIFT_MODULE_DEPENDS_WATCHOS ${swift_distributed_darwin_dependencies}
SWIFT_MODULE_DEPENDS_ANDROID Android
SWIFT_MODULE_DEPENDS_LINUX Glibc
SWIFT_MODULE_DEPENDS_FREEBSD Glibc
Expand Down
Loading