Skip to content

Commit a90789b

Browse files
Merge branch 'master' into fixme-atomic-stdlib-unit-test
2 parents 12ee98b + dbe99d7 commit a90789b

File tree

504 files changed

+7349
-4041
lines changed

Some content is hidden

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

504 files changed

+7349
-4041
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ CHANGELOG
2525
Swift 5.1
2626
---------
2727

28+
* [SE-0068][]:
29+
30+
`Self` can now be used inside member functions and for function arguments of structs and enums to refer to the containing type.
31+
2832
* [SR-7799][]:
2933

3034
Enum cases can now be matched against an optional enum without

CMakeLists.txt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -250,10 +250,6 @@ option(SWIFT_RUNTIME_CRASH_REPORTER_CLIENT
250250
"Whether to enable CrashReporter integration"
251251
FALSE)
252252

253-
option(SWIFT_DARWIN_ENABLE_STABLE_ABI_BIT
254-
"Enable the Swift stable ABI's class marker bit for new deployment targets"
255-
TRUE)
256-
257253
set(SWIFT_DARWIN_XCRUN_TOOLCHAIN "XcodeDefault" CACHE STRING
258254
"The name of the toolchain to pass to 'xcrun'")
259255

apinotes/os.apinotes

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ Enumerators:
3030
SwiftPrivate: true
3131
Functions:
3232
- Name: _os_log_impl
33-
Availability: nonswift
34-
AvailabilityMsg: 'Use os_log'
33+
SwiftPrivate: true
34+
NullabilityOfRet: O
3535
- Name: _os_log_error_impl
3636
Availability: nonswift
3737
AvailabilityMsg: 'Use os_log'

benchmark/cmake/modules/AddSwiftBenchmarkSuite.cmake

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,11 @@ macro(configure_sdks_darwin)
7777
set(appletvos_ver "9.1")
7878
set(watchos_ver "2.0")
7979

80+
set(macosx_vendor "apple")
81+
set(iphoneos_vendor "apple")
82+
set(appletvos_vendor "apple")
83+
set(watchos_vendor "apple")
84+
8085
set(macosx_triple_platform "macosx")
8186
set(iphoneos_triple_platform "ios")
8287
set(appletvos_triple_platform "tvos")

cmake/modules/AddSwift.cmake

Lines changed: 18 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1354,7 +1354,6 @@ endfunction()
13541354
# [SHARED]
13551355
# [STATIC]
13561356
# [DEPENDS dep1 ...]
1357-
# [LINK_LIBRARIES dep1 ...]
13581357
# [INTERFACE_LINK_LIBRARIES dep1 ...]
13591358
# [SWIFT_MODULE_DEPENDS dep1 ...]
13601359
# [LLVM_COMPONENT_DEPENDS comp1 ...]
@@ -1377,9 +1376,6 @@ endfunction()
13771376
# DEPENDS
13781377
# Targets that this library depends on.
13791378
#
1380-
# LINK_LIBRARIES
1381-
# Libraries this library depends on.
1382-
#
13831379
# LLVM_COMPONENT_DEPENDS
13841380
# LLVM components this library depends on.
13851381
#
@@ -1419,6 +1415,10 @@ function(add_swift_host_library name)
14191415
${ARGN})
14201416
set(ASHL_SOURCES ${ASHL_UNPARSED_ARGUMENTS})
14211417

1418+
if(ASHL_LINK_LIBRARIES)
1419+
message(SEND_ERROR "library ${name} is using LINK_LIBRARIES parameter which is deprecated. Please use target_link_libraries instead")
1420+
endif()
1421+
14221422
translate_flags(ASHL "${options}")
14231423

14241424
if(NOT ASHL_SHARED AND NOT ASHL_STATIC)
@@ -1435,7 +1435,6 @@ function(add_swift_host_library name)
14351435
SDK ${SWIFT_HOST_VARIANT_SDK}
14361436
ARCHITECTURE ${SWIFT_HOST_VARIANT_ARCH}
14371437
DEPENDS ${ASHL_DEPENDS}
1438-
LINK_LIBRARIES ${ASHL_LINK_LIBRARIES}
14391438
LLVM_COMPONENT_DEPENDS ${ASHL_LLVM_COMPONENT_DEPENDS}
14401439
FILE_DEPENDS ${ASHL_FILE_DEPENDS}
14411440
C_COMPILE_FLAGS ${ASHL_C_COMPILE_FLAGS}
@@ -2105,15 +2104,12 @@ endfunction()
21052104
#
21062105
# [ARCHITECTURE architecture]
21072106
# Architecture to build for.
2108-
#
2109-
# [LINK_FAT_LIBRARIES lipo_target1 ...]
2110-
# Fat libraries to link with.
21112107
function(_add_swift_executable_single name)
21122108
# Parse the arguments we were given.
21132109
cmake_parse_arguments(SWIFTEXE_SINGLE
21142110
"EXCLUDE_FROM_ALL"
21152111
"SDK;ARCHITECTURE"
2116-
"DEPENDS;LLVM_COMPONENT_DEPENDS;LINK_LIBRARIES;LINK_FAT_LIBRARIES;COMPILE_FLAGS"
2112+
"DEPENDS;LLVM_COMPONENT_DEPENDS;LINK_LIBRARIES;COMPILE_FLAGS"
21172113
${ARGN})
21182114

21192115
set(SWIFTEXE_SINGLE_SOURCES ${SWIFTEXE_SINGLE_UNPARSED_ARGUMENTS})
@@ -2161,27 +2157,11 @@ function(_add_swift_executable_single name)
21612157
"-Xlinker" "@executable_path/../lib/swift/${SWIFT_SDK_${SWIFTEXE_SINGLE_SDK}_LIB_SUBDIR}")
21622158
endif()
21632159

2164-
# Find the names of dependency library targets.
2165-
#
2166-
# We don't add the ${ARCH} to the target suffix because we want to link
2167-
# against fat libraries. This only works for the Darwin targets as MachO is
2168-
# the only format with the fat libraries.
2169-
if(${SWIFTEXE_SINGLE_SDK} IN_LIST SWIFT_APPLE_PLATFORMS)
2170-
_list_add_string_suffix(
2171-
"${SWIFTEXE_SINGLE_LINK_FAT_LIBRARIES}"
2172-
"-${SWIFT_SDK_${SWIFTEXE_SINGLE_SDK}_LIB_SUBDIR}"
2173-
SWIFTEXE_SINGLE_LINK_FAT_LIBRARIES_TARGETS)
2174-
_list_add_string_suffix(
2175-
"${SWIFTEXE_SINGLE_LINK_FAT_LIBRARIES}"
2176-
"-${SWIFT_SDK_${SWIFTEXE_SINGLE_SDK}_LIB_SUBDIR}-${SWIFTEXE_SINGLE_ARCHITECTURE}"
2177-
SWIFTEXE_SINGLE_LINK_FAT_LIBRARIES)
2178-
else()
2179-
_list_add_string_suffix(
2180-
"${SWIFTEXE_SINGLE_LINK_FAT_LIBRARIES}"
2181-
"-${SWIFT_SDK_${SWIFTEXE_SINGLE_SDK}_LIB_SUBDIR}-${SWIFTEXE_SINGLE_ARCHITECTURE}"
2182-
SWIFTEXE_SINGLE_LINK_FAT_LIBRARIES_TARGETS)
2183-
set(SWIFTEXE_SINGLE_LINK_FAT_LIBRARIES ${SWIFTEXE_SINGLE_LINK_FAT_LIBRARIES_TARGETS})
2184-
endif()
2160+
_list_add_string_suffix(
2161+
"${SWIFTEXE_SINGLE_LINK_LIBRARIES}"
2162+
"-${SWIFT_SDK_${SWIFTEXE_SINGLE_SDK}_LIB_SUBDIR}-${SWIFTEXE_SINGLE_ARCHITECTURE}"
2163+
SWIFTEXE_SINGLE_LINK_LIBRARIES_TARGETS)
2164+
set(SWIFTEXE_SINGLE_LINK_LIBRARIES ${SWIFTEXE_SINGLE_LINK_LIBRARIES_TARGETS})
21852165

21862166
handle_swift_sources(
21872167
dependency_target
@@ -2192,7 +2172,6 @@ function(_add_swift_executable_single name)
21922172
SWIFTEXE_SINGLE_SOURCES SWIFTEXE_SINGLE_EXTERNAL_SOURCES ${name}
21932173
DEPENDS
21942174
${SWIFTEXE_SINGLE_DEPENDS}
2195-
${SWIFTEXE_SINGLE_LINK_FAT_LIBRARIES_TARGETS}
21962175
MODULE_NAME ${name}
21972176
SDK ${SWIFTEXE_SINGLE_SDK}
21982177
ARCHITECTURE ${SWIFTEXE_SINGLE_ARCHITECTURE}
@@ -2210,8 +2189,7 @@ function(_add_swift_executable_single name)
22102189
DEPENDS
22112190
${dependency_target}
22122191
${LLVM_COMMON_DEPENDS}
2213-
${SWIFTEXE_SINGLE_DEPENDS}
2214-
${SWIFTEXE_SINGLE_LINK_FAT_LIBRARIES_TARGETS})
2192+
${SWIFTEXE_SINGLE_DEPENDS})
22152193
llvm_update_compile_flags("${name}")
22162194

22172195
# Convert variables to space-separated strings.
@@ -2231,11 +2209,10 @@ function(_add_swift_executable_single name)
22312209
BINARY_DIR ${SWIFT_RUNTIME_OUTPUT_INTDIR}
22322210
LIBRARY_DIR ${SWIFT_LIBRARY_OUTPUT_INTDIR})
22332211

2234-
target_link_libraries("${name}" PRIVATE ${SWIFTEXE_SINGLE_LINK_LIBRARIES} ${SWIFTEXE_SINGLE_LINK_FAT_LIBRARIES})
2212+
target_link_libraries("${name}" PRIVATE ${SWIFTEXE_SINGLE_LINK_LIBRARIES})
22352213
swift_common_llvm_config("${name}" ${SWIFTEXE_SINGLE_LLVM_COMPONENT_DEPENDS})
22362214

2237-
set_target_properties(${name}
2238-
PROPERTIES FOLDER "Swift executables")
2215+
set_target_properties(${name} PROPERTIES FOLDER "Swift executables")
22392216
endfunction()
22402217

22412218
macro(add_swift_tool_subdirectory name)
@@ -2249,14 +2226,18 @@ endmacro()
22492226
function(add_swift_host_tool executable)
22502227
set(options)
22512228
set(single_parameter_options SWIFT_COMPONENT)
2252-
set(multiple_parameter_options)
2229+
set(multiple_parameter_options LINK_LIBRARIES)
22532230

22542231
cmake_parse_arguments(ASHT
22552232
"${options}"
22562233
"${single_parameter_options}"
22572234
"${multiple_parameter_options}"
22582235
${ARGN})
22592236

2237+
if(ASHT_LINK_LIBRARIES)
2238+
message(SEND_ERROR "${executable} is using LINK_LIBRARIES parameter which is deprecated. Please use target_link_libraries instead")
2239+
endif()
2240+
22602241
precondition(ASHT_SWIFT_COMPONENT
22612242
MESSAGE "Swift Component is required to add a host tool")
22622243

cmake/modules/SwiftSource.cmake

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -226,9 +226,9 @@ function(_compile_swift_files
226226
list(APPEND swift_flags "-Xfrontend" "-sil-verify-all")
227227
endif()
228228

229-
# The standard library and overlays are always built with resilience.
229+
# The standard library and overlays are always built resiliently.
230230
if(SWIFTFILE_IS_STDLIB)
231-
list(APPEND swift_flags "-Xfrontend" "-enable-resilience")
231+
list(APPEND swift_flags "-enable-library-evolution")
232232
endif()
233233

234234
if(SWIFT_STDLIB_USE_NONATOMIC_RC)

docs/SIL.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3961,7 +3961,7 @@ unless the enum can be exhaustively switched in the current function, i.e. when
39613961
the compiler can be sure that it knows all possible present and future values
39623962
of the enum in question. This is generally true for enums defined in Swift, but
39633963
there are two exceptions: *non-frozen enums* declared in libraries compiled
3964-
with the ``-enable-resilience`` flag, which may grow new cases in the future in
3964+
with the ``-enable-library-evolution`` flag, which may grow new cases in the future in
39653965
an ABI-compatible way; and enums marked with the ``objc`` attribute, for which
39663966
other bit patterns are permitted for compatibility with C. All enums imported
39673967
from C are treated as "non-exhaustive" for the same reason, regardless of the

docs/WindowsBuild.md

Lines changed: 38 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,7 @@ cmake -G Ninja^
280280
-DCMAKE_SWIFT_COMPILER=S:\b\swift\bin\swiftc.exe^
281281
-DCURL_LIBRARY="S:/curl/builds/libcurl-vc15-x64-release-static-ipv6-sspi-winssl/lib/libcurl_a.lib"^
282282
-DCURL_INCLUDE_DIR="S:/curl/builds/libcurl-vc15-x64-release-static-ipv6-sspi-winssl/include"^
283+
-DENABLE_TESTING=NO^
283284
-DICU_ROOT="S:/thirdparty/icu4c-63_1-Win64-MSVC2017"^
284285
-DLIBXML2_LIBRARY="S:/libxml2/win32/bin.msvc/libxml2_a.lib"^
285286
-DLIBXML2_INCLUDE_DIR="S:/libxml2/include"^
@@ -288,7 +289,6 @@ cmake -G Ninja^
288289
S:\swift-corelibs-foundation
289290
popd
290291
cmake --build S:\b\foundation
291-
292292
```
293293

294294
- Add Foundation to your path:
@@ -321,7 +321,43 @@ cmake --build S:\b\xctest
321321
path S:\b\xctest;%PATH%
322322
```
323323

324-
### 15. Install Swift on Windows
324+
### 15. Test XCTest
325+
326+
```cmd
327+
ninja -C S:\b\xctest check-xctest
328+
```
329+
330+
### 16. Rebuild Foundation
331+
332+
```cmd
333+
mkdir "S:\b\foundation"
334+
pushd "S:\b\foundation
335+
cmake -G Ninja^
336+
-DCMAKE_BUILD_TYPE=RelWithDebInfo^
337+
-DCMAKE_C_COMPILER=clang-cl^
338+
-DCMAKE_SWIFT_COMPILER=S:\b\swift\bin\swiftc.exe^
339+
-DCURL_LIBRARY="S:/curl/builds/libcurl-vc15-x64-release-static-ipv6-sspi-winssl/lib/libcurl_a.lib"^
340+
-DCURL_INCLUDE_DIR="S:/curl/builds/libcurl-vc15-x64-release-static-ipv6-sspi-winssl/include"^
341+
-DENABLE_TESTING=YES^
342+
-DICU_ROOT="S:/thirdparty/icu4c-63_1-Win64-MSVC2017"^
343+
-DLIBXML2_LIBRARY="S:/libxml2/win32/bin.msvc/libxml2_a.lib"^
344+
-DLIBXML2_INCLUDE_DIR="S:/libxml2/include"^
345+
-DFOUNDATION_PATH_TO_LIBDISPATCH_SOURCE=S:\swift-corelibs-libdispatch^
346+
-DFOUNDATION_PATH_TO_LIBDISPATCH_BUILD=S:\b\libdispatch^
347+
-DFOUNDATION_PATH_TO_XCTEST_BUILD=S:\b\xctest^
348+
S:\swift-corelibs-foundation
349+
popd
350+
cmake --build S:\b\foundation
351+
```
352+
353+
### 17. Test Foundation
354+
355+
```cmd
356+
cmake --build S:\b\foundation
357+
ninja -C S:\b\foundation test
358+
```
359+
360+
### 18. Install Swift on Windows
325361

326362
- Run ninja install:
327363

include/swift/AST/DiagnosticsSIL.def

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,20 @@ NOTE(previous_yield, none, "previous yield was here", ())
369369
ERROR(possible_return_before_yield, none,
370370
"accessor must yield on all paths before returning", ())
371371

372-
NOTE(one_yield, none, "yield along one path is here", ())
372+
NOTE(branch_doesnt_yield, none,
373+
"missing yield when the condition is %select{false|true}0", (bool))
374+
375+
NOTE(named_case_doesnt_yield, none, "missing yield in the %0 case",
376+
(Identifier))
377+
378+
NOTE(case_doesnt_yield, none, "missing yield in "
379+
"%select{this|the nil|the non-nil}0 case", (unsigned))
380+
381+
NOTE(switch_value_case_doesnt_yield, none, "missing yield in the %0 case",
382+
(StringRef))
383+
384+
NOTE(try_branch_doesnt_yield, none, "missing yield when error is "
385+
"%select{not |}0thrown", (bool))
373386

374387
#ifndef DIAG_NO_UNDEF
375388
# if defined(DIAG)

include/swift/AST/DiagnosticsSema.def

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,8 @@ NOTE(inout_change_var_type_if_possible,none,
238238
ERROR(cannot_pass_rvalue_inout,none,
239239
"cannot pass immutable value of type %0 as inout argument",
240240
(Type))
241+
ERROR(cannot_provide_default_value_inout,none,
242+
"cannot provide default value to inout parameter %0", (Identifier))
241243

242244
ERROR(cannot_assign_to_literal,none,
243245
"cannot assign to a literal value", ())
@@ -1303,7 +1305,7 @@ ERROR(indirect_case_without_payload,none,
13031305
ERROR(indirect_case_in_indirect_enum,none,
13041306
"enum case in 'indirect' enum cannot also be 'indirect'", ())
13051307
WARNING(enum_frozen_nonresilient,none,
1306-
"%0 has no effect without -enable-resilience", (DeclAttribute))
1308+
"%0 has no effect without -enable-library-evolution", (DeclAttribute))
13071309
WARNING(enum_frozen_nonpublic,none,
13081310
"%0 has no effect on non-public enums", (DeclAttribute))
13091311

include/swift/AST/IRGenOptions.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,7 @@ class IRGenOptions {
174174
/// Force lazy initialization of class metadata
175175
/// Used on Windows to avoid cross-module references.
176176
unsigned LazyInitializeClassMetadata : 1;
177+
unsigned LazyInitializeProtocolConformances : 1;
177178

178179
/// Normally if the -read-legacy-type-info flag is not specified, we look for
179180
/// a file named "legacy-<arch>.yaml" in SearchPathOpts.RuntimeLibraryPath.
@@ -234,7 +235,7 @@ class IRGenOptions {
234235
ValueNames(false), EnableReflectionMetadata(true),
235236
EnableReflectionNames(true), EnableAnonymousContextMangledNames(false),
236237
EnableResilienceBypass(false), LazyInitializeClassMetadata(false),
237-
DisableLegacyTypeInfo(false),
238+
LazyInitializeProtocolConformances(false), DisableLegacyTypeInfo(false),
238239
UseIncrementalLLVMCodeGen(true), UseSwiftCall(false),
239240
GenerateProfile(false), EnableDynamicReplacementChaining(false),
240241
DisableRoundTripDebugTypes(false),

include/swift/AST/KnownIdentifiers.def

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -101,12 +101,7 @@ IDENTIFIER(stringValue)
101101
IDENTIFIER(super)
102102
IDENTIFIER(superDecoder)
103103
IDENTIFIER(superEncoder)
104-
#if SWIFT_DARWIN_ENABLE_STABLE_ABI_BIT
105104
IDENTIFIER_WITH_NAME(SwiftObject, "_TtCs12_SwiftObject")
106-
#else
107-
// Pre-stable ABI uses un-mangled name for SwiftObject.
108-
IDENTIFIER(SwiftObject)
109-
#endif
110105
IDENTIFIER(to)
111106
IDENTIFIER(toRaw)
112107
IDENTIFIER(Type)

include/swift/AST/Module.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ enum class ResilienceStrategy : unsigned {
117117
/// Public nominal types: resilient
118118
/// Non-inlinable function bodies: resilient
119119
///
120-
/// This is the behavior with -enable-resilience.
120+
/// This is the behavior with -enable-library-evolution.
121121
Resilient
122122
};
123123

include/swift/AST/PrintOptions.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -453,6 +453,7 @@ struct PrintOptions {
453453
result.ShouldQualifyNestedDeclarations =
454454
QualifyNestedDeclarations::Always;
455455
result.PrintDocumentationComments = true;
456+
result.SkipUnderscoredKeywords = true;
456457
return result;
457458
}
458459

@@ -537,6 +538,7 @@ struct PrintOptions {
537538
/// Print in the style of quick help declaration.
538539
static PrintOptions printQuickHelpDeclaration() {
539540
PrintOptions PO;
541+
PO.SkipUnderscoredKeywords = true;
540542
PO.EnumRawValues = true;
541543
PO.PrintImplicitAttrs = false;
542544
PO.PrintFunctionRepresentationAttrs = false;

include/swift/AST/SearchPathOptions.h

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,11 @@ class SearchPathOptions {
6767
/// Path to search for compiler-relative stdlib dylibs.
6868
std::string RuntimeLibraryPath;
6969

70-
/// Path to search for compiler-relative stdlib modules.
71-
std::string RuntimeLibraryImportPath;
70+
/// Paths to search for stdlib modules. One of these will be compiler-relative.
71+
std::vector<std::string> RuntimeLibraryImportPaths;
7272

7373
/// Don't look in for compiler-provided modules.
74-
bool SkipRuntimeLibraryImportPath = false;
74+
bool SkipRuntimeLibraryImportPaths = false;
7575

7676
/// Return a hash code of any components from these options that should
7777
/// contribute to a Swift Bridging PCH hash.
@@ -92,7 +92,9 @@ class SearchPathOptions {
9292
Code = hash_combine(Code, LibraryPath);
9393
}
9494
Code = hash_combine(Code, RuntimeResourcePath);
95-
Code = hash_combine(Code, RuntimeLibraryImportPath);
95+
for (auto RuntimeLibraryImportPath : RuntimeLibraryImportPaths) {
96+
Code = hash_combine(Code, RuntimeLibraryImportPath);
97+
}
9698
return Code;
9799
}
98100
};

0 commit comments

Comments
 (0)