Skip to content

Commit 4eeb953

Browse files
committed
Merge branch 'master' into emit-called-func
2 parents f2bfa26 + 87d3b4d commit 4eeb953

File tree

821 files changed

+26879
-7274
lines changed

Some content is hidden

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

821 files changed

+26879
-7274
lines changed

CHANGELOG.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,38 @@ CHANGELOG
2727
Swift 5.3
2828
----------
2929

30+
* [SE-0268][]:
31+
32+
A `didSet` observer which does not refer to the `oldValue` in its body or does not explicitly request it by placing it in the parameter list (i.e. `didSet(oldValue)`) will no longer trigger a call to the property getter to fetch the `oldValue`.
33+
34+
```swift
35+
class C {
36+
var value: Int = 0 {
37+
didSet { print("didSet called!") }
38+
}
39+
}
40+
41+
let c = C()
42+
// This does not trigger a call to the getter for 'value'
43+
// because the 'didSet' observer on 'value' does not
44+
// refer to the 'oldValue' in its body, which means
45+
// the 'oldValue' does not need to be fetched.
46+
c.value = 1
47+
```
48+
49+
* [SE-0276][]:
50+
51+
Catch clauses in a `do`-`catch` statement can now include multiple patterns in a comma-separated list. The body of a `catch` clause will be executed if a thrown error matches any of its patterns.
52+
53+
```swift
54+
do {
55+
try performTask()
56+
} catch TaskError.someFailure(let msg),
57+
TaskError.anotherFailure(let msg) {
58+
showMessage(msg)
59+
}
60+
```
61+
3062
* [SE-0280][]:
3163

3264
Enum cases can now satisfy static protocol requirements. A static get-only property of type `Self` can be witnessed by an enum case with no associated values and a static function with arguments and returning `Self` can be witnessed by an enum case with associated values.
@@ -7969,7 +8001,9 @@ Swift 1.0
79698001
[SE-0254]: <https://github.com/apple/swift-evolution/blob/master/proposals/0254-static-subscripts.md>
79708002
[SE-0266]: <https://github.com/apple/swift-evolution/blob/master/proposals/0266-synthesized-comparable-for-enumerations.md>
79718003
[SE-0267]: <https://github.com/apple/swift-evolution/blob/master/proposals/0267-where-on-contextually-generic.md>
8004+
[SE-0268]: <https://github.com/apple/swift-evolution/blob/master/proposals/0268-didset-semantics.md>
79728005
[SE-0269]: <https://github.com/apple/swift-evolution/blob/master/proposals/0269-implicit-self-explicit-capture.md>
8006+
[SE-0276]: <https://github.com/apple/swift-evolution/blob/master/proposals/0276-multi-pattern-catch-clauses.md>
79738007
[SE-0280]: <https://github.com/apple/swift-evolution/blob/master/proposals/0280-enum-cases-as-protocol-witnesses.md>
79748008

79758009
[SR-75]: <https://bugs.swift.org/browse/SR-75>

CMakeLists.txt

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required(VERSION 3.4.3)
1+
cmake_minimum_required(VERSION 3.12.4)
22

33
# TODO: Fix RPATH usage to be CMP0068 compliant
44
# Disable Policy CMP0068 for CMake 3.9
@@ -570,6 +570,8 @@ else()
570570
set(SWIFT_HOST_VARIANT_SDK_default "LINUX")
571571
elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "FreeBSD")
572572
set(SWIFT_HOST_VARIANT_SDK_default "FREEBSD")
573+
elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "OpenBSD")
574+
set(SWIFT_HOST_VARIANT_SDK_default "OPENBSD")
573575
elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "CYGWIN")
574576
set(SWIFT_HOST_VARIANT_SDK_default "CYGWIN")
575577
elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "Windows")
@@ -673,6 +675,15 @@ elseif("${SWIFT_HOST_VARIANT_SDK}" STREQUAL "FREEBSD")
673675
set(SWIFT_PRIMARY_VARIANT_SDK_default "${SWIFT_HOST_VARIANT_SDK}")
674676
set(SWIFT_PRIMARY_VARIANT_ARCH_default "${SWIFT_HOST_VARIANT_ARCH}")
675677

678+
elseif("${SWIFT_HOST_VARIANT_SDK}" STREQUAL "OPENBSD")
679+
680+
set(SWIFT_HOST_VARIANT "openbsd" CACHE STRING
681+
"Deployment OS for Swift host tools (the compiler) [openbsd].")
682+
683+
configure_sdk_unix("OpenBSD" "${SWIFT_HOST_VARIANT_ARCH}")
684+
set(SWIFT_PRIMARY_VARIANT_SDK_default "${SWIFT_HOST_VARIANT_SDK}")
685+
set(SWIFT_PRIMARY_VARIANT_ARCH_default "${SWIFT_HOST_VARIANT_ARCH}")
686+
676687
elseif("${SWIFT_HOST_VARIANT_SDK}" STREQUAL "CYGWIN")
677688

678689
set(SWIFT_HOST_VARIANT "cygwin" CACHE STRING
@@ -881,7 +892,14 @@ if(NOT CMAKE_SYSTEM_NAME STREQUAL "Darwin")
881892
endif()
882893
endif()
883894

884-
find_package(PythonInterp REQUIRED)
895+
find_package(Python2 COMPONENTS Interpreter REQUIRED)
896+
find_package(Python3 COMPONENTS Interpreter)
897+
if(NOT Python3_Interpreter_FOUND)
898+
message(WARNING "Python3 not found, using python2 as a fallback")
899+
add_executable(Python3::Interpreter IMPORTED)
900+
set_target_properties(Python3::Interpreter PROPERTIES
901+
IMPORTED_LOCATION ${Python2_EXECUTABLE})
902+
endif()
885903

886904
#
887905
# Find optional dependencies.
@@ -1027,11 +1045,13 @@ if(SWIFT_BUILD_SYNTAXPARSERLIB OR SWIFT_BUILD_SOURCEKIT)
10271045
set(SOURCEKIT_RUNTIME_DIR lib)
10281046
endif()
10291047
add_dependencies(sourcekit-inproc BlocksRuntime dispatch)
1030-
swift_install_in_component(FILES
1031-
$<TARGET_FILE:dispatch>
1032-
$<TARGET_FILE:BlocksRuntime>
1033-
DESTINATION ${SOURCEKIT_RUNTIME_DIR}
1034-
COMPONENT sourcekit-inproc)
1048+
if("${SWIFT_HOST_VARIANT_SDK}" MATCHES "OSX|WINDOWS")
1049+
swift_install_in_component(FILES
1050+
$<TARGET_FILE:dispatch>
1051+
$<TARGET_FILE:BlocksRuntime>
1052+
DESTINATION ${SOURCEKIT_RUNTIME_DIR}
1053+
COMPONENT sourcekit-inproc)
1054+
endif()
10351055
if(SWIFT_HOST_VARIANT_SDK STREQUAL WINDOWS)
10361056
swift_install_in_component(FILES
10371057
$<TARGET_LINKER_FILE:dispatch>

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ Please make sure you use Python 2.x. Python 3.x is not supported currently.
9191

9292
#### macOS
9393

94-
To build for macOS, you need [Xcode 11.4](https://developer.apple.com/xcode/downloads/).
94+
To build for macOS, you need [Xcode 11.4](https://developer.apple.com/xcode/resources/).
9595
The required version of Xcode changes frequently, and is often a beta release.
9696
Check this document or the host information on <https://ci.swift.org> for the
9797
current required version.
@@ -158,7 +158,9 @@ First create a directory for all of the Swift sources:
158158
**Note:** This is important since update-checkout (see below) checks out
159159
repositories next to the Swift source directory. This means that if one clones
160160
Swift and has other unrelated repositories, update-checkout may not clone those
161-
repositories and will update them instead.
161+
repositories and will update them instead. Be aware that `update-checkout`
162+
currently does not support paths with non-ASCII characters. If such characters
163+
are present in the path to `swift-source`, `update-checkout` will fail.
162164

163165
**Via HTTPS** For those checking out sources as read-only, HTTPS works best:
164166

benchmark/CMakeLists.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,7 @@ set(SWIFT_BENCH_MODULES
9696
single-source/Hanoi
9797
single-source/Hash
9898
single-source/Histogram
99-
single-source/InsertCharacter
100-
single-source/IntegerParsing
99+
single-source/HTTP2StateMachine
101100
single-source/Integrate
102101
single-source/IterateData
103102
single-source/Join

benchmark/Package.swift

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,19 +22,19 @@ func getSingleSourceLibraries(subDirectory: String) -> [String] {
2222
let fileURLs = try! f.contentsOfDirectory(at: dirURL,
2323
includingPropertiesForKeys: nil)
2424
return fileURLs.compactMap { (path: URL) -> String? in
25-
let c = path.lastPathComponent.split(separator: ".")
26-
// Too many components. Must be a gyb file.
27-
if c.count > 2 {
28-
return nil
29-
}
30-
if c[1] != "swift" {
25+
guard let lastDot = path.lastPathComponent.lastIndex(of: ".") else {
3126
return nil
3227
}
28+
let ext = String(path.lastPathComponent.suffix(from: lastDot))
29+
guard ext == ".swift" else { return nil }
30+
31+
let name = String(path.lastPathComponent.prefix(upTo: lastDot))
3332

34-
let name = String(c[0])
33+
// Test names must have a single component.
34+
if name.contains(".") { return nil }
3535

36-
// We do not support this test.
3736
if unsupportedTests.contains(name) {
37+
// We do not support this test.
3838
return nil
3939
}
4040

benchmark/single-source/AngryPhonebook.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ public let AngryPhonebook = [
2525

2626
// Small String Workloads
2727
BenchmarkInfo(
28-
name: "AngryPhonebook.ASCII.Small",
29-
runFunction: { angryPhonebook($0, ascii) },
28+
name: "AngryPhonebook.ASCII2.Small",
29+
runFunction: { angryPhonebook($0*10, ascii) },
3030
tags: t,
3131
setUpFunction: { blackHole(ascii) }),
3232
BenchmarkInfo(
@@ -47,8 +47,8 @@ public let AngryPhonebook = [
4747

4848
// Regular String Workloads
4949
BenchmarkInfo(
50-
name: "AngryPhonebook.ASCII",
51-
runFunction: { angryPhonebook($0, precomposed: longASCII) },
50+
name: "AngryPhonebook.ASCII2",
51+
runFunction: { angryPhonebook($0*10, precomposed: longASCII) },
5252
tags: t,
5353
setUpFunction: { blackHole(longASCII) }),
5454
BenchmarkInfo(

benchmark/single-source/DataBenchmarks.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,7 @@ func withUnsafeMutableBytes(_ N: Int, data: Data) {
416416
@inline(never)
417417
func copyBytes(_ N: Int, data: Data) {
418418
let amount = data.count
419-
var buffer = UnsafeMutablePointer<UInt8>.allocate(capacity: amount)
419+
let buffer = UnsafeMutablePointer<UInt8>.allocate(capacity: amount)
420420
defer { buffer.deallocate() }
421421
for _ in 1...N {
422422
data.copyBytes(to: buffer, from: 0..<amount)

0 commit comments

Comments
 (0)