Skip to content

Commit 4e45358

Browse files
authored
Merge branch 'master' into nc-dwformatting
2 parents 1952128 + 0c44bbd commit 4e45358

File tree

467 files changed

+13702
-11546
lines changed

Some content is hidden

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

467 files changed

+13702
-11546
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -783,7 +783,7 @@ if(SWIFT_PARALLEL_LINK_JOBS)
783783
endif()
784784

785785
# Set the CMAKE_OSX_* variables in a way that minimizes conflicts.
786-
if("${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin")
786+
if("${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin" AND NOT CMAKE_CROSSCOMPILING)
787787
set(CMAKE_OSX_SYSROOT "${SWIFT_SDK_${SWIFT_HOST_VARIANT_SDK}_PATH}")
788788
set(CMAKE_OSX_ARCHITECTURES "")
789789
set(CMAKE_OSX_DEPLOYMENT_TARGET "")

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ discussed below.
5555
macOS, Ubuntu Linux LTS, and the latest Ubuntu Linux release are the current
5656
supported host development operating systems.
5757

58-
For macOS, you need [Xcode 9.0 beta 2](https://developer.apple.com/xcode/downloads/).
58+
For macOS, you need [Xcode 9.0 beta 4](https://developer.apple.com/xcode/downloads/).
5959

6060
<a name="linux-dependencies"></a>For Ubuntu, you'll need the following
6161
development dependencies:

benchmark/single-source/CString.swift

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ public func run_StringWithCString(_ N: Int) {
3030

3131
@inline(never)
3232
public func run_CStringLongAscii(_ N: Int) {
33-
let refResult = 517492
3433
var res: UInt = 0
3534
for _ in 1...N*500 {
3635
// static string to c -> from c to String -> implicit conversion
@@ -41,7 +40,6 @@ public func run_CStringLongAscii(_ N: Int) {
4140

4241
@inline(never)
4342
public func run_CStringLongNonAscii(_ N: Int) {
44-
let refResult = 517492
4543
var res: UInt = 0
4644
for _ in 1...N*500 {
4745
res &= strlen(japanese.withCString(String.init(cString:)))

benchmark/single-source/DictionarySwap.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public func run_DictionarySwap(_ N: Int) {
2727

2828
var swapped = false
2929
for _ in 1...10000*N {
30-
swap(&dict[25]!, &dict[75]!)
30+
(dict[25], dict[75]) = (dict[75]!, dict[25]!)
3131
swapped = !swapped
3232
if !swappedCorrectly(swapped, dict[25]!, dict[75]!) {
3333
break
@@ -72,7 +72,9 @@ public func run_DictionarySwapOfObjects(_ N: Int) {
7272

7373
var swapped = false
7474
for _ in 1...10000*N {
75-
swap(&dict[Box(25)]!, &dict[Box(75)]!)
75+
let b1 = Box(25)
76+
let b2 = Box(75)
77+
(dict[b1], dict[b2]) = (dict[b2]!, dict[b1]!)
7678
swapped = !swapped
7779
if !swappedCorrectly(swapped, dict[Box(25)]!.value, dict[Box(75)]!.value) {
7880
break

benchmark/single-source/ExistentialPerformance.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,7 @@ func runTestArrayShift<T: Existential>(withType: T.Type, numberOfTimes N: Int) {
326326
for _ in 0 ..< N {
327327
for _ in 0 ..< 5_000 {
328328
for i in 0 ..< existentialArray.count-1 {
329-
swap(&existentialArray[i], &existentialArray[i+1])
329+
existentialArray.swapAt(i, i+1)
330330
}
331331
}
332332
}

cmake/modules/AddSwift.cmake

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1553,9 +1553,17 @@ function(add_swift_library name)
15531553
endif()
15541554

15551555
# Add PrivateFrameworks, rdar://28466433
1556+
set(swiftlib_link_flags_all ${SWIFTLIB_LINK_FLAGS})
15561557
if(SWIFTLIB_IS_SDK_OVERLAY)
15571558
list(APPEND swiftlib_swift_compile_flags_all "-Fsystem" "${SWIFT_SDK_${sdk}_PATH}/System/Library/PrivateFrameworks/")
15581559
endif()
1560+
1561+
if("${sdk}" STREQUAL "IOS_SIMULATOR")
1562+
if("${name}" STREQUAL "swiftMediaPlayer")
1563+
message("DISABLING AUTOLINK FOR swiftMediaPlayer")
1564+
list(APPEND swiftlib_link_flags_all "-Xlinker" "-ignore_auto_link")
1565+
endif()
1566+
endif()
15591567

15601568
# Add this library variant.
15611569
_add_swift_library_single(
@@ -1576,7 +1584,7 @@ function(add_swift_library name)
15761584
FILE_DEPENDS ${SWIFTLIB_FILE_DEPENDS} ${swiftlib_module_dependency_targets}
15771585
C_COMPILE_FLAGS ${SWIFTLIB_C_COMPILE_FLAGS}
15781586
SWIFT_COMPILE_FLAGS ${swiftlib_swift_compile_flags_all}
1579-
LINK_FLAGS ${SWIFTLIB_LINK_FLAGS}
1587+
LINK_FLAGS ${swiftlib_link_flags_all}
15801588
PRIVATE_LINK_LIBRARIES ${swiftlib_private_link_libraries_targets}
15811589
INCORPORATE_OBJECT_LIBRARIES ${SWIFTLIB_INCORPORATE_OBJECT_LIBRARIES}
15821590
INCORPORATE_OBJECT_LIBRARIES_SHARED_ONLY ${SWIFTLIB_INCORPORATE_OBJECT_LIBRARIES_SHARED_ONLY}

cmake/modules/AddSwiftTableGen.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ include(TableGen)
33
# This needs to be a macro since tablegen (which is a function) needs to set
44
# variables in its parent scope.
55
macro(swift_tablegen)
6-
tablegen(SWIFT ${ARGN})
6+
tablegen(LLVM ${ARGN})
77
endmacro()
88

99
# This needs to be a macro since add_public_tablegen_target (which is a

cmake/modules/SwiftHandleGybSources.cmake

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,20 @@ function(handle_gyb_sources dependency_out_var_name sources_var_name arch)
118118
"${SWIFT_SOURCE_DIR}/utils/UnicodeData/GraphemeBreakTest.txt"
119119
"${SWIFT_SOURCE_DIR}/utils/gyb_stdlib_support.py"
120120
"${SWIFT_SOURCE_DIR}/utils/gyb_stdlib_unittest_support.py"
121-
)
121+
"${SWIFT_SOURCE_DIR}/utils/gyb_syntax_support/__init__.py"
122+
"${SWIFT_SOURCE_DIR}/utils/gyb_syntax_support/Child.py"
123+
"${SWIFT_SOURCE_DIR}/utils/gyb_syntax_support/kinds.py"
124+
"${SWIFT_SOURCE_DIR}/utils/gyb_syntax_support/Node.py"
125+
"${SWIFT_SOURCE_DIR}/utils/gyb_syntax_support/AttributeNodes.py"
126+
"${SWIFT_SOURCE_DIR}/utils/gyb_syntax_support/CommonNodes.py"
127+
"${SWIFT_SOURCE_DIR}/utils/gyb_syntax_support/DeclNodes.py"
128+
"${SWIFT_SOURCE_DIR}/utils/gyb_syntax_support/ExprNodes.py"
129+
"${SWIFT_SOURCE_DIR}/utils/gyb_syntax_support/GenericNodes.py"
130+
"${SWIFT_SOURCE_DIR}/utils/gyb_syntax_support/PatternNodes.py"
131+
"${SWIFT_SOURCE_DIR}/utils/gyb_syntax_support/StmtNodes.py"
132+
"${SWIFT_SOURCE_DIR}/utils/gyb_syntax_support/TypeNodes.py"
133+
"${SWIFT_SOURCE_DIR}/utils/gyb_syntax_support/Token.py")
134+
122135
foreach (src ${${sources_var_name}})
123136
string(REGEX REPLACE "[.]gyb$" "" src_sans_gyb "${src}")
124137
if(src STREQUAL src_sans_gyb)
@@ -153,3 +166,16 @@ function(handle_gyb_sources dependency_out_var_name sources_var_name arch)
153166
set("${dependency_out_var_name}" "${dependency_targets}" PARENT_SCOPE)
154167
set("${sources_var_name}" "${de_gybbed_sources}" PARENT_SCOPE)
155168
endfunction()
169+
170+
function(add_gyb_target target sources)
171+
set(options)
172+
set(single_value_args ARCH)
173+
set(multi_value_args)
174+
cmake_parse_arguments(GYB
175+
"${options}" "${single_value_args}" "${multi_value_args}" ${ARGN})
176+
177+
handle_gyb_sources(gyb_sources_depends sources "${GYB_ARCH}")
178+
179+
add_custom_target(${target}
180+
DEPENDS "${gyb_sources_depends}")
181+
endfunction()

cmake/modules/SwiftSharedCMakeConfig.cmake

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,9 @@ macro(swift_common_standalone_build_config_llvm product is_cross_compiling)
6868
set(${product}_NATIVE_LLVM_TOOLS_PATH "${LLVM_TOOLS_BINARY_DIR}")
6969
endif()
7070

71-
find_program(SWIFT_TABLEGEN_EXE "llvm-tblgen" "${${product}_NATIVE_LLVM_TOOLS_PATH}"
71+
find_program(LLVM_TABLEGEN_EXE "llvm-tblgen" "${${product}_NATIVE_LLVM_TOOLS_PATH}"
7272
NO_DEFAULT_PATH)
73-
if ("${SWIFT_TABLEGEN_EXE}" STREQUAL "SWIFT_TABLEGEN_EXE-NOTFOUND")
73+
if ("${LLVM_TABLEGEN_EXE}" STREQUAL "LLVM_TABLEGEN_EXE-NOTFOUND")
7474
message(FATAL_ERROR "Failed to find tablegen in ${${product}_NATIVE_LLVM_TOOLS_PATH}")
7575
endif()
7676

@@ -219,7 +219,6 @@ macro(swift_common_unified_build_config product)
219219
set(${product}_NATIVE_LLVM_TOOLS_PATH "${CMAKE_BINARY_DIR}/bin")
220220
set(${product}_NATIVE_CLANG_TOOLS_PATH "${CMAKE_BINARY_DIR}/bin")
221221
set(LLVM_PACKAGE_VERSION ${PACKAGE_VERSION})
222-
set(SWIFT_TABLEGEN_EXE llvm-tblgen)
223222
set(LLVM_CMAKE_DIR "${CMAKE_SOURCE_DIR}/cmake/modules")
224223

225224
# If cmark was checked out into tools/cmark, expect to build it as
@@ -257,6 +256,11 @@ endmacro()
257256
# Common cmake project config for additional warnings.
258257
#
259258
macro(swift_common_cxx_warnings)
259+
# Make unhandled switch cases be an error in assert builds
260+
if(DEFINED LLVM_ENABLE_ASSERTIONS)
261+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror=switch")
262+
endif()
263+
260264
check_cxx_compiler_flag("-Werror -Wdocumentation" CXX_SUPPORTS_DOCUMENTATION_FLAG)
261265
append_if(CXX_SUPPORTS_DOCUMENTATION_FLAG "-Wdocumentation" CMAKE_CXX_FLAGS)
262266

0 commit comments

Comments
 (0)