Skip to content

Commit e1f8af2

Browse files
committed
Merge remote-tracking branch 'upstream/master' into a-couple-of-tangents
2 parents a3ead02 + a1b2811 commit e1f8af2

File tree

368 files changed

+14526
-5730
lines changed

Some content is hidden

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

368 files changed

+14526
-5730
lines changed

CMakeLists.txt

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -845,14 +845,18 @@ if("${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin" AND NOT CMAKE_CROSSCOMPILING)
845845
set(CMAKE_OSX_DEPLOYMENT_TARGET "")
846846
endif()
847847

848-
message(STATUS "Building host Swift tools for ${SWIFT_HOST_VARIANT_SDK} ${SWIFT_HOST_VARIANT_ARCH}")
849-
message(STATUS " Build type: ${CMAKE_BUILD_TYPE}")
850-
message(STATUS " Assertions: ${LLVM_ENABLE_ASSERTIONS}")
851-
message(STATUS " LTO: ${SWIFT_TOOLS_ENABLE_LTO}")
852-
message(STATUS "")
853-
854-
if (SWIFT_BUILD_STDLIB OR SWIFT_BUILD_SDK_OVERLAY)
848+
if(SWIFT_INCLUDE_TOOLS)
849+
message(STATUS "Building host Swift tools for ${SWIFT_HOST_VARIANT_SDK} ${SWIFT_HOST_VARIANT_ARCH}")
850+
message(STATUS " Build type: ${CMAKE_BUILD_TYPE}")
851+
message(STATUS " Assertions: ${LLVM_ENABLE_ASSERTIONS}")
852+
message(STATUS " LTO: ${SWIFT_TOOLS_ENABLE_LTO}")
853+
message(STATUS "")
854+
else()
855+
message(STATUS "Not building host Swift tools")
856+
message(STATUS "")
857+
endif()
855858

859+
if(SWIFT_BUILD_STDLIB OR SWIFT_BUILD_SDK_OVERLAY)
856860
message(STATUS "Building Swift standard library and overlays for SDKs: ${SWIFT_SDKS}")
857861
message(STATUS " Build type: ${SWIFT_STDLIB_BUILD_TYPE}")
858862
message(STATUS " Assertions: ${SWIFT_STDLIB_ASSERTIONS}")
@@ -861,12 +865,9 @@ if (SWIFT_BUILD_STDLIB OR SWIFT_BUILD_SDK_OVERLAY)
861865
message(STATUS "Building Swift runtime with:")
862866
message(STATUS " Leak Detection Checker Entrypoints: ${SWIFT_RUNTIME_ENABLE_LEAK_CHECKER}")
863867
message(STATUS "")
864-
865868
else()
866-
867869
message(STATUS "Not building Swift standard library, SDK overlays, and runtime")
868870
message(STATUS "")
869-
870871
endif()
871872

872873
#

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ Instructions for installing CMake and Ninja directly can be found [below](#build
9898

9999
For Ubuntu, you'll need the following development dependencies:
100100

101-
sudo apt-get install git cmake ninja-build clang python uuid-dev libicu-dev icu-devtools libbsd-dev libedit-dev libxml2-dev libsqlite3-dev swig libpython-dev libncurses5-dev pkg-config libblocksruntime-dev libcurl4-openssl-dev systemtap-sdt-dev tzdata rsync
101+
sudo apt-get install git cmake ninja-build clang python uuid-dev libicu-dev icu-devtools libedit-dev libxml2-dev libsqlite3-dev swig libpython-dev libncurses5-dev pkg-config libcurl4-openssl-dev systemtap-sdt-dev tzdata rsync
102102

103103
**Note:** LLDB currently requires at least `swig-1.3.40` but will successfully build
104104
with version 2 shipped with Ubuntu.

cmake/modules/AddSwift.cmake

Lines changed: 30 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -462,10 +462,10 @@ function(_add_variant_link_flags)
462462
list(APPEND link_libraries "bsd" "atomic")
463463
list(APPEND result "-Wl,-Bsymbolic")
464464
elseif("${LFLAGS_SDK}" STREQUAL "ANDROID")
465-
list(APPEND link_libraries "dl" "log" "atomic" "icudataswift" "icui18nswift" "icuucswift")
466-
# We provide our own C++ below, so we ask the linker not to do it. However,
467-
# we need to add the math library, which is linked implicitly by libc++.
468-
list(APPEND result "-nostdlib++" "-lm")
465+
list(APPEND link_libraries "dl" "log" "atomic")
466+
# We need to add the math library, which is linked implicitly by libc++
467+
list(APPEND result "-lm")
468+
469469
if("${LFLAGS_ARCH}" MATCHES armv7)
470470
set(android_libcxx_path "${SWIFT_ANDROID_NDK_PATH}/sources/cxx-stl/llvm-libc++/libs/armeabi-v7a")
471471
elseif("${LFLAGS_ARCH}" MATCHES aarch64)
@@ -477,8 +477,17 @@ function(_add_variant_link_flags)
477477
else()
478478
message(SEND_ERROR "unknown architecture (${LFLAGS_ARCH}) for android")
479479
endif()
480-
list(APPEND link_libraries "${android_libcxx_path}/libc++abi.a")
481-
list(APPEND link_libraries "${android_libcxx_path}/libc++_shared.so")
480+
481+
# link against the custom C++ library
482+
list(APPEND link_libraries
483+
${android_libcxx_path}/libc++abi.a
484+
${android_libcxx_path}/libc++_shared.so)
485+
486+
# link against the ICU libraries
487+
list(APPEND link_libraries
488+
${SWIFT_ANDROID_${LFLAGS_ARCH}_ICU_I18N}
489+
${SWIFT_ANDROID_${LFLAGS_ARCH}_ICU_UC})
490+
482491
swift_android_lib_for_arch(${LFLAGS_ARCH} ${LFLAGS_ARCH}_LIB)
483492
foreach(path IN LISTS ${LFLAGS_ARCH}_LIB)
484493
list(APPEND library_search_directories ${path})
@@ -517,8 +526,12 @@ function(_add_variant_link_flags)
517526
NOT "${CMAKE_SYSTEM_NAME}" STREQUAL "WINDOWS"))
518527
list(APPEND result "-fuse-ld=lld")
519528
elseif(SWIFT_ENABLE_GOLD_LINKER AND
520-
"${SWIFT_SDK_${LFLAGS_SDK}_OBJECT_FORMAT}" STREQUAL "ELF")
521-
list(APPEND result "-fuse-ld=gold")
529+
"${SWIFT_SDK_${LFLAGS_SDK}_OBJECT_FORMAT}" STREQUAL "ELF")
530+
if(CMAKE_HOST_SYSTEM_NAME STREQUAL Windows)
531+
list(APPEND result "-fuse-ld=gold.exe")
532+
else()
533+
list(APPEND result "-fuse-ld=gold")
534+
endif()
522535
endif()
523536
endif()
524537

@@ -1367,8 +1380,16 @@ function(_add_swift_library_single target name)
13671380
${SWIFTLIB_SINGLE_PRIVATE_LINK_LIBRARIES})
13681381
endif()
13691382

1370-
set_property(TARGET "${target}" PROPERTY
1383+
# NOTE(compnerd) use the C linker language to invoke `clang` rather than
1384+
# `clang++` as we explicitly link against the C++ runtime. We were previously
1385+
# actually passing `-nostdlib++` to avoid the C++ runtime linkage.
1386+
if("${SWIFTLIB_SINGLE_SDK}" STREQUAL "ANDROID")
1387+
set_property(TARGET "${target}" PROPERTY
1388+
LINKER_LANGUAGE "C")
1389+
else()
1390+
set_property(TARGET "${target}" PROPERTY
13711391
LINKER_LANGUAGE "CXX")
1392+
endif()
13721393

13731394
if(target_static)
13741395
set_property(TARGET "${target_static}" APPEND_STRING PROPERTY

cmake/modules/SwiftConfigureSDK.cmake

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ function(_report_sdk prefix)
2828
message(STATUS " ${arch} LIB: ${${arch}_LIB}")
2929
endforeach()
3030
elseif("${prefix}" STREQUAL "ANDROID")
31-
message(STATUS " NDK Dir: $ENV{SWIFT_ANDROID_NDK_PATH}")
31+
message(STATUS " NDK: $ENV{SWIFT_ANDROID_NDK_PATH}")
3232
foreach(arch ${SWIFT_SDK_${prefix}_ARCHITECTURES})
3333
swift_android_include_for_arch(${arch} ${arch}_INCLUDE)
3434
swift_android_lib_for_arch(${arch} ${arch}_LIB)
@@ -225,10 +225,14 @@ macro(configure_sdk_unix name architectures)
225225
endif()
226226

227227
# Get the prebuilt suffix to create the correct toolchain path when using the NDK
228-
if("${CMAKE_HOST_SYSTEM_NAME}" STREQUAL "Darwin")
229-
set(_swift_android_prebuilt_build "darwin-x86_64")
230-
elseif("${CMAKE_HOST_SYSTEM_NAME}" STREQUAL "Linux")
231-
set(_swift_android_prebuilt_build "linux-x86_64")
228+
if(CMAKE_HOST_SYSTEM_NAME STREQUAL Darwin)
229+
set(_swift_android_prebuilt_build darwin-x86_64)
230+
elseif(CMAKE_HOST_SYSTEM_NAME STREQUAL Linux)
231+
set(_swift_android_prebuilt_build linux-x86_64)
232+
elseif(CMAKE_HOST_SYSTEM_NAME STREQUAL Windows)
233+
set(_swift_android_prebuilt_build Windows-x86_64)
234+
else()
235+
message(SEND_ERROR "cannot cross-compile to android from ${CMAKE_HOST_SYSTEM_NAME}")
232236
endif()
233237
if("${arch}" STREQUAL "i686")
234238
set(SWIFT_SDK_ANDROID_ARCH_${arch}_NDK_PREBUILT_PATH

cmake/modules/SwiftSource.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,7 @@ function(_compile_swift_files
269269
# into the new runtime.
270270
if (SWIFTFILE_IS_STDLIB OR SWIFTFILE_IS_SDK_OVERLAY)
271271
list(APPEND swift_flags "-runtime-compatibility-version" "none")
272+
list(APPEND swift_flags "-disable-autolinking-runtime-compatibility-dynamic-replacements")
272273
endif()
273274

274275
if (SWIFTFILE_IS_STDLIB_CORE OR SWIFTFILE_IS_SDK_OVERLAY)

docs/ABI/Mangling.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -512,6 +512,7 @@ Types
512512
FUNCTION-KIND ::= 'U' // uncurried function type (currently not used)
513513
FUNCTION-KIND ::= 'K' // @auto_closure function type (noescape)
514514
FUNCTION-KIND ::= 'B' // objc block function type
515+
FUNCTION-KIND ::= 'L' // objc block function type (escaping) (DWARF only; otherwise use 'B')
515516
FUNCTION-KIND ::= 'C' // C function pointer type
516517
FUNCTION-KIND ::= 'A' // @auto_closure function type (escaping)
517518
FUNCTION-KIND ::= 'E' // function type (noescape)

docs/WindowsBuild.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -355,8 +355,8 @@ cmake -G Ninja^
355355
-DFOUNDATION_BUILD_DIR=S:\b\foundation^
356356
-DLIBDISPATCH_BUILD_DIR=S:\b\libdispatch^
357357
-DLIBDISPATCH_SOURCE_DIR=S:\swift-corelibs-libdispatch^
358-
-DLLBUILD_PATH_TO_SQLITE_SOURCE=S:\sqlite-amalgamation-3270200^
359-
-DLLBUILD_PATH_TO_SQLITE_BUILD=S:\b\sqlite^
358+
-DSQLite3_INCLUDE_DIR=S:\sqlite-amalgamation-3270200^
359+
-DSQLite3_LIBRARY=S:\b\sqlite\sqlite3.lib^
360360
-DLLBUILD_SUPPORT_BINDINGS=Swift^
361361
S:\llbuild
362362
ninja

include/swift/AST/ASTContext.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -590,6 +590,10 @@ class ASTContext final {
590590
/// Get the runtime availability of the opaque types language feature for the target platform.
591591
AvailabilityContext getOpaqueTypeAvailability();
592592

593+
/// Get the runtime availability of features introduced in the Swift 5.1
594+
/// compiler for the target platform.
595+
AvailabilityContext getSwift51Availability();
596+
593597
//===--------------------------------------------------------------------===//
594598
// Diagnostics Helper functions
595599
//===--------------------------------------------------------------------===//

0 commit comments

Comments
 (0)