Skip to content

Commit f9c920f

Browse files
Merge pull request #4516 from swiftwasm/main
[pull] swiftwasm from main
2 parents 5b0dc99 + 223d73c commit f9c920f

File tree

168 files changed

+2185
-716
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

168 files changed

+2185
-716
lines changed

CHANGELOG.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -813,7 +813,7 @@ Swift 5.5
813813
}
814814

815815

816-
func hadWithdrawlOn(_ day: Date, from acct: BankAccount) async -> Bool {
816+
func hadWithdrawalOn(_ day: Date, from acct: BankAccount) async -> Bool {
817817
return await !acct[day].allSatisfy { $0.amount >= Amount.zero }
818818
// ^~~~~~~~~ this access is async
819819
}
@@ -2788,7 +2788,7 @@ Swift 3.1
27882788
result in a compilation error.
27892789

27902790
Examples of functions that "return twice" include `vfork` and `setjmp`.
2791-
These functions change the control flow of a program in ways that that Swift
2791+
These functions change the control flow of a program in ways that Swift
27922792
has never supported. For example, definitive initialization of variables,
27932793
a core Swift language feature, could not be guaranteed when these functions
27942794
were used.
@@ -9098,7 +9098,7 @@ Swift 1.0
90989098
[SE-0107]: <https://github.com/apple/swift-evolution/blob/main/proposals/0107-unsaferawpointer.md>
90999099
[SE-0108]: <https://github.com/apple/swift-evolution/blob/main/proposals/0108-remove-assoctype-inference.md>
91009100
[SE-0109]: <https://github.com/apple/swift-evolution/blob/main/proposals/0109-remove-boolean.md>
9101-
[SE-0110]: <https://github.com/apple/swift-evolution/blob/main/proposals/0110-distingish-single-tuple-arg.md>
9101+
[SE-0110]: <https://github.com/apple/swift-evolution/blob/main/proposals/0110-distinguish-single-tuple-arg.md>
91029102
[SE-0111]: <https://github.com/apple/swift-evolution/blob/main/proposals/0111-remove-arg-label-type-significance.md>
91039103
[SE-0112]: <https://github.com/apple/swift-evolution/blob/main/proposals/0112-nserror-bridging.md>
91049104
[SE-0113]: <https://github.com/apple/swift-evolution/blob/main/proposals/0113-rounding-functions-on-floatingpoint.md>

README.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,6 @@ to track the status of our builds, please refer to our [GitHub Actions page](htt
3737
| **OS** | **Architecture** | **Build** |
3838
|---|:---:|:---:|
3939
|**[Ubuntu 16.04 ](https://github.com/apple/swift-community-hosted-continuous-integration/blob/main/nodes/ppc64le_ubuntu_16_04.json)** | PPC64LE |[![Build Status](https://ci-external.swift.org/job/oss-swift-5.1-RA-linux-ubuntu-16.04-ppc64le/lastCompletedBuild/badge/icon)](https://ci-external.swift.org/job/oss-swift-5.1-RA-linux-ubuntu-16.04-ppc64le)|
40-
|**[Ubuntu 18.04](https://github.com/apple/swift-community-hosted-continuous-integration/blob/main/nodes/aarch64_ubuntu_18.04_docker.json)** | AArch64 |[![Build Status](https://ci-external.swift.org/job/oss-swift-RA-ubuntu-18.04-aarch64/lastCompletedBuild/badge/icon)](https://ci-external.swift.org/job/oss-swift-RA-ubuntu-18.04-aarch64)|
41-
|**[Ubuntu 20.04](https://github.com/apple/swift-community-hosted-continuous-integration/blob/main/nodes/aarch64_ubuntu_20.04_docker.json)** | AArch64 |[![Build Status](https://ci-external.swift.org/job/oss-swift-RA-ubuntu-20.04-aarch64/lastCompletedBuild/badge/icon)](https://ci-external.swift.org/job/oss-swift-RA-ubuntu-20.04-aarch64)|
4240
|**[Ubuntu 20.04](https://github.com/apple/swift-community-hosted-continuous-integration/blob/main/nodes/wasm32_ubuntu_20.04.json)** | wasm32 |[![Build Status](https://ci-external.swift.org/job/oss-swift-RA-linux-ubuntu-20.04-webassembly/lastCompletedBuild/badge/icon)](https://ci-external.swift.org/job/oss-swift-RA-linux-ubuntu-20.04-webassembly)|
4341
|**[Android](https://github.com/apple/swift-community-hosted-continuous-integration/blob/main/nodes/x86_64_ubuntu_16_04_LTS_android.json)** | ARMv7 |[![Build Status](https://ci-external.swift.org/job/oss-swift-RA-linux-ubuntu-16.04-android/lastCompletedBuild/badge/icon)](https://ci-external.swift.org/job/oss-swift-RA-linux-ubuntu-16.04-android)|
4442
|**[Android](https://github.com/apple/swift-community-hosted-continuous-integration/blob/main/nodes/x86_64_ubuntu_16_04_LTS_android.json)** | AArch64 |[![Build Status](https://ci-external.swift.org/job/oss-swift-RA-linux-ubuntu-16.04-android-arm64/lastCompletedBuild/badge/icon)](https://ci-external.swift.org/job/oss-swift-RA-linux-ubuntu-16.04-android-arm64)|

SwiftCompilerSources/CMakeLists.txt

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -89,14 +89,27 @@ function(add_swift_compiler_modules_library name)
8989

9090
if(SWIFT_HOST_VARIANT_SDK IN_LIST SWIFT_DARWIN_PLATFORMS)
9191
set(deployment_version "${SWIFT_SDK_${SWIFT_HOST_VARIANT_SDK}_DEPLOYMENT_VERSION}")
92-
set(sdk_option "-sdk" "${SWIFT_SDK_${SWIFT_HOST_VARIANT_SDK}_ARCH_${SWIFT_HOST_VARIANT_ARCH}_PATH}")
92+
set(sdk_path "${SWIFT_SDK_${SWIFT_HOST_VARIANT_SDK}_ARCH_${SWIFT_HOST_VARIANT_ARCH}_PATH}")
93+
set(sdk_option "-sdk" "${sdk_path}")
9394
if(${BOOTSTRAPPING_MODE} STREQUAL "CROSSCOMPILE-WITH-HOSTLIBS")
9495
# Let the cross-compiled compile don't pick up the compiled stdlib by providing
9596
# an (almost) empty resource dir.
9697
# The compiler will instead pick up the stdlib from the SDK.
9798
get_filename_component(swift_exec_bin_dir ${ALS_SWIFT_EXEC} DIRECTORY)
9899
set(sdk_option ${sdk_option} "-resource-dir" "${swift_exec_bin_dir}/../bootstrapping0/lib/swift")
99100
endif()
101+
if(NOT EXISTS "${sdk_path}/usr/include/c++")
102+
# Darwin SDKs in Xcode 12 or older do not include libc++, which prevents clang from finding libc++ when invoked
103+
# from ClangImporter. This results in build errors. To workaround this, let's explicitly pass the path to libc++
104+
# to clang.
105+
message(WARNING "Building with an outdated Darwin SDK: libc++ missing from the ${SWIFT_HOST_VARIANT_SDK} SDK. Will use libc++ from the toolchain.")
106+
get_filename_component(absolute_libcxx_path "${CMAKE_C_COMPILER}/../../include/c++/v1" REALPATH)
107+
if (EXISTS "${absolute_libcxx_path}")
108+
set(sdk_option ${sdk_option} "-Xcc" "-isystem" "-Xcc" "${absolute_libcxx_path}")
109+
else()
110+
message(ERROR "libc++ not found in the toolchain.")
111+
endif()
112+
endif()
100113
elseif(${BOOTSTRAPPING_MODE} STREQUAL "CROSSCOMPILE")
101114
set(sdk_option "-sdk" "${SWIFT_SDK_${SWIFT_HOST_VARIANT_SDK}_ARCH_${SWIFT_HOST_VARIANT_ARCH}_PATH}")
102115
get_filename_component(swift_exec_bin_dir ${ALS_SWIFT_EXEC} DIRECTORY)
@@ -212,6 +225,10 @@ else()
212225
list(APPEND b0_deps swiftDarwin-bootstrapping0)
213226
list(APPEND b1_deps swiftDarwin-bootstrapping1)
214227
endif()
228+
if(${SWIFT_HOST_VARIANT_SDK} IN_LIST SWIFT_LIBSTDCXX_PLATFORMS)
229+
list(APPEND b0_deps copy-libstdcxx-modulemap-bootstrapping0 copy-libstdcxx-header-bootstrapping0)
230+
list(APPEND b1_deps copy-libstdcxx-modulemap-bootstrapping1 copy-libstdcxx-header-bootstrapping1)
231+
endif()
215232
endif()
216233
if(SWIFT_HOST_VARIANT_SDK IN_LIST SWIFT_DARWIN_PLATFORMS)
217234
set(platform ${SWIFT_SDK_${SWIFT_HOST_VARIANT_SDK}_LIB_SUBDIR})
@@ -252,22 +269,23 @@ else()
252269
endif()
253270

254271
# Configure 'SwiftCompilerModules' SwiftPM package. The 'Package.swift' will
255-
# be created at '${build_dir}/SwiftCompilerSources/Package.swift' and can be
256-
# built with 'swift-build'.
272+
# be created at '${build_dir}/SwiftCompilerModulesPackage/Package.swift' and can
273+
# be built with 'swift-build'.
257274
# Note that this SwiftPM package itself is just for development purposes, and
258275
# is not actually used for the compiler building.
259-
set(swiftcompiler_source_dir_name "_Sources")
276+
set(swiftcompiler_modules_package_directory
277+
"${SWIFT_BINARY_DIR}/SwiftCompilerModulesPackage")
260278
configure_file(Package.swift.in
261-
"${CMAKE_CURRENT_BINARY_DIR}/Package.swift" @ONLY)
279+
"${swiftcompiler_modules_package_directory}/Package.swift" @ONLY)
262280
# SwiftPM requires all sources are inside the directory of 'Package.swift'.
263281
# Create symlinks to the actual source directories.
264282
execute_process(COMMAND
265283
"${CMAKE_COMMAND}" -E create_symlink
266284
"${CMAKE_CURRENT_SOURCE_DIR}/Sources"
267-
"${CMAKE_CURRENT_BINARY_DIR}/${swiftcompiler_source_dir_name}")
285+
"${swiftcompiler_modules_package_directory}/Sources")
268286
if(SWIFT_BUILD_REGEX_PARSER_IN_COMPILER)
269287
execute_process(COMMAND
270288
"${CMAKE_COMMAND}" -E create_symlink
271289
"${EXPERIMENTAL_STRING_PROCESSING_SOURCE_DIR}/Sources/_RegexParser"
272-
"${CMAKE_CURRENT_BINARY_DIR}/_RegexParser_Sources")
290+
"${swiftcompiler_modules_package_directory}/_RegexParser_Sources")
273291
endif()

SwiftCompilerSources/Package.swift.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ private extension Target {
3939
.target(
4040
name: name,
4141
dependencies: dependencies,
42-
path: path ?? "@swiftcompiler_source_dir_name@/\(name)",
42+
path: path ?? "Sources/\(name)",
4343
exclude: ["CMakeLists.txt"],
4444
sources: sources,
4545
swiftSettings: defaultSwiftSettings + swiftSettings)

SwiftCompilerSources/Sources/Basic/SourceLoc.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//===--- SourceLoc.swift - SourceLoc bridiging utilities ------------------===//
1+
//===--- SourceLoc.swift - SourceLoc bridging utilities ------------------===//
22
//
33
// This source file is part of the Swift.org open source project
44
//

SwiftCompilerSources/Sources/SIL/BasicBlock.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ final public class BasicBlock : ListNode, CustomStringConvertible, HasName {
2525
public var function: Function { SILBasicBlock_getFunction(bridged).function }
2626

2727
public var description: String {
28-
SILBasicBlock_debugDescription(bridged).takeString()
28+
var s = SILBasicBlock_debugDescription(bridged)
29+
return String(cString: s.c_str())
2930
}
3031

3132
public var arguments: ArgumentArray { ArgumentArray(block: self) }

SwiftCompilerSources/Sources/SIL/Function.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ final public class Function : CustomStringConvertible, HasName {
2121
}
2222

2323
final public var description: String {
24-
return SILFunction_debugDescription(bridged).takeString()
24+
var s = SILFunction_debugDescription(bridged)
25+
return String(cString: s.c_str())
2526
}
2627

2728
public var entryBlock: BasicBlock {

SwiftCompilerSources/Sources/SIL/GlobalVariable.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ final public class GlobalVariable : CustomStringConvertible, HasName {
1919
}
2020

2121
public var description: String {
22-
return SILGlobalVariable_debugDescription(bridged).takeString()
22+
var s = SILGlobalVariable_debugDescription(bridged)
23+
return String(cString: s.c_str())
2324
}
2425

2526
// TODO: initializer instructions

SwiftCompilerSources/Sources/SIL/Instruction.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ public class Instruction : ListNode, CustomStringConvertible, Hashable {
3838
final public var function: Function { block.function }
3939

4040
final public var description: String {
41-
SILNode_debugDescription(bridgedNode).takeString()
41+
var s = SILNode_debugDescription(bridgedNode)
42+
return String(cString: s.c_str())
4243
}
4344

4445
final public var operands: OperandArray {
@@ -135,7 +136,8 @@ public class SingleValueInstruction : Instruction, Value {
135136

136137
public final class MultipleValueInstructionResult : Value {
137138
final public var description: String {
138-
SILNode_debugDescription(bridgedNode).takeString()
139+
var s = SILNode_debugDescription(bridgedNode)
140+
return String(cString: s.c_str())
139141
}
140142

141143
public var instruction: Instruction {

SwiftCompilerSources/Sources/SIL/Value.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ public protocol Value : AnyObject, CustomStringConvertible {
2121

2222
extension Value {
2323
public var description: String {
24-
SILNode_debugDescription(bridgedNode).takeString()
24+
var s = SILNode_debugDescription(bridgedNode)
25+
return String(cString: s.c_str())
2526
}
2627

2728
public var uses: UseList {

0 commit comments

Comments
 (0)