Skip to content

Commit 935128c

Browse files
committed
Merge branch 'master' into fix/duplicate-tuple-labels
2 parents d8f3880 + fa778ec commit 935128c

File tree

643 files changed

+15673
-6301
lines changed

Some content is hidden

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

643 files changed

+15673
-6301
lines changed

.mailmap

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,11 @@ Daniel Duan <[email protected]> <[email protected]>
2929
Dante Broggi <[email protected]>
3030
3131
32-
3332
3433
3534
36-
37-
David Rönnqvist <[email protected]>
35+
36+
David Rönnqvist <[email protected]>
3837
3938
4039
@@ -43,10 +42,8 @@ Davide Italiano <[email protected]> <[email protected]>
4342
4443
4544
46-
4745
4846
Erik Eckstein <[email protected]>
49-
5047
5148
Ewa Matejska <[email protected]>
5249
@@ -130,15 +127,13 @@ Ross Bayer <[email protected]>
130127
131128
132129
133-
134130
135131
Stephen Canon <[email protected]>
136132
137133
Sukolsak Sakshuwong <[email protected]>
138134
139135
140136
141-
142137
143138
144139

CHANGELOG.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,9 @@ Swift 5.1
197197
}
198198
```
199199

200-
* `weak` and `unowned` stored properties no longer inhibit the
200+
* [SR-9827][]:
201+
202+
`weak` and `unowned` stored properties no longer inhibit the
201203
automatic synthesis of `Equatable` or `Hashable` conformance.
202204

203205
* [SR-2688][]:
@@ -7695,3 +7697,4 @@ Swift 1.0
76957697
[SR-8109]: <https://bugs.swift.org/browse/SR-8109>
76967698
[SR-8546]: <https://bugs.swift.org/browse/SR-8546>
76977699
[SR-9043]: <https://bugs.swift.org/browse/SR-9043>
7700+
[SR-9827]: <https://bugs.swift.org/browse/SR-9827>

CMakeLists.txt

Lines changed: 38 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,15 @@ option(SWIFT_INCLUDE_DOCS
9393
"Create targets for building docs."
9494
TRUE)
9595

96+
set(_swift_include_apinotes_default FALSE)
97+
if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
98+
set(_swift_include_apinotes_default TRUE)
99+
endif()
100+
101+
option(SWIFT_INCLUDE_APINOTES
102+
"Create targets for installing the remaining apinotes in the built toolchain."
103+
${_swift_include_apinotes_default})
104+
96105
#
97106
# Miscellaneous User-configurable options.
98107
#
@@ -114,7 +123,7 @@ set_property(CACHE SWIFT_ANALYZE_CODE_COVERAGE PROPERTY
114123
# SWIFT_VERSION is deliberately /not/ cached so that an existing build directory
115124
# can be reused when a new version of Swift comes out (assuming the user hasn't
116125
# manually set it as part of their own CMake configuration).
117-
set(SWIFT_VERSION "5.0")
126+
set(SWIFT_VERSION "5.1")
118127

119128
set(SWIFT_VENDOR "" CACHE STRING
120129
"The vendor name of the Swift compiler")
@@ -253,9 +262,15 @@ option(SWIFT_RUNTIME_CRASH_REPORTER_CLIENT
253262
set(SWIFT_DARWIN_XCRUN_TOOLCHAIN "XcodeDefault" CACHE STRING
254263
"The name of the toolchain to pass to 'xcrun'")
255264

256-
set(SWIFT_DARWIN_STDLIB_INSTALL_NAME_DIR "@rpath" CACHE STRING
265+
set(SWIFT_DARWIN_STDLIB_INSTALL_NAME_DIR "/usr/lib/swift" CACHE STRING
257266
"The directory of the install_name for standard library dylibs")
258267

268+
# We don't want to use the same install_name_dir as the standard library which
269+
# will be installed in /usr/lib/swift. These private libraries should continue
270+
# to use @rpath for now.
271+
set(SWIFT_DARWIN_STDLIB_PRIVATE_INSTALL_NAME_DIR "@rpath" CACHE STRING
272+
"The directory of the install_name for the private standard library dylibs")
273+
259274
set(SWIFT_DARWIN_DEPLOYMENT_VERSION_OSX "10.9" CACHE STRING
260275
"Minimum deployment target version for OS X")
261276

@@ -598,7 +613,7 @@ else()
598613
# FIXME: Only matches v6l/v7l - by far the most common variants
599614
elseif("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "armv6l")
600615
set(SWIFT_HOST_VARIANT_ARCH_default "armv6")
601-
elseif("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "armv7l")
616+
elseif("${CMAKE_SYSTEM_PROCESSOR}" MATCHES "armv7l|armv7-a")
602617
set(SWIFT_HOST_VARIANT_ARCH_default "armv7")
603618
elseif("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "AMD64")
604619
set(SWIFT_HOST_VARIANT_ARCH_default "x86_64")
@@ -998,17 +1013,17 @@ if(SWIFT_NEED_EXPLICIT_LIBDISPATCH)
9981013
else()
9991014
set(SOURCEKIT_RUNTIME_DIR lib)
10001015
endif()
1001-
swift_install_in_component(sourcekit-inproc
1002-
FILES
1016+
swift_install_in_component(FILES
10031017
$<TARGET_FILE:dispatch>
10041018
$<TARGET_FILE:BlocksRuntime>
1005-
DESTINATION ${SOURCEKIT_RUNTIME_DIR})
1019+
DESTINATION ${SOURCEKIT_RUNTIME_DIR}
1020+
COMPONENT sourcekit-inproc)
10061021
if(SWIFT_HOST_VARIANT_SDK STREQUAL WINDOWS)
1007-
swift_install_in_component(sourcekit-inproc
1008-
FILES
1022+
swift_install_in_component(FILES
10091023
$<TARGET_LINKER_FILE:dispatch>
10101024
$<TARGET_LINKER_FILE:BlocksRuntime>
1011-
DESTINATION lib)
1025+
DESTINATION lib
1026+
COMPONENT sourcekit-inproc)
10121027
endif()
10131028

10141029

@@ -1040,16 +1055,20 @@ endif()
10401055
# created. This then will cause SwiftSyntax to fail to build.
10411056
#
10421057
# https://bugs.swift.org/browse/SR-5975
1043-
add_subdirectory(stdlib)
1044-
1045-
if(SWIFT_BUILD_SDK_OVERLAY)
1046-
list_intersect("${SWIFT_APPLE_PLATFORMS}" "${SWIFT_SDKS}"
1047-
building_darwin_sdks)
1048-
if(building_darwin_sdks)
1049-
add_subdirectory(apinotes)
1058+
if(SWIFT_BUILD_STDLIB)
1059+
add_subdirectory(stdlib)
1060+
else()
1061+
# Some tools (e.g. swift-reflection-dump) rely on a host swiftReflection, so
1062+
# ensure we build that when building tools.
1063+
if(SWIFT_INCLUDE_TOOLS)
1064+
add_subdirectory(stdlib/public/Reflection)
10501065
endif()
10511066
endif()
10521067

1068+
if(SWIFT_INCLUDE_APINOTES)
1069+
add_subdirectory(apinotes)
1070+
endif()
1071+
10531072
add_subdirectory(include)
10541073

10551074
if(SWIFT_INCLUDE_TOOLS)
@@ -1083,9 +1102,9 @@ endif()
10831102

10841103
add_subdirectory(cmake/modules)
10851104

1086-
swift_install_in_component(license
1087-
FILES "LICENSE.txt"
1088-
DESTINATION "share/swift")
1105+
swift_install_in_component(FILES "LICENSE.txt"
1106+
DESTINATION "share/swift"
1107+
COMPONENT license)
10891108

10901109
# Add a documentation target so that documentation shows up in the
10911110
# Xcode project.

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
|**[macOS 10.13 (TensorFlow)](https://github.com/apple/swift-community-hosted-continuous-integration/blob/master/nodes/x86_64_macos_high_sierra_tensorflow.json)** | x86_64 |[![Build Status](https://ci-external.swift.org/job/oss-swift-RA-macOS-tensorflow/lastCompletedBuild/badge/icon)](https://ci-external.swift.org/job/oss-swift-RA-macOS-tensorflow)|
2626
|**[Ubuntu 16.04 (TensorFlow with GPU)](https://github.com/apple/swift-community-hosted-continuous-integration/blob/master/nodes/x86_64_ubuntu_16_04_tensorflow_gpu.json)** | x86_64 |[![Build Status](https://ci-external.swift.org/job/oss-swift-RA-linux-ubuntu-16.04-tensorflow-gpu/lastCompletedBuild/badge/icon)](https://ci-external.swift.org/job/oss-swift-RA-linux-ubuntu-16.04-tensorflow-gpu)|
2727
|**[Debian 9.5](https://github.com/apple/swift-community-hosted-continuous-integration/blob/master/nodes/x86_64_debian_9.5.json)** | x86_64 | [![Build Status](https://ci-external.swift.org/job/oss-swift-RA-linux-debian-9_5/lastCompletedBuild/badge/icon)](https://ci-external.swift.org/job/oss-swift-RA-linux-debian-9_5)|
28+
|**[Windows 2019](https://github.com/apple/swift-community-hosted-continuous-integration/blob/master/nodes/x86_64_windows_2019.json)** | x86_64 | [![Build Status](https://ci-external.swift.org/job/oss-swift-windows-x86_64/lastCompletedBuild/badge/icon)](https://ci-external.swift.org/job/oss-swift-windows-x86_64)|
2829

2930

3031
## Welcome to Swift

apinotes/CMakeLists.txt

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,11 @@ add_custom_command(
2323
COMMAND
2424
"${CMAKE_COMMAND}" "-E" "copy_if_different" ${inputs} "${output_dir}/")
2525

26-
add_custom_target("copy_apinotes"
26+
add_custom_target("copy_apinotes" ALL
2727
DEPENDS "${outputs}" "${output_dir}"
2828
COMMENT "Copying API notes to ${output_dir}"
2929
SOURCES "${sources}")
3030

31-
# This is treated as an OPTIONAL target because if we don't build the SDK
32-
# overlay, the files will be missing anyway. It also allows us to build
33-
# single overlays without installing the API notes.
34-
swift_install_in_component(sdk-overlay
35-
DIRECTORY "${output_dir}"
36-
DESTINATION "lib/swift/"
37-
OPTIONAL)
31+
swift_install_in_component(DIRECTORY "${output_dir}"
32+
DESTINATION "lib/swift/"
33+
COMPONENT compiler)

benchmark/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ set(SWIFT_BENCH_MODULES
9292
single-source/Hash
9393
single-source/Histogram
9494
single-source/InsertCharacter
95+
single-source/IntegerParsing
9596
single-source/Integrate
9697
single-source/IterateData
9798
single-source/Join
@@ -107,6 +108,7 @@ set(SWIFT_BENCH_MODULES
107108
single-source/NSError
108109
single-source/NSStringConversion
109110
single-source/NibbleSort
111+
single-source/NIOChannelPipeline
110112
single-source/NopDeinit
111113
single-source/ObjectAllocation
112114
single-source/ObjectiveCBridging

benchmark/single-source/AngryPhonebook.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public let AngryPhonebook = BenchmarkInfo(
2121
tags: [.validation, .api, .String],
2222
legacyFactor: 7)
2323

24-
var words = [
24+
let words = [
2525
"James", "John", "Robert", "Michael", "William", "David", "Richard", "Joseph",
2626
"Charles", "Thomas", "Christopher", "Daniel", "Matthew", "Donald", "Anthony",
2727
"Paul", "Mark", "George", "Steven", "Kenneth", "Andrew", "Edward", "Brian",

benchmark/single-source/AnyHashableWithAClass.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import TestsUtils
2222
// 11% _swift_stdlib_makeAnyHashableUpcastingToHashableBaseType
2323
// 16% _swift_retain_[n]
2424
// 5% swift_conformsToProtocol
25-
public var AnyHashableWithAClass = BenchmarkInfo(
25+
public let AnyHashableWithAClass = BenchmarkInfo(
2626
name: "AnyHashableWithAClass",
2727
runFunction: run_AnyHashableWithAClass,
2828
tags: [.abstraction, .runtime, .cpubench],

benchmark/single-source/ArrayOfGenericPOD.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ public func run_ArrayOfGenericPOD(_ N: Int) {
7676

7777
// --- ArrayInitFromSlice
7878

79-
var globalArray = Array<UInt8>(repeating: 0, count: 4096)
79+
let globalArray = Array<UInt8>(repeating: 0, count: 4096)
8080

8181
func createArrayOfPOD() {
8282
blackHole(globalArray)

benchmark/single-source/ArraySetElement.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import TestsUtils
1515
// 33% isUniquelyReferenced
1616
// 15% swift_rt_swift_isUniquelyReferencedOrPinned_nonNull_native
1717
// 18% swift_isUniquelyReferencedOrPinned_nonNull_native
18-
public var ArraySetElement = BenchmarkInfo(
18+
public let ArraySetElement = BenchmarkInfo(
1919
name: "ArraySetElement",
2020
runFunction: run_ArraySetElement,
2121
tags: [.runtime, .cpubench]

benchmark/single-source/Breadcrumbs.swift

Lines changed: 7 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -45,23 +45,6 @@ extension String {
4545
}
4646
}
4747

48-
let seed = 0x12345678
49-
50-
/// A linear congruential PRNG.
51-
struct LCRNG: RandomNumberGenerator {
52-
private var state: UInt64
53-
54-
init(seed: Int) {
55-
state = UInt64(truncatingIfNeeded: seed)
56-
for _ in 0..<10 { _ = next() }
57-
}
58-
59-
mutating func next() -> UInt64 {
60-
state = 2862933555777941757 &* state &+ 3037000493
61-
return state
62-
}
63-
}
64-
6548
extension Collection {
6649
/// Returns a randomly ordered array of random non-overlapping index ranges
6750
/// that cover this collection entirely.
@@ -254,7 +237,7 @@ class UTF16ToIdx: BenchmarkBase {
254237

255238
override func setUp() {
256239
super.setUp()
257-
var rng = LCRNG(seed: seed)
240+
var rng = SplitMix64(seed: 42)
258241
let range = 0 ..< inputString.utf16.count
259242
inputOffsets = Array(range.shuffled(using: &rng).prefix(count))
260243
}
@@ -286,7 +269,7 @@ class IdxToUTF16: BenchmarkBase {
286269

287270
override func setUp() {
288271
super.setUp()
289-
var rng = LCRNG(seed: seed)
272+
var rng = SplitMix64(seed: 42)
290273
inputIndices = Array(inputString.indices.shuffled(using: &rng).prefix(count))
291274
}
292275

@@ -318,7 +301,7 @@ class UTF16ToIdxRange: BenchmarkBase {
318301

319302
override func setUp() {
320303
super.setUp()
321-
var rng = LCRNG(seed: seed)
304+
var rng = SplitMix64(seed: 42)
322305
inputOffsets = (
323306
0 ..< inputString.utf16.count
324307
).randomIndexRanges(count: count, using: &rng)
@@ -352,7 +335,7 @@ class IdxToUTF16Range: BenchmarkBase {
352335

353336
override func setUp() {
354337
super.setUp()
355-
var rng = LCRNG(seed: seed)
338+
var rng = SplitMix64(seed: 42)
356339
inputIndices = self.inputString.randomIndexRanges(count: count, using: &rng)
357340
}
358341

@@ -384,7 +367,7 @@ class CopyUTF16CodeUnits: BenchmarkBase {
384367

385368
override func setUp() {
386369
super.setUp()
387-
var rng = LCRNG(seed: seed)
370+
var rng = SplitMix64(seed: 42)
388371
inputIndices = (
389372
0 ..< inputString.utf16.count
390373
).randomIndexRanges(count: count, using: &rng)
@@ -425,7 +408,7 @@ class MutatedUTF16ToIdx: BenchmarkBase {
425408

426409
override func setUp() {
427410
super.setUp()
428-
var generator = LCRNG(seed: seed)
411+
var generator = SplitMix64(seed: 42)
429412
let range = 0 ..< inputString.utf16.count
430413
inputOffsets = Array(range.shuffled(using: &generator).prefix(count))
431414
}
@@ -469,7 +452,7 @@ class MutatedIdxToUTF16: BenchmarkBase {
469452

470453
override func setUp() {
471454
super.setUp()
472-
var rng = LCRNG(seed: seed)
455+
var rng = SplitMix64(seed: 42)
473456
inputIndices = Array(inputString.indices.shuffled(using: &rng).prefix(count))
474457
}
475458

0 commit comments

Comments
 (0)