Skip to content

Commit d52bd38

Browse files
committed
---
yaml --- r: 275446 b: refs/heads/master-next c: 04770f6 h: refs/heads/master
1 parent c9331c5 commit d52bd38

File tree

150 files changed

+1917
-5257
lines changed

Some content is hidden

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

150 files changed

+1917
-5257
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: 74d1322a727ac903bf518fa79fdab5221bb3274c
3+
refs/heads/master-next: 04770f6124fef4adae5b86bc4dc4650585b0a44e
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: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ CHANGELOG
66

77
| Contents |
88
| :--------------------- |
9-
| [Swift 5.1](#swift-51) |
109
| [Swift 5.0](#swift-50) |
1110
| [Swift 4.2](#swift-42) |
1211
| [Swift 4.1](#swift-41) |
@@ -27,17 +26,6 @@ Swift 5.1
2726

2827
* Key path expressions can now include references to tuple elements.
2928

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-
4129
Swift 5.0
4230
---------
4331

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 for new deployment targets"
239-
TRUE)
238+
"Enable the Swift stable ABI's class marker bit"
239+
FALSE)
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: 9 additions & 4 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,11 +344,16 @@ 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+
347353
if(SWIFTFILE_SDK IN_LIST SWIFT_APPLE_PLATFORMS)
348354
swift_install_in_component("${SWIFTFILE_INSTALL_IN_COMPONENT}"
349355
DIRECTORY "${specific_module_dir}"
350-
DESTINATION "lib${LLVM_LIBDIR_SUFFIX}/swift/${library_subdir}"
351-
OPTIONAL)
356+
DESTINATION "lib${LLVM_LIBDIR_SUFFIX}/swift/${library_subdir}")
352357
else()
353358
swift_install_in_component("${SWIFTFILE_INSTALL_IN_COMPONENT}"
354359
FILES ${module_outputs}
@@ -434,7 +439,7 @@ function(_compile_swift_files
434439
set(file_path "${CMAKE_CURRENT_BINARY_DIR}/${file_name}.txt")
435440
string(REPLACE ";" "'\n'" source_files_quoted "${source_files}")
436441
file(WRITE "${file_path}" "'${source_files_quoted}'")
437-
442+
438443
# If this platform/architecture combo supports backward deployment to old
439444
# Objective-C runtimes, we need to copy a YAML file with legacy type layout
440445
# 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 $*@opened P
4314+
// %1 will be of type $*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 $@opened P
4337+
// %1 will be of type $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: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1192,31 +1192,6 @@ 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-
12201195
static bool classof(const TargetMetadata<Runtime> *metadata) {
12211196
return metadata->getKind() == MetadataKind::Class;
12221197
}

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -901,8 +901,6 @@ 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))
906904
ERROR(downcast_to_more_optional,none,
907905
"cannot downcast from %0 to a more optional type %1",
908906
(Type, Type))

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

Lines changed: 31 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -935,6 +935,11 @@ 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+
938943
/// The kind of storage we have.
939944
const StorageKind storageKind;
940945

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

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

961967
friend TrailingObjects;
@@ -1093,7 +1099,8 @@ class GenericSignatureBuilder::RequirementSource final
10931099
assert(isAcceptableStorageKind(kind, storageKind) &&
10941100
"RequirementSource kind/storageKind mismatch");
10951101

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

10991106
RequirementSource(Kind kind, const RequirementSource *parent)
@@ -1315,11 +1322,18 @@ class GenericSignatureBuilder::RequirementSource final
13151322
return ProtocolConformanceRef::getFromOpaqueValue(storage.conformance);
13161323
}
13171324

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+
13181332
/// Retrieve the associated type declaration for this requirement, if there
13191333
/// is one.
13201334
AssociatedTypeDecl *getAssociatedType() const {
13211335
if (storageKind != StorageKind::AssociatedTypeDecl) return nullptr;
1322-
return storage.assocType;
1336+
return storage.dependentMember->getAssocType();
13231337
}
13241338

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

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+
15611580
/// Construct a new potential archetype for a concrete declaration.
15621581
PotentialArchetype(PotentialArchetype *parent, AssociatedTypeDecl *assocType)
15631582
: parentOrContext(parent), identifier(assocType) {
@@ -1597,6 +1616,14 @@ class GenericSignatureBuilder::PotentialArchetype {
15971616
return identifier.assocType;
15981617
}
15991618

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+
16001627
/// Determine whether this is a generic parameter.
16011628
bool isGenericParam() const {
16021629
return parentOrContext.is<ASTContext *>();

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

Lines changed: 24 additions & 4 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 {
2244+
class EnumType : public NominalType, public llvm::FoldingSetNode {
22452245
public:
22462246
/// getDecl() - Returns the decl which declares this type.
22472247
EnumDecl *getDecl() const {
@@ -2252,6 +2252,11 @@ class EnumType : public NominalType {
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+
22552260
// Implement isa/cast/dyncast/etc.
22562261
static bool classof(const TypeBase *T) {
22572262
return T->getKind() == TypeKind::Enum;
@@ -2264,7 +2269,7 @@ class EnumType : public NominalType {
22642269
DEFINE_EMPTY_CAN_TYPE_WRAPPER(EnumType, NominalType)
22652270

22662271
/// StructType - This represents the type declared by a StructDecl.
2267-
class StructType : public NominalType {
2272+
class StructType : public NominalType, public llvm::FoldingSetNode {
22682273
public:
22692274
/// getDecl() - Returns the decl which declares this type.
22702275
StructDecl *getDecl() const {
@@ -2275,6 +2280,11 @@ class StructType : public NominalType {
22752280
/// declaration in the parent type \c Parent.
22762281
static StructType *get(StructDecl *D, Type Parent, const ASTContext &C);
22772282

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

22892299
/// ClassType - This represents the type declared by a ClassDecl.
2290-
class ClassType : public NominalType {
2300+
class ClassType : public NominalType, public llvm::FoldingSetNode {
22912301
public:
22922302
/// getDecl() - Returns the decl which declares this type.
22932303
ClassDecl *getDecl() const {
@@ -2298,6 +2308,11 @@ class ClassType : public NominalType {
22982308
/// declaration in the parent type \c Parent.
22992309
static ClassType *get(ClassDecl *D, Type Parent, const ASTContext &C);
23002310

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

43294344
/// ProtocolType - A protocol type describes an abstract interface implemented
43304345
/// by another type.
4331-
class ProtocolType : public NominalType {
4346+
class ProtocolType : public NominalType, public llvm::FoldingSetNode {
43324347
public:
43334348
/// Retrieve the type when we're referencing the given protocol.
43344349
/// declaration.
@@ -4361,6 +4376,11 @@ class ProtocolType : public NominalType {
43614376
static bool visitAllProtocols(ArrayRef<ProtocolDecl *> protocols,
43624377
llvm::function_ref<bool(ProtocolDecl *)> fn);
43634378

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

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

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -78,14 +78,6 @@ 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-
8981
/// Returns the buffer as a StringRef, needed by mangleIdentifier().
9082
StringRef getBufferStr() const {
9183
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-
std::string mangleNode(NodePointer root);
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);
494498

495499
using SymbolicResolver =
496500
llvm::function_ref<Demangle::NodePointer (SymbolicReferenceKind,
497501
const void *)>;
498502

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-
/// 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);
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);
510510

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

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

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

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

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

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

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

0 commit comments

Comments
 (0)