Skip to content

Commit 12cd886

Browse files
authored
---
yaml --- r: 292346 b: refs/heads/tensorflow c: 07a29d5 h: refs/heads/master
1 parent 0f750fc commit 12cd886

File tree

214 files changed

+1550
-824
lines changed

Some content is hidden

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

214 files changed

+1550
-824
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -816,7 +816,7 @@ refs/tags/swift-DEVELOPMENT-SNAPSHOT-2018-04-25-a: 22f738a831d43aff2b9c9773bcb65
816816
refs/tags/swift-DEVELOPMENT-SNAPSHOT-2018-05-08-a: 7d98cc16689baba5c8a3b90a9329bdcc1a12b4e9
817817
refs/heads/cherr42: a566ad54b073c2c56ac0a705d0a5bed9743135a5
818818
"refs/heads/codable_test_comment_fix": fc8f6824f7f347e1e8db55bff62db385c5728b5a
819-
refs/heads/tensorflow: 174d0191119a8448bb858ec76efb8f238306d02e
819+
refs/heads/tensorflow: 07a29d5ff712180e23dcf042558d2673b7d40fe3
820820
refs/tags/swift-4.1-DEVELOPMENT-SNAPSHOT-2018-05-11-a: 8126fd7a652e2f70ad6d76505239e34fb2ef3e1a
821821
refs/tags/swift-4.1-DEVELOPMENT-SNAPSHOT-2018-05-12-a: b3fd3dd84df6717f2e2e9df58c6d7e99fed57086
822822
refs/tags/swift-4.1-DEVELOPMENT-SNAPSHOT-2018-05-13-a: 71135119579039dc321c5f65d870050fe36efda2

branches/tensorflow/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/tensorflow/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/tensorflow/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ To read the compiler documentation, start by installing the
297297
[Sphinx](http://sphinx-doc.org) documentation generator tool by running the
298298
command:
299299

300-
easy_install -U Sphinx
300+
easy_install -U "Sphinx < 2.0"
301301

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

branches/tensorflow/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/tensorflow/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/tensorflow/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/tensorflow/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/tensorflow/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/tensorflow/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/tensorflow/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/tensorflow/include/swift/AST/SILOptions.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ class SILOptions {
112112
std::string SILOutputFileNameForDebugging;
113113

114114
/// If set to true, compile with the SIL Ownership Model enabled.
115-
bool VerifySILOwnership = false;
115+
bool VerifySILOwnership = true;
116116

117117
/// Assume that code will be executed in a single-threaded environment.
118118
bool AssumeSingleThreaded = false;

branches/tensorflow/include/swift/AST/Stmt.h

Lines changed: 40 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,13 @@
1717
#ifndef SWIFT_AST_STMT_H
1818
#define SWIFT_AST_STMT_H
1919

20+
#include "swift/AST/ASTNode.h"
2021
#include "swift/AST/Availability.h"
2122
#include "swift/AST/AvailabilitySpec.h"
22-
#include "swift/AST/ASTNode.h"
2323
#include "swift/AST/IfConfigClause.h"
2424
#include "swift/AST/TypeAlignments.h"
2525
#include "swift/Basic/NullablePtr.h"
26+
#include "llvm/ADT/TinyPtrVector.h"
2627
#include "llvm/Support/TrailingObjects.h"
2728

2829
namespace swift {
@@ -984,24 +985,22 @@ class CaseStmt final
984985
SourceLoc CaseLoc;
985986
SourceLoc ColonLoc;
986987

987-
llvm::PointerIntPair<Stmt *, 1, bool> BodyAndHasBoundDecls;
988+
llvm::PointerIntPair<Stmt *, 1, bool> BodyAndHasFallthrough;
988989

989-
/// Set to true if we have a fallthrough.
990-
///
991-
/// TODO: Once we have CaseBodyVarDecls, use the bit in BodyAndHasBoundDecls
992-
/// for this instead. This is separate now for staging reasons.
993-
bool hasFallthrough;
990+
Optional<MutableArrayRef<VarDecl *>> CaseBodyVariables;
994991

995992
CaseStmt(SourceLoc CaseLoc, ArrayRef<CaseLabelItem> CaseLabelItems,
996-
bool HasBoundDecls, SourceLoc UnknownAttrLoc, SourceLoc ColonLoc,
997-
Stmt *Body, Optional<bool> Implicit,
993+
SourceLoc UnknownAttrLoc, SourceLoc ColonLoc, Stmt *Body,
994+
Optional<MutableArrayRef<VarDecl *>> CaseBodyVariables,
995+
Optional<bool> Implicit,
998996
NullablePtr<FallthroughStmt> fallthroughStmt);
999997

1000998
public:
1001999
static CaseStmt *
10021000
create(ASTContext &C, SourceLoc CaseLoc,
1003-
ArrayRef<CaseLabelItem> CaseLabelItems, bool HasBoundDecls,
1004-
SourceLoc UnknownAttrLoc, SourceLoc ColonLoc, Stmt *Body,
1001+
ArrayRef<CaseLabelItem> CaseLabelItems, SourceLoc UnknownAttrLoc,
1002+
SourceLoc ColonLoc, Stmt *Body,
1003+
Optional<MutableArrayRef<VarDecl *>> CaseBodyVariables,
10051004
Optional<bool> Implicit = None,
10061005
NullablePtr<FallthroughStmt> fallthroughStmt = nullptr);
10071006

@@ -1020,18 +1019,18 @@ class CaseStmt final
10201019
}
10211020

10221021
NullablePtr<CaseStmt> getFallthroughDest() {
1023-
if (!hasFallthrough)
1022+
if (!hasFallthroughDest())
10241023
return nullptr;
10251024
return (*getTrailingObjects<FallthroughStmt *>())->getFallthroughDest();
10261025
}
10271026

1028-
bool hasFallthroughDest() const { return hasFallthrough; }
1027+
bool hasFallthroughDest() const { return BodyAndHasFallthrough.getInt(); }
10291028

1030-
Stmt *getBody() const { return BodyAndHasBoundDecls.getPointer(); }
1031-
void setBody(Stmt *body) { BodyAndHasBoundDecls.setPointer(body); }
1029+
Stmt *getBody() const { return BodyAndHasFallthrough.getPointer(); }
1030+
void setBody(Stmt *body) { BodyAndHasFallthrough.setPointer(body); }
10321031

10331032
/// True if the case block declares any patterns with local variable bindings.
1034-
bool hasBoundDecls() const { return BodyAndHasBoundDecls.getInt(); }
1033+
bool hasBoundDecls() const { return CaseBodyVariables.hasValue(); }
10351034

10361035
/// Get the source location of the 'case' or 'default' of the first label.
10371036
SourceLoc getLoc() const { return CaseLoc; }
@@ -1056,14 +1055,38 @@ class CaseStmt final
10561055
return UnknownAttrLoc.isValid();
10571056
}
10581057

1058+
Optional<ArrayRef<VarDecl *>> getCaseBodyVariables() const {
1059+
if (!CaseBodyVariables)
1060+
return None;
1061+
ArrayRef<VarDecl *> a = *CaseBodyVariables;
1062+
return a;
1063+
}
1064+
1065+
Optional<MutableArrayRef<VarDecl *>> getCaseBodyVariables() {
1066+
return CaseBodyVariables;
1067+
}
1068+
1069+
ArrayRef<VarDecl *> getCaseBodyVariablesOrEmptyArray() const {
1070+
if (!CaseBodyVariables)
1071+
return ArrayRef<VarDecl *>();
1072+
ArrayRef<VarDecl *> a = *CaseBodyVariables;
1073+
return a;
1074+
}
1075+
1076+
MutableArrayRef<VarDecl *> getCaseBodyVariablesOrEmptyArray() {
1077+
if (!CaseBodyVariables)
1078+
return MutableArrayRef<VarDecl *>();
1079+
return *CaseBodyVariables;
1080+
}
1081+
10591082
static bool classof(const Stmt *S) { return S->getKind() == StmtKind::Case; }
10601083

10611084
size_t numTrailingObjects(OverloadToken<CaseLabelItem>) const {
10621085
return getNumCaseLabelItems();
10631086
}
10641087

10651088
size_t numTrailingObjects(OverloadToken<FallthroughStmt *>) const {
1066-
return hasFallthrough ? 1 : 0;
1089+
return hasFallthroughDest() ? 1 : 0;
10671090
}
10681091
};
10691092

branches/tensorflow/include/swift/Option/FrontendOptions.td

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -299,8 +299,8 @@ def emit_pch : Flag<["-"], "emit-pch">,
299299
def pch_disable_validation : Flag<["-"], "pch-disable-validation">,
300300
HelpText<"Disable validating the persistent PCH">;
301301

302-
def verify_sil_ownership : Flag<["-"], "verify-sil-ownership">,
303-
HelpText<"Verify ownership invariants during SIL Verification ">;
302+
def disable_sil_ownership_verifier : Flag<["-"], "disable-sil-ownership-verifier">,
303+
HelpText<"Do not verify ownership invariants during SIL Verification ">;
304304

305305
def enable_mandatory_semantic_arc_opts : Flag<["-"], "enable-mandatory-semantic-arc-opts">,
306306
HelpText<"Enable the mandatory semantic arc optimizer">;

0 commit comments

Comments
 (0)