Skip to content

Commit f2b89d1

Browse files
committed
Merge branch 'master' into fix-urc-overflow-to-side-table-in-deinit
2 parents 146833c + e19fc5e commit f2b89d1

File tree

2,298 files changed

+82927
-43451
lines changed

Some content is hidden

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

2,298 files changed

+82927
-43451
lines changed

CHANGELOG.md

Lines changed: 66 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ CHANGELOG
66

77
| Contents |
88
| :--------------------- |
9-
| [Swift 5.0](#swift-50) |
9+
| [Swift 4.2](#swift-42) |
1010
| [Swift 4.1](#swift-41) |
1111
| [Swift 4.0](#swift-40) |
1212
| [Swift 3.1](#swift-31) |
@@ -20,19 +20,65 @@ CHANGELOG
2020

2121
</details>
2222

23-
Swift 5.0
23+
Swift 4.2
2424
---------
2525

26+
* [SE-0196][]
27+
28+
Custom compile-time warnings or error messages can be emitted using the
29+
`#warning(_:)` and `#error(_:)` directives.
30+
31+
```swift
32+
#warning("this is incomplete")
33+
34+
#if MY_BUILD_CONFIG && MY_OTHER_BUILD_CONFIG
35+
#error("MY_BUILD_CONFIG and MY_OTHER_BUILD_CONFIG cannot both be set")
36+
#endif
37+
```
38+
39+
* Public classes may now have internal `required` initializers. The rule for
40+
`required` initializers is that they must be available everywhere the class
41+
can be subclassed, but previously we said that `required` initializers on
42+
public classes needed to be public themselves. (This limitation is a holdover
43+
from before the introduction of the open/public distinction in Swift 3.)
44+
2645
* C macros containing casts are no longer imported to Swift if the type in the
2746
cast is unavailable or deprecated, or produces some other diagnostic when
2847
referenced. (These macros were already only imported under very limited
2948
circumstances with very simple values, so this is unlikely to affect
3049
real-world code.)
3150

51+
* [SE-0143][]
52+
53+
Runtime query of conditional conformances is now implemented. Therefore,
54+
a dynamic cast such as `value as? P`, where the dynamic type of `value`
55+
conditionally conforms to `P`, will succeed when the conditional
56+
requirements are met.
57+
58+
**Add new entries to the top of this file, not here!**
3259

3360
Swift 4.1
3461
---------
3562

63+
* [SE-0075][]
64+
65+
Compile-time testing for the existence and importability of modules is now
66+
implemented as a build configuration test. The `canImport` test allows
67+
the development of features that require a possibly-failing import
68+
declaration across multiple platforms.
69+
70+
```swift
71+
#if canImport(UIKit)
72+
import UIKit
73+
class MyView : UIView {}
74+
#elseif canImport(AppKit)
75+
import AppKit
76+
class MyView : NSView {}
77+
#else
78+
class MyView : CustomView {}
79+
#endif
80+
```
81+
3682
* [SE-0189][]
3783

3884
If an initializer is declared in a different module from a struct, it must
@@ -81,17 +127,19 @@ Swift 4.1
81127
recursive constraints. For example, the `SubSequence` associated type of
82128
`Sequence` follows the enclosing protocol:
83129

84-
protocol Sequence {
85-
associatedtype Element
86-
associatedtype SubSequence: Sequence
87-
where SubSequence.Element == Element,
88-
SubSequence.SubSequence == SubSequence
89-
// ...
90-
}
130+
```swift
131+
protocol Sequence {
132+
associatedtype Element
133+
associatedtype SubSequence: Sequence
134+
where SubSequence.Element == Element,
135+
SubSequence.SubSequence == SubSequence
136+
// ...
137+
}
91138

92-
protocol Collection: Sequence where Self.SubSequence: Collection {
93-
// ...
94-
}
139+
protocol Collection: Sequence where Self.SubSequence: Collection {
140+
// ...
141+
}
142+
```
95143

96144
As a result, a number of new constraints have been introduced into the
97145
standard library protocols:
@@ -155,8 +203,6 @@ Swift 4.1
155203

156204
If you wish to provide your own implementation of `==`/`hashValue`, you still can; a custom implementation will replace the one synthesized by the compiler.
157205

158-
**Add new entries to the top of this file, not here!**
159-
160206
Swift 4.0
161207
---------
162208

@@ -6863,3 +6909,9 @@ Swift 1.0
68636909
[SE-0191]: <https://github.com/apple/swift-evolution/blob/master/proposals/0191-eliminate-indexdistance.md>
68646910
[SE-0192]: <https://github.com/apple/swift-evolution/blob/master/proposals/0192-non-exhaustive-enums.md>
68656911
[SE-0193]: <https://github.com/apple/swift-evolution/blob/master/proposals/0193-cross-module-inlining-and-specialization.md>
6912+
[SE-0194]: <https://github.com/apple/swift-evolution/blob/master/proposals/0194-derived-collection-of-enum-cases.md>
6913+
[SE-0195]: <https://github.com/apple/swift-evolution/blob/master/proposals/0195-dynamic-member-lookup.md>
6914+
[SE-0196]: <https://github.com/apple/swift-evolution/blob/master/proposals/0196-diagnostic-directives.md>
6915+
[SE-0197]: <https://github.com/apple/swift-evolution/blob/master/proposals/0197-remove-where.md>
6916+
[SE-0198]: <https://github.com/apple/swift-evolution/blob/master/proposals/0198-playground-quicklook-api-revamp.md>
6917+
[SE-0199]: <https://github.com/apple/swift-evolution/blob/master/proposals/0199-bool-toggle.md>

CMakeLists.txt

Lines changed: 39 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
cmake_minimum_required(VERSION 3.4.3)
22

3+
# TODO: Fix RPATH usage to be CMP0068 compliant
4+
# Disable Policy CMP0068 for CMake 3.9
5+
# rdar://37725888
6+
if(POLICY CMP0068)
7+
cmake_policy(SET CMP0068 OLD)
8+
endif()
9+
310
# Add path for custom CMake modules.
411
list(APPEND CMAKE_MODULE_PATH
512
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules")
@@ -11,6 +18,8 @@ set_property(GLOBAL PROPERTY JOB_POOLS local_jobs=${localhost_logical_cores})
1118
# Put linking in that category
1219
set_property(GLOBAL PROPERTY JOB_POOL_LINK local_jobs)
1320

21+
ENABLE_LANGUAGE(C)
22+
1423
# First include general CMake utilities.
1524
include(SwiftUtils)
1625
include(CheckSymbolExists)
@@ -119,7 +128,7 @@ set_property(CACHE SWIFT_ANALYZE_CODE_COVERAGE PROPERTY
119128
# SWIFT_VERSION is deliberately /not/ cached so that an existing build directory
120129
# can be reused when a new version of Swift comes out (assuming the user hasn't
121130
# manually set it as part of their own CMake configuration).
122-
set(SWIFT_VERSION "4.1")
131+
set(SWIFT_VERSION "4.2")
123132

124133
set(SWIFT_VENDOR "" CACHE STRING
125134
"The vendor name of the Swift compiler")
@@ -129,12 +138,12 @@ set(CLANG_COMPILER_VERSION "" CACHE STRING
129138
"The internal version of the Clang compiler")
130139

131140
# Indicate whether Swift should attempt to use the lld linker.
132-
set(SWIFT_ENABLE_LLD_LINKER FALSE CACHE BOOL
141+
set(SWIFT_ENABLE_LLD_LINKER TRUE CACHE BOOL
133142
"Enable using the lld linker when available")
134143

135144
# Indicate whether Swift should attempt to use the gold linker.
136145
# This is not used on Darwin.
137-
set(SWIFT_ENABLE_GOLD_LINKER FALSE CACHE BOOL
146+
set(SWIFT_ENABLE_GOLD_LINKER TRUE CACHE BOOL
138147
"Enable using the gold linker when available")
139148

140149
set(SWIFT_SDKS "" CACHE STRING
@@ -185,14 +194,16 @@ set(SWIFT_ANDROID_DEPLOY_DEVICE_PATH "" CACHE STRING
185194
#
186195

187196
foreach(sdk ANDROID;FREEBSD;LINUX;WINDOWS;HAIKU)
188-
set(SWIFT_${sdk}_ICU_UC "" CACHE STRING
189-
"Path to a directory containing the icuuc library for ${sdk}")
190-
set(SWIFT_${sdk}_ICU_UC_INCLUDE "" CACHE STRING
191-
"Path to a directory containing headers for icuuc for ${sdk}")
192-
set(SWIFT_${sdk}_ICU_I18N "" CACHE STRING
193-
"Path to a directory containing the icui18n library for ${sdk}")
194-
set(SWIFT_${sdk}_ICU_I18N_INCLUDE "" CACHE STRING
195-
"Path to a directory containing headers icui18n for ${sdk}")
197+
foreach(arch aarch64;armv6;armv7;i686;powerpc64;powerpc64le;s390x;x86_64)
198+
set(SWIFT_${sdk}_${arch}_ICU_UC "" CACHE STRING
199+
"Path to a directory containing the icuuc library for ${sdk}")
200+
set(SWIFT_${sdk}_${arch}_ICU_UC_INCLUDE "" CACHE STRING
201+
"Path to a directory containing headers for icuuc for ${sdk}")
202+
set(SWIFT_${sdk}_${arch}_ICU_I18N "" CACHE STRING
203+
"Path to a directory containing the icui18n library for ${sdk}")
204+
set(SWIFT_${sdk}_${arch}_ICU_I18N_INCLUDE "" CACHE STRING
205+
"Path to a directory containing headers icui18n for ${sdk}")
206+
endforeach()
196207
endforeach()
197208

198209
#
@@ -284,10 +295,6 @@ option(SWIFT_RUNTIME_ENABLE_LEAK_CHECKER
284295
"Should the runtime be built with support for non-thread-safe leak detecting entrypoints"
285296
FALSE)
286297

287-
option(SWIFT_STDLIB_ENABLE_RESILIENCE
288-
"Build the standard libraries and overlays with resilience enabled; see docs/LibraryEvolution.rst"
289-
FALSE)
290-
291298
option(SWIFT_STDLIB_USE_NONATOMIC_RC
292299
"Build the standard libraries and overlays with nonatomic reference count operations enabled"
293300
FALSE)
@@ -298,6 +305,10 @@ option(SWIFT_STDLIB_ENABLE_SIL_OWNERSHIP
298305

299306
option(SWIFT_ENABLE_GUARANTEED_NORMAL_ARGUMENTS
300307
"Build the standard libraries, overlays, and runtime with normal arguments at +0"
308+
TRUE)
309+
310+
option(SWIFT_ENABLE_RUNTIME_FUNCTION_COUNTERS
311+
"Enable runtime function counters and expose the API."
301312
FALSE)
302313

303314
#
@@ -370,6 +381,10 @@ if(SWIFT_BUILT_STANDALONE)
370381
project(Swift C CXX ASM)
371382
endif()
372383

384+
if(MSVC OR "${CMAKE_SIMULATE_ID}" STREQUAL MSVC)
385+
include(ClangClCompileRules)
386+
endif()
387+
373388
precondition(CMAKE_SYSTEM_NAME)
374389
if("${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin")
375390
set(SWIFT_BUILD_SOURCEKIT_default TRUE)
@@ -803,20 +818,23 @@ if("${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin" AND NOT CMAKE_CROSSCOMPILING)
803818
endif()
804819

805820
message(STATUS "Building host Swift tools for ${SWIFT_HOST_VARIANT_SDK} ${SWIFT_HOST_VARIANT_ARCH}")
806-
message(STATUS " Build type: ${CMAKE_BUILD_TYPE}")
807-
message(STATUS " Assertions: ${LLVM_ENABLE_ASSERTIONS}")
808-
message(STATUS " LTO: ${SWIFT_TOOLS_ENABLE_LTO}")
821+
message(STATUS " Build type: ${CMAKE_BUILD_TYPE}")
822+
message(STATUS " Assertions: ${LLVM_ENABLE_ASSERTIONS}")
823+
message(STATUS " LTO: ${SWIFT_TOOLS_ENABLE_LTO}")
824+
message(STATUS " +0 Normal Args: ${SWIFT_ENABLE_GUARANTEED_NORMAL_ARGUMENTS}")
809825
message(STATUS "")
810826

811-
if (SWIFT_BULID_STDLIB OR SWIFT_BUILD_SDK_OVERLAY)
827+
if (SWIFT_BUILD_STDLIB OR SWIFT_BUILD_SDK_OVERLAY)
812828

813829
message(STATUS "Building Swift standard library and overlays for SDKs: ${SWIFT_SDKS}")
814-
message(STATUS " Build type: ${SWIFT_STDLIB_BUILD_TYPE}")
815-
message(STATUS " Assertions: ${SWIFT_STDLIB_ASSERTIONS}")
830+
message(STATUS " Build type: ${SWIFT_STDLIB_BUILD_TYPE}")
831+
message(STATUS " Assertions: ${SWIFT_STDLIB_ASSERTIONS}")
832+
message(STATUS " +0 Normal Args: ${SWIFT_ENABLE_GUARANTEED_NORMAL_ARGUMENTS}")
816833
message(STATUS "")
817834

818835
message(STATUS "Building Swift runtime with:")
819836
message(STATUS " Leak Detection Checker Entrypoints: ${SWIFT_RUNTIME_ENABLE_LEAK_CHECKER}")
837+
message(STATUS " +0 Normal Args: ${SWIFT_ENABLE_GUARANTEED_NORMAL_ARGUMENTS}")
820838
message(STATUS "")
821839

822840
else()

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ supported host development operating systems.
5454

5555
#### macOS
5656

57-
To build for macOS, you need [Xcode 9.2](https://developer.apple.com/xcode/downloads/).
57+
To build for macOS, you need [Xcode 9.3 beta](https://developer.apple.com/xcode/downloads/).
5858
The required version of Xcode changes frequently, and is often a beta release.
5959
Check this document or the host information on <https://ci.swift.org> for the
6060
current required version.

benchmark/CMakeLists.txt

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,25 +41,30 @@ set(SWIFT_BENCH_MODULES
4141
single-source/ArraySetElement
4242
single-source/ArraySubscript
4343
single-source/BinaryFloatingPointConversionFromBinaryInteger
44+
single-source/BinaryFloatingPointProperties
4445
single-source/BitCount
4546
single-source/ByteSwap
4647
single-source/COWTree
4748
single-source/CString
4849
single-source/CSVParsing
4950
single-source/Calculator
5051
single-source/CaptureProp
52+
single-source/ChainedFilterMap
5153
single-source/CharacterLiteralsLarge
5254
single-source/CharacterLiteralsSmall
5355
single-source/CharacterProperties
5456
single-source/Chars
5557
single-source/ClassArrayGetter
5658
single-source/Combos
59+
single-source/DataBenchmarks
5760
single-source/DeadArray
5861
single-source/DictOfArraysToArrayOfDicts
5962
single-source/DictTest
6063
single-source/DictTest2
6164
single-source/DictTest3
65+
single-source/DictTest4
6266
single-source/DictionaryBridge
67+
single-source/DictionaryCopy
6368
single-source/DictionaryGroup
6469
single-source/DictionaryLiteral
6570
single-source/DictionaryRemove
@@ -73,6 +78,7 @@ set(SWIFT_BENCH_MODULES
7378
single-source/Exclusivity
7479
single-source/ExistentialPerformance
7580
single-source/Fibonacci
81+
single-source/FloatingPointPrinting
7682
single-source/Hanoi
7783
single-source/Hash
7884
single-source/HashQuadratic
@@ -113,15 +119,18 @@ set(SWIFT_BENCH_MODULES
113119
single-source/Prims
114120
single-source/ProtocolDispatch
115121
single-source/ProtocolDispatch2
122+
single-source/Queue
116123
single-source/RC4
117124
single-source/RGBHistogram
118125
single-source/RangeAssignment
119126
single-source/RangeIteration
120127
single-source/RangeReplaceableCollectionPlusDefault
121128
single-source/RecursiveOwnedParameter
122129
single-source/ReduceInto
130+
single-source/RemoveWhere
123131
single-source/ReversedCollections
124132
single-source/RomanNumbers
133+
single-source/SequenceAlgos
125134
single-source/SetTests
126135
single-source/SevenBoom
127136
single-source/Sim2DArray
@@ -221,6 +230,17 @@ if(NOT SWIFT_OPTIMIZATION_LEVELS)
221230
${SWIFT_EXTRA_BENCH_CONFIGS})
222231
endif()
223232

233+
set(SWIFT_BENCHMARK_EXTRA_FLAGS "" CACHE STRING
234+
"Extra options to pass to swiftc when building the benchmarks")
235+
236+
if (SWIFT_BENCHMARK_BUILT_STANDALONE)
237+
# This option's value must match the value of the same option used when
238+
# building the swift runtime.
239+
option(SWIFT_RUNTIME_ENABLE_LEAK_CHECKER
240+
"Should the runtime be built with support for non-thread-safe leak detecting entrypoints"
241+
FALSE)
242+
endif()
243+
224244
set(SWIFT_BENCHMARK_NUM_O_ITERATIONS "" CACHE STRING
225245
"Number of iterations to perform when running -O benchmarks via cmake")
226246
set(SWIFT_BENCHMARK_NUM_ONONE_ITERATIONS "" CACHE STRING
@@ -285,6 +305,7 @@ message("--")
285305
message("-- Swift Benchmark Suite:")
286306
message("-- SWIFT_BENCHMARK_BUILT_STANDALONE = ${SWIFT_BENCHMARK_BUILT_STANDALONE}")
287307
message("-- SWIFT_EXEC = ${SWIFT_EXEC}")
308+
message("-- SWIFT_BENCHMARK_EXTRA_FLAGS = ${SWIFT_BENCHMARK_EXTRA_FLAGS}")
288309
message("-- SWIFT_LIBRARY_PATH = ${SWIFT_LIBRARY_PATH}")
289310
message("-- CLANG_EXEC = ${CLANG_EXEC}")
290311
message("-- SWIFT_OPTIMIZATION_LEVELS = ${SWIFT_OPTIMIZATION_LEVELS}")

0 commit comments

Comments
 (0)