Skip to content

Commit d48bbd6

Browse files
committed
---
yaml --- r: 327676 b: refs/heads/tensorflow c: 7b1b0a0 h: refs/heads/master
1 parent e860e8a commit d48bbd6

File tree

90 files changed

+564
-856
lines changed

Some content is hidden

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

90 files changed

+564
-856
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: a17573ab51d72d6d65552565b6b9d1083025d48b
819+
refs/heads/tensorflow: 7b1b0a00770d87d122b95341d3685889b272c1f5
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/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414

1515
| **OS** | **Architecture** | **Build** |
1616
|---|:---:|:---:|
17+
|**[Debian 9.1 (Raspberry Pi)](https://github.com/apple/swift-community-hosted-continuous-integration/blob/master/nodes/armv7_debian_stretch.json)** | ARMv7 | [![Build Status](https://ci-external.swift.org/job/oss-swift-RA-linux-debian-9_1/lastCompletedBuild/badge/icon)](https://ci-external.swift.org/job/oss-swift-RA-linux-debian-9_1)|
18+
|**[Fedora 27](https://github.com/apple/swift-community-hosted-continuous-integration/blob/master/nodes/x86_64_fedora_27.json)** | x86_64 |[![Build Status](https://ci-external.swift.org/job/oss-swift-RA-linux-fedora-27/lastCompletedBuild/badge/icon)](https://ci-external.swift.org/job/oss-swift-RA-linux-fedora-27)|
19+
|**[Ubuntu 16.04](https://github.com/apple/swift-community-hosted-continuous-integration/blob/master/nodes/x86_64_ubuntu_16_04.json)** | x86_64 |[![Build Status](https://ci-external.swift.org/job/oss-swift-RA-linux-ubuntu-16.04/lastCompletedBuild/badge/icon)](https://ci-external.swift.org/job/oss-swift-RA-linux-ubuntu-16.04)|
1720
|**[Ubuntu 16.04 ](https://github.com/apple/swift-community-hosted-continuous-integration/blob/master/nodes/ppc64le_ubuntu_16_04.json)** | PPC64LE |[![Build Status](https://ci-external.swift.org/job/oss-swift-5.1-RA-linux-ubuntu-16.04-ppc64le/lastCompletedBuild/badge/icon)](https://ci-external.swift.org/job/oss-swift-5.1-RA-linux-ubuntu-16.04-ppc64le)|
1821
|**[Ubuntu 16.04 ](https://github.com/apple/swift-community-hosted-continuous-integration/blob/master/nodes/aarch64_ubuntu_16.04.json)** | AArch64 |[![Build Status](https://ci-external.swift.org/job/oss-swift-RA-linux-ubuntu-16.04-aarch64/lastCompletedBuild/badge/icon)](https://ci-external.swift.org/job/oss-swift-RA-linux-ubuntu-16.04-aarch64)|
1922
|**[Android](https://github.com/apple/swift-community-hosted-continuous-integration/blob/master/nodes/x86_64_ubuntu_16_04_LTS_android.json)** | ARMv7 |[![Build Status](https://ci-external.swift.org/job/oss-swift-RA-linux-ubuntu-16.04-android/lastCompletedBuild/badge/icon)](https://ci-external.swift.org/job/oss-swift-RA-linux-ubuntu-16.04-android)|

branches/tensorflow/docs/SIL.rst

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2525,9 +2525,10 @@ except that ``destroy_addr`` may be used even if ``%0`` is of an
25252525
address-only type. This does not deallocate memory; it only destroys the
25262526
pointed-to value, leaving the memory uninitialized.
25272527

2528-
If ``T`` is a trivial type, then ``destroy_addr`` is a no-op. However, even a
2529-
memory location ``%a`` with a trivial type must not be accessed after a
2530-
``destroy_addr %a``.
2528+
If ``T`` is a trivial type, then ``destroy_addr`` can be safely
2529+
eliminated. However, a memory location ``%a`` must not be accessed
2530+
after ``destroy_addr %a`` (which has not yet been eliminated)
2531+
regardless of its type.
25312532

25322533
index_addr
25332534
``````````

branches/tensorflow/include/swift/AST/DiagnosticsModuleDiffer.def

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,6 @@ ERROR(new_decl_without_intro,none,"%0 is a new API without @available attribute"
9898

9999
ERROR(objc_name_change,none,"%0 has ObjC name change from %1 to %2", (StringRef, StringRef, StringRef))
100100

101-
ERROR(desig_init_added,none,"%0 has been added as a designated initializer to an open class", (StringRef))
102-
103101
#ifndef DIAG_NO_UNDEF
104102
# if defined(DIAG)
105103
# undef DIAG

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

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,13 +140,52 @@ class alignas(ModuleDecl::ImportedModule) ImportCache {
140140
return !getAllVisibleAccessPaths(mod, dc).empty();
141141
}
142142

143+
/// Determines if 'mod' is visible from 'dc' as a result of a scoped import.
144+
/// Note that if 'mod' was not imported from 'dc' at all, this also returns
145+
/// false.
146+
bool isScopedImport(const ModuleDecl *mod, DeclBaseName name,
147+
const DeclContext *dc) {
148+
auto accessPaths = getAllVisibleAccessPaths(mod, dc);
149+
for (auto accessPath : accessPaths) {
150+
if (accessPath.empty())
151+
continue;
152+
if (ModuleDecl::matchesAccessPath(accessPath, name))
153+
return true;
154+
}
155+
156+
return false;
157+
}
158+
143159
/// Returns all access paths in 'mod' that are visible from 'dc' if we
144160
/// subtract imports of 'other'.
145161
ArrayRef<ModuleDecl::AccessPathTy>
146162
getAllAccessPathsNotShadowedBy(const ModuleDecl *mod,
147163
const ModuleDecl *other,
148164
const DeclContext *dc);
149165

166+
/// Returns 'true' if a declaration named 'name' defined in 'other' shadows
167+
/// defined in 'mod', because no access paths can find 'name' in 'mod' from
168+
/// 'dc' if we ignore imports of 'other'.
169+
bool isShadowedBy(const ModuleDecl *mod,
170+
const ModuleDecl *other,
171+
DeclBaseName name,
172+
const DeclContext *dc) {
173+
auto accessPaths = getAllAccessPathsNotShadowedBy(mod, other, dc);
174+
return llvm::none_of(accessPaths,
175+
[&](ModuleDecl::AccessPathTy accessPath) {
176+
return ModuleDecl::matchesAccessPath(accessPath, name);
177+
});
178+
}
179+
180+
/// Qualified lookup into types uses a slightly different check that does not
181+
/// take access paths into account.
182+
bool isShadowedBy(const ModuleDecl *mod,
183+
const ModuleDecl *other,
184+
const DeclContext *dc) {
185+
auto accessPaths = getAllAccessPathsNotShadowedBy(mod, other, dc);
186+
return accessPaths.empty();
187+
}
188+
150189
/// This is a hack to cope with main file parsing and REPL parsing, where
151190
/// we can add ImportDecls after name binding.
152191
void clear() {

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,6 @@ struct PropertyWrapperMutability {
109109
}
110110
return std::max(Getter, Setter);
111111
}
112-
llvm_unreachable("Unhandled Value in switch");
113112
}
114113

115114
bool operator==(PropertyWrapperMutability other) const {

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,6 @@ class Requirement {
167167
case RequirementKind::Layout:
168168
return lhs.getLayoutConstraint() == rhs.getLayoutConstraint();
169169
}
170-
llvm_unreachable("Unhandled RequirementKind in switch");
171170
}
172171
};
173172

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ inline llvm::raw_ostream &operator<<(llvm::raw_ostream &os,
5454
case ResilienceExpansion::Maximal:
5555
return os << "Maximal";
5656
}
57-
llvm_unreachable("Unhandled ResilienceExpansion in switch");
5857
}
5958

6059
} // namespace swift

branches/tensorflow/include/swift/IDE/DigesterEnums.def

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,6 @@ KEY_STRING(IntrotvOS, intro_tvOS)
152152
KEY_STRING(IntrowatchOS, intro_watchOS)
153153
KEY_STRING(Introswift, intro_swift)
154154
KEY_STRING(ObjCName, objc_name)
155-
KEY_STRING(InitKind, init_kind)
156155

157156
KEY_STRING_ARR(SuperclassNames, superclassNames)
158157
KEY_STRING_ARR(ToolArgs, tool_arguments)

branches/tensorflow/include/swift/Runtime/ObjCBridge.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -79,11 +79,6 @@ namespace swift {
7979
SWIFT_RUNTIME_EXPORT
8080
void swift_rootObjCDealloc(HeapObject *self);
8181

82-
// Uses Swift bridging to box a C string into an NSString without introducing
83-
// a link-time dependency on NSString.
84-
SWIFT_CC(swift) SWIFT_RUNTIME_STDLIB_API
85-
id swift_stdlib_NSStringFromUTF8(const char *cstr, int len);
86-
8782
}
8883

8984
#endif // SWIFT_OBJC_INTEROP

branches/tensorflow/include/swift/SIL/AbstractionPattern.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,6 @@ class AbstractionPattern {
402402
case Kind::Tuple:
403403
return false;
404404
}
405-
llvm_unreachable("Unhandled AbstractionPatternKind in switch");
406405
}
407406

408407
CanGenericSignature getGenericSignature() const {

branches/tensorflow/include/swift/Sema/IDETypeChecking.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,10 @@ namespace swift {
4747
/// \returns true on convertible, false on not.
4848
bool isConvertibleTo(Type T1, Type T2, bool openArchetypes, DeclContext &DC);
4949

50+
bool isEqual(Type T1, Type T2, DeclContext &DC);
51+
52+
bool canPossiblyEqual(Type T1, Type T2, DeclContext &DC);
53+
5054
void collectDefaultImplementationForProtocolMembers(ProtocolDecl *PD,
5155
llvm::SmallDenseMap<ValueDecl*, ValueDecl*> &DefaultMap);
5256

branches/tensorflow/include/swift/Sema/IDETypeCheckingRequests.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,8 @@ class IsDeclApplicableRequest:
8787
// Type relation checking
8888
//----------------------------------------------------------------------------//
8989
enum class TypeRelation: uint8_t {
90+
EqualTo,
91+
PossiblyEqualTo,
9092
ConvertTo,
9193
};
9294

@@ -156,6 +158,8 @@ struct TypeRelationCheckInput {
156158
out << " is ";
157159
switch(owner.Relation) {
158160
#define CASE(NAME) case TypeRelation::NAME: out << #NAME << " "; break;
161+
CASE(EqualTo)
162+
CASE(PossiblyEqualTo)
159163
CASE(ConvertTo)
160164
#undef CASE
161165
}

branches/tensorflow/lib/AST/ASTContext.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4477,7 +4477,6 @@ bool ASTContext::overrideGenericSignatureReqsSatisfied(
44774477
case OverrideGenericSignatureReqCheck::DerivedReqSatisfiedByBase:
44784478
return derivedSig->requirementsNotSatisfiedBy(sig).empty();
44794479
}
4480-
llvm_unreachable("Unhandled OverrideGenericSignatureReqCheck in switch");
44814480
}
44824481

44834482
SILLayout *SILLayout::get(ASTContext &C,

branches/tensorflow/lib/AST/ASTScope.cpp

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -53,17 +53,7 @@ Optional<bool> ASTScope::computeIsCascadingUse(
5353
return ASTScopeImpl::computeIsCascadingUse(history, initialIsCascadingUse);
5454
}
5555

56-
#if SWIFT_COMPILER_IS_MSVC
57-
#pragma warning(push)
58-
#pragma warning(disable : 4996)
59-
#endif
60-
6156
void ASTScope::dump() const { impl->dump(); }
62-
63-
#if SWIFT_COMPILER_IS_MSVC
64-
#pragma warning(pop)
65-
#endif
66-
6757
void ASTScope::print(llvm::raw_ostream &out) const { impl->print(out); }
6858
void ASTScope::dumpOneScopeMapLocation(std::pair<unsigned, unsigned> lineCol) {
6959
impl->dumpOneScopeMapLocation(lineCol);

branches/tensorflow/lib/AST/ASTScopeCreation.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1178,7 +1178,6 @@ ConditionalClauseScope::expandAScopeThatCreatesANewInsertionPoint(
11781178
return {ccPatternUseScope,
11791179
"Succeeding code must be in scope of conditional variables"};
11801180
}
1181-
llvm_unreachable("Unhandled StmtConditionKind in switch");
11821181
}
11831182

11841183
AnnotatedInsertionPoint

branches/tensorflow/lib/AST/Decl.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7660,7 +7660,6 @@ ParseAbstractFunctionBodyRequest::getCachedResult() const {
76607660
case BodyKind::Unparsed:
76617661
return None;
76627662
}
7663-
llvm_unreachable("Unhandled BodyKing in switch");
76647663
}
76657664

76667665
void ParseAbstractFunctionBodyRequest::cacheResult(BraceStmt *value) const {

branches/tensorflow/lib/AST/DeclContext.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1037,7 +1037,6 @@ SourceLoc swift::extractNearestSourceLoc(const DeclContext *dc) {
10371037
case DeclContextKind::SerializedLocal:
10381038
return extractNearestSourceLoc(dc->getParent());
10391039
}
1040-
llvm_unreachable("Unhandled DeclCopntextKindin switch");
10411040
}
10421041

10431042
#define DECL(Id, Parent) \

branches/tensorflow/lib/AST/GenericSignature.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1091,5 +1091,4 @@ Requirement Requirement::getCanonical() const {
10911091
case RequirementKind::Layout:
10921092
return Requirement(getKind(), firstType, getLayoutConstraint());
10931093
}
1094-
llvm_unreachable("Unhandled RequirementKind in switch");
10951094
}

branches/tensorflow/lib/AST/NameLookup.cpp

Lines changed: 10 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -193,27 +193,6 @@ static void recordShadowedDeclsAfterSignatureMatch(
193193
auto firstDecl = decls[firstIdx];
194194
auto firstModule = firstDecl->getModuleContext();
195195
auto name = firstDecl->getBaseName();
196-
197-
auto isShadowed = [&](ArrayRef<ModuleDecl::AccessPathTy> paths) {
198-
for (auto path : paths) {
199-
if (ModuleDecl::matchesAccessPath(path, name))
200-
return false;
201-
}
202-
203-
return true;
204-
};
205-
206-
auto isScopedImport = [&](ArrayRef<ModuleDecl::AccessPathTy> paths) {
207-
for (auto path : paths) {
208-
if (path.empty())
209-
continue;
210-
if (ModuleDecl::matchesAccessPath(path, name))
211-
return true;
212-
}
213-
214-
return false;
215-
};
216-
217196
for (unsigned secondIdx : range(firstIdx + 1, decls.size())) {
218197
// Determine whether one module takes precedence over another.
219198
auto secondDecl = decls[secondIdx];
@@ -227,28 +206,22 @@ static void recordShadowedDeclsAfterSignatureMatch(
227206
if (firstModule != secondModule &&
228207
firstDecl->getDeclContext()->isModuleScopeContext() &&
229208
secondDecl->getDeclContext()->isModuleScopeContext()) {
230-
auto firstPaths = imports.getAllAccessPathsNotShadowedBy(
231-
firstModule, secondModule, dc);
232-
auto secondPaths = imports.getAllAccessPathsNotShadowedBy(
233-
secondModule, firstModule, dc);
234-
235-
// Check if one module shadows the other.
236-
if (isShadowed(firstPaths)) {
209+
// First, scoped imports shadow unscoped imports.
210+
bool firstScoped = imports.isScopedImport(firstModule, name, dc);
211+
bool secondScoped = imports.isScopedImport(secondModule, name, dc);
212+
if (!firstScoped && secondScoped) {
237213
shadowed.insert(firstDecl);
238214
break;
239-
} else if (isShadowed(secondPaths)) {
215+
} else if (firstScoped && !secondScoped) {
240216
shadowed.insert(secondDecl);
241217
continue;
242218
}
243219

244-
// We might be in a situation where neither module shadows the
245-
// other, but one declaration is visible via a scoped import.
246-
bool firstScoped = isScopedImport(firstPaths);
247-
bool secondScoped = isScopedImport(secondPaths);
248-
if (!firstScoped && secondScoped) {
220+
// Now check if one module shadows the other.
221+
if (imports.isShadowedBy(firstModule, secondModule, name, dc)) {
249222
shadowed.insert(firstDecl);
250223
break;
251-
} else if (firstScoped && !secondScoped) {
224+
} else if (imports.isShadowedBy(secondModule, firstModule, name, dc)) {
252225
shadowed.insert(secondDecl);
253226
continue;
254227
}
@@ -305,16 +278,10 @@ static void recordShadowedDeclsAfterSignatureMatch(
305278
if (firstModule != secondModule &&
306279
!firstDecl->getDeclContext()->isModuleScopeContext() &&
307280
!secondDecl->getDeclContext()->isModuleScopeContext()) {
308-
auto firstPaths = imports.getAllAccessPathsNotShadowedBy(
309-
firstModule, secondModule, dc);
310-
auto secondPaths = imports.getAllAccessPathsNotShadowedBy(
311-
secondModule, firstModule, dc);
312-
313-
// Check if one module shadows the other.
314-
if (isShadowed(firstPaths)) {
281+
if (imports.isShadowedBy(firstModule, secondModule, dc)) {
315282
shadowed.insert(firstDecl);
316283
break;
317-
} else if (isShadowed(secondPaths)) {
284+
} else if (imports.isShadowedBy(secondModule, firstModule, dc)) {
318285
shadowed.insert(secondDecl);
319286
continue;
320287
}

branches/tensorflow/lib/AST/Type.cpp

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1479,11 +1479,7 @@ bool TypeBase::isExactSuperclassOf(Type ty) {
14791479
ty->getSuperclass()->getAnyNominal()->hasClangNode())))
14801480
return false;
14811481

1482-
SmallPtrSet<ClassDecl *, 8> seen;
14831482
do {
1484-
if (auto *classDecl = ty->getClassOrBoundGenericClass())
1485-
if (!seen.insert(classDecl).second)
1486-
return false;
14871483
if (ty->isEqual(this))
14881484
return true;
14891485
} while ((ty = ty->getSuperclass()));
@@ -1514,10 +1510,6 @@ bool TypeBase::isBindableTo(Type b) {
15141510
if (orig->requiresClass() && !subst->satisfiesClassConstraint())
15151511
return false;
15161512

1517-
if (auto superclass = orig->getSuperclass())
1518-
if (!superclass->isBindableToSuperclassOf(subst))
1519-
return false;
1520-
15211513
// TODO: If the archetype has a superclass constraint, check that the
15221514
// substitution is a subclass.
15231515

@@ -1536,7 +1528,7 @@ bool TypeBase::isBindableTo(Type b) {
15361528
if (CanType(orig) == subst)
15371529
return true;
15381530

1539-
return false;
1531+
llvm_unreachable("not a valid canonical type substitution");
15401532
}
15411533

15421534
bool visitNominalType(NominalType *nom, CanType subst) {
@@ -1588,20 +1580,17 @@ bool TypeBase::isBindableTo(Type b) {
15881580
}
15891581

15901582
bool visitDependentMemberType(DependentMemberType *dt, CanType subst) {
1591-
return true;
1583+
llvm_unreachable("can't visit dependent types");
15921584
}
15931585
bool visitGenericTypeParamType(GenericTypeParamType *dt, CanType subst) {
1594-
return true;
1586+
llvm_unreachable("can't visit dependent types");
15951587
}
15961588

15971589
bool visitFunctionType(FunctionType *func, CanType subst) {
15981590
if (auto substFunc = dyn_cast<FunctionType>(subst)) {
15991591
if (func->getExtInfo() != substFunc->getExtInfo())
16001592
return false;
16011593

1602-
if (func->getParams().size() != substFunc->getParams().size())
1603-
return false;
1604-
16051594
for (unsigned i : indices(func->getParams())) {
16061595
if (!visit(func->getParams()[i].getOldType(),
16071596
substFunc.getParams()[i].getOldType()))
@@ -1719,13 +1708,20 @@ bool TypeBase::isBindableToSuperclassOf(Type ty) {
17191708
if (!ty->mayHaveSuperclass())
17201709
return false;
17211710

1722-
SmallPtrSet<ClassDecl *, 8> seen;
1711+
// If the type is itself an archetype, we could always potentially bind it
1712+
// to the superclass (via external retroactive conformance, even if the
1713+
// type isn't statically known to conform).
1714+
//
1715+
// We could theoretically reject cases where the set of conformances is known
1716+
// (say the protocol or classes are private or internal).
1717+
if (is<ArchetypeType>())
1718+
return true;
1719+
17231720
do {
1724-
if (auto *classDecl = ty->getClassOrBoundGenericClass())
1725-
if (!seen.insert(classDecl).second)
1726-
return false;
17271721
if (isBindableTo(ty))
17281722
return true;
1723+
if (ty->getAnyNominal() && ty->getAnyNominal()->isInvalid())
1724+
return false;
17291725
} while ((ty = ty->getSuperclass()));
17301726
return false;
17311727
}

0 commit comments

Comments
 (0)