Skip to content

Commit 37cf94d

Browse files
authored
---
yaml --- r: 335735 b: refs/heads/rxwei-patch-1 c: d006c53 h: refs/heads/master i: 335733: 47d217b 335731: bfe3cab 335727: 5023812
1 parent 17612ae commit 37cf94d

File tree

396 files changed

+3690
-1365
lines changed

Some content is hidden

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

396 files changed

+3690
-1365
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: b51b60b2275128b7443809211fa5d321b0d1f7cc
1018+
refs/heads/rxwei-patch-1: d006c53a4a94e9d967902e240b6c51844f10039f
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/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,11 @@ Swift 5.1
9999
foo(0) // prints "Any" in Swift < 5.1, "T" in Swift 5.1
100100
```
101101

102+
* [SE-0245][]:
103+
104+
`Array` and `ContiguousArray` now have `init(unsafeUninitializedCapacity:initializingWith:)`,
105+
which provides access to the array's uninitialized storage.
106+
102107
**Add new entries to the top of this section, not here!**
103108

104109
Swift 5.0
@@ -7506,6 +7511,7 @@ Swift 1.0
75067511
[SE-0228]: <https://github.com/apple/swift-evolution/blob/master/proposals/0228-fix-expressiblebystringinterpolation.md>
75077512
[SE-0230]: <https://github.com/apple/swift-evolution/blob/master/proposals/0230-flatten-optional-try.md>
75087513
[SE-0235]: <https://github.com/apple/swift-evolution/blob/master/proposals/0235-add-result.md>
7514+
[SE-0245]: <https://github.com/apple/swift-evolution/blob/master/proposals/0245-array-uninitialized-initializer.md>
75097515

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

branches/rxwei-patch-1/CMakeLists.txt

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -883,12 +883,11 @@ find_package(PythonInterp REQUIRED)
883883
# Find optional dependencies.
884884
#
885885

886-
# Find libxml.
887-
# FIXME: unify with CLANG_HAVE_LIBXML, which is set in LLVM anyway.
888-
find_package(LibXml2)
889-
option(SWIFT_HAVE_LIBXML
890-
"Whether to build with libxml"
891-
${LIBXML2_FOUND})
886+
if(LLVM_ENABLE_LIBXML2)
887+
find_package(Libxml2 REQUIRED)
888+
else()
889+
find_package(LibXml2)
890+
endif()
892891

893892
# You need libedit linked in order to check if you have el_wgets.
894893
cmake_push_check_state()

branches/rxwei-patch-1/README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@ several hours. Naturally, incremental builds are much faster.
7171
macOS, Ubuntu Linux LTS, and the latest Ubuntu Linux release are the current
7272
supported host development operating systems.
7373

74+
Please make sure you use Python 2.x. Python 3.x is not supported currently.
75+
7476
#### macOS
7577

7678
To build for macOS, you need [Xcode 10.2 beta](https://developer.apple.com/xcode/downloads/).
@@ -295,7 +297,7 @@ To read the compiler documentation, start by installing the
295297
[Sphinx](http://sphinx-doc.org) documentation generator tool by running the
296298
command:
297299

298-
easy_install -U Sphinx
300+
easy_install -U "Sphinx < 2.0"
299301

300302
Once complete, you can build the Swift documentation by changing directory into
301303
[docs](https://github.com/apple/swift/tree/master/docs) and typing `make`. This

branches/rxwei-patch-1/benchmark/cmake/modules/AddSwiftBenchmarkSuite.cmake

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,6 @@ function (swift_benchmark_compile_archopts)
314314

315315
set(common_options
316316
"-c"
317-
"-Xfrontend" "-verify-sil-ownership"
318317
"-target" "${target}"
319318
"-${BENCH_COMPILE_ARCHOPTS_OPT}" ${PAGE_ALIGNMENT_OPTION})
320319

@@ -344,7 +343,6 @@ function (swift_benchmark_compile_archopts)
344343

345344
set(common_options_driver
346345
"-c"
347-
"-Xfrontend" "-verify-sil-ownership"
348346
"-target" "${target}"
349347
"-${driver_opt}")
350348

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

Lines changed: 51 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,64 @@
1111
//===----------------------------------------------------------------------===//
1212

1313
// <rdar://problem/19003201>
14+
#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS)
15+
1416
import TestsUtils
1517
import Foundation
1618

17-
public let NSStringConversion = BenchmarkInfo(
18-
name: "NSStringConversion",
19-
runFunction: run_NSStringConversion,
20-
tags: [.validation, .api, .String, .bridging])
19+
fileprivate var test:NSString = ""
20+
21+
public let NSStringConversion = [
22+
BenchmarkInfo(name: "NSStringConversion",
23+
runFunction: run_NSStringConversion,
24+
tags: [.validation, .api, .String, .bridging]),
25+
BenchmarkInfo(name: "NSStringConversion.UTF8",
26+
runFunction: run_NSStringConversion_nonASCII,
27+
tags: [.validation, .api, .String, .bridging],
28+
setUpFunction: { test = NSString(cString: "tëst", encoding: String.Encoding.utf8.rawValue)! }),
29+
BenchmarkInfo(name: "NSStringConversion.Mutable",
30+
runFunction: run_NSMutableStringConversion,
31+
tags: [.validation, .api, .String, .bridging],
32+
setUpFunction: { test = NSMutableString(cString: "test", encoding: String.Encoding.ascii.rawValue)! }),
33+
BenchmarkInfo(name: "NSStringConversion.Long",
34+
runFunction: run_NSStringConversion_long,
35+
tags: [.validation, .api, .String, .bridging],
36+
setUpFunction: { test = NSString(cString: "The quick brown fox jumps over the lazy dog", encoding: String.Encoding.ascii.rawValue)! } ),
37+
BenchmarkInfo(name: "NSStringConversion.LongUTF8",
38+
runFunction: run_NSStringConversion_longNonASCII,
39+
tags: [.validation, .api, .String, .bridging],
40+
setUpFunction: { test = NSString(cString: "Thë qüick bröwn föx jumps over the lazy dög", encoding: String.Encoding.utf8.rawValue)! })]
2141

2242
public func run_NSStringConversion(_ N: Int) {
23-
#if _runtime(_ObjC)
2443
let test:NSString = NSString(cString: "test", encoding: String.Encoding.ascii.rawValue)!
2544
for _ in 1...N * 10000 {
45+
//Doesn't test accessing the String contents to avoid changing historical benchmark numbers
2646
blackHole(identity(test) as String)
2747
}
28-
#endif
2948
}
49+
50+
fileprivate func innerLoop(_ str: NSString, _ N: Int, _ scale: Int = 5000) {
51+
for _ in 1...N * scale {
52+
for char in (identity(str) as String).utf8 {
53+
blackHole(char)
54+
}
55+
}
56+
}
57+
58+
public func run_NSStringConversion_nonASCII(_ N: Int) {
59+
innerLoop(test, N, 2500)
60+
}
61+
62+
public func run_NSMutableStringConversion(_ N: Int) {
63+
innerLoop(test, N)
64+
}
65+
66+
public func run_NSStringConversion_long(_ N: Int) {
67+
innerLoop(test, N, 1000)
68+
}
69+
70+
public func run_NSStringConversion_longNonASCII(_ N: Int) {
71+
innerLoop(test, N, 300)
72+
}
73+
74+
#endif

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,9 @@ import MonteCarloPi
9292
import NibbleSort
9393
import NSDictionaryCastToSwift
9494
import NSError
95+
#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS)
9596
import NSStringConversion
97+
#endif
9698
import NopDeinit
9799
import ObjectAllocation
98100
#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS)
@@ -262,7 +264,9 @@ registerBenchmark(MonteCarloE)
262264
registerBenchmark(MonteCarloPi)
263265
registerBenchmark(NSDictionaryCastToSwift)
264266
registerBenchmark(NSErrorTest)
267+
#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS)
265268
registerBenchmark(NSStringConversion)
269+
#endif
266270
registerBenchmark(NibbleSort)
267271
registerBenchmark(NopDeinit)
268272
registerBenchmark(ObjectAllocation)

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,6 @@ function(_compile_swift_files
236236
endif()
237237

238238
if(SWIFTFILE_IS_STDLIB)
239-
list(APPEND swift_flags "-Xfrontend" "-verify-sil-ownership")
240239
list(APPEND swift_flags "-Xfrontend" "-enable-mandatory-semantic-arc-opts")
241240
endif()
242241

branches/rxwei-patch-1/docs/WindowsBuild.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ cmake -G Ninja^
125125
-DLLVM_ENABLE_ASSERTIONS=ON^
126126
-DLLVM_ENABLE_PDB=YES^
127127
-DLLVM_ENABLE_PROJECTS=clang^
128-
-DLLVM_TARGETS_TO_BUILD=X86^
128+
-DLLVM_TARGETS_TO_BUILD="AArch64;ARM;X86"^
129129
S:/llvm
130130
popd
131131
cmake --build "S:\b\llvm"
@@ -208,7 +208,7 @@ cmake -G Ninja^
208208
-DLLDB_PATH_TO_LLVM_BUILD="S:\b\llvm"^
209209
-DLLDB_PATH_TO_SWIFT_BUILD="S:\b\swift"^
210210
-DLLVM_ENABLE_ASSERTIONS=ON^
211-
-DPYTHON_HOME=%ProgramFiles(x86)%\Microsoft Visual Studio\Shared\Python37_64^
211+
-DPYTHON_HOME="%ProgramFiles(x86)%\Microsoft Visual Studio\Shared\Python37_64"^
212212
S:\lldb
213213
popd
214214
cmake --build S:\b\lldb

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

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4715,7 +4715,7 @@ class VarDecl : public AbstractStorageDecl {
47154715
/// Set \p v to be the pattern produced VarDecl that is the parent of this
47164716
/// var decl.
47174717
void setParentVarDecl(VarDecl *v) {
4718-
assert(v);
4718+
assert(v && v != this);
47194719
Parent = v;
47204720
}
47214721

@@ -4906,7 +4906,7 @@ class ParamDecl : public VarDecl {
49064906
SourceLoc SpecifierLoc;
49074907

49084908
struct StoredDefaultArgument {
4909-
Expr *DefaultArg = nullptr;
4909+
PointerUnion<Expr *, VarDecl *> DefaultArg;
49104910
Initializer *InitContext = nullptr;
49114911
StringRef StringRepresentation;
49124912
};
@@ -4963,12 +4963,20 @@ class ParamDecl : public VarDecl {
49634963

49644964
Expr *getDefaultValue() const {
49654965
if (auto stored = DefaultValueAndFlags.getPointer())
4966-
return stored->DefaultArg;
4966+
return stored->DefaultArg.dyn_cast<Expr *>();
4967+
return nullptr;
4968+
}
4969+
4970+
VarDecl *getStoredProperty() const {
4971+
if (auto stored = DefaultValueAndFlags.getPointer())
4972+
return stored->DefaultArg.dyn_cast<VarDecl *>();
49674973
return nullptr;
49684974
}
49694975

49704976
void setDefaultValue(Expr *E);
49714977

4978+
void setStoredProperty(VarDecl *var);
4979+
49724980
Initializer *getDefaultArgumentInitContext() const {
49734981
if (auto stored = DefaultValueAndFlags.getPointer())
49744982
return stored->InitContext;
@@ -5561,12 +5569,14 @@ class AbstractFunctionDecl : public GenericContext, public ValueDecl {
55615569

55625570
class OperatorDecl;
55635571

5564-
/// Note: These align with '%select's in diagnostics.
55655572
enum class SelfAccessKind : uint8_t {
5566-
NonMutating = 0,
5567-
Mutating = 1,
5568-
__Consuming = 2,
5573+
NonMutating,
5574+
Mutating,
5575+
__Consuming,
55695576
};
5577+
5578+
/// Diagnostic printing of \c SelfAccessKind.
5579+
llvm::raw_ostream &operator<<(llvm::raw_ostream &OS, SelfAccessKind SAK);
55705580

55715581
/// FuncDecl - 'func' declaration.
55725582
class FuncDecl : public AbstractFunctionDecl {

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,10 @@ enum class DefaultArgumentKind : uint8_t {
5252
EmptyArray,
5353
/// An empty dictionary literal.
5454
EmptyDictionary,
55+
/// A reference to the stored property. This is a special default argument
56+
/// kind for the synthesized memberwise constructor to emit a call to the
57+
// property's initializer.
58+
StoredProperty,
5559
};
5660
enum { NumDefaultArgumentKindBits = 4 };
5761

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ namespace swift {
3030
class ValueDecl;
3131

3232
enum class PatternKind : uint8_t;
33+
enum class SelfAccessKind : uint8_t;
3334
enum class ReferenceOwnership : uint8_t;
3435
enum class StaticSpellingKind : uint8_t;
3536
enum class DescriptiveDeclKind : uint8_t;
@@ -77,6 +78,7 @@ namespace swift {
7778
Type,
7879
TypeRepr,
7980
PatternKind,
81+
SelfAccessKind,
8082
ReferenceOwnership,
8183
StaticSpellingKind,
8284
DescriptiveDeclKind,
@@ -105,6 +107,7 @@ namespace swift {
105107
Type TypeVal;
106108
TypeRepr *TyR;
107109
PatternKind PatternKindVal;
110+
SelfAccessKind SelfAccessKindVal;
108111
ReferenceOwnership ReferenceOwnershipVal;
109112
StaticSpellingKind StaticSpellingKindVal;
110113
DescriptiveDeclKind DescriptiveDeclKindVal;
@@ -169,6 +172,10 @@ namespace swift {
169172
: Kind(DiagnosticArgumentKind::ReferenceOwnership),
170173
ReferenceOwnershipVal(RO) {}
171174

175+
DiagnosticArgument(SelfAccessKind SAK)
176+
: Kind(DiagnosticArgumentKind::SelfAccessKind),
177+
SelfAccessKindVal(SAK) {}
178+
172179
DiagnosticArgument(StaticSpellingKind SSK)
173180
: Kind(DiagnosticArgumentKind::StaticSpellingKind),
174181
StaticSpellingKindVal(SSK) {}
@@ -249,6 +256,11 @@ namespace swift {
249256
return ReferenceOwnershipVal;
250257
}
251258

259+
SelfAccessKind getAsSelfAccessKind() const {
260+
assert(Kind == DiagnosticArgumentKind::SelfAccessKind);
261+
return SelfAccessKindVal;
262+
}
263+
252264
StaticSpellingKind getAsStaticSpellingKind() const {
253265
assert(Kind == DiagnosticArgumentKind::StaticSpellingKind);
254266
return StaticSpellingKindVal;

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

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1108,24 +1108,20 @@ ERROR(attribute_requires_operator_identifier,none,
11081108
ERROR(attribute_requires_single_argument,none,
11091109
"'%0' requires a function with one argument", (StringRef))
11101110

1111-
ERROR(mutating_invalid_global_scope,none,
1112-
"'%select{nonmutating|mutating|__consuming}0' is only valid on methods",
1113-
(unsigned))
1114-
ERROR(mutating_invalid_classes,none,
1115-
"'%select{nonmutating|mutating|__consuming}0' isn't valid on methods in "
1116-
"classes or class-bound protocols", (bool))
1111+
ERROR(mutating_invalid_global_scope,none, "%0 is only valid on methods",
1112+
(SelfAccessKind))
1113+
ERROR(mutating_invalid_classes,none, "%0 isn't valid on methods in "
1114+
"classes or class-bound protocols", (SelfAccessKind))
11171115

11181116
ERROR(functions_mutating_and_not,none,
1119-
"method must not be declared both "
1120-
"%select{nonmutating|mutating|__consuming}0 and "
1121-
"%select{nonmutating|mutating|__consuming}1",
1122-
(unsigned, unsigned))
1117+
"method must not be declared both %0 and %1",
1118+
(SelfAccessKind, SelfAccessKind))
11231119
ERROR(static_functions_not_mutating,none,
11241120
"static functions must not be declared mutating", ())
11251121

11261122
ERROR(modify_mutatingness_differs_from_setter,none,
1127-
"'modify' accessor cannot be %select{nonmutating|mutating}0 "
1128-
"when the setter is %select{mutating|nonmutating}0", (bool))
1123+
"'modify' accessor cannot be %0 when the setter is %1",
1124+
(SelfAccessKind, SelfAccessKind))
11291125

11301126
ERROR(transparent_in_protocols_not_supported,none,
11311127
"'@_transparent' attribute is not supported on declarations within protocols", ())
@@ -1522,6 +1518,8 @@ ERROR(extension_specialization,none,
15221518
"type %0 with constraints specified by a 'where' clause", (Identifier))
15231519
ERROR(extension_stored_property,none,
15241520
"extensions must not contain stored properties", ())
1521+
NOTE(extension_stored_property_fixit,none,
1522+
"Remove '=' to make %0 a computed property", (Identifier))
15251523
ERROR(extension_nongeneric_trailing_where,none,
15261524
"trailing 'where' clause for extension of non-generic type %0",
15271525
(DeclName))
@@ -1871,8 +1869,8 @@ NOTE(protocol_witness_prefix_postfix_conflict,none,
18711869
"candidate is %select{|prefix, |postfix, }1not "
18721870
"%select{prefix|postfix}0 as required", (bool, unsigned))
18731871
NOTE(protocol_witness_mutation_modifier_conflict,none,
1874-
"candidate is marked '%select{nonmutating|mutating|__consuming}0' but "
1875-
"protocol does not allow it", (unsigned))
1872+
"candidate is marked %0 but protocol does not allow it",
1873+
(SelfAccessKind))
18761874
NOTE(protocol_witness_settable_conflict,none,
18771875
"candidate is not settable, but protocol requires it", ())
18781876
NOTE(protocol_witness_rethrows_conflict,none,

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ PROTOCOL(Error)
6767
PROTOCOL_(ErrorCodeProtocol)
6868
PROTOCOL(OptionSet)
6969
PROTOCOL(CaseIterable)
70+
PROTOCOL(SIMDScalar)
7071

7172
PROTOCOL_(BridgedNSError)
7273
PROTOCOL_(BridgedStoredNSError)

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -810,6 +810,14 @@ class FileUnit : public DeclContext {
810810
return nullptr;
811811
}
812812

813+
/// Returns the name to use when referencing entities in this file.
814+
///
815+
/// Usually this is the module name itself, but certain Clang features allow
816+
/// substituting another name instead.
817+
virtual StringRef getExportedModuleName() const {
818+
return getParentModule()->getName().str();
819+
}
820+
813821
/// Traverse the decls within this file.
814822
///
815823
/// \returns true if traversal was aborted, false if it completed

0 commit comments

Comments
 (0)