Skip to content

Commit 48a4a91

Browse files
authored
---
yaml --- r: 294319 b: refs/heads/tensorflow c: 2587df2 h: refs/heads/master i: 294317: 0fbde4d 294315: 0abb9cd 294311: fb54ae5 294303: 28d06ba
1 parent 64ffd84 commit 48a4a91

Some content is hidden

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

41 files changed

+1117
-500
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: b67b45aae68e55c2361f77d915412ea0169a94a5
819+
refs/heads/tensorflow: 2587df23337284d9b3744c158dc94468bd790ffe
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/benchmark/single-source/SetTests.swift

Lines changed: 559 additions & 2 deletions
Large diffs are not rendered by default.

branches/tensorflow/cmake/modules/StandaloneOverlay.cmake

Lines changed: 85 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -3,46 +3,97 @@
33
# a top-level build of the CMAKE_SOURCE_DIR. Otherwise, define a guard variable
44
# and return.
55
if(DEFINED SWIFT_MASTER_LOADED
6-
OR NOT ${CMAKE_CURRENT_SOURCE_DIR} STREQUAL ${CMAKE_SOURCE_DIR})
6+
OR NOT CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
77
set(SWIFT_MASTER_LOADED TRUE)
88
return()
99
endif()
1010

11-
set(CMAKE_INSTALL_PREFIX "${SWIFT_DEST_ROOT}${TOOLCHAIN_DIR}/usr")
1211

13-
set(SWIFT_STDLIB_BUILD_TYPE "Release" CACHE STRING
14-
"Build type for the Swift standard library and SDK overlays [Debug, RelWithDebInfo, Release, MinSizeRel]")
12+
# -----------------------------------------------------------------------------
13+
# Preconditions
14+
15+
include(SwiftUtils)
16+
17+
precondition(CMAKE_INSTALL_PREFIX)
18+
precondition(SWIFT_DEST_ROOT)
19+
precondition(SWIFT_HOST_VARIANT_SDK)
20+
precondition(SWIFT_SOURCE_ROOT)
21+
precondition(TOOLCHAIN_DIR)
22+
23+
24+
# -----------------------------------------------------------------------------
25+
# Cache Variables and Options
26+
27+
set(SWIFT_SOURCE_DIR "${SWIFT_SOURCE_ROOT}/swift" CACHE PATH
28+
"Path to the directory containing the Swift sources.")
29+
30+
set(SWIFT_DARWIN_XCRUN_TOOLCHAIN "XcodeDefault" CACHE STRING
31+
"The name of the toolchain to pass to 'xcrun'.")
32+
33+
set(SWIFT_DARWIN_DEPLOYMENT_VERSION_OSX "10.9" CACHE STRING
34+
"Minimum deployment target version for macOS.")
35+
set(SWIFT_DARWIN_DEPLOYMENT_VERSION_IOS "7.0" CACHE STRING
36+
"Minimum deployment target version for iOS.")
37+
set(SWIFT_DARWIN_DEPLOYMENT_VERSION_TVOS "9.0" CACHE STRING
38+
"Minimum deployment target version for tvOS.")
39+
set(SWIFT_DARWIN_DEPLOYMENT_VERSION_WATCHOS "2.0" CACHE STRING
40+
"Minimum deployment target version for watchOS.")
41+
42+
set(SWIFT_INSTALL_COMPONENTS "sdk-overlay" CACHE STRING
43+
"A semicolon-separated list of install components.")
44+
45+
set(SWIFT_SDKS "${SWIFT_HOST_VARIANT_SDK}" CACHE STRING
46+
"List of Swift SDKs to build.")
47+
48+
set(SWIFT_NATIVE_LLVM_TOOLS_PATH "${TOOLCHAIN_DIR}/usr/bin" CACHE STRING
49+
"Path to LLVM tools that are executable on the build machine.")
50+
set(SWIFT_NATIVE_CLANG_TOOLS_PATH "${TOOLCHAIN_DIR}/usr/bin" CACHE STRING
51+
"Path to Clang tools that are executable on the build machine.")
52+
set(SWIFT_NATIVE_SWIFT_TOOLS_PATH "${TOOLCHAIN_DIR}/usr/bin" CACHE STRING
53+
"Path to Swift tools that are executable on the build machine.")
54+
55+
option(SWIFT_ENABLE_PARSEABLE_MODULE_INTERFACES
56+
"Generate .swiftinterface files alongside .swiftmodule files."
57+
TRUE)
58+
59+
set(SWIFT_STDLIB_BUILD_TYPE "${CMAKE_BUILD_TYPE}" CACHE STRING
60+
"Build type for the Swift standard library and SDK overlays.")
61+
1562
set_property(CACHE SWIFT_STDLIB_BUILD_TYPE PROPERTY
16-
STRINGS "Debug" "RelWithDebInfo" "Release" "MinSizeRel")
63+
STRINGS
64+
"Debug" "RelWithDebInfo" "Release" "MinSizeRel")
1765

18-
# Only happens if it's called from a top-level cmake invocation.
19-
set(BUILD_STANDALONE TRUE)
20-
set(SWIFT_SDK_OVERLAY_LIBRARY_BUILD_TYPES "SHARED")
21-
set(SWIFT_INSTALL_COMPONENTS "sdk-overlay" CACHE STRING "")
22-
set(SWIFT_DARWIN_DEPLOYMENT_VERSION_OSX "10.9" CACHE STRING "")
23-
set(SWIFT_DARWIN_DEPLOYMENT_VERSION_IOS "7.0" CACHE STRING "")
24-
set(SWIFT_DARWIN_DEPLOYMENT_VERSION_TVOS "9.0" CACHE STRING "")
25-
set(SWIFT_DARWIN_DEPLOYMENT_VERSION_WATCHOS "2.0" CACHE STRING "")
26-
set(SWIFT_ENABLE_PARSEABLE_MODULE_INTERFACES TRUE)
66+
# -----------------------------------------------------------------------------
67+
# Constants
2768

28-
set(SWIFT_SOURCE_DIR "${SWIFT_SOURCE_ROOT}/swift" CACHE PATH "")
29-
set(SWIFT_NATIVE_SWIFT_TOOLS_PATH "${TOOLCHAIN_DIR}/usr/bin" CACHE PATH "")
30-
set(SWIFT_SDKS ${SWIFT_HOST_VARIANT_SDK})
69+
set(CMAKE_INSTALL_PREFIX
70+
"${SWIFT_DEST_ROOT}${TOOLCHAIN_DIR}/usr")
3171

3272
list(APPEND CMAKE_MODULE_PATH
3373
"${SWIFT_SOURCE_ROOT}/llvm/cmake/modules"
34-
"${PROJECT_SOURCE_DIR}/../../../../cmake/modules")
74+
"${PROJECT_SOURCE_DIR}/../../../../cmake/modules"
75+
"${PROJECT_SOURCE_DIR}/../../../cmake/modules")
3576

36-
set(SWIFT_DARWIN_XCRUN_TOOLCHAIN "XcodeDefault" CACHE STRING
37-
"The name of the toolchain to pass to 'xcrun'")
77+
78+
set(SWIFT_APPLE_PLATFORMS
79+
OSX IOS IOS_SIMULATOR TVOS TVOS_SIMULATOR WATCHOS WATCHOS_SIMULATOR)
80+
81+
# Flags used to indicate we are building a standalone overlay.
82+
# FIXME: We should cut this down to a single flag.
83+
set(BUILD_STANDALONE TRUE)
84+
set(SWIFT_BUILD_STANDALONE_OVERLAY TRUE)
85+
86+
set(SWIFT_SDK_OVERLAY_LIBRARY_BUILD_TYPES "SHARED")
87+
88+
89+
# -----------------------------------------------------------------------------
3890

3991
include(SwiftToolchainUtils)
4092
if(NOT SWIFT_LIPO)
4193
find_toolchain_tool(SWIFT_LIPO "${SWIFT_DARWIN_XCRUN_TOOLCHAIN}" lipo)
4294
endif()
4395

4496
include(AddLLVM)
45-
include(SwiftUtils)
4697
include(SwiftSharedCMakeConfig)
4798
include(AddSwift)
4899
include(SwiftHandleGybSources)
@@ -51,25 +102,22 @@ include(SwiftSource)
51102
include(SwiftComponents)
52103
include(DarwinSDKs)
53104

54-
# These variables should be passed as -D variables to cmake.
55-
# e.g. cmake -G Ninja -DSWIFT_HOST_VARIANT_SDK=OSX ..
56-
precondition(CMAKE_INSTALL_PREFIX)
57-
precondition(SWIFT_SOURCE_ROOT)
58-
precondition(SWIFT_DEST_ROOT)
59-
precondition(SWIFT_HOST_VARIANT_SDK)
60-
precondition(TOOLCHAIN_DIR)
61105

62106
# Without this line, installing components is broken. This needs refactoring.
63107
swift_configure_components()
64108

65-
# Some overlays include the runtime's headers,
66-
# and some of those headers are generated at build time.
67-
add_subdirectory("${SWIFT_SOURCE_DIR}/include" "${SWIFT_SOURCE_DIR}/include")
68-
add_subdirectory("${SWIFT_SOURCE_DIR}/apinotes" "${SWIFT_SOURCE_DIR}/apinotes")
69109

70-
precondition(unknown_sdks NEGATE MESSAGE "Unknown SDKs: ${unknown_sdks}")
71-
precondition(SWIFT_CONFIGURED_SDKS MESSAGE "No SDKs selected.")
72-
precondition(SWIFT_HOST_VARIANT_SDK MESSAGE "No SDK for host tools.")
110+
list_subtract(
111+
"${SWIFT_SDKS}"
112+
"${SWIFT_CONFIGURED_SDKS}"
113+
unknown_sdks)
114+
115+
precondition(unknown_sdks NEGATE
116+
MESSAGE
117+
"Unknown SDKs: ${unknown_sdks}")
118+
73119

74-
# ARCH is set somewhere later.
75-
#precondition(SWIFT_HOST_VARIANT_ARCH MESSAGE "No arch for host tools")
120+
# Some overlays include the runtime's headers, and some of those headers are
121+
# generated at build time.
122+
add_subdirectory("${SWIFT_SOURCE_DIR}/include" "${SWIFT_SOURCE_DIR}/include")
123+
add_subdirectory("${SWIFT_SOURCE_DIR}/apinotes" "${SWIFT_SOURCE_DIR}/apinotes")

branches/tensorflow/docs/LibraryEvolution.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1106,7 +1106,7 @@ Possible Restrictions on Classes
11061106
--------------------------------
11071107

11081108
In addition to ``final``, it may be useful to restrict the stored properties of
1109-
a class instance, like `Fixed-Contents Structs`_. However, there are open
1109+
a class instance, like `Frozen Structs`_. However, there are open
11101110
questions about how this would actually work, and the compiler still wouldn't
11111111
be able to make much use of the information, because classes from other
11121112
libraries must almost always be allocated on the heap.

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5323,6 +5323,8 @@ class ParamDecl : public VarDecl {
53235323

53245324
SourceRange getSourceRange() const;
53255325

5326+
AnyFunctionType::Param toFunctionParam(Type type = Type()) const;
5327+
53265328
// Implement isa/cast/dyncast/etc.
53275329
static bool classof(const Decl *D) {
53285330
return D->getKind() == DeclKind::Param;

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ KNOWN_STDLIB_TYPE_DECL(Float, NominalTypeDecl, 0)
4545
KNOWN_STDLIB_TYPE_DECL(Double, NominalTypeDecl, 0)
4646
KNOWN_STDLIB_TYPE_DECL(Float80, NominalTypeDecl, 0)
4747

48+
KNOWN_STDLIB_TYPE_DECL(_MaxBuiltinFloatType, TypeAliasDecl, 0)
49+
4850
KNOWN_STDLIB_TYPE_DECL(String, NominalTypeDecl, 0)
4951
KNOWN_STDLIB_TYPE_DECL(Substring, NominalTypeDecl, 0)
5052
KNOWN_STDLIB_TYPE_DECL(Array, NominalTypeDecl, 1)

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

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -127,12 +127,6 @@ class alignas(ParamDecl *) ParameterList final :
127127
/// based on the interface types of the parameters in this list.
128128
void getParams(SmallVectorImpl<AnyFunctionType::Param> &params) const;
129129

130-
/// Return a list of function parameters for this parameter list,
131-
/// based on types provided by a callback.
132-
void getParams(SmallVectorImpl<AnyFunctionType::Param> &params,
133-
llvm::function_ref<Type(ParamDecl *)> getType) const;
134-
135-
136130
/// Return the full source range of this parameter.
137131
SourceRange getSourceRange() const;
138132
SourceLoc getStartLoc() const { return getSourceRange().Start; }

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

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,7 @@ class ProtocolConformanceRef {
138138
static Type
139139
getTypeWitnessByName(Type type,
140140
ProtocolConformanceRef conformance,
141-
Identifier name,
142-
LazyResolver *resolver);
141+
Identifier name);
143142

144143
/// Determine whether this conformance is canonical.
145144
bool isCanonical() const;
@@ -154,11 +153,6 @@ class ProtocolConformanceRef {
154153
/// Get any additional requirements that are required for this conformance to
155154
/// be satisfied.
156155
ArrayRef<Requirement> getConditionalRequirements() const;
157-
158-
/// If this is a conformance reference for a protocol that inherits other
159-
/// protocols, get a reference to the related conformance for the inherited
160-
/// protocol.
161-
ProtocolConformanceRef getInheritedConformanceRef(ProtocolDecl *base) const;
162156
};
163157

164158
} // end namespace swift

branches/tensorflow/lib/AST/ASTContext.cpp

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4225,13 +4225,8 @@ Type ASTContext::getBridgedToObjC(const DeclContext *dc, Type type,
42254225
*bridgedValueType = type;
42264226

42274227
// Find the Objective-C class type we bridge to.
4228-
if (conformance->isConcrete()) {
4229-
return ProtocolConformanceRef::getTypeWitnessByName(
4230-
type, *conformance, Id_ObjectiveCType,
4231-
getLazyResolver());
4232-
} else {
4233-
return type->castTo<ArchetypeType>()->getNestedType(Id_ObjectiveCType);
4234-
}
4228+
return ProtocolConformanceRef::getTypeWitnessByName(
4229+
type, *conformance, Id_ObjectiveCType);
42354230
}
42364231

42374232
// Do we conform to Error?

branches/tensorflow/lib/AST/Decl.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5673,6 +5673,21 @@ Type ParamDecl::getVarargBaseTy(Type VarArgT) {
56735673
return T;
56745674
}
56755675

5676+
AnyFunctionType::Param ParamDecl::toFunctionParam(Type type) const {
5677+
if (!type)
5678+
type = getInterfaceType();
5679+
5680+
if (isVariadic())
5681+
type = ParamDecl::getVarargBaseTy(type);
5682+
5683+
auto label = getArgumentName();
5684+
auto flags = ParameterTypeFlags::fromParameterType(type,
5685+
isVariadic(),
5686+
isAutoClosure(),
5687+
getValueOwnership());
5688+
return AnyFunctionType::Param(type, label, flags);
5689+
}
5690+
56765691
void ParamDecl::setDefaultValue(Expr *E) {
56775692
if (!DefaultValueAndFlags.getPointer()) {
56785693
if (!E) return;

branches/tensorflow/lib/AST/GenericSignatureBuilder.cpp

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2057,13 +2057,6 @@ TypeDecl *EquivalenceClass::lookupNestedType(
20572057
!= proto->getParentModule())
20582058
continue;
20592059

2060-
// Resolve the signature of this type.
2061-
if (!type->hasInterfaceType()) {
2062-
type->getASTContext().getLazyResolver()->resolveDeclSignature(type);
2063-
if (!type->hasInterfaceType())
2064-
continue;
2065-
}
2066-
20672060
concreteDecls.push_back(type);
20682061
continue;
20692062
}

branches/tensorflow/lib/AST/Parameter.cpp

Lines changed: 2 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -89,29 +89,8 @@ ParameterList *ParameterList::clone(const ASTContext &C,
8989

9090
void ParameterList::getParams(
9191
SmallVectorImpl<AnyFunctionType::Param> &params) const {
92-
getParams(params,
93-
[](ParamDecl *decl) { return decl->getInterfaceType(); });
94-
}
95-
96-
void ParameterList::getParams(
97-
SmallVectorImpl<AnyFunctionType::Param> &params,
98-
llvm::function_ref<Type(ParamDecl *)> getType) const {
99-
if (size() == 0)
100-
return;
101-
102-
for (auto P : *this) {
103-
auto type = getType(P);
104-
105-
if (P->isVariadic())
106-
type = ParamDecl::getVarargBaseTy(type);
107-
108-
auto label = P->getArgumentName();
109-
auto flags = ParameterTypeFlags::fromParameterType(type,
110-
P->isVariadic(),
111-
P->isAutoClosure(),
112-
P->getValueOwnership());
113-
params.emplace_back(type, label, flags);
114-
}
92+
for (auto P : *this)
93+
params.push_back(P->toFunctionParam());
11594
}
11695

11796

branches/tensorflow/lib/AST/ProtocolConformance.cpp

Lines changed: 5 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -144,13 +144,13 @@ ProtocolConformanceRef::subst(Type origType,
144144
Type
145145
ProtocolConformanceRef::getTypeWitnessByName(Type type,
146146
ProtocolConformanceRef conformance,
147-
Identifier name,
148-
LazyResolver *resolver) {
147+
Identifier name) {
149148
assert(!conformance.isInvalid());
150149

151150
// Find the named requirement.
151+
ProtocolDecl *proto = conformance.getRequirement();
152152
AssociatedTypeDecl *assocType = nullptr;
153-
auto members = conformance.getRequirement()->lookupDirect(name);
153+
auto members = proto->lookupDirect(name);
154154
for (auto member : members) {
155155
assocType = dyn_cast<AssociatedTypeDecl>(member);
156156
if (assocType)
@@ -161,21 +161,8 @@ ProtocolConformanceRef::getTypeWitnessByName(Type type,
161161
if (!assocType)
162162
return nullptr;
163163

164-
if (conformance.isAbstract()) {
165-
// For an archetype, retrieve the nested type with the appropriate
166-
// name. There are no conformance tables.
167-
if (auto archetype = type->getAs<ArchetypeType>()) {
168-
return archetype->getNestedType(name);
169-
}
170-
171-
return DependentMemberType::get(type, assocType);
172-
}
173-
174-
auto concrete = conformance.getConcrete();
175-
if (!concrete->hasTypeWitness(assocType, resolver)) {
176-
return nullptr;
177-
}
178-
return concrete->getTypeWitness(assocType, resolver);
164+
return assocType->getDeclaredInterfaceType().subst(
165+
SubstitutionMap::getProtocolSubstitutions(proto, type, conformance));
179166
}
180167

181168
void *ProtocolConformance::operator new(size_t bytes, ASTContext &context,
@@ -500,37 +487,6 @@ ProtocolConformanceRef::getConditionalRequirements() const {
500487
return {};
501488
}
502489

503-
ProtocolConformanceRef
504-
ProtocolConformanceRef::getInheritedConformanceRef(ProtocolDecl *base) const {
505-
if (isAbstract()) {
506-
assert(getRequirement()->inheritsFrom(base));
507-
return ProtocolConformanceRef(base);
508-
}
509-
510-
auto concrete = getConcrete();
511-
auto proto = concrete->getProtocol();
512-
auto path =
513-
proto->getGenericSignature()->getConformanceAccessPath(
514-
proto->getSelfInterfaceType(), base);
515-
ProtocolConformanceRef result = *this;
516-
Type resultType = concrete->getType();
517-
bool first = true;
518-
for (const auto &step : path) {
519-
if (first) {
520-
assert(step.first->isEqual(proto->getSelfInterfaceType()));
521-
assert(step.second == proto);
522-
first = false;
523-
continue;
524-
}
525-
526-
result =
527-
result.getAssociatedConformance(resultType, step.first, step.second);
528-
resultType = result.getAssociatedType(resultType, step.first);
529-
}
530-
531-
return result;
532-
}
533-
534490
void NormalProtocolConformance::differenceAndStoreConditionalRequirements()
535491
const {
536492
switch (CRState) {

0 commit comments

Comments
 (0)