Skip to content

Commit 72194c5

Browse files
author
Marc Rasi
committed
Merge branch 'master' into ast-nondiff
2 parents e5e25a6 + e1663c9 commit 72194c5

File tree

1,089 files changed

+46571
-21454
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,089 files changed

+46571
-21454
lines changed

CHANGELOG.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,21 @@ CHANGELOG
2626
Swift 5.2
2727
---------
2828

29+
* [SR-11841][]:
30+
31+
When chaining calls to `filter(_:)` on a lazy sequence or collection, the
32+
filtering predicates will now be called in the same order as eager filters.
33+
34+
```swift
35+
let evens = (1...10).lazy
36+
.filter { $0.isMultiple(of: 2) }
37+
.filter { print($0); return true }
38+
_ = evens.count
39+
// Prints 2, 4, 6, 8, and 10 on separate lines
40+
```
41+
42+
Previously, the predicates were called in reverse order.
43+
2944
* [SR-2790][]:
3045

3146
The compiler will now emit a warning when attempting to pass a temporary
@@ -7874,3 +7889,4 @@ Swift 1.0
78747889
[SR-9827]: <https://bugs.swift.org/browse/SR-9827>
78757890
[SR-11298]: <https://bugs.swift.org/browse/SR-11298>
78767891
[SR-11429]: <https://bugs.swift.org/browse/SR-11429>
7892+
[SR-11841]: <https://bugs.swift.org/browse/SR-11841>

CMakeLists.txt

Lines changed: 130 additions & 144 deletions
Large diffs are not rendered by default.

README.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,14 +79,14 @@ several hours. Naturally, incremental builds are much faster.
7979

8080
### System Requirements
8181

82-
macOS, Ubuntu Linux LTS, and the latest Ubuntu Linux release are the current
83-
supported host development operating systems.
82+
macOS, Ubuntu Linux LTS, and the latest Ubuntu Linux release are currently
83+
supported as host development operating systems.
8484

8585
Please make sure you use Python 2.x. Python 3.x is not supported currently.
8686

8787
#### macOS
8888

89-
To build for macOS, you need [Xcode 11.2](https://developer.apple.com/xcode/downloads/).
89+
To build for macOS, you need [Xcode 11.3](https://developer.apple.com/xcode/downloads/).
9090
The required version of Xcode changes frequently, and is often a beta release.
9191
Check this document or the host information on <https://ci.swift.org> for the
9292
current required version.
@@ -234,7 +234,8 @@ then run the build product in Terminal.
234234
Swift toolchains are created using the script
235235
[build-toolchain](https://github.com/apple/swift/blob/master/utils/build-toolchain). This
236236
script is used by swift.org's CI to produce snapshots and can allow for one to
237-
locally reproduce such builds for development or distribution purposes. E.x.:
237+
locally reproduce such builds for development or distribution purposes. A typical
238+
invocation looks like the following:
238239

239240
```
240241
$ ./swift/utils/build-toolchain $BUNDLE_PREFIX

benchmark/Package.swift

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@
33
import PackageDescription
44
import Foundation
55

6-
var unsupportedTests: Set<String> = ["ObjectiveCNoBridgingStubs"]
6+
var unsupportedTests: Set<String> = []
77
#if !os(macOS) && !os(iOS) && !os(watchOS) && !os(tvOS)
8+
unsupportedTests.insert("ObjectiveCNoBridgingStubs")
89
unsupportedTests.insert("ObjectiveCBridging")
910
unsupportedTests.insert("ObjectiveCBridgingStubs")
1011
#endif
@@ -123,6 +124,15 @@ singleSourceDeps.append(.target(name: "ObjectiveCTests"))
123124
#endif
124125

125126
targets += singleSourceLibraries.map { name in
127+
if name == "ObjectiveCNoBridgingStubs" {
128+
return .target(
129+
name: name,
130+
dependencies: singleSourceDeps,
131+
path: "single-source",
132+
sources: ["\(name).swift"],
133+
swiftSettings: [.unsafeFlags(["-Xfrontend",
134+
"-disable-swift-bridge-attr"])])
135+
}
126136
return .target(name: name,
127137
dependencies: singleSourceDeps,
128138
path: "single-source",

benchmark/single-source/ArrayOfGenericRef.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class ConstructibleArray<T:Constructible> {
3434
array = [T]()
3535
array.reserveCapacity(1_000)
3636
for _ in 0...1_000 {
37-
array.append(T(e:e) as T)
37+
array.append(T(e:e))
3838
}
3939
}
4040
}

benchmark/single-source/ArrayOfRef.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class ConstructibleArray<T:Constructible> {
3535
array = [T]()
3636
array.reserveCapacity(1_000)
3737
for _ in 0...1_000 {
38-
array.append(T(e:e) as T)
38+
array.append(T(e:e))
3939
}
4040
}
4141
}

benchmark/single-source/StringWalk.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ import TestsUtils
6666
let ascii =
6767
"siebenhundertsiebenundsiebzigtausendsiebenhundertsiebenundsiebzig"
6868
let emoji = "👍👩‍👩‍👧‍👧👨‍👨‍👦‍👦🇺🇸🇨🇦🇲🇽👍🏻👍🏼👍🏽👍🏾👍🏿"
69-
let utf16 = emoji + "the quick brown fox" + String(emoji.reversed() as Array<Character>)
69+
let utf16 = emoji + "the quick brown fox" + String(emoji.reversed())
7070

7171
let japanese = "今回のアップデートでSwiftに大幅な改良が施され、安定していてしかも直感的に使うことができるAppleプラットフォーム向けプログラミング言語になりました。"
7272
let chinese = "Swift 是面向 Apple 平台的编程语言,功能强大且直观易用,而本次更新对其进行了全面优化。"

benchmark/single-source/StringWalk.swift.gyb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ import TestsUtils
6767
let ascii =
6868
"siebenhundertsiebenundsiebzigtausendsiebenhundertsiebenundsiebzig"
6969
let emoji = "👍👩‍👩‍👧‍👧👨‍👨‍👦‍👦🇺🇸🇨🇦🇲🇽👍🏻👍🏼👍🏽👍🏾👍🏿"
70-
let utf16 = emoji + "the quick brown fox" + String(emoji.reversed() as Array<Character>)
70+
let utf16 = emoji + "the quick brown fox" + String(emoji.reversed())
7171

7272
let japanese = "今回のアップデートでSwiftに大幅な改良が施され、安定していてしかも直感的に使うことができるAppleプラットフォーム向けプログラミング言語になりました。"
7373
let chinese = "Swift 是面向 Apple 平台的编程语言,功能强大且直观易用,而本次更新对其进行了全面优化。"

benchmark/utils/DriverUtils.swift

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -412,9 +412,10 @@ final class TestRunner {
412412
private static func getExecutedInstructions() -> UInt64 {
413413
if #available(OSX 10.9, iOS 7.0, *) {
414414
var u = rusage_info_v4()
415-
let p = UnsafeMutablePointer(&u)
416-
p.withMemoryRebound(to: Optional<rusage_info_t>.self, capacity: 1) { up in
417-
let _ = proc_pid_rusage(getpid(), RUSAGE_INFO_V4, up)
415+
withUnsafeMutablePointer(to: &u) { p in
416+
p.withMemoryRebound(to: Optional<rusage_info_t>.self, capacity: 1) { up in
417+
let _ = proc_pid_rusage(getpid(), RUSAGE_INFO_V4, up)
418+
}
418419
}
419420
return u.ri_instructions
420421
} else {

cmake/modules/AddSwift.cmake

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1105,9 +1105,13 @@ function(_add_swift_library_single target name)
11051105
PROPERTIES
11061106
INSTALL_RPATH "$ORIGIN:/usr/lib/swift/cygwin")
11071107
elseif("${SWIFTLIB_SINGLE_SDK}" STREQUAL "ANDROID")
1108-
# CMake generates incorrect rule `$SONAME_FLAG $INSTALLNAME_DIR$SONAME` for Android build on macOS cross-compile host.
1109-
# Proper linker flags constructed manually. See below variable `swiftlib_link_flags_all`.
1110-
set_target_properties("${target}" PROPERTIES NO_SONAME TRUE)
1108+
# CMake generates an incorrect rule `$SONAME_FLAG $INSTALLNAME_DIR$SONAME`
1109+
# for an Android cross-build from a macOS host. Construct the proper linker
1110+
# flags manually in add_swift_target_library instead, see there with
1111+
# variable `swiftlib_link_flags_all`.
1112+
if(SWIFTLIB_SINGLE_TARGET_LIBRARY)
1113+
set_target_properties("${target}" PROPERTIES NO_SONAME TRUE)
1114+
endif()
11111115
# Only set the install RPATH if cross-compiling the host tools, in which
11121116
# case both the NDK and Sysroot paths must be set.
11131117
if(NOT "${SWIFT_ANDROID_NDK_PATH}" STREQUAL "" AND
@@ -1261,6 +1265,14 @@ function(_add_swift_library_single target name)
12611265
"${SWIFT_NATIVE_SWIFT_TOOLS_PATH}/../lib/swift/${SWIFTLIB_SINGLE_SUBDIR}"
12621266
"${SWIFT_NATIVE_SWIFT_TOOLS_PATH}/../lib/swift/${SWIFT_SDK_${SWIFTLIB_SINGLE_SDK}_LIB_SUBDIR}")
12631267

1268+
# In certain cases when building, the environment variable SDKROOT is set to override
1269+
# where the sdk root is located in the system. If that environment variable has been
1270+
# set by the user, respect it and add the specified SDKROOT directory to the
1271+
# library_search_directories so we are able to link against those libraries
1272+
if(DEFINED ENV{SDKROOT} AND EXISTS "$ENV{SDKROOT}/usr/lib/swift")
1273+
list(APPEND library_search_directories "$ENV{SDKROOT}/usr/lib/swift")
1274+
endif()
1275+
12641276
# Add variant-specific flags.
12651277
if(SWIFTLIB_SINGLE_TARGET_LIBRARY)
12661278
set(build_type "${SWIFT_STDLIB_BUILD_TYPE}")

cmake/modules/StandaloneOverlay.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ endif()
1010

1111

1212
list(APPEND CMAKE_MODULE_PATH
13-
"${SWIFT_SOURCE_ROOT}/llvm/cmake/modules"
13+
"${SWIFT_SOURCE_ROOT}/llvm-project/llvm/cmake/modules"
1414
"${PROJECT_SOURCE_DIR}/../../../../cmake/modules"
1515
"${PROJECT_SOURCE_DIR}/../../../cmake/modules")
1616

cmake/modules/SwiftConfigureSDK.cmake

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,8 @@ macro(configure_sdk_unix name architectures)
262262
set(_swift_android_prebuilt_build linux-x86_64)
263263
elseif(CMAKE_HOST_SYSTEM_NAME STREQUAL Windows)
264264
set(_swift_android_prebuilt_build Windows-x86_64)
265+
elseif(CMAKE_HOST_SYSTEM_NAME STREQUAL Android)
266+
# When building natively on an Android host, there's no NDK or prebuilt suffix.
265267
else()
266268
message(SEND_ERROR "cannot cross-compile to android from ${CMAKE_HOST_SYSTEM_NAME}")
267269
endif()

docs/Android.md

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ To follow along with this guide, you'll need:
4242
turn on remote debugging by following the official instructions:
4343
https://developer.chrome.com/devtools/docs/remote-debugging.
4444

45-
## Part One: "Hello, world" on Android
45+
## "Hello, world" on Android
4646

4747
### 1. Downloading (or building) the Swift Android stdlib dependencies
4848

@@ -189,7 +189,7 @@ Hello, Android
189189

190190
Congratulations! You've just run your first Swift program on Android.
191191

192-
## Part Two: Running the Swift test suite hosted on an Android device
192+
## Running the Swift test suite hosted on an Android device
193193

194194
When running the test suite, build products are automatically pushed to your
195195
device. As in part one, you'll need to connect your Android device via USB:
@@ -213,3 +213,19 @@ $ utils/build-script \
213213
--android-icu-i18n ~/libicu-android/armeabi-v7a/libicui18n.so \
214214
--android-icu-i18n-include ~/libicu-android/armeabi-v7a/icu/source/i18n/
215215
```
216+
217+
## Build Android Toolchain
218+
219+
This toolchain will generate the .so and .swiftmodule files of the Swift standard library and Foundation framework for the Android environment, armv7 architecture. Those files are needed when building any Swift library to be included in an application for Android.
220+
221+
To build the toolchain run:
222+
223+
```
224+
$ utils/android/build-toolchain
225+
```
226+
227+
It will be built on:
228+
229+
```
230+
path/to/swift-source/swift-android-toolchain
231+
```

0 commit comments

Comments
 (0)