Skip to content

Commit 690c1f5

Browse files
committed
Merge branch 'master' into optimize/global-var-init
2 parents eda11c5 + b4771c2 commit 690c1f5

File tree

1,602 files changed

+60431
-20516
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,602 files changed

+60431
-20516
lines changed

.flake8

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

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@ docs/_build
3939
# Visual Studio metadata
4040
.vs
4141

42+
# clangd
43+
.clangd
44+
4245
#==============================================================================#
4346
# Ignore CMake temporary files
4447
#==============================================================================#

.mailmap

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ Amr Aboelela <[email protected]> <[email protected]>
88
99
Argyrios Kyrtzidis <[email protected]> <[email protected]>
1010
11+
1112
Ben Cohen <[email protected]>
1213
1314

CHANGELOG.md

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,33 @@ CHANGELOG
2323

2424
</details>
2525

26+
Swift Next
27+
----------
28+
29+
* [SE-0269][]:
30+
31+
When an escaping closure explicitly captures `self` in its capture list, the
32+
use of implicit `self` is enabled within that closure. This means that the
33+
following code is now valid:
34+
35+
```swift
36+
func doStuff(_ stuff: @escaping () -> Void) {}
37+
38+
class C {
39+
var x = 0
40+
41+
func method() {
42+
doStuff { [self] in
43+
x += 1
44+
}
45+
}
46+
}
47+
```
48+
49+
This proposal also introduces new diagnostics for inserting `self` into the
50+
closure's capture list in addition to the existing 'use `self.` explicitly'
51+
fix-it.
52+
2653
Swift 5.2
2754
---------
2855

@@ -172,7 +199,7 @@ Swift 5.2
172199
A method override is no longer allowed to have a generic signature with
173200
requirements not imposed by the base method. For example:
174201

175-
```
202+
```swift
176203
protocol P {}
177204

178205
class Base {
@@ -7856,6 +7883,7 @@ Swift 1.0
78567883
[SE-0252]: <https://github.com/apple/swift-evolution/blob/master/proposals/0252-keypath-dynamic-member-lookup.md>
78577884
[SE-0253]: <https://github.com/apple/swift-evolution/blob/master/proposals/0253-callable.md>
78587885
[SE-0254]: <https://github.com/apple/swift-evolution/blob/master/proposals/0254-static-subscripts.md>
7886+
[SE-0269]: <https://github.com/apple/swift-evolution/blob/master/proposals/0269-implicit-self-explicit-capture.md>
78597887

78607888
[SR-106]: <https://bugs.swift.org/browse/SR-106>
78617889
[SR-419]: <https://bugs.swift.org/browse/SR-419>

CMakeLists.txt

Lines changed: 50 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ if(POLICY CMP0068)
77
cmake_policy(SET CMP0068 OLD)
88
endif()
99

10+
# Honour CMAKE_CXX_STANDARD in try_compile(), needed for check_cxx_native_regex.
11+
if(POLICY CMP0067)
12+
cmake_policy(SET CMP0067 NEW)
13+
endif()
14+
1015
# Add path for custom CMake modules.
1116
list(APPEND CMAKE_MODULE_PATH
1217
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules")
@@ -385,63 +390,6 @@ option(SWIFT_ENABLE_EXPERIMENTAL_DIFFERENTIABLE_PROGRAMMING
385390
# End of user-configurable options.
386391
#
387392

388-
# Look for either a program in execute_process()'s path or for a hardcoded path.
389-
# Find a program's version and set it in the parent scope.
390-
# Replace newlines with spaces so it prints on one line.
391-
function(find_version cmd flag find_in_path)
392-
if(find_in_path)
393-
message(STATUS "Finding installed version for: ${cmd}")
394-
else()
395-
message(STATUS "Finding version for: ${cmd}")
396-
endif()
397-
execute_process(
398-
COMMAND ${cmd} ${flag}
399-
OUTPUT_VARIABLE out
400-
OUTPUT_STRIP_TRAILING_WHITESPACE)
401-
if(NOT out)
402-
if(find_in_path)
403-
message(STATUS "tried to find version for ${cmd}, but ${cmd} not found in path, continuing")
404-
else()
405-
message(FATAL_ERROR "tried to find version for ${cmd}, but ${cmd} not found")
406-
endif()
407-
else()
408-
string(REPLACE "\n" " " out2 ${out})
409-
message(STATUS "Found version: ${out2}")
410-
endif()
411-
message(STATUS "")
412-
endfunction()
413-
414-
# Print out path and version of any installed commands.
415-
# We migth be using the wrong version of a command, so record them all.
416-
function(print_versions)
417-
find_version("${CMAKE_COMMAND}" "--version" TRUE)
418-
419-
message(STATUS "Finding version for: ${CMAKE_COMMAND}")
420-
message(STATUS "Found version: ${CMAKE_VERSION}")
421-
message(STATUS "")
422-
423-
get_filename_component(CMAKE_MAKE_PROGRAM_BN "${CMAKE_MAKE_PROGRAM}" NAME_WE)
424-
if(${CMAKE_MAKE_PROGRAM_BN} STREQUAL "ninja" OR
425-
${CMAKE_MAKE_PROGRAM_BN} STREQUAL "make")
426-
find_version(${CMAKE_MAKE_PROGRAM_BN} "--version" TRUE)
427-
find_version(${CMAKE_MAKE_PROGRAM} "--version" FALSE)
428-
endif()
429-
430-
if(${SWIFT_PATH_TO_CMARK_BUILD})
431-
find_version("cmark" "--version" TRUE)
432-
find_version("${SWIFT_PATH_TO_CMARK_BUILD}/src/cmark" "--version" FALSE)
433-
endif()
434-
435-
message(STATUS "Finding version for: ${CMAKE_C_COMPILER}")
436-
message(STATUS "Found version: ${CMAKE_C_COMPILER_VERSION}")
437-
message(STATUS "")
438-
439-
message(STATUS "Finding version for: ${CMAKE_CXX_COMPILER}")
440-
message(STATUS "Found version: ${CMAKE_CXX_COMPILER_VERSION}")
441-
message(STATUS "")
442-
endfunction()
443-
444-
445393
set(SWIFT_BUILT_STANDALONE FALSE)
446394
if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}")
447395
set(SWIFT_BUILT_STANDALONE TRUE)
@@ -493,7 +441,21 @@ include(CheckCXXSourceRuns)
493441
include(CMakeParseArguments)
494442
include(CMakePushCheckState)
495443

496-
print_versions()
444+
# Print out path and version of any installed commands
445+
message(STATUS "CMake (${CMAKE_COMMAND}) Version: ${CMAKE_VERSION}")
446+
execute_process(COMMAND ${CMAKE_MAKE_PROGRAM} --version
447+
OUTPUT_VARIABLE _CMAKE_MAKE_PROGRAM_VERSION
448+
OUTPUT_STRIP_TRAILING_WHITESPACE)
449+
message(STATUS "CMake Make Program (${CMAKE_MAKE_PROGRAM}) Version: ${_CMAKE_MAKE_PROGRAM_VERSION}")
450+
message(STATUS "C Compiler (${CMAKE_C_COMPILER}) Version: ${CMAKE_C_COMPILER_VERSION}")
451+
message(STATUS "C++ Compiler (${CMAKE_CXX_COMPILER}) Version: ${CMAKE_CXX_COMPILER_VERSION}")
452+
if(SWIFT_PATH_TO_CMARK_BUILD)
453+
execute_process(COMMAND ${SWIFT_PATH_TO_CMARK_BUILD}/src/cmark --version
454+
OUTPUT_VARIABLE _CMARK_VERSION
455+
OUTPUT_STRIP_TRAILING_WHITESPACE)
456+
message(STATUS "CMark Version: ${_CMARK_VERSION}")
457+
endif()
458+
message(STATUS "")
497459

498460
include(SwiftSharedCMakeConfig)
499461

@@ -872,6 +834,9 @@ if(SWIFT_BUILD_STDLIB OR SWIFT_BUILD_SDK_OVERLAY)
872834
message(STATUS "Building Swift runtime with:")
873835
message(STATUS " Leak Detection Checker Entrypoints: ${SWIFT_RUNTIME_ENABLE_LEAK_CHECKER}")
874836
message(STATUS "")
837+
838+
message(STATUS "Differentiable Programming Support: ${SWIFT_ENABLE_EXPERIMENTAL_DIFFERENTIABLE_PROGRAMMING}")
839+
message(STATUS "")
875840
else()
876841
message(STATUS "Not building Swift standard library, SDK overlays, and runtime")
877842
message(STATUS "")
@@ -924,14 +889,24 @@ else()
924889
find_package(LibXml2)
925890
endif()
926891

927-
# You need libedit linked in order to check if you have el_wgets.
928-
cmake_push_check_state()
929-
list(APPEND CMAKE_REQUIRED_LIBRARIES "edit")
930-
check_symbol_exists(el_wgets "histedit.h" HAVE_EL_WGETS)
931-
if(HAVE_EL_WGETS)
932-
set(HAVE_UNICODE_LIBEDIT 1)
892+
if(LLVM_ENABLE_LIBEDIT)
893+
find_package(LibEdit REQUIRED)
894+
else()
895+
find_package(LibEdit)
896+
endif()
897+
898+
if(LibEdit_FOUND)
899+
cmake_push_check_state()
900+
list(APPEND CMAKE_REQUIRED_INCLUDES ${LibEdit_INCLUDE_DIRS})
901+
list(APPEND CMAKE_REQUIRED_LIBRARIES ${LibEdit_LIBRARIES})
902+
check_symbol_exists(el_wgets "histedit.h" HAVE_EL_WGETS)
903+
if(HAVE_EL_WGETS)
904+
set(LibEdit_HAS_UNICODE YES)
905+
else()
906+
set(LibEdit_HAS_UNICODE NO)
907+
endif()
908+
cmake_pop_check_state()
933909
endif()
934-
cmake_pop_check_state()
935910

936911
check_symbol_exists(wait4 "sys/wait.h" HAVE_WAIT4)
937912

@@ -953,10 +928,16 @@ if(SWIFT_BUILD_SYNTAXPARSERLIB OR SWIFT_BUILD_SOURCEKIT)
953928
set(SWIFT_LIBDISPATCH_CXX_COMPILER ${CMAKE_CXX_COMPILER})
954929
elseif(${CMAKE_SYSTEM_NAME} STREQUAL ${CMAKE_HOST_SYSTEM_NAME})
955930
if(CMAKE_SYSTEM_NAME STREQUAL Windows)
956-
set(SWIFT_LIBDISPATCH_C_COMPILER
957-
$<TARGET_FILE_DIR:clang>/clang-cl${CMAKE_EXECUTABLE_SUFFIX})
958-
set(SWIFT_LIBDISPATCH_CXX_COMPILER
959-
$<TARGET_FILE_DIR:clang>/clang-cl${CMAKE_EXECUTABLE_SUFFIX})
931+
if(CMAKE_SYSTEM_PROCESSOR STREQUAL CMAKE_HOST_SYSTEM_PROCESSOR AND
932+
TARGET clang)
933+
set(SWIFT_LIBDISPATCH_C_COMPILER
934+
$<TARGET_FILE_DIR:clang>/clang-cl${CMAKE_EXECUTABLE_SUFFIX})
935+
set(SWIFT_LIBDISPATCH_CXX_COMPILER
936+
$<TARGET_FILE_DIR:clang>/clang-cl${CMAKE_EXECUTABLE_SUFFIX})
937+
else()
938+
set(SWIFT_LIBDISPATCH_C_COMPILER clang-cl${CMAKE_EXECUTABLE_SUFFIX})
939+
set(SWIFT_LIBDISPATCH_CXX_COMPILER clang-cl${CMAKE_EXECUTABLE_SUFFIX})
940+
endif()
960941
else()
961942
set(SWIFT_LIBDISPATCH_C_COMPILER $<TARGET_FILE_DIR:clang>/clang)
962943
set(SWIFT_LIBDISPATCH_CXX_COMPILER $<TARGET_FILE_DIR:clang>/clang++)

0 commit comments

Comments
 (0)