Skip to content

Commit 2c84189

Browse files
Merge remote-tracking branch 'swiftwasm/master' into merge/7952f051a3401494655c09aa785a058a7c997c31
2 parents c6ba966 + 7952f05 commit 2c84189

File tree

500 files changed

+17145
-4838
lines changed

Some content is hidden

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

500 files changed

+17145
-4838
lines changed

.flake8

Lines changed: 71 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,72 @@
11
[flake8]
2-
ignore = W291 W504
3-
filename = *.py,
4-
./utils/80+-check,
5-
./utils/backtrace-check,
6-
./benchmark/scripts/Benchmark_Driver,
7-
./benchmark/scripts/Benchmark_DTrace.in,
8-
./benchmark/scripts/Benchmark_GuardMalloc.in,
9-
./benchmark/scripts/Benchmark_RuntimeLeaksRunner.in,
10-
./utils/build-script,
11-
./utils/check-incremental,
12-
./test/Driver/Inputs/fake-toolchain/clang++,
13-
./utils/coverage/coverage-build-db,
14-
./utils/coverage/coverage-generate-data,
15-
./utils/coverage/coverage-query-db,
16-
./utils/coverage/coverage-touch-tests,
17-
./utils/gyb,
18-
./test/Driver/Inputs/fake-toolchain/ld,
19-
./utils/line-directive,
20-
./utils/swift_build_support/tests/mock-distcc,
21-
./docs/scripts/ns-html2rst,
22-
./utils/PathSanitizingFileCheck,
23-
./utils/recursive-lipo,
24-
./utils/round-trip-syntax-test,
25-
./utils/rth,
26-
./utils/run-remote,
27-
./utils/run-test,
28-
./utils/scale-test,
29-
./utils/submit-benchmark-results,
30-
./utils/update-checkout,
31-
./utils/viewcfg,
32-
./utils/symbolicate-linux-fatal,
2+
3+
filename =
4+
*.py,
5+
6+
./benchmark/scripts/Benchmark_Driver,
7+
./benchmark/scripts/Benchmark_DTrace.in,
8+
./benchmark/scripts/Benchmark_GuardMalloc.in,
9+
./benchmark/scripts/Benchmark_RuntimeLeaksRunner.in,
10+
11+
./docs/scripts/ns-html2rst,
12+
13+
./test/Driver/Inputs/fake-toolchain/clang++,
14+
./test/Driver/Inputs/fake-toolchain/ld,
15+
16+
./utils/80+-check,
17+
./utils/backtrace-check,
18+
./utils/build-parser-lib,
19+
./utils/build-script,
20+
./utils/check-incremental,
21+
./utils/coverage/coverage-build-db,
22+
./utils/coverage/coverage-generate-data,
23+
./utils/coverage/coverage-query-db,
24+
./utils/coverage/coverage-touch-tests,
25+
./utils/dev-scripts/blockifyasm,
26+
./utils/dev-scripts/split-cmdline,
27+
./utils/gyb,
28+
./utils/line-directive,
29+
./utils/PathSanitizingFileCheck,
30+
./utils/recursive-lipo,
31+
./utils/round-trip-syntax-test,
32+
./utils/rth,
33+
./utils/run-remote,
34+
./utils/run-test,
35+
./utils/scale-test,
36+
./utils/submit-benchmark-results,
37+
./utils/swift_build_support/tests/mock-distcc,
38+
./utils/symbolicate-linux-fatal,
39+
./utils/update-checkout,
40+
./utils/viewcfg,
41+
42+
# TODO: We should be linting the lit configs.
43+
#lit.cfg,
44+
45+
exclude =
46+
.git,
47+
__pycache__,
48+
49+
ignore =
50+
# The black tool treats slices consistently, the E203 warning is not PEP8
51+
# compliant (https://github.com/psf/black#slices).
52+
E203,
53+
54+
# FIXME: We should not have trailing whitespace.
55+
W291,
56+
57+
# Line breaks before binary operators are not explicitly disallowed in
58+
# PEP8, rather it should be consistent throughout the project. The black
59+
# tool puts them on new lines which is to be considered a best practice
60+
# in the future.
61+
W503,
62+
63+
# Similarly ignore line break after binary operators.
64+
W504,
65+
66+
# TODO: Ignore Bugbear lints for now, but we should enable these in the
67+
# future.
68+
B,
69+
70+
# 10% larger than the standard 80 character limit. Conforms to the black
71+
# standard and Bugbear's B950.
72+
max-line-length = 88

CHANGELOG.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,23 @@ Swift 5.2
193193
* `mutating func callAsFunction` is supported.
194194
* `func callAsFunction` works with `throws` and `rethrows`.
195195
* `func callAsFunction` works with trailing closures.
196+
197+
* [SE-0249][]:
198+
199+
A `\Root.value` key path expression is now allowed wherever a `(Root) -> Value`
200+
function is allowed. Such an expression is implicitly converted to a key path
201+
application of `{ $0[keyPath: \Root.value] }`.
202+
203+
For example:
204+
205+
```swift
206+
struct User {
207+
let email: String
208+
let isAdmin: Bool
209+
}
210+
211+
users.map(\.email) // this is equivalent to: users.map { $0[keyPath: \User.email] }
212+
```
196213

197214
* [SR-4206][]:
198215

@@ -7880,6 +7897,7 @@ Swift 1.0
78807897
[SE-0242]: <https://github.com/apple/swift-evolution/blob/master/proposals/0242-default-values-memberwise.md>
78817898
[SE-0244]: <https://github.com/apple/swift-evolution/blob/master/proposals/0244-opaque-result-types.md>
78827899
[SE-0245]: <https://github.com/apple/swift-evolution/blob/master/proposals/0245-array-uninitialized-initializer.md>
7900+
[SE-0249]: <https://github.com/apple/swift-evolution/blob/master/proposals/0249-key-path-literal-function-expressions.md>
78837901
[SE-0252]: <https://github.com/apple/swift-evolution/blob/master/proposals/0252-keypath-dynamic-member-lookup.md>
78847902
[SE-0253]: <https://github.com/apple/swift-evolution/blob/master/proposals/0253-callable.md>
78857903
[SE-0254]: <https://github.com/apple/swift-evolution/blob/master/proposals/0254-static-subscripts.md>

benchmark/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,10 @@ option(SWIFT_BENCHMARK_GENERATE_OPT_VIEW
248248
set(SWIFT_BENCHMARK_OPT_VIEWER "" CACHE FILEPATH
249249
"Path to opt-viewer")
250250

251+
option(SWIFT_BENCHMARK_GENERATE_DEBUG_INFO
252+
"Produce debug info for benchmarks"
253+
TRUE)
254+
251255
if(SWIFT_BENCHMARK_OPT_VIEWER)
252256
# If the path to the opt-viewer was specified manually and we have no access
253257
# to the LLVM tree, assume we have the modules for the opt-viewer installed.

benchmark/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,9 @@ The following build options are available:
6767
* Enable this option to link the benchmark binaries against the target
6868
machine's Swift standard library and runtime installed with the OS.
6969
(default: OFF)
70+
* `-DSWIFT_BENCHMARK_GENERATE_DEBUG_INFO`
71+
* Enable this option to compile benchmark binaries with debug info.
72+
(default: ON)
7073

7174
The following build targets are available:
7275

benchmark/cmake/modules/AddSwiftBenchmarkSuite.cmake

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -355,6 +355,10 @@ function (swift_benchmark_compile_archopts)
355355
"-target" "${target}"
356356
"-${BENCH_COMPILE_ARCHOPTS_OPT}" ${PAGE_ALIGNMENT_OPTION})
357357

358+
if(SWIFT_BENCHMARK_GENERATE_DEBUG_INFO)
359+
list(APPEND common_options "-g")
360+
endif()
361+
358362
if (is_darwin)
359363
list(APPEND common_options
360364
"-I" "${srcdir}/utils/ObjectiveCTests"
@@ -384,6 +388,10 @@ function (swift_benchmark_compile_archopts)
384388
"-target" "${target}"
385389
"-${driver_opt}")
386390

391+
if(SWIFT_BENCHMARK_GENERATE_DEBUG_INFO)
392+
list(APPEND common_options_driver "-g")
393+
endif()
394+
387395
if (is_darwin)
388396
list(APPEND common_options_driver
389397
"-sdk" "${sdk}"

cmake/modules/AddSwift.cmake

Lines changed: 31 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1416,10 +1416,27 @@ function(_add_swift_library_single target name)
14161416
# Include LLVM Bitcode slices for iOS, Watch OS, and Apple TV OS device libraries.
14171417
if(SWIFT_EMBED_BITCODE_SECTION AND NOT SWIFTLIB_SINGLE_DONT_EMBED_BITCODE)
14181418
if(${SWIFTLIB_SINGLE_SDK} MATCHES "(I|TV|WATCH)OS")
1419-
target_link_options(${target} PRIVATE
1420-
"LINKER:-bitcode_bundle"
1421-
$<$<BOOL:SWIFT_EMBED_BITCODE_SECTION_HIDE_SYMBOLS>:"LINKER:-bitcode_hide_symbols">
1422-
"LINKER:-lto_library,${LLVM_LIBRARY_DIR}/libLTO.dylib")
1419+
# The two branches of this if statement accomplish the same end result
1420+
# We are simply accounting for the fact that on CMake < 3.16
1421+
# using a generator expression to
1422+
# specify a LINKER: argument does not work,
1423+
# since that seems not to allow the LINKER: prefix to be
1424+
# evaluated (i.e. it will be added as-is to the linker parameters)
1425+
if(CMAKE_VERSION VERSION_LESS 3.16)
1426+
target_link_options(${target} PRIVATE
1427+
"LINKER:-bitcode_bundle"
1428+
"LINKER:-lto_library,${LLVM_LIBRARY_DIR}/libLTO.dylib")
1429+
1430+
if(SWIFT_EMBED_BITCODE_SECTION_HIDE_SYMBOLS)
1431+
target_link_options(${target} PRIVATE
1432+
"LINKER:-bitcode_hide_symbols")
1433+
endif()
1434+
else()
1435+
target_link_options(${target} PRIVATE
1436+
"LINKER:-bitcode_bundle"
1437+
$<$<BOOL:SWIFT_EMBED_BITCODE_SECTION_HIDE_SYMBOLS>:"LINKER:-bitcode_hide_symbols">
1438+
"LINKER:-lto_library,${LLVM_LIBRARY_DIR}/libLTO.dylib")
1439+
endif()
14231440
endif()
14241441
endif()
14251442
endif()
@@ -1554,6 +1571,9 @@ function(add_swift_host_library name)
15541571
if(ASHL_DEPENDS)
15551572
message(SEND_ERROR "library ${name} is using DEPENDS parameter which is deprecated. Please use add_dependencies instead")
15561573
endif()
1574+
if(ASHL_FILE_DEPENDS)
1575+
message(SEND_ERROR "library ${name} is using FILE_DEPENDS parameter which is deprecated.")
1576+
endif()
15571577
if(ASHL_LINK_LIBRARIES)
15581578
message(SEND_ERROR "library ${name} is using LINK_LIBRARIES parameter which is deprecated. Please use target_link_libraries instead")
15591579
endif()
@@ -1573,7 +1593,6 @@ function(add_swift_host_library name)
15731593
SDK ${SWIFT_HOST_VARIANT_SDK}
15741594
ARCHITECTURE ${SWIFT_HOST_VARIANT_ARCH}
15751595
LLVM_LINK_COMPONENTS ${ASHL_LLVM_LINK_COMPONENTS}
1576-
FILE_DEPENDS ${ASHL_FILE_DEPENDS}
15771596
INSTALL_IN_COMPONENT "dev"
15781597
)
15791598

@@ -2153,7 +2172,10 @@ function(add_swift_target_library name)
21532172

21542173
list(APPEND swiftlib_swift_compile_flags_all "-Fsystem" "${ios_support_frameworks_path}")
21552174
list(APPEND swiftlib_c_compile_flags_all "-iframework" "${ios_support_frameworks_path}")
2156-
list(APPEND swiftlib_link_flags_all "-F" "${ios_support_frameworks_path}")
2175+
# We collate -F with the framework path to avoid unwanted deduplication
2176+
# of options by target_compile_options -- this way no undesired
2177+
# side effects are introduced should a new search path be added.
2178+
list(APPEND swiftlib_link_flags_all "-F${ios_support_frameworks_path}")
21572179
endif()
21582180

21592181
if(sdk IN_LIST SWIFT_APPLE_PLATFORMS AND SWIFTLIB_IS_SDK_OVERLAY)
@@ -2523,6 +2545,9 @@ function(_add_swift_executable_single name)
25232545
if(SWIFTEXE_SINGLE_EXCLUDE_FROM_ALL)
25242546
message(SEND_ERROR "${name} is using EXCLUDE_FROM_ALL option which is deprecated.")
25252547
endif()
2548+
if(SWIFTEXE_SINGLE_LINK_LIBRARIES)
2549+
message(SEND_ERROR "${name} is using LINK_LIBRARIES parameter which is deprecated. Please use target_link_libraries instead")
2550+
endif()
25262551

25272552
# Check arguments.
25282553
precondition(SWIFTEXE_SINGLE_SDK MESSAGE "Should specify an SDK")
@@ -2557,12 +2582,6 @@ function(_add_swift_executable_single name)
25572582
LINK_LIBRARIES_VAR_NAME link_libraries
25582583
LIBRARY_SEARCH_DIRECTORIES_VAR_NAME library_search_directories)
25592584

2560-
_list_add_string_suffix(
2561-
"${SWIFTEXE_SINGLE_LINK_LIBRARIES}"
2562-
"-${SWIFT_SDK_${SWIFTEXE_SINGLE_SDK}_LIB_SUBDIR}-${SWIFTEXE_SINGLE_ARCHITECTURE}"
2563-
SWIFTEXE_SINGLE_LINK_LIBRARIES_TARGETS)
2564-
set(SWIFTEXE_SINGLE_LINK_LIBRARIES ${SWIFTEXE_SINGLE_LINK_LIBRARIES_TARGETS})
2565-
25662585
handle_swift_sources(
25672586
dependency_target
25682587
unused_module_dependency_target
@@ -2626,7 +2645,6 @@ function(_add_swift_executable_single name)
26262645
BINARY_DIR ${SWIFT_RUNTIME_OUTPUT_INTDIR}
26272646
LIBRARY_DIR ${SWIFT_LIBRARY_OUTPUT_INTDIR})
26282647

2629-
target_link_libraries("${name}" PRIVATE ${SWIFTEXE_SINGLE_LINK_LIBRARIES})
26302648
swift_common_llvm_config("${name}" ${SWIFTEXE_SINGLE_LLVM_LINK_COMPONENTS})
26312649

26322650
# NOTE(compnerd) use the C linker language to invoke `clang` rather than

cmake/modules/SwiftSource.cmake

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -355,13 +355,9 @@ function(_compile_swift_files
355355
if(SWIFTFILE_SDK IN_LIST SWIFT_APPLE_PLATFORMS OR
356356
SWIFTFILE_SDK STREQUAL "MACCATALYST")
357357
set(specific_module_dir "${module_base}.swiftmodule")
358-
set(specific_module_project_dir "${specific_module_dir}/Project")
359-
set(source_info_file "${specific_module_project_dir}/${SWIFTFILE_ARCHITECTURE}.swiftsourceinfo")
360358
set(module_base "${module_base}.swiftmodule/${SWIFTFILE_ARCHITECTURE}")
361359
else()
362360
set(specific_module_dir)
363-
set(specific_module_project_dir)
364-
set(source_info_file "${module_base}.swiftsourceinfo")
365361
endif()
366362
set(module_file "${module_base}.swiftmodule")
367363
set(module_doc_file "${module_base}.swiftdoc")
@@ -622,11 +618,10 @@ function(_compile_swift_files
622618
COMMAND
623619
"${CMAKE_COMMAND}" "-E" "make_directory" ${module_dir}
624620
${specific_module_dir}
625-
${specific_module_project_dir}
626621
COMMAND
627622
"${PYTHON_EXECUTABLE}" "${line_directive_tool}" "@${file_path}" --
628623
"${swift_compiler_tool}" "-emit-module" "-o" "${module_file}"
629-
"-emit-module-source-info-path" "${source_info_file}"
624+
"-avoid-emit-module-source-info"
630625
${swift_flags} ${swift_module_flags} "@${file_path}"
631626
${command_touch_module_outputs}
632627
OUTPUT ${module_outputs}

0 commit comments

Comments
 (0)