Skip to content

Commit 1faa598

Browse files
authored
---
yaml --- r: 340342 b: refs/heads/rxwei-patch-1 c: 7beb358 h: refs/heads/master
1 parent 6f5213e commit 1faa598

File tree

190 files changed

+1905
-736
lines changed

Some content is hidden

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

190 files changed

+1905
-736
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: fe32ba1a8657da03ed0b8c1e777bd5cf29f58726
1018+
refs/heads/rxwei-patch-1: 7beb3585d5edfc24e945afca513c24205e7a47a5
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/CMakeLists.txt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,17 @@ option(SWIFT_STDLIB_ENABLE_SIB_TARGETS
223223
"Should we generate sib targets for the stdlib or not?"
224224
FALSE)
225225

226+
227+
set(SWIFT_DARWIN_SUPPORTED_ARCHS "" CACHE STRING
228+
"Semicolon-separated list of architectures to configure on Darwin platforms. \
229+
If left empty all default architectures are configured.")
230+
231+
set(SWIFT_DARWIN_MODULE_ARCHS "" CACHE STRING
232+
"Semicolon-separated list of architectures to configure Swift module-only \
233+
targets on Darwin platforms. These targets are in addition to the full \
234+
library targets.")
235+
236+
226237
#
227238
# User-configurable Android specific options.
228239
#

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

Lines changed: 80 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,11 @@ function(_add_variant_c_compile_flags)
303303
"-fcoverage-mapping")
304304
endif()
305305

306+
if((CFLAGS_ARCH STREQUAL "armv7" OR CFLAGS_ARCH STREQUAL "aarch64") AND
307+
(CFLAGS_SDK STREQUAL "LINUX" OR CFLAGS_SDK STREQUAL "ANDROID"))
308+
list(APPEND result -funwind-tables)
309+
endif()
310+
306311
if("${CFLAGS_SDK}" STREQUAL "ANDROID")
307312
swift_android_libcxx_include_paths(CFLAGS_CXX_INCLUDES)
308313
swift_android_include_for_arch("${CFLAGS_ARCH}" "${CFLAGS_ARCH}_INCLUDE")
@@ -927,6 +932,17 @@ function(_add_swift_library_single target name)
927932
endif()
928933
endif()
929934

935+
# Only build the modules for any arch listed in the *_MODULE_ARCHITECTURES.
936+
if(SWIFTLIB_SINGLE_SDK IN_LIST SWIFT_APPLE_PLATFORMS
937+
AND SWIFTLIB_SINGLE_ARCHITECTURE IN_LIST SWIFT_SDK_${SWIFTLIB_SINGLE_SDK}_MODULE_ARCHITECTURES)
938+
# Create dummy target to hook up the module target dependency.
939+
add_custom_target("${target}"
940+
DEPENDS
941+
"${swift_module_dependency_target}")
942+
943+
return()
944+
endif()
945+
930946
set(SWIFTLIB_INCORPORATED_OBJECT_LIBRARIES_EXPRESSIONS)
931947
foreach(object_library ${SWIFTLIB_SINGLE_INCORPORATE_OBJECT_LIBRARIES})
932948
list(APPEND SWIFTLIB_INCORPORATED_OBJECT_LIBRARIES_EXPRESSIONS
@@ -1846,8 +1862,13 @@ function(add_swift_target_library name)
18461862
list(APPEND swiftlib_link_flags_all "-Wl,-z,defs")
18471863
endif()
18481864

1865+
set(sdk_supported_archs
1866+
${SWIFT_SDK_${sdk}_ARCHITECTURES}
1867+
${SWIFT_SDK_${sdk}_MODULE_ARCHITECTURES})
1868+
list(REMOVE_DUPLICATES sdk_supported_archs)
1869+
18491870
# For each architecture supported by this SDK
1850-
foreach(arch ${SWIFT_SDK_${sdk}_ARCHITECTURES})
1871+
foreach(arch ${sdk_supported_archs})
18511872
# Configure variables for this subdirectory.
18521873
set(VARIANT_SUFFIX "-${SWIFT_SDK_${sdk}_LIB_SUBDIR}-${arch}")
18531874
set(VARIANT_NAME "${name}${VARIANT_SUFFIX}")
@@ -1969,11 +1990,38 @@ function(add_swift_target_library name)
19691990
endforeach()
19701991
endif()
19711992

1972-
# Note this thin library.
1973-
list(APPEND THIN_INPUT_TARGETS ${VARIANT_NAME})
1993+
if(arch IN_LIST SWIFT_SDK_${sdk}_ARCHITECTURES)
1994+
# Note this thin library.
1995+
list(APPEND THIN_INPUT_TARGETS ${VARIANT_NAME})
1996+
endif()
19741997
endif()
19751998
endforeach()
19761999

2000+
# Configure module-only targets
2001+
if(NOT SWIFT_SDK_${sdk}_ARCHITECTURES
2002+
AND SWIFT_SDK_${sdk}_MODULE_ARCHITECTURES)
2003+
set(_target "${name}-${SWIFT_SDK_${sdk}_LIB_SUBDIR}")
2004+
2005+
# Create unified sdk target
2006+
add_custom_target("${_target}")
2007+
2008+
foreach(_arch ${SWIFT_SDK_${sdk}_MODULE_ARCHITECTURES})
2009+
set(_variant_suffix "-${SWIFT_SDK_${sdk}_LIB_SUBDIR}-${_arch}")
2010+
set(_module_variant_name "${name}-swiftmodule-${_variant_suffix}")
2011+
2012+
add_dependencies("${_target}" ${_module_variant_name})
2013+
2014+
# Add Swift standard library targets as dependencies to the top-level
2015+
# convenience target.
2016+
if(TARGET "swift-stdlib${_variant_suffix}")
2017+
add_dependencies("swift-stdlib${_variant_suffix}"
2018+
"${_target}")
2019+
endif()
2020+
endforeach()
2021+
2022+
return()
2023+
endif()
2024+
19772025
if(NOT SWIFTLIB_OBJECT_LIBRARY)
19782026
# Determine the name of the universal library.
19792027
if(SWIFTLIB_SHARED)
@@ -2064,12 +2112,35 @@ function(add_swift_target_library name)
20642112
endforeach()
20652113
endif()
20662114

2067-
swift_is_installing_component("${SWIFTLIB_INSTALL_IN_COMPONENT}" is_installing)
2068-
if(NOT is_installing)
2069-
set_property(GLOBAL APPEND PROPERTY SWIFT_BUILDTREE_EXPORTS ${VARIANT_NAME})
2070-
else()
2071-
set_property(GLOBAL APPEND PROPERTY SWIFT_EXPORTS ${VARIANT_NAME})
2072-
endif()
2115+
swift_is_installing_component(
2116+
"${SWIFTLIB_INSTALL_IN_COMPONENT}"
2117+
is_installing)
2118+
2119+
# Add the arch-specific library targets to the global exports.
2120+
foreach(arch ${SWIFT_SDK_${sdk}_ARCHITECTURES})
2121+
set(_variant_name "${name}-${SWIFT_SDK_${sdk}_LIB_SUBDIR}-${arch}")
2122+
if(NOT TARGET "${_variant_name}")
2123+
continue()
2124+
endif()
2125+
2126+
if(is_installing)
2127+
set_property(GLOBAL APPEND
2128+
PROPERTY SWIFT_EXPORTS ${_variant_name})
2129+
else()
2130+
set_property(GLOBAL APPEND
2131+
PROPERTY SWIFT_BUILDTREE_EXPORTS ${_variant_name})
2132+
endif()
2133+
endforeach()
2134+
2135+
# Add the swiftmodule-only targets to the lipo target depdencies.
2136+
foreach(arch ${SWIFT_SDK_${sdk}_MODULE_ARCHITECTURES})
2137+
set(_variant_name "${name}-${SWIFT_SDK_${sdk}_LIB_SUBDIR}-${arch}")
2138+
if(NOT TARGET "${_variant_name}")
2139+
continue()
2140+
endif()
2141+
2142+
add_dependencies("${lipo_target}" "${_variant_name}")
2143+
endforeach()
20732144

20742145
# If we built static variants of the library, create a lipo target for
20752146
# them.

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,16 @@ option(SWIFT_ENABLE_PARSEABLE_MODULE_INTERFACES
6565
set(SWIFT_STDLIB_BUILD_TYPE "${CMAKE_BUILD_TYPE}" CACHE STRING
6666
"Build type for the Swift standard library and SDK overlays.")
6767

68+
set(SWIFT_DARWIN_SUPPORTED_ARCHS "" CACHE STRING
69+
"Semicolon-separated list of architectures to configure on Darwin platforms. \
70+
If left empty all default architectures are configured.")
71+
72+
set(SWIFT_DARWIN_MODULE_ARCHS "" CACHE STRING
73+
"Semicolon-separated list of architectures to configure Swift module-only \
74+
targets on Darwin platforms. These targets are in addition to the full \
75+
library targets.")
76+
77+
6878
# -----------------------------------------------------------------------------
6979
# Constants
7080

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

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@ function(_report_sdk prefix)
5151
message(STATUS " Triple name: ${SWIFT_SDK_${prefix}_TRIPLE_NAME}")
5252
endif()
5353
message(STATUS " Architectures: ${SWIFT_SDK_${prefix}_ARCHITECTURES}")
54+
if(SWIFT_SDK_${prefix}_MODULE_ARCHITECTURES)
55+
message(STATUS " Module Architectures: ${SWIFT_SDK_${prefix}_MODULE_ARCHITECTURES}")
56+
endif()
5457
if(NOT prefix IN_LIST SWIFT_APPLE_PLATFORMS)
5558
if(SWIFT_BUILD_STDLIB)
5659
foreach(arch ${SWIFT_SDK_${prefix}_ARCHITECTURES})
@@ -141,9 +144,30 @@ macro(configure_sdk_darwin
141144
set(SWIFT_SDK_${prefix}_LIB_SUBDIR "${xcrun_name}")
142145
set(SWIFT_SDK_${prefix}_VERSION_MIN_NAME "${version_min_name}")
143146
set(SWIFT_SDK_${prefix}_TRIPLE_NAME "${triple_name}")
144-
set(SWIFT_SDK_${prefix}_ARCHITECTURES "${architectures}")
145147
set(SWIFT_SDK_${prefix}_OBJECT_FORMAT "MACHO")
146148

149+
set(SWIFT_SDK_${prefix}_ARCHITECTURES ${architectures})
150+
if(SWIFT_DARWIN_SUPPORTED_ARCHS)
151+
list_intersect(
152+
"${architectures}" # lhs
153+
"${SWIFT_DARWIN_SUPPORTED_ARCHS}" # rhs
154+
SWIFT_SDK_${prefix}_ARCHITECTURES) # result
155+
endif()
156+
157+
list_intersect(
158+
"${SWIFT_DARWIN_MODULE_ARCHS}" # lhs
159+
"${architectures}" # rhs
160+
SWIFT_SDK_${prefix}_MODULE_ARCHITECTURES) # result
161+
162+
# Ensure the architectures and module-only architectures lists are mutually
163+
# exclusive.
164+
list_subtract(
165+
"${SWIFT_SDK_${prefix}_MODULE_ARCHITECTURES}" # lhs
166+
"${SWIFT_SDK_${prefix}_ARCHITECTURES}" # rhs
167+
SWIFT_SDK_${prefix}_MODULE_ARCHITECTURES) # result
168+
169+
# Configure variables for _all_ architectures even if we aren't "building"
170+
# them because they aren't supported.
147171
foreach(arch ${architectures})
148172
# On Darwin, all archs share the same SDK path.
149173
set(SWIFT_SDK_${prefix}_ARCH_${arch}_PATH "${SWIFT_SDK_${prefix}_PATH}")

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

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -553,7 +553,7 @@ class alignas(1 << DeclAlignInBits) Decl {
553553
NumRequirementsInSignature : 16
554554
);
555555

556-
SWIFT_INLINE_BITFIELD(ClassDecl, NominalTypeDecl, 1+2+1+2+1+6+1+1+1,
556+
SWIFT_INLINE_BITFIELD(ClassDecl, NominalTypeDecl, 1+2+1+2+1+6+1+1+1+1,
557557
/// Whether this class requires all of its instance variables to
558558
/// have in-class initializers.
559559
RequiresStoredPropertyInits : 1,
@@ -581,7 +581,11 @@ class alignas(1 << DeclAlignInBits) Decl {
581581
AncestryComputed : 1,
582582

583583
HasMissingDesignatedInitializers : 1,
584-
HasMissingVTableEntries : 1
584+
HasMissingVTableEntries : 1,
585+
586+
/// Whether instances of this class are incompatible
587+
/// with weak and unowned references.
588+
IsIncompatibleWithWeakReferences : 1
585589
);
586590

587591
SWIFT_INLINE_BITFIELD(StructDecl, NominalTypeDecl, 1,
@@ -3860,6 +3864,17 @@ class ClassDecl final : public NominalTypeDecl {
38603864
Bits.ClassDecl.HasMissingVTableEntries = newValue;
38613865
}
38623866

3867+
/// Returns true if this class cannot be used with weak or unowned
3868+
/// references.
3869+
///
3870+
/// Note that this is true if this class or any of its ancestor classes
3871+
/// are marked incompatible.
3872+
bool isIncompatibleWithWeakReferences() const;
3873+
3874+
void setIsIncompatibleWithWeakReferences(bool newValue = true) {
3875+
Bits.ClassDecl.IsIncompatibleWithWeakReferences = newValue;
3876+
}
3877+
38633878
/// Find a method of a class that overrides a given method.
38643879
/// Return nullptr, if no such method exists.
38653880
AbstractFunctionDecl *findOverridingDecl(

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

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2538,6 +2538,12 @@ NOTE(decodable_suggest_overriding_init_here,none,
25382538
NOTE(codable_suggest_overriding_init_here,none,
25392539
"did you mean to override 'init(from:)' and 'encode(to:)'?", ())
25402540

2541+
NOTE(missing_member_type_conformance_prevents_synthesis, none,
2542+
"%select{associated value|stored property}0 type %1 does not conform to "
2543+
"protocol %2, preventing synthesized conformance "
2544+
"of %3 to %2",
2545+
(unsigned, Type, Type, Type))
2546+
25412547
// Dynamic Self
25422548
ERROR(dynamic_self_non_method,none,
25432549
"%select{global|local}0 function cannot return 'Self'", (bool))
@@ -3150,7 +3156,7 @@ ERROR(jump_out_of_defer,none,
31503156
(StringRef))
31513157

31523158
WARNING(defer_stmt_at_block_end,none,
3153-
"'defer' statement before end of scope always executes immediately; "
3159+
"'defer' statement at end of scope always executes immediately; "
31543160
"replace with 'do' statement to silence this warning", ())
31553161

31563162
ERROR(return_invalid_outside_func,none,
@@ -3565,6 +3571,9 @@ ERROR(invalid_ownership_protocol_type,none,
35653571
"%0 must not be applied to non-class-bound %1; "
35663572
"consider adding a protocol conformance that has a class bound",
35673573
(ReferenceOwnership, Type))
3574+
ERROR(invalid_ownership_incompatible_class,none,
3575+
"%0 is incompatible with %1 references",
3576+
(Type, ReferenceOwnership))
35683577
ERROR(invalid_ownership_with_optional,none,
35693578
"%0 variable cannot have optional type", (ReferenceOwnership))
35703579
ERROR(invalid_ownership_not_optional,none,

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1135,6 +1135,7 @@ class ObjectLiteralExpr final
11351135
Expr *Arg;
11361136
Expr *SemanticExpr;
11371137
SourceLoc PoundLoc;
1138+
ConcreteDeclRef Initializer;
11381139

11391140
ObjectLiteralExpr(SourceLoc PoundLoc, LiteralKind LitKind,
11401141
Expr *Arg,
@@ -1195,6 +1196,15 @@ class ObjectLiteralExpr final
11951196

11961197
StringRef getLiteralKindPlainName() const;
11971198

1199+
/// Retrieve the initializer that will be used to construct the 'object'
1200+
/// literal from the result of the initializer.
1201+
ConcreteDeclRef getInitializer() const { return Initializer; }
1202+
1203+
/// Set the initializer that will be used to construct the 'object' literal.
1204+
void setInitializer(ConcreteDeclRef initializer) {
1205+
Initializer = initializer;
1206+
}
1207+
11981208
static bool classof(const Expr *E) {
11991209
return E->getKind() == ExprKind::ObjectLiteral;
12001210
}

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ IDENTIFIER(Any)
3131
IDENTIFIER(ArrayLiteralElement)
3232
IDENTIFIER(atIndexedSubscript)
3333
IDENTIFIER_(bridgeToObjectiveC)
34+
IDENTIFIER(Change)
3435
IDENTIFIER_WITH_NAME(code_, "_code")
3536
IDENTIFIER(CodingKeys)
3637
IDENTIFIER(combine)

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ KNOWN_STDLIB_TYPE_DECL(Array, NominalTypeDecl, 1)
5454
KNOWN_STDLIB_TYPE_DECL(Set, NominalTypeDecl, 1)
5555
KNOWN_STDLIB_TYPE_DECL(Sequence, NominalTypeDecl, 1)
5656
KNOWN_STDLIB_TYPE_DECL(Dictionary, NominalTypeDecl, 2)
57+
KNOWN_STDLIB_TYPE_DECL(CollectionDifference, NominalTypeDecl, 1)
5758
KNOWN_STDLIB_TYPE_DECL(AnyHashable, NominalTypeDecl, 0)
5859
KNOWN_STDLIB_TYPE_DECL(MutableCollection, ProtocolDecl, 1)
5960
KNOWN_STDLIB_TYPE_DECL(Hasher, NominalTypeDecl, 0)

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,8 @@ class alignas(ParamDecl *) ParameterList final :
9797

9898
const ParamDecl *operator[](unsigned i) const { return get(i); }
9999
ParamDecl *&operator[](unsigned i) { return get(i); }
100-
100+
bool hasInternalParameter(StringRef prefix) const;
101+
101102
/// Change the DeclContext of any contained parameters to the specified
102103
/// DeclContext.
103104
void setDeclContextOfParamDecls(DeclContext *DC);

branches/rxwei-patch-1/include/swift/SIL/SILBuilder.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1279,6 +1279,13 @@ class SILBuilder {
12791279
return createUncheckedEnumData(Loc, Operand, Element, EltType);
12801280
}
12811281

1282+
/// Return unchecked_enum_data %Operand, #Optional<T>.some.
1283+
SILValue emitExtractOptionalPayloadOperation(SILLocation Loc,
1284+
SILValue Operand) {
1285+
auto *Decl = F->getASTContext().getOptionalSomeDecl();
1286+
return createUncheckedEnumData(Loc, Operand, Decl);
1287+
}
1288+
12821289
UncheckedTakeEnumDataAddrInst *
12831290
createUncheckedTakeEnumDataAddr(SILLocation Loc, SILValue Operand,
12841291
EnumElementDecl *Element, SILType Ty) {

0 commit comments

Comments
 (0)