Skip to content

Commit 10f10ec

Browse files
authored
---
yaml --- r: 275447 b: refs/heads/master-next c: 666457b h: refs/heads/master i: 275445: c9331c5 275443: e901b04 275439: 2f97917
1 parent d52bd38 commit 10f10ec

File tree

147 files changed

+5255
-1895
lines changed

Some content is hidden

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

147 files changed

+5255
-1895
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
refs/heads/master: 65b3164726f2e62dff31e90a5cb5e3fb67cc82bf
3-
refs/heads/master-next: 04770f6124fef4adae5b86bc4dc4650585b0a44e
3+
refs/heads/master-next: 666457bc276f62cace2e9bad73f094786c6451fa
44
refs/tags/osx-passed: b6b74147ef8a386f532cf9357a1bde006e552c54
55
refs/tags/swift-2.2-SNAPSHOT-2015-12-01-a: 6bb18e013c2284f2b45f5f84f2df2887dc0f7dea
66
refs/tags/swift-2.2-SNAPSHOT-2015-12-01-b: 66d897bfcf64a82cb9a87f5e663d889189d06d07

branches/master-next/CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ CHANGELOG
66

77
| Contents |
88
| :--------------------- |
9+
| [Swift 5.1](#swift-51) |
910
| [Swift 5.0](#swift-50) |
1011
| [Swift 4.2](#swift-42) |
1112
| [Swift 4.1](#swift-41) |
@@ -26,6 +27,17 @@ Swift 5.1
2627

2728
* Key path expressions can now include references to tuple elements.
2829

30+
* Single-parameter functions accepting values of type `Any` are no
31+
longer preferred over other functions.
32+
33+
```swift
34+
func foo(_: Any) { print("Any") }
35+
func foo<T>(_: T) { print("T") }
36+
foo(0) // prints "Any" in Swift < 5.1, "T" in Swift 5.1
37+
```
38+
39+
**Add new entries to the top of this section, not here!**
40+
2941
Swift 5.0
3042
---------
3143

branches/master-next/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -235,8 +235,8 @@ option(SWIFT_RUNTIME_CRASH_REPORTER_CLIENT
235235
FALSE)
236236

237237
option(SWIFT_DARWIN_ENABLE_STABLE_ABI_BIT
238-
"Enable the Swift stable ABI's class marker bit"
239-
FALSE)
238+
"Enable the Swift stable ABI's class marker bit for new deployment targets"
239+
TRUE)
240240

241241
set(SWIFT_DARWIN_XCRUN_TOOLCHAIN "XcodeDefault" CACHE STRING
242242
"The name of the toolchain to pass to 'xcrun'")

branches/master-next/cmake/modules/SwiftSource.cmake

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ function(_compile_swift_files
262262
if (SWIFTFILE_IS_STDLIB)
263263
list(APPEND swift_flags "-swift-version" "5")
264264
endif()
265-
265+
266266
# Force swift 4 compatibility mode for overlays.
267267
if (SWIFTFILE_IS_SDK_OVERLAY)
268268
list(APPEND swift_flags "-swift-version" "4")
@@ -344,16 +344,11 @@ function(_compile_swift_files
344344
list(APPEND module_outputs "${interface_file}")
345345
endif()
346346

347-
set(optional_arg)
348-
if(sdk IN_LIST SWIFT_APPLE_PLATFORMS)
349-
# Allow installation of stdlib without building all variants on Darwin.
350-
set(optional_arg "OPTIONAL")
351-
endif()
352-
353347
if(SWIFTFILE_SDK IN_LIST SWIFT_APPLE_PLATFORMS)
354348
swift_install_in_component("${SWIFTFILE_INSTALL_IN_COMPONENT}"
355349
DIRECTORY "${specific_module_dir}"
356-
DESTINATION "lib${LLVM_LIBDIR_SUFFIX}/swift/${library_subdir}")
350+
DESTINATION "lib${LLVM_LIBDIR_SUFFIX}/swift/${library_subdir}"
351+
OPTIONAL)
357352
else()
358353
swift_install_in_component("${SWIFTFILE_INSTALL_IN_COMPONENT}"
359354
FILES ${module_outputs}
@@ -439,7 +434,7 @@ function(_compile_swift_files
439434
set(file_path "${CMAKE_CURRENT_BINARY_DIR}/${file_name}.txt")
440435
string(REPLACE ";" "'\n'" source_files_quoted "${source_files}")
441436
file(WRITE "${file_path}" "'${source_files_quoted}'")
442-
437+
443438
# If this platform/architecture combo supports backward deployment to old
444439
# Objective-C runtimes, we need to copy a YAML file with legacy type layout
445440
# information to the build directory so that the compiler can find it.

branches/master-next/docs/SIL.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4311,7 +4311,7 @@ open_existential_addr
43114311
// type P
43124312
// $*@opened P must be a unique archetype that refers to an opened
43134313
// existential type P.
4314-
// %1 will be of type $*P
4314+
// %1 will be of type $*@opened P
43154315

43164316
Obtains the address of the concrete value inside the existential
43174317
container referenced by ``%0``. The protocol conformances associated
@@ -4334,7 +4334,7 @@ open_existential_value
43344334
// type P
43354335
// $@opened P must be a unique archetype that refers to an opened
43364336
// existential type P.
4337-
// %1 will be of type $P
4337+
// %1 will be of type $@opened P
43384338

43394339
Loadable version of the above: Opens-up the existential
43404340
container associated with ``%0``. The protocol conformances associated

branches/master-next/include/swift/ABI/Metadata.h

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1192,6 +1192,31 @@ struct TargetClassMetadata : public TargetAnyClassMetadata<Runtime> {
11921192
return bounds;
11931193
}
11941194

1195+
/// Given a statically-emitted metadata template, this sets the correct
1196+
/// "is Swift" bit for the current runtime. Depending on the deployment
1197+
/// target a binary was compiled for, statically emitted metadata templates
1198+
/// may have a different bit set from the one that this runtime canonically
1199+
/// considers the "is Swift" bit.
1200+
void setAsTypeMetadata() {
1201+
// If the wrong "is Swift" bit is set, set the correct one.
1202+
//
1203+
// Note that the only time we should see the "new" bit set while
1204+
// expecting the "old" one is when running a binary built for a
1205+
// new OS on an old OS, which is not supported, however we do
1206+
// have tests that exercise this scenario.
1207+
auto otherSwiftBit = (3ULL - SWIFT_CLASS_IS_SWIFT_MASK);
1208+
assert(otherSwiftBit == 1ULL || otherSwiftBit == 2ULL);
1209+
1210+
if ((this->Data & 3) == otherSwiftBit) {
1211+
this->Data ^= 3;
1212+
}
1213+
1214+
// Otherwise there should be nothing to do, since only the old "is
1215+
// Swift" bit is used for backward-deployed runtimes.
1216+
1217+
assert(isTypeMetadata());
1218+
}
1219+
11951220
static bool classof(const TargetMetadata<Runtime> *metadata) {
11961221
return metadata->getKind() == MetadataKind::Class;
11971222
}

branches/master-next/include/swift/AST/DiagnosticsSema.def

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -901,6 +901,8 @@ WARNING(is_expr_same_type,none,
901901
"'!= nil'?", (Type, Type))
902902
WARNING(downcast_to_unrelated,none,
903903
"cast from %0 to unrelated type %1 always fails", (Type, Type))
904+
NOTE(downcast_to_unrelated_fixit,none,
905+
"did you mean to call %0 with '()'?", (Identifier))
904906
ERROR(downcast_to_more_optional,none,
905907
"cannot downcast from %0 to a more optional type %1",
906908
(Type, Type))

branches/master-next/include/swift/AST/GenericSignatureBuilder.h

Lines changed: 4 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -935,11 +935,6 @@ class GenericSignatureBuilder::RequirementSource final
935935
AssociatedTypeDecl,
936936
};
937937

938-
/// Cache DependentMemberType results instead of calling
939-
/// DependentMemberType::get(). The much smaller hash table is more
940-
/// processor cache efficient.
941-
mutable llvm::DenseMap<Type, Type> ReplacedSelfCache;
942-
943938
/// The kind of storage we have.
944939
const StorageKind storageKind;
945940

@@ -959,9 +954,8 @@ class GenericSignatureBuilder::RequirementSource final
959954
/// A protocol conformance used to satisfy the requirement.
960955
void *conformance;
961956

962-
/// A precomputed dependent member of an associated type to which a
963-
/// requirement is being applied.
964-
DependentMemberType *dependentMember;
957+
/// An associated type to which a requirement is being applied.
958+
AssociatedTypeDecl *assocType;
965959
} storage;
966960

967961
friend TrailingObjects;
@@ -1099,8 +1093,7 @@ class GenericSignatureBuilder::RequirementSource final
10991093
assert(isAcceptableStorageKind(kind, storageKind) &&
11001094
"RequirementSource kind/storageKind mismatch");
11011095

1102-
auto ty = assocType->getDeclaredInterfaceType();
1103-
storage.dependentMember = cast<DependentMemberType>(ty.getPointer());
1096+
storage.assocType = assocType;
11041097
}
11051098

11061099
RequirementSource(Kind kind, const RequirementSource *parent)
@@ -1322,18 +1315,11 @@ class GenericSignatureBuilder::RequirementSource final
13221315
return ProtocolConformanceRef::getFromOpaqueValue(storage.conformance);
13231316
}
13241317

1325-
/// Retrieve the precomputed dependent member for the associated type
1326-
/// declaration for this requirement, if there is one.
1327-
DependentMemberType *getDependentMember() const {
1328-
if (storageKind != StorageKind::AssociatedTypeDecl) return nullptr;
1329-
return storage.dependentMember;
1330-
}
1331-
13321318
/// Retrieve the associated type declaration for this requirement, if there
13331319
/// is one.
13341320
AssociatedTypeDecl *getAssociatedType() const {
13351321
if (storageKind != StorageKind::AssociatedTypeDecl) return nullptr;
1336-
return storage.dependentMember->getAssocType();
1322+
return storage.assocType;
13371323
}
13381324

13391325
/// Profiling support for \c FoldingSet.
@@ -1572,11 +1558,6 @@ class GenericSignatureBuilder::PotentialArchetype {
15721558
/// that share a name.
15731559
llvm::MapVector<Identifier, StoredNestedType> NestedTypes;
15741560

1575-
/// Cache DependentMemberType results instead of calling
1576-
/// DependentMemberType::get(). The much smaller hash table is more
1577-
/// processor cache efficient.
1578-
mutable llvm::DenseMap<Type, DependentMemberType*> CachedDMTs;
1579-
15801561
/// Construct a new potential archetype for a concrete declaration.
15811562
PotentialArchetype(PotentialArchetype *parent, AssociatedTypeDecl *assocType)
15821563
: parentOrContext(parent), identifier(assocType) {
@@ -1616,14 +1597,6 @@ class GenericSignatureBuilder::PotentialArchetype {
16161597
return identifier.assocType;
16171598
}
16181599

1619-
/// Retrieve the type declaration to which this nested type was resolved.
1620-
DependentMemberType *getResolvedDependentMemberType(Type Parent) const {
1621-
auto *&known = CachedDMTs[Parent];
1622-
if (!known)
1623-
known = DependentMemberType::get(Parent, getResolvedType());
1624-
return known;
1625-
}
1626-
16271600
/// Determine whether this is a generic parameter.
16281601
bool isGenericParam() const {
16291602
return parentOrContext.is<ASTContext *>();

branches/master-next/include/swift/AST/Types.h

Lines changed: 4 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2241,7 +2241,7 @@ class NominalType : public NominalOrBoundGenericNominalType {
22412241
DEFINE_EMPTY_CAN_TYPE_WRAPPER(NominalType, NominalOrBoundGenericNominalType)
22422242

22432243
/// EnumType - This represents the type declared by an EnumDecl.
2244-
class EnumType : public NominalType, public llvm::FoldingSetNode {
2244+
class EnumType : public NominalType {
22452245
public:
22462246
/// getDecl() - Returns the decl which declares this type.
22472247
EnumDecl *getDecl() const {
@@ -2252,11 +2252,6 @@ class EnumType : public NominalType, public llvm::FoldingSetNode {
22522252
/// declaration in the parent type \c Parent.
22532253
static EnumType *get(EnumDecl *D, Type Parent, const ASTContext &C);
22542254

2255-
void Profile(llvm::FoldingSetNodeID &ID) {
2256-
Profile(ID, getDecl(), getParent());
2257-
}
2258-
static void Profile(llvm::FoldingSetNodeID &ID, EnumDecl *D, Type Parent);
2259-
22602255
// Implement isa/cast/dyncast/etc.
22612256
static bool classof(const TypeBase *T) {
22622257
return T->getKind() == TypeKind::Enum;
@@ -2269,7 +2264,7 @@ class EnumType : public NominalType, public llvm::FoldingSetNode {
22692264
DEFINE_EMPTY_CAN_TYPE_WRAPPER(EnumType, NominalType)
22702265

22712266
/// StructType - This represents the type declared by a StructDecl.
2272-
class StructType : public NominalType, public llvm::FoldingSetNode {
2267+
class StructType : public NominalType {
22732268
public:
22742269
/// getDecl() - Returns the decl which declares this type.
22752270
StructDecl *getDecl() const {
@@ -2280,11 +2275,6 @@ class StructType : public NominalType, public llvm::FoldingSetNode {
22802275
/// declaration in the parent type \c Parent.
22812276
static StructType *get(StructDecl *D, Type Parent, const ASTContext &C);
22822277

2283-
void Profile(llvm::FoldingSetNodeID &ID) {
2284-
Profile(ID, getDecl(), getParent());
2285-
}
2286-
static void Profile(llvm::FoldingSetNodeID &ID, StructDecl *D, Type Parent);
2287-
22882278
// Implement isa/cast/dyncast/etc.
22892279
static bool classof(const TypeBase *T) {
22902280
return T->getKind() == TypeKind::Struct;
@@ -2297,7 +2287,7 @@ class StructType : public NominalType, public llvm::FoldingSetNode {
22972287
DEFINE_EMPTY_CAN_TYPE_WRAPPER(StructType, NominalType)
22982288

22992289
/// ClassType - This represents the type declared by a ClassDecl.
2300-
class ClassType : public NominalType, public llvm::FoldingSetNode {
2290+
class ClassType : public NominalType {
23012291
public:
23022292
/// getDecl() - Returns the decl which declares this type.
23032293
ClassDecl *getDecl() const {
@@ -2308,11 +2298,6 @@ class ClassType : public NominalType, public llvm::FoldingSetNode {
23082298
/// declaration in the parent type \c Parent.
23092299
static ClassType *get(ClassDecl *D, Type Parent, const ASTContext &C);
23102300

2311-
void Profile(llvm::FoldingSetNodeID &ID) {
2312-
Profile(ID, getDecl(), getParent());
2313-
}
2314-
static void Profile(llvm::FoldingSetNodeID &ID, ClassDecl *D, Type Parent);
2315-
23162301
// Implement isa/cast/dyncast/etc.
23172302
static bool classof(const TypeBase *T) {
23182303
return T->getKind() == TypeKind::Class;
@@ -4343,7 +4328,7 @@ class DictionaryType : public SyntaxSugarType {
43434328

43444329
/// ProtocolType - A protocol type describes an abstract interface implemented
43454330
/// by another type.
4346-
class ProtocolType : public NominalType, public llvm::FoldingSetNode {
4331+
class ProtocolType : public NominalType {
43474332
public:
43484333
/// Retrieve the type when we're referencing the given protocol.
43494334
/// declaration.
@@ -4376,11 +4361,6 @@ class ProtocolType : public NominalType, public llvm::FoldingSetNode {
43764361
static bool visitAllProtocols(ArrayRef<ProtocolDecl *> protocols,
43774362
llvm::function_ref<bool(ProtocolDecl *)> fn);
43784363

4379-
void Profile(llvm::FoldingSetNodeID &ID) {
4380-
Profile(ID, getDecl(), getParent());
4381-
}
4382-
static void Profile(llvm::FoldingSetNodeID &ID, ProtocolDecl *D, Type Parent);
4383-
43844364
private:
43854365
friend class NominalTypeDecl;
43864366
ProtocolType(ProtocolDecl *TheDecl, Type Parent, const ASTContext &Ctx,

branches/master-next/include/swift/Basic/Mangler.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,14 @@ class Mangler {
7878
}
7979
};
8080

81+
void addSubstWordsInIdent(const WordReplacement &repl) {
82+
SubstWordsInIdent.push_back(repl);
83+
}
84+
85+
void addWord(const SubstitutionWord &word) {
86+
Words.push_back(word);
87+
}
88+
8189
/// Returns the buffer as a StringRef, needed by mangleIdentifier().
8290
StringRef getBufferStr() const {
8391
return StringRef(Storage.data(), Storage.size());

branches/master-next/include/swift/Demangling/Demangle.h

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -490,23 +490,23 @@ void mangleIdentifier(const char *data, size_t length,
490490
bool usePunycode = true);
491491

492492
/// Remangle a demangled parse tree.
493-
///
494-
/// If \p BorrowFrom is specified, the initial bump pointer memory is
495-
/// borrowed from the free memory of BorrowFrom.
496-
std::string mangleNode(NodePointer root,
497-
NodeFactory *BorrowFrom = nullptr);
493+
std::string mangleNode(NodePointer root);
498494

499495
using SymbolicResolver =
500496
llvm::function_ref<Demangle::NodePointer (SymbolicReferenceKind,
501497
const void *)>;
502498

499+
/// Remangle a demangled parse tree, using a callback to resolve
500+
/// symbolic references.
501+
std::string mangleNode(NodePointer root, SymbolicResolver resolver);
502+
503503
/// Remangle a demangled parse tree, using a callback to resolve
504504
/// symbolic references.
505505
///
506-
/// If \p BorrowFrom is specified, the initial bump pointer memory is
507-
/// borrowed from the free memory of BorrowFrom.
508-
std::string mangleNode(NodePointer root, SymbolicResolver resolver,
509-
NodeFactory *BorrowFrom = nullptr);
506+
/// The returned string is owned by \p Factory. This means \p Factory must stay
507+
/// alive as long as the returned string is used.
508+
llvm::StringRef mangleNode(NodePointer root, SymbolicResolver resolver,
509+
NodeFactory &Factory);
510510

511511
/// Remangle in the old mangling scheme.
512512
///

branches/master-next/include/swift/Demangling/Demangler.h

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,11 @@ template<typename T> class Vector {
279279
Capacity = 0;
280280
Elems = 0;
281281
}
282-
282+
283+
void clear() {
284+
NumElems = 0;
285+
}
286+
283287
iterator begin() { return Elems; }
284288
iterator end() { return Elems + NumElems; }
285289

@@ -299,6 +303,11 @@ template<typename T> class Vector {
299303

300304
T &back() { return (*this)[NumElems - 1]; }
301305

306+
void resetSize(size_t toPos) {
307+
assert(toPos <= NumElems);
308+
NumElems = toPos;
309+
}
310+
302311
void push_back(const T &NewElem, NodeFactory &Factory) {
303312
if (NumElems >= Capacity)
304313
Factory.Reallocate(Elems, Capacity, /*Growth*/ 1);
@@ -327,6 +336,9 @@ class CharVector : public Vector<char> {
327336
// Append an integer as readable number.
328337
void append(int Number, NodeFactory &Factory);
329338

339+
// Append an unsigned 64 bit integer as readable number.
340+
void append(unsigned long long Number, NodeFactory &Factory);
341+
330342
StringRef str() const {
331343
return StringRef(Elems, NumElems);
332344
}

0 commit comments

Comments
 (0)