Skip to content

Commit de21a66

Browse files
committed
Merge branch 'master' into cxx-link-stdlib
2 parents 78c3222 + bfde3b0 commit de21a66

File tree

1,739 files changed

+37072
-22771
lines changed

Some content is hidden

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

1,739 files changed

+37072
-22771
lines changed

CHANGELOG.md

Lines changed: 71 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,75 @@ CHANGELOG
2525
</details>
2626

2727
Swift 5.3
28-
----------
28+
---------
29+
30+
* [SR-7083][]:
31+
32+
Property observers such as `willSet` and `didSet` are now supported on `lazy` properties:
33+
34+
```swift
35+
class C {
36+
lazy var property: Int = 0 {
37+
willSet { print("willSet called!") } // Okay
38+
didSet { print("didSet called!") } // Okay
39+
}
40+
}
41+
```
42+
43+
Note that the initial value of the property will be forced and made available as the `oldValue` for the `didSet` observer, if the property hasn't been accessed yet.
44+
45+
```swift
46+
class C {
47+
lazy var property: Int = 0 {
48+
didSet { print("Old value: ", oldValue) }
49+
}
50+
}
51+
52+
let c = C()
53+
c.property = 1 // Prints 'Old value: 0'
54+
```
55+
56+
This could have side-effects, for example if the lazy property's initializer is doing other work.
57+
58+
* [SR-11700][]:
59+
60+
Exclusivity violations within code that computes the `default`
61+
argument during Dictionary access are now diagnosed.
62+
63+
```swift
64+
struct Container {
65+
static let defaultKey = 0
66+
67+
var dictionary = [defaultKey:0]
68+
69+
mutating func incrementValue(at key: Int) {
70+
dictionary[key, default: dictionary[Container.defaultKey]!] += 1
71+
}
72+
}
73+
// error: overlapping accesses to 'self.dictionary', but modification requires exclusive access; consider copying to a local variable
74+
// dictionary[key, default: dictionary[Container.defaultKey]!] += 1
75+
// ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
76+
// note: conflicting access is here
77+
// dictionary[key, default: dictionary[Container.defaultKey]!] += 1
78+
// ~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
79+
```
80+
81+
The exclusivity violation can be avoided by precomputing the `default`
82+
argument using a local variable.
83+
84+
```swift
85+
struct Container {
86+
static let defaultKey = 0
87+
88+
var dictionary = [defaultKey:0]
89+
90+
mutating func incrementValue(at key: Int) {
91+
let defaultValue = dictionary[Container.defaultKey]!
92+
dictionary[key, default: defaultValue] += 1
93+
}
94+
}
95+
// No error.
96+
```
2997

3098
* [SE-0268][]:
3199

@@ -585,8 +653,6 @@ Swift 5.1
585653
`Array` and `ContiguousArray` now have `init(unsafeUninitializedCapacity:initializingWith:)`,
586654
which provides access to the array's uninitialized storage.
587655

588-
**Add new entries to the top of this section, not here!**
589-
590656
Swift 5.0
591657
---------
592658

@@ -8028,6 +8094,7 @@ Swift 1.0
80288094
[SR-5581]: <https://bugs.swift.org/browse/SR-5581>
80298095
[SR-5719]: <https://bugs.swift.org/browse/SR-5719>
80308096
[SR-6118]: <https://bugs.swift.org/browse/SR-6118>
8097+
[SR-7083]: <https://bugs.swift.org/browse/SR-7083>
80318098
[SR-7139]: <https://bugs.swift.org/browse/SR-7139>
80328099
[SR-7251]: <https://bugs.swift.org/browse/SR-7251>
80338100
[SR-7601]: <https://bugs.swift.org/browse/SR-7601>
@@ -8039,4 +8106,5 @@ Swift 1.0
80398106
[SR-9827]: <https://bugs.swift.org/browse/SR-9827>
80408107
[SR-11298]: <https://bugs.swift.org/browse/SR-11298>
80418108
[SR-11429]: <https://bugs.swift.org/browse/SR-11429>
8109+
[SR-11700]: <https://bugs.swift.org/browse/SR-11700>
80428110
[SR-11841]: <https://bugs.swift.org/browse/SR-11841>

CMakeLists.txt

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -99,10 +99,6 @@ option(SWIFT_BUILD_PERF_TESTSUITE
9999
"Create in-tree targets for building swift performance benchmarks."
100100
FALSE)
101101

102-
option(SWIFT_BUILD_EXTERNAL_PERF_TESTSUITE
103-
"Create out-of-tree targets for building swift performance benchmarks."
104-
FALSE)
105-
106102
option(SWIFT_INCLUDE_TESTS "Create targets for building/running tests." TRUE)
107103

108104
option(SWIFT_INCLUDE_DOCS
@@ -265,11 +261,11 @@ set(SWIFT_ANDROID_DEPLOY_DEVICE_PATH "" CACHE STRING
265261
"Path on an Android device where build products will be pushed. These are used when running the test suite against the device")
266262

267263
#
268-
# User-configurable ICU specific options for Android, FreeBSD, Linux and Haiku.
264+
# User-configurable ICU specific options for Android, FreeBSD, Linux, Haiku, and WASI.
269265
#
270266

271-
foreach(sdk ANDROID;FREEBSD;LINUX;WINDOWS;HAIKU)
272-
foreach(arch aarch64;armv6;armv7;i686;powerpc64;powerpc64le;s390x;x86_64)
267+
foreach(sdk ANDROID;FREEBSD;LINUX;WINDOWS;HAIKU;WASI)
268+
foreach(arch aarch64;armv6;armv7;i686;powerpc64;powerpc64le;s390x;wasm32;x86_64)
273269
set(SWIFT_${sdk}_${arch}_ICU_UC "" CACHE STRING
274270
"Path to a directory containing the icuuc library for ${sdk}")
275271
set(SWIFT_${sdk}_${arch}_ICU_UC_INCLUDE "" CACHE STRING
@@ -610,6 +606,8 @@ else()
610606
set(SWIFT_HOST_VARIANT_ARCH_default "itanium")
611607
elseif("${CMAKE_SYSTEM_PROCESSOR}" MATCHES "(x86|i686)")
612608
set(SWIFT_HOST_VARIANT_ARCH_default "i686")
609+
elseif("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "wasm32")
610+
set(SWIFT_HOST_VARIANT_ARCH_default "wasm32")
613611
else()
614612
message(FATAL_ERROR "Unrecognized architecture on host system: ${CMAKE_SYSTEM_PROCESSOR}")
615613
endif()
@@ -794,6 +792,12 @@ if(swift_build_windows AND NOT "${CMAKE_SYSTEM_NAME}" STREQUAL "Windows")
794792
configure_sdk_windows("Windows" "msvc" "${SWIFT_SDK_WINDOWS_ARCHITECTURES}")
795793
endif()
796794

795+
# Should we cross-compile the standard library for WASI?
796+
is_sdk_requested(WASI swift_build_wasm)
797+
if(swift_build_wasm AND NOT "${SWIFT_HOST_VARIANT_SDK}" STREQUAL "WASI")
798+
configure_sdk_unix(WASI wasm32)
799+
endif()
800+
797801
if("${SWIFT_SDKS}" STREQUAL "")
798802
set(SWIFT_SDKS "${SWIFT_CONFIGURED_SDKS}")
799803
endif()
@@ -1120,10 +1124,6 @@ if ("${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin")
11201124
if(SWIFT_BUILD_PERF_TESTSUITE)
11211125
add_subdirectory(benchmark)
11221126
endif()
1123-
if(SWIFT_BUILD_EXTERNAL_PERF_TESTSUITE)
1124-
include(SwiftExternalBenchmarkBuild)
1125-
add_external_benchmark_suite()
1126-
endif()
11271127
endif()
11281128

11291129
if(SWIFT_INCLUDE_TESTS)

README.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88
| **macOS** | x86_64 |[![Build Status](https://ci.swift.org/job/oss-swift-incremental-RA-osx/lastCompletedBuild/badge/icon)](https://ci.swift.org/job/oss-swift-incremental-RA-osx)|[![Build Status](https://ci.swift.org/job/oss-swift-package-osx/lastCompletedBuild/badge/icon)](https://ci.swift.org/job/oss-swift-package-osx)|
99
| **Ubuntu 16.04** | x86_64 | [![Build Status](https://ci.swift.org/job/oss-swift-incremental-RA-linux-ubuntu-16_04/lastCompletedBuild/badge/icon)](https://ci.swift.org/job/oss-swift-incremental-RA-linux-ubuntu-16_04)|[![Build Status](https://ci.swift.org/job/oss-swift-package-linux-ubuntu-16_04/lastCompletedBuild/badge/icon)](https://ci.swift.org/job/oss-swift-package-linux-ubuntu-16_04)|
1010
| **Ubuntu 18.04** | x86_64 | [![Build Status](https://ci.swift.org/job/oss-swift-incremental-RA-linux-ubuntu-18_04/lastCompletedBuild/badge/icon)](https://ci.swift.org/job/oss-swift-incremental-RA-linux-ubuntu-18_04)|[![Build Status](https://ci.swift.org/job/oss-swift-package-linux-ubuntu-18_04/lastCompletedBuild/badge/icon)](https://ci.swift.org/job/oss-swift-package-linux-ubuntu-18_04)|
11+
| **Ubuntu 20.04** | x86_64 | [![Build Status](https://ci.swift.org/job/oss-swift-package-ubuntu-20_04/lastCompletedBuild/badge/icon)](https://ci.swift.org/job/oss-swift-package-ubuntu-20_04)|[![Build Status](https://ci.swift.org/job/oss-swift-package-ubuntu-20_04/lastCompletedBuild/badge/icon)](https://ci.swift.org/job/oss-swift-package-ubuntu-20_04)|
12+
| **CentOS 8** | x86_64 | [![Build Status](https://ci.swift.org/job/oss-swift-package-centos-8/lastCompletedBuild/badge/icon)](https://ci.swift.org/job/oss-swift-package-centos-8)|[![Build Status](https://ci.swift.org/job/oss-swift-package-linux-ubuntu-18_04/lastCompletedBuild/badge/icon)](https://ci.swift.org/job/oss-swift-package-centos-8)|
13+
| **Amazon Linux 2** | x86_64 | [![Build Status](https://ci.swift.org/job/oss-swift-package-amazon-linux-2/lastCompletedBuild/badge/icon)](https://ci.swift.org/job/oss-swift-package-amazon-linux-2)|[![Build Status](https://ci.swift.org/job/oss-swift-package-amazon-linux-2/lastCompletedBuild/badge/icon)](https://ci.swift.org/job/oss-swift-package-amazon-linux-2)|
1114

1215
**Swift Community-Hosted CI Platforms**
1316

@@ -146,6 +149,8 @@ sudo apt-get install \
146149
**Note:** LLDB currently requires at least `swig-1.3.40` but will successfully build
147150
with version 2 shipped with Ubuntu.
148151

152+
**Note:** For Ubuntu 20.04, use `libpython2-dev` in place of the libpython-dev package above.
153+
149154
Build instructions for Ubuntu 14.04 LTS can be found [here](docs/Ubuntu14.md).
150155

151156
### Getting Sources for Swift and Related Projects
@@ -338,7 +343,7 @@ See [docs/Testing.md](docs/Testing.md), in particular the section on [lit.py](do
338343

339344
Be sure to look through the [docs](https://github.com/apple/swift/tree/master/docs)
340345
directory for more information about the compiler. In particular, the documents
341-
titled [Debugging the Swift Compiler](docs/DebuggingTheCompiler.rst) and
346+
titled [Debugging the Swift Compiler](docs/DebuggingTheCompiler.md) and
342347
[Continuous Integration for Swift](docs/ContinuousIntegration.md) are very
343348
helpful to understand before submitting your first PR.
344349

benchmark/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,8 @@ set(SWIFT_BENCH_MODULES
9797
single-source/Hash
9898
single-source/Histogram
9999
single-source/HTTP2StateMachine
100+
single-source/InsertCharacter
101+
single-source/IntegerParsing
100102
single-source/Integrate
101103
single-source/IterateData
102104
single-source/Join

benchmark/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ The following build options are available:
7474
The following build targets are available:
7575

7676
* `swift-benchmark-macosx-x86_64`
77+
* `swift-benchmark-iphoneos-arm64e`
7778
* `swift-benchmark-iphoneos-arm64`
7879
* `swift-benchmark-iphoneos-armv7`
7980
* `swift-benchmark-appletvos-arm64`

benchmark/cmake/modules/AddSwiftBenchmarkSuite.cmake

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ function (add_swift_benchmark_library objfile_out sibfile_out swiftmodule_out)
189189
DEPENDS ${stdlib_dependencies} ${sources} ${BENCHLIB_DEPENDS}
190190
COMMAND "${SWIFT_EXEC}"
191191
${BENCHLIB_LIBRARY_FLAGS}
192-
"-force-single-frontend-invocation"
192+
"-whole-module-optimization"
193193
"-parse-as-library"
194194
"-module-name" "${module_name}"
195195
"-emit-module" "-emit-module-path" "${swiftmodule}"
@@ -209,7 +209,7 @@ function (add_swift_benchmark_library objfile_out sibfile_out swiftmodule_out)
209209
${stdlib_dependencies} ${sources} ${BENCHLIB_DEPENDS}
210210
COMMAND "${SWIFT_EXEC}"
211211
${BENCHLIB_LIBRARY_FLAGS}
212-
"-force-single-frontend-invocation"
212+
"-whole-module-optimization"
213213
"-parse-as-library"
214214
"-module-name" "${module_name}"
215215
"-emit-sib"
@@ -574,7 +574,7 @@ function (swift_benchmark_compile_archopts)
574574
${SWIFT_BENCH_SIBFILES} "${source}"
575575
COMMAND "${SWIFT_EXEC}"
576576
${common_swift4_options}
577-
"-force-single-frontend-invocation"
577+
"-whole-module-optimization"
578578
"-emit-module" "-module-name" "${module_name}"
579579
"-I" "${objdir}"
580580
"-o" "${objdir}/${module_name}.o"

benchmark/single-source/ProtocolDispatch2.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import TestsUtils
1919
public let ProtocolDispatch2 = BenchmarkInfo(
2020
name: "ProtocolDispatch2",
2121
runFunction: run_ProtocolDispatch2,
22-
tags: [.validation, .abstraction])
22+
tags: [.validation, .abstraction, .cpubench])
2323

2424
protocol Pingable { func ping() -> Int; func pong() -> Int}
2525

benchmark/utils/main.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,8 @@ import Hanoi
8585
import Hash
8686
import Histogram
8787
import HTTP2StateMachine
88+
import InsertCharacter
89+
import IntegerParsing
8890
import Integrate
8991
import IterateData
9092
import Join
@@ -268,6 +270,8 @@ registerBenchmark(Hanoi)
268270
registerBenchmark(HashTest)
269271
registerBenchmark(Histogram)
270272
registerBenchmark(HTTP2StateMachine)
273+
registerBenchmark(InsertCharacter)
274+
registerBenchmark(IntegerParsing)
271275
registerBenchmark(IntegrateTest)
272276
registerBenchmark(IterateData)
273277
registerBenchmark(Join)

0 commit comments

Comments
 (0)