Skip to content

Commit 0525389

Browse files
authored
---
yaml --- r: 341341 b: refs/heads/rxwei-patch-1 c: ae065ff h: refs/heads/master i: 341339: 2efae59
1 parent 14fa55d commit 0525389

File tree

68 files changed

+753
-343
lines changed

Some content is hidden

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

68 files changed

+753
-343
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1015,7 +1015,7 @@ refs/tags/swift-DEVELOPMENT-SNAPSHOT-2018-08-18-a: b10b1fce14385faa6d44f6b933e95
10151015
refs/heads/rdar-43033749-fix-batch-mode-no-diags-swift-5.0-branch: a14e64eaad30de89f0f5f0b2a782eed7ecdcb255
10161016
refs/heads/revert-19006-error-bridging-integer-type: 8a9065a3696535305ea53fe9b71f91cbe6702019
10171017
refs/heads/revert-19050-revert-19006-error-bridging-integer-type: ecf752d54b05dd0a20f510f0bfa54a3fec3bcaca
1018-
refs/heads/rxwei-patch-1: 591482114d0f2c3d03e4301443cf1b865828683d
1018+
refs/heads/rxwei-patch-1: ae065ff2a5d0c4dc971cce3c6ab3f75e2ac34c5a
10191019
refs/heads/shahmishal-patch-1: e58ec0f7488258d42bef51bc3e6d7b3dc74d7b2a
10201020
refs/heads/typelist-existential: 4046359efd541fb5c72d69a92eefc0a784df8f5e
10211021
refs/tags/swift-4.2-DEVELOPMENT-SNAPSHOT-2018-08-20-a: 4319ba09e4fb8650ee86061075c74a016b6baab9

branches/rxwei-patch-1/benchmark/single-source/AngryPhonebook.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
// This test is based on single-source/Phonebook, with
1414
// to test uppercase and lowercase ASCII string fast paths.
1515
import TestsUtils
16-
import Foundation
1716

1817
public let AngryPhonebook = BenchmarkInfo(
1918
name: "AngryPhonebook",

branches/rxwei-patch-1/benchmark/single-source/BinaryFloatingPointConversionFromBinaryInteger.swift

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
// This test checks performance of generic binary floating-point conversion from
1414
// a binary integer.
1515

16-
import Foundation
1716
import TestsUtils
1817

1918
#if swift(>=4.2)
@@ -110,7 +109,7 @@ extension MockBinaryInteger : BinaryInteger {
110109
var trailingZeroBitCount: Int {
111110
return _value.trailingZeroBitCount
112111
}
113-
112+
114113
func isMultiple(of other: MockBinaryInteger<T>) -> Bool {
115114
return _value.isMultiple(of: other._value)
116115
}
@@ -211,4 +210,3 @@ public func run_BinaryFloatingPointConversionFromBinaryInteger(_ N: Int) {
211210
}
212211

213212
#endif
214-

branches/rxwei-patch-1/benchmark/single-source/BinaryFloatingPointProperties.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
//
1111
//===----------------------------------------------------------------------===//
1212

13-
import Foundation
1413
import TestsUtils
1514

1615
public let BinaryFloatingPointPropertiesBinade = BenchmarkInfo(

branches/rxwei-patch-1/benchmark/single-source/BitCount.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
// This test checks performance of Swift bit count.
1414
// and mask operator.
1515
// rdar://problem/22151678
16-
import Foundation
1716
import TestsUtils
1817

1918
public let BitCount = BenchmarkInfo(

branches/rxwei-patch-1/benchmark/single-source/BucketSort.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,16 @@
1616
// https://github.com/raywenderlich/swift-algorithm-club/tree/master/Bucket%20Sort
1717
//
1818
// It sorts an array of generic `SortableItem`s. If the type of `sortingAlgo`
19-
// is not known to the call site at line 90, the `sort` method can not be
19+
// is not known to the call site at line 89, the `sort` method can not be
2020
// specialized to integer array sorting, which will lead to a huge performance
2121
// loss. Since `SortingAlgorithm` and `InsertionSort` are declared to be
22-
// `public` and the lines 89-91 can not be inlined in `bucketSort` (due to
22+
// `public` and the lines 88-90 can not be inlined in `bucketSort` (due to
2323
// inlining heuristic limitations), compiler without ExistentialSpecializer
2424
// optimization can not achieve this feat. With ExistentialSpecializer which
2525
// enables generic specialization recursively in a call chain, we're able to
26-
// specialize line 90 for `InsertionSort` on integers.
26+
// specialize line 89 for `InsertionSort` on integers.
2727

2828
import TestsUtils
29-
import Foundation
3029

3130
public let BucketSort = BenchmarkInfo(
3231
name: "BucketSort",
@@ -117,7 +116,8 @@ let items: [Int] = {
117116
let buckets: [Bucket<Int>] = {
118117
let bucketCount = 10
119118
let maxValue = items.max()!.convertToInt()
120-
let maxCapacity = Int(ceil(Double(maxValue + 1) / Double(bucketCount)))
119+
let maxCapacity = Int(
120+
(Double(maxValue + 1) / Double(bucketCount)).rounded(.up))
121121
return (0..<bucketCount).map { _ in Bucket<Int>(capacity: maxCapacity) }
122122
}()
123123

branches/rxwei-patch-1/benchmark/single-source/ByteSwap.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
// This test checks performance of Swift byte swap.
1414
// rdar://problem/22151907
1515

16-
import Foundation
1716
import TestsUtils
1817

1918
public let ByteSwap = BenchmarkInfo(

branches/rxwei-patch-1/benchmark/single-source/CString.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
import TestsUtils
1414
#if os(Linux)
1515
import Glibc
16+
#elseif os(Windows)
17+
import MSVCRT
1618
#else
1719
import Darwin
1820
#endif

branches/rxwei-patch-1/benchmark/single-source/Calculator.swift

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
//===----------------------------------------------------------------------===//
1212

1313
import TestsUtils
14-
import Foundation
1514

1615
public let Calculator = BenchmarkInfo(
1716
name: "Calculator",
@@ -53,4 +52,3 @@ public func run_Calculator(_ N: Int) {
5352
}
5453
CheckResults(c == 0)
5554
}
56-

branches/rxwei-patch-1/benchmark/single-source/Hanoi.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212

1313
// This test checks performance of Swift hanoi tower.
1414
// <rdar://problem/22151932>
15-
import Foundation
1615
import TestsUtils
1716

1817
public let Hanoi = BenchmarkInfo(

branches/rxwei-patch-1/benchmark/single-source/OpenClose.swift

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@
1111
//===----------------------------------------------------------------------===//
1212

1313
import TestsUtils
14-
import Foundation
15-
1614

1715
// A micro benchmark for checking the speed of string-based enums.
1816
public let OpenClose = BenchmarkInfo(
@@ -38,4 +36,3 @@ public func run_OpenClose(_ N: Int) {
3836
}
3937
CheckResults(c == 0)
4038
}
41-

branches/rxwei-patch-1/benchmark/single-source/ProtocolDispatch2.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515

1616

1717
import TestsUtils
18-
import Foundation
1918

2019
public let ProtocolDispatch2 = BenchmarkInfo(
2120
name: "ProtocolDispatch2",

branches/rxwei-patch-1/benchmark/single-source/RGBHistogram.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
//
1616
// Description:
1717
// Create a sorted sparse RGB histogram from an array of 300 RGB values.
18-
import Foundation
1918
import TestsUtils
2019

2120
public let RGBHistogram = [

branches/rxwei-patch-1/benchmark/single-source/Radix2CooleyTukey.swift

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,13 @@
22
//
33
// Originally written by @owensd. Used with his permission.
44

5-
import Foundation
5+
#if os(Linux)
6+
import Glibc
7+
#elseif os(Windows)
8+
import MSVCRT
9+
#else
10+
import Darwin
11+
#endif
612
import TestsUtils
713

814
public var Radix2CooleyTukey = [

branches/rxwei-patch-1/benchmark/single-source/ReduceInto.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
//===----------------------------------------------------------------------===//
1212

1313
import TestsUtils
14-
import Foundation
1514

1615
public let ReduceInto = [
1716
BenchmarkInfo(name: "FilterEvenUsingReduce", runFunction: run_FilterEvenUsingReduce, tags: [.validation, .api], legacyFactor: 10),

branches/rxwei-patch-1/benchmark/single-source/SortLettersInPlace.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212

1313
// This test checks performance and correctness of Swift sortInPlace on an
1414
// array of letters.
15-
import Foundation
1615
import TestsUtils
1716

1817
public let SortLettersInPlace = BenchmarkInfo(

branches/rxwei-patch-1/benchmark/single-source/StringEdits.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
import TestsUtils
1414
#if os(Linux)
1515
import Glibc
16+
#elseif os(Windows)
17+
import MSVCRT
1618
#else
1719
import Darwin
1820
#endif

branches/rxwei-patch-1/benchmark/single-source/StringMatch.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
import TestsUtils
1414
#if os(Linux)
1515
import Glibc
16+
#elseif os(Windows)
17+
import MSVCRT
1618
#else
1719
import Darwin
1820
#endif

branches/rxwei-patch-1/benchmark/single-source/Walsh.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
import TestsUtils
1414
#if os(Linux)
1515
import Glibc
16+
#elseif os(Windows)
17+
import MSVCRT
1618
#else
1719
import Darwin
1820
#endif
@@ -89,4 +91,3 @@ public func run_Walsh(_ N: Int) {
8991
InverseWalshTransform(&data2)
9092
}
9193
}
92-

branches/rxwei-patch-1/benchmark/utils/ArgParse.swift

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,13 @@
1010
//
1111
//===----------------------------------------------------------------------===//
1212

13-
import Foundation
13+
#if os(Linux)
14+
import Glibc
15+
#elseif os(Windows)
16+
import MSVCRT
17+
#else
18+
import Darwin
19+
#endif
1420

1521
enum ArgumentError: Error {
1622
case missingValue(String)

branches/rxwei-patch-1/benchmark/utils/DriverUtils.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212

1313
#if os(Linux)
1414
import Glibc
15+
#elseif os(Windows)
16+
import MSVCRT
1517
#else
1618
import Darwin
1719
import LibProc

branches/rxwei-patch-1/benchmark/utils/TestsUtils.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212

1313
#if os(Linux)
1414
import Glibc
15+
#elseif os(Windows)
16+
import MSVCRT
1517
#else
1618
import Darwin
1719
#endif

branches/rxwei-patch-1/cmake/modules/SwiftConfigureSDK.cmake

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -252,9 +252,8 @@ macro(configure_sdk_unix name architectures)
252252
"${SWIFT_ANDROID_NDK_PATH}/toolchains/${SWIFT_SDK_ANDROID_ARCH_${arch}_NDK_TRIPLE}-${SWIFT_ANDROID_NDK_GCC_VERSION}/prebuilt/${_swift_android_prebuilt_build}")
253253
endif()
254254
else()
255-
if(NOT SWIFT_SDK_${prefix}_ARCH_${arch}_PATH)
256-
set(SWIFT_SDK_${prefix}_ARCH_${arch}_PATH "/")
257-
endif()
255+
set(SWIFT_SDK_${prefix}_ARCH_${arch}_PATH "/" CACHE STRING "CMAKE_SYSROOT for ${prefix} ${arch}")
256+
258257
if("${prefix}" STREQUAL "HAIKU")
259258
set(SWIFT_SDK_HAIKU_ARCH_${arch}_LIBC_INCLUDE_DIRECTORY "/system/develop/headers/posix" CACHE STRING "Path to C library headers")
260259
set(SWIFT_SDK_HAIKU_ARCH_${arch}_LIBC_ARCHITECTURE_INCLUDE_DIRECTORY "/system/develop/headers" CACHE STRING "Path to C library architecture headers")

branches/rxwei-patch-1/include/swift/ABI/Metadata.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1495,7 +1495,11 @@ struct TargetTupleTypeMetadata : public TargetMetadata<Runtime> {
14951495
ConstTargetMetadataPointer<Runtime, swift::TargetMetadata> Type;
14961496

14971497
/// The offset of the tuple element within the tuple.
1498+
#if __APPLE__
14981499
StoredSize Offset;
1500+
#else
1501+
uint32_t Offset;
1502+
#endif
14991503

15001504
OpaqueValue *findIn(OpaqueValue *tuple) const {
15011505
return (OpaqueValue*) (((char*) tuple) + Offset);
@@ -1506,6 +1510,9 @@ struct TargetTupleTypeMetadata : public TargetMetadata<Runtime> {
15061510
}
15071511
};
15081512

1513+
static_assert(sizeof(Element) == sizeof(StoredSize) * 2,
1514+
"element size should be two words");
1515+
15091516
Element *getElements() {
15101517
return reinterpret_cast<Element*>(this + 1);
15111518
}

branches/rxwei-patch-1/include/swift/AST/AnyFunctionRef.h

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,20 @@ class AnyFunctionRef {
5252
}
5353
}
5454

55-
CaptureInfo &getCaptureInfo() const {
55+
const CaptureInfo &getCaptureInfo() const {
5656
if (auto *AFD = TheFunction.dyn_cast<AbstractFunctionDecl *>())
5757
return AFD->getCaptureInfo();
5858
return TheFunction.get<AbstractClosureExpr *>()->getCaptureInfo();
5959
}
6060

61+
void setCaptureInfo(const CaptureInfo &captures) const {
62+
if (auto *AFD = TheFunction.dyn_cast<AbstractFunctionDecl *>()) {
63+
AFD->setCaptureInfo(captures);
64+
return;
65+
}
66+
TheFunction.get<AbstractClosureExpr *>()->setCaptureInfo(captures);
67+
}
68+
6169
void getLocalCaptures(SmallVectorImpl<CapturedValue> &Result) const {
6270
getCaptureInfo().getLocalCaptures(Result);
6371
}

branches/rxwei-patch-1/include/swift/AST/CaptureInfo.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,9 +126,9 @@ class CaptureInfo {
126126
: Captures(nullptr), DynamicSelf(nullptr), OpaqueValue(nullptr), Count(0),
127127
GenericParamCaptures(0), Computed(0) { }
128128

129-
bool hasBeenComputed() { return Computed; }
129+
bool hasBeenComputed() const { return Computed; }
130130

131-
bool isTrivial() {
131+
bool isTrivial() const {
132132
return Count == 0 && !GenericParamCaptures && !DynamicSelf && !OpaqueValue;
133133
}
134134

branches/rxwei-patch-1/include/swift/AST/Decl.h

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1932,6 +1932,9 @@ class PatternBindingEntry {
19321932
/// The initializer context used for this pattern binding entry.
19331933
llvm::PointerIntPair<DeclContext *, 1, bool> InitContextAndIsText;
19341934

1935+
/// Values captured by this initializer.
1936+
CaptureInfo Captures;
1937+
19351938
friend class PatternBindingInitializer;
19361939

19371940
public:
@@ -2025,6 +2028,9 @@ class PatternBindingEntry {
20252028
/// \param omitAccessors Whether the computation should omit the accessors
20262029
/// from the source range.
20272030
SourceRange getSourceRange(bool omitAccessors = false) const;
2031+
2032+
const CaptureInfo &getCaptureInfo() const { return Captures; }
2033+
void setCaptureInfo(const CaptureInfo &captures) { Captures = captures; }
20282034
};
20292035

20302036
/// This decl contains a pattern and optional initializer for a set
@@ -2122,6 +2128,18 @@ class PatternBindingDecl final : public Decl,
21222128

21232129
void setPattern(unsigned i, Pattern *Pat, DeclContext *InitContext);
21242130

2131+
DeclContext *getInitContext(unsigned i) const {
2132+
return getPatternList()[i].getInitContext();
2133+
}
2134+
2135+
const CaptureInfo &getCaptureInfo(unsigned i) const {
2136+
return getPatternList()[i].getCaptureInfo();
2137+
}
2138+
2139+
void setCaptureInfo(unsigned i, const CaptureInfo &captures) {
2140+
getMutablePatternList()[i].setCaptureInfo(captures);
2141+
}
2142+
21252143
/// Given that this PBD is the parent pattern for the specified VarDecl,
21262144
/// return the entry of the VarDecl in our PatternList. For example, in:
21272145
///
@@ -5847,8 +5865,8 @@ class AbstractFunctionDecl : public GenericContext, public ValueDecl {
58475865
/// Retrieve the source range of the function declaration name + patterns.
58485866
SourceRange getSignatureSourceRange() const;
58495867

5850-
CaptureInfo &getCaptureInfo() { return Captures; }
58515868
const CaptureInfo &getCaptureInfo() const { return Captures; }
5869+
void setCaptureInfo(const CaptureInfo &captures) { Captures = captures; }
58525870

58535871
/// Retrieve the Objective-C selector that names this method.
58545872
ObjCSelector getObjCSelector(DeclName preferredName = DeclName(),

branches/rxwei-patch-1/include/swift/AST/DiagnosticsFrontend.def

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,10 @@ WARNING(cannot_assign_value_to_conditional_compilation_flag,none,
254254
"conditional compilation flags do not have values in Swift; they are "
255255
"either present or absent (rather than '%0')", (StringRef))
256256

257+
WARNING(framework_search_path_includes_framework_extension,none,
258+
"framework search path ends in \".framework\"; add directory containing "
259+
"framework instead: %0", (StringRef))
260+
257261
ERROR(error_optimization_remark_pattern, none, "%0 in '%1'",
258262
(StringRef, StringRef))
259263

branches/rxwei-patch-1/include/swift/AST/DiagnosticsSema.def

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2595,6 +2595,8 @@ ERROR(dynamic_self_invalid_subscript,none,
25952595
"covariant 'Self' can only appear at the top level of subscript element type", ())
25962596
ERROR(dynamic_self_invalid_method,none,
25972597
"covariant 'Self' can only appear at the top level of method result type", ())
2598+
ERROR(dynamic_self_stored_property_init,none,
2599+
"covariant 'Self' type cannot be referenced from a stored property initializer", ())
25982600

25992601
//------------------------------------------------------------------------------
26002602
// MARK: Type Check Attributes
@@ -4448,6 +4450,9 @@ ERROR(property_wrapper_type_requirement_not_accessible,none,
44484450
"more restrictive access than its enclosing property wrapper type %3 "
44494451
"(which is %select{private|fileprivate|internal|public|open}4)",
44504452
(AccessLevel, DescriptiveDeclKind, DeclName, Type, AccessLevel))
4453+
ERROR(property_wrapper_ambiguous_enclosing_self_subscript, none,
4454+
"property wrapper type %0 has multiple enclosing-self subscripts %1",
4455+
(Type, DeclName))
44514456

44524457
ERROR(property_wrapper_attribute_not_on_property, none,
44534458
"property wrapper attribute %0 can only be applied to a property",

0 commit comments

Comments
 (0)